linkshell-cli 0.3.6 → 0.3.7

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.
@@ -1163,6 +1163,7 @@ function parseRemoteSessions(value: unknown): Array<{
1163
1163
  model?: string;
1164
1164
  createdAt?: number;
1165
1165
  lastActivityAt?: number;
1166
+ archived?: boolean;
1166
1167
  }> {
1167
1168
  const raw = asRecord(value);
1168
1169
  const sessionsValue =
@@ -1178,6 +1179,7 @@ function parseRemoteSessions(value: unknown): Array<{
1178
1179
  model?: string;
1179
1180
  createdAt?: number;
1180
1181
  lastActivityAt?: number;
1182
+ archived?: boolean;
1181
1183
  }> = [];
1182
1184
  for (const entry of sessionsValue) {
1183
1185
  const session = asRecord(entry);
@@ -1196,6 +1198,7 @@ function parseRemoteSessions(value: unknown): Array<{
1196
1198
  model: firstString(source, ["model", "modelId"]),
1197
1199
  createdAt: parseTimestamp(source.createdAt ?? source.created_at),
1198
1200
  lastActivityAt: parseTimestamp(source.lastActivityAt ?? source.updatedAt ?? source.modifiedAt ?? source.lastModified ?? source.updated_at),
1201
+ archived: typeof source.archived === "boolean" ? source.archived : undefined,
1199
1202
  });
1200
1203
  }
1201
1204
  return result;
@@ -1472,7 +1475,7 @@ export class AgentWorkspaceProxy {
1472
1475
  permissionMode: existing?.permissionMode,
1473
1476
  collaborationMode: existing?.collaborationMode,
1474
1477
  status: existing?.status ?? "idle",
1475
- archived: existing?.archived ?? false,
1478
+ archived: remote.archived ?? existing?.archived ?? false,
1476
1479
  lastMessagePreview: existing?.lastMessagePreview,
1477
1480
  lastActivityAt: remote.lastActivityAt ?? existing?.lastActivityAt ?? now,
1478
1481
  createdAt: remote.createdAt ?? existing?.createdAt ?? now,
@@ -11,6 +11,7 @@ export interface CodexStoredSession {
11
11
  title?: string;
12
12
  createdAt?: number;
13
13
  lastModified: number;
14
+ archived?: boolean;
14
15
  }
15
16
 
16
17
  interface CodexIndexEntry {
@@ -158,15 +159,15 @@ function readCodexSessionFile(filePath: string, fallbackCwd: string): Omit<Codex
158
159
  };
159
160
  }
160
161
 
161
- function collectJsonlFiles(dir: string, result: string[]): void {
162
+ function collectJsonlFiles(dir: string, result: Array<{ path: string; archived: boolean }>, archived: boolean): void {
162
163
  if (!existsSync(dir)) return;
163
164
  try {
164
165
  for (const entry of readdirSync(dir, { withFileTypes: true })) {
165
166
  const path = join(dir, entry.name);
166
167
  if (entry.isDirectory()) {
167
- collectJsonlFiles(path, result);
168
+ collectJsonlFiles(path, result, archived);
168
169
  } else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
169
- result.push(path);
170
+ result.push({ path, archived });
170
171
  }
171
172
  }
172
173
  } catch {
@@ -179,13 +180,13 @@ export function listCodexStoredSessions(inputCwd: string): { sessions: CodexStor
179
180
  if (!existsSync(root)) return { sessions: [] };
180
181
 
181
182
  const index = loadSessionIndex(root);
182
- const files: string[] = [];
183
- collectJsonlFiles(join(root, "sessions"), files);
184
- collectJsonlFiles(join(root, "archived_sessions"), files);
183
+ const files: Array<{ path: string; archived: boolean }> = [];
184
+ collectJsonlFiles(join(root, "sessions"), files, false);
185
+ collectJsonlFiles(join(root, "archived_sessions"), files, true);
185
186
 
186
187
  const sessionsById = new Map<string, CodexStoredSession>();
187
188
  for (const file of files) {
188
- const metadata = readCodexSessionFile(file, inputCwd);
189
+ const metadata = readCodexSessionFile(file.path, inputCwd);
189
190
  if (!metadata) continue;
190
191
  const indexed = index.get(metadata.id);
191
192
  const session: CodexStoredSession = {
@@ -194,9 +195,10 @@ export function listCodexStoredSessions(inputCwd: string): { sessions: CodexStor
194
195
  title: indexed?.title,
195
196
  createdAt: metadata.createdAt,
196
197
  lastModified: indexed?.updatedAt ?? metadata.lastModified ?? Date.now(),
198
+ archived: file.archived,
197
199
  };
198
200
  const existing = sessionsById.get(session.id);
199
- if (!existing || session.lastModified > existing.lastModified) {
201
+ if (!existing || session.lastModified > existing.lastModified || session.archived) {
200
202
  sessionsById.set(session.id, session);
201
203
  }
202
204
  }
@@ -208,6 +210,7 @@ export function listCodexStoredSessions(inputCwd: string): { sessions: CodexStor
208
210
  cwd: resolve(inputCwd),
209
211
  title: indexed.title,
210
212
  lastModified: indexed.updatedAt ?? Date.now(),
213
+ archived: false,
211
214
  });
212
215
  }
213
216