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.
- package/dist/cli/src/runtime/acp/agent-workspace.d.ts +1 -0
- package/dist/cli/src/runtime/acp/agent-workspace.js +34 -27
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/runtime/acp/agent-workspace.ts +35 -27
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import { AcpClient } from "./acp-client.js";
|
|
10
10
|
import { ClaudeSdkClient } from "./claude-sdk-client.js";
|
|
11
11
|
import { ClaudeStreamJsonClient } from "./claude-stream-json-client.js";
|
|
12
|
+
import { listClaudeStoredSessions } from "./claude-sessions.js";
|
|
13
|
+
import { listCodexStoredSessions } from "./codex-sessions.js";
|
|
12
14
|
import type { AgentProtocol, AgentProvider } from "./provider-resolver.js";
|
|
13
15
|
import { resolveAgentCommand } from "./provider-resolver.js";
|
|
14
16
|
|
|
@@ -1437,36 +1439,12 @@ export class AgentWorkspaceProxy {
|
|
|
1437
1439
|
|
|
1438
1440
|
private async syncProviderSessions(): Promise<void> {
|
|
1439
1441
|
await this.initialize();
|
|
1442
|
+
this.upsertProviderSessions("codex", listCodexStoredSessions(this.input.cwd));
|
|
1443
|
+
this.upsertProviderSessions("claude", listClaudeStoredSessions(this.input.cwd));
|
|
1440
1444
|
for (const [provider, client] of this.clients) {
|
|
1441
1445
|
try {
|
|
1442
1446
|
const result = await client.listSessions();
|
|
1443
|
-
|
|
1444
|
-
const agentSessionId = remote.id;
|
|
1445
|
-
const existingId = this.conversationByAgentSessionId.get(agentSessionId);
|
|
1446
|
-
const now = Date.now();
|
|
1447
|
-
const conversationId = existingId ?? `agent:${agentSessionId}`;
|
|
1448
|
-
const existing = this.conversations.get(conversationId);
|
|
1449
|
-
const cwd = remote.cwd ?? existing?.cwd ?? this.input.cwd;
|
|
1450
|
-
const conversation: AgentConversation = {
|
|
1451
|
-
id: conversationId,
|
|
1452
|
-
agentSessionId,
|
|
1453
|
-
provider,
|
|
1454
|
-
cwd,
|
|
1455
|
-
title: remote.title ?? existing?.title ?? titleFromCwd(cwd),
|
|
1456
|
-
model: remote.model ?? existing?.model,
|
|
1457
|
-
reasoningEffort: existing?.reasoningEffort,
|
|
1458
|
-
permissionMode: existing?.permissionMode,
|
|
1459
|
-
collaborationMode: existing?.collaborationMode,
|
|
1460
|
-
status: existing?.status ?? "idle",
|
|
1461
|
-
archived: existing?.archived ?? false,
|
|
1462
|
-
lastMessagePreview: existing?.lastMessagePreview,
|
|
1463
|
-
lastActivityAt: remote.lastActivityAt ?? existing?.lastActivityAt ?? now,
|
|
1464
|
-
createdAt: remote.createdAt ?? existing?.createdAt ?? now,
|
|
1465
|
-
};
|
|
1466
|
-
this.conversations.set(conversation.id, conversation);
|
|
1467
|
-
this.conversationByAgentSessionId.set(agentSessionId, conversation.id);
|
|
1468
|
-
this.timelines.set(conversation.id, this.timelines.get(conversation.id) ?? []);
|
|
1469
|
-
}
|
|
1447
|
+
this.upsertProviderSessions(provider, result);
|
|
1470
1448
|
} catch (error) {
|
|
1471
1449
|
if (this.input.verbose) {
|
|
1472
1450
|
process.stderr.write(`[agent:v2] session list failed for ${provider}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -1475,6 +1453,36 @@ export class AgentWorkspaceProxy {
|
|
|
1475
1453
|
}
|
|
1476
1454
|
}
|
|
1477
1455
|
|
|
1456
|
+
private upsertProviderSessions(provider: AgentProvider, result: unknown): void {
|
|
1457
|
+
for (const remote of parseRemoteSessions(result)) {
|
|
1458
|
+
const agentSessionId = remote.id;
|
|
1459
|
+
const existingId = this.conversationByAgentSessionId.get(agentSessionId);
|
|
1460
|
+
const now = Date.now();
|
|
1461
|
+
const conversationId = existingId ?? `agent:${agentSessionId}`;
|
|
1462
|
+
const existing = this.conversations.get(conversationId);
|
|
1463
|
+
const cwd = remote.cwd ?? existing?.cwd ?? this.input.cwd;
|
|
1464
|
+
const conversation: AgentConversation = {
|
|
1465
|
+
id: conversationId,
|
|
1466
|
+
agentSessionId,
|
|
1467
|
+
provider,
|
|
1468
|
+
cwd,
|
|
1469
|
+
title: remote.title ?? existing?.title ?? titleFromCwd(cwd),
|
|
1470
|
+
model: remote.model ?? existing?.model,
|
|
1471
|
+
reasoningEffort: existing?.reasoningEffort,
|
|
1472
|
+
permissionMode: existing?.permissionMode,
|
|
1473
|
+
collaborationMode: existing?.collaborationMode,
|
|
1474
|
+
status: existing?.status ?? "idle",
|
|
1475
|
+
archived: existing?.archived ?? false,
|
|
1476
|
+
lastMessagePreview: existing?.lastMessagePreview,
|
|
1477
|
+
lastActivityAt: remote.lastActivityAt ?? existing?.lastActivityAt ?? now,
|
|
1478
|
+
createdAt: remote.createdAt ?? existing?.createdAt ?? now,
|
|
1479
|
+
};
|
|
1480
|
+
this.conversations.set(conversation.id, conversation);
|
|
1481
|
+
this.conversationByAgentSessionId.set(agentSessionId, conversation.id);
|
|
1482
|
+
this.timelines.set(conversation.id, this.timelines.get(conversation.id) ?? []);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1478
1486
|
private sendCapabilities(): void {
|
|
1479
1487
|
const providers = this.input.availableProviders.map((provider) => {
|
|
1480
1488
|
const client = this.clients.get(provider);
|