linkshell-cli 0.3.14 → 0.3.15

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.
@@ -5,6 +5,8 @@ export declare class AgentWorkspaceProxy {
5
5
  private clients;
6
6
  private agentProtocols;
7
7
  private providerCapabilities;
8
+ private providerCapabilityErrors;
9
+ private capabilitiesRevision;
8
10
  private initialized;
9
11
  private status;
10
12
  private error;
@@ -1178,6 +1178,8 @@ export class AgentWorkspaceProxy {
1178
1178
  clients = new Map();
1179
1179
  agentProtocols = new Map();
1180
1180
  providerCapabilities = new Map();
1181
+ providerCapabilityErrors = new Map();
1182
+ capabilitiesRevision = 0;
1181
1183
  initialized = false;
1182
1184
  status = "unavailable";
1183
1185
  error;
@@ -1396,10 +1398,13 @@ export class AgentWorkspaceProxy {
1396
1398
  try {
1397
1399
  const result = await listModels.call(client);
1398
1400
  const runtimeCapabilities = parseModelListCapabilities(result);
1399
- if (runtimeCapabilities)
1401
+ if (runtimeCapabilities) {
1400
1402
  this.providerCapabilities.set(provider, runtimeCapabilities);
1403
+ this.providerCapabilityErrors.delete(provider);
1404
+ }
1401
1405
  }
1402
1406
  catch (error) {
1407
+ this.providerCapabilityErrors.set(provider, error instanceof Error ? error.message : String(error));
1403
1408
  if (this.input.verbose) {
1404
1409
  process.stderr.write(`[agent:v2] model/list failed for ${provider}: ${error instanceof Error ? error.message : String(error)}\n`);
1405
1410
  }
@@ -1463,6 +1468,7 @@ export class AgentWorkspaceProxy {
1463
1468
  const protocol = this.agentProtocols.get(provider);
1464
1469
  const runtimeCapabilities = this.providerCapabilities.get(provider);
1465
1470
  const enabled = Boolean(client);
1471
+ const hasRuntimeModels = Boolean(runtimeCapabilities?.models?.length);
1466
1472
  const supportsImages = enabled && protocolSupportsImages(protocol);
1467
1473
  const isClaudeFallback = protocol === "claude-stream-json";
1468
1474
  const supportsPermission = enabled && !isClaudeFallback;
@@ -1474,12 +1480,15 @@ export class AgentWorkspaceProxy {
1474
1480
  label: providerLabel(provider),
1475
1481
  enabled,
1476
1482
  reason: enabled ? undefined : `${providerLabel(provider)} 未安装或启动失败`,
1483
+ providerProtocol: protocol,
1477
1484
  supportsImages,
1478
1485
  supportsPermission,
1479
1486
  supportsPlan: enabled,
1480
1487
  supportsCancel: enabled,
1481
1488
  models: runtimeCapabilities?.models ?? [{ id: "default", label: "默认模型" }],
1482
1489
  defaultModel: runtimeCapabilities?.defaultModel,
1490
+ modelsSource: hasRuntimeModels ? "runtime" : enabled ? "fallback" : "unavailable",
1491
+ modelListError: this.providerCapabilityErrors.get(provider),
1483
1492
  reasoningEfforts: supportsReasoningEffort
1484
1493
  ? runtimeCapabilities?.reasoningEfforts ?? (provider === "claude" ? [...CLAUDE_REASONING_EFFORTS] : [...ALL_REASONING_EFFORTS])
1485
1494
  : [],
@@ -1508,6 +1517,7 @@ export class AgentWorkspaceProxy {
1508
1517
  providers,
1509
1518
  protocolVersion: 1,
1510
1519
  workspaceProtocolVersion: 2,
1520
+ capabilitiesRevision: ++this.capabilitiesRevision,
1511
1521
  error: anyEnabled ? undefined : "没有可用的 Agent provider。请安装 Claude Code 或 Codex CLI。",
1512
1522
  supportsSessionList: anyEnabled,
1513
1523
  supportsSessionLoad: anyEnabled,