wave-agent-sdk 0.14.1 → 0.14.3
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/builtin/skills/settings/HOOKS.md +69 -0
- package/builtin/skills/settings/PLUGINS.md +171 -0
- package/builtin/skills/settings/SKILL.md +8 -3
- package/builtin/skills/settings/SUBAGENTS.md +21 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +12 -3
- package/dist/managers/aiManager.d.ts +6 -6
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +122 -59
- package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
- package/dist/managers/backgroundTaskManager.js +28 -18
- package/dist/managers/hookManager.d.ts +16 -1
- package/dist/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +97 -8
- package/dist/managers/messageManager.d.ts +19 -4
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +63 -18
- package/dist/managers/pluginManager.d.ts +1 -0
- package/dist/managers/pluginManager.d.ts.map +1 -1
- package/dist/managers/pluginManager.js +7 -0
- package/dist/managers/subagentManager.d.ts +5 -0
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +35 -0
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/services/MarketplaceService.d.ts +0 -11
- package/dist/services/MarketplaceService.d.ts.map +1 -1
- package/dist/services/MarketplaceService.js +21 -89
- package/dist/services/aiService.d.ts +3 -3
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +7 -7
- package/dist/services/hook.d.ts.map +1 -1
- package/dist/services/hook.js +15 -0
- package/dist/services/initializationService.d.ts.map +1 -1
- package/dist/services/initializationService.js +24 -1
- package/dist/services/interactionService.js +1 -1
- package/dist/services/pluginLoader.d.ts +5 -6
- package/dist/services/pluginLoader.d.ts.map +1 -1
- package/dist/services/pluginLoader.js +43 -53
- package/dist/services/session.d.ts +1 -1
- package/dist/services/session.js +7 -7
- package/dist/services/taskManager.d.ts +1 -1
- package/dist/services/taskManager.js +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +9 -1
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +2 -0
- package/dist/types/marketplace.d.ts +1 -26
- package/dist/types/marketplace.d.ts.map +1 -1
- package/dist/types/messaging.d.ts +3 -3
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +3 -13
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +18 -7
- package/dist/utils/groupMessagesByApiRound.d.ts +1 -1
- package/dist/utils/groupMessagesByApiRound.js +6 -6
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +3 -3
- package/dist/utils/subagentParser.d.ts +8 -1
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +18 -3
- package/package.json +1 -1
- package/src/agent.ts +16 -3
- package/src/managers/aiManager.ts +142 -63
- package/src/managers/backgroundTaskManager.ts +32 -22
- package/src/managers/hookManager.ts +125 -10
- package/src/managers/messageManager.ts +76 -22
- package/src/managers/pluginManager.ts +10 -0
- package/src/managers/subagentManager.ts +47 -0
- package/src/prompts/index.ts +1 -1
- package/src/services/MarketplaceService.ts +26 -127
- package/src/services/aiService.ts +11 -11
- package/src/services/hook.ts +17 -0
- package/src/services/initializationService.ts +33 -1
- package/src/services/interactionService.ts +1 -1
- package/src/services/pluginLoader.ts +51 -67
- package/src/services/session.ts +7 -7
- package/src/services/taskManager.ts +1 -1
- package/src/types/core.ts +1 -1
- package/src/types/hooks.ts +16 -2
- package/src/types/marketplace.ts +1 -24
- package/src/types/messaging.ts +3 -3
- package/src/types/plugins.ts +3 -13
- package/src/utils/convertMessagesForAPI.ts +24 -9
- package/src/utils/groupMessagesByApiRound.ts +6 -6
- package/src/utils/messageOperations.ts +3 -5
- package/src/utils/subagentParser.ts +31 -4
package/dist/services/hook.js
CHANGED
|
@@ -58,6 +58,21 @@ async function buildHookJsonInput(context) {
|
|
|
58
58
|
jsonInput.name = context.worktreeName;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
// Add SessionStart-specific fields
|
|
62
|
+
if (context.event === "SessionStart") {
|
|
63
|
+
if (context.source !== undefined) {
|
|
64
|
+
jsonInput.source = context.source;
|
|
65
|
+
}
|
|
66
|
+
if (context.agentType !== undefined) {
|
|
67
|
+
jsonInput.agent_type = context.agentType;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Add SessionEnd-specific fields
|
|
71
|
+
if (context.event === "SessionEnd") {
|
|
72
|
+
if (context.endSource !== undefined) {
|
|
73
|
+
jsonInput.end_source = context.endSource;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
61
76
|
return jsonInput;
|
|
62
77
|
}
|
|
63
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializationService.d.ts","sourceRoot":"","sources":["../../src/services/initializationService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAA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IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,wBAAwB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,qBAAa,qBAAqB;WACZ,UAAU,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE;QACR,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;KACtB,GACA,OAAO,CAAC,IAAI,CAAC;CAyTjB"}
|
|
@@ -75,6 +75,29 @@ export class InitializationService {
|
|
|
75
75
|
logger?.error("Failed to initialize hooks system:", error);
|
|
76
76
|
// Don't throw error to prevent app startup failure
|
|
77
77
|
}
|
|
78
|
+
// Execute SessionStart hooks
|
|
79
|
+
try {
|
|
80
|
+
const phaseStart = performance.now();
|
|
81
|
+
const sessionStartResult = await hookManager.executeSessionStartHooks("startup", messageManager.getSessionId(), messageManager.getTranscriptPath());
|
|
82
|
+
// Inject additionalContext as a meta user message (matches Claude Code)
|
|
83
|
+
if (sessionStartResult.additionalContext) {
|
|
84
|
+
messageManager.addUserMessage({
|
|
85
|
+
content: `<system-reminder>\nSessionStart hook additional context: ${sessionStartResult.additionalContext}\n</system-reminder>`,
|
|
86
|
+
isMeta: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Inject initialUserMessage as a meta user message
|
|
90
|
+
if (sessionStartResult.initialUserMessage) {
|
|
91
|
+
messageManager.addUserMessage({
|
|
92
|
+
content: sessionStartResult.initialUserMessage,
|
|
93
|
+
isMeta: true,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
logger?.debug(`Initialization Phase [SessionStart Hooks] took ${(performance.now() - phaseStart).toFixed(2)}ms`);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
logger?.warn("SessionStart hooks execution failed:", error);
|
|
100
|
+
}
|
|
78
101
|
// Trigger WorktreeCreate hook if this is a new worktree
|
|
79
102
|
if (agentOptions.isNewWorktree && hookManager) {
|
|
80
103
|
try {
|
|
@@ -188,7 +211,7 @@ export class InitializationService {
|
|
|
188
211
|
messageManager.rebuildUsageFromMessages(sessionToRestore?.messages || []);
|
|
189
212
|
if (sessionToRestore) {
|
|
190
213
|
messageManager.initializeFromSession(sessionToRestore);
|
|
191
|
-
// Update task manager with the root session ID to ensure continuity across
|
|
214
|
+
// Update task manager with the root session ID to ensure continuity across compactions
|
|
192
215
|
taskManager.setTaskListId(sessionToRestore.rootSessionId || sessionToRestore.id);
|
|
193
216
|
// After session is initialized, load tasks for the session
|
|
194
217
|
const tasks = await taskManager.listTasks();
|
|
@@ -103,7 +103,7 @@ export class InteractionService {
|
|
|
103
103
|
messageManager.rebuildUsageFromMessages(sessionData.messages);
|
|
104
104
|
// 6. Initialize session state last
|
|
105
105
|
messageManager.initializeFromSession(sessionData);
|
|
106
|
-
// Update task manager with the root session ID to ensure continuity across
|
|
106
|
+
// Update task manager with the root session ID to ensure continuity across compactions
|
|
107
107
|
taskManager.setTaskListId(sessionData.rootSessionId || sessionData.id);
|
|
108
108
|
// 7. Load tasks for the restored session
|
|
109
109
|
const tasks = await taskManager.listTasks();
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { PluginManifest, CustomSlashCommand, Skill, LspConfig, McpConfig, PartialHookConfiguration } from "../types/index.js";
|
|
2
|
+
import { type SubagentConfiguration } from "../utils/subagentParser.js";
|
|
2
3
|
export declare class PluginLoader {
|
|
3
|
-
/**
|
|
4
|
-
* Finds the first existing plugin manifest path.
|
|
5
|
-
* Prefers .wave-plugin/ for backward compatibility, falls back to .claude-plugin/.
|
|
6
|
-
* Returns null if neither exists.
|
|
7
|
-
*/
|
|
8
|
-
private static findPluginManifestPath;
|
|
9
4
|
/**
|
|
10
5
|
* Load and validate a plugin manifest from a directory
|
|
11
6
|
* @param pluginPath Absolute path to the plugin directory
|
|
@@ -33,6 +28,10 @@ export declare class PluginLoader {
|
|
|
33
28
|
* Load hooks configuration from a plugin
|
|
34
29
|
*/
|
|
35
30
|
static loadHooksConfig(pluginPath: string): Promise<PartialHookConfiguration | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Load agent configurations from a plugin's agents directory
|
|
33
|
+
*/
|
|
34
|
+
static loadAgents(pluginPath: string): Promise<SubagentConfiguration[]>;
|
|
36
35
|
/**
|
|
37
36
|
* Validate the plugin manifest structure
|
|
38
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,SAAS,EACT,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAIpC,qBAAa,YAAY;IACvB;;;OAGG;WACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6CtE;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAK7D;;;OAGG;WACU,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAuC7D;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAUjC;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAUjC;;OAEG;WACU,eAAe,CAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAgBhD;;OAEG;WACU,UAAU,CACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA2BnC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAgBhC"}
|
|
@@ -1,73 +1,30 @@
|
|
|
1
1
|
import * as fs from "fs/promises";
|
|
2
|
-
import * as fsSync from "fs";
|
|
3
2
|
import * as path from "path";
|
|
4
3
|
import { scanCommandsDirectory } from "../utils/customCommands.js";
|
|
5
4
|
import { parseSkillFile } from "../utils/skillParser.js";
|
|
5
|
+
import { parseAgentFile, } from "../utils/subagentParser.js";
|
|
6
6
|
import { resolveMcpConfig } from "../managers/mcpManager.js";
|
|
7
|
+
import { logger } from "../utils/globalLogger.js";
|
|
7
8
|
export class PluginLoader {
|
|
8
|
-
/**
|
|
9
|
-
* Finds the first existing plugin manifest path.
|
|
10
|
-
* Prefers .wave-plugin/ for backward compatibility, falls back to .claude-plugin/.
|
|
11
|
-
* Returns null if neither exists.
|
|
12
|
-
*/
|
|
13
|
-
static findPluginManifestPath(pluginPath) {
|
|
14
|
-
const waveManifestPath = path.join(pluginPath, ".wave-plugin", "plugin.json");
|
|
15
|
-
const claudeManifestPath = path.join(pluginPath, ".claude-plugin", "plugin.json");
|
|
16
|
-
// Check .wave-plugin first for backward compatibility
|
|
17
|
-
try {
|
|
18
|
-
const waveStat = fsSync.statSync(waveManifestPath);
|
|
19
|
-
if (waveStat.isFile()) {
|
|
20
|
-
return waveManifestPath;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// .wave-plugin/plugin.json doesn't exist
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
const claudeStat = fsSync.statSync(claudeManifestPath);
|
|
28
|
-
if (claudeStat.isFile()) {
|
|
29
|
-
return claudeManifestPath;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
// .claude-plugin/plugin.json doesn't exist
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
9
|
/**
|
|
38
10
|
* Load and validate a plugin manifest from a directory
|
|
39
11
|
* @param pluginPath Absolute path to the plugin directory
|
|
40
12
|
*/
|
|
41
13
|
static async loadManifest(pluginPath) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
// Determine which directory is being used for validation
|
|
47
|
-
const pluginDirName = manifestPath.includes(".claude-plugin")
|
|
48
|
-
? ".claude-plugin"
|
|
49
|
-
: ".wave-plugin";
|
|
50
|
-
const pluginDirPath = path.join(pluginPath, pluginDirName);
|
|
51
|
-
// T018: Ensure plugin.json is the only file in the manifest directory
|
|
52
|
-
// For .claude-plugin/, marketplace.json is also allowed (Claude Code convention)
|
|
14
|
+
const dotWavePluginPath = path.join(pluginPath, ".wave-plugin");
|
|
15
|
+
const manifestPath = path.join(dotWavePluginPath, "plugin.json");
|
|
16
|
+
// T018: Ensure plugin.json is the only file in .wave-plugin/
|
|
53
17
|
try {
|
|
54
|
-
const entries = await fs.readdir(
|
|
55
|
-
const
|
|
56
|
-
if (pluginDirName === ".claude-plugin") {
|
|
57
|
-
allowedFiles.push("marketplace.json");
|
|
58
|
-
}
|
|
59
|
-
const misplaced = entries.filter((e) => !allowedFiles.includes(e));
|
|
18
|
+
const entries = await fs.readdir(dotWavePluginPath);
|
|
19
|
+
const misplaced = entries.filter((e) => e !== "plugin.json");
|
|
60
20
|
if (misplaced.length > 0) {
|
|
61
|
-
|
|
62
|
-
? "Only plugin.json and marketplace.json should be in this directory."
|
|
63
|
-
: "Only plugin.json should be in this directory.";
|
|
64
|
-
throw new Error(`Misplaced files/directories in ${pluginDirName}/: ${misplaced.join(", ")}. ${allowedMsg}`);
|
|
21
|
+
throw new Error(`Misplaced files/directories in .wave-plugin/: ${misplaced.join(", ")}. Only plugin.json should be in this directory.`);
|
|
65
22
|
}
|
|
66
23
|
}
|
|
67
24
|
catch (error) {
|
|
68
25
|
if (error instanceof Error &&
|
|
69
26
|
error.code === "ENOENT") {
|
|
70
|
-
throw new Error(`Plugin manifest directory not found at ${
|
|
27
|
+
throw new Error(`Plugin manifest directory not found at ${dotWavePluginPath}`);
|
|
71
28
|
}
|
|
72
29
|
throw error;
|
|
73
30
|
}
|
|
@@ -168,12 +125,45 @@ export class PluginLoader {
|
|
|
168
125
|
const hooksPath = path.join(pluginPath, "hooks", "hooks.json");
|
|
169
126
|
try {
|
|
170
127
|
const content = await fs.readFile(hooksPath, "utf-8");
|
|
171
|
-
|
|
128
|
+
const parsed = JSON.parse(content);
|
|
129
|
+
// Claude Code wrapper format: { "hooks": { "SessionStart": [...] } }
|
|
130
|
+
// (optional "description" sibling key)
|
|
131
|
+
if (parsed && typeof parsed === "object" && "hooks" in parsed) {
|
|
132
|
+
return parsed.hooks;
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
172
135
|
}
|
|
173
136
|
catch {
|
|
174
137
|
return undefined;
|
|
175
138
|
}
|
|
176
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Load agent configurations from a plugin's agents directory
|
|
142
|
+
*/
|
|
143
|
+
static async loadAgents(pluginPath) {
|
|
144
|
+
const agentsPath = path.join(pluginPath, "agents");
|
|
145
|
+
const agents = [];
|
|
146
|
+
try {
|
|
147
|
+
const entries = await fs.readdir(agentsPath, { withFileTypes: true });
|
|
148
|
+
for (const entry of entries) {
|
|
149
|
+
if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
150
|
+
const agentFilePath = path.join(agentsPath, entry.name);
|
|
151
|
+
try {
|
|
152
|
+
const config = parseAgentFile(agentFilePath, "plugin", pluginPath);
|
|
153
|
+
agents.push(config);
|
|
154
|
+
}
|
|
155
|
+
catch (parseError) {
|
|
156
|
+
// Log error but continue with other files
|
|
157
|
+
logger?.warn(`Warning: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// agents directory might not exist
|
|
164
|
+
}
|
|
165
|
+
return agents;
|
|
166
|
+
}
|
|
177
167
|
/**
|
|
178
168
|
* Validate the plugin manifest structure
|
|
179
169
|
*/
|
|
@@ -160,7 +160,7 @@ export declare function sessionExistsInJsonl(sessionId: string, workdir: string,
|
|
|
160
160
|
/**
|
|
161
161
|
* Get the content of the first message in a session
|
|
162
162
|
* For user role: get text block content
|
|
163
|
-
* For assistant role: get
|
|
163
|
+
* For assistant role: get compact block content
|
|
164
164
|
* @param sessionId - Session ID to get first message from
|
|
165
165
|
* @param workdir - Working directory for session operations
|
|
166
166
|
* @returns Promise that resolves to the first message content or null if not found
|
package/dist/services/session.js
CHANGED
|
@@ -637,7 +637,7 @@ export async function sessionExistsInJsonl(sessionId, workdir, sessionType) {
|
|
|
637
637
|
/**
|
|
638
638
|
* Get the content of the first message in a session
|
|
639
639
|
* For user role: get text block content
|
|
640
|
-
* For assistant role: get
|
|
640
|
+
* For assistant role: get compact block content
|
|
641
641
|
* @param sessionId - Session ID to get first message from
|
|
642
642
|
* @param workdir - Working directory for session operations
|
|
643
643
|
* @returns Promise that resolves to the first message content or null if not found
|
|
@@ -778,17 +778,17 @@ export async function loadFullMessageThread(currentSessionId, workdir) {
|
|
|
778
778
|
break;
|
|
779
779
|
sessionIds.unshift(currentId);
|
|
780
780
|
// Add messages from this session to the beginning of the list
|
|
781
|
-
// But skip the "
|
|
781
|
+
// But skip the "compact" block if it's not the first session in our traversal (which is the latest)
|
|
782
782
|
// Actually, we should probably keep all messages and let the UI/logic handle it.
|
|
783
|
-
// But wait, if we are concatenating, the "
|
|
784
|
-
// So if we have session N-1 and session N, we should probably skip the
|
|
783
|
+
// But wait, if we are concatenating, the "compact" block in session N summarizes session N-1.
|
|
784
|
+
// So if we have session N-1 and session N, we should probably skip the compact block in session N.
|
|
785
785
|
const messages = sessionData.messages;
|
|
786
786
|
if (allMessages.length > 0) {
|
|
787
787
|
// If we already have messages (from "later" sessions),
|
|
788
788
|
// we are now adding messages from an "earlier" session.
|
|
789
|
-
// The later session's first message might be a "
|
|
790
|
-
if (allMessages[0].blocks.some((b) => b.type === "
|
|
791
|
-
// Remove the
|
|
789
|
+
// The later session's first message might be a "compact" block.
|
|
790
|
+
if (allMessages[0].blocks.some((b) => b.type === "compact")) {
|
|
791
|
+
// Remove the compact block from the later session's messages
|
|
792
792
|
// because we are now providing the actual messages it summarized.
|
|
793
793
|
allMessages.shift();
|
|
794
794
|
}
|
|
@@ -10,7 +10,7 @@ export declare class TaskManager extends EventEmitter {
|
|
|
10
10
|
setTaskListId(taskListId: string): void;
|
|
11
11
|
/**
|
|
12
12
|
* Syncs the task list ID with the current session's root session ID.
|
|
13
|
-
* This is typically called when the session is cleared or
|
|
13
|
+
* This is typically called when the session is cleared or compacted.
|
|
14
14
|
*/
|
|
15
15
|
syncWithSession(): Promise<void>;
|
|
16
16
|
private getSessionDir;
|
|
@@ -18,7 +18,7 @@ export class TaskManager extends EventEmitter {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Syncs the task list ID with the current session's root session ID.
|
|
21
|
-
* This is typically called when the session is cleared or
|
|
21
|
+
* This is typically called when the session is cleared or compacted.
|
|
22
22
|
*/
|
|
23
23
|
async syncWithSession() {
|
|
24
24
|
const messageManager = this.container.get("MessageManager");
|
package/dist/types/core.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface Usage {
|
|
|
22
22
|
completion_tokens: number;
|
|
23
23
|
total_tokens: number;
|
|
24
24
|
model?: string;
|
|
25
|
-
operation_type?: "agent" | "
|
|
25
|
+
operation_type?: "agent" | "compact";
|
|
26
26
|
cache_read_input_tokens?: number;
|
|
27
27
|
cache_creation_input_tokens?: number;
|
|
28
28
|
cache_creation?: {
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;A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AE,MAAM,CAAC;IACnB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,KAAK,EAAE,MAAM;aACb,QAAQ,CAAC,EAAE,OAAO;gBAFlC,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,YAAA;CAKrC;AAGD,eAAO,MAAM,aAAa;;;;;;CAShB,CAAC"}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* enabling automated actions at specific workflow points.
|
|
6
6
|
*/
|
|
7
7
|
export type { WaveConfiguration, HookConfiguration, PartialHookConfiguration, HookConfigurationRecord, } from "./configuration.js";
|
|
8
|
-
export type HookEvent = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "SubagentStop" | "PermissionRequest" | "WorktreeCreate" | "CwdChanged";
|
|
8
|
+
export type HookEvent = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "SubagentStop" | "PermissionRequest" | "WorktreeCreate" | "CwdChanged" | "SessionStart" | "SessionEnd";
|
|
9
9
|
export interface HookCommand {
|
|
10
10
|
type: "command";
|
|
11
11
|
command: string;
|
|
@@ -51,6 +51,8 @@ export declare class HookConfigurationError extends Error {
|
|
|
51
51
|
readonly validationErrors: string[];
|
|
52
52
|
constructor(configPath: string, validationErrors: string[]);
|
|
53
53
|
}
|
|
54
|
+
export type SessionStartSource = "startup" | "resume" | "compact";
|
|
55
|
+
export type SessionEndSource = "exit" | "stop" | "compact";
|
|
54
56
|
export declare function isValidHookEvent(event: string): event is HookEvent;
|
|
55
57
|
export declare function isValidHookCommand(cmd: unknown): cmd is HookCommand;
|
|
56
58
|
export declare function isValidHookEventConfig(config: unknown): config is HookEventConfig;
|
|
@@ -67,6 +69,9 @@ export interface HookJsonInput {
|
|
|
67
69
|
name?: string;
|
|
68
70
|
old_cwd?: string;
|
|
69
71
|
new_cwd?: string;
|
|
72
|
+
source?: SessionStartSource;
|
|
73
|
+
agent_type?: string;
|
|
74
|
+
end_source?: SessionEndSource;
|
|
70
75
|
}
|
|
71
76
|
export interface ExtendedHookExecutionContext extends HookExecutionContext {
|
|
72
77
|
sessionId?: string;
|
|
@@ -80,6 +85,9 @@ export interface ExtendedHookExecutionContext extends HookExecutionContext {
|
|
|
80
85
|
worktreeName?: string;
|
|
81
86
|
oldCwd?: string;
|
|
82
87
|
newCwd?: string;
|
|
88
|
+
source?: SessionStartSource;
|
|
89
|
+
agentType?: string;
|
|
90
|
+
endSource?: SessionEndSource;
|
|
83
91
|
}
|
|
84
92
|
export interface HookEnvironment {
|
|
85
93
|
WAVE_PROJECT_DIR: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/types/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,MAAM,GACN,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,YAAY,CAAC;AAGjB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAGD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;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AAE,MAAM,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAGD,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB"}
|
package/dist/types/hooks.js
CHANGED
|
@@ -5,27 +5,8 @@ export interface MarketplaceOwner {
|
|
|
5
5
|
}
|
|
6
6
|
export interface MarketplacePluginEntry {
|
|
7
7
|
name: string;
|
|
8
|
-
source: string
|
|
8
|
+
source: string;
|
|
9
9
|
description: string;
|
|
10
|
-
/** Claude Code compatibility: plugin category */
|
|
11
|
-
category?: string;
|
|
12
|
-
/** Claude Code compatibility: plugin tags */
|
|
13
|
-
tags?: string[];
|
|
14
|
-
/** Claude Code compatibility: when false, plugin.json is optional */
|
|
15
|
-
strict?: boolean;
|
|
16
|
-
/** Claude Code compatibility: inline manifest fields */
|
|
17
|
-
version?: string;
|
|
18
|
-
author?: {
|
|
19
|
-
name: string;
|
|
20
|
-
url?: string;
|
|
21
|
-
};
|
|
22
|
-
homepage?: string;
|
|
23
|
-
repository?: string;
|
|
24
|
-
license?: string;
|
|
25
|
-
keywords?: string[];
|
|
26
|
-
commands?: string;
|
|
27
|
-
skills?: string;
|
|
28
|
-
agents?: string;
|
|
29
10
|
}
|
|
30
11
|
export interface MarketplacePluginStatus extends MarketplacePluginEntry {
|
|
31
12
|
marketplace: string;
|
|
@@ -39,8 +20,6 @@ export interface MarketplaceManifest {
|
|
|
39
20
|
name: string;
|
|
40
21
|
owner: MarketplaceOwner;
|
|
41
22
|
plugins: MarketplacePluginEntry[];
|
|
42
|
-
/** Claude Code compatibility: additional metadata */
|
|
43
|
-
metadata?: Record<string, unknown>;
|
|
44
23
|
}
|
|
45
24
|
export type MarketplaceSource = {
|
|
46
25
|
source: "directory";
|
|
@@ -53,10 +32,6 @@ export type MarketplaceSource = {
|
|
|
53
32
|
source: "git";
|
|
54
33
|
url: string;
|
|
55
34
|
ref?: string;
|
|
56
|
-
} | {
|
|
57
|
-
source: "url";
|
|
58
|
-
url: string;
|
|
59
|
-
ref?: string;
|
|
60
35
|
};
|
|
61
36
|
export interface KnownMarketplace {
|
|
62
37
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/types/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/types/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;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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 | CompactBlock | ReasoningBlock | FileHistoryBlock | TaskNotificationBlock;
|
|
19
19
|
export interface TextBlock {
|
|
20
20
|
type: "text";
|
|
21
21
|
content: string;
|
|
@@ -65,8 +65,8 @@ export interface BangBlock {
|
|
|
65
65
|
stage: "running" | "end";
|
|
66
66
|
exitCode: number | null;
|
|
67
67
|
}
|
|
68
|
-
export interface
|
|
69
|
-
type: "
|
|
68
|
+
export interface CompactBlock {
|
|
69
|
+
type: "compact";
|
|
70
70
|
content: string;
|
|
71
71
|
sessionId: string;
|
|
72
72
|
}
|
|
@@ -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":"AAA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,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { Skill } from "./skills.js";
|
|
|
3
3
|
import { LspConfig } from "./lsp.js";
|
|
4
4
|
import { McpConfig } from "./mcp.js";
|
|
5
5
|
import { PartialHookConfiguration } from "./configuration.js";
|
|
6
|
+
import { SubagentConfiguration } from "../utils/subagentParser.js";
|
|
6
7
|
/**
|
|
7
|
-
* Plugin manifest structure (.wave-plugin/plugin.json
|
|
8
|
+
* Plugin manifest structure (.wave-plugin/plugin.json)
|
|
8
9
|
*/
|
|
9
10
|
export interface PluginManifest {
|
|
10
11
|
name: string;
|
|
@@ -13,18 +14,6 @@ export interface PluginManifest {
|
|
|
13
14
|
author?: {
|
|
14
15
|
name: string;
|
|
15
16
|
};
|
|
16
|
-
/** Claude Code compatibility: plugin keywords */
|
|
17
|
-
keywords?: string[];
|
|
18
|
-
/** Claude Code compatibility: plugin homepage URL */
|
|
19
|
-
homepage?: string;
|
|
20
|
-
/** Claude Code compatibility: repository info */
|
|
21
|
-
repository?: string;
|
|
22
|
-
/** Claude Code compatibility: license info */
|
|
23
|
-
license?: string;
|
|
24
|
-
/** Claude Code compatibility: plugin dependencies */
|
|
25
|
-
dependencies?: Record<string, string>;
|
|
26
|
-
/** Claude Code compatibility: user configuration schema */
|
|
27
|
-
userConfig?: Record<string, unknown>;
|
|
28
17
|
}
|
|
29
18
|
/**
|
|
30
19
|
* Plugin configuration in AgentOptions or wave.settings.json
|
|
@@ -40,6 +29,7 @@ export interface Plugin extends PluginManifest {
|
|
|
40
29
|
path: string;
|
|
41
30
|
commands: CustomSlashCommand[];
|
|
42
31
|
skills: Skill[];
|
|
32
|
+
agents: SubagentConfiguration[];
|
|
43
33
|
lspConfig?: LspConfig;
|
|
44
34
|
mcpConfig?: McpConfig;
|
|
45
35
|
hooksConfig?: PartialHookConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/types/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/types/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,cAAc;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Message } from "../types/index.js";
|
|
2
2
|
import { ChatCompletionMessageParam } from "openai/resources.js";
|
|
3
3
|
/**
|
|
4
|
-
* Convert message format to API call format, stopping when a
|
|
4
|
+
* Convert message format to API call format, stopping when a compacted message is encountered.
|
|
5
5
|
* Messages with no meaningful content or tool calls are filtered out.
|
|
6
6
|
* @param messages Message list
|
|
7
7
|
* @returns Converted API message format list
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertMessagesForAPI.d.ts","sourceRoot":"","sources":["../../src/utils/convertMessagesForAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKjD,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;AAKjD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AA0B7B;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,GAClB,0BAA0B,EAAE,CAsP9B"}
|
|
@@ -25,7 +25,7 @@ function safeToolArguments(args) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Convert message format to API call format, stopping when a
|
|
28
|
+
* Convert message format to API call format, stopping when a compacted message is encountered.
|
|
29
29
|
* Messages with no meaningful content or tool calls are filtered out.
|
|
30
30
|
* @param messages Message list
|
|
31
31
|
* @returns Converted API message format list
|
|
@@ -35,15 +35,15 @@ export function convertMessagesForAPI(messages) {
|
|
|
35
35
|
const startIndex = messages.length - 1;
|
|
36
36
|
for (let i = startIndex; i >= 0; i--) {
|
|
37
37
|
const message = messages[i];
|
|
38
|
-
// Check if a
|
|
38
|
+
// Check if a compaction block is encountered, if so, stop iteration
|
|
39
39
|
if (message.role === "assistant" &&
|
|
40
|
-
message.blocks.some((block) => block.type === "
|
|
41
|
-
// Add the content of the
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
40
|
+
message.blocks.some((block) => block.type === "compact")) {
|
|
41
|
+
// Add the content of the compaction block as an assistant message to the history
|
|
42
|
+
const compactBlock = message.blocks.find((block) => block.type === "compact");
|
|
43
|
+
if (compactBlock && compactBlock.type === "compact") {
|
|
44
44
|
recentMessages.unshift({
|
|
45
45
|
role: "user",
|
|
46
|
-
content:
|
|
46
|
+
content: compactBlock.content,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
@@ -114,6 +114,16 @@ export function convertMessagesForAPI(messages) {
|
|
|
114
114
|
.map((block) => (block.type === "text" ? block.content : ""))
|
|
115
115
|
.join("\n");
|
|
116
116
|
}
|
|
117
|
+
// Extract reasoning content from reasoning blocks
|
|
118
|
+
const reasoningBlocks = message.blocks.filter((block) => block.type === "reasoning" &&
|
|
119
|
+
block.content &&
|
|
120
|
+
block.content.trim().length > 0);
|
|
121
|
+
let reasoning_content;
|
|
122
|
+
if (reasoningBlocks.length > 0) {
|
|
123
|
+
reasoning_content = reasoningBlocks
|
|
124
|
+
.map((block) => (block.type === "reasoning" ? block.content : ""))
|
|
125
|
+
.join("\n");
|
|
126
|
+
}
|
|
117
127
|
// Construct tool calls from tool blocks
|
|
118
128
|
if (toolBlocks.length > 0) {
|
|
119
129
|
tool_calls = toolBlocks
|
|
@@ -138,6 +148,7 @@ export function convertMessagesForAPI(messages) {
|
|
|
138
148
|
role: "assistant",
|
|
139
149
|
content: hasContent ? content : undefined,
|
|
140
150
|
tool_calls,
|
|
151
|
+
...(reasoning_content ? { reasoning_content } : {}),
|
|
141
152
|
...(message.additionalFields ? { ...message.additionalFields } : {}),
|
|
142
153
|
};
|
|
143
154
|
recentMessages.unshift(assistantMessage);
|
|
@@ -12,7 +12,7 @@ export interface ApiRound {
|
|
|
12
12
|
* Boundaries:
|
|
13
13
|
* - A new `role: "user"` message starts a new round.
|
|
14
14
|
* - A new `role: "assistant"` message with a different `id` starts a new round.
|
|
15
|
-
* - A message with a `
|
|
15
|
+
* - A message with a `compact` block is pushed as its own round and starts a
|
|
16
16
|
* new round after it.
|
|
17
17
|
*/
|
|
18
18
|
export declare function groupMessagesByApiRound(messages: Message[]): ApiRound[];
|