wave-agent-sdk 0.9.0 → 0.9.1

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.
@@ -1,5 +1,7 @@
1
1
  export interface PromptEntry {
2
2
  prompt: string;
3
3
  timestamp: number;
4
+ sessionId?: string;
5
+ longTextMap?: Record<string, string>;
4
6
  }
5
7
  //# sourceMappingURL=history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/types/history.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/types/history.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"containerSetup.d.ts","sourceRoot":"","sources":["../../src/utils/containerSetup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAoB3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,IAAI,EACJ,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;I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,EAAE,cAAc,KAAK,IAAI,CAAC;IACvD,wBAAwB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACzD,iBAAiB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAClD,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,0BAA0B,GACvC,SAAS,CAiNX"}
@@ -1,4 +1,3 @@
1
- import * as fs from "fs/promises";
2
1
  import { Container } from "./container.js";
3
2
  import { ForegroundTaskManager } from "../managers/foregroundTaskManager.js";
4
3
  import { BackgroundTaskManager } from "../managers/backgroundTaskManager.js";
@@ -128,18 +127,9 @@ export function setupAgentContainer(setupOptions) {
128
127
  if (decision.clearContext) {
129
128
  messageManager.clearMessages();
130
129
  if (planFilePath) {
131
- try {
132
- const planContent = await fs.readFile(planFilePath, "utf-8");
133
- messageManager.addUserMessage({
134
- content: `Implement the following plan:\n\n${planContent}`,
135
- });
136
- }
137
- catch (error) {
138
- logger.warn("Failed to read plan file for context clearing", {
139
- planFilePath,
140
- error: error instanceof Error ? error.message : String(error),
141
- });
142
- }
130
+ messageManager.addUserMessage({
131
+ content: `Implement the plan at ${planFilePath}`,
132
+ });
143
133
  }
144
134
  }
145
135
  return decision;
@@ -3,7 +3,7 @@ export declare class PromptHistoryManager {
3
3
  /**
4
4
  * Add a new prompt to history
5
5
  */
6
- static addEntry(prompt: string): Promise<void>;
6
+ static addEntry(prompt: string, sessionId?: string, longTextMap?: Record<string, string>): Promise<void>;
7
7
  /**
8
8
  * Trim history file to MAX_HISTORY_ENTRIES
9
9
  */
@@ -11,10 +11,10 @@ export declare class PromptHistoryManager {
11
11
  /**
12
12
  * Get all history entries
13
13
  */
14
- static getHistory(): Promise<PromptEntry[]>;
14
+ static getHistory(sessionId?: string): Promise<PromptEntry[]>;
15
15
  /**
16
16
  * Search history by query
17
17
  */
18
- static searchHistory(query: string): Promise<PromptEntry[]>;
18
+ static searchHistory(query: string, sessionId?: string): Promise<PromptEntry[]>;
19
19
  }
20
20
  //# sourceMappingURL=promptHistory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptHistory.d.ts","sourceRoot":"","sources":["../../src/utils/promptHistory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiBlD,qBAAa,oBAAoB;IAC/B;;OAEG;WACU,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBpD;;OAEG;mBACkB,WAAW;IAoBhC;;OAEG;WACU,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAwCjD;;OAEG;WACU,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAgBlE"}
1
+ {"version":3,"file":"promptHistory.d.ts","sourceRoot":"","sources":["../../src/utils/promptHistory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiBlD,qBAAa,oBAAoB;IAC/B;;OAEG;WACU,QAAQ,CACnB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC;IAyBhB;;OAEG;mBACkB,WAAW;IAoBhC;;OAEG;WACU,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IA6CnE;;OAEG;WACU,aAAa,CACxB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,EAAE,CAAC;CAgB1B"}
@@ -19,7 +19,7 @@ export class PromptHistoryManager {
19
19
  /**
20
20
  * Add a new prompt to history
21
21
  */
22
- static async addEntry(prompt) {
22
+ static async addEntry(prompt, sessionId, longTextMap) {
23
23
  try {
24
24
  if (!prompt.trim())
25
25
  return;
@@ -27,6 +27,8 @@ export class PromptHistoryManager {
27
27
  const entry = {
28
28
  prompt,
29
29
  timestamp: Date.now(),
30
+ sessionId,
31
+ longTextMap,
30
32
  };
31
33
  const line = JSON.stringify(entry) + "\n";
32
34
  await fs.promises.appendFile(PROMPT_HISTORY_FILE, line, "utf-8");
@@ -61,7 +63,7 @@ export class PromptHistoryManager {
61
63
  /**
62
64
  * Get all history entries
63
65
  */
64
- static async getHistory() {
66
+ static async getHistory(sessionId) {
65
67
  try {
66
68
  if (!fs.existsSync(PROMPT_HISTORY_FILE)) {
67
69
  return [];
@@ -79,12 +81,16 @@ export class PromptHistoryManager {
79
81
  }
80
82
  })
81
83
  .filter((entry) => entry !== null);
84
+ // Filter by sessionId if provided
85
+ const filteredEntries = sessionId
86
+ ? entries.filter((entry) => entry.sessionId === sessionId)
87
+ : entries;
82
88
  // Deduplicate by prompt, keeping the most recent one
83
89
  const uniqueEntries = [];
84
90
  const seenPrompts = new Set();
85
91
  // Process from newest to oldest
86
- for (let i = entries.length - 1; i >= 0; i--) {
87
- const entry = entries[i];
92
+ for (let i = filteredEntries.length - 1; i >= 0; i--) {
93
+ const entry = filteredEntries[i];
88
94
  if (!seenPrompts.has(entry.prompt)) {
89
95
  uniqueEntries.push(entry);
90
96
  seenPrompts.add(entry.prompt);
@@ -100,9 +106,9 @@ export class PromptHistoryManager {
100
106
  /**
101
107
  * Search history by query
102
108
  */
103
- static async searchHistory(query) {
109
+ static async searchHistory(query, sessionId) {
104
110
  try {
105
- const history = await this.getHistory();
111
+ const history = await this.getHistory(sessionId);
106
112
  if (!query.trim()) {
107
113
  return history;
108
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-agent-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "SDK for building AI-powered development tools and agents",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,4 +1,6 @@
1
1
  export interface PromptEntry {
2
2
  prompt: string;
3
3
  timestamp: number;
4
+ sessionId?: string;
5
+ longTextMap?: Record<string, string>;
4
6
  }
@@ -1,4 +1,3 @@
1
- import * as fs from "fs/promises";
2
1
  import { Container } from "./container.js";
3
2
  import { ForegroundTaskManager } from "../managers/foregroundTaskManager.js";
4
3
  import { BackgroundTaskManager } from "../managers/backgroundTaskManager.js";
@@ -195,17 +194,9 @@ export function setupAgentContainer(
195
194
  if (decision.clearContext) {
196
195
  messageManager.clearMessages();
197
196
  if (planFilePath) {
198
- try {
199
- const planContent = await fs.readFile(planFilePath, "utf-8");
200
- messageManager.addUserMessage({
201
- content: `Implement the following plan:\n\n${planContent}`,
202
- });
203
- } catch (error) {
204
- logger.warn("Failed to read plan file for context clearing", {
205
- planFilePath,
206
- error: error instanceof Error ? error.message : String(error),
207
- });
208
- }
197
+ messageManager.addUserMessage({
198
+ content: `Implement the plan at ${planFilePath}`,
199
+ });
209
200
  }
210
201
  }
211
202
 
@@ -22,7 +22,11 @@ export class PromptHistoryManager {
22
22
  /**
23
23
  * Add a new prompt to history
24
24
  */
25
- static async addEntry(prompt: string): Promise<void> {
25
+ static async addEntry(
26
+ prompt: string,
27
+ sessionId?: string,
28
+ longTextMap?: Record<string, string>,
29
+ ): Promise<void> {
26
30
  try {
27
31
  if (!prompt.trim()) return;
28
32
 
@@ -30,6 +34,8 @@ export class PromptHistoryManager {
30
34
  const entry: PromptEntry = {
31
35
  prompt,
32
36
  timestamp: Date.now(),
37
+ sessionId,
38
+ longTextMap,
33
39
  };
34
40
 
35
41
  const line = JSON.stringify(entry) + "\n";
@@ -71,7 +77,7 @@ export class PromptHistoryManager {
71
77
  /**
72
78
  * Get all history entries
73
79
  */
74
- static async getHistory(): Promise<PromptEntry[]> {
80
+ static async getHistory(sessionId?: string): Promise<PromptEntry[]> {
75
81
  try {
76
82
  if (!fs.existsSync(PROMPT_HISTORY_FILE)) {
77
83
  return [];
@@ -91,13 +97,18 @@ export class PromptHistoryManager {
91
97
  })
92
98
  .filter((entry): entry is PromptEntry => entry !== null);
93
99
 
100
+ // Filter by sessionId if provided
101
+ const filteredEntries = sessionId
102
+ ? entries.filter((entry) => entry.sessionId === sessionId)
103
+ : entries;
104
+
94
105
  // Deduplicate by prompt, keeping the most recent one
95
106
  const uniqueEntries: PromptEntry[] = [];
96
107
  const seenPrompts = new Set<string>();
97
108
 
98
109
  // Process from newest to oldest
99
- for (let i = entries.length - 1; i >= 0; i--) {
100
- const entry = entries[i];
110
+ for (let i = filteredEntries.length - 1; i >= 0; i--) {
111
+ const entry = filteredEntries[i];
101
112
  if (!seenPrompts.has(entry.prompt)) {
102
113
  uniqueEntries.push(entry);
103
114
  seenPrompts.add(entry.prompt);
@@ -114,9 +125,12 @@ export class PromptHistoryManager {
114
125
  /**
115
126
  * Search history by query
116
127
  */
117
- static async searchHistory(query: string): Promise<PromptEntry[]> {
128
+ static async searchHistory(
129
+ query: string,
130
+ sessionId?: string,
131
+ ): Promise<PromptEntry[]> {
118
132
  try {
119
- const history = await this.getHistory();
133
+ const history = await this.getHistory(sessionId);
120
134
  if (!query.trim()) {
121
135
  return history;
122
136
  }