wave-code 0.19.5 → 0.19.7
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.
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +2 -2
- package/dist/commands/plugin/disable.d.ts +0 -1
- package/dist/commands/plugin/enable.d.ts +0 -1
- package/dist/commands/plugin/install.d.ts +0 -1
- package/dist/commands/plugin/list.d.ts +0 -1
- package/dist/commands/plugin/marketplace.d.ts +0 -1
- package/dist/commands/plugin/uninstall.d.ts +0 -1
- package/dist/commands/plugin/update.d.ts +0 -1
- package/dist/commands/update.d.ts +0 -1
- package/dist/components/App.d.ts +0 -1
- package/dist/components/App.js +5 -5
- package/dist/components/BackgroundTaskManager.d.ts +0 -1
- package/dist/components/BangDisplay.d.ts +0 -1
- package/dist/components/BtwDisplay.d.ts +0 -1
- package/dist/components/ChatInterface.d.ts +0 -1
- package/dist/components/CommandSelector.d.ts +0 -1
- package/dist/components/CompactDisplay.d.ts +0 -1
- package/dist/components/ConfirmationDetails.d.ts +0 -1
- package/dist/components/ConfirmationSelector.d.ts +0 -1
- package/dist/components/DiffDisplay.d.ts +0 -1
- package/dist/components/DiscoverView.d.ts +0 -1
- package/dist/components/FileSelector.d.ts +0 -1
- package/dist/components/HelpView.d.ts +0 -1
- package/dist/components/HistorySearch.d.ts +0 -1
- package/dist/components/InputBox.d.ts +0 -1
- package/dist/components/InstalledView.d.ts +0 -1
- package/dist/components/LoadingIndicator.d.ts +0 -1
- package/dist/components/LoginCommand.d.ts +0 -1
- package/dist/components/Markdown.d.ts +0 -1
- package/dist/components/MarketplaceAddForm.d.ts +0 -1
- package/dist/components/MarketplaceDetail.d.ts +0 -1
- package/dist/components/MarketplaceList.d.ts +0 -1
- package/dist/components/MarketplaceView.d.ts +0 -1
- package/dist/components/McpManager.d.ts +0 -1
- package/dist/components/MessageBlockItem.d.ts +0 -1
- package/dist/components/MessageList.d.ts +0 -1
- package/dist/components/ModelSelector.d.ts +0 -1
- package/dist/components/PlanDisplay.d.ts +0 -1
- package/dist/components/PluginDetail.d.ts +0 -1
- package/dist/components/PluginList.d.ts +0 -1
- package/dist/components/PluginManagerShell.d.ts +0 -1
- package/dist/components/PluginManagerTypes.d.ts +0 -1
- package/dist/components/QueuedMessageList.d.ts +0 -1
- package/dist/components/ReasoningDisplay.d.ts +0 -1
- package/dist/components/RewindCommand.d.ts +0 -1
- package/dist/components/SessionSelector.d.ts +0 -1
- package/dist/components/StatusCommand.d.ts +0 -1
- package/dist/components/StatusLine.d.ts +0 -1
- package/dist/components/TaskList.d.ts +0 -1
- package/dist/components/TaskNotificationMessage.d.ts +0 -1
- package/dist/components/ToolDisplay.d.ts +0 -1
- package/dist/components/WorkflowManager.d.ts +0 -1
- package/dist/components/WorktreeExitPrompt.d.ts +0 -1
- package/dist/constants/commands.d.ts +0 -1
- package/dist/contexts/PluginManagerContext.d.ts +0 -1
- package/dist/contexts/useAppConfig.d.ts +0 -1
- package/dist/contexts/useChat.d.ts +0 -1
- package/dist/contexts/useChat.js +16 -1
- package/dist/contracts/status.d.ts +0 -1
- package/dist/hooks/useInputManager.d.ts +0 -1
- package/dist/hooks/usePluginManager.d.ts +0 -1
- package/dist/hooks/useTasks.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +7 -10
- package/dist/managers/inputHandlers.d.ts +0 -1
- package/dist/managers/inputReducer.d.ts +0 -1
- package/dist/plugin-manager-cli.d.ts +0 -1
- package/dist/print-cli.d.ts +0 -1
- package/dist/print-cli.js +15 -1
- package/dist/reducers/backgroundTaskManagerReducer.d.ts +0 -1
- package/dist/reducers/confirmationReducer.d.ts +0 -1
- package/dist/reducers/helpSelectorReducer.d.ts +0 -1
- package/dist/reducers/marketplaceAddFormReducer.d.ts +0 -1
- package/dist/reducers/mcpManagerReducer.d.ts +0 -1
- package/dist/reducers/pluginDetailReducer.d.ts +0 -1
- package/dist/reducers/questionReducer.d.ts +0 -1
- package/dist/reducers/rewindSelectorReducer.d.ts +0 -1
- package/dist/reducers/selectorReducer.d.ts +0 -1
- package/dist/reducers/workflowManagerReducer.d.ts +0 -1
- package/dist/session-selector-cli.d.ts +0 -1
- package/dist/stdio/agentBridge.d.ts +2 -1
- package/dist/stdio/agentBridge.js +25 -27
- package/dist/stdio/index.d.ts +0 -1
- package/dist/stdio/protocol.d.ts +2 -3
- package/dist/stdio/stdioServer.d.ts +0 -1
- package/dist/stdio-cli.d.ts +0 -1
- package/dist/types.d.ts +2 -1
- package/dist/utils/clipboard.d.ts +0 -1
- package/dist/utils/constants.d.ts +0 -1
- package/dist/utils/highlightUtils.d.ts +0 -1
- package/dist/utils/inputUtils.d.ts +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/throttle.d.ts +0 -1
- package/dist/utils/toolParameterTransforms.d.ts +0 -1
- package/dist/utils/usageSummary.d.ts +0 -1
- package/dist/utils/version.d.ts +0 -1
- package/dist/utils/worktree.d.ts +0 -1
- package/package.json +2 -2
- package/src/cli.tsx +2 -0
- package/src/components/App.tsx +5 -0
- package/src/contexts/useChat.tsx +18 -0
- package/src/index.ts +7 -15
- package/src/print-cli.ts +17 -0
- package/src/stdio/agentBridge.ts +41 -38
- package/src/stdio/protocol.ts +5 -1
- package/src/types.ts +2 -0
- package/dist/cli.d.ts.map +0 -1
- package/dist/commands/plugin/disable.d.ts.map +0 -1
- package/dist/commands/plugin/enable.d.ts.map +0 -1
- package/dist/commands/plugin/install.d.ts.map +0 -1
- package/dist/commands/plugin/list.d.ts.map +0 -1
- package/dist/commands/plugin/marketplace.d.ts.map +0 -1
- package/dist/commands/plugin/uninstall.d.ts.map +0 -1
- package/dist/commands/plugin/update.d.ts.map +0 -1
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/components/App.d.ts.map +0 -1
- package/dist/components/BackgroundTaskManager.d.ts.map +0 -1
- package/dist/components/BangDisplay.d.ts.map +0 -1
- package/dist/components/BtwDisplay.d.ts.map +0 -1
- package/dist/components/ChatInterface.d.ts.map +0 -1
- package/dist/components/CommandSelector.d.ts.map +0 -1
- package/dist/components/CompactDisplay.d.ts.map +0 -1
- package/dist/components/ConfirmationDetails.d.ts.map +0 -1
- package/dist/components/ConfirmationSelector.d.ts.map +0 -1
- package/dist/components/DiffDisplay.d.ts.map +0 -1
- package/dist/components/DiscoverView.d.ts.map +0 -1
- package/dist/components/FileSelector.d.ts.map +0 -1
- package/dist/components/HelpView.d.ts.map +0 -1
- package/dist/components/HistorySearch.d.ts.map +0 -1
- package/dist/components/InputBox.d.ts.map +0 -1
- package/dist/components/InstalledView.d.ts.map +0 -1
- package/dist/components/LoadingIndicator.d.ts.map +0 -1
- package/dist/components/LoginCommand.d.ts.map +0 -1
- package/dist/components/Markdown.d.ts.map +0 -1
- package/dist/components/MarketplaceAddForm.d.ts.map +0 -1
- package/dist/components/MarketplaceDetail.d.ts.map +0 -1
- package/dist/components/MarketplaceList.d.ts.map +0 -1
- package/dist/components/MarketplaceView.d.ts.map +0 -1
- package/dist/components/McpManager.d.ts.map +0 -1
- package/dist/components/MessageBlockItem.d.ts.map +0 -1
- package/dist/components/MessageList.d.ts.map +0 -1
- package/dist/components/ModelSelector.d.ts.map +0 -1
- package/dist/components/PlanDisplay.d.ts.map +0 -1
- package/dist/components/PluginDetail.d.ts.map +0 -1
- package/dist/components/PluginList.d.ts.map +0 -1
- package/dist/components/PluginManagerShell.d.ts.map +0 -1
- package/dist/components/PluginManagerTypes.d.ts.map +0 -1
- package/dist/components/QueuedMessageList.d.ts.map +0 -1
- package/dist/components/ReasoningDisplay.d.ts.map +0 -1
- package/dist/components/RewindCommand.d.ts.map +0 -1
- package/dist/components/SessionSelector.d.ts.map +0 -1
- package/dist/components/StatusCommand.d.ts.map +0 -1
- package/dist/components/StatusLine.d.ts.map +0 -1
- package/dist/components/TaskList.d.ts.map +0 -1
- package/dist/components/TaskNotificationMessage.d.ts.map +0 -1
- package/dist/components/ToolDisplay.d.ts.map +0 -1
- package/dist/components/WorkflowManager.d.ts.map +0 -1
- package/dist/components/WorktreeExitPrompt.d.ts.map +0 -1
- package/dist/constants/commands.d.ts.map +0 -1
- package/dist/contexts/PluginManagerContext.d.ts.map +0 -1
- package/dist/contexts/useAppConfig.d.ts.map +0 -1
- package/dist/contexts/useChat.d.ts.map +0 -1
- package/dist/contracts/status.d.ts.map +0 -1
- package/dist/hooks/useInputManager.d.ts.map +0 -1
- package/dist/hooks/usePluginManager.d.ts.map +0 -1
- package/dist/hooks/useTasks.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/managers/inputHandlers.d.ts.map +0 -1
- package/dist/managers/inputReducer.d.ts.map +0 -1
- package/dist/plugin-manager-cli.d.ts.map +0 -1
- package/dist/print-cli.d.ts.map +0 -1
- package/dist/reducers/backgroundTaskManagerReducer.d.ts.map +0 -1
- package/dist/reducers/confirmationReducer.d.ts.map +0 -1
- package/dist/reducers/helpSelectorReducer.d.ts.map +0 -1
- package/dist/reducers/marketplaceAddFormReducer.d.ts.map +0 -1
- package/dist/reducers/mcpManagerReducer.d.ts.map +0 -1
- package/dist/reducers/pluginDetailReducer.d.ts.map +0 -1
- package/dist/reducers/questionReducer.d.ts.map +0 -1
- package/dist/reducers/rewindSelectorReducer.d.ts.map +0 -1
- package/dist/reducers/selectorReducer.d.ts.map +0 -1
- package/dist/reducers/workflowManagerReducer.d.ts.map +0 -1
- package/dist/session-selector-cli.d.ts.map +0 -1
- package/dist/stdio/agentBridge.d.ts.map +0 -1
- package/dist/stdio/index.d.ts.map +0 -1
- package/dist/stdio/protocol.d.ts.map +0 -1
- package/dist/stdio/stdioServer.d.ts.map +0 -1
- package/dist/stdio-cli.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/clipboard.d.ts.map +0 -1
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/highlightUtils.d.ts.map +0 -1
- package/dist/utils/inputUtils.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/throttle.d.ts.map +0 -1
- package/dist/utils/toolParameterTransforms.d.ts.map +0 -1
- package/dist/utils/usageSummary.d.ts.map +0 -1
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/worktree.d.ts.map +0 -1
|
@@ -41,6 +41,8 @@ export declare class AgentBridge {
|
|
|
41
41
|
private clearMessages;
|
|
42
42
|
private rewindToMessage;
|
|
43
43
|
private deleteQueuedMessage;
|
|
44
|
+
private updateQueuedMessage;
|
|
45
|
+
private deleteQueuedMessageById;
|
|
44
46
|
private getMessages;
|
|
45
47
|
private getFullMessageThread;
|
|
46
48
|
private setPermissionMode;
|
|
@@ -77,4 +79,3 @@ export declare class RpcError extends Error {
|
|
|
77
79
|
constructor(code: number, message: string);
|
|
78
80
|
toJsonRpcError(): JsonRpcError;
|
|
79
81
|
}
|
|
80
|
-
//# sourceMappingURL=agentBridge.d.ts.map
|
|
@@ -16,19 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { Agent, listSessions, searchFiles, PromptHistoryManager, AuthService, PluginCore, } from "wave-agent-sdk";
|
|
18
18
|
import { INTERNAL_ERROR as PROTOCOL_INTERNAL_ERROR, METHOD_NOT_FOUND as PROTOCOL_METHOD_NOT_FOUND, } from "./protocol.js";
|
|
19
|
-
import {
|
|
20
|
-
import path from "path";
|
|
21
|
-
import { fileURLToPath } from "url";
|
|
22
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
const CLI_VERSION = (() => {
|
|
24
|
-
try {
|
|
25
|
-
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8"));
|
|
26
|
-
return pkg.version ?? "";
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
})();
|
|
19
|
+
import { logger } from "../utils/logger.js";
|
|
32
20
|
export class AgentBridge {
|
|
33
21
|
constructor(options) {
|
|
34
22
|
this.sessions = new Map();
|
|
@@ -66,6 +54,10 @@ export class AgentBridge {
|
|
|
66
54
|
return this.rewindToMessage(p.messageId, sessionId);
|
|
67
55
|
case "deleteQueuedMessage":
|
|
68
56
|
return this.deleteQueuedMessage(p.index, sessionId);
|
|
57
|
+
case "updateQueuedMessage":
|
|
58
|
+
return this.updateQueuedMessage(p.id, p.text, p.images, sessionId);
|
|
59
|
+
case "deleteQueuedMessageById":
|
|
60
|
+
return this.deleteQueuedMessageById(p.id, sessionId);
|
|
69
61
|
case "getMessages":
|
|
70
62
|
return this.getMessages(sessionId);
|
|
71
63
|
case "getFullMessageThread":
|
|
@@ -141,6 +133,7 @@ export class AgentBridge {
|
|
|
141
133
|
const callbacks = this.createCallbacks(ctx);
|
|
142
134
|
const options = {
|
|
143
135
|
callbacks,
|
|
136
|
+
logger,
|
|
144
137
|
workdir: params.workdir,
|
|
145
138
|
restoreSessionId: params.restoreSessionId,
|
|
146
139
|
apiKey: params.apiKey,
|
|
@@ -164,15 +157,11 @@ export class AgentBridge {
|
|
|
164
157
|
agent,
|
|
165
158
|
storedConfig: { ...params },
|
|
166
159
|
});
|
|
167
|
-
if (params.clientVersion) {
|
|
168
|
-
console.debug(`[agentBridge] clientVersion=${params.clientVersion} serverVersion=${CLI_VERSION}`);
|
|
169
|
-
}
|
|
170
160
|
return {
|
|
171
161
|
sessionId: agent.sessionId,
|
|
172
162
|
workingDirectory: agent.workingDirectory,
|
|
173
163
|
permissionMode: agent.getPermissionMode(),
|
|
174
164
|
latestTotalTokens: agent.latestTotalTokens,
|
|
175
|
-
serverVersion: CLI_VERSION,
|
|
176
165
|
};
|
|
177
166
|
}
|
|
178
167
|
async destroy(sessionId) {
|
|
@@ -292,6 +281,19 @@ export class AgentBridge {
|
|
|
292
281
|
entry.agent.removeQueuedMessage(index);
|
|
293
282
|
return null;
|
|
294
283
|
}
|
|
284
|
+
updateQueuedMessage(id, text, images, sessionId) {
|
|
285
|
+
const entry = this.requireSession(sessionId);
|
|
286
|
+
const ok = entry.agent.updateQueuedMessageById(id, {
|
|
287
|
+
content: text,
|
|
288
|
+
images,
|
|
289
|
+
});
|
|
290
|
+
return { ok };
|
|
291
|
+
}
|
|
292
|
+
deleteQueuedMessageById(id, sessionId) {
|
|
293
|
+
const entry = this.requireSession(sessionId);
|
|
294
|
+
entry.agent.removeQueuedMessageById(id);
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
295
297
|
getMessages(sessionId) {
|
|
296
298
|
const entry = this.requireSession(sessionId);
|
|
297
299
|
return { messages: entry.agent.messages };
|
|
@@ -356,16 +358,6 @@ export class AgentBridge {
|
|
|
356
358
|
return new Promise((resolve) => {
|
|
357
359
|
this.pendingPermissions.set(requestId, resolve);
|
|
358
360
|
this.emit("permissionRequest", { requestId, context }, ctx.registeredSessionId);
|
|
359
|
-
// 5-minute timeout → auto-deny
|
|
360
|
-
setTimeout(() => {
|
|
361
|
-
if (this.pendingPermissions.has(requestId)) {
|
|
362
|
-
this.pendingPermissions.delete(requestId);
|
|
363
|
-
resolve({
|
|
364
|
-
behavior: "deny",
|
|
365
|
-
message: "Permission request timed out",
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}, 5 * 60 * 1000);
|
|
369
361
|
});
|
|
370
362
|
}
|
|
371
363
|
// ── Auth (global) ────────────────────────────────────────────
|
|
@@ -510,6 +502,9 @@ export class AgentBridge {
|
|
|
510
502
|
onPermissionModeChange: (mode) => {
|
|
511
503
|
this.emit("permissionModeChange", { mode }, ctx.registeredSessionId);
|
|
512
504
|
},
|
|
505
|
+
onWorkdirChange: (newCwd) => {
|
|
506
|
+
this.emit("workdirChange", { workdir: newCwd }, ctx.registeredSessionId);
|
|
507
|
+
},
|
|
513
508
|
onMcpServersChange: (servers) => {
|
|
514
509
|
this.emit("mcpServersChange", { servers }, ctx.registeredSessionId);
|
|
515
510
|
},
|
|
@@ -528,6 +523,9 @@ export class AgentBridge {
|
|
|
528
523
|
b.taskId === params.taskId));
|
|
529
524
|
this.emit("notificationMessageAdded", { ...params, message: msg }, ctx.registeredSessionId);
|
|
530
525
|
},
|
|
526
|
+
onCompactBlockAdded: (content) => {
|
|
527
|
+
this.emit("compactBlockAdded", { content }, ctx.registeredSessionId);
|
|
528
|
+
},
|
|
531
529
|
};
|
|
532
530
|
}
|
|
533
531
|
findLastUserMessage(agent) {
|
package/dist/stdio/index.d.ts
CHANGED
package/dist/stdio/protocol.d.ts
CHANGED
|
@@ -34,9 +34,8 @@ export declare const INVALID_REQUEST = -32600;
|
|
|
34
34
|
export declare const METHOD_NOT_FOUND = -32601;
|
|
35
35
|
export declare const INVALID_PARAMS = -32602;
|
|
36
36
|
export declare const INTERNAL_ERROR = -32603;
|
|
37
|
-
export type RequestMethod = "initialize" | "destroy" | "restoreSession" | "listSessions" | "getSessionInfo" | "sendMessage" | "bang" | "abortMessage" | "clearMessages" | "rewindToMessage" | "deleteQueuedMessage" | "getMessages" | "getFullMessageThread" | "setPermissionMode" | "getPermissionMode" | "getMcpServers" | "connectMcpServer" | "disconnectMcpServer" | "getSlashCommands" | "searchFiles" | "getPromptHistory" | "searchPromptHistory" | "updateConfig" | "getAuthStatus" | "login" | "logout" | "listPlugins" | "installPlugin" | "uninstallPlugin" | "enablePlugin" | "disablePlugin" | "updatePlugin" | "listMarketplaces" | "addMarketplace" | "removeMarketplace" | "updateMarketplace";
|
|
37
|
+
export type RequestMethod = "initialize" | "destroy" | "restoreSession" | "listSessions" | "getSessionInfo" | "sendMessage" | "bang" | "abortMessage" | "clearMessages" | "rewindToMessage" | "deleteQueuedMessage" | "updateQueuedMessage" | "deleteQueuedMessageById" | "getMessages" | "getFullMessageThread" | "setPermissionMode" | "getPermissionMode" | "getMcpServers" | "connectMcpServer" | "disconnectMcpServer" | "getSlashCommands" | "searchFiles" | "getPromptHistory" | "searchPromptHistory" | "updateConfig" | "getAuthStatus" | "login" | "logout" | "listPlugins" | "installPlugin" | "uninstallPlugin" | "enablePlugin" | "disablePlugin" | "updatePlugin" | "listMarketplaces" | "addMarketplace" | "removeMarketplace" | "updateMarketplace";
|
|
38
38
|
export type ClientNotificationMethod = "permissionResponse";
|
|
39
|
-
export type ServerNotificationMethod = "messagesChange" | "userMessageAdded" | "assistantMessageAdded" | "assistantContentUpdated" | "assistantReasoningUpdated" | "toolBlockUpdated" | "errorBlockAdded" | "loadingChange" | "commandRunningChange" | "queuedMessagesChange" | "tasksChange" | "sessionIdChange" | "permissionModeChange" | "mcpServersChange" | "bangMessageAdded" | "bangMessageUpdated" | "bangMessageCompleted" | "notificationMessageAdded" | "permissionRequest" | "authUrl";
|
|
39
|
+
export type ServerNotificationMethod = "messagesChange" | "userMessageAdded" | "assistantMessageAdded" | "assistantContentUpdated" | "assistantReasoningUpdated" | "toolBlockUpdated" | "errorBlockAdded" | "loadingChange" | "commandRunningChange" | "queuedMessagesChange" | "tasksChange" | "sessionIdChange" | "permissionModeChange" | "mcpServersChange" | "workdirChange" | "bangMessageAdded" | "bangMessageUpdated" | "bangMessageCompleted" | "notificationMessageAdded" | "permissionRequest" | "authUrl" | "compactBlockAdded";
|
|
40
40
|
export declare function isRequest(msg: unknown): msg is JsonRpcRequest;
|
|
41
41
|
export declare function isNotification(msg: unknown): msg is JsonRpcNotification;
|
|
42
|
-
//# sourceMappingURL=protocol.d.ts.map
|
package/dist/stdio-cli.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export interface BaseAppProps {
|
|
|
9
9
|
disallowedTools?: string[];
|
|
10
10
|
worktreeSession?: WorktreeSession;
|
|
11
11
|
workdir?: string;
|
|
12
|
+
/** The working directory before entering a worktree (CLI -w); injected into the agent's container. */
|
|
13
|
+
originalCwd?: string;
|
|
12
14
|
version?: string;
|
|
13
15
|
model?: string;
|
|
14
16
|
/** Optional MCP server configs to pass to Agent.create() */
|
|
15
17
|
mcpServers?: Record<string, McpServerConfig>;
|
|
16
18
|
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/throttle.d.ts
CHANGED
|
@@ -12,4 +12,3 @@ export interface ThrottledFunction<T extends (...args: unknown[]) => void> {
|
|
|
12
12
|
* every `wait` milliseconds.
|
|
13
13
|
*/
|
|
14
14
|
export declare function throttle<T extends (...args: unknown[]) => void>(func: T, wait: number, options?: ThrottleOptions): ThrottledFunction<T>;
|
|
15
|
-
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -16,4 +16,3 @@ export declare function transformEditParameters(parameters: EditToolParameters):
|
|
|
16
16
|
* Forces type judgment based on tool name using type assertions
|
|
17
17
|
*/
|
|
18
18
|
export declare function transformToolBlockToChanges(toolName: string, parameters: string, startLineNumber?: number): Change[];
|
|
19
|
-
//# sourceMappingURL=toolParameterTransforms.d.ts.map
|
|
@@ -30,4 +30,3 @@ export declare function calculateTokenSummary(usages: Usage[]): Record<string, T
|
|
|
30
30
|
* @param sessionFilePath Optional session file path to display
|
|
31
31
|
*/
|
|
32
32
|
export declare function displayUsageSummary(usages: Usage[], sessionFilePath?: string): void;
|
|
33
|
-
//# sourceMappingURL=usageSummary.d.ts.map
|
package/dist/utils/version.d.ts
CHANGED
package/dist/utils/worktree.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-code",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7",
|
|
4
4
|
"description": "CLI-based code assistant powered by AI, built with React and Ink",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"semver": "^7.7.4",
|
|
42
42
|
"yargs": "^17.7.2",
|
|
43
43
|
"zod": "^3.23.8",
|
|
44
|
-
"wave-agent-sdk": "0.19.
|
|
44
|
+
"wave-agent-sdk": "0.19.7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^19.1.8",
|
package/src/cli.tsx
CHANGED
|
@@ -22,6 +22,7 @@ export async function startCli(options: CliOptions): Promise<void> {
|
|
|
22
22
|
disallowedTools,
|
|
23
23
|
worktreeSession,
|
|
24
24
|
workdir,
|
|
25
|
+
originalCwd,
|
|
25
26
|
version,
|
|
26
27
|
model,
|
|
27
28
|
mcpServers,
|
|
@@ -48,6 +49,7 @@ export async function startCli(options: CliOptions): Promise<void> {
|
|
|
48
49
|
disallowedTools={disallowedTools}
|
|
49
50
|
worktreeSession={worktreeSession}
|
|
50
51
|
workdir={workdir}
|
|
52
|
+
originalCwd={originalCwd}
|
|
51
53
|
version={version}
|
|
52
54
|
model={model}
|
|
53
55
|
mcpServers={mcpServers}
|
package/src/components/App.tsx
CHANGED
|
@@ -98,6 +98,7 @@ const AppWithProviders: React.FC<AppWithProvidersProps> = ({
|
|
|
98
98
|
disallowedTools,
|
|
99
99
|
worktreeSession,
|
|
100
100
|
workdir,
|
|
101
|
+
originalCwd,
|
|
101
102
|
version,
|
|
102
103
|
model,
|
|
103
104
|
mcpServers,
|
|
@@ -123,6 +124,7 @@ const AppWithProviders: React.FC<AppWithProvidersProps> = ({
|
|
|
123
124
|
disallowedTools={disallowedTools}
|
|
124
125
|
workdir={workdir}
|
|
125
126
|
worktreeSession={worktreeSession}
|
|
127
|
+
originalCwd={originalCwd}
|
|
126
128
|
version={version}
|
|
127
129
|
model={model}
|
|
128
130
|
mcpServers={mcpServers}
|
|
@@ -142,6 +144,7 @@ const AppWithProviders: React.FC<AppWithProvidersProps> = ({
|
|
|
142
144
|
disallowedTools={disallowedTools}
|
|
143
145
|
workdir={workdir}
|
|
144
146
|
worktreeSession={worktreeSession}
|
|
147
|
+
originalCwd={originalCwd}
|
|
145
148
|
version={version}
|
|
146
149
|
model={model}
|
|
147
150
|
mcpServers={mcpServers}
|
|
@@ -162,6 +165,7 @@ export const App: React.FC<AppProps> = ({
|
|
|
162
165
|
disallowedTools,
|
|
163
166
|
worktreeSession,
|
|
164
167
|
workdir,
|
|
168
|
+
originalCwd,
|
|
165
169
|
version,
|
|
166
170
|
model,
|
|
167
171
|
mcpServers,
|
|
@@ -181,6 +185,7 @@ export const App: React.FC<AppProps> = ({
|
|
|
181
185
|
disallowedTools={disallowedTools}
|
|
182
186
|
worktreeSession={worktreeSession}
|
|
183
187
|
workdir={workdir}
|
|
188
|
+
originalCwd={originalCwd}
|
|
184
189
|
version={version}
|
|
185
190
|
model={model}
|
|
186
191
|
mcpServers={mcpServers}
|
package/src/contexts/useChat.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
Agent,
|
|
25
25
|
AgentCallbacks,
|
|
26
26
|
type ToolPermissionContext,
|
|
27
|
+
type WorktreeSession,
|
|
27
28
|
OPERATION_CANCELLED_BY_USER,
|
|
28
29
|
extractLatestTotalTokens,
|
|
29
30
|
} from "wave-agent-sdk";
|
|
@@ -161,6 +162,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
161
162
|
disallowedTools,
|
|
162
163
|
workdir,
|
|
163
164
|
worktreeSession,
|
|
165
|
+
originalCwd,
|
|
164
166
|
version,
|
|
165
167
|
model,
|
|
166
168
|
mcpServers,
|
|
@@ -478,6 +480,21 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
478
480
|
|
|
479
481
|
agentRef.current = agent;
|
|
480
482
|
|
|
483
|
+
// Inject worktree session into this agent's own DI container so system
|
|
484
|
+
// prompts and permission checks reflect the CLI -w worktree. This state is
|
|
485
|
+
// per-session, not process-global (see specs/047-worktree.md FR-042).
|
|
486
|
+
if (worktreeSession) {
|
|
487
|
+
const session: WorktreeSession = {
|
|
488
|
+
originalCwd: originalCwd ?? worktreeSession.repoRoot,
|
|
489
|
+
worktreePath: worktreeSession.path,
|
|
490
|
+
worktreeBranch: worktreeSession.branch,
|
|
491
|
+
worktreeName: worktreeSession.name,
|
|
492
|
+
isNew: worktreeSession.isNew,
|
|
493
|
+
repoRoot: worktreeSession.repoRoot,
|
|
494
|
+
};
|
|
495
|
+
agent.setWorktreeSession(session);
|
|
496
|
+
}
|
|
497
|
+
|
|
481
498
|
// Get initial state
|
|
482
499
|
setSessionId(agent.sessionId);
|
|
483
500
|
setMessages(agent.messages);
|
|
@@ -513,6 +530,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
513
530
|
disallowedTools,
|
|
514
531
|
workdir,
|
|
515
532
|
worktreeSession,
|
|
533
|
+
originalCwd,
|
|
516
534
|
model,
|
|
517
535
|
initialPermissionMode,
|
|
518
536
|
throttledSetMessages,
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import yargs from "yargs";
|
|
2
2
|
import { hideBin } from "yargs/helpers";
|
|
3
3
|
import { startCli } from "./cli.js";
|
|
4
|
-
import {
|
|
5
|
-
Scope,
|
|
6
|
-
generateRandomName,
|
|
7
|
-
type PermissionMode,
|
|
8
|
-
setCurrentWorktreeSession,
|
|
9
|
-
} from "wave-agent-sdk";
|
|
4
|
+
import { Scope, generateRandomName, type PermissionMode } from "wave-agent-sdk";
|
|
10
5
|
import { createWorktree, type WorktreeSession } from "./utils/worktree.js";
|
|
11
6
|
import path from "path";
|
|
12
7
|
import { readFileSync } from "fs";
|
|
@@ -327,15 +322,9 @@ export async function main() {
|
|
|
327
322
|
}
|
|
328
323
|
worktreeSession = createWorktree(name, originalCwd);
|
|
329
324
|
|
|
330
|
-
//
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
worktreePath: worktreeSession.path,
|
|
334
|
-
worktreeBranch: worktreeSession.branch,
|
|
335
|
-
worktreeName: worktreeSession.name,
|
|
336
|
-
isNew: worktreeSession.isNew,
|
|
337
|
-
repoRoot: worktreeSession.repoRoot,
|
|
338
|
-
});
|
|
325
|
+
// Note: the full worktree session (originalCwd etc.) is injected into the
|
|
326
|
+
// agent's DI container after the agent is created in useChat.tsx. This keeps
|
|
327
|
+
// worktree state per-session instead of process-global.
|
|
339
328
|
}
|
|
340
329
|
|
|
341
330
|
const workdir = worktreeSession?.path || originalCwd;
|
|
@@ -369,6 +358,7 @@ export async function main() {
|
|
|
369
358
|
disallowedTools,
|
|
370
359
|
worktreeSession,
|
|
371
360
|
workdir,
|
|
361
|
+
originalCwd,
|
|
372
362
|
version,
|
|
373
363
|
model: argv.model as string | undefined,
|
|
374
364
|
mcpServers,
|
|
@@ -393,6 +383,7 @@ export async function main() {
|
|
|
393
383
|
disallowedTools,
|
|
394
384
|
worktreeSession,
|
|
395
385
|
workdir,
|
|
386
|
+
originalCwd,
|
|
396
387
|
version,
|
|
397
388
|
model: argv.model as string | undefined,
|
|
398
389
|
mcpServers,
|
|
@@ -416,6 +407,7 @@ export async function main() {
|
|
|
416
407
|
disallowedTools,
|
|
417
408
|
worktreeSession,
|
|
418
409
|
workdir,
|
|
410
|
+
originalCwd,
|
|
419
411
|
version,
|
|
420
412
|
model: argv.model as string | undefined,
|
|
421
413
|
mcpServers,
|
package/src/print-cli.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
hasUncommittedChanges,
|
|
5
5
|
hasNewCommits,
|
|
6
6
|
getDefaultRemoteBranch,
|
|
7
|
+
type WorktreeSession,
|
|
7
8
|
} from "wave-agent-sdk";
|
|
8
9
|
import { displayUsageSummary } from "./utils/usageSummary.js";
|
|
9
10
|
import { removeWorktree } from "./utils/worktree.js";
|
|
@@ -47,6 +48,7 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
|
|
|
47
48
|
disallowedTools,
|
|
48
49
|
worktreeSession,
|
|
49
50
|
workdir,
|
|
51
|
+
originalCwd,
|
|
50
52
|
model,
|
|
51
53
|
mcpServers,
|
|
52
54
|
} = options;
|
|
@@ -126,11 +128,26 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
|
|
|
126
128
|
allowedTools,
|
|
127
129
|
disallowedTools,
|
|
128
130
|
workdir,
|
|
131
|
+
worktreeName: worktreeSession?.name,
|
|
132
|
+
isNewWorktree: worktreeSession?.isNew,
|
|
129
133
|
model,
|
|
130
134
|
mcpServers,
|
|
131
135
|
// 保持流式模式以获得更好的命令行用户体验
|
|
132
136
|
});
|
|
133
137
|
|
|
138
|
+
// Inject worktree session into this agent's container (per-session, not global)
|
|
139
|
+
if (worktreeSession) {
|
|
140
|
+
const session: WorktreeSession = {
|
|
141
|
+
originalCwd: originalCwd ?? worktreeSession.repoRoot,
|
|
142
|
+
worktreePath: worktreeSession.path,
|
|
143
|
+
worktreeBranch: worktreeSession.branch,
|
|
144
|
+
worktreeName: worktreeSession.name,
|
|
145
|
+
isNew: worktreeSession.isNew,
|
|
146
|
+
repoRoot: worktreeSession.repoRoot,
|
|
147
|
+
};
|
|
148
|
+
agent.setWorktreeSession(session);
|
|
149
|
+
}
|
|
150
|
+
|
|
134
151
|
// Send message if provided and not empty
|
|
135
152
|
if (typeof message === "string" && message.trim() !== "") {
|
|
136
153
|
await agent.sendMessage(message);
|
package/src/stdio/agentBridge.ts
CHANGED
|
@@ -41,21 +41,7 @@ import {
|
|
|
41
41
|
INTERNAL_ERROR as PROTOCOL_INTERNAL_ERROR,
|
|
42
42
|
METHOD_NOT_FOUND as PROTOCOL_METHOD_NOT_FOUND,
|
|
43
43
|
} from "./protocol.js";
|
|
44
|
-
import {
|
|
45
|
-
import path from "path";
|
|
46
|
-
import { fileURLToPath } from "url";
|
|
47
|
-
|
|
48
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
49
|
-
const CLI_VERSION: string = (() => {
|
|
50
|
-
try {
|
|
51
|
-
const pkg = JSON.parse(
|
|
52
|
-
readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8"),
|
|
53
|
-
);
|
|
54
|
-
return pkg.version ?? "";
|
|
55
|
-
} catch {
|
|
56
|
-
return "";
|
|
57
|
-
}
|
|
58
|
-
})();
|
|
44
|
+
import { logger } from "../utils/logger.js";
|
|
59
45
|
|
|
60
46
|
export type NotificationEmitter = (
|
|
61
47
|
method: string,
|
|
@@ -83,7 +69,6 @@ interface InitializeParams {
|
|
|
83
69
|
disallowedTools?: string[];
|
|
84
70
|
pluginDirs?: string[];
|
|
85
71
|
mcpServers?: Record<string, McpServerConfig>;
|
|
86
|
-
clientVersion?: string;
|
|
87
72
|
}
|
|
88
73
|
|
|
89
74
|
interface UpdateConfigParams {
|
|
@@ -177,6 +162,15 @@ export class AgentBridge {
|
|
|
177
162
|
return this.rewindToMessage(p.messageId as string, sessionId);
|
|
178
163
|
case "deleteQueuedMessage":
|
|
179
164
|
return this.deleteQueuedMessage(p.index as number, sessionId);
|
|
165
|
+
case "updateQueuedMessage":
|
|
166
|
+
return this.updateQueuedMessage(
|
|
167
|
+
p.id as string,
|
|
168
|
+
p.text as string,
|
|
169
|
+
p.images as Array<{ path: string; mimeType: string }> | undefined,
|
|
170
|
+
sessionId,
|
|
171
|
+
);
|
|
172
|
+
case "deleteQueuedMessageById":
|
|
173
|
+
return this.deleteQueuedMessageById(p.id as string, sessionId);
|
|
180
174
|
case "getMessages":
|
|
181
175
|
return this.getMessages(sessionId);
|
|
182
176
|
case "getFullMessageThread":
|
|
@@ -315,13 +309,13 @@ export class AgentBridge {
|
|
|
315
309
|
workingDirectory: string;
|
|
316
310
|
permissionMode: PermissionMode;
|
|
317
311
|
latestTotalTokens: number;
|
|
318
|
-
serverVersion: string;
|
|
319
312
|
}> {
|
|
320
313
|
const ctx: SessionContext = {};
|
|
321
314
|
const callbacks = this.createCallbacks(ctx);
|
|
322
315
|
|
|
323
316
|
const options: AgentOptions = {
|
|
324
317
|
callbacks,
|
|
318
|
+
logger,
|
|
325
319
|
workdir: params.workdir,
|
|
326
320
|
restoreSessionId: params.restoreSessionId,
|
|
327
321
|
apiKey: params.apiKey,
|
|
@@ -349,18 +343,11 @@ export class AgentBridge {
|
|
|
349
343
|
storedConfig: { ...params },
|
|
350
344
|
});
|
|
351
345
|
|
|
352
|
-
if (params.clientVersion) {
|
|
353
|
-
console.debug(
|
|
354
|
-
`[agentBridge] clientVersion=${params.clientVersion} serverVersion=${CLI_VERSION}`,
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
346
|
return {
|
|
359
347
|
sessionId: agent.sessionId,
|
|
360
348
|
workingDirectory: agent.workingDirectory,
|
|
361
349
|
permissionMode: agent.getPermissionMode(),
|
|
362
350
|
latestTotalTokens: agent.latestTotalTokens,
|
|
363
|
-
serverVersion: CLI_VERSION,
|
|
364
351
|
};
|
|
365
352
|
}
|
|
366
353
|
|
|
@@ -535,6 +522,26 @@ export class AgentBridge {
|
|
|
535
522
|
return null;
|
|
536
523
|
}
|
|
537
524
|
|
|
525
|
+
private updateQueuedMessage(
|
|
526
|
+
id: string,
|
|
527
|
+
text: string,
|
|
528
|
+
images: Array<{ path: string; mimeType: string }> | undefined,
|
|
529
|
+
sessionId?: string,
|
|
530
|
+
): { ok: boolean } {
|
|
531
|
+
const entry = this.requireSession(sessionId);
|
|
532
|
+
const ok = entry.agent.updateQueuedMessageById(id, {
|
|
533
|
+
content: text,
|
|
534
|
+
images,
|
|
535
|
+
});
|
|
536
|
+
return { ok };
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
private deleteQueuedMessageById(id: string, sessionId?: string): null {
|
|
540
|
+
const entry = this.requireSession(sessionId);
|
|
541
|
+
entry.agent.removeQueuedMessageById(id);
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
|
|
538
545
|
private getMessages(sessionId?: string): { messages: Message[] } {
|
|
539
546
|
const entry = this.requireSession(sessionId);
|
|
540
547
|
return { messages: entry.agent.messages };
|
|
@@ -649,20 +656,6 @@ export class AgentBridge {
|
|
|
649
656
|
{ requestId, context },
|
|
650
657
|
ctx.registeredSessionId,
|
|
651
658
|
);
|
|
652
|
-
|
|
653
|
-
// 5-minute timeout → auto-deny
|
|
654
|
-
setTimeout(
|
|
655
|
-
() => {
|
|
656
|
-
if (this.pendingPermissions.has(requestId)) {
|
|
657
|
-
this.pendingPermissions.delete(requestId);
|
|
658
|
-
resolve({
|
|
659
|
-
behavior: "deny",
|
|
660
|
-
message: "Permission request timed out",
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
5 * 60 * 1000,
|
|
665
|
-
);
|
|
666
659
|
});
|
|
667
660
|
}
|
|
668
661
|
|
|
@@ -891,6 +884,13 @@ export class AgentBridge {
|
|
|
891
884
|
onPermissionModeChange: (mode: PermissionMode) => {
|
|
892
885
|
this.emit("permissionModeChange", { mode }, ctx.registeredSessionId);
|
|
893
886
|
},
|
|
887
|
+
onWorkdirChange: (newCwd: string) => {
|
|
888
|
+
this.emit(
|
|
889
|
+
"workdirChange",
|
|
890
|
+
{ workdir: newCwd },
|
|
891
|
+
ctx.registeredSessionId,
|
|
892
|
+
);
|
|
893
|
+
},
|
|
894
894
|
onMcpServersChange: (servers: McpServerStatus[]) => {
|
|
895
895
|
this.emit("mcpServersChange", { servers }, ctx.registeredSessionId);
|
|
896
896
|
},
|
|
@@ -919,6 +919,9 @@ export class AgentBridge {
|
|
|
919
919
|
ctx.registeredSessionId,
|
|
920
920
|
);
|
|
921
921
|
},
|
|
922
|
+
onCompactBlockAdded: (content: string) => {
|
|
923
|
+
this.emit("compactBlockAdded", { content }, ctx.registeredSessionId);
|
|
924
|
+
},
|
|
922
925
|
};
|
|
923
926
|
}
|
|
924
927
|
|
package/src/stdio/protocol.ts
CHANGED
|
@@ -58,6 +58,8 @@ export type RequestMethod =
|
|
|
58
58
|
| "clearMessages"
|
|
59
59
|
| "rewindToMessage"
|
|
60
60
|
| "deleteQueuedMessage"
|
|
61
|
+
| "updateQueuedMessage"
|
|
62
|
+
| "deleteQueuedMessageById"
|
|
61
63
|
| "getMessages"
|
|
62
64
|
| "getFullMessageThread"
|
|
63
65
|
| "setPermissionMode"
|
|
@@ -107,12 +109,14 @@ export type ServerNotificationMethod =
|
|
|
107
109
|
| "sessionIdChange"
|
|
108
110
|
| "permissionModeChange"
|
|
109
111
|
| "mcpServersChange"
|
|
112
|
+
| "workdirChange"
|
|
110
113
|
| "bangMessageAdded"
|
|
111
114
|
| "bangMessageUpdated"
|
|
112
115
|
| "bangMessageCompleted"
|
|
113
116
|
| "notificationMessageAdded"
|
|
114
117
|
| "permissionRequest"
|
|
115
|
-
| "authUrl"
|
|
118
|
+
| "authUrl"
|
|
119
|
+
| "compactBlockAdded";
|
|
116
120
|
|
|
117
121
|
// ── Helper: is this a request (has id)? ─────────────────────────
|
|
118
122
|
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface BaseAppProps {
|
|
|
10
10
|
disallowedTools?: string[];
|
|
11
11
|
worktreeSession?: WorktreeSession;
|
|
12
12
|
workdir?: string;
|
|
13
|
+
/** The working directory before entering a worktree (CLI -w); injected into the agent's container. */
|
|
14
|
+
originalCwd?: string;
|
|
13
15
|
version?: string;
|
|
14
16
|
model?: string;
|
|
15
17
|
/** Optional MCP server configs to pass to Agent.create() */
|
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEjE"}
|