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
|
@@ -9,6 +9,7 @@ export class MessageManager {
|
|
|
9
9
|
this.container = container;
|
|
10
10
|
this.filesInContext = new Set(); // Track files mentioned in the conversation
|
|
11
11
|
this.recentFileReads = new Map(); // Track file read contents
|
|
12
|
+
this.invokedSkills = new Map(); // Track invoked skill names
|
|
12
13
|
this._usages = [];
|
|
13
14
|
this.sessionId = generateSessionId();
|
|
14
15
|
this.rootSessionId = this.sessionId;
|
|
@@ -152,11 +153,13 @@ export class MessageManager {
|
|
|
152
153
|
for (const message of newMessages) {
|
|
153
154
|
this.addPathsFromMessage(message);
|
|
154
155
|
this.extractFileReadsFromMessage(message);
|
|
156
|
+
this.extractSkillInvocationsFromMessage(message);
|
|
155
157
|
}
|
|
156
158
|
// Also check if the last message was updated (common for tool blocks)
|
|
157
159
|
if (messages.length > 0 && messages.length === oldLength) {
|
|
158
160
|
this.addPathsFromMessage(messages[messages.length - 1]);
|
|
159
161
|
this.extractFileReadsFromMessage(messages[messages.length - 1]);
|
|
162
|
+
this.extractSkillInvocationsFromMessage(messages[messages.length - 1]);
|
|
160
163
|
}
|
|
161
164
|
this.callbacks.onMessagesChange?.([...messages]);
|
|
162
165
|
}
|
|
@@ -317,26 +320,26 @@ export class MessageManager {
|
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
/**
|
|
320
|
-
*
|
|
323
|
+
* Compact messages and update session, delete compacted messages, only keep compacted messages and last 3 messages
|
|
321
324
|
*/
|
|
322
|
-
|
|
325
|
+
compactMessagesAndUpdateSession(compactedContent, usage) {
|
|
323
326
|
// Get last 2 API rounds to preserve (structurally safe boundary)
|
|
324
327
|
const lastThreeMessages = getLastApiRounds(this.messages, 2);
|
|
325
|
-
// Create
|
|
326
|
-
const
|
|
328
|
+
// Create compacted message
|
|
329
|
+
const compactMessage = {
|
|
327
330
|
id: generateMessageId(),
|
|
328
331
|
role: "assistant",
|
|
329
332
|
blocks: [
|
|
330
333
|
{
|
|
331
|
-
type: "
|
|
332
|
-
content:
|
|
334
|
+
type: "compact",
|
|
335
|
+
content: compactedContent,
|
|
333
336
|
sessionId: this.sessionId,
|
|
334
337
|
},
|
|
335
338
|
],
|
|
336
339
|
...(usage && { usage }),
|
|
337
340
|
};
|
|
338
|
-
// Build new message array: keep the
|
|
339
|
-
const newMessages = [
|
|
341
|
+
// Build new message array: keep the compacted message and last 3 messages
|
|
342
|
+
const newMessages = [compactMessage, ...lastThreeMessages];
|
|
340
343
|
// Update sessionId and parentSessionId
|
|
341
344
|
const oldSessionId = this.sessionId;
|
|
342
345
|
this.setSessionId(generateSessionId());
|
|
@@ -352,14 +355,14 @@ export class MessageManager {
|
|
|
352
355
|
for (const message of this.messages) {
|
|
353
356
|
this.addPathsFromMessage(message);
|
|
354
357
|
}
|
|
355
|
-
// Scan
|
|
358
|
+
// Scan compactedContent for file mentions
|
|
356
359
|
const fileMentionRegex = /(?:^|\s)@([\w.\-/]+)/g;
|
|
357
360
|
let match;
|
|
358
|
-
while ((match = fileMentionRegex.exec(
|
|
361
|
+
while ((match = fileMentionRegex.exec(compactedContent)) !== null) {
|
|
359
362
|
this.touchFile(match[1]);
|
|
360
363
|
}
|
|
361
|
-
// Trigger
|
|
362
|
-
this.callbacks.
|
|
364
|
+
// Trigger compaction callback
|
|
365
|
+
this.callbacks.onCompactBlockAdded?.(compactedContent);
|
|
363
366
|
}
|
|
364
367
|
addFileHistoryBlock(snapshots) {
|
|
365
368
|
if (snapshots.length === 0)
|
|
@@ -597,7 +600,7 @@ export class MessageManager {
|
|
|
597
600
|
// Find which session the index belongs to
|
|
598
601
|
let targetSessionId = this.sessionId;
|
|
599
602
|
let targetIndexInSession = index;
|
|
600
|
-
// We need to be careful here because loadFullMessageThread might have removed "
|
|
603
|
+
// We need to be careful here because loadFullMessageThread might have removed "compact" blocks
|
|
601
604
|
// Let's re-calculate based on the actual messages returned.
|
|
602
605
|
// Actually, it's easier to just load sessions one by one again or keep track of counts.
|
|
603
606
|
// For simplicity, let's assume we want to truncate the WHOLE thread.
|
|
@@ -615,15 +618,15 @@ export class MessageManager {
|
|
|
615
618
|
if (!sessionData)
|
|
616
619
|
continue;
|
|
617
620
|
const sessionMessages = sessionData.messages;
|
|
618
|
-
// If this is not the first session in the thread, it might have a
|
|
621
|
+
// If this is not the first session in the thread, it might have a compact block at the start
|
|
619
622
|
// that was removed in getFullMessageThread.
|
|
620
|
-
const
|
|
621
|
-
const effectiveMessages =
|
|
623
|
+
const hasCompactBlock = sessionMessages[0]?.blocks.some((b) => b.type === "compact");
|
|
624
|
+
const effectiveMessages = hasCompactBlock && sid !== sessionIds[0]
|
|
622
625
|
? sessionMessages.slice(1)
|
|
623
626
|
: sessionMessages;
|
|
624
627
|
if (remainingIndex < effectiveMessages.length) {
|
|
625
628
|
targetSessionId = sid;
|
|
626
|
-
targetIndexInSession =
|
|
629
|
+
targetIndexInSession = hasCompactBlock
|
|
627
630
|
? remainingIndex + 1
|
|
628
631
|
: remainingIndex;
|
|
629
632
|
break;
|
|
@@ -653,7 +656,7 @@ export class MessageManager {
|
|
|
653
656
|
await this.rewriteSessionFile(newMessagesInSession);
|
|
654
657
|
// Update in-memory messages to the truncated session messages
|
|
655
658
|
// We do NOT include ancestor messages here to avoid exceeding context limits.
|
|
656
|
-
// The '
|
|
659
|
+
// The 'compact' block at the start of the session (if any) already summarizes them.
|
|
657
660
|
this.setMessages(newMessagesInSession);
|
|
658
661
|
// Update saved message count
|
|
659
662
|
this.savedMessageCount = newMessagesInSession.length;
|
|
@@ -751,4 +754,46 @@ export class MessageManager {
|
|
|
751
754
|
}
|
|
752
755
|
return result;
|
|
753
756
|
}
|
|
757
|
+
/**
|
|
758
|
+
* Extract skill invocations from tool blocks in a message.
|
|
759
|
+
*/
|
|
760
|
+
extractSkillInvocationsFromMessage(message) {
|
|
761
|
+
for (const block of message.blocks) {
|
|
762
|
+
if (block.type === "tool" &&
|
|
763
|
+
block.name === "Skill" &&
|
|
764
|
+
block.stage === "end" &&
|
|
765
|
+
block.parameters) {
|
|
766
|
+
try {
|
|
767
|
+
const params = JSON.parse(block.parameters);
|
|
768
|
+
const skillName = params.skill_name;
|
|
769
|
+
if (skillName) {
|
|
770
|
+
this.invokedSkills.set(skillName, {
|
|
771
|
+
skillName,
|
|
772
|
+
timestamp: Date.now(),
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
catch {
|
|
777
|
+
// Ignore parse errors
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Get recently invoked skill names, sorted by timestamp (newest first).
|
|
784
|
+
* @param maxSkills - Maximum number of skills to return
|
|
785
|
+
* @returns Array of skill names sorted by recency
|
|
786
|
+
*/
|
|
787
|
+
getInvokedSkillNames(maxSkills = 10) {
|
|
788
|
+
const sorted = Array.from(this.invokedSkills.entries())
|
|
789
|
+
.sort(([, a], [, b]) => b.timestamp - a.timestamp)
|
|
790
|
+
.slice(0, maxSkills);
|
|
791
|
+
return sorted.map(([, { skillName }]) => skillName);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Clear all invoked skills (e.g., after compaction).
|
|
795
|
+
*/
|
|
796
|
+
clearInvokedSkills() {
|
|
797
|
+
this.invokedSkills.clear();
|
|
798
|
+
}
|
|
754
799
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../../src/managers/pluginManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../../src/managers/pluginManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAWzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAA0B;gBAGtC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,oBAAoB;IAM/B,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,mBAAmB,GAE9B;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED,OAAO,KAAK,eAAe,GAE1B;IAED;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAInE;;OAEG;YACW,oBAAoB;IA0ElC;;OAEG;YACW,gBAAgB;IAgE9B;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG5C"}
|
|
@@ -27,6 +27,9 @@ export class PluginManager {
|
|
|
27
27
|
get configurationService() {
|
|
28
28
|
return this.container.get("ConfigurationService");
|
|
29
29
|
}
|
|
30
|
+
get subagentManager() {
|
|
31
|
+
return this.container.get("SubagentManager");
|
|
32
|
+
}
|
|
30
33
|
/**
|
|
31
34
|
* Update enabled plugins configuration
|
|
32
35
|
*/
|
|
@@ -106,6 +109,7 @@ export class PluginManager {
|
|
|
106
109
|
path: absolutePath,
|
|
107
110
|
commands: PluginLoader.loadCommands(absolutePath),
|
|
108
111
|
skills: await PluginLoader.loadSkills(absolutePath),
|
|
112
|
+
agents: await PluginLoader.loadAgents(absolutePath),
|
|
109
113
|
lspConfig: await PluginLoader.loadLspConfig(absolutePath),
|
|
110
114
|
mcpConfig: await PluginLoader.loadMcpConfig(absolutePath),
|
|
111
115
|
hooksConfig: await PluginLoader.loadHooksConfig(absolutePath),
|
|
@@ -132,6 +136,9 @@ export class PluginManager {
|
|
|
132
136
|
if (this.hookManager && plugin.hooksConfig) {
|
|
133
137
|
this.hookManager.registerPluginHooks(plugin.path, plugin.hooksConfig);
|
|
134
138
|
}
|
|
139
|
+
if (this.subagentManager && plugin.agents.length > 0) {
|
|
140
|
+
this.subagentManager.registerPluginAgents(plugin.name, plugin.agents);
|
|
141
|
+
}
|
|
135
142
|
this.plugins.set(manifest.name, plugin);
|
|
136
143
|
logger?.info(`Loaded plugin: ${manifest.name} v${manifest.version}`);
|
|
137
144
|
}
|
|
@@ -77,6 +77,11 @@ export declare class SubagentManager {
|
|
|
77
77
|
* Find subagent by exact name match
|
|
78
78
|
*/
|
|
79
79
|
findSubagent(name: string): Promise<SubagentConfiguration | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Register plugin agents into the cached configurations.
|
|
82
|
+
* Names each agent as `pluginName:agentName` to avoid collisions.
|
|
83
|
+
*/
|
|
84
|
+
registerPluginAgents(pluginName: string, agents: SubagentConfiguration[]): void;
|
|
80
85
|
/**
|
|
81
86
|
* Create a new subagent instance with isolated managers
|
|
82
87
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagentManager.d.ts","sourceRoot":"","sources":["../../src/managers/subagentManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM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B,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,MAAM,CAAC;IAiFZ,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YA6C/C,eAAe;IAmJ7B;;OAEG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAIxD;;OAEG;IACH,oBAAoB,CAClB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GACjC,IAAI;IAOP;;OAEG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAOhE;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAazC;;OAEG;IACH,kBAAkB,IAAI,gBAAgB,EAAE;IAOxC;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;;OAGG;IACH,OAAO,CAAC,uBAAuB;CA+FhC"}
|
|
@@ -88,9 +88,44 @@ export class SubagentManager {
|
|
|
88
88
|
* Find subagent by exact name match
|
|
89
89
|
*/
|
|
90
90
|
async findSubagent(name) {
|
|
91
|
+
// Check cached configurations first (includes plugin agents)
|
|
92
|
+
if (this.cachedConfigurations !== null) {
|
|
93
|
+
const cached = this.cachedConfigurations.find((config) => config.name === name);
|
|
94
|
+
if (cached)
|
|
95
|
+
return cached;
|
|
96
|
+
}
|
|
97
|
+
// Fall back to filesystem scan for non-plugin agents
|
|
91
98
|
const { findSubagentByName } = await import("../utils/subagentParser.js");
|
|
92
99
|
return findSubagentByName(name, this.workdir);
|
|
93
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Register plugin agents into the cached configurations.
|
|
103
|
+
* Names each agent as `pluginName:agentName` to avoid collisions.
|
|
104
|
+
*/
|
|
105
|
+
registerPluginAgents(pluginName, agents) {
|
|
106
|
+
if (this.cachedConfigurations === null) {
|
|
107
|
+
// Should not happen if initialization order is correct
|
|
108
|
+
this.cachedConfigurations = [];
|
|
109
|
+
}
|
|
110
|
+
// Remove any previously registered agents for this plugin (by name prefix)
|
|
111
|
+
this.cachedConfigurations = this.cachedConfigurations.filter((config) => !config.name.startsWith(`${pluginName}:`));
|
|
112
|
+
for (const agent of agents) {
|
|
113
|
+
const namespacedName = `${pluginName}:${agent.name}`;
|
|
114
|
+
const namespacedAgent = {
|
|
115
|
+
...agent,
|
|
116
|
+
name: namespacedName,
|
|
117
|
+
// Safety net: substitute any remaining ${WAVE_PLUGIN_ROOT} placeholders
|
|
118
|
+
systemPrompt: agent.systemPrompt.replace(/\$\{WAVE_PLUGIN_ROOT\}/g, agent.pluginRoot ?? ""),
|
|
119
|
+
};
|
|
120
|
+
this.cachedConfigurations.push(namespacedAgent);
|
|
121
|
+
}
|
|
122
|
+
// Re-sort by priority then name
|
|
123
|
+
this.cachedConfigurations.sort((a, b) => {
|
|
124
|
+
if (a.priority !== b.priority)
|
|
125
|
+
return a.priority - b.priority;
|
|
126
|
+
return a.name.localeCompare(b.name);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
94
129
|
/**
|
|
95
130
|
* Create a new subagent instance with isolated managers
|
|
96
131
|
*/
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const OUTPUT_EFFICIENCY_PROMPT = "# Output efficiency\n\nIMPORTAN
|
|
|
12
12
|
export declare const TONE_AND_STYLE_PROMPT = "# Tone and style\n\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n- Your responses should be short and concise.\n- When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location.\n- When referencing GitHub issues or pull requests, use the owner/repo#123 format (e.g. anthropics/claude-code#100) so they render as clickable links.\n- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like \"Let me read the file:\" followed by a read tool call should just be \"Let me read the file.\" with a period.";
|
|
13
13
|
export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
|
|
14
14
|
export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const COMPACT_MESSAGES_SYSTEM_PROMPT = "You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.\n\nFirst, write your analysis in <analysis> tags as a thinking scratchpad:\n- Chronologically review the conversation\n- Identify user intents and goals\n- Note files read/modified, approaches tried, decisions made\n- Check for accuracy and completeness \u2014 ensure nothing critical is missing\n\nThen produce a structured summary in <summary> tags with these sections:\n\n## Primary Request and Intent\n- The user's core request and success criteria\n- Clarifications, constraints, or scope changes\n\n## Key Technical Concepts\n- Frameworks, libraries, patterns, architectural decisions\n\n## Files and Code Sections\n- Files read, modified, created (with full paths)\n- Critical code snippets (function signatures, bug fixes, key logic)\n- Focus on recent messages \u2014 include full code for important sections\n\n## Errors and Fixes\n- Errors encountered, root causes, how they were resolved\n- Approaches tried that didn't work and why\n\n## Problem Solving\n- Approach evolution, trade-offs considered, decisions made\n\n## All User Messages\n- Complete list of all user messages (non-tool content)\n- Preserve exact wording where load-bearing\n\n## Pending Tasks\n- Outstanding work, TODOs, unresolved questions\n\n## Current Work\n- What was being worked on at the time of summarization\n- Exact state of in-progress changes\n\n## Optional Next Step\n- Immediate next action needed\n- Include verbatim quotes from recent conversation if relevant\n\nBe concise but complete \u2014 include information that prevents duplicate work or repeated mistakes.\nRespond with text only. Do NOT call any tools.\nWrap your summary in <summary></summary> tags.";
|
|
16
16
|
export declare const WEB_CONTENT_SYSTEM_PROMPT = "You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.";
|
|
17
17
|
export declare const BTW_SYSTEM_PROMPT = "You are a helpful assistant. Answer the user's side question based on the conversation history. \nDo NOT say things like \"Let me try...\", \"I'll now...\", \"Let me check...\", or promise to take any action. \nIf you don't know the answer, say so - do not offer to look it up or investigate. \nSimply answer the question with the information you have.";
|
|
18
18
|
export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAiBzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oKAAoK,CAAC;AAEpM,eAAO,MAAM,kBAAkB,opIAcqQ,CAAC;AAErS,eAAO,MAAM,wBAAwB,25DASqmB,CAAC;AAE3oB,eAAO,MAAM,WAAW,knDAYqH,CAAC;AAE9I;;GAEG;AACH,eAAO,MAAM,wBAAwB,+uBAWiH,CAAC;AAEvJ,eAAO,MAAM,qBAAqB,6sBAMuL,CAAC;AAE1N,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,oKAAqB,CAAC;AAExD,eAAO,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAiBzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oKAAoK,CAAC;AAEpM,eAAO,MAAM,kBAAkB,opIAcqQ,CAAC;AAErS,eAAO,MAAM,wBAAwB,25DASqmB,CAAC;AAE3oB,eAAO,MAAM,WAAW,knDAYqH,CAAC;AAE9I;;GAEG;AACH,eAAO,MAAM,wBAAwB,+uBAWiH,CAAC;AAEvJ,eAAO,MAAM,qBAAqB,6sBAMuL,CAAC;AAE1N,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,oKAAqB,CAAC;AAExD,eAAO,MAAM,8BAA8B,44DA8CI,CAAC;AAEhD,eAAO,MAAM,yBAAyB,wHAAwH,CAAC;AAC/J,eAAO,MAAM,iBAAiB,qWAG4B,CAAC;AAE3D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,GACL,MAAM,CA+DR;AAED,wBAAgB,iCAAiC,CAC/C,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,CAgCR"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -148,7 +148,7 @@ This is critical - your turn should only end with either using the ${ASK_USER_QU
|
|
|
148
148
|
NOTE: At any point in time through this workflow you should feel free to ask the user questions or clarifications using the ${ASK_USER_QUESTION_TOOL_NAME} tool. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins.`;
|
|
149
149
|
}
|
|
150
150
|
export const DEFAULT_SYSTEM_PROMPT = BASE_SYSTEM_PROMPT;
|
|
151
|
-
export const
|
|
151
|
+
export const COMPACT_MESSAGES_SYSTEM_PROMPT = `You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.
|
|
152
152
|
|
|
153
153
|
First, write your analysis in <analysis> tags as a thinking scratchpad:
|
|
154
154
|
- Chronologically review the conversation
|
|
@@ -69,12 +69,6 @@ export declare class MarketplaceService {
|
|
|
69
69
|
* Saves the installed plugins registry
|
|
70
70
|
*/
|
|
71
71
|
saveInstalledPlugins(registry: InstalledPluginsRegistry): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Finds the first existing marketplace manifest path.
|
|
74
|
-
* Prefers .wave-plugin/ for backward compatibility, falls back to .claude-plugin/.
|
|
75
|
-
* Returns null if neither exists.
|
|
76
|
-
*/
|
|
77
|
-
private findMarketplaceManifestPath;
|
|
78
72
|
/**
|
|
79
73
|
* Loads a marketplace manifest from a local path
|
|
80
74
|
*/
|
|
@@ -117,11 +111,6 @@ export declare class MarketplaceService {
|
|
|
117
111
|
* Toggles auto-update for a marketplace
|
|
118
112
|
*/
|
|
119
113
|
toggleAutoUpdate(name: string, enabled: boolean): Promise<void>;
|
|
120
|
-
/**
|
|
121
|
-
* Resolves a plugin source into a consistent format for installation.
|
|
122
|
-
* Handles both string sources (local paths or git URLs) and object-style MarketplaceSource.
|
|
123
|
-
*/
|
|
124
|
-
private resolvePluginSource;
|
|
125
114
|
/**
|
|
126
115
|
* Installs a plugin from a marketplace
|
|
127
116
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarketplaceService.d.ts","sourceRoot":"","sources":["../../src/services/MarketplaceService.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MarketplaceService.d.ts","sourceRoot":"","sources":["../../src/services/MarketplaceService.ts"],"names":[],"mapp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PluginsDir } from "../utils/configPaths.js";
|
|
5
5
|
import { GitService } from "./GitService.js";
|
|
6
6
|
import { ConfigurationService } from "./configurationService.js";
|
|
7
|
+
import { logger } from "../utils/globalLogger.js";
|
|
7
8
|
/**
|
|
8
9
|
* Marketplace Service
|
|
9
10
|
*
|
|
@@ -243,29 +244,13 @@ export class MarketplaceService {
|
|
|
243
244
|
await fs.writeFile(tmpPath, JSON.stringify(registry, null, 2));
|
|
244
245
|
await fs.rename(tmpPath, this.installedPluginsPath);
|
|
245
246
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Finds the first existing marketplace manifest path.
|
|
248
|
-
* Prefers .wave-plugin/ for backward compatibility, falls back to .claude-plugin/.
|
|
249
|
-
* Returns null if neither exists.
|
|
250
|
-
*/
|
|
251
|
-
async findMarketplaceManifestPath(dir) {
|
|
252
|
-
const waveManifestPath = path.join(dir, ".wave-plugin", "marketplace.json");
|
|
253
|
-
const claudeManifestPath = path.join(dir, ".claude-plugin", "marketplace.json");
|
|
254
|
-
if (existsSync(waveManifestPath)) {
|
|
255
|
-
return waveManifestPath;
|
|
256
|
-
}
|
|
257
|
-
if (existsSync(claudeManifestPath)) {
|
|
258
|
-
return claudeManifestPath;
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
247
|
/**
|
|
263
248
|
* Loads a marketplace manifest from a local path
|
|
264
249
|
*/
|
|
265
250
|
async loadMarketplaceManifest(marketplacePath) {
|
|
266
|
-
const manifestPath =
|
|
267
|
-
if (!manifestPath) {
|
|
268
|
-
throw new Error(`Marketplace manifest not found at ${
|
|
251
|
+
const manifestPath = path.join(marketplacePath, ".wave-plugin", "marketplace.json");
|
|
252
|
+
if (!existsSync(manifestPath)) {
|
|
253
|
+
throw new Error(`Marketplace manifest not found at ${manifestPath}`);
|
|
269
254
|
}
|
|
270
255
|
const content = await fs.readFile(manifestPath, "utf-8");
|
|
271
256
|
const manifest = JSON.parse(content);
|
|
@@ -494,7 +479,7 @@ export class MarketplaceService {
|
|
|
494
479
|
for (const plugin of pluginsToUpdate) {
|
|
495
480
|
const pluginEntry = manifest.plugins.find((p) => p.name === plugin.name);
|
|
496
481
|
if (!pluginEntry) {
|
|
497
|
-
|
|
482
|
+
logger.warn(`Plugin "${plugin.name}" no longer found in marketplace "${marketplace.name}". Uninstalling...`);
|
|
498
483
|
try {
|
|
499
484
|
await this.uninstallPlugin(`${plugin.name}@${plugin.marketplace}`, plugin.projectPath);
|
|
500
485
|
}
|
|
@@ -564,59 +549,6 @@ export class MarketplaceService {
|
|
|
564
549
|
await this.updateCacheMarketplace(name, { autoUpdate: enabled });
|
|
565
550
|
});
|
|
566
551
|
}
|
|
567
|
-
/**
|
|
568
|
-
* Resolves a plugin source into a consistent format for installation.
|
|
569
|
-
* Handles both string sources (local paths or git URLs) and object-style MarketplaceSource.
|
|
570
|
-
*/
|
|
571
|
-
resolvePluginSource(pluginEntry, marketplacePath) {
|
|
572
|
-
const { source } = pluginEntry;
|
|
573
|
-
if (typeof source === "string") {
|
|
574
|
-
// String source: could be a git URL or a relative local path
|
|
575
|
-
const isGitUrl = source.startsWith("http://") ||
|
|
576
|
-
source.startsWith("https://") ||
|
|
577
|
-
source.startsWith("git@") ||
|
|
578
|
-
source.startsWith("ssh://");
|
|
579
|
-
if (isGitUrl) {
|
|
580
|
-
let url = source;
|
|
581
|
-
let ref;
|
|
582
|
-
if (url.includes("#")) {
|
|
583
|
-
[url, ref] = url.split("#");
|
|
584
|
-
}
|
|
585
|
-
return { isGit: true, url, ref, localPath: "" };
|
|
586
|
-
}
|
|
587
|
-
// Relative local path
|
|
588
|
-
return { isGit: false, localPath: path.resolve(marketplacePath, source) };
|
|
589
|
-
}
|
|
590
|
-
// Object-style source
|
|
591
|
-
if (source.source === "git") {
|
|
592
|
-
return { isGit: true, url: source.url, ref: source.ref, localPath: "" };
|
|
593
|
-
}
|
|
594
|
-
if (source.source === "github") {
|
|
595
|
-
return {
|
|
596
|
-
isGit: true,
|
|
597
|
-
url: `https://github.com/${source.repo}.git`,
|
|
598
|
-
ref: source.ref,
|
|
599
|
-
localPath: "",
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
if (source.source === "url") {
|
|
603
|
-
let url = source.url;
|
|
604
|
-
let ref = source.ref;
|
|
605
|
-
if (url.includes("#")) {
|
|
606
|
-
[url, ref] = url.split("#");
|
|
607
|
-
}
|
|
608
|
-
return { isGit: true, url, ref, localPath: "" };
|
|
609
|
-
}
|
|
610
|
-
if (source.source === "directory") {
|
|
611
|
-
return {
|
|
612
|
-
isGit: false,
|
|
613
|
-
localPath: path.resolve(marketplacePath, source.path),
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
// Exhaustiveness: this should be unreachable given the union type
|
|
617
|
-
const _exhaustive = source;
|
|
618
|
-
throw new Error(`Unsupported plugin source type: ${_exhaustive.source}`);
|
|
619
|
-
}
|
|
620
552
|
/**
|
|
621
553
|
* Installs a plugin from a marketplace
|
|
622
554
|
*/
|
|
@@ -637,36 +569,36 @@ export class MarketplaceService {
|
|
|
637
569
|
if (!pluginEntry) {
|
|
638
570
|
throw new Error(`Plugin ${pluginName} not found in marketplace ${marketplaceName}`);
|
|
639
571
|
}
|
|
640
|
-
const
|
|
572
|
+
const isGitSource = pluginEntry.source.startsWith("http://") ||
|
|
573
|
+
pluginEntry.source.startsWith("https://") ||
|
|
574
|
+
pluginEntry.source.startsWith("git@") ||
|
|
575
|
+
pluginEntry.source.startsWith("ssh://");
|
|
641
576
|
let pluginSrcPath;
|
|
642
577
|
let tempCloneDir;
|
|
643
578
|
try {
|
|
644
|
-
if (
|
|
579
|
+
if (isGitSource) {
|
|
645
580
|
tempCloneDir = path.join(this.tmpDir, `clone-${Date.now()}`);
|
|
646
|
-
|
|
581
|
+
let url = pluginEntry.source;
|
|
582
|
+
let ref;
|
|
583
|
+
if (url.includes("#")) {
|
|
584
|
+
[url, ref] = url.split("#");
|
|
585
|
+
}
|
|
586
|
+
await this.gitService.clone(url, tempCloneDir, ref);
|
|
647
587
|
pluginSrcPath = tempCloneDir;
|
|
648
588
|
}
|
|
649
589
|
else {
|
|
650
|
-
pluginSrcPath =
|
|
651
|
-
}
|
|
652
|
-
let pluginManifestPath;
|
|
653
|
-
const wavePluginPath = path.join(pluginSrcPath, ".wave-plugin", "plugin.json");
|
|
654
|
-
const claudePluginPath = path.join(pluginSrcPath, ".claude-plugin", "plugin.json");
|
|
655
|
-
if (existsSync(wavePluginPath)) {
|
|
656
|
-
pluginManifestPath = wavePluginPath;
|
|
657
|
-
}
|
|
658
|
-
else if (existsSync(claudePluginPath)) {
|
|
659
|
-
pluginManifestPath = claudePluginPath;
|
|
590
|
+
pluginSrcPath = path.resolve(marketplacePath, pluginEntry.source);
|
|
660
591
|
}
|
|
661
|
-
|
|
662
|
-
|
|
592
|
+
const pluginManifestPath = path.join(pluginSrcPath, ".wave-plugin", "plugin.json");
|
|
593
|
+
if (!existsSync(pluginManifestPath)) {
|
|
594
|
+
throw new Error(`Plugin manifest not found at ${pluginManifestPath}`);
|
|
663
595
|
}
|
|
664
596
|
const pluginManifestContent = await fs.readFile(pluginManifestPath, "utf-8");
|
|
665
597
|
const pluginManifest = JSON.parse(pluginManifestContent);
|
|
666
598
|
const version = pluginManifest.version || "1.0.0";
|
|
667
599
|
const tmpPluginDir = path.join(this.tmpDir, `${pluginName}-${Date.now()}`);
|
|
668
600
|
try {
|
|
669
|
-
if (
|
|
601
|
+
if (isGitSource) {
|
|
670
602
|
await fs.rename(pluginSrcPath, tmpPluginDir);
|
|
671
603
|
tempCloneDir = undefined;
|
|
672
604
|
}
|
|
@@ -37,14 +37,14 @@ export interface CallAgentResult {
|
|
|
37
37
|
additionalFields?: Record<string, unknown>;
|
|
38
38
|
}
|
|
39
39
|
export declare function callAgent(options: CallAgentOptions): Promise<CallAgentResult>;
|
|
40
|
-
export interface
|
|
40
|
+
export interface CompactMessagesOptions {
|
|
41
41
|
gatewayConfig: GatewayConfig;
|
|
42
42
|
modelConfig: ModelConfig;
|
|
43
43
|
messages: ChatCompletionMessageParam[];
|
|
44
44
|
abortSignal?: AbortSignal;
|
|
45
45
|
model?: string;
|
|
46
46
|
}
|
|
47
|
-
export interface
|
|
47
|
+
export interface CompactMessagesResult {
|
|
48
48
|
content: string;
|
|
49
49
|
usage?: {
|
|
50
50
|
prompt_tokens: number;
|
|
@@ -52,7 +52,7 @@ export interface CompressMessagesResult {
|
|
|
52
52
|
total_tokens: number;
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function compactMessages(options: CompactMessagesOptions): Promise<CompactMessagesResult>;
|
|
56
56
|
export interface ProcessWebContentOptions {
|
|
57
57
|
gatewayConfig: GatewayConfig;
|
|
58
58
|
modelConfig: ModelConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiService.d.ts","sourceRoot":"","sources":["../../src/services/aiService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAGL,0BAA0B,EAC1B,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAgEvC;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AA6DD,MAAM,WAAW,gBAAgB;IAE/B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IAGzB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IAC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C;IAC7B,WAAW,EAAE,WAAW,CAAC;IAGzB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAuFjE"}
|
|
@@ -5,7 +5,7 @@ import { transformMessagesForClaudeCache, addCacheControlToLastTool, supportsPro
|
|
|
5
5
|
import * as os from "os";
|
|
6
6
|
import * as fs from "fs";
|
|
7
7
|
import * as path from "path";
|
|
8
|
-
import {
|
|
8
|
+
import { COMPACT_MESSAGES_SYSTEM_PROMPT, WEB_CONTENT_SYSTEM_PROMPT, BTW_SYSTEM_PROMPT, } from "../prompts/index.js";
|
|
9
9
|
// Global rate limiter state for 1 QPS
|
|
10
10
|
let nextAllowedTime = 0;
|
|
11
11
|
const MIN_INTERVAL = 1000; // 1 second for 1 QPS
|
|
@@ -450,7 +450,7 @@ async function processStreamingResponse(stream, onContentUpdate, onToolUpdate, o
|
|
|
450
450
|
}
|
|
451
451
|
return result;
|
|
452
452
|
}
|
|
453
|
-
export async function
|
|
453
|
+
export async function compactMessages(options) {
|
|
454
454
|
const { gatewayConfig, modelConfig, messages, abortSignal } = options;
|
|
455
455
|
// Apply global 1 QPS rate limit
|
|
456
456
|
if (process.env.NODE_ENV !== "test" ||
|
|
@@ -492,7 +492,7 @@ export async function compressMessages(options) {
|
|
|
492
492
|
messages: [
|
|
493
493
|
{
|
|
494
494
|
role: "system",
|
|
495
|
-
content:
|
|
495
|
+
content: COMPACT_MESSAGES_SYSTEM_PROMPT,
|
|
496
496
|
},
|
|
497
497
|
...cleanedMessages,
|
|
498
498
|
{
|
|
@@ -505,7 +505,7 @@ export async function compressMessages(options) {
|
|
|
505
505
|
});
|
|
506
506
|
const content = response.choices[0]?.message?.content?.trim();
|
|
507
507
|
if (!content) {
|
|
508
|
-
throw new Error("Failed to
|
|
508
|
+
throw new Error("Failed to compact conversation history: Empty response from AI");
|
|
509
509
|
}
|
|
510
510
|
const usage = response.usage
|
|
511
511
|
? {
|
|
@@ -521,10 +521,10 @@ export async function compressMessages(options) {
|
|
|
521
521
|
}
|
|
522
522
|
catch (error) {
|
|
523
523
|
if (error.name === "AbortError") {
|
|
524
|
-
logger.info("
|
|
525
|
-
throw new Error("
|
|
524
|
+
logger.info("Compaction request was aborted");
|
|
525
|
+
throw new Error("Compaction request was aborted");
|
|
526
526
|
}
|
|
527
|
-
logger.error("Failed to
|
|
527
|
+
logger.error("Failed to compact messages:", error);
|
|
528
528
|
throw error;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AA2F3B;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA6I9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAMhC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD"}
|