wave-agent-sdk 0.16.10 → 0.16.12
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/agent.d.ts +5 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +15 -0
- package/dist/constants/toolLimits.d.ts +2 -0
- package/dist/constants/toolLimits.d.ts.map +1 -1
- package/dist/constants/toolLimits.js +2 -0
- package/dist/managers/aiManager.d.ts +5 -0
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +21 -0
- package/dist/managers/hookManager.d.ts +6 -3
- package/dist/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +36 -13
- package/dist/managers/mcpManager.d.ts +4 -28
- package/dist/managers/mcpManager.d.ts.map +1 -1
- package/dist/managers/mcpManager.js +10 -127
- package/dist/services/authService.d.ts +33 -1
- package/dist/services/authService.d.ts.map +1 -1
- package/dist/services/authService.js +212 -11
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +4 -1
- package/dist/services/hook.d.ts +4 -0
- package/dist/services/hook.d.ts.map +1 -1
- package/dist/services/hook.js +10 -0
- package/dist/services/interactionService.d.ts.map +1 -1
- package/dist/services/interactionService.js +0 -12
- package/dist/services/remoteSettingsService.d.ts.map +1 -1
- package/dist/services/remoteSettingsService.js +3 -2
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +58 -32
- package/dist/tools/types.d.ts +4 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/types/agent.d.ts +7 -0
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/auth.d.ts +12 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +5 -1
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +1 -0
- package/dist/types/mcp.d.ts +1 -1
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/utils/containerSetup.d.ts.map +1 -1
- package/dist/utils/containerSetup.js +3 -12
- package/dist/utils/gitUtils.d.ts +18 -1
- package/dist/utils/gitUtils.d.ts.map +1 -1
- package/dist/utils/gitUtils.js +120 -49
- package/dist/utils/mcpUtils.d.ts.map +1 -1
- package/dist/utils/mcpUtils.js +6 -1
- package/dist/utils/toolResultStorage.d.ts +46 -0
- package/dist/utils/toolResultStorage.d.ts.map +1 -0
- package/dist/utils/toolResultStorage.js +90 -0
- package/dist/utils/worktreeUtils.d.ts.map +1 -1
- package/dist/utils/worktreeUtils.js +58 -0
- package/package.json +3 -3
- package/src/agent.ts +17 -0
- package/src/constants/toolLimits.ts +3 -0
- package/src/managers/aiManager.ts +37 -0
- package/src/managers/hookManager.ts +42 -17
- package/src/managers/mcpManager.ts +10 -178
- package/src/services/authService.ts +243 -16
- package/src/services/configurationService.ts +6 -1
- package/src/services/hook.ts +15 -0
- package/src/services/interactionService.ts +0 -18
- package/src/services/remoteSettingsService.ts +3 -2
- package/src/tools/bashTool.ts +70 -38
- package/src/tools/types.ts +4 -0
- package/src/types/agent.ts +7 -0
- package/src/types/auth.ts +10 -0
- package/src/types/hooks.ts +7 -1
- package/src/types/mcp.ts +1 -1
- package/src/utils/containerSetup.ts +3 -13
- package/src/utils/gitUtils.ts +123 -48
- package/src/utils/mcpUtils.ts +12 -1
- package/src/utils/toolResultStorage.ts +117 -0
- package/src/utils/worktreeUtils.ts +63 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authService.d.ts","sourceRoot":"","sources":["../../src/services/authService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"authService.d.ts","sourceRoot":"","sources":["../../src/services/authService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAQ5E,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC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AA4B,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,KAAK,GAAG,OAAO,KAAK,CA+C3E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAsC/C;AAED,4DAA4D;AAC5D,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles SSO authentication via the admin server.
|
|
5
5
|
* Manages auth token storage in ~/.wave/auth.json.
|
|
6
6
|
*/
|
|
7
|
-
import { readFileSync, writeFileSync, existsSync, chmodSync, rmSync, mkdirSync, } from "fs";
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, chmodSync, rmSync, mkdirSync, statSync, } from "fs";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
import * as os from "os";
|
|
10
10
|
import { randomBytes } from "crypto";
|
|
@@ -12,12 +12,15 @@ import { createServer } from "http";
|
|
|
12
12
|
import { URL } from "url";
|
|
13
13
|
import { execFile } from "child_process";
|
|
14
14
|
import { promisify } from "util";
|
|
15
|
+
import { logger } from "../utils/globalLogger.js";
|
|
15
16
|
/** Persistent anonymous ID for telemetry fallback when SSO is not authenticated. */
|
|
16
17
|
let _anonymousId;
|
|
17
18
|
const execFileAsync = promisify(execFile);
|
|
18
19
|
export class AuthService {
|
|
19
20
|
constructor() {
|
|
20
21
|
this.onAuthChangeCallbacks = [];
|
|
22
|
+
this._refreshPromise = null;
|
|
23
|
+
this._authFileMtime = 0;
|
|
21
24
|
}
|
|
22
25
|
static getInstance() {
|
|
23
26
|
if (!AuthService.instance) {
|
|
@@ -63,6 +66,13 @@ export class AuthService {
|
|
|
63
66
|
}
|
|
64
67
|
try {
|
|
65
68
|
const content = readFileSync(authPath, "utf-8");
|
|
69
|
+
// Best-effort mtime tracking for multi-process detection
|
|
70
|
+
try {
|
|
71
|
+
this._authFileMtime = statSync(authPath).mtimeMs;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// ignore stat errors
|
|
75
|
+
}
|
|
66
76
|
return JSON.parse(content);
|
|
67
77
|
}
|
|
68
78
|
catch {
|
|
@@ -77,10 +87,19 @@ export class AuthService {
|
|
|
77
87
|
}
|
|
78
88
|
writeFileSync(authPath, JSON.stringify(config, null, 2), "utf-8");
|
|
79
89
|
chmodSync(authPath, 0o600);
|
|
90
|
+
// Update mtime after write
|
|
91
|
+
try {
|
|
92
|
+
this._authFileMtime = statSync(authPath).mtimeMs;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// ignore stat errors
|
|
96
|
+
}
|
|
80
97
|
}
|
|
81
98
|
clearAuth() {
|
|
82
99
|
const config = this.loadAuth();
|
|
83
100
|
delete config.SSO_TOKEN;
|
|
101
|
+
delete config.SSO_REFRESH_TOKEN;
|
|
102
|
+
delete config.SSO_TOKEN_EXPIRES_AT;
|
|
84
103
|
if (Object.keys(config).length === 0) {
|
|
85
104
|
const authPath = this.getAuthPath();
|
|
86
105
|
if (existsSync(authPath)) {
|
|
@@ -111,33 +130,41 @@ export class AuthService {
|
|
|
111
130
|
readToken: options?.readToken,
|
|
112
131
|
});
|
|
113
132
|
// Exchange authorization code for JWT (includes user info)
|
|
114
|
-
const { token, user } = await this.exchangeCode(serverUrl, code);
|
|
133
|
+
const { token, refreshToken, expiresIn, user } = await this.exchangeCode(serverUrl, code);
|
|
115
134
|
// Save the token and user info (preserve existing keys)
|
|
116
135
|
const existing = this.loadAuth();
|
|
117
|
-
this.saveAuth({
|
|
136
|
+
this.saveAuth({
|
|
137
|
+
...existing,
|
|
138
|
+
SSO_TOKEN: token,
|
|
139
|
+
SSO_REFRESH_TOKEN: refreshToken,
|
|
140
|
+
SSO_TOKEN_EXPIRES_AT: expiresIn
|
|
141
|
+
? Date.now() + expiresIn * 1000
|
|
142
|
+
: undefined,
|
|
143
|
+
user,
|
|
144
|
+
});
|
|
118
145
|
this.notifyAuthChange("login");
|
|
119
146
|
return token;
|
|
120
147
|
}
|
|
121
148
|
/**
|
|
122
149
|
* Exchange a short-lived authorization code for a JWT token.
|
|
123
|
-
* Returns
|
|
150
|
+
* Returns token, optional refresh token, optional expiresIn, and user info.
|
|
124
151
|
*/
|
|
125
152
|
async exchangeCode(serverUrl, code) {
|
|
126
|
-
const exchangeUrl = `${serverUrl}/api/auth/
|
|
153
|
+
const exchangeUrl = `${serverUrl}/api/auth/token`;
|
|
154
|
+
logger.info(`[Auth] Exchanging authorization code at ${exchangeUrl}`);
|
|
127
155
|
const response = await fetch(exchangeUrl, {
|
|
128
156
|
method: "POST",
|
|
129
157
|
headers: { "Content-Type": "application/json" },
|
|
130
|
-
body: JSON.stringify({ code }),
|
|
158
|
+
body: JSON.stringify({ grant_type: "authorization_code", code }),
|
|
131
159
|
});
|
|
132
160
|
if (!response.ok) {
|
|
133
161
|
const text = await response.text();
|
|
162
|
+
logger.info(`[Auth] Authorization code exchange failed (${response.status}): ${text}`);
|
|
134
163
|
throw new Error(`Token exchange failed (${response.status}): ${text}`);
|
|
135
164
|
}
|
|
136
165
|
const data = (await response.json());
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
user: { id: data.user.id, email: data.user.email },
|
|
140
|
-
};
|
|
166
|
+
logger.info("[Auth] Authorization code exchanged successfully");
|
|
167
|
+
return data;
|
|
141
168
|
}
|
|
142
169
|
startLocalAuthServer(serverUrl, options) {
|
|
143
170
|
return new Promise((resolve, reject) => {
|
|
@@ -233,14 +260,188 @@ export class AuthService {
|
|
|
233
260
|
await execFileAsync(command, args);
|
|
234
261
|
}
|
|
235
262
|
isSSOAuthenticated() {
|
|
236
|
-
|
|
263
|
+
const config = this.loadAuth();
|
|
264
|
+
if (!config.SSO_TOKEN)
|
|
265
|
+
return false;
|
|
266
|
+
if (config.SSO_TOKEN_EXPIRES_AT &&
|
|
267
|
+
Date.now() >= config.SSO_TOKEN_EXPIRES_AT)
|
|
268
|
+
return false;
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Check if the current token is expired or within the refresh buffer.
|
|
273
|
+
* Returns false if no expiry info (backward compat — treated as never-expiring).
|
|
274
|
+
*/
|
|
275
|
+
isTokenExpired() {
|
|
276
|
+
const config = this.loadAuth();
|
|
277
|
+
if (!config.SSO_TOKEN_EXPIRES_AT)
|
|
278
|
+
return false;
|
|
279
|
+
const expiresAt = config.SSO_TOKEN_EXPIRES_AT;
|
|
280
|
+
const bufferMs = AuthService.REFRESH_BUFFER_MS;
|
|
281
|
+
const now = Date.now();
|
|
282
|
+
const remaining = expiresAt - now;
|
|
283
|
+
const expired = now >= expiresAt - bufferMs;
|
|
284
|
+
if (expired) {
|
|
285
|
+
logger.info(`[Auth] Token expired or within refresh buffer: remaining=${Math.round(remaining / 1000)}s, buffer=${bufferMs / 1000}s`);
|
|
286
|
+
}
|
|
287
|
+
return expired;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Check if the token needs refresh and refresh it if possible.
|
|
291
|
+
* Deduplicates concurrent refresh calls (401 dedup).
|
|
292
|
+
*/
|
|
293
|
+
async checkAndRefreshTokenIfNeeded() {
|
|
294
|
+
if (!this.isTokenExpired())
|
|
295
|
+
return true;
|
|
296
|
+
// Dedup: if a refresh is already in-flight, reuse the same promise
|
|
297
|
+
if (this._refreshPromise) {
|
|
298
|
+
logger.info("[Auth] Token refresh already in-flight, reusing existing promise");
|
|
299
|
+
return this._refreshPromise;
|
|
300
|
+
}
|
|
301
|
+
logger.info("[Auth] Starting token refresh");
|
|
302
|
+
this._refreshPromise = this.refreshToken();
|
|
303
|
+
try {
|
|
304
|
+
return await this._refreshPromise;
|
|
305
|
+
}
|
|
306
|
+
finally {
|
|
307
|
+
this._refreshPromise = null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Refresh the access token using the stored refresh token.
|
|
312
|
+
* Returns true on success, false on failure.
|
|
313
|
+
*/
|
|
314
|
+
async refreshToken() {
|
|
315
|
+
const config = this.loadAuth();
|
|
316
|
+
if (!config.SSO_REFRESH_TOKEN) {
|
|
317
|
+
logger.info("[Auth] No refresh token available, cannot refresh");
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
const serverUrl = this.getServerUrl();
|
|
321
|
+
try {
|
|
322
|
+
logger.info(`[Auth] Refreshing token via ${serverUrl}/api/auth/token`);
|
|
323
|
+
const response = await fetch(`${serverUrl}/api/auth/token`, {
|
|
324
|
+
method: "POST",
|
|
325
|
+
headers: { "Content-Type": "application/json" },
|
|
326
|
+
body: JSON.stringify({
|
|
327
|
+
grant_type: "refresh_token",
|
|
328
|
+
refresh_token: config.SSO_REFRESH_TOKEN,
|
|
329
|
+
}),
|
|
330
|
+
});
|
|
331
|
+
if (response.status === 400 || response.status === 401) {
|
|
332
|
+
// Refresh token revoked — clear auth
|
|
333
|
+
logger.info(`[Auth] Refresh token rejected (${response.status}), clearing auth`);
|
|
334
|
+
this.clearAuth();
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
if (!response.ok) {
|
|
338
|
+
logger.info(`[Auth] Token refresh failed with status ${response.status}`);
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
const data = (await response.json());
|
|
342
|
+
const newExpiresAt = data.expiresIn
|
|
343
|
+
? Date.now() + data.expiresIn * 1000
|
|
344
|
+
: undefined;
|
|
345
|
+
this.saveAuth({
|
|
346
|
+
...config,
|
|
347
|
+
SSO_TOKEN: data.token,
|
|
348
|
+
SSO_REFRESH_TOKEN: data.refreshToken ?? config.SSO_REFRESH_TOKEN,
|
|
349
|
+
SSO_TOKEN_EXPIRES_AT: newExpiresAt,
|
|
350
|
+
user: data.user
|
|
351
|
+
? { id: data.user.id, email: data.user.email }
|
|
352
|
+
: config.user,
|
|
353
|
+
});
|
|
354
|
+
logger.info(`[Auth] Token refreshed successfully, new token expires at ${newExpiresAt ? new Date(newExpiresAt).toISOString() : "never"}`);
|
|
355
|
+
this.notifyAuthChange("login");
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
catch (err) {
|
|
359
|
+
// Network error — don't clear auth (might be transient)
|
|
360
|
+
logger.info(`[Auth] Token refresh failed with network error: ${err}`);
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Check if another process has refreshed the token on disk.
|
|
366
|
+
* Returns true if a fresh token was found and loaded.
|
|
367
|
+
*/
|
|
368
|
+
/** @internal Check if another process has refreshed the token on disk */
|
|
369
|
+
tryReadRefreshedTokenFromDisk() {
|
|
370
|
+
try {
|
|
371
|
+
const authPath = this.getAuthPath();
|
|
372
|
+
if (!existsSync(authPath))
|
|
373
|
+
return false;
|
|
374
|
+
const stat = statSync(authPath);
|
|
375
|
+
if (stat.mtimeMs <= this._authFileMtime)
|
|
376
|
+
return false;
|
|
377
|
+
// File was modified by another process — check if token is fresh
|
|
378
|
+
const config = this.loadAuth();
|
|
379
|
+
if (config.SSO_TOKEN_EXPIRES_AT &&
|
|
380
|
+
Date.now() < config.SSO_TOKEN_EXPIRES_AT) {
|
|
381
|
+
logger.info(`[Auth] Detected token refreshed by another process (auth.json mtime changed)`);
|
|
382
|
+
this._authFileMtime = stat.mtimeMs;
|
|
383
|
+
return true;
|
|
384
|
+
}
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
237
390
|
}
|
|
238
391
|
getAuthUser() {
|
|
239
392
|
const config = this.loadAuth();
|
|
240
393
|
return config.user;
|
|
241
394
|
}
|
|
242
395
|
}
|
|
396
|
+
AuthService.REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
243
397
|
export const authService = AuthService.getInstance();
|
|
398
|
+
/**
|
|
399
|
+
* Create a fetch wrapper that handles SSO token refresh transparently.
|
|
400
|
+
*
|
|
401
|
+
* 1. Proactive refresh: calls checkAndRefreshTokenIfNeeded() before each request
|
|
402
|
+
* 2. Updates Authorization header with fresh token
|
|
403
|
+
* 3. Reactive 401/403 recovery: tries disk refresh then force refresh, retries once
|
|
404
|
+
*/
|
|
405
|
+
export function createAuthAwareFetch(innerFetch) {
|
|
406
|
+
return async (input, init) => {
|
|
407
|
+
// Proactive refresh
|
|
408
|
+
await authService.checkAndRefreshTokenIfNeeded();
|
|
409
|
+
// Update Authorization header with fresh token
|
|
410
|
+
const freshToken = authService.getSSOToken();
|
|
411
|
+
const headers = new Headers(init?.headers);
|
|
412
|
+
if (freshToken) {
|
|
413
|
+
headers.set("Authorization", `Bearer ${freshToken}`);
|
|
414
|
+
}
|
|
415
|
+
const modifiedInit = { ...init, headers };
|
|
416
|
+
const response = await innerFetch(input, modifiedInit);
|
|
417
|
+
// Reactive 401/403 recovery (single retry)
|
|
418
|
+
if (response.status === 401 || response.status === 403) {
|
|
419
|
+
logger.info(`[Auth] Received ${response.status}, attempting token recovery`);
|
|
420
|
+
// Try disk refresh first (another process may have refreshed)
|
|
421
|
+
if (authService.tryReadRefreshedTokenFromDisk()) {
|
|
422
|
+
const retryToken = authService.getSSOToken();
|
|
423
|
+
const retryHeaders = new Headers(init?.headers);
|
|
424
|
+
if (retryToken) {
|
|
425
|
+
retryHeaders.set("Authorization", `Bearer ${retryToken}`);
|
|
426
|
+
}
|
|
427
|
+
logger.info("[Auth] Retrying request with disk-refreshed token");
|
|
428
|
+
return innerFetch(input, { ...init, headers: retryHeaders });
|
|
429
|
+
}
|
|
430
|
+
// Try force refresh
|
|
431
|
+
if (await authService.checkAndRefreshTokenIfNeeded()) {
|
|
432
|
+
const retryToken = authService.getSSOToken();
|
|
433
|
+
if (retryToken) {
|
|
434
|
+
const retryHeaders = new Headers(init?.headers);
|
|
435
|
+
retryHeaders.set("Authorization", `Bearer ${retryToken}`);
|
|
436
|
+
logger.info("[Auth] Retrying request with force-refreshed token");
|
|
437
|
+
return innerFetch(input, { ...init, headers: retryHeaders });
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
logger.info("[Auth] Token recovery failed, returning original response");
|
|
441
|
+
}
|
|
442
|
+
return response;
|
|
443
|
+
};
|
|
444
|
+
}
|
|
244
445
|
/**
|
|
245
446
|
* Get or create a persistent anonymous ID for telemetry.
|
|
246
447
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAQvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,kBAAkB,CAAqB;IAE/C;;OAEG;IACH,UAA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M,GAAG,iBAAiB,GAAG,IAAI;CAGnE;AAKD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,2BAA2B,CAsD7B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA+B1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CA0K1B"}
|
|
@@ -15,6 +15,7 @@ import { ConfigurationError, CONFIG_ERRORS, } from "../types/index.js";
|
|
|
15
15
|
import { DEFAULT_WAVE_MAX_INPUT_TOKENS, DEFAULT_WAVE_MAX_OUTPUT_TOKENS, } from "../utils/constants.js";
|
|
16
16
|
import { parseCustomHeaders } from "../utils/stringUtils.js";
|
|
17
17
|
import { getRemoteSettingsSync, mergeRemoteSettings, } from "./remoteSettingsService.js";
|
|
18
|
+
import { createAuthAwareFetch } from "./authService.js";
|
|
18
19
|
/**
|
|
19
20
|
* Default ConfigurationService implementation
|
|
20
21
|
*
|
|
@@ -327,6 +328,8 @@ export class ConfigurationService {
|
|
|
327
328
|
const ssoToken = this.readSSOToken();
|
|
328
329
|
const serverUrl = this.options.serverUrl || process.env.WAVE_SERVER_URL;
|
|
329
330
|
if (ssoToken && serverUrl) {
|
|
331
|
+
const baseFetch = fetch ?? this.options.fetch ?? globalThis.fetch;
|
|
332
|
+
const authAwareFetch = createAuthAwareFetch(baseFetch);
|
|
330
333
|
return {
|
|
331
334
|
apiKey: ssoToken,
|
|
332
335
|
baseURL: `${serverUrl}/api/v1`,
|
|
@@ -334,7 +337,7 @@ export class ConfigurationService {
|
|
|
334
337
|
? defaultHeaders
|
|
335
338
|
: undefined,
|
|
336
339
|
fetchOptions: fetchOptions ?? this.options.fetchOptions,
|
|
337
|
-
fetch:
|
|
340
|
+
fetch: authAwareFetch,
|
|
338
341
|
};
|
|
339
342
|
}
|
|
340
343
|
// Resolve API key: override > options > env (settings.json) > process.env
|
package/dist/services/hook.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export declare function executeCommand(command: string, context: HookExecutionCo
|
|
|
14
14
|
* Execute multiple commands in sequence
|
|
15
15
|
*/
|
|
16
16
|
export declare function executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Execute a CwdChanged hook
|
|
19
|
+
*/
|
|
20
|
+
export declare function executeCwdChangedHooks(oldCwd: string, newCwd: string, context: ExtendedHookExecutionContext): Promise<HookExecutionResult[]>;
|
|
17
21
|
/**
|
|
18
22
|
* Validate command safety (basic checks)
|
|
19
23
|
*/
|
|
@@ -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;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,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD"}
|
|
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"}
|
package/dist/services/hook.js
CHANGED
|
@@ -223,6 +223,16 @@ export async function executeCommands(commands, context, options) {
|
|
|
223
223
|
}
|
|
224
224
|
return results;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Execute a CwdChanged hook
|
|
228
|
+
*/
|
|
229
|
+
export async function executeCwdChangedHooks(oldCwd, newCwd, context) {
|
|
230
|
+
// CwdChanged hooks are executed through HookManager.executeCwdChangedHooks()
|
|
231
|
+
void context;
|
|
232
|
+
void oldCwd;
|
|
233
|
+
void newCwd;
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
226
236
|
/**
|
|
227
237
|
* Validate command safety (basic checks)
|
|
228
238
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionService.d.ts","sourceRoot":"","sources":["../../src/services/interactionService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactionService.d.ts","sourceRoot":"","sources":["../../src/services/interactionService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,qBAAa,kBAAkB;WACT,WAAW,CAC7B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC;WA6FI,cAAc,CAChC,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;CAiDjB"}
|
|
@@ -21,18 +21,6 @@ export class InteractionService {
|
|
|
21
21
|
// If command doesn't exist, continue as normal message processing
|
|
22
22
|
// Don't add to history, let normal message processing logic below handle it
|
|
23
23
|
}
|
|
24
|
-
// Inject pending notifications from background tasks
|
|
25
|
-
const notificationQueue = context.aiManager["container"].has("NotificationQueue")
|
|
26
|
-
? context.aiManager["container"].get("NotificationQueue")
|
|
27
|
-
: undefined;
|
|
28
|
-
if (notificationQueue && notificationQueue.hasPending()) {
|
|
29
|
-
const notifications = notificationQueue.dequeueAll();
|
|
30
|
-
for (const notification of notifications) {
|
|
31
|
-
messageManager.addUserMessage({
|
|
32
|
-
content: notification,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
24
|
// Handle normal AI message
|
|
37
25
|
// Add user message first, will automatically sync to UI
|
|
38
26
|
messageManager.addUserMessage({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteSettingsService.d.ts","sourceRoot":"","sources":["../../src/services/remoteSettingsService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"remoteSettingsService.d.ts","sourceRoot":"","sources":["../../src/services/remoteSettingsService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AA2JnE,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAEhE;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAKlE;AAED,wBAAgB,KAAK,IAAI,IAAI,CAO5B;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAK/B;AAqCD,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CA4DnB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { authService } from "./authService.js";
|
|
4
|
+
import { authService, createAuthAwareFetch } from "./authService.js";
|
|
5
5
|
import { logger } from "../utils/globalLogger.js";
|
|
6
6
|
const CACHE_FILE = path.join(homedir(), ".wave", "remote-settings.json");
|
|
7
7
|
const POLLING_INTERVAL_MS = 60 * 60 * 1000; // 60 minutes
|
|
@@ -71,7 +71,8 @@ async function fetchRemoteSettings() {
|
|
|
71
71
|
headers["If-None-Match"] = _cachedSettings.checksum;
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
|
-
const
|
|
74
|
+
const authFetch = createAuthAwareFetch(globalThis.fetch);
|
|
75
|
+
const response = await authFetch(`${serverUrl}/api/wave/settings`, {
|
|
75
76
|
method: "GET",
|
|
76
77
|
headers,
|
|
77
78
|
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAYtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA4etB,CAAC"}
|
package/dist/tools/bashTool.js
CHANGED
|
@@ -4,30 +4,10 @@ import * as path from "path";
|
|
|
4
4
|
import * as os from "os";
|
|
5
5
|
import { logger } from "../utils/globalLogger.js";
|
|
6
6
|
import { stripAnsiColors } from "../utils/stringUtils.js";
|
|
7
|
+
import { processToolResult } from "../utils/toolResultStorage.js";
|
|
8
|
+
import { BASH_MAX_OUTPUT_CHARS } from "../constants/toolLimits.js";
|
|
7
9
|
import { BASH_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, } from "../constants/tools.js";
|
|
8
|
-
const MAX_OUTPUT_LENGTH = 30000;
|
|
9
10
|
const BASH_DEFAULT_TIMEOUT_MS = 120000;
|
|
10
|
-
/**
|
|
11
|
-
* Helper function to handle large output by truncation and persistence to a temporary file.
|
|
12
|
-
*/
|
|
13
|
-
function processOutput(output) {
|
|
14
|
-
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
15
|
-
return output;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const tempDir = os.tmpdir();
|
|
19
|
-
const fileName = `bash_output_${Date.now()}_${Math.random().toString(36).substring(2, 11)}.txt`;
|
|
20
|
-
const filePath = path.join(tempDir, fileName);
|
|
21
|
-
fs.writeFileSync(filePath, output, "utf8");
|
|
22
|
-
return (output.substring(0, MAX_OUTPUT_LENGTH) +
|
|
23
|
-
`\n\n... (output truncated)\nFull output persisted to: ${filePath}`);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
logger.error("Failed to persist large bash output:", error);
|
|
27
|
-
return (output.substring(0, MAX_OUTPUT_LENGTH) +
|
|
28
|
-
"\n\n... (output truncated, failed to persist full output)");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
11
|
/**
|
|
32
12
|
* Bash command execution tool - supports both foreground and background execution
|
|
33
13
|
*/
|
|
@@ -87,7 +67,7 @@ Usage notes:
|
|
|
87
67
|
- The command argument is required.
|
|
88
68
|
- You can specify an optional timeout in milliseconds (up to ${BASH_DEFAULT_TIMEOUT_MS}ms / ${BASH_DEFAULT_TIMEOUT_MS / 60000} minutes). If not specified, commands will timeout after ${BASH_DEFAULT_TIMEOUT_MS}ms (${BASH_DEFAULT_TIMEOUT_MS / 60000} minutes).
|
|
89
69
|
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
|
|
90
|
-
- If the output exceeds ${
|
|
70
|
+
- If the output exceeds ${BASH_MAX_OUTPUT_CHARS.toLocaleString()} characters, output will be truncated and the full output will be persisted to a file you can read with the Read tool.
|
|
91
71
|
- You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${READ_TOOL_NAME} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
|
|
92
72
|
- Avoid using ${BASH_TOOL_NAME} with the \`find\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
|
|
93
73
|
- File search: Use ${GLOB_TOOL_NAME} (NOT find or ls)
|
|
@@ -122,7 +102,10 @@ Use the gh command via the Bash tool for GitHub-related tasks including working
|
|
|
122
102
|
- Do not retry failing commands in a sleep loop — diagnose the root cause.
|
|
123
103
|
- If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll.
|
|
124
104
|
- If you must poll an external process, use a check command (e.g. \`gh run view\`) rather than sleeping first.
|
|
125
|
-
- If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user
|
|
105
|
+
- If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.
|
|
106
|
+
|
|
107
|
+
# CWD management
|
|
108
|
+
The working directory persists between commands. Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of \`cd\`. You may use \`cd\` if the User explicitly requests it.`,
|
|
126
109
|
execute: async (args, context) => {
|
|
127
110
|
const command = args.command;
|
|
128
111
|
const runInBackground = args.run_in_background;
|
|
@@ -201,7 +184,10 @@ Use the gh command via the Bash tool for GitHub-related tasks including working
|
|
|
201
184
|
}
|
|
202
185
|
// Foreground execution (original behavior)
|
|
203
186
|
return new Promise((resolve) => {
|
|
204
|
-
|
|
187
|
+
// Create a temporary file to store the CWD
|
|
188
|
+
const tempCwdFile = path.join(os.tmpdir(), `wave_cwd_${Date.now()}_${Math.random().toString(36).substring(2, 11)}.tmp`);
|
|
189
|
+
const wrappedCommand = `${command} && pwd -P >| ${tempCwdFile}`;
|
|
190
|
+
const child = spawn(wrappedCommand, {
|
|
205
191
|
shell: true,
|
|
206
192
|
stdio: "pipe",
|
|
207
193
|
detached: true,
|
|
@@ -228,11 +214,11 @@ Use the gh command via the Bash tool for GitHub-related tasks including working
|
|
|
228
214
|
: `... +${lines.length - 3} lines\n` + lines.slice(-3).join("\n");
|
|
229
215
|
context.onShortResultUpdate(shortResult);
|
|
230
216
|
}
|
|
231
|
-
// Update full result
|
|
217
|
+
// Update full result (simple truncation for streaming — persistence happens at final result)
|
|
232
218
|
if (context.onResultUpdate) {
|
|
233
|
-
const content = combinedOutput.length <=
|
|
219
|
+
const content = combinedOutput.length <= BASH_MAX_OUTPUT_CHARS
|
|
234
220
|
? combinedOutput
|
|
235
|
-
: combinedOutput.substring(0,
|
|
221
|
+
: combinedOutput.substring(0, BASH_MAX_OUTPUT_CHARS) +
|
|
236
222
|
"\n\n... (output truncated)";
|
|
237
223
|
context.onResultUpdate(content);
|
|
238
224
|
}
|
|
@@ -313,7 +299,7 @@ Use the gh command via the Bash tool for GitHub-related tasks including working
|
|
|
313
299
|
}
|
|
314
300
|
}
|
|
315
301
|
}
|
|
316
|
-
const processedOutput =
|
|
302
|
+
const processedOutput = processToolResult(outputBuffer + (errorBuffer ? "\n" + errorBuffer : ""), BASH_MAX_OUTPUT_CHARS, "bash");
|
|
317
303
|
resolve({
|
|
318
304
|
success: false,
|
|
319
305
|
content: processedOutput
|
|
@@ -357,11 +343,51 @@ Use the gh command via the Bash tool for GitHub-related tasks including working
|
|
|
357
343
|
if (timeoutHandle) {
|
|
358
344
|
clearTimeout(timeoutHandle);
|
|
359
345
|
}
|
|
346
|
+
// Read the new CWD from the temporary file
|
|
347
|
+
let newCwd;
|
|
348
|
+
try {
|
|
349
|
+
if (fs.existsSync(tempCwdFile)) {
|
|
350
|
+
newCwd = fs.readFileSync(tempCwdFile, "utf8").trim();
|
|
351
|
+
// Validate the path exists before calling the callback
|
|
352
|
+
fs.accessSync(newCwd, fs.constants.F_OK);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch (fileError) {
|
|
356
|
+
logger.warn(`Could not read or validate new CWD from temp file ${tempCwdFile}:`, fileError);
|
|
357
|
+
newCwd = undefined;
|
|
358
|
+
}
|
|
359
|
+
finally {
|
|
360
|
+
// Ensure temp file is cleaned up even if reading fails
|
|
361
|
+
try {
|
|
362
|
+
if (fs.existsSync(tempCwdFile)) {
|
|
363
|
+
fs.unlinkSync(tempCwdFile);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
catch (fileError) {
|
|
367
|
+
logger.error("Failed to clean up temp CWD file:", fileError);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// If CWD changed, call the onCwdChange callback and add notification
|
|
371
|
+
let cwdResetMessage;
|
|
372
|
+
if (newCwd && newCwd !== context.workdir && context.onCwdChange) {
|
|
373
|
+
const isInSafeZone = context.permissionManager?.isPathInSafeZone?.(newCwd) ?? true;
|
|
374
|
+
if (isInSafeZone) {
|
|
375
|
+
context.onCwdChange(newCwd);
|
|
376
|
+
}
|
|
377
|
+
else if (context.originalWorkdir) {
|
|
378
|
+
context.onCwdChange(context.originalWorkdir);
|
|
379
|
+
cwdResetMessage = `Shell cwd was reset to ${context.originalWorkdir}`;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
context.onCwdChange(newCwd);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
360
385
|
const exitCode = code ?? 0;
|
|
361
386
|
const combinedOutput = outputBuffer + (errorBuffer ? "\n" + errorBuffer : "");
|
|
362
|
-
//
|
|
363
|
-
const finalOutput =
|
|
364
|
-
|
|
387
|
+
// Prepend CWD reset message to output if present (like Claude Code's stderr approach)
|
|
388
|
+
const finalOutput = (cwdResetMessage ? cwdResetMessage + "\n" : "") +
|
|
389
|
+
(combinedOutput || `Command executed with exit code: ${exitCode}`);
|
|
390
|
+
const content = processToolResult(finalOutput, BASH_MAX_OUTPUT_CHARS, "bash");
|
|
365
391
|
const lines = combinedOutput.trim().split("\n");
|
|
366
392
|
const shortResult = lines.length <= 3
|
|
367
393
|
? lines.join("\n")
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -90,5 +90,9 @@ export interface ToolContext {
|
|
|
90
90
|
}>;
|
|
91
91
|
/** Hook manager instance for executing hooks */
|
|
92
92
|
hookManager?: import("../managers/hookManager.js").HookManager;
|
|
93
|
+
/** Callback to notify when the current working directory changes */
|
|
94
|
+
onCwdChange?: (newCwd: string) => void;
|
|
95
|
+
/** Original working directory (before any cd changes) for CWD reset */
|
|
96
|
+
originalWorkdir?: string;
|
|
93
97
|
}
|
|
94
98
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;QACf,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC7C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,KAAK,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,eAAe,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,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,yCAAyC;IACzC,iBAAiB,CAAC,EAAE;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,mEAAmE;IACnE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,4BAA4B,EAAE,WAAW,CAAC;IAC/D,oEAAoE;IACpE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { MessageManagerCallbacks } from "../managers/messageManager.js";
|
|
|
5
5
|
import type { BackgroundTaskManagerCallbacks } from "../managers/backgroundTaskManager.js";
|
|
6
6
|
import type { McpManagerCallbacks } from "../managers/mcpManager.js";
|
|
7
7
|
import type { SubagentManagerCallbacks } from "../managers/subagentManager.js";
|
|
8
|
+
import type { PartialHookConfiguration } from "./configuration.js";
|
|
8
9
|
import type { ToolPlugin } from "../tools/types.js";
|
|
9
10
|
/**
|
|
10
11
|
* Configuration options for Agent instances
|
|
@@ -76,6 +77,11 @@ export interface AgentOptions {
|
|
|
76
77
|
mcpServers?: Record<string, McpServerConfig>;
|
|
77
78
|
/** Custom tools provided by the SDK user, registered alongside built-in tools */
|
|
78
79
|
customTools?: ToolPlugin[];
|
|
80
|
+
/**
|
|
81
|
+
* Optional hook configuration to inject at creation time.
|
|
82
|
+
* File-based hooks (from config.json/.waverc.json) merge on top of these.
|
|
83
|
+
*/
|
|
84
|
+
hooks?: PartialHookConfiguration;
|
|
79
85
|
[key: string]: unknown;
|
|
80
86
|
}
|
|
81
87
|
export interface AgentCallbacks extends MessageManagerCallbacks, BackgroundTaskManagerCallbacks, McpManagerCallbacks, SubagentManagerCallbacks {
|
|
@@ -88,6 +94,7 @@ export interface AgentCallbacks extends MessageManagerCallbacks, BackgroundTaskM
|
|
|
88
94
|
onConfiguredModelsChange?: (models: string[]) => void;
|
|
89
95
|
onLoadingChange?: (loading: boolean) => void;
|
|
90
96
|
onCommandRunningChange?: (running: boolean) => void;
|
|
97
|
+
onWorkdirChange?: (newCwd: string) => void;
|
|
91
98
|
onQueuedMessagesChange?: (messages: QueuedMessage[]) => void;
|
|
92
99
|
}
|
|
93
100
|
//# sourceMappingURL=agent.d.ts.map
|