linkshell-cli 0.3.5 → 0.3.6

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.
@@ -38,6 +38,7 @@ export declare class AgentWorkspaceProxy {
38
38
  private ensureProviderClient;
39
39
  private refreshProviderCapabilities;
40
40
  private syncProviderSessions;
41
+ private upsertProviderSessions;
41
42
  private sendCapabilities;
42
43
  private openConversation;
43
44
  private openFailure;
@@ -5,6 +5,8 @@ import { createEnvelope, parseTypedPayload, } from "@linkshell/protocol";
5
5
  import { AcpClient } from "./acp-client.js";
6
6
  import { ClaudeSdkClient } from "./claude-sdk-client.js";
7
7
  import { ClaudeStreamJsonClient } from "./claude-stream-json-client.js";
8
+ import { listClaudeStoredSessions } from "./claude-sessions.js";
9
+ import { listCodexStoredSessions } from "./codex-sessions.js";
8
10
  import { resolveAgentCommand } from "./provider-resolver.js";
9
11
  const PERMISSION_TIMEOUT_MS = 5 * 60_000;
10
12
  const MAX_TIMELINE_ITEMS = 200;
@@ -1181,36 +1183,12 @@ export class AgentWorkspaceProxy {
1181
1183
  }
1182
1184
  async syncProviderSessions() {
1183
1185
  await this.initialize();
1186
+ this.upsertProviderSessions("codex", listCodexStoredSessions(this.input.cwd));
1187
+ this.upsertProviderSessions("claude", listClaudeStoredSessions(this.input.cwd));
1184
1188
  for (const [provider, client] of this.clients) {
1185
1189
  try {
1186
1190
  const result = await client.listSessions();
1187
- for (const remote of parseRemoteSessions(result)) {
1188
- const agentSessionId = remote.id;
1189
- const existingId = this.conversationByAgentSessionId.get(agentSessionId);
1190
- const now = Date.now();
1191
- const conversationId = existingId ?? `agent:${agentSessionId}`;
1192
- const existing = this.conversations.get(conversationId);
1193
- const cwd = remote.cwd ?? existing?.cwd ?? this.input.cwd;
1194
- const conversation = {
1195
- id: conversationId,
1196
- agentSessionId,
1197
- provider,
1198
- cwd,
1199
- title: remote.title ?? existing?.title ?? titleFromCwd(cwd),
1200
- model: remote.model ?? existing?.model,
1201
- reasoningEffort: existing?.reasoningEffort,
1202
- permissionMode: existing?.permissionMode,
1203
- collaborationMode: existing?.collaborationMode,
1204
- status: existing?.status ?? "idle",
1205
- archived: existing?.archived ?? false,
1206
- lastMessagePreview: existing?.lastMessagePreview,
1207
- lastActivityAt: remote.lastActivityAt ?? existing?.lastActivityAt ?? now,
1208
- createdAt: remote.createdAt ?? existing?.createdAt ?? now,
1209
- };
1210
- this.conversations.set(conversation.id, conversation);
1211
- this.conversationByAgentSessionId.set(agentSessionId, conversation.id);
1212
- this.timelines.set(conversation.id, this.timelines.get(conversation.id) ?? []);
1213
- }
1191
+ this.upsertProviderSessions(provider, result);
1214
1192
  }
1215
1193
  catch (error) {
1216
1194
  if (this.input.verbose) {
@@ -1219,6 +1197,35 @@ export class AgentWorkspaceProxy {
1219
1197
  }
1220
1198
  }
1221
1199
  }
1200
+ upsertProviderSessions(provider, result) {
1201
+ for (const remote of parseRemoteSessions(result)) {
1202
+ const agentSessionId = remote.id;
1203
+ const existingId = this.conversationByAgentSessionId.get(agentSessionId);
1204
+ const now = Date.now();
1205
+ const conversationId = existingId ?? `agent:${agentSessionId}`;
1206
+ const existing = this.conversations.get(conversationId);
1207
+ const cwd = remote.cwd ?? existing?.cwd ?? this.input.cwd;
1208
+ const conversation = {
1209
+ id: conversationId,
1210
+ agentSessionId,
1211
+ provider,
1212
+ cwd,
1213
+ title: remote.title ?? existing?.title ?? titleFromCwd(cwd),
1214
+ model: remote.model ?? existing?.model,
1215
+ reasoningEffort: existing?.reasoningEffort,
1216
+ permissionMode: existing?.permissionMode,
1217
+ collaborationMode: existing?.collaborationMode,
1218
+ status: existing?.status ?? "idle",
1219
+ archived: existing?.archived ?? false,
1220
+ lastMessagePreview: existing?.lastMessagePreview,
1221
+ lastActivityAt: remote.lastActivityAt ?? existing?.lastActivityAt ?? now,
1222
+ createdAt: remote.createdAt ?? existing?.createdAt ?? now,
1223
+ };
1224
+ this.conversations.set(conversation.id, conversation);
1225
+ this.conversationByAgentSessionId.set(agentSessionId, conversation.id);
1226
+ this.timelines.set(conversation.id, this.timelines.get(conversation.id) ?? []);
1227
+ }
1228
+ }
1222
1229
  sendCapabilities() {
1223
1230
  const providers = this.input.availableProviders.map((provider) => {
1224
1231
  const client = this.clients.get(provider);