linkshell-cli 0.3.29 → 0.4.0

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.
@@ -79,6 +79,7 @@ export declare class AgentWorkspaceProxy {
79
79
  private emitItem;
80
80
  private emitConversation;
81
81
  private emitStatus;
82
+ private emitNotice;
82
83
  private updateConversationPreview;
83
84
  private updateConversationStatus;
84
85
  private sendSnapshot;
@@ -1471,6 +1471,11 @@ export class AgentWorkspaceProxy {
1471
1471
  });
1472
1472
  return;
1473
1473
  }
1474
+ const priorSettings = {
1475
+ model: conversation.model,
1476
+ reasoningEffort: conversation.reasoningEffort,
1477
+ permissionMode: conversation.permissionMode,
1478
+ };
1474
1479
  conversation.model = payload.model ?? conversation.model;
1475
1480
  conversation.reasoningEffort = payload.reasoningEffort ?? conversation.reasoningEffort;
1476
1481
  conversation.permissionMode = payload.permissionMode ?? conversation.permissionMode;
@@ -1478,6 +1483,30 @@ export class AgentWorkspaceProxy {
1478
1483
  conversation.status = "running";
1479
1484
  conversation.lastActivityAt = Date.now();
1480
1485
  this.activeConversationId = conversation.id;
1486
+ if (payload.model && payload.model !== priorSettings.model) {
1487
+ const runtimeCapabilities = this.providerCapabilities.get(conversation.provider);
1488
+ const label = runtimeCapabilities?.models?.find((m) => m.id === payload.model)?.label ?? payload.model;
1489
+ this.emitNotice({
1490
+ conversationId: conversation.id,
1491
+ kind: "model_changed",
1492
+ title: `已切换模型 · ${label}`,
1493
+ detail: `${providerLabel(conversation.provider)} 下次回复将使用 ${payload.model}`,
1494
+ });
1495
+ }
1496
+ if (payload.reasoningEffort && payload.reasoningEffort !== priorSettings.reasoningEffort) {
1497
+ this.emitNotice({
1498
+ conversationId: conversation.id,
1499
+ kind: "effort_changed",
1500
+ title: `思考强度 · ${payload.reasoningEffort}`,
1501
+ });
1502
+ }
1503
+ if (payload.permissionMode && payload.permissionMode !== priorSettings.permissionMode) {
1504
+ this.emitNotice({
1505
+ conversationId: conversation.id,
1506
+ kind: "permission_changed",
1507
+ title: `权限模式 · ${payload.permissionMode}`,
1508
+ });
1509
+ }
1481
1510
  const userText = textFromBlocks(payload.contentBlocks);
1482
1511
  this.addItem(conversation.id, {
1483
1512
  id: payload.clientMessageId,
@@ -1608,11 +1637,18 @@ export class AgentWorkspaceProxy {
1608
1637
  return;
1609
1638
  }
1610
1639
  if (conversation.provider !== "codex") {
1640
+ const message = `${command.title} 暂无 ${providerLabel(conversation.provider)} 原生实现。`;
1641
+ this.emitNotice({
1642
+ conversationId: conversation.id,
1643
+ kind: "native_unsupported",
1644
+ title: `${command.title} 不支持`,
1645
+ detail: `${providerLabel(conversation.provider)} 当前未实现这个命令。`,
1646
+ });
1611
1647
  this.addItem(conversation.id, {
1612
1648
  id: id("error"),
1613
1649
  conversationId: conversation.id,
1614
1650
  type: "error",
1615
- error: `${command.title} 暂无 ${providerLabel(conversation.provider)} 原生实现。`,
1651
+ error: message,
1616
1652
  createdAt: now,
1617
1653
  });
1618
1654
  return;
@@ -1729,6 +1765,15 @@ export class AgentWorkspaceProxy {
1729
1765
  this.sendCapabilities();
1730
1766
  }
1731
1767
  }
1768
+ const initModel = firstString(asRecord(params), ["model", "currentModel"]);
1769
+ if (initModel && conversationId) {
1770
+ const conversation = this.conversations.get(conversationId);
1771
+ if (conversation && conversation.model !== initModel) {
1772
+ conversation.model = initModel;
1773
+ conversation.lastActivityAt = Date.now();
1774
+ this.emitConversation(conversation);
1775
+ }
1776
+ }
1732
1777
  return;
1733
1778
  }
1734
1779
  if (method.startsWith("account/") ||
@@ -1760,6 +1805,10 @@ export class AgentWorkspaceProxy {
1760
1805
  if (conversation) {
1761
1806
  conversation.agentSessionId = agentSessionId;
1762
1807
  conversation.lastActivityAt = Date.now();
1808
+ const startedModel = firstString(asRecord(params), ["model", "currentModel"]);
1809
+ if (startedModel && conversation.model !== startedModel) {
1810
+ conversation.model = startedModel;
1811
+ }
1763
1812
  this.emitConversation(conversation);
1764
1813
  }
1765
1814
  }
@@ -2595,6 +2644,13 @@ export class AgentWorkspaceProxy {
2595
2644
  createdAt: Date.now(),
2596
2645
  });
2597
2646
  }
2647
+ emitNotice(input) {
2648
+ this.input.send(createEnvelope({
2649
+ type: "agent.v2.notice",
2650
+ sessionId: this.input.sessionId,
2651
+ payload: input,
2652
+ }));
2653
+ }
2598
2654
  updateConversationPreview(conversationId, text, status) {
2599
2655
  const conversation = this.conversations.get(conversationId);
2600
2656
  if (!conversation)