| 926 | } |
| 927 | |
| 928 | function sendAvailableCommands( |
| 929 | connection: Pick<AgentSideConnection, "sessionUpdate"> | undefined, |
| 930 | sessionId: string, |
| 931 | snapshot: Directory.Snapshot, |
| 932 | ) { |
| 933 | if (!connection) return Effect.void |
| 934 | return Effect.sync(() => { |
| 935 | setTimeout(() => { |
| 936 | void connection.sessionUpdate({ |
| 937 | sessionId, |
| 938 | update: { |
| 939 | sessionUpdate: "available_commands_update", |
| 940 | availableCommands: snapshot.availableCommands.map((command) => ({ |
| 941 | name: command.name, |
| 942 | description: command.description ?? "", |
| 943 | })), |
| 944 | }, |
| 945 | }) |
| 946 | }, 0) |
| 947 | }) |
| 948 | } |
| 949 | |
| 950 | function registerMcpServers( |
| 951 | sdk: OpencodeClient, |