linkshell-cli 0.3.15 → 0.3.16
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/index.js +0 -0
- package/dist/cli/src/runtime/acp/agent-workspace.d.ts +2 -0
- package/dist/cli/src/runtime/acp/agent-workspace.js +54 -6
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/src/runtime/acp/claude-sdk-client.d.ts +1 -0
- package/dist/cli/src/runtime/acp/claude-sdk-client.js +45 -7
- package/dist/cli/src/runtime/acp/claude-sdk-client.js.map +1 -1
- package/dist/cli/src/runtime/acp/claude-stream-json-client.js +22 -2
- package/dist/cli/src/runtime/acp/claude-stream-json-client.js.map +1 -1
- package/dist/cli/src/runtime/acp/codex-rpc-bridge.d.ts +16 -0
- package/dist/cli/src/runtime/acp/codex-rpc-bridge.js +53 -0
- package/dist/cli/src/runtime/acp/codex-rpc-bridge.js.map +1 -0
- package/dist/cli/src/runtime/acp/json-rpc.d.ts +25 -1
- package/dist/cli/src/runtime/acp/json-rpc.js +9 -1
- package/dist/cli/src/runtime/acp/json-rpc.js.map +1 -1
- package/dist/cli/src/runtime/bridge-session.js +25 -0
- package/dist/cli/src/runtime/bridge-session.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/shared-protocol/src/index.d.ts +1397 -980
- package/dist/shared-protocol/src/index.js +52 -0
- package/dist/shared-protocol/src/index.js.map +1 -1
- package/package.json +13 -13
- package/src/runtime/acp/agent-workspace.ts +54 -6
- package/src/runtime/acp/claude-sdk-client.ts +50 -7
- package/src/runtime/acp/claude-stream-json-client.ts +25 -2
- package/src/runtime/acp/codex-rpc-bridge.ts +70 -0
- package/src/runtime/acp/json-rpc.ts +13 -4
- package/src/runtime/bridge-session.ts +27 -0
package/dist/cli/src/index.js
CHANGED
|
File without changes
|
|
@@ -3,6 +3,7 @@ import type { AgentProvider } from "./provider-resolver.js";
|
|
|
3
3
|
export declare class AgentWorkspaceProxy {
|
|
4
4
|
private readonly input;
|
|
5
5
|
private clients;
|
|
6
|
+
private codexRpcBridge;
|
|
6
7
|
private agentProtocols;
|
|
7
8
|
private providerCapabilities;
|
|
8
9
|
private providerCapabilityErrors;
|
|
@@ -37,6 +38,7 @@ export declare class AgentWorkspaceProxy {
|
|
|
37
38
|
handleEnvelope(envelope: Envelope): Promise<void>;
|
|
38
39
|
stop(): void;
|
|
39
40
|
private clientForProvider;
|
|
41
|
+
private codexRpc;
|
|
40
42
|
private protocolForProvider;
|
|
41
43
|
private initialize;
|
|
42
44
|
private ensureProviderClient;
|
|
@@ -6,8 +6,9 @@ import { createEnvelope, parseTypedPayload, } from "@linkshell/protocol";
|
|
|
6
6
|
import { AcpClient } from "./acp-client.js";
|
|
7
7
|
import { ClaudeSdkClient } from "./claude-sdk-client.js";
|
|
8
8
|
import { ClaudeStreamJsonClient } from "./claude-stream-json-client.js";
|
|
9
|
+
import { CodexRpcBridge } from "./codex-rpc-bridge.js";
|
|
9
10
|
import { listClaudeStoredSessions, loadClaudeStoredTimeline } from "./claude-sessions.js";
|
|
10
|
-
import {
|
|
11
|
+
import { loadCodexStoredTimeline } from "./codex-sessions.js";
|
|
11
12
|
import { resolveAgentCommand } from "./provider-resolver.js";
|
|
12
13
|
const PERMISSION_TIMEOUT_MS = 5 * 60_000;
|
|
13
14
|
const MAX_TIMELINE_ITEMS = 200;
|
|
@@ -1176,6 +1177,7 @@ function normalizeAgentStatus(value) {
|
|
|
1176
1177
|
export class AgentWorkspaceProxy {
|
|
1177
1178
|
input;
|
|
1178
1179
|
clients = new Map();
|
|
1180
|
+
codexRpcBridge;
|
|
1179
1181
|
agentProtocols = new Map();
|
|
1180
1182
|
providerCapabilities = new Map();
|
|
1181
1183
|
providerCapabilityErrors = new Map();
|
|
@@ -1204,6 +1206,32 @@ export class AgentWorkspaceProxy {
|
|
|
1204
1206
|
}
|
|
1205
1207
|
async handleEnvelope(envelope) {
|
|
1206
1208
|
switch (envelope.type) {
|
|
1209
|
+
case "agent.codex.rpc": {
|
|
1210
|
+
const payload = parseTypedPayload("agent.codex.rpc", envelope.payload);
|
|
1211
|
+
try {
|
|
1212
|
+
this.codexRpc().send(payload);
|
|
1213
|
+
}
|
|
1214
|
+
catch (error) {
|
|
1215
|
+
const idValue = payload && typeof payload === "object" && "id" in payload
|
|
1216
|
+
? payload.id
|
|
1217
|
+
: undefined;
|
|
1218
|
+
if (typeof idValue === "string" || typeof idValue === "number") {
|
|
1219
|
+
this.input.send(createEnvelope({
|
|
1220
|
+
type: "agent.codex.rpc",
|
|
1221
|
+
hostDeviceId: this.input.hostDeviceId,
|
|
1222
|
+
payload: {
|
|
1223
|
+
jsonrpc: "2.0",
|
|
1224
|
+
id: idValue,
|
|
1225
|
+
error: {
|
|
1226
|
+
code: -32000,
|
|
1227
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1228
|
+
},
|
|
1229
|
+
},
|
|
1230
|
+
}));
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1207
1235
|
case "agent.v2.capabilities.request":
|
|
1208
1236
|
await this.initialize();
|
|
1209
1237
|
this.sendCapabilities();
|
|
@@ -1276,6 +1304,8 @@ export class AgentWorkspaceProxy {
|
|
|
1276
1304
|
}
|
|
1277
1305
|
}
|
|
1278
1306
|
stop() {
|
|
1307
|
+
this.codexRpcBridge?.stop();
|
|
1308
|
+
this.codexRpcBridge = undefined;
|
|
1279
1309
|
for (const client of this.clients.values()) {
|
|
1280
1310
|
client.stop();
|
|
1281
1311
|
}
|
|
@@ -1284,6 +1314,16 @@ export class AgentWorkspaceProxy {
|
|
|
1284
1314
|
clientForProvider(provider) {
|
|
1285
1315
|
return this.clients.get(provider);
|
|
1286
1316
|
}
|
|
1317
|
+
codexRpc() {
|
|
1318
|
+
this.codexRpcBridge ??= new CodexRpcBridge({
|
|
1319
|
+
command: this.input.command,
|
|
1320
|
+
cwd: this.input.cwd,
|
|
1321
|
+
hostDeviceId: this.input.hostDeviceId,
|
|
1322
|
+
send: this.input.send,
|
|
1323
|
+
verbose: this.input.verbose,
|
|
1324
|
+
});
|
|
1325
|
+
return this.codexRpcBridge;
|
|
1326
|
+
}
|
|
1287
1327
|
protocolForProvider(provider) {
|
|
1288
1328
|
return this.agentProtocols.get(provider);
|
|
1289
1329
|
}
|
|
@@ -1292,7 +1332,9 @@ export class AgentWorkspaceProxy {
|
|
|
1292
1332
|
return;
|
|
1293
1333
|
this.initialized = true;
|
|
1294
1334
|
// Eagerly start all detected providers so capabilities report real status
|
|
1295
|
-
const startPromises = this.input.availableProviders
|
|
1335
|
+
const startPromises = this.input.availableProviders
|
|
1336
|
+
.filter((provider) => provider !== "codex")
|
|
1337
|
+
.map((p) => this.ensureProviderClient(p));
|
|
1296
1338
|
await Promise.allSettled(startPromises);
|
|
1297
1339
|
this.status = "idle";
|
|
1298
1340
|
this.error = undefined;
|
|
@@ -1412,7 +1454,6 @@ export class AgentWorkspaceProxy {
|
|
|
1412
1454
|
}
|
|
1413
1455
|
async syncProviderSessions() {
|
|
1414
1456
|
await this.initialize();
|
|
1415
|
-
this.upsertProviderSessions("codex", listCodexStoredSessions(this.input.cwd));
|
|
1416
1457
|
this.upsertProviderSessions("claude", listClaudeStoredSessions(this.input.cwd));
|
|
1417
1458
|
for (const [provider, client] of this.clients) {
|
|
1418
1459
|
try {
|
|
@@ -1465,13 +1506,14 @@ export class AgentWorkspaceProxy {
|
|
|
1465
1506
|
sendCapabilities() {
|
|
1466
1507
|
const providers = this.input.availableProviders.map((provider) => {
|
|
1467
1508
|
const client = this.clients.get(provider);
|
|
1468
|
-
const protocol = this.agentProtocols.get(provider);
|
|
1509
|
+
const protocol = provider === "codex" ? "codex-app-server" : this.agentProtocols.get(provider);
|
|
1469
1510
|
const runtimeCapabilities = this.providerCapabilities.get(provider);
|
|
1470
|
-
const enabled = Boolean(client);
|
|
1511
|
+
const enabled = provider === "codex" ? true : Boolean(client);
|
|
1471
1512
|
const hasRuntimeModels = Boolean(runtimeCapabilities?.models?.length);
|
|
1472
1513
|
const supportsImages = enabled && protocolSupportsImages(protocol);
|
|
1514
|
+
const isClaudeSdk = protocol === "claude-agent-sdk";
|
|
1473
1515
|
const isClaudeFallback = protocol === "claude-stream-json";
|
|
1474
|
-
const supportsPermission = enabled && !isClaudeFallback;
|
|
1516
|
+
const supportsPermission = enabled && (isClaudeSdk || !isClaudeFallback);
|
|
1475
1517
|
const supportsReasoningEffort = enabled;
|
|
1476
1518
|
const commands = mergeCommands(defaultProviderCommands(provider, this.input.cwd, enabled), runtimeCapabilities?.commands);
|
|
1477
1519
|
const currentMode = [...this.conversations.values()].find((conversation) => conversation.provider === provider)?.collaborationMode;
|
|
@@ -1502,6 +1544,7 @@ export class AgentWorkspaceProxy {
|
|
|
1502
1544
|
plan: enabled,
|
|
1503
1545
|
cancel: enabled,
|
|
1504
1546
|
reasoningEffort: supportsReasoningEffort,
|
|
1547
|
+
claudeSdk: isClaudeSdk,
|
|
1505
1548
|
streamJsonFallback: isClaudeFallback,
|
|
1506
1549
|
},
|
|
1507
1550
|
};
|
|
@@ -2031,6 +2074,9 @@ export class AgentWorkspaceProxy {
|
|
|
2031
2074
|
this.conversationByAgentSessionId.set(agentSessionId, conversationId);
|
|
2032
2075
|
const conversation = this.conversations.get(conversationId);
|
|
2033
2076
|
if (conversation) {
|
|
2077
|
+
if (conversation.agentSessionId && conversation.agentSessionId !== agentSessionId) {
|
|
2078
|
+
this.conversationByAgentSessionId.delete(conversation.agentSessionId);
|
|
2079
|
+
}
|
|
2034
2080
|
conversation.agentSessionId = agentSessionId;
|
|
2035
2081
|
conversation.lastActivityAt = Date.now();
|
|
2036
2082
|
this.emitConversation(conversation);
|
|
@@ -2945,6 +2991,8 @@ export class AgentWorkspaceProxy {
|
|
|
2945
2991
|
...existing,
|
|
2946
2992
|
...toolCall,
|
|
2947
2993
|
id: targetToolId,
|
|
2994
|
+
input: toolCall.input ?? existing?.input,
|
|
2995
|
+
output: toolCall.output ?? existing?.output,
|
|
2948
2996
|
createdAt: existing?.createdAt ?? toolCall.createdAt ?? Date.now(),
|
|
2949
2997
|
};
|
|
2950
2998
|
this.toolConversationIds.set(toolCall.id, conversationId);
|