wave-agent-sdk 0.12.9 → 0.12.10
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/managers/messageManager.d.ts +1 -5
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +1 -28
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +31 -46
- package/dist/types/messaging.d.ts +1 -11
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +0 -15
- package/dist/utils/messageOperations.d.ts +0 -26
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +0 -80
- package/package.json +1 -1
- package/src/managers/messageManager.ts +0 -40
- package/src/managers/slashCommandManager.ts +33 -49
- package/src/types/messaging.ts +0 -12
- package/src/utils/convertMessagesForAPI.ts +0 -16
- package/src/utils/messageOperations.ts +0 -114
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserMessageParams,
|
|
1
|
+
import { UserMessageParams, type AgentToolBlockUpdateParams } from "../utils/messageOperations.js";
|
|
2
2
|
import type { Message, Usage } from "../types/index.js";
|
|
3
3
|
import { SessionData } from "../services/session.js";
|
|
4
4
|
import { ChatCompletionMessageFunctionToolCall } from "openai/resources.js";
|
|
@@ -19,8 +19,6 @@ export interface MessageManagerCallbacks {
|
|
|
19
19
|
onAddBangMessage?: (command: string) => void;
|
|
20
20
|
onUpdateBangMessage?: (command: string, output: string) => void;
|
|
21
21
|
onCompleteBangMessage?: (command: string, exitCode: number) => void;
|
|
22
|
-
onAddSlashMessage?: (params: import("../utils/messageOperations.js").AddSlashParams) => void;
|
|
23
|
-
onUpdateSlashBlock?: (params: import("../utils/messageOperations.js").UpdateSlashParams) => void;
|
|
24
22
|
onInfoBlockAdded?: (content: string) => void;
|
|
25
23
|
onShowRewind?: () => void;
|
|
26
24
|
onFileHistoryBlockAdded?: (snapshots: import("../types/reversion.js").FileSnapshot[]) => void;
|
|
@@ -122,8 +120,6 @@ export declare class MessageManager {
|
|
|
122
120
|
addBangMessage(command: string): void;
|
|
123
121
|
updateBangMessage(command: string, output: string): void;
|
|
124
122
|
completeBangMessage(command: string, exitCode: number, output?: string): void;
|
|
125
|
-
addSlashMessage(params: Omit<AddSlashParams, "messages">): string;
|
|
126
|
-
updateSlashBlock(params: Omit<UpdateSlashParams, "messages">): void;
|
|
127
123
|
/**
|
|
128
124
|
* Rebuild usage array from messages containing usage metadata
|
|
129
125
|
* Called during session restoration to reconstruct usage tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageManager.d.ts","sourceRoot":"","sources":["../../src/managers/messageManager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"messageManager.d.ts","sourceRoot":"","sources":["../../src/managers/messageManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,iBAAiB,EACjB,KAAK,0BAA0B,EAEhC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAIL,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACjD,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,yBAAyB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IAE3C,kBAAkB,CAAC,EAAE,C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I;IAUxD,mBAAmB,CACxB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAWP;;;OAGG;IACI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAW1D;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAKnC;;OAEG;IACI,kBAAkB,IAAI,IAAI;IAIjC;;;;OAIG;IACI,2BAA2B,CAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI;IA6CvE;;;OAGG;IACI,6BAA6B,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI;IA8C3E;;;OAGG;IACI,qBAAqB,IAAI,IAAI;IAKvB,oBAAoB,IAAI,OAAO,CAAC;QAC3C,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IAKF;;;;OAIG;IACU,eAAe,CAC1B,KAAK,EAAE,MAAM,EACb,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,EAAE,gBAAgB,GAClE,OAAO,CAAC,IAAI,CAAC;IAkGhB;;OAEG;YACW,kBAAkB;IAoBhC,OAAO,CAAC,sBAAsB;CA4B/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addAssistantMessageToMessages, updateToolBlockInMessage, addErrorBlockToMessage, addUserMessageToMessages, updateUserMessageInMessages, addBangMessage, updateBangInMessage, completeBangInMessage,
|
|
1
|
+
import { addAssistantMessageToMessages, updateToolBlockInMessage, addErrorBlockToMessage, addUserMessageToMessages, updateUserMessageInMessages, addBangMessage, updateBangInMessage, completeBangInMessage, removeLastUserMessage, addToolBlockToMessageInMessages, generateMessageId, } from "../utils/messageOperations.js";
|
|
2
2
|
import { join, isAbsolute, relative } from "path";
|
|
3
3
|
import { appendMessages, createSession, generateSessionId, SESSION_DIR, } from "../services/session.js";
|
|
4
4
|
import { pathEncoder } from "../utils/pathEncoder.js";
|
|
@@ -394,33 +394,6 @@ export class MessageManager {
|
|
|
394
394
|
this.setMessages(updatedMessages);
|
|
395
395
|
this.callbacks.onCompleteBangMessage?.(command, exitCode);
|
|
396
396
|
}
|
|
397
|
-
// Slash related message operations
|
|
398
|
-
addSlashMessage(params) {
|
|
399
|
-
const id = params.id || generateMessageId();
|
|
400
|
-
const updatedMessages = addSlashMessageToMessages({
|
|
401
|
-
messages: this.messages,
|
|
402
|
-
...params,
|
|
403
|
-
id,
|
|
404
|
-
});
|
|
405
|
-
this.setMessages(updatedMessages);
|
|
406
|
-
this.callbacks.onAddSlashMessage?.({
|
|
407
|
-
messages: updatedMessages,
|
|
408
|
-
...params,
|
|
409
|
-
id,
|
|
410
|
-
});
|
|
411
|
-
return id;
|
|
412
|
-
}
|
|
413
|
-
updateSlashBlock(params) {
|
|
414
|
-
const updatedMessages = updateSlashBlockInMessage({
|
|
415
|
-
messages: this.messages,
|
|
416
|
-
...params,
|
|
417
|
-
});
|
|
418
|
-
this.setMessages(updatedMessages);
|
|
419
|
-
this.callbacks.onUpdateSlashBlock?.({
|
|
420
|
-
messages: updatedMessages,
|
|
421
|
-
...params,
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
397
|
/**
|
|
425
398
|
* Rebuild usage array from messages containing usage metadata
|
|
426
399
|
* Called during session restoration to reconstruct usage tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slashCommandManager.d.ts","sourceRoot":"","sources":["../../src/managers/slashCommandManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAQ1E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAWlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,mBAAmB;IAQ5B,OAAO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AO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA2C1B;;OAEG;IACI,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI;IAuK3D;;OAEG;IACI,sBAAsB,CAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,IAAI;IAyCP;;OAEG;IACI,oBAAoB,IAAI,IAAI;IAWnC;;OAEG;IACI,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAInD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACI,WAAW,IAAI,YAAY,EAAE;IAIpC;;OAEG;IACI,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI9D;;OAEG;IACU,cAAc,CACzB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;IA2BnB;;;OAGG;IACI,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG;QAClD,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAeD;;OAEG;IACI,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI7C;;OAEG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI1E;;OAEG;IACI,iBAAiB,IAAI,kBAAkB,EAAE;IAIhD;;OAEG;YACW,+BAA+B;IA4C7C;;OAEG;IACI,mBAAmB,IAAI,IAAI;CAQnC"}
|
|
@@ -76,7 +76,7 @@ export class SlashCommandManager {
|
|
|
76
76
|
if (args) {
|
|
77
77
|
processedContent = substituteCommandParameters(processedContent, args);
|
|
78
78
|
}
|
|
79
|
-
await this.executeCustomCommandInMainAgent(command.name, processedContent, command.config
|
|
79
|
+
await this.executeCustomCommandInMainAgent(command.name, processedContent, command.config);
|
|
80
80
|
},
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -112,23 +112,21 @@ export class SlashCommandManager {
|
|
|
112
112
|
skill_name: skill.name,
|
|
113
113
|
args,
|
|
114
114
|
});
|
|
115
|
-
// 2. Add slash message immediately
|
|
116
|
-
const messageId = this.messageManager.addSlashMessage({
|
|
117
|
-
command: skill.name,
|
|
118
|
-
args,
|
|
119
|
-
content: prepared.content,
|
|
120
|
-
});
|
|
121
115
|
if (!prepared.skill) {
|
|
122
|
-
// If skill not found or invalid,
|
|
123
|
-
this.messageManager.
|
|
124
|
-
command: skill.name,
|
|
125
|
-
messageId,
|
|
126
|
-
stage: "error",
|
|
127
|
-
error: prepared.content,
|
|
128
|
-
});
|
|
116
|
+
// If skill not found or invalid, add error
|
|
117
|
+
this.messageManager.addErrorBlock(prepared.content);
|
|
129
118
|
return;
|
|
130
119
|
}
|
|
131
120
|
if (skill.context === "fork") {
|
|
121
|
+
// Forked skill execution: add user message with text + tool block
|
|
122
|
+
const messageId = this.messageManager.addUserMessage({
|
|
123
|
+
content: `/${skill.name} ${args || ""}`,
|
|
124
|
+
});
|
|
125
|
+
const toolBlockId = this.messageManager.addToolBlockToMessage(messageId, {
|
|
126
|
+
name: skill.name,
|
|
127
|
+
parameters: prepared.content,
|
|
128
|
+
stage: "running",
|
|
129
|
+
});
|
|
132
130
|
// Forked skill execution
|
|
133
131
|
const subagentConfigs = await this.subagentManager.loadConfigurations();
|
|
134
132
|
const subagentType = skill.agent || "general-purpose";
|
|
@@ -143,7 +141,7 @@ export class SlashCommandManager {
|
|
|
143
141
|
subagent_type: subagentType,
|
|
144
142
|
model: skill.model,
|
|
145
143
|
}, false, () => {
|
|
146
|
-
// Update the
|
|
144
|
+
// Update the tool block with progress
|
|
147
145
|
const subagent = this.subagentManager.getInstance(instance.subagentId);
|
|
148
146
|
if (subagent) {
|
|
149
147
|
const messages = subagent.messages;
|
|
@@ -159,8 +157,8 @@ export class SlashCommandManager {
|
|
|
159
157
|
shortResult += `${lastTools.join(", ")} `;
|
|
160
158
|
}
|
|
161
159
|
shortResult += summary;
|
|
162
|
-
this.messageManager.
|
|
163
|
-
|
|
160
|
+
this.messageManager.updateToolBlock({
|
|
161
|
+
id: toolBlockId,
|
|
164
162
|
messageId,
|
|
165
163
|
shortResult,
|
|
166
164
|
});
|
|
@@ -168,12 +166,12 @@ export class SlashCommandManager {
|
|
|
168
166
|
});
|
|
169
167
|
try {
|
|
170
168
|
const result = await this.subagentManager.executeAgent(instance, prepared.content, signal);
|
|
171
|
-
// Update the
|
|
172
|
-
this.messageManager.
|
|
173
|
-
|
|
169
|
+
// Update the ToolBlock with final result
|
|
170
|
+
this.messageManager.updateToolBlock({
|
|
171
|
+
id: toolBlockId,
|
|
174
172
|
messageId,
|
|
175
173
|
result,
|
|
176
|
-
stage: "
|
|
174
|
+
stage: "end",
|
|
177
175
|
});
|
|
178
176
|
}
|
|
179
177
|
finally {
|
|
@@ -181,31 +179,27 @@ export class SlashCommandManager {
|
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
181
|
catch (error) {
|
|
184
|
-
// Update the
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
command: skill.name,
|
|
182
|
+
// Update the ToolBlock with error
|
|
183
|
+
this.messageManager.updateToolBlock({
|
|
184
|
+
id: toolBlockId,
|
|
188
185
|
messageId,
|
|
189
|
-
stage:
|
|
186
|
+
stage: "end",
|
|
190
187
|
error: error instanceof Error ? error.message : String(error),
|
|
191
188
|
});
|
|
192
189
|
throw error; // Re-throw to be caught by outer catch for logging/error block
|
|
193
190
|
}
|
|
194
191
|
return;
|
|
195
192
|
}
|
|
196
|
-
//
|
|
193
|
+
// Non-forked skill: execute and trigger AI response
|
|
197
194
|
const result = await this.skillManager.executeSkill({
|
|
198
195
|
skill_name: skill.name,
|
|
199
196
|
args,
|
|
200
197
|
});
|
|
201
|
-
//
|
|
202
|
-
this.messageManager.
|
|
203
|
-
command: skill.name,
|
|
204
|
-
messageId,
|
|
198
|
+
// Add user message with the processed content
|
|
199
|
+
this.messageManager.addUserMessage({
|
|
205
200
|
content: result.content,
|
|
206
|
-
stage: "success",
|
|
207
201
|
});
|
|
208
|
-
//
|
|
202
|
+
// Trigger AI response
|
|
209
203
|
await this.aiManager.sendAIMessage({
|
|
210
204
|
model: skill.model,
|
|
211
205
|
allowedRules: result.allowedTools,
|
|
@@ -241,7 +235,7 @@ export class SlashCommandManager {
|
|
|
241
235
|
if (args) {
|
|
242
236
|
processedContent = substituteCommandParameters(processedContent, args);
|
|
243
237
|
}
|
|
244
|
-
await this.executeCustomCommandInMainAgent(namespacedName, processedContent, command.config
|
|
238
|
+
await this.executeCustomCommandInMainAgent(namespacedName, processedContent, command.config);
|
|
245
239
|
},
|
|
246
240
|
});
|
|
247
241
|
}
|
|
@@ -353,14 +347,8 @@ export class SlashCommandManager {
|
|
|
353
347
|
/**
|
|
354
348
|
* Execute custom command in main agent instead of sub-agent
|
|
355
349
|
*/
|
|
356
|
-
async executeCustomCommandInMainAgent(commandName, content, config
|
|
350
|
+
async executeCustomCommandInMainAgent(commandName, content, config) {
|
|
357
351
|
try {
|
|
358
|
-
// Add slash command message immediately to show the command being executed
|
|
359
|
-
const messageId = this.messageManager.addSlashMessage({
|
|
360
|
-
command: commandName,
|
|
361
|
-
args,
|
|
362
|
-
content, // Initial content with bash placeholders
|
|
363
|
-
});
|
|
364
352
|
// Parse bash commands from the content
|
|
365
353
|
const { commands, processedContent } = parseBashCommands(content);
|
|
366
354
|
// Execute bash commands if any
|
|
@@ -369,12 +357,9 @@ export class SlashCommandManager {
|
|
|
369
357
|
const bashResults = await executeBashCommands(commands, this.workdir);
|
|
370
358
|
finalContent = replaceBashCommandsWithOutput(processedContent, bashResults);
|
|
371
359
|
}
|
|
372
|
-
//
|
|
373
|
-
this.messageManager.
|
|
374
|
-
command: commandName,
|
|
375
|
-
messageId,
|
|
360
|
+
// Add user message with the processed content
|
|
361
|
+
this.messageManager.addUserMessage({
|
|
376
362
|
content: finalContent,
|
|
377
|
-
stage: "success",
|
|
378
363
|
});
|
|
379
364
|
// Execute the AI conversation with custom configuration
|
|
380
365
|
await this.aiManager.sendAIMessage({
|
|
@@ -15,22 +15,12 @@ export interface Message {
|
|
|
15
15
|
additionalFields?: Record<string, unknown>;
|
|
16
16
|
isMeta?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | BangBlock |
|
|
18
|
+
export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | BangBlock | CompressBlock | ReasoningBlock | FileHistoryBlock;
|
|
19
19
|
export interface TextBlock {
|
|
20
20
|
type: "text";
|
|
21
21
|
content: string;
|
|
22
22
|
source?: MessageSource;
|
|
23
23
|
}
|
|
24
|
-
export interface SlashBlock {
|
|
25
|
-
type: "slash";
|
|
26
|
-
command: string;
|
|
27
|
-
args?: string;
|
|
28
|
-
content?: string;
|
|
29
|
-
result?: string;
|
|
30
|
-
stage: "running" | "success" | "error" | "aborted";
|
|
31
|
-
error?: string;
|
|
32
|
-
shortResult?: string;
|
|
33
|
-
}
|
|
34
24
|
export interface ErrorBlock {
|
|
35
25
|
type: "error";
|
|
36
26
|
content: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/types/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,
|
|
1
|
+
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/types/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,aAAa,GACb,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB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E,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AA0B7B;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,GAClB,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"convertMessagesForAPI.d.ts","sourceRoot":"","sources":["../../src/utils/convertMessagesForAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AA0B7B;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,GAClB,0BAA0B,EAAE,CA8N9B"}
|
|
@@ -155,21 +155,6 @@ export function convertMessagesForAPI(messages) {
|
|
|
155
155
|
text: block.content,
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
// Handle SlashBlock
|
|
159
|
-
if (block.type === "slash") {
|
|
160
|
-
if (block.content && block.content.trim().length > 0) {
|
|
161
|
-
contentParts.push({
|
|
162
|
-
type: "text",
|
|
163
|
-
text: block.content,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
if (block.result && block.result.trim().length > 0) {
|
|
167
|
-
contentParts.push({
|
|
168
|
-
type: "text",
|
|
169
|
-
text: `<local-command-stdout>\n${stripAnsiColors(block.result)}\n</local-command-stdout>`,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
158
|
// If there is an image, add image content
|
|
174
159
|
if (block.type === "image" &&
|
|
175
160
|
block.imageUrls &&
|
|
@@ -14,24 +14,6 @@ export interface AddUserMessageParams extends UserMessageParams {
|
|
|
14
14
|
messages: Message[];
|
|
15
15
|
id?: string;
|
|
16
16
|
}
|
|
17
|
-
export interface AddSlashParams {
|
|
18
|
-
messages: Message[];
|
|
19
|
-
command: string;
|
|
20
|
-
args?: string;
|
|
21
|
-
content?: string;
|
|
22
|
-
id?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface UpdateSlashParams {
|
|
25
|
-
messages: Message[];
|
|
26
|
-
command: string;
|
|
27
|
-
messageId?: string;
|
|
28
|
-
args?: string;
|
|
29
|
-
content?: string;
|
|
30
|
-
result?: string;
|
|
31
|
-
stage?: "running" | "success" | "error" | "aborted";
|
|
32
|
-
error?: string;
|
|
33
|
-
shortResult?: string;
|
|
34
|
-
}
|
|
35
17
|
export interface UpdateToolBlockParams {
|
|
36
18
|
messages: Message[];
|
|
37
19
|
id: string;
|
|
@@ -87,14 +69,6 @@ export interface CompleteBangParams {
|
|
|
87
69
|
export declare const convertImageToBase64: (imagePath: string) => string;
|
|
88
70
|
export declare const generateMessageId: () => string;
|
|
89
71
|
export declare const addUserMessageToMessages: ({ messages, content, images, source, id, isMeta, }: AddUserMessageParams) => Message[];
|
|
90
|
-
/**
|
|
91
|
-
* Add a slash command message to the conversation.
|
|
92
|
-
*/
|
|
93
|
-
export declare const addSlashMessageToMessages: ({ messages, command, args, content, id, }: AddSlashParams) => Message[];
|
|
94
|
-
/**
|
|
95
|
-
* Update a slash block in a message.
|
|
96
|
-
*/
|
|
97
|
-
export declare const updateSlashBlockInMessage: ({ messages, command, messageId, args, content, result, stage, error, shortResult, }: UpdateSlashParams) => Message[];
|
|
98
72
|
/**
|
|
99
73
|
* Update a user message's content by its ID.
|
|
100
74
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageOperations.d.ts","sourceRoot":"","sources":["../../src/utils/messageOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAa,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAI5E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,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b,MAAM,CAUR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAoB1D"}
|
|
@@ -69,82 +69,6 @@ export const addUserMessageToMessages = ({ messages, content, images, source, id
|
|
|
69
69
|
};
|
|
70
70
|
return [...messages, userMessage];
|
|
71
71
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Add a slash command message to the conversation.
|
|
74
|
-
*/
|
|
75
|
-
export const addSlashMessageToMessages = ({ messages, command, args, content, id, }) => {
|
|
76
|
-
const slashMessage = {
|
|
77
|
-
id: id || generateMessageId(),
|
|
78
|
-
role: "user",
|
|
79
|
-
blocks: [
|
|
80
|
-
{
|
|
81
|
-
type: "slash",
|
|
82
|
-
command,
|
|
83
|
-
args,
|
|
84
|
-
content,
|
|
85
|
-
stage: "running",
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
};
|
|
89
|
-
return [...messages, slashMessage];
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Update a slash block in a message.
|
|
93
|
-
*/
|
|
94
|
-
export const updateSlashBlockInMessage = ({ messages, command, messageId, args, content, result, stage, error, shortResult, }) => {
|
|
95
|
-
const newMessages = [...messages];
|
|
96
|
-
// If messageId is provided, target that specific message
|
|
97
|
-
if (messageId) {
|
|
98
|
-
const messageIndex = newMessages.findIndex((msg) => msg.id === messageId);
|
|
99
|
-
if (messageIndex !== -1) {
|
|
100
|
-
const slashBlockIndex = newMessages[messageIndex].blocks.findIndex((block) => block.type === "slash" && block.command === command);
|
|
101
|
-
if (slashBlockIndex !== -1) {
|
|
102
|
-
const slashBlock = newMessages[messageIndex].blocks[slashBlockIndex];
|
|
103
|
-
if (slashBlock.type === "slash") {
|
|
104
|
-
if (args !== undefined)
|
|
105
|
-
slashBlock.args = args;
|
|
106
|
-
if (content !== undefined)
|
|
107
|
-
slashBlock.content = content;
|
|
108
|
-
if (result !== undefined)
|
|
109
|
-
slashBlock.result = result;
|
|
110
|
-
if (stage !== undefined)
|
|
111
|
-
slashBlock.stage = stage;
|
|
112
|
-
if (error !== undefined)
|
|
113
|
-
slashBlock.error = error;
|
|
114
|
-
if (shortResult !== undefined)
|
|
115
|
-
slashBlock.shortResult = shortResult;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return newMessages;
|
|
120
|
-
}
|
|
121
|
-
// Find the last user message with a slash block for this command
|
|
122
|
-
for (let i = newMessages.length - 1; i >= 0; i--) {
|
|
123
|
-
const msg = newMessages[i];
|
|
124
|
-
if (msg.role === "user") {
|
|
125
|
-
const slashBlockIndex = msg.blocks.findIndex((block) => block.type === "slash" && block.command === command);
|
|
126
|
-
if (slashBlockIndex !== -1) {
|
|
127
|
-
const slashBlock = msg.blocks[slashBlockIndex];
|
|
128
|
-
if (slashBlock.type === "slash") {
|
|
129
|
-
if (args !== undefined)
|
|
130
|
-
slashBlock.args = args;
|
|
131
|
-
if (content !== undefined)
|
|
132
|
-
slashBlock.content = content;
|
|
133
|
-
if (result !== undefined)
|
|
134
|
-
slashBlock.result = result;
|
|
135
|
-
if (stage !== undefined)
|
|
136
|
-
slashBlock.stage = stage;
|
|
137
|
-
if (error !== undefined)
|
|
138
|
-
slashBlock.error = error;
|
|
139
|
-
if (shortResult !== undefined)
|
|
140
|
-
slashBlock.shortResult = shortResult;
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return newMessages;
|
|
147
|
-
};
|
|
148
72
|
/**
|
|
149
73
|
* Update a user message's content by its ID.
|
|
150
74
|
*/
|
|
@@ -486,10 +410,6 @@ export function getMessageContent(message) {
|
|
|
486
410
|
if (textBlock && "content" in textBlock) {
|
|
487
411
|
return textBlock.content;
|
|
488
412
|
}
|
|
489
|
-
const slashBlock = message.blocks.find((block) => block.type === "slash");
|
|
490
|
-
if (slashBlock && "command" in slashBlock) {
|
|
491
|
-
return `/${slashBlock.command}${slashBlock.args ? ` ${slashBlock.args}` : ""}`;
|
|
492
|
-
}
|
|
493
413
|
const bangBlock = message.blocks.find((block) => block.type === "bang");
|
|
494
414
|
if (bangBlock && "command" in bangBlock) {
|
|
495
415
|
return `!${bangBlock.command}`;
|
package/package.json
CHANGED
|
@@ -7,13 +7,9 @@ import {
|
|
|
7
7
|
addBangMessage,
|
|
8
8
|
updateBangInMessage,
|
|
9
9
|
completeBangInMessage,
|
|
10
|
-
addSlashMessageToMessages,
|
|
11
|
-
updateSlashBlockInMessage,
|
|
12
10
|
removeLastUserMessage,
|
|
13
11
|
addToolBlockToMessageInMessages,
|
|
14
12
|
UserMessageParams,
|
|
15
|
-
AddSlashParams,
|
|
16
|
-
UpdateSlashParams,
|
|
17
13
|
type AgentToolBlockUpdateParams,
|
|
18
14
|
generateMessageId,
|
|
19
15
|
} from "../utils/messageOperations.js";
|
|
@@ -54,13 +50,6 @@ export interface MessageManagerCallbacks {
|
|
|
54
50
|
onAddBangMessage?: (command: string) => void;
|
|
55
51
|
onUpdateBangMessage?: (command: string, output: string) => void;
|
|
56
52
|
onCompleteBangMessage?: (command: string, exitCode: number) => void;
|
|
57
|
-
// Slash callback
|
|
58
|
-
onAddSlashMessage?: (
|
|
59
|
-
params: import("../utils/messageOperations.js").AddSlashParams,
|
|
60
|
-
) => void;
|
|
61
|
-
onUpdateSlashBlock?: (
|
|
62
|
-
params: import("../utils/messageOperations.js").UpdateSlashParams,
|
|
63
|
-
) => void;
|
|
64
53
|
onInfoBlockAdded?: (content: string) => void;
|
|
65
54
|
// Rewind callbacks
|
|
66
55
|
onShowRewind?: () => void;
|
|
@@ -594,35 +583,6 @@ export class MessageManager {
|
|
|
594
583
|
this.callbacks.onCompleteBangMessage?.(command, exitCode);
|
|
595
584
|
}
|
|
596
585
|
|
|
597
|
-
// Slash related message operations
|
|
598
|
-
public addSlashMessage(params: Omit<AddSlashParams, "messages">): string {
|
|
599
|
-
const id = params.id || generateMessageId();
|
|
600
|
-
const updatedMessages = addSlashMessageToMessages({
|
|
601
|
-
messages: this.messages,
|
|
602
|
-
...params,
|
|
603
|
-
id,
|
|
604
|
-
});
|
|
605
|
-
this.setMessages(updatedMessages);
|
|
606
|
-
this.callbacks.onAddSlashMessage?.({
|
|
607
|
-
messages: updatedMessages,
|
|
608
|
-
...params,
|
|
609
|
-
id,
|
|
610
|
-
});
|
|
611
|
-
return id;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
public updateSlashBlock(params: Omit<UpdateSlashParams, "messages">): void {
|
|
615
|
-
const updatedMessages = updateSlashBlockInMessage({
|
|
616
|
-
messages: this.messages,
|
|
617
|
-
...params,
|
|
618
|
-
});
|
|
619
|
-
this.setMessages(updatedMessages);
|
|
620
|
-
this.callbacks.onUpdateSlashBlock?.({
|
|
621
|
-
messages: updatedMessages,
|
|
622
|
-
...params,
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
|
|
626
586
|
/**
|
|
627
587
|
* Rebuild usage array from messages containing usage metadata
|
|
628
588
|
* Called during session restoration to reconstruct usage tracking
|
|
@@ -130,7 +130,6 @@ export class SlashCommandManager {
|
|
|
130
130
|
command.name,
|
|
131
131
|
processedContent,
|
|
132
132
|
command.config,
|
|
133
|
-
args,
|
|
134
133
|
);
|
|
135
134
|
},
|
|
136
135
|
});
|
|
@@ -171,25 +170,27 @@ export class SlashCommandManager {
|
|
|
171
170
|
args,
|
|
172
171
|
});
|
|
173
172
|
|
|
174
|
-
// 2. Add slash message immediately
|
|
175
|
-
const messageId = this.messageManager.addSlashMessage({
|
|
176
|
-
command: skill.name,
|
|
177
|
-
args,
|
|
178
|
-
content: prepared.content,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
173
|
if (!prepared.skill) {
|
|
182
|
-
// If skill not found or invalid,
|
|
183
|
-
this.messageManager.
|
|
184
|
-
command: skill.name,
|
|
185
|
-
messageId,
|
|
186
|
-
stage: "error",
|
|
187
|
-
error: prepared.content,
|
|
188
|
-
});
|
|
174
|
+
// If skill not found or invalid, add error
|
|
175
|
+
this.messageManager.addErrorBlock(prepared.content);
|
|
189
176
|
return;
|
|
190
177
|
}
|
|
191
178
|
|
|
192
179
|
if (skill.context === "fork") {
|
|
180
|
+
// Forked skill execution: add user message with text + tool block
|
|
181
|
+
const messageId = this.messageManager.addUserMessage({
|
|
182
|
+
content: `/${skill.name} ${args || ""}`,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const toolBlockId = this.messageManager.addToolBlockToMessage(
|
|
186
|
+
messageId,
|
|
187
|
+
{
|
|
188
|
+
name: skill.name,
|
|
189
|
+
parameters: prepared.content,
|
|
190
|
+
stage: "running",
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
|
|
193
194
|
// Forked skill execution
|
|
194
195
|
const subagentConfigs =
|
|
195
196
|
await this.subagentManager.loadConfigurations();
|
|
@@ -214,7 +215,7 @@ export class SlashCommandManager {
|
|
|
214
215
|
},
|
|
215
216
|
false,
|
|
216
217
|
() => {
|
|
217
|
-
// Update the
|
|
218
|
+
// Update the tool block with progress
|
|
218
219
|
const subagent = this.subagentManager.getInstance(
|
|
219
220
|
instance.subagentId,
|
|
220
221
|
);
|
|
@@ -237,8 +238,8 @@ export class SlashCommandManager {
|
|
|
237
238
|
|
|
238
239
|
shortResult += summary;
|
|
239
240
|
|
|
240
|
-
this.messageManager.
|
|
241
|
-
|
|
241
|
+
this.messageManager.updateToolBlock({
|
|
242
|
+
id: toolBlockId,
|
|
242
243
|
messageId,
|
|
243
244
|
shortResult,
|
|
244
245
|
});
|
|
@@ -253,24 +254,22 @@ export class SlashCommandManager {
|
|
|
253
254
|
signal,
|
|
254
255
|
);
|
|
255
256
|
|
|
256
|
-
// Update the
|
|
257
|
-
this.messageManager.
|
|
258
|
-
|
|
257
|
+
// Update the ToolBlock with final result
|
|
258
|
+
this.messageManager.updateToolBlock({
|
|
259
|
+
id: toolBlockId,
|
|
259
260
|
messageId,
|
|
260
261
|
result,
|
|
261
|
-
stage: "
|
|
262
|
+
stage: "end",
|
|
262
263
|
});
|
|
263
264
|
} finally {
|
|
264
265
|
this.subagentManager.cleanupInstance(instance.subagentId);
|
|
265
266
|
}
|
|
266
267
|
} catch (error) {
|
|
267
|
-
// Update the
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.messageManager.updateSlashBlock({
|
|
271
|
-
command: skill.name,
|
|
268
|
+
// Update the ToolBlock with error
|
|
269
|
+
this.messageManager.updateToolBlock({
|
|
270
|
+
id: toolBlockId,
|
|
272
271
|
messageId,
|
|
273
|
-
stage:
|
|
272
|
+
stage: "end",
|
|
274
273
|
error: error instanceof Error ? error.message : String(error),
|
|
275
274
|
});
|
|
276
275
|
throw error; // Re-throw to be caught by outer catch for logging/error block
|
|
@@ -278,21 +277,18 @@ export class SlashCommandManager {
|
|
|
278
277
|
return;
|
|
279
278
|
}
|
|
280
279
|
|
|
281
|
-
//
|
|
280
|
+
// Non-forked skill: execute and trigger AI response
|
|
282
281
|
const result = await this.skillManager.executeSkill({
|
|
283
282
|
skill_name: skill.name,
|
|
284
283
|
args,
|
|
285
284
|
});
|
|
286
285
|
|
|
287
|
-
//
|
|
288
|
-
this.messageManager.
|
|
289
|
-
command: skill.name,
|
|
290
|
-
messageId,
|
|
286
|
+
// Add user message with the processed content
|
|
287
|
+
this.messageManager.addUserMessage({
|
|
291
288
|
content: result.content,
|
|
292
|
-
stage: "success",
|
|
293
289
|
});
|
|
294
290
|
|
|
295
|
-
//
|
|
291
|
+
// Trigger AI response
|
|
296
292
|
await this.aiManager.sendAIMessage({
|
|
297
293
|
model: skill.model,
|
|
298
294
|
allowedRules: result.allowedTools,
|
|
@@ -352,7 +348,6 @@ export class SlashCommandManager {
|
|
|
352
348
|
namespacedName,
|
|
353
349
|
processedContent,
|
|
354
350
|
command.config,
|
|
355
|
-
args,
|
|
356
351
|
);
|
|
357
352
|
},
|
|
358
353
|
});
|
|
@@ -489,16 +484,8 @@ export class SlashCommandManager {
|
|
|
489
484
|
commandName: string,
|
|
490
485
|
content: string,
|
|
491
486
|
config?: { model?: string; allowedTools?: string[] },
|
|
492
|
-
args?: string,
|
|
493
487
|
): Promise<void> {
|
|
494
488
|
try {
|
|
495
|
-
// Add slash command message immediately to show the command being executed
|
|
496
|
-
const messageId = this.messageManager.addSlashMessage({
|
|
497
|
-
command: commandName,
|
|
498
|
-
args,
|
|
499
|
-
content, // Initial content with bash placeholders
|
|
500
|
-
});
|
|
501
|
-
|
|
502
489
|
// Parse bash commands from the content
|
|
503
490
|
const { commands, processedContent } = parseBashCommands(content);
|
|
504
491
|
|
|
@@ -512,12 +499,9 @@ export class SlashCommandManager {
|
|
|
512
499
|
);
|
|
513
500
|
}
|
|
514
501
|
|
|
515
|
-
//
|
|
516
|
-
this.messageManager.
|
|
517
|
-
command: commandName,
|
|
518
|
-
messageId,
|
|
502
|
+
// Add user message with the processed content
|
|
503
|
+
this.messageManager.addUserMessage({
|
|
519
504
|
content: finalContent,
|
|
520
|
-
stage: "success",
|
|
521
505
|
});
|
|
522
506
|
|
|
523
507
|
// Execute the AI conversation with custom configuration
|
package/src/types/messaging.ts
CHANGED
|
@@ -25,7 +25,6 @@ export type MessageBlock =
|
|
|
25
25
|
| ToolBlock
|
|
26
26
|
| ImageBlock
|
|
27
27
|
| BangBlock
|
|
28
|
-
| SlashBlock
|
|
29
28
|
| CompressBlock
|
|
30
29
|
| ReasoningBlock
|
|
31
30
|
| FileHistoryBlock;
|
|
@@ -36,17 +35,6 @@ export interface TextBlock {
|
|
|
36
35
|
source?: MessageSource;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
export interface SlashBlock {
|
|
40
|
-
type: "slash";
|
|
41
|
-
command: string;
|
|
42
|
-
args?: string;
|
|
43
|
-
content?: string; // The expanded prompt (template + args + bash output)
|
|
44
|
-
result?: string; // The final output (e.g., from a forked skill)
|
|
45
|
-
stage: "running" | "success" | "error" | "aborted";
|
|
46
|
-
error?: string;
|
|
47
|
-
shortResult?: string; // Progress summary (e.g., "3 tools | 1,234 tokens")
|
|
48
|
-
}
|
|
49
|
-
|
|
50
38
|
export interface ErrorBlock {
|
|
51
39
|
type: "error";
|
|
52
40
|
content: string;
|
|
@@ -197,22 +197,6 @@ export function convertMessagesForAPI(
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
// Handle SlashBlock
|
|
201
|
-
if (block.type === "slash") {
|
|
202
|
-
if (block.content && block.content.trim().length > 0) {
|
|
203
|
-
contentParts.push({
|
|
204
|
-
type: "text",
|
|
205
|
-
text: block.content,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
if (block.result && block.result.trim().length > 0) {
|
|
209
|
-
contentParts.push({
|
|
210
|
-
type: "text",
|
|
211
|
-
text: `<local-command-stdout>\n${stripAnsiColors(block.result)}\n</local-command-stdout>`,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
200
|
// If there is an image, add image content
|
|
217
201
|
if (
|
|
218
202
|
block.type === "image" &&
|
|
@@ -20,26 +20,6 @@ export interface AddUserMessageParams extends UserMessageParams {
|
|
|
20
20
|
id?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export interface AddSlashParams {
|
|
24
|
-
messages: Message[];
|
|
25
|
-
command: string;
|
|
26
|
-
args?: string;
|
|
27
|
-
content?: string;
|
|
28
|
-
id?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface UpdateSlashParams {
|
|
32
|
-
messages: Message[];
|
|
33
|
-
command: string;
|
|
34
|
-
messageId?: string;
|
|
35
|
-
args?: string;
|
|
36
|
-
content?: string;
|
|
37
|
-
result?: string;
|
|
38
|
-
stage?: "running" | "success" | "error" | "aborted";
|
|
39
|
-
error?: string;
|
|
40
|
-
shortResult?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
23
|
export interface UpdateToolBlockParams {
|
|
44
24
|
messages: Message[];
|
|
45
25
|
id: string;
|
|
@@ -175,95 +155,6 @@ export const addUserMessageToMessages = ({
|
|
|
175
155
|
return [...messages, userMessage];
|
|
176
156
|
};
|
|
177
157
|
|
|
178
|
-
/**
|
|
179
|
-
* Add a slash command message to the conversation.
|
|
180
|
-
*/
|
|
181
|
-
export const addSlashMessageToMessages = ({
|
|
182
|
-
messages,
|
|
183
|
-
command,
|
|
184
|
-
args,
|
|
185
|
-
content,
|
|
186
|
-
id,
|
|
187
|
-
}: AddSlashParams): Message[] => {
|
|
188
|
-
const slashMessage: Message = {
|
|
189
|
-
id: id || generateMessageId(),
|
|
190
|
-
role: "user",
|
|
191
|
-
blocks: [
|
|
192
|
-
{
|
|
193
|
-
type: "slash",
|
|
194
|
-
command,
|
|
195
|
-
args,
|
|
196
|
-
content,
|
|
197
|
-
stage: "running",
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
};
|
|
201
|
-
return [...messages, slashMessage];
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Update a slash block in a message.
|
|
206
|
-
*/
|
|
207
|
-
export const updateSlashBlockInMessage = ({
|
|
208
|
-
messages,
|
|
209
|
-
command,
|
|
210
|
-
messageId,
|
|
211
|
-
args,
|
|
212
|
-
content,
|
|
213
|
-
result,
|
|
214
|
-
stage,
|
|
215
|
-
error,
|
|
216
|
-
shortResult,
|
|
217
|
-
}: UpdateSlashParams): Message[] => {
|
|
218
|
-
const newMessages = [...messages];
|
|
219
|
-
|
|
220
|
-
// If messageId is provided, target that specific message
|
|
221
|
-
if (messageId) {
|
|
222
|
-
const messageIndex = newMessages.findIndex((msg) => msg.id === messageId);
|
|
223
|
-
if (messageIndex !== -1) {
|
|
224
|
-
const slashBlockIndex = newMessages[messageIndex].blocks.findIndex(
|
|
225
|
-
(block) => block.type === "slash" && block.command === command,
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
if (slashBlockIndex !== -1) {
|
|
229
|
-
const slashBlock = newMessages[messageIndex].blocks[slashBlockIndex];
|
|
230
|
-
if (slashBlock.type === "slash") {
|
|
231
|
-
if (args !== undefined) slashBlock.args = args;
|
|
232
|
-
if (content !== undefined) slashBlock.content = content;
|
|
233
|
-
if (result !== undefined) slashBlock.result = result;
|
|
234
|
-
if (stage !== undefined) slashBlock.stage = stage;
|
|
235
|
-
if (error !== undefined) slashBlock.error = error;
|
|
236
|
-
if (shortResult !== undefined) slashBlock.shortResult = shortResult;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return newMessages;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Find the last user message with a slash block for this command
|
|
244
|
-
for (let i = newMessages.length - 1; i >= 0; i--) {
|
|
245
|
-
const msg = newMessages[i];
|
|
246
|
-
if (msg.role === "user") {
|
|
247
|
-
const slashBlockIndex = msg.blocks.findIndex(
|
|
248
|
-
(block) => block.type === "slash" && block.command === command,
|
|
249
|
-
);
|
|
250
|
-
if (slashBlockIndex !== -1) {
|
|
251
|
-
const slashBlock = msg.blocks[slashBlockIndex];
|
|
252
|
-
if (slashBlock.type === "slash") {
|
|
253
|
-
if (args !== undefined) slashBlock.args = args;
|
|
254
|
-
if (content !== undefined) slashBlock.content = content;
|
|
255
|
-
if (result !== undefined) slashBlock.result = result;
|
|
256
|
-
if (stage !== undefined) slashBlock.stage = stage;
|
|
257
|
-
if (error !== undefined) slashBlock.error = error;
|
|
258
|
-
if (shortResult !== undefined) slashBlock.shortResult = shortResult;
|
|
259
|
-
}
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return newMessages;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
158
|
/**
|
|
268
159
|
* Update a user message's content by its ID.
|
|
269
160
|
*/
|
|
@@ -669,11 +560,6 @@ export function getMessageContent(message: Message): string {
|
|
|
669
560
|
return textBlock.content;
|
|
670
561
|
}
|
|
671
562
|
|
|
672
|
-
const slashBlock = message.blocks.find((block) => block.type === "slash");
|
|
673
|
-
if (slashBlock && "command" in slashBlock) {
|
|
674
|
-
return `/${slashBlock.command}${slashBlock.args ? ` ${slashBlock.args}` : ""}`;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
563
|
const bangBlock = message.blocks.find((block) => block.type === "bang");
|
|
678
564
|
if (bangBlock && "command" in bangBlock) {
|
|
679
565
|
return `!${bangBlock.command}`;
|