linkshell-cli 0.2.72 → 0.2.74

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.
@@ -20,6 +20,7 @@ import { ScreenShare } from "./screen-share.js";
20
20
  import { getLanIp } from "../utils/lan-ip.js";
21
21
  import { startKeepAwake, type KeepAwakeHandle } from "../utils/keep-awake.js";
22
22
  import { AgentSessionProxy } from "./acp/agent-session.js";
23
+ import { AgentWorkspaceProxy } from "./acp/agent-workspace.js";
23
24
  import type { AgentProvider } from "./acp/provider-resolver.js";
24
25
 
25
26
  export interface BridgeSessionOptions {
@@ -166,6 +167,7 @@ export class BridgeSession {
166
167
  private tunnelSockets = new Map<string, WebSocket>();
167
168
  private keepAwake: KeepAwakeHandle | undefined;
168
169
  private agentSession: AgentSessionProxy | undefined;
170
+ private agentWorkspace: AgentWorkspaceProxy | undefined;
169
171
 
170
172
  constructor(options: BridgeSessionOptions) {
171
173
  this.options = options;
@@ -194,15 +196,21 @@ export class BridgeSession {
194
196
  const agentProvider = normalizeAgentProvider(
195
197
  this.options.agentProvider ?? this.options.providerConfig.provider,
196
198
  );
197
- this.agentSession = new AgentSessionProxy({
199
+ const agentOptions = {
198
200
  sessionId: this.sessionId,
199
201
  cwd: process.cwd(),
200
202
  provider: agentProvider,
201
203
  command: this.options.agentCommand,
202
204
  verbose: this.options.verbose,
203
- send: (envelope) => this.send(envelope),
205
+ send: (envelope: Envelope) => this.send(envelope),
206
+ };
207
+ this.agentSession = new AgentSessionProxy({
208
+ ...agentOptions,
209
+ });
210
+ this.agentWorkspace = new AgentWorkspaceProxy({
211
+ ...agentOptions,
204
212
  });
205
- process.stderr.write("[bridge] agent GUI channel enabled\n");
213
+ process.stderr.write("[bridge] agent workspace channel enabled\n");
206
214
  }
207
215
  await this.spawnTerminal(DEFAULT_TERMINAL_ID, process.cwd());
208
216
  this.connectGateway();
@@ -577,6 +585,40 @@ export class BridgeSession {
577
585
  await this.agentSession.handleEnvelope(envelope);
578
586
  break;
579
587
  }
588
+ case "agent.v2.capabilities.request":
589
+ case "agent.v2.conversation.open":
590
+ case "agent.v2.conversation.list":
591
+ case "agent.v2.prompt":
592
+ case "agent.v2.cancel":
593
+ case "agent.v2.permission.respond":
594
+ case "agent.v2.snapshot.request": {
595
+ if (!this.agentWorkspace) {
596
+ this.send(
597
+ createEnvelope({
598
+ type: "agent.v2.capabilities",
599
+ sessionId: this.sessionId,
600
+ payload: {
601
+ enabled: false,
602
+ provider: normalizeAgentProvider(
603
+ this.options.agentProvider ?? this.options.providerConfig.provider,
604
+ ),
605
+ workspaceProtocolVersion: 2,
606
+ error: "Agent Workspace is not enabled. Start CLI with --agent-ui.",
607
+ supportsSessionList: false,
608
+ supportsSessionLoad: false,
609
+ supportsImages: false,
610
+ supportsAudio: false,
611
+ supportsPermission: false,
612
+ supportsPlan: false,
613
+ supportsCancel: false,
614
+ },
615
+ }),
616
+ );
617
+ break;
618
+ }
619
+ await this.agentWorkspace.handleEnvelope(envelope);
620
+ break;
621
+ }
580
622
  case "file.upload": {
581
623
  const p = parseTypedPayload("file.upload", envelope.payload);
582
624
  const ext = p.filename.split(".").pop() || "png";
@@ -1692,6 +1734,8 @@ export class BridgeSession {
1692
1734
  this.stopScreenCapture();
1693
1735
  this.agentSession?.stop();
1694
1736
  this.agentSession = undefined;
1737
+ this.agentWorkspace?.stop();
1738
+ this.agentWorkspace = undefined;
1695
1739
  this.keepAwake?.stop();
1696
1740
  this.keepAwake = undefined;
1697
1741
  if (this.reconnectTimer) {