wave-code 1.0.10 → 1.1.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.
Files changed (242) hide show
  1. package/bin/wave-code.js +8 -2
  2. package/dist/bundle/wave.mjs +3207 -0
  3. package/package.json +24 -25
  4. package/src/commands/update.ts +2 -7
  5. package/src/components/App.tsx +3 -7
  6. package/src/components/BtwDisplay.tsx +10 -1
  7. package/src/components/ChatInterface.tsx +21 -52
  8. package/src/components/ConfirmationDetails.tsx +144 -37
  9. package/src/components/DiffDisplay.tsx +335 -301
  10. package/src/components/InputBox.tsx +3 -1
  11. package/src/components/LoadingIndicator.tsx +16 -2
  12. package/src/components/MessageBlockItem.tsx +2 -4
  13. package/src/components/MessageList.tsx +75 -14
  14. package/src/components/ReasoningDisplay.tsx +2 -4
  15. package/src/components/SessionSelector.tsx +82 -11
  16. package/src/components/StatusCommand.tsx +2 -9
  17. package/src/components/ToolDisplay.tsx +2 -4
  18. package/src/contexts/useChat.tsx +156 -335
  19. package/src/daemon/commands.ts +57 -27
  20. package/src/daemon/jsonRpcClient.ts +1 -1
  21. package/src/daemon/socketClient.ts +2 -2
  22. package/src/hooks/useInputManager.ts +1 -1
  23. package/src/index.ts +57 -10
  24. package/src/managers/inputReducer.ts +186 -104
  25. package/src/print-cli.ts +21 -17
  26. package/src/reducers/selectorReducer.ts +10 -0
  27. package/src/session-selector-cli.tsx +269 -28
  28. package/src/stdio/agentBridge.ts +22 -21
  29. package/src/stdio/daemonServer.ts +3 -1
  30. package/src/utils/clipboard.ts +21 -0
  31. package/src/utils/highlightUtils.ts +46 -1
  32. package/src/utils/readPackageJson.ts +29 -0
  33. package/src/utils/streamingText.ts +11 -0
  34. package/src/utils/worktree.ts +191 -43
  35. package/dist/cli.d.ts +0 -6
  36. package/dist/cli.js +0 -53
  37. package/dist/commands/plugin/disable.d.ts +0 -5
  38. package/dist/commands/plugin/disable.js +0 -15
  39. package/dist/commands/plugin/enable.d.ts +0 -5
  40. package/dist/commands/plugin/enable.js +0 -15
  41. package/dist/commands/plugin/install.d.ts +0 -5
  42. package/dist/commands/plugin/install.js +0 -21
  43. package/dist/commands/plugin/list.d.ts +0 -1
  44. package/dist/commands/plugin/list.js +0 -31
  45. package/dist/commands/plugin/marketplace.d.ts +0 -10
  46. package/dist/commands/plugin/marketplace.js +0 -90
  47. package/dist/commands/plugin/uninstall.d.ts +0 -3
  48. package/dist/commands/plugin/uninstall.js +0 -16
  49. package/dist/commands/plugin/update.d.ts +0 -3
  50. package/dist/commands/plugin/update.js +0 -15
  51. package/dist/commands/update.d.ts +0 -1
  52. package/dist/commands/update.js +0 -97
  53. package/dist/components/AgentsManager.d.ts +0 -7
  54. package/dist/components/AgentsManager.js +0 -109
  55. package/dist/components/App.d.ts +0 -9
  56. package/dist/components/App.js +0 -76
  57. package/dist/components/BackgroundTaskManager.d.ts +0 -5
  58. package/dist/components/BackgroundTaskManager.js +0 -99
  59. package/dist/components/BangDisplay.d.ts +0 -8
  60. package/dist/components/BangDisplay.js +0 -17
  61. package/dist/components/BtwDisplay.d.ts +0 -7
  62. package/dist/components/BtwDisplay.js +0 -19
  63. package/dist/components/ChatInterface.d.ts +0 -2
  64. package/dist/components/ChatInterface.js +0 -61
  65. package/dist/components/CommandSelector.d.ts +0 -10
  66. package/dist/components/CommandSelector.js +0 -66
  67. package/dist/components/CompactDisplay.d.ts +0 -8
  68. package/dist/components/CompactDisplay.js +0 -13
  69. package/dist/components/ConfirmationDetails.d.ts +0 -9
  70. package/dist/components/ConfirmationDetails.js +0 -45
  71. package/dist/components/ConfirmationSelector.d.ts +0 -13
  72. package/dist/components/ConfirmationSelector.js +0 -127
  73. package/dist/components/DiffDisplay.d.ts +0 -8
  74. package/dist/components/DiffDisplay.js +0 -201
  75. package/dist/components/DiscoverView.d.ts +0 -2
  76. package/dist/components/DiscoverView.js +0 -37
  77. package/dist/components/FileSelector.d.ts +0 -11
  78. package/dist/components/FileSelector.js +0 -50
  79. package/dist/components/HelpView.d.ts +0 -7
  80. package/dist/components/HelpView.js +0 -74
  81. package/dist/components/HistorySearch.d.ts +0 -8
  82. package/dist/components/HistorySearch.js +0 -66
  83. package/dist/components/InputBox.d.ts +0 -24
  84. package/dist/components/InputBox.js +0 -149
  85. package/dist/components/InstalledView.d.ts +0 -2
  86. package/dist/components/InstalledView.js +0 -45
  87. package/dist/components/LoadingIndicator.d.ts +0 -10
  88. package/dist/components/LoadingIndicator.js +0 -6
  89. package/dist/components/LoginCommand.d.ts +0 -5
  90. package/dist/components/LoginCommand.js +0 -153
  91. package/dist/components/Markdown.d.ts +0 -5
  92. package/dist/components/Markdown.js +0 -127
  93. package/dist/components/MarketplaceAddForm.d.ts +0 -2
  94. package/dist/components/MarketplaceAddForm.js +0 -55
  95. package/dist/components/MarketplaceDetail.d.ts +0 -2
  96. package/dist/components/MarketplaceDetail.js +0 -74
  97. package/dist/components/MarketplaceList.d.ts +0 -8
  98. package/dist/components/MarketplaceList.js +0 -17
  99. package/dist/components/MarketplaceView.d.ts +0 -2
  100. package/dist/components/MarketplaceView.js +0 -41
  101. package/dist/components/McpManager.d.ts +0 -9
  102. package/dist/components/McpManager.js +0 -88
  103. package/dist/components/MessageBlockItem.d.ts +0 -8
  104. package/dist/components/MessageBlockItem.js +0 -15
  105. package/dist/components/MessageList.d.ts +0 -10
  106. package/dist/components/MessageList.js +0 -80
  107. package/dist/components/ModelSelector.d.ts +0 -8
  108. package/dist/components/ModelSelector.js +0 -45
  109. package/dist/components/Notifications.d.ts +0 -7
  110. package/dist/components/Notifications.js +0 -9
  111. package/dist/components/PlanDisplay.d.ts +0 -7
  112. package/dist/components/PlanDisplay.js +0 -6
  113. package/dist/components/PluginDetail.d.ts +0 -2
  114. package/dist/components/PluginDetail.js +0 -87
  115. package/dist/components/PluginList.d.ts +0 -13
  116. package/dist/components/PluginList.js +0 -15
  117. package/dist/components/PluginManagerShell.d.ts +0 -6
  118. package/dist/components/PluginManagerShell.js +0 -92
  119. package/dist/components/PluginManagerTypes.d.ts +0 -35
  120. package/dist/components/PluginManagerTypes.js +0 -1
  121. package/dist/components/QueuedMessageList.d.ts +0 -2
  122. package/dist/components/QueuedMessageList.js +0 -18
  123. package/dist/components/ReasoningDisplay.d.ts +0 -8
  124. package/dist/components/ReasoningDisplay.js +0 -13
  125. package/dist/components/RewindCommand.d.ts +0 -12
  126. package/dist/components/RewindCommand.js +0 -78
  127. package/dist/components/SessionSelector.d.ts +0 -12
  128. package/dist/components/SessionSelector.js +0 -47
  129. package/dist/components/StatusCommand.d.ts +0 -5
  130. package/dist/components/StatusCommand.js +0 -28
  131. package/dist/components/StatusLine.d.ts +0 -6
  132. package/dist/components/StatusLine.js +0 -9
  133. package/dist/components/TaskList.d.ts +0 -5
  134. package/dist/components/TaskList.js +0 -197
  135. package/dist/components/TaskNotificationMessage.d.ts +0 -5
  136. package/dist/components/TaskNotificationMessage.js +0 -12
  137. package/dist/components/ToolDisplay.d.ts +0 -9
  138. package/dist/components/ToolDisplay.js +0 -55
  139. package/dist/components/WorkflowManager.d.ts +0 -5
  140. package/dist/components/WorkflowManager.js +0 -102
  141. package/dist/components/WorktreeExitPrompt.d.ts +0 -12
  142. package/dist/components/WorktreeExitPrompt.js +0 -35
  143. package/dist/constants/commands.d.ts +0 -2
  144. package/dist/constants/commands.js +0 -92
  145. package/dist/contexts/PluginManagerContext.d.ts +0 -3
  146. package/dist/contexts/PluginManagerContext.js +0 -9
  147. package/dist/contexts/useAppConfig.d.ts +0 -10
  148. package/dist/contexts/useAppConfig.js +0 -13
  149. package/dist/contexts/useChat.d.ts +0 -101
  150. package/dist/contexts/useChat.js +0 -993
  151. package/dist/contracts/status.d.ts +0 -7
  152. package/dist/contracts/status.js +0 -1
  153. package/dist/daemon/commands.d.ts +0 -49
  154. package/dist/daemon/commands.js +0 -341
  155. package/dist/daemon/jsonRpcClient.d.ts +0 -38
  156. package/dist/daemon/jsonRpcClient.js +0 -129
  157. package/dist/daemon/socketClient.d.ts +0 -13
  158. package/dist/daemon/socketClient.js +0 -26
  159. package/dist/daemon-cli.d.ts +0 -10
  160. package/dist/daemon-cli.js +0 -15
  161. package/dist/hooks/useInputManager.d.ts +0 -75
  162. package/dist/hooks/useInputManager.js +0 -583
  163. package/dist/hooks/usePluginManager.d.ts +0 -4
  164. package/dist/hooks/usePluginManager.js +0 -265
  165. package/dist/hooks/useTasks.d.ts +0 -1
  166. package/dist/hooks/useTasks.js +0 -5
  167. package/dist/index.d.ts +0 -4
  168. package/dist/index.js +0 -447
  169. package/dist/managers/inputHandlers.d.ts +0 -30
  170. package/dist/managers/inputHandlers.js +0 -625
  171. package/dist/managers/inputReducer.d.ts +0 -271
  172. package/dist/managers/inputReducer.js +0 -1121
  173. package/dist/plugin-manager-cli.d.ts +0 -5
  174. package/dist/plugin-manager-cli.js +0 -12
  175. package/dist/print-cli.d.ts +0 -10
  176. package/dist/print-cli.js +0 -209
  177. package/dist/reducers/agentsManagerReducer.d.ts +0 -26
  178. package/dist/reducers/agentsManagerReducer.js +0 -54
  179. package/dist/reducers/backgroundTaskManagerReducer.d.ts +0 -62
  180. package/dist/reducers/backgroundTaskManagerReducer.js +0 -106
  181. package/dist/reducers/confirmationReducer.d.ts +0 -37
  182. package/dist/reducers/confirmationReducer.js +0 -193
  183. package/dist/reducers/helpSelectorReducer.d.ts +0 -25
  184. package/dist/reducers/helpSelectorReducer.js +0 -52
  185. package/dist/reducers/marketplaceAddFormReducer.d.ts +0 -24
  186. package/dist/reducers/marketplaceAddFormReducer.js +0 -58
  187. package/dist/reducers/mcpManagerReducer.d.ts +0 -37
  188. package/dist/reducers/mcpManagerReducer.js +0 -74
  189. package/dist/reducers/pluginDetailReducer.d.ts +0 -32
  190. package/dist/reducers/pluginDetailReducer.js +0 -70
  191. package/dist/reducers/questionReducer.d.ts +0 -82
  192. package/dist/reducers/questionReducer.js +0 -375
  193. package/dist/reducers/rewindSelectorReducer.d.ts +0 -21
  194. package/dist/reducers/rewindSelectorReducer.js +0 -37
  195. package/dist/reducers/selectorReducer.d.ts +0 -23
  196. package/dist/reducers/selectorReducer.js +0 -42
  197. package/dist/reducers/workflowManagerReducer.d.ts +0 -40
  198. package/dist/reducers/workflowManagerReducer.js +0 -100
  199. package/dist/session-selector-cli.d.ts +0 -3
  200. package/dist/session-selector-cli.js +0 -25
  201. package/dist/stdio/agentBridge.d.ts +0 -139
  202. package/dist/stdio/agentBridge.js +0 -999
  203. package/dist/stdio/daemonServer.d.ts +0 -67
  204. package/dist/stdio/daemonServer.js +0 -191
  205. package/dist/stdio/index.d.ts +0 -5
  206. package/dist/stdio/index.js +0 -5
  207. package/dist/stdio/jsonRpcConnection.d.ts +0 -39
  208. package/dist/stdio/jsonRpcConnection.js +0 -135
  209. package/dist/stdio/protocol.d.ts +0 -41
  210. package/dist/stdio/protocol.js +0 -26
  211. package/dist/stdio/stdioServer.d.ts +0 -36
  212. package/dist/stdio/stdioServer.js +0 -51
  213. package/dist/stdio-cli.d.ts +0 -8
  214. package/dist/stdio-cli.js +0 -15
  215. package/dist/types.d.ts +0 -20
  216. package/dist/types.js +0 -1
  217. package/dist/utils/bracketedPaste.d.ts +0 -39
  218. package/dist/utils/bracketedPaste.js +0 -122
  219. package/dist/utils/clipboard.d.ts +0 -21
  220. package/dist/utils/clipboard.js +0 -347
  221. package/dist/utils/constants.d.ts +0 -16
  222. package/dist/utils/constants.js +0 -18
  223. package/dist/utils/highlightUtils.d.ts +0 -1
  224. package/dist/utils/highlightUtils.js +0 -93
  225. package/dist/utils/inputUtils.d.ts +0 -17
  226. package/dist/utils/inputUtils.js +0 -67
  227. package/dist/utils/logger.d.ts +0 -71
  228. package/dist/utils/logger.js +0 -259
  229. package/dist/utils/markdownTable.d.ts +0 -34
  230. package/dist/utils/markdownTable.js +0 -302
  231. package/dist/utils/rewindCheckpoints.d.ts +0 -8
  232. package/dist/utils/rewindCheckpoints.js +0 -17
  233. package/dist/utils/throttle.d.ts +0 -14
  234. package/dist/utils/throttle.js +0 -55
  235. package/dist/utils/toolParameterTransforms.d.ts +0 -18
  236. package/dist/utils/toolParameterTransforms.js +0 -73
  237. package/dist/utils/usageSummary.d.ts +0 -28
  238. package/dist/utils/usageSummary.js +0 -121
  239. package/dist/utils/version.d.ts +0 -1
  240. package/dist/utils/version.js +0 -4
  241. package/dist/utils/worktree.d.ts +0 -35
  242. package/dist/utils/worktree.js +0 -219
package/dist/index.js DELETED
@@ -1,447 +0,0 @@
1
- import yargs from "yargs";
2
- import { hideBin } from "yargs/helpers";
3
- import { startCli } from "./cli.js";
4
- import { generateRandomName, loadMergedWaveConfig, } from "wave-agent-sdk";
5
- import { createWorktree } from "./utils/worktree.js";
6
- import path from "path";
7
- import { readFileSync } from "fs";
8
- import { fileURLToPath } from "url";
9
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
- const packageJsonPath = path.resolve(__dirname, "../package.json");
11
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
12
- const version = packageJson.version;
13
- // Export main function for external use
14
- export async function main() {
15
- try {
16
- const originalCwd = process.cwd();
17
- const argv = await yargs(hideBin(process.argv))
18
- .option("restore", {
19
- alias: "r",
20
- description: "Restore session by ID (or list sessions if no ID provided)",
21
- type: "string",
22
- global: false,
23
- })
24
- .option("continue", {
25
- alias: "c",
26
- description: "Continue from last session",
27
- type: "boolean",
28
- global: false,
29
- })
30
- .option("worktree", {
31
- alias: "w",
32
- description: "Start session in a git worktree (optional name)",
33
- type: "string",
34
- global: false,
35
- })
36
- .option("print", {
37
- alias: "p",
38
- description: "Print response without interactive mode",
39
- type: "string",
40
- global: false,
41
- })
42
- .option("stdio", {
43
- description: "Start in stdio mode (JSON-RPC over stdin/stdout)",
44
- type: "boolean",
45
- default: false,
46
- global: false,
47
- })
48
- .option("daemon", {
49
- description: "Start as a background daemon (JSON-RPC over a unix socket at PATH)",
50
- type: "string",
51
- global: false,
52
- })
53
- .option("show-stats", {
54
- description: "Show timing and usage statistics in print mode",
55
- type: "boolean",
56
- global: false,
57
- })
58
- .option("dangerously-skip-permissions", {
59
- description: "Skip all permission checks (dangerous)",
60
- type: "boolean",
61
- default: false,
62
- global: false,
63
- })
64
- .option("permission-mode", {
65
- description: "Permission mode to use for the session",
66
- choices: [
67
- "acceptEdits",
68
- "bypassPermissions",
69
- "default",
70
- "dontAsk",
71
- "plan",
72
- ],
73
- type: "string",
74
- global: false,
75
- })
76
- .option("plugin-dir", {
77
- description: "Load a plugin from a specific directory",
78
- type: "array",
79
- string: true,
80
- global: false,
81
- })
82
- .option("add-dir", {
83
- description: "Add a directory to the session Safe Zone (repeatable)",
84
- type: "array",
85
- string: true,
86
- global: false,
87
- })
88
- .option("tools", {
89
- description: 'Specify a comma-separated list of tools to enable (e.g., \'Bash,Read,Write\'). Use "" to disable all, "default" for all.',
90
- type: "string",
91
- global: false,
92
- })
93
- .option("allowed-tools", {
94
- description: "Specify a comma-separated list of tools to always allow (e.g., 'Bash(ls),Read')",
95
- type: "string",
96
- global: false,
97
- })
98
- .option("disallowed-tools", {
99
- description: "Specify a comma-separated list of tools to always disallow (e.g., 'Bash(rm *),Write')",
100
- type: "string",
101
- global: false,
102
- })
103
- .option("model", {
104
- description: "Specify the AI model to use",
105
- type: "string",
106
- global: false,
107
- })
108
- .option("mcp-config", {
109
- description: "MCP server configuration as JSON string (same format as .mcp.json)",
110
- type: "string",
111
- global: false,
112
- })
113
- .command("plugin", "Manage plugins and marketplaces", (yargs) => {
114
- return yargs
115
- .help()
116
- .command("marketplace", "Manage plugin marketplaces", (yargs) => {
117
- return yargs
118
- .help()
119
- .command("add <input>", "Add a plugin marketplace (local path, owner/repo, or Git URL)", (yargs) => {
120
- return yargs.positional("input", {
121
- describe: "Path to local marketplace, GitHub owner/repo, or full Git URL (with optional #ref)",
122
- type: "string",
123
- });
124
- }, async (argv) => {
125
- const { addMarketplaceCommand } = await import("./commands/plugin/marketplace.js");
126
- await addMarketplaceCommand(argv);
127
- })
128
- .command("update [name]", "Update registered marketplace(s)", (yargs) => {
129
- return yargs.positional("name", {
130
- describe: "Name of the marketplace to update",
131
- type: "string",
132
- });
133
- }, async (argv) => {
134
- const { updateMarketplaceCommand } = await import("./commands/plugin/marketplace.js");
135
- await updateMarketplaceCommand(argv);
136
- })
137
- .command("list", "List registered marketplaces", {}, async () => {
138
- const { listMarketplacesCommand } = await import("./commands/plugin/marketplace.js");
139
- await listMarketplacesCommand();
140
- })
141
- .demandCommand(1, "Please specify a marketplace subcommand");
142
- }, () => { })
143
- .command("install <plugin>", "Install a plugin from a marketplace", (yargs) => {
144
- return yargs
145
- .positional("plugin", {
146
- describe: "Plugin to install (format: name@marketplace)",
147
- type: "string",
148
- })
149
- .option("scope", {
150
- alias: "s",
151
- describe: "Scope to enable the plugin in",
152
- choices: ["user", "project", "local"],
153
- type: "string",
154
- });
155
- }, async (argv) => {
156
- const { installPluginCommand } = await import("./commands/plugin/install.js");
157
- await installPluginCommand(argv);
158
- })
159
- .command("list", "List all available plugins from marketplaces", {}, async () => {
160
- const { listPluginsCommand } = await import("./commands/plugin/list.js");
161
- await listPluginsCommand();
162
- })
163
- .command("uninstall <plugin>", "Uninstall a plugin", (yargs) => {
164
- return yargs.positional("plugin", {
165
- describe: "Plugin to uninstall (format: name@marketplace)",
166
- type: "string",
167
- });
168
- }, async (argv) => {
169
- const { uninstallPluginCommand } = await import("./commands/plugin/uninstall.js");
170
- await uninstallPluginCommand(argv);
171
- })
172
- .command("update <plugin>", "Update a plugin (uninstall followed by install)", (yargs) => {
173
- return yargs.positional("plugin", {
174
- describe: "Plugin to update (format: name@marketplace)",
175
- type: "string",
176
- });
177
- }, async (argv) => {
178
- const { updatePluginCommand } = await import("./commands/plugin/update.js");
179
- await updatePluginCommand(argv);
180
- });
181
- })
182
- .command("daemon", "Manage the wave daemon (client subcommands — to START a daemon use `wave --daemon <socket>` instead)", (yargs) => {
183
- return yargs
184
- .help()
185
- .command("list", "List sessions hosted by the daemon (in-memory registry)", {}, async () => {
186
- const { daemonListCommand, DEFAULT_DAEMON_SOCKET } = await import("./daemon/commands.js");
187
- await daemonListCommand(DEFAULT_DAEMON_SOCKET);
188
- })
189
- .command("status <sessionId>", "Show a session's progress and recent messages", (yargs) => {
190
- return yargs
191
- .positional("sessionId", {
192
- describe: "Session ID hosted by the daemon",
193
- type: "string",
194
- })
195
- .option("lines", {
196
- describe: "Number of recent messages to show",
197
- default: 20,
198
- type: "number",
199
- });
200
- }, async (argv) => {
201
- const { daemonStatusCommand, DEFAULT_DAEMON_SOCKET } = await import("./daemon/commands.js");
202
- await daemonStatusCommand(DEFAULT_DAEMON_SOCKET, argv.sessionId, argv.lines);
203
- })
204
- .command("send <sessionId> <message>", "Inject a message into a session and wait for the reply", (yargs) => {
205
- return yargs
206
- .positional("sessionId", {
207
- describe: "Session ID hosted by the daemon",
208
- type: "string",
209
- })
210
- .positional("message", {
211
- describe: "Message to send",
212
- type: "string",
213
- })
214
- .option("timeout", {
215
- describe: "Seconds to wait for the reply (0 = no limit)",
216
- default: 600,
217
- type: "number",
218
- });
219
- }, async (argv) => {
220
- const { daemonSendCommand, DEFAULT_DAEMON_SOCKET } = await import("./daemon/commands.js");
221
- await daemonSendCommand(DEFAULT_DAEMON_SOCKET, argv.sessionId, argv.message, { timeout: argv.timeout });
222
- })
223
- .command("respond <sessionId> <requestId>", "Respond to a pending permission request", (yargs) => {
224
- return yargs
225
- .positional("sessionId", {
226
- describe: "Session ID hosting the pending request",
227
- type: "string",
228
- })
229
- .positional("requestId", {
230
- describe: "Pending permission request ID",
231
- type: "string",
232
- })
233
- .option("allow", {
234
- describe: "Allow the operation",
235
- type: "boolean",
236
- })
237
- .option("deny", {
238
- describe: "Deny the operation",
239
- type: "boolean",
240
- })
241
- .option("reason", {
242
- describe: "Reason for the decision (deny)",
243
- type: "string",
244
- })
245
- .option("answer", {
246
- describe: "Answers JSON for AskUserQuestion requests",
247
- type: "string",
248
- })
249
- .option("rule", {
250
- describe: "Persist an allowed rule (e.g. Bash(ls))",
251
- type: "string",
252
- })
253
- .option("mode", {
254
- describe: "Switch the session's permission mode",
255
- type: "string",
256
- });
257
- }, async (argv) => {
258
- const { daemonRespondCommand, DEFAULT_DAEMON_SOCKET } = await import("./daemon/commands.js");
259
- await daemonRespondCommand(DEFAULT_DAEMON_SOCKET, argv.sessionId, argv.requestId, {
260
- allow: argv.allow,
261
- deny: argv.deny,
262
- reason: argv.reason,
263
- answer: argv.answer,
264
- rule: argv.rule,
265
- mode: argv.mode,
266
- });
267
- })
268
- .demandCommand(1, "Please specify a daemon subcommand");
269
- })
270
- .command("update", "Update WAVE Code to the latest version", {}, async () => {
271
- const { updateCommand } = await import("./commands/update.js");
272
- await updateCommand();
273
- })
274
- .version()
275
- .alias("v", "version")
276
- .example("$0", "Start CLI with default settings")
277
- .example("$0 --restore session_123", "Restore specific session")
278
- .example("$0 --continue", "Continue from last session")
279
- .example("$0 --print 'Hello'", "Send message in print mode")
280
- .example("$0 -p 'Hello' --show-stats", "Send message in print mode with statistics")
281
- .help("h")
282
- .recommendCommands()
283
- .strict()
284
- .parseAsync();
285
- const parseTools = (tools) => {
286
- if (tools === undefined || tools === "default")
287
- return undefined;
288
- if (tools === "")
289
- return [];
290
- // Improved parsing to handle commas inside parentheses
291
- const result = [];
292
- let current = "";
293
- let depth = 0;
294
- for (let i = 0; i < tools.length; i++) {
295
- const char = tools[i];
296
- if (char === "(")
297
- depth++;
298
- else if (char === ")")
299
- depth--;
300
- if (char === "," && depth === 0) {
301
- result.push(current.trim());
302
- current = "";
303
- }
304
- else {
305
- current += char;
306
- }
307
- }
308
- if (current.trim()) {
309
- result.push(current.trim());
310
- }
311
- return result;
312
- };
313
- const tools = parseTools(argv.tools);
314
- const allowedTools = parseTools(argv.allowedTools);
315
- const disallowedTools = parseTools(argv.disallowedTools);
316
- // Parse MCP server configuration from --mcp-config JSON string
317
- let mcpServers;
318
- if (argv.mcpConfig) {
319
- try {
320
- const parsed = JSON.parse(argv.mcpConfig);
321
- mcpServers = parsed.mcpServers || parsed;
322
- }
323
- catch {
324
- console.error("Failed to parse --mcp-config as JSON");
325
- process.exit(1);
326
- }
327
- }
328
- // Resolve plugin directories to absolute paths before any worktree logic
329
- const pluginDirs = argv.pluginDir?.map((dir) => path.resolve(originalCwd, dir));
330
- // Resolve additional directories to absolute paths (relative to the
331
- // original working directory, before any worktree change)
332
- const additionalDirectories = argv.addDir?.map((dir) => path.resolve(originalCwd, dir));
333
- let worktreeSession;
334
- if (argv.worktree !== undefined ||
335
- process.argv.includes("-w") ||
336
- process.argv.includes("--worktree")) {
337
- let name = argv.worktree;
338
- if (!name || name === "") {
339
- name = generateRandomName();
340
- }
341
- const baseRef = loadMergedWaveConfig(originalCwd)?.worktree?.baseRef;
342
- worktreeSession = await createWorktree(name, originalCwd, { baseRef });
343
- // Note: the full worktree session (originalCwd etc.) is injected into the
344
- // agent's DI container after the agent is created in useChat.tsx. This keeps
345
- // worktree state per-session instead of process-global.
346
- }
347
- const workdir = worktreeSession?.path || originalCwd;
348
- if (worktreeSession) {
349
- process.chdir(workdir);
350
- }
351
- // Handle restore session command
352
- if (argv.restore === "" ||
353
- (process.argv.includes("-r") && argv.restore === undefined) ||
354
- (process.argv.includes("--restore") && argv.restore === undefined)) {
355
- // Interactive session selection
356
- const { startSessionSelectorCli } = await import("./session-selector-cli.js");
357
- const selectedSessionId = await startSessionSelectorCli({ workdir });
358
- if (!selectedSessionId) {
359
- return;
360
- }
361
- // Continue with the selected session
362
- return startCli({
363
- restoreSessionId: selectedSessionId,
364
- bypassPermissions: argv.dangerouslySkipPermissions,
365
- permissionMode: argv.permissionMode,
366
- pluginDirs,
367
- additionalDirectories,
368
- tools,
369
- allowedTools,
370
- disallowedTools,
371
- worktreeSession,
372
- workdir,
373
- originalCwd,
374
- version,
375
- model: argv.model,
376
- mcpServers,
377
- });
378
- }
379
- // Handle print mode directly
380
- if (argv.print !== undefined) {
381
- const { startPrintCli } = await import("./print-cli.js");
382
- return startPrintCli({
383
- restoreSessionId: argv.restore,
384
- continueLastSession: argv.continue,
385
- message: argv.print,
386
- showStats: argv.showStats,
387
- bypassPermissions: argv.dangerouslySkipPermissions,
388
- permissionMode: argv.permissionMode,
389
- pluginDirs,
390
- additionalDirectories,
391
- tools,
392
- allowedTools,
393
- disallowedTools,
394
- worktreeSession,
395
- workdir,
396
- originalCwd,
397
- version,
398
- model: argv.model,
399
- mcpServers,
400
- });
401
- }
402
- // Handle stdio mode
403
- if (argv.stdio) {
404
- const { startStdioCli } = await import("./stdio-cli.js");
405
- return startStdioCli();
406
- }
407
- // Handle daemon mode (remote background sessions)
408
- if (typeof argv.daemon === "string") {
409
- const { startDaemonCli } = await import("./daemon-cli.js");
410
- return startDaemonCli(argv.daemon);
411
- }
412
- await startCli({
413
- restoreSessionId: argv.restore,
414
- continueLastSession: argv.continue,
415
- bypassPermissions: argv.dangerouslySkipPermissions,
416
- permissionMode: argv.permissionMode,
417
- pluginDirs,
418
- additionalDirectories,
419
- tools,
420
- allowedTools,
421
- disallowedTools,
422
- worktreeSession,
423
- workdir,
424
- originalCwd,
425
- version,
426
- model: argv.model,
427
- mcpServers,
428
- });
429
- }
430
- catch (error) {
431
- console.error("Failed to start WAVE Code:", error);
432
- process.exit(1);
433
- }
434
- }
435
- // Export CLI function
436
- export { startCli } from "./cli.js";
437
- // Export logger
438
- export { logger } from "./utils/logger.js";
439
- // Export clipboard utilities
440
- export { readClipboardImage, cleanupTempImage, hasClipboardImage, } from "./utils/clipboard.js";
441
- // Execute main function if this file is run directly
442
- if (import.meta.url === `file://${process.argv[1]}`) {
443
- main().catch((error) => {
444
- console.error("Failed to start WAVE Code:", error);
445
- process.exit(1);
446
- });
447
- }
@@ -1,30 +0,0 @@
1
- import { Key } from "ink";
2
- import { PermissionMode } from "wave-agent-sdk";
3
- import { InputState, InputAction, InputManagerCallbacks } from "./inputReducer.js";
4
- export declare const expandLongTextPlaceholders: (text: string, longTextMap: Record<string, string>) => string;
5
- export declare const handleSubmit: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, attachedImagesOverride?: Array<{
6
- id: number;
7
- path: string;
8
- mimeType: string;
9
- }>) => Promise<void>;
10
- export declare const handlePasteImage: (dispatch: React.Dispatch<InputAction>) => Promise<boolean>;
11
- export declare const cyclePermissionMode: (currentMode: PermissionMode, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>) => void;
12
- export declare const getAtSelectorPosition: (text: string, cursorPosition: number) => number;
13
- export declare const getSlashSelectorPosition: (text: string, cursorPosition: number) => number;
14
- export declare const updateSearchQueriesForActiveSelectors: (state: InputState, dispatch: React.Dispatch<InputAction>, inputText: string, cursorPosition: number) => void;
15
- export declare const processSelectorInput: (state: InputState, dispatch: React.Dispatch<InputAction>, char: string) => void;
16
- export declare const handlePasteInput: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, input: string) => void;
17
- export declare const getWordEnd: (text: string, startPos: number) => number;
18
- export declare const handleCommandSelect: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, command: string) => {
19
- newInput: string;
20
- newCursorPosition: number;
21
- };
22
- export declare const handleFileSelect: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, filePath: string) => {
23
- newInput: string;
24
- newCursorPosition: number;
25
- };
26
- export declare const checkForAtDeletion: (state: InputState, dispatch: React.Dispatch<InputAction>, cursorPosition: number) => boolean;
27
- export declare const checkForSlashDeletion: (state: InputState, dispatch: React.Dispatch<InputAction>, cursorPosition: number) => boolean;
28
- export declare const handleSelectorInput: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, input: string, key: Key) => boolean;
29
- export declare const handleNormalInput: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, input: string, key: Key, clearImages?: () => void) => Promise<boolean>;
30
- export declare const handleInput: (state: InputState, dispatch: React.Dispatch<InputAction>, callbacks: Partial<InputManagerCallbacks>, input: string, key: Key, clearImages?: () => void) => Promise<boolean>;