ather-code 0.34.7 → 0.35.0
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/cli.mjs +271 -232
- package/dist/sdk.mjs +961 -572
- package/package.json +2 -2
package/dist/sdk.mjs
CHANGED
|
@@ -10126,7 +10126,7 @@ var init_version = __esm(() => {
|
|
|
10126
10126
|
import_semver = __toESM(require_semver2(), 1);
|
|
10127
10127
|
fallbackBuildVersion = (() => {
|
|
10128
10128
|
try {
|
|
10129
|
-
return "0.
|
|
10129
|
+
return "0.35.0";
|
|
10130
10130
|
} catch {
|
|
10131
10131
|
return "0.0.0";
|
|
10132
10132
|
}
|
|
@@ -71402,7 +71402,7 @@ function getAttributionHeader(fingerprint, policy) {
|
|
|
71402
71402
|
if (!policy.generate) {
|
|
71403
71403
|
return "";
|
|
71404
71404
|
}
|
|
71405
|
-
const version2 = `${"0.
|
|
71405
|
+
const version2 = `${"0.35.0"}.${fingerprint}`;
|
|
71406
71406
|
const entrypoint = process.env.ATHER_CODE_ENTRYPOINT ?? "unknown";
|
|
71407
71407
|
const cch = "";
|
|
71408
71408
|
const workload = getWorkload();
|
|
@@ -104419,7 +104419,7 @@ var init_metadata = __esm(() => {
|
|
|
104419
104419
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
104420
104420
|
WHITESPACE_REGEX = /\s+/;
|
|
104421
104421
|
getVersionBase = memoize_default(() => {
|
|
104422
|
-
const match = "0.
|
|
104422
|
+
const match = "0.35.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
104423
104423
|
return match ? match[0] : undefined;
|
|
104424
104424
|
});
|
|
104425
104425
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -104459,9 +104459,9 @@ var init_metadata = __esm(() => {
|
|
|
104459
104459
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
104460
104460
|
isAtherCodeAction: isEnvTruthy(process.env.ATHER_CODE_ACTION),
|
|
104461
104461
|
isAtherCodeAiAuth: isAtherSubscriber(),
|
|
104462
|
-
version: "0.
|
|
104462
|
+
version: "0.35.0",
|
|
104463
104463
|
versionBase: getVersionBase(),
|
|
104464
|
-
buildTime: "2026-10-
|
|
104464
|
+
buildTime: "2026-10-21T06:43:04.174Z",
|
|
104465
104465
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
104466
104466
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
104467
104467
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -112676,7 +112676,7 @@ var init_effort = __esm(() => {
|
|
|
112676
112676
|
// src/utils/userAgent.ts
|
|
112677
112677
|
function getAtherCodeUserAgent() {
|
|
112678
112678
|
try {
|
|
112679
|
-
return `ather-code/${"0.
|
|
112679
|
+
return `ather-code/${"0.35.0"}`;
|
|
112680
112680
|
} catch {
|
|
112681
112681
|
return "ather-code/0.0.0";
|
|
112682
112682
|
}
|
|
@@ -112688,7 +112688,7 @@ function getUserAgent() {
|
|
|
112688
112688
|
const clientApp = process.env.ATHER_CODE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.ATHER_CODE_AGENT_SDK_CLIENT_APP}` : "";
|
|
112689
112689
|
const workload = getWorkload();
|
|
112690
112690
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
112691
|
-
return `ather-code/${"0.
|
|
112691
|
+
return `ather-code/${"0.35.0"} (${"external"}, ${process.env.ATHER_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
112692
112692
|
}
|
|
112693
112693
|
function getMCPUserAgent() {
|
|
112694
112694
|
const parts = [];
|
|
@@ -112702,7 +112702,7 @@ function getMCPUserAgent() {
|
|
|
112702
112702
|
parts.push(`client-app/${process.env.ATHER_CODE_AGENT_SDK_CLIENT_APP}`);
|
|
112703
112703
|
}
|
|
112704
112704
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
112705
|
-
return `ather-code/${"0.
|
|
112705
|
+
return `ather-code/${"0.35.0"}${suffix}`;
|
|
112706
112706
|
}
|
|
112707
112707
|
function getWebFetchUserAgent() {
|
|
112708
112708
|
const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/Atharva/ather-code";
|
|
@@ -150069,7 +150069,7 @@ function computeFingerprint(messageText2, version2) {
|
|
|
150069
150069
|
}
|
|
150070
150070
|
function computeFingerprintFromMessages(messages) {
|
|
150071
150071
|
const firstMessageText = extractFirstMessageText(messages);
|
|
150072
|
-
return computeFingerprint(firstMessageText, "0.
|
|
150072
|
+
return computeFingerprint(firstMessageText, "0.35.0");
|
|
150073
150073
|
}
|
|
150074
150074
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
150075
150075
|
var init_fingerprint = () => {};
|
|
@@ -150111,7 +150111,7 @@ async function sideQuery(opts) {
|
|
|
150111
150111
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
150112
150112
|
}
|
|
150113
150113
|
const messageText2 = extractFirstUserMessageText(messages);
|
|
150114
|
-
const fingerprint = computeFingerprint(messageText2, "0.
|
|
150114
|
+
const fingerprint = computeFingerprint(messageText2, "0.35.0");
|
|
150115
150115
|
const attributionPolicy = resolveCurrentAnthropicAttributionPolicy({
|
|
150116
150116
|
attributionEnabled: isAttributionHeaderEnabled()
|
|
150117
150117
|
});
|
|
@@ -150177,7 +150177,7 @@ var init_sideQuery = __esm(() => {
|
|
|
150177
150177
|
init_system();
|
|
150178
150178
|
init_ather_code3();
|
|
150179
150179
|
init_authRouting();
|
|
150180
|
-
|
|
150180
|
+
init_client5();
|
|
150181
150181
|
init_betas2();
|
|
150182
150182
|
init_fingerprint();
|
|
150183
150183
|
init_model();
|
|
@@ -151408,7 +151408,7 @@ var init_client2 = __esm(() => {
|
|
|
151408
151408
|
const client = new Client({
|
|
151409
151409
|
name: "ather-code-code",
|
|
151410
151410
|
title: "Ather Code",
|
|
151411
|
-
version: "0.
|
|
151411
|
+
version: "0.35.0",
|
|
151412
151412
|
description: "Ather Code — a terminal coding agent that works with any model provider",
|
|
151413
151413
|
websiteUrl: PRODUCT_URL
|
|
151414
151414
|
}, {
|
|
@@ -183169,9 +183169,396 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
183169
183169
|
});
|
|
183170
183170
|
});
|
|
183171
183171
|
|
|
183172
|
+
// src/services/instagram/authStore.ts
|
|
183173
|
+
import { chmod as chmod4, mkdir as mkdir17, readFile as readFile18, rename as rename4, writeFile as writeFile14 } from "node:fs/promises";
|
|
183174
|
+
import { dirname as dirname41, join as join73 } from "node:path";
|
|
183175
|
+
function getInstagramAuthPath() {
|
|
183176
|
+
return join73(getAtherCodeConfigHomeDir(), AUTH_FILE);
|
|
183177
|
+
}
|
|
183178
|
+
function isValidSessionId(value) {
|
|
183179
|
+
return value.length >= 10 && value.length <= 512 && !/[\s;]/.test(value) && /^[A-Za-z0-9%:_\-=.]+$/.test(value);
|
|
183180
|
+
}
|
|
183181
|
+
async function loadInstagramAuth() {
|
|
183182
|
+
try {
|
|
183183
|
+
const parsed = JSON.parse(await readFile18(getInstagramAuthPath(), "utf8"));
|
|
183184
|
+
if (!parsed || typeof parsed !== "object")
|
|
183185
|
+
return null;
|
|
183186
|
+
const auth = parsed;
|
|
183187
|
+
if (typeof auth.sessionid !== "string" || !isValidSessionId(auth.sessionid)) {
|
|
183188
|
+
return null;
|
|
183189
|
+
}
|
|
183190
|
+
return {
|
|
183191
|
+
sessionid: auth.sessionid,
|
|
183192
|
+
csrftoken: typeof auth.csrftoken === "string" ? auth.csrftoken : undefined,
|
|
183193
|
+
ds_user_id: typeof auth.ds_user_id === "string" ? auth.ds_user_id : undefined,
|
|
183194
|
+
created_at: typeof auth.created_at === "number" ? auth.created_at : 0,
|
|
183195
|
+
source: auth.source ?? "manual"
|
|
183196
|
+
};
|
|
183197
|
+
} catch {
|
|
183198
|
+
return null;
|
|
183199
|
+
}
|
|
183200
|
+
}
|
|
183201
|
+
var AUTH_FILE = "ig-auth.json";
|
|
183202
|
+
var init_authStore = __esm(() => {
|
|
183203
|
+
init_envUtils();
|
|
183204
|
+
});
|
|
183205
|
+
|
|
183206
|
+
// src/services/instagram/client.ts
|
|
183207
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
183208
|
+
function sleep4(ms) {
|
|
183209
|
+
return new Promise((resolve27) => setTimeout(resolve27, Math.max(0, ms)));
|
|
183210
|
+
}
|
|
183211
|
+
|
|
183212
|
+
class InstagramClient {
|
|
183213
|
+
auth;
|
|
183214
|
+
minDelayMs;
|
|
183215
|
+
maxDelayMs;
|
|
183216
|
+
lastRequestAt = 0;
|
|
183217
|
+
constructor(auth, options2) {
|
|
183218
|
+
this.auth = auth;
|
|
183219
|
+
this.minDelayMs = options2?.minDelayMs ?? 3000;
|
|
183220
|
+
this.maxDelayMs = options2?.maxDelayMs ?? 7000;
|
|
183221
|
+
}
|
|
183222
|
+
async throttle() {
|
|
183223
|
+
if (this.maxDelayMs <= 0)
|
|
183224
|
+
return;
|
|
183225
|
+
const gap = Math.floor(Math.random() * (this.maxDelayMs - this.minDelayMs + 1)) + this.minDelayMs;
|
|
183226
|
+
const wait = this.lastRequestAt === 0 ? gap : Math.max(0, this.lastRequestAt + gap - Date.now());
|
|
183227
|
+
if (wait > 0)
|
|
183228
|
+
await sleep4(wait);
|
|
183229
|
+
this.lastRequestAt = Date.now();
|
|
183230
|
+
}
|
|
183231
|
+
headers(extra) {
|
|
183232
|
+
const cookies = [`sessionid=${this.auth.sessionid}`];
|
|
183233
|
+
if (this.auth.csrftoken)
|
|
183234
|
+
cookies.push(`csrftoken=${this.auth.csrftoken}`);
|
|
183235
|
+
if (this.auth.ds_user_id)
|
|
183236
|
+
cookies.push(`ds_user_id=${this.auth.ds_user_id}`);
|
|
183237
|
+
return {
|
|
183238
|
+
"user-agent": WEB_UA,
|
|
183239
|
+
"x-ig-app-id": APP_ID,
|
|
183240
|
+
"x-requested-with": "XMLHttpRequest",
|
|
183241
|
+
accept: "*/*",
|
|
183242
|
+
"accept-language": "en-US,en;q=0.9",
|
|
183243
|
+
origin: "https://www.instagram.com",
|
|
183244
|
+
referer: "https://www.instagram.com/",
|
|
183245
|
+
cookie: cookies.join("; "),
|
|
183246
|
+
...this.auth.csrftoken ? { "x-csrftoken": this.auth.csrftoken } : {},
|
|
183247
|
+
...extra
|
|
183248
|
+
};
|
|
183249
|
+
}
|
|
183250
|
+
async request(path12, init) {
|
|
183251
|
+
await this.throttle();
|
|
183252
|
+
const timeout = AbortSignal.timeout(20000);
|
|
183253
|
+
const signal = init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout;
|
|
183254
|
+
let response;
|
|
183255
|
+
try {
|
|
183256
|
+
response = await fetch(`${BASE}${path12}`, {
|
|
183257
|
+
...init,
|
|
183258
|
+
signal,
|
|
183259
|
+
headers: this.headers(init?.headers)
|
|
183260
|
+
});
|
|
183261
|
+
} catch (error40) {
|
|
183262
|
+
if (error40 instanceof Error && error40.name === "AbortError") {
|
|
183263
|
+
throw new Error("Instagram request was cancelled.");
|
|
183264
|
+
}
|
|
183265
|
+
throw new Error(`Could not reach Instagram: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
183266
|
+
}
|
|
183267
|
+
if (response.status === 429) {
|
|
183268
|
+
const retry = Number(response.headers.get("retry-after"));
|
|
183269
|
+
throw new InstagramRateLimitError(Number.isFinite(retry) ? retry * 1000 : undefined);
|
|
183270
|
+
}
|
|
183271
|
+
if (response.status === 401 || response.status === 403) {
|
|
183272
|
+
throw new InstagramAuthError("Instagram rejected this session. Run `/link instagram --reset`, then connect again.");
|
|
183273
|
+
}
|
|
183274
|
+
const text = await response.text();
|
|
183275
|
+
if (!response.ok) {
|
|
183276
|
+
let detail = text.slice(0, 300);
|
|
183277
|
+
try {
|
|
183278
|
+
const parsed = JSON.parse(text);
|
|
183279
|
+
if (parsed.message)
|
|
183280
|
+
detail = parsed.message;
|
|
183281
|
+
} catch {}
|
|
183282
|
+
throw new Error(`Instagram request failed (${response.status}): ${detail}`);
|
|
183283
|
+
}
|
|
183284
|
+
try {
|
|
183285
|
+
return JSON.parse(text);
|
|
183286
|
+
} catch {
|
|
183287
|
+
throw new Error("Instagram returned an unexpected non-JSON response.");
|
|
183288
|
+
}
|
|
183289
|
+
}
|
|
183290
|
+
async getRecentMedia(limit = 12) {
|
|
183291
|
+
const safeLimit = Math.min(Math.max(Math.trunc(limit), 1), 50);
|
|
183292
|
+
const data = await this.request("/feed/user/self/?count=" + safeLimit);
|
|
183293
|
+
return (data.items ?? []).slice(0, safeLimit).map((item) => this.toMedia(item));
|
|
183294
|
+
}
|
|
183295
|
+
async getComments(mediaId, limit = 30) {
|
|
183296
|
+
if (!mediaId)
|
|
183297
|
+
throw new Error("mediaId is required");
|
|
183298
|
+
const safeLimit = Math.min(Math.max(Math.trunc(limit), 1), 100);
|
|
183299
|
+
const data = await this.request(`/media/${encodeURIComponent(mediaId)}/comments/?can_support_threading=true&permalink_enabled=false&count=${safeLimit}`);
|
|
183300
|
+
return (data.comments ?? []).slice(0, safeLimit).map((comment) => ({
|
|
183301
|
+
id: String(comment.pk ?? comment.id ?? ""),
|
|
183302
|
+
text: String(comment.text ?? ""),
|
|
183303
|
+
username: typeof comment.user === "object" && comment.user ? String(comment.user.username ?? "") : undefined,
|
|
183304
|
+
userId: typeof comment.user_id === "string" ? comment.user_id : undefined,
|
|
183305
|
+
createdAt: typeof comment.created_at === "number" ? comment.created_at : undefined,
|
|
183306
|
+
parentCommentId: typeof comment.parent_comment_id === "string" ? comment.parent_comment_id : undefined
|
|
183307
|
+
}));
|
|
183308
|
+
}
|
|
183309
|
+
async getDirectInbox(limit = 20) {
|
|
183310
|
+
const safeLimit = Math.min(Math.max(Math.trunc(limit), 1), 50);
|
|
183311
|
+
const data = await this.request(`/direct_v2/inbox/?visual_message_return_type=unseen&thread_message_limit=10&limit=${safeLimit}`);
|
|
183312
|
+
return (data.inbox?.threads ?? []).slice(0, safeLimit).map((thread) => {
|
|
183313
|
+
const items = Array.isArray(thread.items) ? thread.items : [];
|
|
183314
|
+
return {
|
|
183315
|
+
id: String(thread.thread_id ?? thread.id ?? ""),
|
|
183316
|
+
title: typeof thread.thread_title === "string" ? thread.thread_title : undefined,
|
|
183317
|
+
lastActivityAt: typeof thread.last_activity_at === "number" ? thread.last_activity_at : undefined,
|
|
183318
|
+
messages: items.map((item) => ({
|
|
183319
|
+
id: String(item.item_id ?? item.id ?? ""),
|
|
183320
|
+
text: String(item.text ?? ""),
|
|
183321
|
+
userId: typeof item.user_id === "string" ? item.user_id : undefined,
|
|
183322
|
+
timestamp: typeof item.timestamp === "number" ? item.timestamp : undefined,
|
|
183323
|
+
isSentByViewer: item.user_id === this.auth.ds_user_id
|
|
183324
|
+
}))
|
|
183325
|
+
};
|
|
183326
|
+
});
|
|
183327
|
+
}
|
|
183328
|
+
async sendReply(mediaId, commentId, text) {
|
|
183329
|
+
if (!mediaId || !commentId)
|
|
183330
|
+
throw new Error("mediaId and commentId are required");
|
|
183331
|
+
const trimmed = text.trim();
|
|
183332
|
+
if (!trimmed)
|
|
183333
|
+
throw new Error("Reply text cannot be empty");
|
|
183334
|
+
if (trimmed.length > 2200)
|
|
183335
|
+
throw new Error("Reply exceeds Instagram’s 2,200 character limit");
|
|
183336
|
+
const form = new URLSearchParams({
|
|
183337
|
+
comment_text: trimmed,
|
|
183338
|
+
_uuid: randomUUID11(),
|
|
183339
|
+
...this.auth.csrftoken ? { _csrftoken: this.auth.csrftoken } : {},
|
|
183340
|
+
...this.auth.ds_user_id ? { _uid: this.auth.ds_user_id } : {}
|
|
183341
|
+
});
|
|
183342
|
+
const data = await this.request(`/media/${encodeURIComponent(mediaId)}/comments/add/`, {
|
|
183343
|
+
method: "POST",
|
|
183344
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
183345
|
+
body: form.toString()
|
|
183346
|
+
});
|
|
183347
|
+
return { id: String(data.comment?.pk ?? "") };
|
|
183348
|
+
}
|
|
183349
|
+
toMedia(item) {
|
|
183350
|
+
const caption = typeof item.caption === "object" && item.caption ? String(item.caption.text ?? "") : undefined;
|
|
183351
|
+
const code = typeof item.code === "string" ? item.code : undefined;
|
|
183352
|
+
return {
|
|
183353
|
+
id: String(item.pk ?? item.id ?? ""),
|
|
183354
|
+
shortcode: code,
|
|
183355
|
+
mediaType: typeof item.media_type === "number" ? item.media_type : undefined,
|
|
183356
|
+
caption,
|
|
183357
|
+
takenAt: typeof item.taken_at === "number" ? item.taken_at : undefined,
|
|
183358
|
+
commentCount: typeof item.comment_count === "number" ? item.comment_count : undefined,
|
|
183359
|
+
likeCount: typeof item.like_count === "number" ? item.like_count : undefined,
|
|
183360
|
+
permalink: code ? `https://www.instagram.com/p/${code}/` : undefined
|
|
183361
|
+
};
|
|
183362
|
+
}
|
|
183363
|
+
}
|
|
183364
|
+
var WEB_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", APP_ID = "936619743392459", BASE = "https://i.instagram.com/api/v1", InstagramAuthError, InstagramRateLimitError;
|
|
183365
|
+
var init_client4 = __esm(() => {
|
|
183366
|
+
InstagramAuthError = class InstagramAuthError extends Error {
|
|
183367
|
+
code = "IG_AUTH";
|
|
183368
|
+
};
|
|
183369
|
+
InstagramRateLimitError = class InstagramRateLimitError extends Error {
|
|
183370
|
+
code = "IG_RATE_LIMIT";
|
|
183371
|
+
retryAfterMs;
|
|
183372
|
+
constructor(retryAfterMs = 15 * 60000) {
|
|
183373
|
+
super(`Instagram rate limit reached. Stop all requests for ${Math.ceil(retryAfterMs / 60000)} minutes.`);
|
|
183374
|
+
this.retryAfterMs = retryAfterMs;
|
|
183375
|
+
}
|
|
183376
|
+
};
|
|
183377
|
+
});
|
|
183378
|
+
|
|
183379
|
+
// src/tools/InstagramTool/InstagramTool.ts
|
|
183380
|
+
async function client() {
|
|
183381
|
+
const auth = await loadInstagramAuth();
|
|
183382
|
+
if (!auth) {
|
|
183383
|
+
throw new Error("Instagram is not connected. Ask the user to run `/link instagram` first.");
|
|
183384
|
+
}
|
|
183385
|
+
return new InstagramClient(auth);
|
|
183386
|
+
}
|
|
183387
|
+
var inputSchema15, outputSchema13, PROMPT5 = `Use this tool for Instagram work. Always start with get_recent_posts, then get_comments for the chosen media.
|
|
183388
|
+
|
|
183389
|
+
Rules:
|
|
183390
|
+
- Never call send_reply without first calling draft_reply and showing the exact draft to the user.
|
|
183391
|
+
- send_reply triggers a human approval prompt; do not try to bypass it.
|
|
183392
|
+
- Keep replies short, specific, and non-spammy. One reply per comment.
|
|
183393
|
+
- Respect Instagram rate limits. If the tool reports a 15-minute limit, stop and tell the user.`, InstagramTool;
|
|
183394
|
+
var init_InstagramTool = __esm(() => {
|
|
183395
|
+
init_v4();
|
|
183396
|
+
init_Tool();
|
|
183397
|
+
init_authStore();
|
|
183398
|
+
init_client4();
|
|
183399
|
+
inputSchema15 = lazySchema(() => exports_external.strictObject({
|
|
183400
|
+
action: exports_external.enum([
|
|
183401
|
+
"get_recent_posts",
|
|
183402
|
+
"get_comments",
|
|
183403
|
+
"get_dm_inbox",
|
|
183404
|
+
"draft_reply",
|
|
183405
|
+
"send_reply"
|
|
183406
|
+
]).describe("What to do. draft_reply never sends; send_reply always asks for approval."),
|
|
183407
|
+
mediaId: exports_external.string().optional().describe("Instagram media id (from get_recent_posts)"),
|
|
183408
|
+
commentId: exports_external.string().optional().describe("Comment id to reply to"),
|
|
183409
|
+
draftText: exports_external.string().optional().describe("Reply text to draft or send"),
|
|
183410
|
+
limit: exports_external.number().int().min(1).max(50).optional().describe("Maximum items to return")
|
|
183411
|
+
}));
|
|
183412
|
+
outputSchema13 = lazySchema(() => exports_external.object({ result: exports_external.unknown() }));
|
|
183413
|
+
InstagramTool = buildTool({
|
|
183414
|
+
name: "instagram_automation",
|
|
183415
|
+
searchHint: "read Instagram comments/DMs and draft replies",
|
|
183416
|
+
maxResultSizeChars: 200000,
|
|
183417
|
+
async description(input) {
|
|
183418
|
+
const { action } = input;
|
|
183419
|
+
if (action === "send_reply") {
|
|
183420
|
+
const text = input.draftText ?? "";
|
|
183421
|
+
return `Post this Instagram reply after human approval: “${text.slice(0, 180)}”`;
|
|
183422
|
+
}
|
|
183423
|
+
if (action === "draft_reply")
|
|
183424
|
+
return "Draft an Instagram reply (does not send)";
|
|
183425
|
+
if (action === "get_comments")
|
|
183426
|
+
return "Read Instagram comments";
|
|
183427
|
+
if (action === "get_dm_inbox")
|
|
183428
|
+
return "Read the Instagram DM inbox";
|
|
183429
|
+
return "Read recent Instagram posts";
|
|
183430
|
+
},
|
|
183431
|
+
async prompt() {
|
|
183432
|
+
return PROMPT5;
|
|
183433
|
+
},
|
|
183434
|
+
get inputSchema() {
|
|
183435
|
+
return inputSchema15();
|
|
183436
|
+
},
|
|
183437
|
+
get outputSchema() {
|
|
183438
|
+
return outputSchema13();
|
|
183439
|
+
},
|
|
183440
|
+
userFacingName() {
|
|
183441
|
+
return "Instagram";
|
|
183442
|
+
},
|
|
183443
|
+
getToolUseSummary(input) {
|
|
183444
|
+
return input?.action ? `Instagram · ${input.action}` : null;
|
|
183445
|
+
},
|
|
183446
|
+
isReadOnly(input) {
|
|
183447
|
+
return input.action !== "send_reply";
|
|
183448
|
+
},
|
|
183449
|
+
isDestructive(input) {
|
|
183450
|
+
return input.action === "send_reply";
|
|
183451
|
+
},
|
|
183452
|
+
isConcurrencySafe() {
|
|
183453
|
+
return false;
|
|
183454
|
+
},
|
|
183455
|
+
toAutoClassifierInput(input) {
|
|
183456
|
+
return `${input.action}: ${input.draftText ?? input.mediaId ?? ""}`;
|
|
183457
|
+
},
|
|
183458
|
+
async validateInput(input) {
|
|
183459
|
+
if (input.action === "get_comments" && !input.mediaId) {
|
|
183460
|
+
return { result: false, message: "mediaId is required for get_comments.", errorCode: 1 };
|
|
183461
|
+
}
|
|
183462
|
+
if (input.action === "draft_reply" && (!input.commentId || !input.draftText?.trim())) {
|
|
183463
|
+
return {
|
|
183464
|
+
result: false,
|
|
183465
|
+
message: "commentId and draftText are required for draft_reply.",
|
|
183466
|
+
errorCode: 1
|
|
183467
|
+
};
|
|
183468
|
+
}
|
|
183469
|
+
if (input.action === "send_reply" && (!input.mediaId || !input.commentId || !input.draftText?.trim())) {
|
|
183470
|
+
return {
|
|
183471
|
+
result: false,
|
|
183472
|
+
message: "mediaId, commentId, and draftText are required for send_reply.",
|
|
183473
|
+
errorCode: 1
|
|
183474
|
+
};
|
|
183475
|
+
}
|
|
183476
|
+
return { result: true };
|
|
183477
|
+
},
|
|
183478
|
+
async checkPermissions(input) {
|
|
183479
|
+
if (input.action !== "send_reply") {
|
|
183480
|
+
return { behavior: "allow", updatedInput: input };
|
|
183481
|
+
}
|
|
183482
|
+
return {
|
|
183483
|
+
behavior: "ask",
|
|
183484
|
+
message: `Post this Instagram reply to comment ${input.commentId}?
|
|
183485
|
+
|
|
183486
|
+
“${input.draftText}”
|
|
183487
|
+
|
|
183488
|
+
Approval sends it immediately. Rejection discards it.`,
|
|
183489
|
+
decisionReason: {
|
|
183490
|
+
type: "other",
|
|
183491
|
+
reason: "Instagram replies require explicit human approval"
|
|
183492
|
+
}
|
|
183493
|
+
};
|
|
183494
|
+
},
|
|
183495
|
+
async call(input, context2) {
|
|
183496
|
+
if (input.action === "draft_reply") {
|
|
183497
|
+
return {
|
|
183498
|
+
data: {
|
|
183499
|
+
result: {
|
|
183500
|
+
status: "requires_approval",
|
|
183501
|
+
draft: input.draftText,
|
|
183502
|
+
mediaId: input.mediaId,
|
|
183503
|
+
commentId: input.commentId,
|
|
183504
|
+
note: "Nothing was sent. Ask the user to approve, then call send_reply with the same text."
|
|
183505
|
+
}
|
|
183506
|
+
}
|
|
183507
|
+
};
|
|
183508
|
+
}
|
|
183509
|
+
const ig = await client();
|
|
183510
|
+
switch (input.action) {
|
|
183511
|
+
case "get_recent_posts": {
|
|
183512
|
+
const posts = await ig.getRecentMedia(input.limit ?? 12);
|
|
183513
|
+
return { data: { result: { posts } } };
|
|
183514
|
+
}
|
|
183515
|
+
case "get_comments": {
|
|
183516
|
+
const comments = await ig.getComments(input.mediaId, input.limit ?? 30);
|
|
183517
|
+
return {
|
|
183518
|
+
data: {
|
|
183519
|
+
result: {
|
|
183520
|
+
mediaId: input.mediaId,
|
|
183521
|
+
comments,
|
|
183522
|
+
hint: "Use draft_reply with the commentId, then ask the user to approve."
|
|
183523
|
+
}
|
|
183524
|
+
}
|
|
183525
|
+
};
|
|
183526
|
+
}
|
|
183527
|
+
case "get_dm_inbox": {
|
|
183528
|
+
const threads = await ig.getDirectInbox(input.limit ?? 20);
|
|
183529
|
+
return { data: { result: { threads } } };
|
|
183530
|
+
}
|
|
183531
|
+
case "send_reply": {
|
|
183532
|
+
const sent = await ig.sendReply(input.mediaId, input.commentId, input.draftText);
|
|
183533
|
+
return {
|
|
183534
|
+
data: {
|
|
183535
|
+
result: {
|
|
183536
|
+
status: "sent",
|
|
183537
|
+
commentId: sent.id,
|
|
183538
|
+
text: input.draftText,
|
|
183539
|
+
note: "The human approved this reply; it was posted once."
|
|
183540
|
+
}
|
|
183541
|
+
}
|
|
183542
|
+
};
|
|
183543
|
+
}
|
|
183544
|
+
}
|
|
183545
|
+
},
|
|
183546
|
+
mapToolResultToToolResultBlockParam(data, toolUseID) {
|
|
183547
|
+
return {
|
|
183548
|
+
type: "tool_result",
|
|
183549
|
+
tool_use_id: toolUseID,
|
|
183550
|
+
content: JSON.stringify(data.result)
|
|
183551
|
+
};
|
|
183552
|
+
},
|
|
183553
|
+
renderToolUseMessage() {
|
|
183554
|
+
return null;
|
|
183555
|
+
}
|
|
183556
|
+
});
|
|
183557
|
+
});
|
|
183558
|
+
|
|
183172
183559
|
// src/utils/listSessionsImpl.ts
|
|
183173
183560
|
import { readdir as readdir13, stat as stat19 } from "fs/promises";
|
|
183174
|
-
import { basename as basename20, join as
|
|
183561
|
+
import { basename as basename20, join as join74 } from "path";
|
|
183175
183562
|
function parseSessionInfoFromLite(sessionId, lite, projectPath) {
|
|
183176
183563
|
const { head, tail, mtime, size } = lite;
|
|
183177
183564
|
const firstNewline = head.indexOf(`
|
|
@@ -183223,7 +183610,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
183223
183610
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
183224
183611
|
if (!sessionId)
|
|
183225
183612
|
return null;
|
|
183226
|
-
const filePath =
|
|
183613
|
+
const filePath = join74(projectDir, name);
|
|
183227
183614
|
if (!doStat)
|
|
183228
183615
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
183229
183616
|
try {
|
|
@@ -183348,7 +183735,7 @@ async function gatherProjectCandidates(dir, includeWorktrees, doStat) {
|
|
|
183348
183735
|
const isMatch = dirName === prefix || prefix.length >= MAX_SANITIZED_LENGTH && dirName.startsWith(prefix + "-");
|
|
183349
183736
|
if (isMatch) {
|
|
183350
183737
|
seenDirs.add(dirName);
|
|
183351
|
-
all4.push(...await listCandidates(
|
|
183738
|
+
all4.push(...await listCandidates(join74(projectsDir, dirent.name), doStat, wtPath));
|
|
183352
183739
|
break;
|
|
183353
183740
|
}
|
|
183354
183741
|
}
|
|
@@ -183363,7 +183750,7 @@ async function gatherAllCandidates(doStat) {
|
|
|
183363
183750
|
} catch {
|
|
183364
183751
|
return [];
|
|
183365
183752
|
}
|
|
183366
|
-
const perProject = await Promise.all(dirents.filter((d) => d.isDirectory()).map((d) => listCandidates(
|
|
183753
|
+
const perProject = await Promise.all(dirents.filter((d) => d.isDirectory()).map((d) => listCandidates(join74(projectsDir, d.name), doStat)));
|
|
183367
183754
|
return perProject.flat();
|
|
183368
183755
|
}
|
|
183369
183756
|
async function listSessionsImpl(options2) {
|
|
@@ -183383,10 +183770,10 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
183383
183770
|
});
|
|
183384
183771
|
|
|
183385
183772
|
// src/services/autoDream/consolidationLock.ts
|
|
183386
|
-
import { mkdir as
|
|
183387
|
-
import { join as
|
|
183773
|
+
import { mkdir as mkdir18, readFile as readFile19, stat as stat20, unlink as unlink8, utimes, writeFile as writeFile15 } from "fs/promises";
|
|
183774
|
+
import { join as join75 } from "path";
|
|
183388
183775
|
function lockPath() {
|
|
183389
|
-
return
|
|
183776
|
+
return join75(getAutoMemPath(), LOCK_FILE);
|
|
183390
183777
|
}
|
|
183391
183778
|
async function rollbackConsolidationLock(priorMtime) {
|
|
183392
183779
|
const path12 = lockPath();
|
|
@@ -183395,7 +183782,7 @@ async function rollbackConsolidationLock(priorMtime) {
|
|
|
183395
183782
|
await unlink8(path12);
|
|
183396
183783
|
return;
|
|
183397
183784
|
}
|
|
183398
|
-
await
|
|
183785
|
+
await writeFile15(path12, "");
|
|
183399
183786
|
const t = priorMtime / 1000;
|
|
183400
183787
|
await utimes(path12, t, t);
|
|
183401
183788
|
} catch (e) {
|
|
@@ -183458,9 +183845,9 @@ var init_types5 = __esm(() => {
|
|
|
183458
183845
|
});
|
|
183459
183846
|
|
|
183460
183847
|
// src/tools/TodoWriteTool/prompt.ts
|
|
183461
|
-
var
|
|
183848
|
+
var PROMPT6, DESCRIPTION10 = "Update the todo list for the current session. To be used proactively and often to track progress and pending tasks. Make sure that at least one task is in_progress at all times. Always provide both content (imperative) and activeForm (present continuous) for each task.";
|
|
183462
183849
|
var init_prompt12 = __esm(() => {
|
|
183463
|
-
|
|
183850
|
+
PROMPT6 = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
183464
183851
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
183465
183852
|
|
|
183466
183853
|
## When to Use This Tool
|
|
@@ -183642,7 +184029,7 @@ When in doubt, use this tool. Being proactive with task management demonstrates
|
|
|
183642
184029
|
});
|
|
183643
184030
|
|
|
183644
184031
|
// src/tools/TodoWriteTool/TodoWriteTool.ts
|
|
183645
|
-
var
|
|
184032
|
+
var inputSchema16, outputSchema14, TodoWriteTool;
|
|
183646
184033
|
var init_TodoWriteTool = __esm(() => {
|
|
183647
184034
|
init_v4();
|
|
183648
184035
|
init_state();
|
|
@@ -183652,10 +184039,10 @@ var init_TodoWriteTool = __esm(() => {
|
|
|
183652
184039
|
init_types5();
|
|
183653
184040
|
init_constants2();
|
|
183654
184041
|
init_prompt12();
|
|
183655
|
-
|
|
184042
|
+
inputSchema16 = lazySchema(() => exports_external.strictObject({
|
|
183656
184043
|
todos: TodoListSchema().describe("The updated todo list")
|
|
183657
184044
|
}));
|
|
183658
|
-
|
|
184045
|
+
outputSchema14 = lazySchema(() => exports_external.object({
|
|
183659
184046
|
oldTodos: TodoListSchema().describe("The todo list before the update"),
|
|
183660
184047
|
newTodos: TodoListSchema().describe("The todo list after the update"),
|
|
183661
184048
|
verificationNudgeNeeded: exports_external.boolean().optional()
|
|
@@ -183669,13 +184056,13 @@ var init_TodoWriteTool = __esm(() => {
|
|
|
183669
184056
|
return DESCRIPTION10;
|
|
183670
184057
|
},
|
|
183671
184058
|
async prompt() {
|
|
183672
|
-
return
|
|
184059
|
+
return PROMPT6;
|
|
183673
184060
|
},
|
|
183674
184061
|
get inputSchema() {
|
|
183675
|
-
return
|
|
184062
|
+
return inputSchema16();
|
|
183676
184063
|
},
|
|
183677
184064
|
get outputSchema() {
|
|
183678
|
-
return
|
|
184065
|
+
return outputSchema14();
|
|
183679
184066
|
},
|
|
183680
184067
|
userFacingName() {
|
|
183681
184068
|
return "";
|
|
@@ -183743,7 +184130,7 @@ var init_types6 = __esm(() => {
|
|
|
183743
184130
|
|
|
183744
184131
|
// src/services/policyLimits/index.ts
|
|
183745
184132
|
import { readFileSync as fsReadFileSync } from "fs";
|
|
183746
|
-
import { join as
|
|
184133
|
+
import { join as join76 } from "path";
|
|
183747
184134
|
function initializePolicyLimitsLoadingPromise() {
|
|
183748
184135
|
if (loadingCompletePromise) {
|
|
183749
184136
|
return;
|
|
@@ -183762,7 +184149,7 @@ function initializePolicyLimitsLoadingPromise() {
|
|
|
183762
184149
|
}
|
|
183763
184150
|
}
|
|
183764
184151
|
function getCachePath() {
|
|
183765
|
-
return
|
|
184152
|
+
return join76(getAtherCodeConfigHomeDir(), CACHE_FILENAME);
|
|
183766
184153
|
}
|
|
183767
184154
|
function isPolicyLimitsEligible() {
|
|
183768
184155
|
if (getAPIProvider() !== "firstParty") {
|
|
@@ -184441,18 +184828,18 @@ var init_stopTask = __esm(() => {
|
|
|
184441
184828
|
});
|
|
184442
184829
|
|
|
184443
184830
|
// src/tools/TaskStopTool/TaskStopTool.ts
|
|
184444
|
-
var
|
|
184831
|
+
var inputSchema17, outputSchema15, TaskStopTool;
|
|
184445
184832
|
var init_TaskStopTool = __esm(() => {
|
|
184446
184833
|
init_v4();
|
|
184447
184834
|
init_Tool();
|
|
184448
184835
|
init_stopTask();
|
|
184449
184836
|
init_slowOperations();
|
|
184450
184837
|
init_UI();
|
|
184451
|
-
|
|
184838
|
+
inputSchema17 = lazySchema(() => exports_external.strictObject({
|
|
184452
184839
|
task_id: exports_external.string().optional().describe("The ID of the background task to stop"),
|
|
184453
184840
|
shell_id: exports_external.string().optional().describe("Deprecated: use task_id instead")
|
|
184454
184841
|
}));
|
|
184455
|
-
|
|
184842
|
+
outputSchema15 = lazySchema(() => exports_external.object({
|
|
184456
184843
|
message: exports_external.string().describe("Status message about the operation"),
|
|
184457
184844
|
task_id: exports_external.string().describe("The ID of the task that was stopped"),
|
|
184458
184845
|
task_type: exports_external.string().describe("The type of the task that was stopped"),
|
|
@@ -184465,10 +184852,10 @@ var init_TaskStopTool = __esm(() => {
|
|
|
184465
184852
|
maxResultSizeChars: 1e5,
|
|
184466
184853
|
userFacingName: () => "Stop Task",
|
|
184467
184854
|
get inputSchema() {
|
|
184468
|
-
return
|
|
184855
|
+
return inputSchema17();
|
|
184469
184856
|
},
|
|
184470
184857
|
get outputSchema() {
|
|
184471
|
-
return
|
|
184858
|
+
return outputSchema15();
|
|
184472
184859
|
},
|
|
184473
184860
|
shouldDefer: true,
|
|
184474
184861
|
isConcurrencySafe() {
|
|
@@ -184636,7 +185023,7 @@ Keep messages tight — the decision, the file:line, the PR number. Second perso
|
|
|
184636
185023
|
function isBriefEnabled() {
|
|
184637
185024
|
return false;
|
|
184638
185025
|
}
|
|
184639
|
-
var
|
|
185026
|
+
var inputSchema18, outputSchema16, KAIROS_BRIEF_REFRESH_MS, BriefTool;
|
|
184640
185027
|
var init_BriefTool = __esm(() => {
|
|
184641
185028
|
init_v4();
|
|
184642
185029
|
init_state();
|
|
@@ -184647,12 +185034,12 @@ var init_BriefTool = __esm(() => {
|
|
|
184647
185034
|
init_attachments();
|
|
184648
185035
|
init_prompt13();
|
|
184649
185036
|
init_UI();
|
|
184650
|
-
|
|
185037
|
+
inputSchema18 = lazySchema(() => exports_external.strictObject({
|
|
184651
185038
|
message: exports_external.string().describe("The message for the user. Supports markdown formatting."),
|
|
184652
185039
|
attachments: exports_external.array(exports_external.string()).optional().describe("Optional file paths (absolute or relative to cwd) to attach. Use for photos, screenshots, diffs, logs, or any file the user should see alongside your message."),
|
|
184653
185040
|
status: exports_external.enum(["normal", "proactive"]).describe("Use 'proactive' when you're surfacing something the user hasn't asked for and needs to see now — task completion while they're away, a blocker you hit, an unsolicited status update. Use 'normal' when replying to something the user just said.")
|
|
184654
185041
|
}));
|
|
184655
|
-
|
|
185042
|
+
outputSchema16 = lazySchema(() => exports_external.object({
|
|
184656
185043
|
message: exports_external.string().describe("The message"),
|
|
184657
185044
|
attachments: exports_external.array(exports_external.object({
|
|
184658
185045
|
path: exports_external.string(),
|
|
@@ -184672,10 +185059,10 @@ var init_BriefTool = __esm(() => {
|
|
|
184672
185059
|
return "";
|
|
184673
185060
|
},
|
|
184674
185061
|
get inputSchema() {
|
|
184675
|
-
return
|
|
185062
|
+
return inputSchema18();
|
|
184676
185063
|
},
|
|
184677
185064
|
get outputSchema() {
|
|
184678
|
-
return
|
|
185065
|
+
return outputSchema16();
|
|
184679
185066
|
},
|
|
184680
185067
|
isEnabled() {
|
|
184681
185068
|
return isBriefEnabled();
|
|
@@ -185449,7 +185836,7 @@ function TaskOutputResultDisplay(t0) {
|
|
|
185449
185836
|
}
|
|
185450
185837
|
return t5;
|
|
185451
185838
|
}
|
|
185452
|
-
var
|
|
185839
|
+
var inputSchema19, TASK_OUTPUT_ACTIVITY_INTERVAL_MS = 30000, TaskOutputTool;
|
|
185453
185840
|
var init_TaskOutputTool = __esm(() => {
|
|
185454
185841
|
init_react_compiler_runtime();
|
|
185455
185842
|
init_v4();
|
|
@@ -185470,7 +185857,7 @@ var init_TaskOutputTool = __esm(() => {
|
|
|
185470
185857
|
init_outputFormatting();
|
|
185471
185858
|
init_UI3();
|
|
185472
185859
|
init_BashToolResultMessage();
|
|
185473
|
-
|
|
185860
|
+
inputSchema19 = lazySchema(() => exports_external.strictObject({
|
|
185474
185861
|
task_id: exports_external.string().describe("The task ID to get output from"),
|
|
185475
185862
|
block: semanticBoolean(exports_external.boolean().default(true)).describe("Whether to wait for completion"),
|
|
185476
185863
|
timeout: exports_external.number().min(0).max(600000).default(30000).describe("Max wait time in ms")
|
|
@@ -185485,7 +185872,7 @@ var init_TaskOutputTool = __esm(() => {
|
|
|
185485
185872
|
return "Task Output";
|
|
185486
185873
|
},
|
|
185487
185874
|
get inputSchema() {
|
|
185488
|
-
return
|
|
185875
|
+
return inputSchema19();
|
|
185489
185876
|
},
|
|
185490
185877
|
async description() {
|
|
185491
185878
|
return "[Deprecated] — prefer Read on the task output file path";
|
|
@@ -186649,7 +187036,7 @@ var require_querystring = __commonJS((exports) => {
|
|
|
186649
187036
|
|
|
186650
187037
|
// node_modules/needle/lib/multipart.js
|
|
186651
187038
|
var require_multipart = __commonJS((exports) => {
|
|
186652
|
-
var
|
|
187039
|
+
var readFile20 = __require("fs").readFile;
|
|
186653
187040
|
var basename21 = __require("path").basename;
|
|
186654
187041
|
exports.build = function(data, boundary, callback) {
|
|
186655
187042
|
if (typeof data != "object" || typeof data.pipe == "function")
|
|
@@ -186701,7 +187088,7 @@ var require_multipart = __commonJS((exports) => {
|
|
|
186701
187088
|
var filename = part.filename ? part.filename : part.file ? basename21(part.file) : name;
|
|
186702
187089
|
if (part.buffer)
|
|
186703
187090
|
return append2(part.buffer, filename, true);
|
|
186704
|
-
|
|
187091
|
+
readFile20(part.file, function(err2, data) {
|
|
186705
187092
|
if (err2)
|
|
186706
187093
|
return callback(err2);
|
|
186707
187094
|
append2(data, filename, true);
|
|
@@ -193741,7 +194128,7 @@ function isRetryableDDGError(err2) {
|
|
|
193741
194128
|
const msg = err2.message.toLowerCase();
|
|
193742
194129
|
return msg.includes("anomaly") || msg.includes("too quickly") || msg.includes("rate limit") || msg.includes("timeout") || msg.includes("econnreset") || msg.includes("etimedout") || msg.includes("econnaborted");
|
|
193743
194130
|
}
|
|
193744
|
-
function
|
|
194131
|
+
function sleep5(ms, signal) {
|
|
193745
194132
|
if (signal?.aborted) {
|
|
193746
194133
|
return Promise.reject(toAbortError(signal.reason));
|
|
193747
194134
|
}
|
|
@@ -193809,7 +194196,7 @@ var init_duckduckgo = __esm(() => {
|
|
|
193809
194196
|
}
|
|
193810
194197
|
const baseDelay = INITIAL_BACKOFF_MS * Math.pow(2, attempt2);
|
|
193811
194198
|
const jitter = baseDelay * 0.2 * (Math.random() * 2 - 1);
|
|
193812
|
-
await
|
|
194199
|
+
await sleep5(baseDelay + jitter, signal);
|
|
193813
194200
|
}
|
|
193814
194201
|
}
|
|
193815
194202
|
throw lastErr;
|
|
@@ -194805,7 +195192,7 @@ function hasNativeSearchFallback() {
|
|
|
194805
195192
|
const provider = getAPIProvider();
|
|
194806
195193
|
return provider === "firstParty" && isFirstPartyAnthropicBaseUrl() || provider === "vertex" || provider === "foundry";
|
|
194807
195194
|
}
|
|
194808
|
-
var
|
|
195195
|
+
var inputSchema20, searchResultSchema, outputSchema17, WebSearchTool;
|
|
194809
195196
|
var init_WebSearchTool = __esm(() => {
|
|
194810
195197
|
init_providers();
|
|
194811
195198
|
init_v4();
|
|
@@ -194822,7 +195209,7 @@ var init_WebSearchTool = __esm(() => {
|
|
|
194822
195209
|
init_prompt5();
|
|
194823
195210
|
init_UI();
|
|
194824
195211
|
init_providers2();
|
|
194825
|
-
|
|
195212
|
+
inputSchema20 = lazySchema(() => exports_external.strictObject({
|
|
194826
195213
|
query: exports_external.string().min(2).describe("The search query to use"),
|
|
194827
195214
|
allowed_domains: exports_external.array(exports_external.string()).optional().describe("Only include search results from these domains"),
|
|
194828
195215
|
blocked_domains: exports_external.array(exports_external.string()).optional().describe("Never include search results from these domains")
|
|
@@ -194837,7 +195224,7 @@ var init_WebSearchTool = __esm(() => {
|
|
|
194837
195224
|
content: exports_external.array(searchHitSchema).describe("Array of search hits")
|
|
194838
195225
|
});
|
|
194839
195226
|
});
|
|
194840
|
-
|
|
195227
|
+
outputSchema17 = lazySchema(() => exports_external.object({
|
|
194841
195228
|
query: exports_external.string().describe("The search query that was executed"),
|
|
194842
195229
|
results: exports_external.array(exports_external.union([searchResultSchema(), exports_external.string()])).describe("Search results and/or text commentary from the model"),
|
|
194843
195230
|
durationSeconds: exports_external.number().describe("Time taken to complete the search operation")
|
|
@@ -194882,10 +195269,10 @@ var init_WebSearchTool = __esm(() => {
|
|
|
194882
195269
|
return false;
|
|
194883
195270
|
},
|
|
194884
195271
|
get inputSchema() {
|
|
194885
|
-
return
|
|
195272
|
+
return inputSchema20();
|
|
194886
195273
|
},
|
|
194887
195274
|
get outputSchema() {
|
|
194888
|
-
return
|
|
195275
|
+
return outputSchema17();
|
|
194889
195276
|
},
|
|
194890
195277
|
isConcurrencySafe() {
|
|
194891
195278
|
return true;
|
|
@@ -196285,29 +196672,29 @@ __export(exports_teammateMailbox, {
|
|
|
196285
196672
|
PlanApprovalRequestMessageSchema: () => PlanApprovalRequestMessageSchema,
|
|
196286
196673
|
ModeSetRequestMessageSchema: () => ModeSetRequestMessageSchema
|
|
196287
196674
|
});
|
|
196288
|
-
import { mkdir as
|
|
196289
|
-
import { join as
|
|
196675
|
+
import { mkdir as mkdir19, readFile as readFile20, writeFile as writeFile16 } from "fs/promises";
|
|
196676
|
+
import { join as join77 } from "path";
|
|
196290
196677
|
function getInboxPath(agentName, teamName) {
|
|
196291
196678
|
const team = teamName || getTeamName() || "default";
|
|
196292
196679
|
const safeTeam = sanitizePathComponent(team);
|
|
196293
196680
|
const safeAgentName = sanitizePathComponent(agentName);
|
|
196294
|
-
const inboxDir =
|
|
196295
|
-
const fullPath =
|
|
196681
|
+
const inboxDir = join77(getTeamsDir(), safeTeam, "inboxes");
|
|
196682
|
+
const fullPath = join77(inboxDir, `${safeAgentName}.json`);
|
|
196296
196683
|
logForDebugging(`[TeammateMailbox] getInboxPath: agent=${agentName}, team=${team}, fullPath=${fullPath}`);
|
|
196297
196684
|
return fullPath;
|
|
196298
196685
|
}
|
|
196299
196686
|
async function ensureInboxDir(teamName) {
|
|
196300
196687
|
const team = teamName || getTeamName() || "default";
|
|
196301
196688
|
const safeTeam = sanitizePathComponent(team);
|
|
196302
|
-
const inboxDir =
|
|
196303
|
-
await
|
|
196689
|
+
const inboxDir = join77(getTeamsDir(), safeTeam, "inboxes");
|
|
196690
|
+
await mkdir19(inboxDir, { recursive: true });
|
|
196304
196691
|
logForDebugging(`[TeammateMailbox] Ensured inbox directory: ${inboxDir}`);
|
|
196305
196692
|
}
|
|
196306
196693
|
async function readMailbox(agentName, teamName) {
|
|
196307
196694
|
const inboxPath = getInboxPath(agentName, teamName);
|
|
196308
196695
|
logForDebugging(`[TeammateMailbox] readMailbox: path=${inboxPath}`);
|
|
196309
196696
|
try {
|
|
196310
|
-
const content = await
|
|
196697
|
+
const content = await readFile20(inboxPath, "utf-8");
|
|
196311
196698
|
const messages = jsonParse(content);
|
|
196312
196699
|
logForDebugging(`[TeammateMailbox] readMailbox: read ${messages.length} message(s)`);
|
|
196313
196700
|
return messages;
|
|
@@ -196334,7 +196721,7 @@ async function writeToMailbox(recipientName, message, teamName) {
|
|
|
196334
196721
|
const lockFilePath = `${inboxPath}.lock`;
|
|
196335
196722
|
logForDebugging(`[TeammateMailbox] writeToMailbox: recipient=${recipientName}, from=${message.from}, path=${inboxPath}`);
|
|
196336
196723
|
try {
|
|
196337
|
-
await
|
|
196724
|
+
await writeFile16(inboxPath, "[]", { encoding: "utf-8", flag: "wx" });
|
|
196338
196725
|
logForDebugging(`[TeammateMailbox] writeToMailbox: created new inbox file`);
|
|
196339
196726
|
} catch (error40) {
|
|
196340
196727
|
const code = getErrnoCode(error40);
|
|
@@ -196356,7 +196743,7 @@ async function writeToMailbox(recipientName, message, teamName) {
|
|
|
196356
196743
|
read: false
|
|
196357
196744
|
};
|
|
196358
196745
|
messages.push(newMessage);
|
|
196359
|
-
await
|
|
196746
|
+
await writeFile16(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
196360
196747
|
logForDebugging(`[TeammateMailbox] Wrote message to ${recipientName}'s inbox from ${message.from}`);
|
|
196361
196748
|
} catch (error40) {
|
|
196362
196749
|
logForDebugging(`Failed to write to inbox for ${recipientName}: ${error40}`);
|
|
@@ -196391,7 +196778,7 @@ async function markMessageAsReadByIndex(agentName, teamName, messageIndex) {
|
|
|
196391
196778
|
return;
|
|
196392
196779
|
}
|
|
196393
196780
|
messages[messageIndex] = { ...message, read: true };
|
|
196394
|
-
await
|
|
196781
|
+
await writeFile16(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
196395
196782
|
logForDebugging(`[TeammateMailbox] markMessageAsReadByIndex: marked message at index ${messageIndex} as read`);
|
|
196396
196783
|
} catch (error40) {
|
|
196397
196784
|
const code = getErrnoCode(error40);
|
|
@@ -196430,7 +196817,7 @@ async function markMessagesAsRead(agentName, teamName) {
|
|
|
196430
196817
|
logForDebugging(`[TeammateMailbox] markMessagesAsRead: ${unreadCount} unread of ${messages.length} total`);
|
|
196431
196818
|
for (const m of messages)
|
|
196432
196819
|
m.read = true;
|
|
196433
|
-
await
|
|
196820
|
+
await writeFile16(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
196434
196821
|
logForDebugging(`[TeammateMailbox] markMessagesAsRead: WROTE ${unreadCount} message(s) as read to ${inboxPath}`);
|
|
196435
196822
|
} catch (error40) {
|
|
196436
196823
|
const code = getErrnoCode(error40);
|
|
@@ -196450,7 +196837,7 @@ async function markMessagesAsRead(agentName, teamName) {
|
|
|
196450
196837
|
async function clearMailbox(agentName, teamName) {
|
|
196451
196838
|
const inboxPath = getInboxPath(agentName, teamName);
|
|
196452
196839
|
try {
|
|
196453
|
-
await
|
|
196840
|
+
await writeFile16(inboxPath, "[]", { encoding: "utf-8", flag: "r+" });
|
|
196454
196841
|
logForDebugging(`[TeammateMailbox] Cleared inbox for ${agentName}`);
|
|
196455
196842
|
} catch (error40) {
|
|
196456
196843
|
const code = getErrnoCode(error40);
|
|
@@ -196725,7 +197112,7 @@ async function markMessagesAsReadByPredicate(agentName, predicate, teamName) {
|
|
|
196725
197112
|
return;
|
|
196726
197113
|
}
|
|
196727
197114
|
const updatedMessages = messages.map((m) => !m.read && predicate(m) ? { ...m, read: true } : m);
|
|
196728
|
-
await
|
|
197115
|
+
await writeFile16(inboxPath, jsonStringify(updatedMessages, null, 2), "utf-8");
|
|
196729
197116
|
} catch (error40) {
|
|
196730
197117
|
const code = getErrnoCode(error40);
|
|
196731
197118
|
if (code === "ENOENT") {
|
|
@@ -196910,8 +197297,8 @@ function _resetForTesting() {
|
|
|
196910
197297
|
var autoModeActive = false, autoModeFlagCli = false, autoModeCircuitBroken = false;
|
|
196911
197298
|
|
|
196912
197299
|
// src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.ts
|
|
196913
|
-
import { writeFile as
|
|
196914
|
-
var autoModeStateModule, permissionSetupModule, allowedPromptSchema,
|
|
197300
|
+
import { writeFile as writeFile17 } from "fs/promises";
|
|
197301
|
+
var autoModeStateModule, permissionSetupModule, allowedPromptSchema, inputSchema21, _sdkInputSchema, outputSchema18, ExitPlanModeV2Tool;
|
|
196915
197302
|
var init_ExitPlanModeV2Tool = __esm(() => {
|
|
196916
197303
|
init_v4();
|
|
196917
197304
|
init_state();
|
|
@@ -196933,14 +197320,14 @@ var init_ExitPlanModeV2Tool = __esm(() => {
|
|
|
196933
197320
|
tool: exports_external.enum(["Bash"]).describe("The tool this prompt applies to"),
|
|
196934
197321
|
prompt: exports_external.string().describe('Semantic description of the action, e.g. "run tests", "install dependencies"')
|
|
196935
197322
|
}));
|
|
196936
|
-
|
|
197323
|
+
inputSchema21 = lazySchema(() => exports_external.strictObject({
|
|
196937
197324
|
allowedPrompts: exports_external.array(allowedPromptSchema()).optional().describe("Prompt-based permissions needed to implement the plan. These describe categories of actions rather than specific commands.")
|
|
196938
197325
|
}).passthrough());
|
|
196939
|
-
_sdkInputSchema = lazySchema(() =>
|
|
197326
|
+
_sdkInputSchema = lazySchema(() => inputSchema21().extend({
|
|
196940
197327
|
plan: exports_external.string().optional().describe("The plan content (injected by normalizeToolInput from disk)"),
|
|
196941
197328
|
planFilePath: exports_external.string().optional().describe("The plan file path (injected by normalizeToolInput)")
|
|
196942
197329
|
}));
|
|
196943
|
-
|
|
197330
|
+
outputSchema18 = lazySchema(() => exports_external.object({
|
|
196944
197331
|
plan: exports_external.string().nullable().describe("The plan that was presented to the user"),
|
|
196945
197332
|
isAgent: exports_external.boolean(),
|
|
196946
197333
|
filePath: exports_external.string().optional().describe("The file path where the plan was saved"),
|
|
@@ -196960,10 +197347,10 @@ var init_ExitPlanModeV2Tool = __esm(() => {
|
|
|
196960
197347
|
return EXIT_PLAN_MODE_V2_TOOL_PROMPT;
|
|
196961
197348
|
},
|
|
196962
197349
|
get inputSchema() {
|
|
196963
|
-
return
|
|
197350
|
+
return inputSchema21();
|
|
196964
197351
|
},
|
|
196965
197352
|
get outputSchema() {
|
|
196966
|
-
return
|
|
197353
|
+
return outputSchema18();
|
|
196967
197354
|
},
|
|
196968
197355
|
userFacingName() {
|
|
196969
197356
|
return "";
|
|
@@ -197027,7 +197414,7 @@ var init_ExitPlanModeV2Tool = __esm(() => {
|
|
|
197027
197414
|
const plan = inputPlan ?? getPlan(context2.agentId);
|
|
197028
197415
|
if (inputPlan !== undefined && filePath) {
|
|
197029
197416
|
try {
|
|
197030
|
-
await
|
|
197417
|
+
await writeFile17(filePath, inputPlan, "utf-8");
|
|
197031
197418
|
} catch (e) {
|
|
197032
197419
|
logError(`Failed to write plan to ${filePath}: ${e}`);
|
|
197033
197420
|
throw e;
|
|
@@ -197194,11 +197581,11 @@ ${plan}`,
|
|
|
197194
197581
|
});
|
|
197195
197582
|
|
|
197196
197583
|
// src/tools/testing/TestingPermissionTool.tsx
|
|
197197
|
-
var NAME = "TestingPermission",
|
|
197584
|
+
var NAME = "TestingPermission", inputSchema22, TestingPermissionTool;
|
|
197198
197585
|
var init_TestingPermissionTool = __esm(() => {
|
|
197199
197586
|
init_v4();
|
|
197200
197587
|
init_Tool();
|
|
197201
|
-
|
|
197588
|
+
inputSchema22 = lazySchema(() => exports_external.strictObject({}));
|
|
197202
197589
|
TestingPermissionTool = buildTool({
|
|
197203
197590
|
name: NAME,
|
|
197204
197591
|
maxResultSizeChars: 1e5,
|
|
@@ -197209,7 +197596,7 @@ var init_TestingPermissionTool = __esm(() => {
|
|
|
197209
197596
|
return "Test tool that always asks for permission before executing. Used for end-to-end testing.";
|
|
197210
197597
|
},
|
|
197211
197598
|
get inputSchema() {
|
|
197212
|
-
return
|
|
197599
|
+
return inputSchema22();
|
|
197213
197600
|
},
|
|
197214
197601
|
userFacingName() {
|
|
197215
197602
|
return "TestingPermission";
|
|
@@ -197283,7 +197670,7 @@ function formatLimitInfo(appliedLimit, appliedOffset) {
|
|
|
197283
197670
|
parts.push(`offset: ${appliedOffset}`);
|
|
197284
197671
|
return parts.join(", ");
|
|
197285
197672
|
}
|
|
197286
|
-
var
|
|
197673
|
+
var inputSchema23, VCS_DIRECTORIES_TO_EXCLUDE2, DEFAULT_HEAD_LIMIT = 250, outputSchema19, GrepTool;
|
|
197287
197674
|
var init_GrepTool = __esm(() => {
|
|
197288
197675
|
init_v4();
|
|
197289
197676
|
init_Tool();
|
|
@@ -197302,7 +197689,7 @@ var init_GrepTool = __esm(() => {
|
|
|
197302
197689
|
init_stringUtils();
|
|
197303
197690
|
init_prompt();
|
|
197304
197691
|
init_UI();
|
|
197305
|
-
|
|
197692
|
+
inputSchema23 = lazySchema(() => exports_external.strictObject({
|
|
197306
197693
|
pattern: exports_external.string().describe("The regular expression pattern to search for in file contents"),
|
|
197307
197694
|
path: exports_external.string().optional().describe("File or directory to search in (rg PATH). Defaults to current working directory."),
|
|
197308
197695
|
glob: exports_external.string().optional().describe('Glob pattern to filter files (e.g. "*.js", "*.{ts,tsx}") - maps to rg --glob'),
|
|
@@ -197326,7 +197713,7 @@ var init_GrepTool = __esm(() => {
|
|
|
197326
197713
|
".jj",
|
|
197327
197714
|
".sl"
|
|
197328
197715
|
];
|
|
197329
|
-
|
|
197716
|
+
outputSchema19 = lazySchema(() => exports_external.object({
|
|
197330
197717
|
mode: exports_external.enum(["content", "files_with_matches", "count"]).optional(),
|
|
197331
197718
|
numFiles: exports_external.number(),
|
|
197332
197719
|
filenames: exports_external.array(exports_external.string()),
|
|
@@ -197353,10 +197740,10 @@ var init_GrepTool = __esm(() => {
|
|
|
197353
197740
|
return summary ? `Searching for ${summary}` : "Searching";
|
|
197354
197741
|
},
|
|
197355
197742
|
get inputSchema() {
|
|
197356
|
-
return
|
|
197743
|
+
return inputSchema23();
|
|
197357
197744
|
},
|
|
197358
197745
|
get outputSchema() {
|
|
197359
|
-
return
|
|
197746
|
+
return outputSchema19();
|
|
197360
197747
|
},
|
|
197361
197748
|
isConcurrencySafe() {
|
|
197362
197749
|
return true;
|
|
@@ -197683,7 +198070,7 @@ function throwIfAborted2(signal) {
|
|
|
197683
198070
|
throw new AbortError;
|
|
197684
198071
|
}
|
|
197685
198072
|
}
|
|
197686
|
-
var
|
|
198073
|
+
var inputSchema24, outputSchema20, RepoMapTool;
|
|
197687
198074
|
var init_RepoMapTool = __esm(() => {
|
|
197688
198075
|
init_v4();
|
|
197689
198076
|
init_Tool();
|
|
@@ -197692,12 +198079,12 @@ var init_RepoMapTool = __esm(() => {
|
|
|
197692
198079
|
init_errors();
|
|
197693
198080
|
init_repoMap2();
|
|
197694
198081
|
init_UI();
|
|
197695
|
-
|
|
198082
|
+
inputSchema24 = lazySchema(() => exports_external.strictObject({
|
|
197696
198083
|
max_tokens: exports_external.number().int().min(256).max(16384).optional().describe("Maximum token budget for the rendered map. Higher values include more files. Default: 1024."),
|
|
197697
198084
|
focus_files: exports_external.array(exports_external.string()).optional().describe('Relative file or directory paths to boost in the ranking (e.g. ["src/tools/", "src/context.ts"]).'),
|
|
197698
198085
|
focus_symbols: exports_external.array(exports_external.string()).optional().describe('Symbol names to boost — files defining these symbols rank higher (e.g. ["buildTool", "ToolUseContext"]).')
|
|
197699
198086
|
}));
|
|
197700
|
-
|
|
198087
|
+
outputSchema20 = lazySchema(() => exports_external.object({
|
|
197701
198088
|
rendered: exports_external.string(),
|
|
197702
198089
|
token_count: exports_external.number(),
|
|
197703
198090
|
file_count: exports_external.number(),
|
|
@@ -197723,10 +198110,10 @@ var init_RepoMapTool = __esm(() => {
|
|
|
197723
198110
|
return "Building repository map";
|
|
197724
198111
|
},
|
|
197725
198112
|
get inputSchema() {
|
|
197726
|
-
return
|
|
198113
|
+
return inputSchema24();
|
|
197727
198114
|
},
|
|
197728
198115
|
get outputSchema() {
|
|
197729
|
-
return
|
|
198116
|
+
return outputSchema20();
|
|
197730
198117
|
},
|
|
197731
198118
|
isConcurrencySafe() {
|
|
197732
198119
|
return true;
|
|
@@ -197879,7 +198266,7 @@ function validateHtmlPreview(preview) {
|
|
|
197879
198266
|
}
|
|
197880
198267
|
return null;
|
|
197881
198268
|
}
|
|
197882
|
-
var questionOptionSchema, questionSchema, annotationsSchema, UNIQUENESS_REFINE, commonFields,
|
|
198269
|
+
var questionOptionSchema, questionSchema, annotationsSchema, UNIQUENESS_REFINE, commonFields, inputSchema25, outputSchema21, AskUserQuestionTool;
|
|
197883
198270
|
var init_AskUserQuestionTool = __esm(() => {
|
|
197884
198271
|
init_react_compiler_runtime();
|
|
197885
198272
|
init_state();
|
|
@@ -197930,13 +198317,13 @@ var init_AskUserQuestionTool = __esm(() => {
|
|
|
197930
198317
|
source: exports_external.string().optional().describe('Optional identifier for the source of this question (e.g., "remember" for /remember command). Used for analytics tracking.')
|
|
197931
198318
|
}).optional().describe("Optional metadata for tracking and analytics purposes. Not displayed to user.")
|
|
197932
198319
|
}));
|
|
197933
|
-
|
|
198320
|
+
inputSchema25 = lazySchema(() => exports_external.strictObject({
|
|
197934
198321
|
questions: exports_external.array(questionSchema()).min(1).max(4).describe("Questions to ask the user (1-4 questions)"),
|
|
197935
198322
|
...commonFields()
|
|
197936
198323
|
}).refine(UNIQUENESS_REFINE.check, {
|
|
197937
198324
|
message: UNIQUENESS_REFINE.message
|
|
197938
198325
|
}));
|
|
197939
|
-
|
|
198326
|
+
outputSchema21 = lazySchema(() => exports_external.object({
|
|
197940
198327
|
questions: exports_external.array(questionSchema()).describe("The questions that were asked"),
|
|
197941
198328
|
answers: exports_external.record(exports_external.string(), exports_external.string()).describe("The answers provided by the user (question text -> answer string; multi-select answers are comma-separated)"),
|
|
197942
198329
|
annotations: annotationsSchema()
|
|
@@ -197957,10 +198344,10 @@ var init_AskUserQuestionTool = __esm(() => {
|
|
|
197957
198344
|
return ASK_USER_QUESTION_TOOL_PROMPT + PREVIEW_FEATURE_PROMPT[format4];
|
|
197958
198345
|
},
|
|
197959
198346
|
get inputSchema() {
|
|
197960
|
-
return
|
|
198347
|
+
return inputSchema25();
|
|
197961
198348
|
},
|
|
197962
198349
|
get outputSchema() {
|
|
197963
|
-
return
|
|
198350
|
+
return outputSchema21();
|
|
197964
198351
|
},
|
|
197965
198352
|
userFacingName() {
|
|
197966
198353
|
return "";
|
|
@@ -198808,7 +199195,7 @@ function countUniqueFilesFromOutgoingCalls(calls) {
|
|
|
198808
199195
|
const validUris = calls.map((call) => call.to?.uri).filter((uri) => uri);
|
|
198809
199196
|
return new Set(validUris).size;
|
|
198810
199197
|
}
|
|
198811
|
-
var MAX_LSP_FILE_SIZE_BYTES = 1e7,
|
|
199198
|
+
var MAX_LSP_FILE_SIZE_BYTES = 1e7, inputSchema26, outputSchema22, LSPTool;
|
|
198812
199199
|
var init_LSPTool = __esm(() => {
|
|
198813
199200
|
init_v4();
|
|
198814
199201
|
init_manager();
|
|
@@ -198824,7 +199211,7 @@ var init_LSPTool = __esm(() => {
|
|
|
198824
199211
|
init_formatters();
|
|
198825
199212
|
init_schemas4();
|
|
198826
199213
|
init_UI();
|
|
198827
|
-
|
|
199214
|
+
inputSchema26 = lazySchema(() => exports_external.strictObject({
|
|
198828
199215
|
operation: exports_external.enum([
|
|
198829
199216
|
"goToDefinition",
|
|
198830
199217
|
"findReferences",
|
|
@@ -198840,7 +199227,7 @@ var init_LSPTool = __esm(() => {
|
|
|
198840
199227
|
line: exports_external.number().int().positive().describe("The line number (1-based, as shown in editors)"),
|
|
198841
199228
|
character: exports_external.number().int().positive().describe("The character offset (1-based, as shown in editors)")
|
|
198842
199229
|
}));
|
|
198843
|
-
|
|
199230
|
+
outputSchema22 = lazySchema(() => exports_external.object({
|
|
198844
199231
|
operation: exports_external.enum([
|
|
198845
199232
|
"goToDefinition",
|
|
198846
199233
|
"findReferences",
|
|
@@ -198871,10 +199258,10 @@ var init_LSPTool = __esm(() => {
|
|
|
198871
199258
|
return isLspConnected();
|
|
198872
199259
|
},
|
|
198873
199260
|
get inputSchema() {
|
|
198874
|
-
return
|
|
199261
|
+
return inputSchema26();
|
|
198875
199262
|
},
|
|
198876
199263
|
get outputSchema() {
|
|
198877
|
-
return
|
|
199264
|
+
return outputSchema22();
|
|
198878
199265
|
},
|
|
198879
199266
|
isConcurrencySafe() {
|
|
198880
199267
|
return true;
|
|
@@ -199208,7 +199595,7 @@ In plan mode, you'll:
|
|
|
199208
199595
|
});
|
|
199209
199596
|
|
|
199210
199597
|
// src/tools/EnterPlanModeTool/EnterPlanModeTool.ts
|
|
199211
|
-
var
|
|
199598
|
+
var inputSchema27, outputSchema23, EnterPlanModeTool;
|
|
199212
199599
|
var init_EnterPlanModeTool = __esm(() => {
|
|
199213
199600
|
init_v4();
|
|
199214
199601
|
init_state();
|
|
@@ -199217,8 +199604,8 @@ var init_EnterPlanModeTool = __esm(() => {
|
|
|
199217
199604
|
init_planModeV2();
|
|
199218
199605
|
init_prompt15();
|
|
199219
199606
|
init_UI();
|
|
199220
|
-
|
|
199221
|
-
|
|
199607
|
+
inputSchema27 = lazySchema(() => exports_external.strictObject({}));
|
|
199608
|
+
outputSchema23 = lazySchema(() => exports_external.object({
|
|
199222
199609
|
message: exports_external.string().describe("Confirmation that plan mode was entered")
|
|
199223
199610
|
}));
|
|
199224
199611
|
EnterPlanModeTool = buildTool({
|
|
@@ -199232,10 +199619,10 @@ var init_EnterPlanModeTool = __esm(() => {
|
|
|
199232
199619
|
return getEnterPlanModeToolPrompt();
|
|
199233
199620
|
},
|
|
199234
199621
|
get inputSchema() {
|
|
199235
|
-
return
|
|
199622
|
+
return inputSchema27();
|
|
199236
199623
|
},
|
|
199237
199624
|
get outputSchema() {
|
|
199238
|
-
return
|
|
199625
|
+
return outputSchema23();
|
|
199239
199626
|
},
|
|
199240
199627
|
userFacingName() {
|
|
199241
199628
|
return "";
|
|
@@ -199350,7 +199737,7 @@ function getEnterWorktreeToolPrompt() {
|
|
|
199350
199737
|
}
|
|
199351
199738
|
|
|
199352
199739
|
// src/tools/EnterWorktreeTool/EnterWorktreeTool.ts
|
|
199353
|
-
var
|
|
199740
|
+
var inputSchema28, outputSchema24, EnterWorktreeTool;
|
|
199354
199741
|
var init_EnterWorktreeTool = __esm(() => {
|
|
199355
199742
|
init_v4();
|
|
199356
199743
|
init_state();
|
|
@@ -199364,7 +199751,7 @@ var init_EnterWorktreeTool = __esm(() => {
|
|
|
199364
199751
|
init_sessionStorage();
|
|
199365
199752
|
init_worktree();
|
|
199366
199753
|
init_UI();
|
|
199367
|
-
|
|
199754
|
+
inputSchema28 = lazySchema(() => exports_external.strictObject({
|
|
199368
199755
|
name: exports_external.string().superRefine((s, ctx) => {
|
|
199369
199756
|
try {
|
|
199370
199757
|
validateWorktreeSlug(s);
|
|
@@ -199373,7 +199760,7 @@ var init_EnterWorktreeTool = __esm(() => {
|
|
|
199373
199760
|
}
|
|
199374
199761
|
}).optional().describe('Optional name for the worktree. Each "/"-separated segment may contain only letters, digits, dots, underscores, and dashes; max 64 chars total. A random name is generated if not provided.')
|
|
199375
199762
|
}));
|
|
199376
|
-
|
|
199763
|
+
outputSchema24 = lazySchema(() => exports_external.object({
|
|
199377
199764
|
worktreePath: exports_external.string(),
|
|
199378
199765
|
worktreeBranch: exports_external.string().optional(),
|
|
199379
199766
|
message: exports_external.string()
|
|
@@ -199389,10 +199776,10 @@ var init_EnterWorktreeTool = __esm(() => {
|
|
|
199389
199776
|
return getEnterWorktreeToolPrompt();
|
|
199390
199777
|
},
|
|
199391
199778
|
get inputSchema() {
|
|
199392
|
-
return
|
|
199779
|
+
return inputSchema28();
|
|
199393
199780
|
},
|
|
199394
199781
|
get outputSchema() {
|
|
199395
|
-
return
|
|
199782
|
+
return outputSchema24();
|
|
199396
199783
|
},
|
|
199397
199784
|
userFacingName() {
|
|
199398
199785
|
return "Creating worktree";
|
|
@@ -199518,7 +199905,7 @@ function restoreSessionToOriginalCwd(originalCwd, projectRootIsWorktree) {
|
|
|
199518
199905
|
clearMemoryFileCaches();
|
|
199519
199906
|
getPlansDirectory.cache.clear?.();
|
|
199520
199907
|
}
|
|
199521
|
-
var
|
|
199908
|
+
var inputSchema29, outputSchema25, ExitWorktreeTool;
|
|
199522
199909
|
var init_ExitWorktreeTool = __esm(() => {
|
|
199523
199910
|
init_v4();
|
|
199524
199911
|
init_state();
|
|
@@ -199532,11 +199919,11 @@ var init_ExitWorktreeTool = __esm(() => {
|
|
|
199532
199919
|
init_sessionStorage();
|
|
199533
199920
|
init_worktree();
|
|
199534
199921
|
init_UI();
|
|
199535
|
-
|
|
199922
|
+
inputSchema29 = lazySchema(() => exports_external.strictObject({
|
|
199536
199923
|
action: exports_external.enum(["keep", "remove"]).describe('"keep" leaves the worktree and branch on disk; "remove" deletes both.'),
|
|
199537
199924
|
discard_changes: exports_external.boolean().optional().describe('Required true when action is "remove" and the worktree has uncommitted files or unmerged commits. The tool will refuse and list them otherwise.')
|
|
199538
199925
|
}));
|
|
199539
|
-
|
|
199926
|
+
outputSchema25 = lazySchema(() => exports_external.object({
|
|
199540
199927
|
action: exports_external.enum(["keep", "remove"]),
|
|
199541
199928
|
originalCwd: exports_external.string(),
|
|
199542
199929
|
worktreePath: exports_external.string(),
|
|
@@ -199557,10 +199944,10 @@ var init_ExitWorktreeTool = __esm(() => {
|
|
|
199557
199944
|
return getExitWorktreeToolPrompt();
|
|
199558
199945
|
},
|
|
199559
199946
|
get inputSchema() {
|
|
199560
|
-
return
|
|
199947
|
+
return inputSchema29();
|
|
199561
199948
|
},
|
|
199562
199949
|
get outputSchema() {
|
|
199563
|
-
return
|
|
199950
|
+
return outputSchema25();
|
|
199564
199951
|
},
|
|
199565
199952
|
userFacingName() {
|
|
199566
199953
|
return "Exiting worktree";
|
|
@@ -199737,7 +200124,7 @@ var init_prompt16 = __esm(() => {
|
|
|
199737
200124
|
});
|
|
199738
200125
|
|
|
199739
200126
|
// src/tools/TaskCreateTool/TaskCreateTool.ts
|
|
199740
|
-
var
|
|
200127
|
+
var inputSchema30, outputSchema26, TaskCreateTool;
|
|
199741
200128
|
var init_TaskCreateTool = __esm(() => {
|
|
199742
200129
|
init_v4();
|
|
199743
200130
|
init_Tool();
|
|
@@ -199745,13 +200132,13 @@ var init_TaskCreateTool = __esm(() => {
|
|
|
199745
200132
|
init_tasks2();
|
|
199746
200133
|
init_teammate();
|
|
199747
200134
|
init_prompt16();
|
|
199748
|
-
|
|
200135
|
+
inputSchema30 = lazySchema(() => exports_external.strictObject({
|
|
199749
200136
|
subject: exports_external.string().describe("A brief title for the task"),
|
|
199750
200137
|
description: exports_external.string().describe("What needs to be done"),
|
|
199751
200138
|
activeForm: exports_external.string().optional().describe('Present continuous form shown in spinner when in_progress (e.g., "Running tests")'),
|
|
199752
200139
|
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Arbitrary metadata to attach to the task")
|
|
199753
200140
|
}));
|
|
199754
|
-
|
|
200141
|
+
outputSchema26 = lazySchema(() => exports_external.object({
|
|
199755
200142
|
task: exports_external.object({
|
|
199756
200143
|
id: exports_external.string(),
|
|
199757
200144
|
subject: exports_external.string()
|
|
@@ -199768,10 +200155,10 @@ var init_TaskCreateTool = __esm(() => {
|
|
|
199768
200155
|
return getPrompt4();
|
|
199769
200156
|
},
|
|
199770
200157
|
get inputSchema() {
|
|
199771
|
-
return
|
|
200158
|
+
return inputSchema30();
|
|
199772
200159
|
},
|
|
199773
200160
|
get outputSchema() {
|
|
199774
|
-
return
|
|
200161
|
+
return outputSchema26();
|
|
199775
200162
|
},
|
|
199776
200163
|
userFacingName() {
|
|
199777
200164
|
return "TaskCreate";
|
|
@@ -199838,7 +200225,7 @@ var init_TaskCreateTool = __esm(() => {
|
|
|
199838
200225
|
});
|
|
199839
200226
|
|
|
199840
200227
|
// src/tools/TaskGetTool/prompt.ts
|
|
199841
|
-
var DESCRIPTION14 = "Get a task by ID from the task list",
|
|
200228
|
+
var DESCRIPTION14 = "Get a task by ID from the task list", PROMPT7 = `Use this tool to retrieve a task by its ID from the task list.
|
|
199842
200229
|
|
|
199843
200230
|
## When to Use This Tool
|
|
199844
200231
|
|
|
@@ -199862,15 +200249,15 @@ Returns full task details:
|
|
|
199862
200249
|
`;
|
|
199863
200250
|
|
|
199864
200251
|
// src/tools/TaskGetTool/TaskGetTool.ts
|
|
199865
|
-
var
|
|
200252
|
+
var inputSchema31, outputSchema27, TaskGetTool;
|
|
199866
200253
|
var init_TaskGetTool = __esm(() => {
|
|
199867
200254
|
init_v4();
|
|
199868
200255
|
init_Tool();
|
|
199869
200256
|
init_tasks2();
|
|
199870
|
-
|
|
200257
|
+
inputSchema31 = lazySchema(() => exports_external.strictObject({
|
|
199871
200258
|
taskId: exports_external.string().describe("The ID of the task to retrieve")
|
|
199872
200259
|
}));
|
|
199873
|
-
|
|
200260
|
+
outputSchema27 = lazySchema(() => exports_external.object({
|
|
199874
200261
|
task: exports_external.object({
|
|
199875
200262
|
id: exports_external.string(),
|
|
199876
200263
|
subject: exports_external.string(),
|
|
@@ -199888,13 +200275,13 @@ var init_TaskGetTool = __esm(() => {
|
|
|
199888
200275
|
return DESCRIPTION14;
|
|
199889
200276
|
},
|
|
199890
200277
|
async prompt() {
|
|
199891
|
-
return
|
|
200278
|
+
return PROMPT7;
|
|
199892
200279
|
},
|
|
199893
200280
|
get inputSchema() {
|
|
199894
|
-
return
|
|
200281
|
+
return inputSchema31();
|
|
199895
200282
|
},
|
|
199896
200283
|
get outputSchema() {
|
|
199897
|
-
return
|
|
200284
|
+
return outputSchema27();
|
|
199898
200285
|
},
|
|
199899
200286
|
userFacingName() {
|
|
199900
200287
|
return "TaskGet";
|
|
@@ -199969,7 +200356,7 @@ var init_TaskGetTool = __esm(() => {
|
|
|
199969
200356
|
});
|
|
199970
200357
|
|
|
199971
200358
|
// src/tools/TaskUpdateTool/prompt.ts
|
|
199972
|
-
var DESCRIPTION15 = "Update a task in the task list",
|
|
200359
|
+
var DESCRIPTION15 = "Update a task in the task list", PROMPT8 = `Use this tool to update a task in the task list.
|
|
199973
200360
|
|
|
199974
200361
|
## When to Use This Tool
|
|
199975
200362
|
|
|
@@ -200046,7 +200433,7 @@ Set up task dependencies:
|
|
|
200046
200433
|
`;
|
|
200047
200434
|
|
|
200048
200435
|
// src/tools/TaskUpdateTool/TaskUpdateTool.ts
|
|
200049
|
-
var
|
|
200436
|
+
var inputSchema32, outputSchema28, TaskUpdateTool;
|
|
200050
200437
|
var init_TaskUpdateTool = __esm(() => {
|
|
200051
200438
|
init_v4();
|
|
200052
200439
|
init_growthbook();
|
|
@@ -200057,7 +200444,7 @@ var init_TaskUpdateTool = __esm(() => {
|
|
|
200057
200444
|
init_teammate();
|
|
200058
200445
|
init_teammateMailbox();
|
|
200059
200446
|
init_constants2();
|
|
200060
|
-
|
|
200447
|
+
inputSchema32 = lazySchema(() => {
|
|
200061
200448
|
const TaskUpdateStatusSchema = TaskStatusSchema().or(exports_external.literal("deleted"));
|
|
200062
200449
|
return exports_external.strictObject({
|
|
200063
200450
|
taskId: exports_external.string().describe("The ID of the task to update"),
|
|
@@ -200071,7 +200458,7 @@ var init_TaskUpdateTool = __esm(() => {
|
|
|
200071
200458
|
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Metadata keys to merge into the task. Set a key to null to delete it.")
|
|
200072
200459
|
});
|
|
200073
200460
|
});
|
|
200074
|
-
|
|
200461
|
+
outputSchema28 = lazySchema(() => exports_external.object({
|
|
200075
200462
|
success: exports_external.boolean(),
|
|
200076
200463
|
taskId: exports_external.string(),
|
|
200077
200464
|
updatedFields: exports_external.array(exports_external.string()),
|
|
@@ -200090,13 +200477,13 @@ var init_TaskUpdateTool = __esm(() => {
|
|
|
200090
200477
|
return DESCRIPTION15;
|
|
200091
200478
|
},
|
|
200092
200479
|
async prompt() {
|
|
200093
|
-
return
|
|
200480
|
+
return PROMPT8;
|
|
200094
200481
|
},
|
|
200095
200482
|
get inputSchema() {
|
|
200096
|
-
return
|
|
200483
|
+
return inputSchema32();
|
|
200097
200484
|
},
|
|
200098
200485
|
get outputSchema() {
|
|
200099
|
-
return
|
|
200486
|
+
return outputSchema28();
|
|
200100
200487
|
},
|
|
200101
200488
|
userFacingName() {
|
|
200102
200489
|
return "TaskUpdate";
|
|
@@ -200358,14 +200745,14 @@ var init_prompt17 = __esm(() => {
|
|
|
200358
200745
|
});
|
|
200359
200746
|
|
|
200360
200747
|
// src/tools/TaskListTool/TaskListTool.ts
|
|
200361
|
-
var
|
|
200748
|
+
var inputSchema33, outputSchema29, TaskListTool;
|
|
200362
200749
|
var init_TaskListTool = __esm(() => {
|
|
200363
200750
|
init_v4();
|
|
200364
200751
|
init_Tool();
|
|
200365
200752
|
init_tasks2();
|
|
200366
200753
|
init_prompt17();
|
|
200367
|
-
|
|
200368
|
-
|
|
200754
|
+
inputSchema33 = lazySchema(() => exports_external.strictObject({}));
|
|
200755
|
+
outputSchema29 = lazySchema(() => exports_external.object({
|
|
200369
200756
|
tasks: exports_external.array(exports_external.object({
|
|
200370
200757
|
id: exports_external.string(),
|
|
200371
200758
|
subject: exports_external.string(),
|
|
@@ -200385,10 +200772,10 @@ var init_TaskListTool = __esm(() => {
|
|
|
200385
200772
|
return getPrompt5();
|
|
200386
200773
|
},
|
|
200387
200774
|
get inputSchema() {
|
|
200388
|
-
return
|
|
200775
|
+
return inputSchema33();
|
|
200389
200776
|
},
|
|
200390
200777
|
get outputSchema() {
|
|
200391
|
-
return
|
|
200778
|
+
return outputSchema29();
|
|
200392
200779
|
},
|
|
200393
200780
|
userFacingName() {
|
|
200394
200781
|
return "TaskList";
|
|
@@ -200457,7 +200844,7 @@ var exports_CronCreateTool = {};
|
|
|
200457
200844
|
__export(exports_CronCreateTool, {
|
|
200458
200845
|
CronCreateTool: () => CronCreateTool
|
|
200459
200846
|
});
|
|
200460
|
-
var MAX_JOBS = 50, MAX_CRON_PROMPT_CHARS = 1e4,
|
|
200847
|
+
var MAX_JOBS = 50, MAX_CRON_PROMPT_CHARS = 1e4, inputSchema34, outputSchema30, CronCreateTool;
|
|
200461
200848
|
var init_CronCreateTool = __esm(() => {
|
|
200462
200849
|
init_v4();
|
|
200463
200850
|
init_state();
|
|
@@ -200468,13 +200855,13 @@ var init_CronCreateTool = __esm(() => {
|
|
|
200468
200855
|
init_teammateContext();
|
|
200469
200856
|
init_prompt7();
|
|
200470
200857
|
init_UI();
|
|
200471
|
-
|
|
200858
|
+
inputSchema34 = lazySchema(() => exports_external.strictObject({
|
|
200472
200859
|
cron: exports_external.string().describe('Standard 5-field cron expression in local time: "M H DoM Mon DoW" (e.g. "*/5 * * * *" = every 5 minutes, "30 14 28 2 *" = Feb 28 at 2:30pm local once).'),
|
|
200473
200860
|
prompt: exports_external.string().describe("The prompt to enqueue at each fire time."),
|
|
200474
200861
|
recurring: semanticBoolean(exports_external.boolean().optional()).describe(`true (default) = fire on every cron match until deleted or auto-expired after ${DEFAULT_MAX_AGE_DAYS} days. false = fire once at the next match, then auto-delete. Use false for "remind me at X" one-shot requests with pinned minute/hour/dom/month.`),
|
|
200475
200862
|
durable: semanticBoolean(exports_external.boolean().optional()).describe("true = persist to .ather-code/scheduled_tasks.json and survive restarts. false (default) = in-memory only, dies when this AtherCode session ends. Use true only when the user asks the task to survive across sessions.")
|
|
200476
200863
|
}));
|
|
200477
|
-
|
|
200864
|
+
outputSchema30 = lazySchema(() => exports_external.object({
|
|
200478
200865
|
id: exports_external.string(),
|
|
200479
200866
|
humanSchedule: exports_external.string(),
|
|
200480
200867
|
recurring: exports_external.boolean(),
|
|
@@ -200486,10 +200873,10 @@ var init_CronCreateTool = __esm(() => {
|
|
|
200486
200873
|
maxResultSizeChars: 1e5,
|
|
200487
200874
|
shouldDefer: true,
|
|
200488
200875
|
get inputSchema() {
|
|
200489
|
-
return
|
|
200876
|
+
return inputSchema34();
|
|
200490
200877
|
},
|
|
200491
200878
|
get outputSchema() {
|
|
200492
|
-
return
|
|
200879
|
+
return outputSchema30();
|
|
200493
200880
|
},
|
|
200494
200881
|
isEnabled() {
|
|
200495
200882
|
return isKairosCronEnabled();
|
|
@@ -200576,7 +200963,7 @@ var exports_CronDeleteTool = {};
|
|
|
200576
200963
|
__export(exports_CronDeleteTool, {
|
|
200577
200964
|
CronDeleteTool: () => CronDeleteTool
|
|
200578
200965
|
});
|
|
200579
|
-
var
|
|
200966
|
+
var inputSchema35, outputSchema31, CronDeleteTool;
|
|
200580
200967
|
var init_CronDeleteTool = __esm(() => {
|
|
200581
200968
|
init_v4();
|
|
200582
200969
|
init_Tool();
|
|
@@ -200584,10 +200971,10 @@ var init_CronDeleteTool = __esm(() => {
|
|
|
200584
200971
|
init_teammateContext();
|
|
200585
200972
|
init_prompt7();
|
|
200586
200973
|
init_UI();
|
|
200587
|
-
|
|
200974
|
+
inputSchema35 = lazySchema(() => exports_external.strictObject({
|
|
200588
200975
|
id: exports_external.string().describe("Job ID returned by CronCreate.")
|
|
200589
200976
|
}));
|
|
200590
|
-
|
|
200977
|
+
outputSchema31 = lazySchema(() => exports_external.object({
|
|
200591
200978
|
id: exports_external.string()
|
|
200592
200979
|
}));
|
|
200593
200980
|
CronDeleteTool = buildTool({
|
|
@@ -200596,10 +200983,10 @@ var init_CronDeleteTool = __esm(() => {
|
|
|
200596
200983
|
maxResultSizeChars: 1e5,
|
|
200597
200984
|
shouldDefer: true,
|
|
200598
200985
|
get inputSchema() {
|
|
200599
|
-
return
|
|
200986
|
+
return inputSchema35();
|
|
200600
200987
|
},
|
|
200601
200988
|
get outputSchema() {
|
|
200602
|
-
return
|
|
200989
|
+
return outputSchema31();
|
|
200603
200990
|
},
|
|
200604
200991
|
isEnabled() {
|
|
200605
200992
|
return isKairosCronEnabled();
|
|
@@ -200657,7 +201044,7 @@ var exports_CronListTool = {};
|
|
|
200657
201044
|
__export(exports_CronListTool, {
|
|
200658
201045
|
CronListTool: () => CronListTool
|
|
200659
201046
|
});
|
|
200660
|
-
var
|
|
201047
|
+
var inputSchema36, outputSchema32, CronListTool;
|
|
200661
201048
|
var init_CronListTool = __esm(() => {
|
|
200662
201049
|
init_v4();
|
|
200663
201050
|
init_Tool();
|
|
@@ -200667,8 +201054,8 @@ var init_CronListTool = __esm(() => {
|
|
|
200667
201054
|
init_teammateContext();
|
|
200668
201055
|
init_prompt7();
|
|
200669
201056
|
init_UI();
|
|
200670
|
-
|
|
200671
|
-
|
|
201057
|
+
inputSchema36 = lazySchema(() => exports_external.strictObject({}));
|
|
201058
|
+
outputSchema32 = lazySchema(() => exports_external.object({
|
|
200672
201059
|
jobs: exports_external.array(exports_external.object({
|
|
200673
201060
|
id: exports_external.string(),
|
|
200674
201061
|
cron: exports_external.string(),
|
|
@@ -200684,10 +201071,10 @@ var init_CronListTool = __esm(() => {
|
|
|
200684
201071
|
maxResultSizeChars: 1e5,
|
|
200685
201072
|
shouldDefer: true,
|
|
200686
201073
|
get inputSchema() {
|
|
200687
|
-
return
|
|
201074
|
+
return inputSchema36();
|
|
200688
201075
|
},
|
|
200689
201076
|
get outputSchema() {
|
|
200690
|
-
return
|
|
201077
|
+
return outputSchema32();
|
|
200691
201078
|
},
|
|
200692
201079
|
isEnabled() {
|
|
200693
201080
|
return isKairosCronEnabled();
|
|
@@ -208884,7 +209271,7 @@ __export(exports_MonitorTool, {
|
|
|
208884
209271
|
MonitorTool: () => MonitorTool,
|
|
208885
209272
|
MONITOR_TOOL_NAME: () => MONITOR_TOOL_NAME
|
|
208886
209273
|
});
|
|
208887
|
-
var MONITOR_TOOL_NAME = "Monitor", MONITOR_TIMEOUT_MS,
|
|
209274
|
+
var MONITOR_TOOL_NAME = "Monitor", MONITOR_TIMEOUT_MS, inputSchema37, outputSchema33, MonitorTool;
|
|
208888
209275
|
var init_MonitorTool = __esm(() => {
|
|
208889
209276
|
init_v4();
|
|
208890
209277
|
init_Tool();
|
|
@@ -208894,11 +209281,11 @@ var init_MonitorTool = __esm(() => {
|
|
|
208894
209281
|
init_bashPermissions();
|
|
208895
209282
|
init_ast();
|
|
208896
209283
|
MONITOR_TIMEOUT_MS = 30 * 60 * 1000;
|
|
208897
|
-
|
|
209284
|
+
inputSchema37 = lazySchema(() => exports_external.strictObject({
|
|
208898
209285
|
command: exports_external.string().describe("The shell command to run and monitor"),
|
|
208899
209286
|
description: exports_external.string().describe("Clear, concise description of what this command does in active voice.")
|
|
208900
209287
|
}));
|
|
208901
|
-
|
|
209288
|
+
outputSchema33 = lazySchema(() => exports_external.object({
|
|
208902
209289
|
taskId: exports_external.string().describe("The ID of the background monitor task"),
|
|
208903
209290
|
outputFile: exports_external.string().describe("Path to the file where output is being written")
|
|
208904
209291
|
}));
|
|
@@ -208939,10 +209326,10 @@ var init_MonitorTool = __esm(() => {
|
|
|
208939
209326
|
return `Execute a shell command in the background and stream its stdout line-by-line as notifications. Each polling interval (~1s), new output lines are delivered to you. Use this for monitoring logs, watching build output, or observing long-running processes. For one-shot "wait until done" commands, prefer Bash with run_in_background instead.`;
|
|
208940
209327
|
},
|
|
208941
209328
|
get inputSchema() {
|
|
208942
|
-
return
|
|
209329
|
+
return inputSchema37();
|
|
208943
209330
|
},
|
|
208944
209331
|
get outputSchema() {
|
|
208945
|
-
return
|
|
209332
|
+
return outputSchema33();
|
|
208946
209333
|
},
|
|
208947
209334
|
userFacingName() {
|
|
208948
209335
|
return "Monitor";
|
|
@@ -209195,7 +209582,7 @@ __export(exports_teamHelpers, {
|
|
|
209195
209582
|
registerTeamForSessionCleanup: () => registerTeamForSessionCleanup,
|
|
209196
209583
|
readTeamFileAsync: () => readTeamFileAsync,
|
|
209197
209584
|
readTeamFile: () => readTeamFile,
|
|
209198
|
-
inputSchema: () =>
|
|
209585
|
+
inputSchema: () => inputSchema38,
|
|
209199
209586
|
getTeamFilePath: () => getTeamFilePath,
|
|
209200
209587
|
getTeamDir: () => getTeamDir,
|
|
209201
209588
|
cleanupTeamDirectories: () => cleanupTeamDirectories,
|
|
@@ -209203,8 +209590,8 @@ __export(exports_teamHelpers, {
|
|
|
209203
209590
|
addHiddenPaneId: () => addHiddenPaneId
|
|
209204
209591
|
});
|
|
209205
209592
|
import { mkdirSync as mkdirSync8, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
|
|
209206
|
-
import { mkdir as
|
|
209207
|
-
import { join as
|
|
209593
|
+
import { mkdir as mkdir20, readFile as readFile21, rm as rm3, writeFile as writeFile18 } from "fs/promises";
|
|
209594
|
+
import { join as join78 } from "path";
|
|
209208
209595
|
function sanitizeName(name) {
|
|
209209
209596
|
return name.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
209210
209597
|
}
|
|
@@ -209212,10 +209599,10 @@ function sanitizeAgentName(name) {
|
|
|
209212
209599
|
return name.replace(/@/g, "-");
|
|
209213
209600
|
}
|
|
209214
209601
|
function getTeamDir(teamName) {
|
|
209215
|
-
return
|
|
209602
|
+
return join78(getTeamsDir(), sanitizeName(teamName));
|
|
209216
209603
|
}
|
|
209217
209604
|
function getTeamFilePath(teamName) {
|
|
209218
|
-
return
|
|
209605
|
+
return join78(getTeamDir(teamName), "config.json");
|
|
209219
209606
|
}
|
|
209220
209607
|
function readTeamFile(teamName) {
|
|
209221
209608
|
try {
|
|
@@ -209230,7 +209617,7 @@ function readTeamFile(teamName) {
|
|
|
209230
209617
|
}
|
|
209231
209618
|
async function readTeamFileAsync(teamName) {
|
|
209232
209619
|
try {
|
|
209233
|
-
const content = await
|
|
209620
|
+
const content = await readFile21(getTeamFilePath(teamName), "utf-8");
|
|
209234
209621
|
return jsonParse(content);
|
|
209235
209622
|
} catch (e) {
|
|
209236
209623
|
if (getErrnoCode(e) === "ENOENT")
|
|
@@ -209246,8 +209633,8 @@ function writeTeamFile(teamName, teamFile) {
|
|
|
209246
209633
|
}
|
|
209247
209634
|
async function writeTeamFileAsync(teamName, teamFile) {
|
|
209248
209635
|
const teamDir = getTeamDir(teamName);
|
|
209249
|
-
await
|
|
209250
|
-
await
|
|
209636
|
+
await mkdir20(teamDir, { recursive: true });
|
|
209637
|
+
await writeFile18(getTeamFilePath(teamName), jsonStringify(teamFile, null, 2));
|
|
209251
209638
|
}
|
|
209252
209639
|
function removeTeammateFromTeamFile(teamName, identifier) {
|
|
209253
209640
|
const identifierStr = identifier.agentId || identifier.name;
|
|
@@ -209406,15 +209793,15 @@ async function setMemberActive(teamName, memberName, isActive) {
|
|
|
209406
209793
|
logForDebugging(`[TeammateTool] Set member ${memberName} in team ${teamName} to ${isActive ? "active" : "idle"}`);
|
|
209407
209794
|
}
|
|
209408
209795
|
async function destroyWorktree(worktreePath) {
|
|
209409
|
-
const gitFilePath =
|
|
209796
|
+
const gitFilePath = join78(worktreePath, ".git");
|
|
209410
209797
|
let mainRepoPath = null;
|
|
209411
209798
|
try {
|
|
209412
|
-
const gitFileContent = (await
|
|
209799
|
+
const gitFileContent = (await readFile21(gitFilePath, "utf-8")).trim();
|
|
209413
209800
|
const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
|
|
209414
209801
|
if (match && match[1]) {
|
|
209415
209802
|
const worktreeGitDir = match[1];
|
|
209416
|
-
const mainGitDir =
|
|
209417
|
-
mainRepoPath =
|
|
209803
|
+
const mainGitDir = join78(worktreeGitDir, "..", "..");
|
|
209804
|
+
mainRepoPath = join78(mainGitDir, "..");
|
|
209418
209805
|
}
|
|
209419
209806
|
} catch {}
|
|
209420
209807
|
if (mainRepoPath) {
|
|
@@ -209503,7 +209890,7 @@ async function cleanupTeamDirectories(teamName) {
|
|
|
209503
209890
|
logForDebugging(`[TeammateTool] Failed to clean up tasks directory ${tasksDir}: ${errorMessage(error40)}`);
|
|
209504
209891
|
}
|
|
209505
209892
|
}
|
|
209506
|
-
var
|
|
209893
|
+
var inputSchema38;
|
|
209507
209894
|
var init_teamHelpers = __esm(() => {
|
|
209508
209895
|
init_v4();
|
|
209509
209896
|
init_state();
|
|
@@ -209515,7 +209902,7 @@ var init_teamHelpers = __esm(() => {
|
|
|
209515
209902
|
init_slowOperations();
|
|
209516
209903
|
init_tasks2();
|
|
209517
209904
|
init_teammate();
|
|
209518
|
-
|
|
209905
|
+
inputSchema38 = lazySchema(() => exports_external.strictObject({
|
|
209519
209906
|
operation: exports_external.enum(["spawnTeam", "cleanup"]).describe("Operation: spawnTeam to create a team, cleanup to remove team and task directories."),
|
|
209520
209907
|
agent_type: exports_external.string().optional().describe('Type/role of the team lead (e.g., "researcher", "test-runner"). ' + "Used for team file and inter-agent coordination."),
|
|
209521
209908
|
team_name: exports_external.string().optional().describe("Name for the new team to create (required for spawnTeam)."),
|
|
@@ -212336,7 +212723,7 @@ function generateUniqueTeamName(providedName) {
|
|
|
212336
212723
|
}
|
|
212337
212724
|
return generateWordSlug();
|
|
212338
212725
|
}
|
|
212339
|
-
var
|
|
212726
|
+
var inputSchema39, TeamCreateTool;
|
|
212340
212727
|
var init_TeamCreateTool = __esm(() => {
|
|
212341
212728
|
init_v4();
|
|
212342
212729
|
init_state();
|
|
@@ -212351,7 +212738,7 @@ var init_TeamCreateTool = __esm(() => {
|
|
|
212351
212738
|
init_tasks2();
|
|
212352
212739
|
init_words();
|
|
212353
212740
|
init_UI();
|
|
212354
|
-
|
|
212741
|
+
inputSchema39 = lazySchema(() => exports_external.strictObject({
|
|
212355
212742
|
team_name: exports_external.string().describe("Name for the new team to create."),
|
|
212356
212743
|
description: exports_external.string().optional().describe("Team description/purpose."),
|
|
212357
212744
|
agent_type: exports_external.string().optional().describe('Type/role of the team lead (e.g., "researcher", "test-runner"). ' + "Used for team file and inter-agent coordination.")
|
|
@@ -212365,7 +212752,7 @@ var init_TeamCreateTool = __esm(() => {
|
|
|
212365
212752
|
return "";
|
|
212366
212753
|
},
|
|
212367
212754
|
get inputSchema() {
|
|
212368
|
-
return
|
|
212755
|
+
return inputSchema39();
|
|
212369
212756
|
},
|
|
212370
212757
|
isEnabled() {
|
|
212371
212758
|
return isAgentSwarmsEnabled();
|
|
@@ -212499,7 +212886,7 @@ var exports_TeamDeleteTool = {};
|
|
|
212499
212886
|
__export(exports_TeamDeleteTool, {
|
|
212500
212887
|
TeamDeleteTool: () => TeamDeleteTool
|
|
212501
212888
|
});
|
|
212502
|
-
var
|
|
212889
|
+
var inputSchema40, TeamDeleteTool;
|
|
212503
212890
|
var init_TeamDeleteTool = __esm(() => {
|
|
212504
212891
|
init_v4();
|
|
212505
212892
|
init_Tool();
|
|
@@ -212509,7 +212896,7 @@ var init_TeamDeleteTool = __esm(() => {
|
|
|
212509
212896
|
init_teammateLayoutManager();
|
|
212510
212897
|
init_tasks2();
|
|
212511
212898
|
init_UI();
|
|
212512
|
-
|
|
212899
|
+
inputSchema40 = lazySchema(() => exports_external.strictObject({}));
|
|
212513
212900
|
TeamDeleteTool = buildTool({
|
|
212514
212901
|
name: TEAM_DELETE_TOOL_NAME,
|
|
212515
212902
|
searchHint: "disband a swarm team and clean up",
|
|
@@ -212519,7 +212906,7 @@ var init_TeamDeleteTool = __esm(() => {
|
|
|
212519
212906
|
return "";
|
|
212520
212907
|
},
|
|
212521
212908
|
get inputSchema() {
|
|
212522
|
-
return
|
|
212909
|
+
return inputSchema40();
|
|
212523
212910
|
},
|
|
212524
212911
|
isEnabled() {
|
|
212525
212912
|
return isAgentSwarmsEnabled();
|
|
@@ -213199,7 +213586,7 @@ async function handlePlanRejection(recipientName, requestId, feedback, context2)
|
|
|
213199
213586
|
}
|
|
213200
213587
|
};
|
|
213201
213588
|
}
|
|
213202
|
-
var StructuredMessage,
|
|
213589
|
+
var StructuredMessage, inputSchema41, SendMessageTool;
|
|
213203
213590
|
var init_SendMessageTool = __esm(() => {
|
|
213204
213591
|
init_v4();
|
|
213205
213592
|
init_state();
|
|
@@ -213240,7 +213627,7 @@ var init_SendMessageTool = __esm(() => {
|
|
|
213240
213627
|
feedback: exports_external.string().optional()
|
|
213241
213628
|
})
|
|
213242
213629
|
]));
|
|
213243
|
-
|
|
213630
|
+
inputSchema41 = lazySchema(() => exports_external.object({
|
|
213244
213631
|
to: exports_external.string().describe('Recipient: teammate name, or "*" for broadcast to all teammates'),
|
|
213245
213632
|
summary: exports_external.string().optional().describe("A 5-10 word summary shown as a preview in the UI (required when message is a string)"),
|
|
213246
213633
|
message: exports_external.union([
|
|
@@ -213256,7 +213643,7 @@ var init_SendMessageTool = __esm(() => {
|
|
|
213256
213643
|
return "SendMessage";
|
|
213257
213644
|
},
|
|
213258
213645
|
get inputSchema() {
|
|
213259
|
-
return
|
|
213646
|
+
return inputSchema41();
|
|
213260
213647
|
},
|
|
213261
213648
|
shouldDefer: true,
|
|
213262
213649
|
isEnabled() {
|
|
@@ -213674,7 +214061,7 @@ __export(exports_contextCollapse, {
|
|
|
213674
214061
|
getCommitLogForProjection: () => getCommitLogForProjection,
|
|
213675
214062
|
applyCollapsesIfNeeded: () => applyCollapsesIfNeeded
|
|
213676
214063
|
});
|
|
213677
|
-
import { randomUUID as
|
|
214064
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
213678
214065
|
function isContextCollapseEnabled() {
|
|
213679
214066
|
return enabled;
|
|
213680
214067
|
}
|
|
@@ -213797,7 +214184,7 @@ function drainStaged(messages, persist) {
|
|
|
213797
214184
|
continue;
|
|
213798
214185
|
const archivedCount = lastIdx - firstIdx + 1;
|
|
213799
214186
|
const collapseId = deriveCollapseId(span.startUuid);
|
|
213800
|
-
const summaryUuid =
|
|
214187
|
+
const summaryUuid = randomUUID12();
|
|
213801
214188
|
const summaryContent = buildCollapsePlaceholder(collapseId, span.summary);
|
|
213802
214189
|
const placeholder = {
|
|
213803
214190
|
type: "system",
|
|
@@ -214041,11 +214428,11 @@ var exports_CtxInspectTool = {};
|
|
|
214041
214428
|
__export(exports_CtxInspectTool, {
|
|
214042
214429
|
CtxInspectTool: () => CtxInspectTool
|
|
214043
214430
|
});
|
|
214044
|
-
var
|
|
214431
|
+
var inputSchema42, CtxInspectTool;
|
|
214045
214432
|
var init_CtxInspectTool = __esm(() => {
|
|
214046
214433
|
init_v4();
|
|
214047
214434
|
init_Tool();
|
|
214048
|
-
|
|
214435
|
+
inputSchema42 = lazySchema(() => exports_external.strictObject({}));
|
|
214049
214436
|
CtxInspectTool = buildTool({
|
|
214050
214437
|
name: CTX_INSPECT_TOOL_NAME,
|
|
214051
214438
|
isEnabled() {
|
|
@@ -214065,7 +214452,7 @@ var init_CtxInspectTool = __esm(() => {
|
|
|
214065
214452
|
return getPrompt9();
|
|
214066
214453
|
},
|
|
214067
214454
|
get inputSchema() {
|
|
214068
|
-
return
|
|
214455
|
+
return inputSchema42();
|
|
214069
214456
|
},
|
|
214070
214457
|
async call(_input, _context) {
|
|
214071
214458
|
const { getStats: getStats2, getContextCollapseState: getContextCollapseState2 } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
|
|
@@ -214132,7 +214519,7 @@ __export(exports_snipCompact, {
|
|
|
214132
214519
|
_resetForTesting: () => _resetForTesting2,
|
|
214133
214520
|
SNIP_NUDGE_TEXT: () => SNIP_NUDGE_TEXT
|
|
214134
214521
|
});
|
|
214135
|
-
import { randomUUID as
|
|
214522
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
214136
214523
|
function normalizeSnipShortId(shortId) {
|
|
214137
214524
|
const trimmed = shortId.trim();
|
|
214138
214525
|
const snipMetadataMatch = /\bsnip_id=([a-z0-9]{6})\b/i.exec(trimmed);
|
|
@@ -214290,7 +214677,7 @@ function snipCompactIfNeeded(messages) {
|
|
|
214290
214677
|
content: "Conversation history snipped",
|
|
214291
214678
|
isMeta: false,
|
|
214292
214679
|
timestamp: new Date().toISOString(),
|
|
214293
|
-
uuid:
|
|
214680
|
+
uuid: randomUUID13(),
|
|
214294
214681
|
level: "info",
|
|
214295
214682
|
snipMetadata: {
|
|
214296
214683
|
removedUuids: [...removedUuids]
|
|
@@ -214316,11 +214703,11 @@ var exports_SnipTool = {};
|
|
|
214316
214703
|
__export(exports_SnipTool, {
|
|
214317
214704
|
SnipTool: () => SnipTool
|
|
214318
214705
|
});
|
|
214319
|
-
var
|
|
214706
|
+
var inputSchema43, SnipTool;
|
|
214320
214707
|
var init_SnipTool = __esm(() => {
|
|
214321
214708
|
init_v4();
|
|
214322
214709
|
init_Tool();
|
|
214323
|
-
|
|
214710
|
+
inputSchema43 = lazySchema(() => exports_external.object({
|
|
214324
214711
|
message_ids: exports_external.array(exports_external.string()).describe("Short internal snip message IDs to remove.")
|
|
214325
214712
|
}));
|
|
214326
214713
|
SnipTool = buildTool({
|
|
@@ -214341,7 +214728,7 @@ var init_SnipTool = __esm(() => {
|
|
|
214341
214728
|
return getPrompt10();
|
|
214342
214729
|
},
|
|
214343
214730
|
get inputSchema() {
|
|
214344
|
-
return
|
|
214731
|
+
return inputSchema43();
|
|
214345
214732
|
},
|
|
214346
214733
|
async call(input, context2) {
|
|
214347
214734
|
const { markForSnip: markForSnip2 } = (init_snipCompact(), __toCommonJS(exports_snipCompact));
|
|
@@ -214402,6 +214789,7 @@ function getAllBaseTools() {
|
|
|
214402
214789
|
WebFetchTool,
|
|
214403
214790
|
TodoWriteTool,
|
|
214404
214791
|
WebSearchTool,
|
|
214792
|
+
InstagramTool,
|
|
214405
214793
|
TaskStopTool,
|
|
214406
214794
|
AskUserQuestionTool,
|
|
214407
214795
|
SkillTool,
|
|
@@ -214507,6 +214895,7 @@ var init_tools2 = __esm(() => {
|
|
|
214507
214895
|
init_GlobTool();
|
|
214508
214896
|
init_NotebookEditTool();
|
|
214509
214897
|
init_WebFetchTool();
|
|
214898
|
+
init_InstagramTool();
|
|
214510
214899
|
init_TaskStopTool();
|
|
214511
214900
|
init_BriefTool();
|
|
214512
214901
|
init_TaskOutputTool();
|
|
@@ -215309,7 +215698,7 @@ var exports_AgentTool = {};
|
|
|
215309
215698
|
__export(exports_AgentTool, {
|
|
215310
215699
|
resolveAgentToolEffectiveIsolation: () => resolveAgentToolEffectiveIsolation,
|
|
215311
215700
|
resolveAgentToolCwdOverride: () => resolveAgentToolCwdOverride,
|
|
215312
|
-
outputSchema: () =>
|
|
215701
|
+
outputSchema: () => outputSchema34,
|
|
215313
215702
|
isMissingGitAgentWorktreeError: () => isMissingGitAgentWorktreeError,
|
|
215314
215703
|
inputSchema: () => inputSchema8,
|
|
215315
215704
|
fullInputSchema: () => fullInputSchema,
|
|
@@ -215379,7 +215768,7 @@ function resolveTeamName(input, appState) {
|
|
|
215379
215768
|
return;
|
|
215380
215769
|
return input.team_name || appState.teamContext?.teamName;
|
|
215381
215770
|
}
|
|
215382
|
-
var proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled, baseInputSchema, fullInputSchema, inputSchema8,
|
|
215771
|
+
var proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled, baseInputSchema, fullInputSchema, inputSchema8, outputSchema34, AgentTool;
|
|
215383
215772
|
var init_AgentTool = __esm(() => {
|
|
215384
215773
|
init_Tool();
|
|
215385
215774
|
init_promptCategory();
|
|
@@ -215458,7 +215847,7 @@ var init_AgentTool = __esm(() => {
|
|
|
215458
215847
|
run_in_background: true
|
|
215459
215848
|
}) : schema;
|
|
215460
215849
|
});
|
|
215461
|
-
|
|
215850
|
+
outputSchema34 = lazySchema(() => {
|
|
215462
215851
|
const syncOutputSchema = agentToolResultSchema().extend({
|
|
215463
215852
|
status: exports_external.literal("completed"),
|
|
215464
215853
|
prompt: exports_external.string(),
|
|
@@ -215512,7 +215901,7 @@ var init_AgentTool = __esm(() => {
|
|
|
215512
215901
|
return inputSchema8();
|
|
215513
215902
|
},
|
|
215514
215903
|
get outputSchema() {
|
|
215515
|
-
return
|
|
215904
|
+
return outputSchema34();
|
|
215516
215905
|
},
|
|
215517
215906
|
async call({
|
|
215518
215907
|
prompt,
|
|
@@ -217645,7 +218034,7 @@ var init_memoryTypes = __esm(() => {
|
|
|
217645
218034
|
|
|
217646
218035
|
// src/memdir/memoryScan.ts
|
|
217647
218036
|
import { readdir as readdir14 } from "fs/promises";
|
|
217648
|
-
import { join as
|
|
218037
|
+
import { join as join79 } from "path";
|
|
217649
218038
|
async function scanMemoryFiles(memoryDir, signal) {
|
|
217650
218039
|
return scanMemoryFilesWithDependencies(memoryDir, signal, defaultDependencies2);
|
|
217651
218040
|
}
|
|
@@ -217702,8 +218091,8 @@ async function* walkMarkdownFiles(memoryDir, signal, deps) {
|
|
|
217702
218091
|
}
|
|
217703
218092
|
for (const entry of entries) {
|
|
217704
218093
|
signal.throwIfAborted();
|
|
217705
|
-
const relativePath = current2.relativePath ?
|
|
217706
|
-
const absolutePath =
|
|
218094
|
+
const relativePath = current2.relativePath ? join79(current2.relativePath, entry.name) : entry.name;
|
|
218095
|
+
const absolutePath = join79(memoryDir, relativePath);
|
|
217707
218096
|
const isMarkdownMemoryFile = entry.name.endsWith(".md") && entry.name !== "MEMORY.md";
|
|
217708
218097
|
if (entry.isSymbolicLink()) {
|
|
217709
218098
|
if (isMarkdownMemoryFile) {
|
|
@@ -217726,7 +218115,7 @@ async function* walkMarkdownFiles(memoryDir, signal, deps) {
|
|
|
217726
218115
|
}
|
|
217727
218116
|
async function readMemoryHeader(memoryDir, relativePath, signal, deps) {
|
|
217728
218117
|
signal.throwIfAborted();
|
|
217729
|
-
const filePath =
|
|
218118
|
+
const filePath = join79(memoryDir, relativePath);
|
|
217730
218119
|
const { content, mtimeMs } = await deps.readFileInRange(filePath, 0, FRONTMATTER_MAX_LINES, FRONTMATTER_MAX_BYTES, signal, { truncateOnByteLimit: true });
|
|
217731
218120
|
const { frontmatter } = parseFrontmatter(content, filePath);
|
|
217732
218121
|
const description = typeof frontmatter.description === "string" && frontmatter.description ? frontmatter.description : null;
|
|
@@ -217849,8 +218238,8 @@ var init_findRelevantMemories = __esm(() => {
|
|
|
217849
218238
|
|
|
217850
218239
|
// src/utils/attachments.ts
|
|
217851
218240
|
import { readdir as readdir15, stat as stat22 } from "fs/promises";
|
|
217852
|
-
import nodePath2, { dirname as
|
|
217853
|
-
import { randomUUID as
|
|
218241
|
+
import nodePath2, { dirname as dirname42, parse as parse10, relative as relative12, resolve as resolve28 } from "path";
|
|
218242
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
217854
218243
|
function shouldIncludeSkillListingAttachment(querySource) {
|
|
217855
218244
|
return !(typeof querySource === "string" && SKILL_LISTING_SUPPRESSED_QUERY_SOURCES.has(querySource));
|
|
217856
218245
|
}
|
|
@@ -218326,21 +218715,21 @@ function isPathUnder(child, parent, pathApi = nodePath2) {
|
|
|
218326
218715
|
return stripTrailingSep(pathApi.join(parent, rel)) === stripTrailingSep(pathApi.normalize(child));
|
|
218327
218716
|
}
|
|
218328
218717
|
function getDirectoriesToProcess(targetPath, originalCwd) {
|
|
218329
|
-
const targetDir =
|
|
218718
|
+
const targetDir = dirname42(resolve28(targetPath));
|
|
218330
218719
|
const nestedDirs = [];
|
|
218331
218720
|
let currentDir = targetDir;
|
|
218332
218721
|
while (currentDir !== originalCwd && currentDir !== parse10(currentDir).root) {
|
|
218333
218722
|
if (isPathUnder(currentDir, originalCwd)) {
|
|
218334
218723
|
nestedDirs.push(currentDir);
|
|
218335
218724
|
}
|
|
218336
|
-
currentDir =
|
|
218725
|
+
currentDir = dirname42(currentDir);
|
|
218337
218726
|
}
|
|
218338
218727
|
nestedDirs.reverse();
|
|
218339
218728
|
const cwdLevelDirs = [];
|
|
218340
218729
|
currentDir = originalCwd;
|
|
218341
218730
|
while (currentDir !== parse10(currentDir).root) {
|
|
218342
218731
|
cwdLevelDirs.push(currentDir);
|
|
218343
|
-
currentDir =
|
|
218732
|
+
currentDir = dirname42(currentDir);
|
|
218344
218733
|
}
|
|
218345
218734
|
cwdLevelDirs.reverse();
|
|
218346
218735
|
return { nestedDirs, cwdLevelDirs };
|
|
@@ -218509,8 +218898,8 @@ async function processMcpResourceAttachments(input, toolUseContext) {
|
|
|
218509
218898
|
logEvent("ather_at_mention_mcp_resource_error", {});
|
|
218510
218899
|
return null;
|
|
218511
218900
|
}
|
|
218512
|
-
const
|
|
218513
|
-
if (!
|
|
218901
|
+
const client2 = mcpClients.find((c7) => c7.name === serverName);
|
|
218902
|
+
if (!client2 || client2.type !== "connected") {
|
|
218514
218903
|
logEvent("ather_at_mention_mcp_resource_error", {});
|
|
218515
218904
|
return null;
|
|
218516
218905
|
}
|
|
@@ -218521,7 +218910,7 @@ async function processMcpResourceAttachments(input, toolUseContext) {
|
|
|
218521
218910
|
return null;
|
|
218522
218911
|
}
|
|
218523
218912
|
try {
|
|
218524
|
-
const result = await
|
|
218913
|
+
const result = await client2.client.readResource({
|
|
218525
218914
|
uri
|
|
218526
218915
|
});
|
|
218527
218916
|
logEvent("ather_at_mention_mcp_resource_success", {});
|
|
@@ -219145,7 +219534,7 @@ function createAttachmentMessage(attachment) {
|
|
|
219145
219534
|
return {
|
|
219146
219535
|
attachment,
|
|
219147
219536
|
type: "attachment",
|
|
219148
|
-
uuid:
|
|
219537
|
+
uuid: randomUUID14(),
|
|
219149
219538
|
timestamp: new Date().toISOString()
|
|
219150
219539
|
};
|
|
219151
219540
|
}
|
|
@@ -223131,7 +223520,7 @@ function findMcpServerConnection(toolName, mcpClients) {
|
|
|
223131
223520
|
if (!mcpInfo) {
|
|
223132
223521
|
return;
|
|
223133
223522
|
}
|
|
223134
|
-
return mcpClients.find((
|
|
223523
|
+
return mcpClients.find((client2) => normalizeNameForMCP(client2.name) === mcpInfo.serverName);
|
|
223135
223524
|
}
|
|
223136
223525
|
function getMcpServerType(toolName, mcpClients) {
|
|
223137
223526
|
const serverConnection = findMcpServerConnection(toolName, mcpClients);
|
|
@@ -225797,12 +226186,12 @@ import {
|
|
|
225797
226186
|
statSync as statSync7,
|
|
225798
226187
|
unlinkSync as unlinkSync3
|
|
225799
226188
|
} from "node:fs";
|
|
225800
|
-
import { join as
|
|
226189
|
+
import { join as join80 } from "node:path";
|
|
225801
226190
|
function logDir() {
|
|
225802
|
-
return
|
|
226191
|
+
return join80(getAtherCodeConfigHomeDir(), LOG_DIR_NAME);
|
|
225803
226192
|
}
|
|
225804
226193
|
function logFile() {
|
|
225805
|
-
return
|
|
226194
|
+
return join80(logDir(), LOG_FILE_NAME);
|
|
225806
226195
|
}
|
|
225807
226196
|
function ensureLogFile() {
|
|
225808
226197
|
const dir = logDir();
|
|
@@ -226010,13 +226399,13 @@ var init_config7 = __esm(() => {
|
|
|
226010
226399
|
});
|
|
226011
226400
|
|
|
226012
226401
|
// src/query/deps.ts
|
|
226013
|
-
import { randomUUID as
|
|
226402
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
226014
226403
|
function productionDeps() {
|
|
226015
226404
|
return {
|
|
226016
226405
|
callModel: queryModelWithStreaming,
|
|
226017
226406
|
microcompact: microcompactMessages,
|
|
226018
226407
|
autocompact: autoCompactIfNeeded,
|
|
226019
|
-
uuid:
|
|
226408
|
+
uuid: randomUUID15
|
|
226020
226409
|
};
|
|
226021
226410
|
}
|
|
226022
226411
|
var init_deps = __esm(() => {
|
|
@@ -226318,9 +226707,9 @@ var init_memorySecurity = __esm(() => {
|
|
|
226318
226707
|
|
|
226319
226708
|
// src/memdir/autoExtractFacts.ts
|
|
226320
226709
|
import { writeFileSync as writeFileSync7, existsSync as existsSync11, mkdirSync as mkdirSync10, readFileSync as readFileSync14 } from "fs";
|
|
226321
|
-
import { join as
|
|
226710
|
+
import { join as join81 } from "path";
|
|
226322
226711
|
function ensureFactsDir(memoryDir) {
|
|
226323
|
-
const dir =
|
|
226712
|
+
const dir = join81(memoryDir, FACTS_SUBDIR);
|
|
226324
226713
|
try {
|
|
226325
226714
|
if (!existsSync11(dir)) {
|
|
226326
226715
|
mkdirSync10(dir, { recursive: true });
|
|
@@ -226402,7 +226791,7 @@ function writeFactMemory(memoryDir, factType, name, description, attributes = {}
|
|
|
226402
226791
|
return false;
|
|
226403
226792
|
const slug = `${slugify(safeName)}-${getShortHash(safeName)}`;
|
|
226404
226793
|
const filename = `fact-${factType}-${slug}.md`;
|
|
226405
|
-
const filePath =
|
|
226794
|
+
const filePath = join81(factsDir, filename);
|
|
226406
226795
|
const now = new Date().toISOString();
|
|
226407
226796
|
const content = `---
|
|
226408
226797
|
type: reference
|
|
@@ -226601,14 +226990,14 @@ var init_autoExtractFacts = __esm(() => {
|
|
|
226601
226990
|
// src/memdir/vectorIndex.ts
|
|
226602
226991
|
import { createHash as createHash11 } from "crypto";
|
|
226603
226992
|
import { readFileSync as readFileSync15, existsSync as existsSync12, writeFileSync as writeFileSync8, readdirSync as readdirSync4, statSync as statSync8 } from "fs";
|
|
226604
|
-
import { join as
|
|
226993
|
+
import { join as join82, relative as relative13 } from "path";
|
|
226605
226994
|
import { create as create2, insert, search } from "@orama/orama";
|
|
226606
226995
|
import { persist, restore } from "@orama/plugin-data-persistence";
|
|
226607
226996
|
function getIndexPath(memoryDir) {
|
|
226608
|
-
return
|
|
226997
|
+
return join82(memoryDir, INDEX_FILENAME);
|
|
226609
226998
|
}
|
|
226610
226999
|
function getIndexMetaPath(memoryDir) {
|
|
226611
|
-
return
|
|
227000
|
+
return join82(memoryDir, INDEX_META_FILENAME);
|
|
226612
227001
|
}
|
|
226613
227002
|
function getSortedMdFiles(memoryDir) {
|
|
226614
227003
|
const files = [];
|
|
@@ -226623,7 +227012,7 @@ function getSortedMdFiles(memoryDir) {
|
|
|
226623
227012
|
}
|
|
226624
227013
|
entries.sort((a2, b) => a2.name.localeCompare(b.name));
|
|
226625
227014
|
for (const entry of entries) {
|
|
226626
|
-
const fullPath =
|
|
227015
|
+
const fullPath = join82(dir, entry.name);
|
|
226627
227016
|
if (entry.isSymbolicLink())
|
|
226628
227017
|
continue;
|
|
226629
227018
|
if (entry.isDirectory()) {
|
|
@@ -226903,11 +227292,11 @@ __export(exports_knowledgeGraph, {
|
|
|
226903
227292
|
clearMemoryOnly: () => clearMemoryOnly
|
|
226904
227293
|
});
|
|
226905
227294
|
import { readFileSync as readFileSync16, existsSync as existsSync13, readdirSync as readdirSync5, rmSync as rmSync5, mkdirSync as mkdirSync11, writeFileSync as writeFileSync9, statSync as statSync9 } from "fs";
|
|
226906
|
-
import { join as
|
|
227295
|
+
import { join as join83 } from "path";
|
|
226907
227296
|
import { createRequire as createRequire3 } from "module";
|
|
226908
227297
|
function getFactsDir() {
|
|
226909
227298
|
const memDir = getAutoMemPath();
|
|
226910
|
-
return memDir ?
|
|
227299
|
+
return memDir ? join83(memDir, FACTS_SUBDIR2) : "";
|
|
226911
227300
|
}
|
|
226912
227301
|
function extractKeywords2(text) {
|
|
226913
227302
|
const words = text.toLowerCase().split(/[\s,;:()\"'`?]+/).filter((word) => word.length >= 2).map((word) => {
|
|
@@ -226935,10 +227324,10 @@ function getLegacyProjectKeys() {
|
|
|
226935
227324
|
return [...keys2];
|
|
226936
227325
|
}
|
|
226937
227326
|
function getLegacyGraphPaths() {
|
|
226938
|
-
return getLegacyProjectKeys().map((key) =>
|
|
227327
|
+
return getLegacyProjectKeys().map((key) => join83(getProjectsDir(), key, "knowledge_graph.json"));
|
|
226939
227328
|
}
|
|
226940
227329
|
function getLegacySqlitePaths() {
|
|
226941
|
-
return getLegacyProjectKeys().map((key) =>
|
|
227330
|
+
return getLegacyProjectKeys().map((key) => join83(getProjectsDir(), key, "knowledge.db"));
|
|
226942
227331
|
}
|
|
226943
227332
|
function slugify2(text) {
|
|
226944
227333
|
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
@@ -227300,7 +227689,7 @@ function doMigration(data, sources, projectKey) {
|
|
|
227300
227689
|
const memDir = getAutoMemPath();
|
|
227301
227690
|
if (!memDir)
|
|
227302
227691
|
return;
|
|
227303
|
-
const factsDir =
|
|
227692
|
+
const factsDir = join83(memDir, FACTS_SUBDIR2);
|
|
227304
227693
|
try {
|
|
227305
227694
|
if (!existsSync13(factsDir)) {
|
|
227306
227695
|
mkdirSync11(factsDir, { recursive: true });
|
|
@@ -227353,7 +227742,7 @@ ${attrsYaml}` : ""}
|
|
|
227353
227742
|
---
|
|
227354
227743
|
Auto-migrated from legacy store: **${safeName}**
|
|
227355
227744
|
`;
|
|
227356
|
-
writeFileSync9(
|
|
227745
|
+
writeFileSync9(join83(factsDir, `fact-${typeSlug}-${nameSlug}.md`), content, "utf-8");
|
|
227357
227746
|
count4++;
|
|
227358
227747
|
}
|
|
227359
227748
|
for (const summary of data.summaries ?? []) {
|
|
@@ -227374,7 +227763,7 @@ source: legacy_migration
|
|
|
227374
227763
|
---
|
|
227375
227764
|
${safeSummary}
|
|
227376
227765
|
`;
|
|
227377
|
-
writeFileSync9(
|
|
227766
|
+
writeFileSync9(join83(factsDir, `fact-summary-${idSlug}.md`), content, "utf-8");
|
|
227378
227767
|
count4++;
|
|
227379
227768
|
}
|
|
227380
227769
|
for (const rule of data.rules ?? []) {
|
|
@@ -227393,7 +227782,7 @@ source: legacy_migration
|
|
|
227393
227782
|
---
|
|
227394
227783
|
${safeRule}
|
|
227395
227784
|
`;
|
|
227396
|
-
writeFileSync9(
|
|
227785
|
+
writeFileSync9(join83(factsDir, `fact-rule-${slug}.md`), content, "utf-8");
|
|
227397
227786
|
count4++;
|
|
227398
227787
|
}
|
|
227399
227788
|
const relations = (data.relations ?? []).flatMap((r) => {
|
|
@@ -227422,7 +227811,7 @@ relationCount: ${relations.length}
|
|
|
227422
227811
|
${relations.map((r) => `${r.sourceId} => ${r.type} => ${r.targetId}`).join(`
|
|
227423
227812
|
`)}
|
|
227424
227813
|
`;
|
|
227425
|
-
writeFileSync9(
|
|
227814
|
+
writeFileSync9(join83(factsDir, `fact-relations-migrated.md`), relContent, "utf-8");
|
|
227426
227815
|
count4++;
|
|
227427
227816
|
}
|
|
227428
227817
|
let retirementFailed = false;
|
|
@@ -227477,7 +227866,7 @@ function getGlobalGraph() {
|
|
|
227477
227866
|
for (const file2 of files) {
|
|
227478
227867
|
if (!file2.endsWith(".md"))
|
|
227479
227868
|
continue;
|
|
227480
|
-
const filePath =
|
|
227869
|
+
const filePath = join83(factsDir, file2);
|
|
227481
227870
|
try {
|
|
227482
227871
|
const raw = readFileSync16(filePath, "utf-8");
|
|
227483
227872
|
const parsed = parseFrontmatter(raw);
|
|
@@ -227620,7 +228009,7 @@ function pruneLegacyGraphArtifacts(projectDir) {
|
|
|
227620
228009
|
for (const entry of readdirSync5(projectDir)) {
|
|
227621
228010
|
if (entry.startsWith("knowledge_graph.json.backup-") || entry.startsWith("knowledge_graph.json.cleared-") || entry.startsWith("knowledge.db.backup-") || entry.startsWith("knowledge.db.cleared-") || entry.startsWith("knowledge.db-wal.cleared-") || entry.startsWith("knowledge.db-shm.cleared-")) {
|
|
227622
228011
|
try {
|
|
227623
|
-
rmSync5(
|
|
228012
|
+
rmSync5(join83(projectDir, entry), { force: true });
|
|
227624
228013
|
} catch {}
|
|
227625
228014
|
}
|
|
227626
228015
|
}
|
|
@@ -227632,10 +228021,10 @@ function retireLegacyArtifacts(projectDir) {
|
|
|
227632
228021
|
if (!existsSync13(projectDir))
|
|
227633
228022
|
return { archived, failures };
|
|
227634
228023
|
const mainArtifacts = [
|
|
227635
|
-
|
|
227636
|
-
|
|
228024
|
+
join83(projectDir, "knowledge_graph.json"),
|
|
228025
|
+
join83(projectDir, "knowledge.db")
|
|
227637
228026
|
];
|
|
227638
|
-
const sidecars = ["-wal", "-shm"].map((s) =>
|
|
228027
|
+
const sidecars = ["-wal", "-shm"].map((s) => join83(projectDir, `knowledge.db${s}`));
|
|
227639
228028
|
const candidates = [...mainArtifacts, ...sidecars].filter((p) => existsSync13(p));
|
|
227640
228029
|
for (const live of candidates) {
|
|
227641
228030
|
const backupPath = `${live}.migration-backup`;
|
|
@@ -227670,7 +228059,7 @@ function resetGlobalGraph() {
|
|
|
227670
228059
|
const memDir = getAutoMemPath();
|
|
227671
228060
|
if (!memDir)
|
|
227672
228061
|
return { archived: [], failures: [] };
|
|
227673
|
-
const factsDir =
|
|
228062
|
+
const factsDir = join83(memDir, FACTS_SUBDIR2);
|
|
227674
228063
|
if (existsSync13(factsDir)) {
|
|
227675
228064
|
try {
|
|
227676
228065
|
rmSync5(factsDir, { recursive: true, force: true });
|
|
@@ -227689,12 +228078,12 @@ function resetGlobalGraph() {
|
|
|
227689
228078
|
} catch {}
|
|
227690
228079
|
}
|
|
227691
228080
|
for (const key of getLegacyProjectKeys()) {
|
|
227692
|
-
pruneLegacyGraphArtifacts(
|
|
228081
|
+
pruneLegacyGraphArtifacts(join83(getProjectsDir(), key));
|
|
227693
228082
|
}
|
|
227694
228083
|
const archived = [];
|
|
227695
228084
|
const failures = [];
|
|
227696
228085
|
for (const key of getLegacyProjectKeys()) {
|
|
227697
|
-
const { archived: a2, failures: f } = retireLegacyArtifacts(
|
|
228086
|
+
const { archived: a2, failures: f } = retireLegacyArtifacts(join83(getProjectsDir(), key));
|
|
227698
228087
|
archived.push(...a2);
|
|
227699
228088
|
failures.push(...f);
|
|
227700
228089
|
}
|
|
@@ -227742,13 +228131,13 @@ __export(exports_conversationArc, {
|
|
|
227742
228131
|
addDecision: () => addDecision
|
|
227743
228132
|
});
|
|
227744
228133
|
import { readFileSync as readFileSync17, writeFileSync as writeFileSync10, existsSync as existsSync14, mkdirSync as mkdirSync12, rmSync as rmSync6, readdirSync as readdirSync6 } from "fs";
|
|
227745
|
-
import { join as
|
|
227746
|
-
import { randomUUID as
|
|
228134
|
+
import { join as join84 } from "path";
|
|
228135
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
227747
228136
|
function currentProjectKey2() {
|
|
227748
228137
|
return getAutoMemPath() || "";
|
|
227749
228138
|
}
|
|
227750
228139
|
function getArcPath(memoryDir) {
|
|
227751
|
-
return
|
|
228140
|
+
return join84(memoryDir, ARC_FILENAME);
|
|
227752
228141
|
}
|
|
227753
228142
|
function safeArcText(value) {
|
|
227754
228143
|
const sanitized = sanitizeMemoryText(value);
|
|
@@ -227770,7 +228159,7 @@ function normalizeArc(value) {
|
|
|
227770
228159
|
return [];
|
|
227771
228160
|
const createdAt = typeof goal.createdAt === "number" && Number.isFinite(goal.createdAt) ? goal.createdAt : now;
|
|
227772
228161
|
const normalized = {
|
|
227773
|
-
id: sanitizeMemoryIdentifier(goal.id) ?? `goal_${
|
|
228162
|
+
id: sanitizeMemoryIdentifier(goal.id) ?? `goal_${randomUUID16()}`,
|
|
227774
228163
|
description: safeArcText(goal.description),
|
|
227775
228164
|
status: goal.status,
|
|
227776
228165
|
createdAt
|
|
@@ -227787,7 +228176,7 @@ function normalizeArc(value) {
|
|
|
227787
228176
|
if (typeof decision.description !== "string")
|
|
227788
228177
|
return [];
|
|
227789
228178
|
const normalized = {
|
|
227790
|
-
id: sanitizeMemoryIdentifier(decision.id) ?? `decision_${
|
|
228179
|
+
id: sanitizeMemoryIdentifier(decision.id) ?? `decision_${randomUUID16()}`,
|
|
227791
228180
|
description: safeArcText(decision.description),
|
|
227792
228181
|
timestamp: typeof decision.timestamp === "number" && Number.isFinite(decision.timestamp) ? decision.timestamp : now
|
|
227793
228182
|
};
|
|
@@ -227803,7 +228192,7 @@ function normalizeArc(value) {
|
|
|
227803
228192
|
if (typeof milestone.description !== "string")
|
|
227804
228193
|
return [];
|
|
227805
228194
|
return [{
|
|
227806
|
-
id: sanitizeMemoryIdentifier(milestone.id) ?? `milestone_${
|
|
228195
|
+
id: sanitizeMemoryIdentifier(milestone.id) ?? `milestone_${randomUUID16()}`,
|
|
227807
228196
|
description: safeArcText(milestone.description),
|
|
227808
228197
|
achievedAt: typeof milestone.achievedAt === "number" && Number.isFinite(milestone.achievedAt) ? milestone.achievedAt : now
|
|
227809
228198
|
}];
|
|
@@ -227958,7 +228347,7 @@ async function updateArcPhase(messages) {
|
|
|
227958
228347
|
const normDesc = desc.toLowerCase().replace(/\s+/g, " ");
|
|
227959
228348
|
if (desc.length > 3 && !arc.goals.some((g) => g.description.toLowerCase().replace(/\s+/g, " ") === normDesc)) {
|
|
227960
228349
|
arc.goals.push({
|
|
227961
|
-
id: `goal_${
|
|
228350
|
+
id: `goal_${randomUUID16()}`,
|
|
227962
228351
|
description: desc,
|
|
227963
228352
|
status: "active",
|
|
227964
228353
|
createdAt: Date.now()
|
|
@@ -227976,7 +228365,7 @@ async function updateArcPhase(messages) {
|
|
|
227976
228365
|
const normDesc = desc.toLowerCase().replace(/\s+/g, " ");
|
|
227977
228366
|
if (desc.length > 5 && !arc.decisions.some((d) => d.description.toLowerCase().replace(/\s+/g, " ") === normDesc)) {
|
|
227978
228367
|
arc.decisions.push({
|
|
227979
|
-
id: `decision_${
|
|
228368
|
+
id: `decision_${randomUUID16()}`,
|
|
227980
228369
|
description: desc,
|
|
227981
228370
|
timestamp: Date.now()
|
|
227982
228371
|
});
|
|
@@ -228024,7 +228413,7 @@ async function finalizeArcTurn() {
|
|
|
228024
228413
|
}
|
|
228025
228414
|
if (dir) {
|
|
228026
228415
|
const filename = `session-summary-${arc.id.replace(/[^a-z0-9]/gi, "-")}.md`;
|
|
228027
|
-
const filePath =
|
|
228416
|
+
const filePath = join84(dir, filename);
|
|
228028
228417
|
const now = new Date().toISOString();
|
|
228029
228418
|
const content = `---
|
|
228030
228419
|
type: reference
|
|
@@ -228070,7 +228459,7 @@ function addGoal(description) {
|
|
|
228070
228459
|
if (!arc)
|
|
228071
228460
|
throw new Error("Arc not initialized");
|
|
228072
228461
|
const goal = {
|
|
228073
|
-
id: `goal_${
|
|
228462
|
+
id: `goal_${randomUUID16()}`,
|
|
228074
228463
|
description: safeArcText(description),
|
|
228075
228464
|
status: "pending",
|
|
228076
228465
|
createdAt: Date.now()
|
|
@@ -228110,7 +228499,7 @@ function addDecision(description, rationale) {
|
|
|
228110
228499
|
if (!arc)
|
|
228111
228500
|
throw new Error("Arc not initialized");
|
|
228112
228501
|
const decision = {
|
|
228113
|
-
id: `decision_${
|
|
228502
|
+
id: `decision_${randomUUID16()}`,
|
|
228114
228503
|
description: safeArcText(description),
|
|
228115
228504
|
rationale: rationale === undefined ? undefined : safeArcText(rationale),
|
|
228116
228505
|
timestamp: Date.now()
|
|
@@ -228130,7 +228519,7 @@ function addMilestone(description) {
|
|
|
228130
228519
|
if (!arc)
|
|
228131
228520
|
throw new Error("Arc not initialized");
|
|
228132
228521
|
const milestone = {
|
|
228133
|
-
id: `milestone_${
|
|
228522
|
+
id: `milestone_${randomUUID16()}`,
|
|
228134
228523
|
description: safeArcText(description),
|
|
228135
228524
|
achievedAt: Date.now()
|
|
228136
228525
|
};
|
|
@@ -228177,12 +228566,12 @@ function clearArcArtifacts(memoryDir) {
|
|
|
228177
228566
|
try {
|
|
228178
228567
|
for (const entry of readdirSync6(memoryDir)) {
|
|
228179
228568
|
if (entry.startsWith("session-summary-")) {
|
|
228180
|
-
rmSync6(
|
|
228569
|
+
rmSync6(join84(memoryDir, entry), { force: true });
|
|
228181
228570
|
}
|
|
228182
228571
|
}
|
|
228183
228572
|
} catch {}
|
|
228184
228573
|
for (const name of [".vector-index", ".vector-index-meta.json"]) {
|
|
228185
|
-
const p =
|
|
228574
|
+
const p = join84(memoryDir, name);
|
|
228186
228575
|
if (existsSync14(p)) {
|
|
228187
228576
|
try {
|
|
228188
228577
|
rmSync6(p, { force: true });
|
|
@@ -230132,7 +230521,7 @@ function getAnthropicEnvMetadata() {
|
|
|
230132
230521
|
function getBuildAgeMinutes() {
|
|
230133
230522
|
if (false)
|
|
230134
230523
|
;
|
|
230135
|
-
const buildTime = new Date("2026-10-
|
|
230524
|
+
const buildTime = new Date("2026-10-21T06:43:04.174Z").getTime();
|
|
230136
230525
|
if (isNaN(buildTime))
|
|
230137
230526
|
return;
|
|
230138
230527
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -230543,7 +230932,7 @@ __export(exports_forkedAgent, {
|
|
|
230543
230932
|
createGetAppStateWithAllowedTools: () => createGetAppStateWithAllowedTools,
|
|
230544
230933
|
createCacheSafeParams: () => createCacheSafeParams
|
|
230545
230934
|
});
|
|
230546
|
-
import { randomUUID as
|
|
230935
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
230547
230936
|
function saveCacheSafeParams(params) {
|
|
230548
230937
|
lastCacheSafeParams = params;
|
|
230549
230938
|
}
|
|
@@ -230661,7 +231050,7 @@ function createSubagentContext(parentContext, overrides) {
|
|
|
230661
231050
|
agentType: overrides?.agentType,
|
|
230662
231051
|
...overrides?.queryLifecycle ? { queryLifecycle: overrides.queryLifecycle } : {},
|
|
230663
231052
|
queryTracking: {
|
|
230664
|
-
chainId:
|
|
231053
|
+
chainId: randomUUID17(),
|
|
230665
231054
|
depth: (parentContext.queryTracking?.depth ?? -1) + 1
|
|
230666
231055
|
},
|
|
230667
231056
|
fileReadingLimits: parentContext.fileReadingLimits,
|
|
@@ -231521,10 +231910,10 @@ var init_queryHelpers = __esm(() => {
|
|
|
231521
231910
|
});
|
|
231522
231911
|
|
|
231523
231912
|
// src/services/PromptSuggestion/speculation.ts
|
|
231524
|
-
import { randomUUID as
|
|
231913
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
231525
231914
|
import { rm as rm4 } from "fs";
|
|
231526
|
-
import { copyFile as copyFile4, mkdir as
|
|
231527
|
-
import { dirname as
|
|
231915
|
+
import { copyFile as copyFile4, mkdir as mkdir21 } from "fs/promises";
|
|
231916
|
+
import { dirname as dirname44, isAbsolute as isAbsolute22, join as join85, relative as relative14 } from "path";
|
|
231528
231917
|
function requestSpeculationAbort(controller, source) {
|
|
231529
231918
|
requestAbort(controller, undefined, {
|
|
231530
231919
|
source,
|
|
@@ -231536,7 +231925,7 @@ function safeRemoveOverlay(overlayPath) {
|
|
|
231536
231925
|
rm4(overlayPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }, () => {});
|
|
231537
231926
|
}
|
|
231538
231927
|
function getOverlayPath(id) {
|
|
231539
|
-
return
|
|
231928
|
+
return join85(getAtherCodeTempDir(), "speculation", String(process.pid), id);
|
|
231540
231929
|
}
|
|
231541
231930
|
function denySpeculation(message, reason) {
|
|
231542
231931
|
return {
|
|
@@ -231666,7 +232055,7 @@ async function startSpeculation(suggestionText, context2, setAppState, isPipelin
|
|
|
231666
232055
|
if (!isSpeculationEnabled())
|
|
231667
232056
|
return;
|
|
231668
232057
|
abortSpeculation(setAppState);
|
|
231669
|
-
const id =
|
|
232058
|
+
const id = randomUUID18().slice(0, 8);
|
|
231670
232059
|
const abortController = createChildAbortController(context2.toolUseContext.abortController, undefined, {
|
|
231671
232060
|
subsystem: "prompt_suggestion",
|
|
231672
232061
|
controllerRole: "speculation"
|
|
@@ -231679,7 +232068,7 @@ async function startSpeculation(suggestionText, context2, setAppState, isPipelin
|
|
|
231679
232068
|
const overlayPath = getOverlayPath(id);
|
|
231680
232069
|
const cwd2 = getCwdState();
|
|
231681
232070
|
try {
|
|
231682
|
-
await
|
|
232071
|
+
await mkdir21(overlayPath, { recursive: true });
|
|
231683
232072
|
} catch {
|
|
231684
232073
|
logForDebugging("[Speculation] Failed to create overlay directory");
|
|
231685
232074
|
return;
|
|
@@ -231754,17 +232143,17 @@ async function startSpeculation(suggestionText, context2, setAppState, isPipelin
|
|
|
231754
232143
|
}
|
|
231755
232144
|
if (isWriteTool) {
|
|
231756
232145
|
if (!writtenPathsRef.current.has(rel)) {
|
|
231757
|
-
const overlayFile =
|
|
231758
|
-
await
|
|
232146
|
+
const overlayFile = join85(overlayPath, rel);
|
|
232147
|
+
await mkdir21(dirname44(overlayFile), { recursive: true });
|
|
231759
232148
|
try {
|
|
231760
|
-
await copyFile4(
|
|
232149
|
+
await copyFile4(join85(cwd2, rel), overlayFile);
|
|
231761
232150
|
} catch {}
|
|
231762
232151
|
writtenPathsRef.current.add(rel);
|
|
231763
232152
|
}
|
|
231764
|
-
input = { ...input, [pathKey2]:
|
|
232153
|
+
input = { ...input, [pathKey2]: join85(overlayPath, rel) };
|
|
231765
232154
|
} else {
|
|
231766
232155
|
if (writtenPathsRef.current.has(rel)) {
|
|
231767
|
-
input = { ...input, [pathKey2]:
|
|
232156
|
+
input = { ...input, [pathKey2]: join85(overlayPath, rel) };
|
|
231768
232157
|
}
|
|
231769
232158
|
}
|
|
231770
232159
|
logForDebugging(`[Speculation] ${isWriteTool ? "Write" : "Read"} ${filePath} -> ${input[pathKey2]}`);
|
|
@@ -232983,8 +233372,8 @@ var init_types9 = __esm(() => {
|
|
|
232983
233372
|
|
|
232984
233373
|
// src/services/teamMemorySync/index.ts
|
|
232985
233374
|
import { createHash as createHash12 } from "crypto";
|
|
232986
|
-
import { mkdir as
|
|
232987
|
-
import { join as
|
|
233375
|
+
import { mkdir as mkdir22, readdir as readdir16, readFile as readFile22, stat as stat24, writeFile as writeFile19 } from "fs/promises";
|
|
233376
|
+
import { join as join86, relative as relative15, sep as sep20 } from "path";
|
|
232988
233377
|
function createSyncState() {
|
|
232989
233378
|
return {
|
|
232990
233379
|
lastKnownChecksum: null,
|
|
@@ -233300,7 +233689,7 @@ async function collectLocalTeamMemoryFiles(teamDir, deps) {
|
|
|
233300
233689
|
throw e;
|
|
233301
233690
|
}
|
|
233302
233691
|
for (const entry of dirEntries) {
|
|
233303
|
-
const fullPath =
|
|
233692
|
+
const fullPath = join86(dir, entry.name);
|
|
233304
233693
|
if (entry.isDirectory()) {
|
|
233305
233694
|
await walkDir(fullPath);
|
|
233306
233695
|
continue;
|
|
@@ -233707,14 +234096,14 @@ var init_teamMemorySync = __esm(() => {
|
|
|
233707
234096
|
getTeamMemPath,
|
|
233708
234097
|
readdir: (dir) => readdir16(dir, { withFileTypes: true }),
|
|
233709
234098
|
stat: stat24,
|
|
233710
|
-
readFile: (path13) =>
|
|
234099
|
+
readFile: (path13) => readFile22(path13, "utf8"),
|
|
233711
234100
|
scanForSecrets
|
|
233712
234101
|
};
|
|
233713
234102
|
defaultWriteDeps = {
|
|
233714
234103
|
validateTeamMemKey,
|
|
233715
|
-
readFile: (path13) =>
|
|
233716
|
-
mkdir: (path13, options2) =>
|
|
233717
|
-
writeFile: (path13, content) =>
|
|
234104
|
+
readFile: (path13) => readFile22(path13, "utf8"),
|
|
234105
|
+
mkdir: (path13, options2) => mkdir22(path13, options2),
|
|
234106
|
+
writeFile: (path13, content) => writeFile19(path13, content, "utf8")
|
|
233718
234107
|
};
|
|
233719
234108
|
});
|
|
233720
234109
|
|
|
@@ -233730,8 +234119,8 @@ __export(exports_watcher, {
|
|
|
233730
234119
|
_resetWatcherStateForTesting: () => _resetWatcherStateForTesting
|
|
233731
234120
|
});
|
|
233732
234121
|
import { watch as watch2 } from "fs";
|
|
233733
|
-
import { mkdir as
|
|
233734
|
-
import { join as
|
|
234122
|
+
import { mkdir as mkdir23, stat as stat25 } from "fs/promises";
|
|
234123
|
+
import { join as join87 } from "path";
|
|
233735
234124
|
function isPermanentFailure(r) {
|
|
233736
234125
|
if (r.errorType === "no_oauth" || r.errorType === "no_repo")
|
|
233737
234126
|
return true;
|
|
@@ -233822,14 +234211,14 @@ async function startFileWatcher(teamDir) {
|
|
|
233822
234211
|
}
|
|
233823
234212
|
watcherStarted = true;
|
|
233824
234213
|
try {
|
|
233825
|
-
await
|
|
234214
|
+
await mkdir23(teamDir, { recursive: true });
|
|
233826
234215
|
watcher3 = watch2(teamDir, { persistent: true, recursive: true }, (_eventType, filename) => {
|
|
233827
234216
|
if (filename === null) {
|
|
233828
234217
|
schedulePush();
|
|
233829
234218
|
return;
|
|
233830
234219
|
}
|
|
233831
234220
|
if (pushSuppressedReason !== null) {
|
|
233832
|
-
stat25(
|
|
234221
|
+
stat25(join87(teamDir, filename)).catch((err2) => {
|
|
233833
234222
|
if (err2.code !== "ENOENT")
|
|
233834
234223
|
return;
|
|
233835
234224
|
if (pushSuppressedReason !== null) {
|
|
@@ -235226,7 +235615,7 @@ async function* runShellCommand({
|
|
|
235226
235615
|
}
|
|
235227
235616
|
}
|
|
235228
235617
|
var EOL = `
|
|
235229
|
-
`, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2,
|
|
235618
|
+
`, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema44, COMMON_BACKGROUND_COMMANDS, outputSchema35, MAX_PERSISTED_SHELL_OUTPUT_SIZE, MAX_SANDBOX_DIAGNOSTIC_PREVIEW_BYTES = 512, BashTool;
|
|
235230
235619
|
var init_BashTool = __esm(() => {
|
|
235231
235620
|
init_v4();
|
|
235232
235621
|
init_state();
|
|
@@ -235320,7 +235709,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
235320
235709
|
newContent: exports_external.string()
|
|
235321
235710
|
}).optional().describe("Internal: pre-computed sed edit result from preview")
|
|
235322
235711
|
}));
|
|
235323
|
-
|
|
235712
|
+
inputSchema44 = lazySchema(() => isBackgroundTasksDisabled2 ? fullInputSchema2().omit({
|
|
235324
235713
|
run_in_background: true,
|
|
235325
235714
|
dangerouslyDisableSandbox: true,
|
|
235326
235715
|
_dangerouslyDisableSandboxApproved: true,
|
|
@@ -235331,7 +235720,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
235331
235720
|
_simulatedSedEdit: true
|
|
235332
235721
|
}));
|
|
235333
235722
|
COMMON_BACKGROUND_COMMANDS = ["npm", "yarn", "pnpm", "node", "python", "python3", "go", "cargo", "make", "docker", "terraform", "webpack", "vite", "jest", "pytest", "curl", "wget", "build", "test", "serve", "watch", "dev"];
|
|
235334
|
-
|
|
235723
|
+
outputSchema35 = lazySchema(() => exports_external.object({
|
|
235335
235724
|
stdout: exports_external.string().describe("The standard output of the command"),
|
|
235336
235725
|
stderr: exports_external.string().describe("The standard error output of the command"),
|
|
235337
235726
|
rawOutputPath: exports_external.string().optional().describe("Path to raw output file for large MCP tool outputs"),
|
|
@@ -235398,7 +235787,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
235398
235787
|
};
|
|
235399
235788
|
},
|
|
235400
235789
|
isSearchOrReadCommand(input) {
|
|
235401
|
-
const parsed =
|
|
235790
|
+
const parsed = inputSchema44().safeParse(input);
|
|
235402
235791
|
if (!parsed.success)
|
|
235403
235792
|
return {
|
|
235404
235793
|
isSearch: false,
|
|
@@ -235408,10 +235797,10 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
235408
235797
|
return isSearchOrReadBashCommand(parsed.data.command);
|
|
235409
235798
|
},
|
|
235410
235799
|
get inputSchema() {
|
|
235411
|
-
return
|
|
235800
|
+
return inputSchema44();
|
|
235412
235801
|
},
|
|
235413
235802
|
get outputSchema() {
|
|
235414
|
-
return
|
|
235803
|
+
return outputSchema35();
|
|
235415
235804
|
},
|
|
235416
235805
|
userFacingName(input) {
|
|
235417
235806
|
if (!input) {
|
|
@@ -235768,7 +236157,7 @@ var init_PowerShellTool2 = __esm(() => {
|
|
|
235768
236157
|
});
|
|
235769
236158
|
|
|
235770
236159
|
// src/utils/promptShellExecution.ts
|
|
235771
|
-
import { randomUUID as
|
|
236160
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
235772
236161
|
async function executeShellCommandsInPrompt(text, context2, slashCommandName, shell, options2) {
|
|
235773
236162
|
let result = text;
|
|
235774
236163
|
const lineLimits = options2?.lineLimits ?? {};
|
|
@@ -235793,7 +236182,7 @@ async function executeShellCommandsInPrompt(text, context2, slashCommandName, sh
|
|
|
235793
236182
|
stdout: boundedStdout,
|
|
235794
236183
|
stderr: typeof data.stderr === "string" ? data.stderr : ""
|
|
235795
236184
|
};
|
|
235796
|
-
const toolResultBlock = await processToolResultBlock(shellTool, normalizedData,
|
|
236185
|
+
const toolResultBlock = await processToolResultBlock(shellTool, normalizedData, randomUUID19());
|
|
235797
236186
|
const output = typeof toolResultBlock.content === "string" ? toolResultBlock.content : formatBashOutput(normalizedData.stdout, normalizedData.stderr);
|
|
235798
236187
|
result = result.replace(match[0], () => output);
|
|
235799
236188
|
} catch (e) {
|
|
@@ -235891,14 +236280,14 @@ var init_promptShellExecution = __esm(() => {
|
|
|
235891
236280
|
import { realpath as realpath8 } from "fs/promises";
|
|
235892
236281
|
import {
|
|
235893
236282
|
basename as basename23,
|
|
235894
|
-
dirname as
|
|
236283
|
+
dirname as dirname45,
|
|
235895
236284
|
isAbsolute as isAbsolute23,
|
|
235896
|
-
join as
|
|
236285
|
+
join as join88,
|
|
235897
236286
|
sep as pathSep,
|
|
235898
236287
|
relative as relative16
|
|
235899
236288
|
} from "path";
|
|
235900
236289
|
function getProjectSkillsPaths(dir) {
|
|
235901
|
-
return PROJECT_CONFIG_DIR_NAMES.map((configDirName) =>
|
|
236290
|
+
return PROJECT_CONFIG_DIR_NAMES.map((configDirName) => join88(dir, configDirName, "skills"));
|
|
235902
236291
|
}
|
|
235903
236292
|
function prefersAtherCodeConfigDir(path13) {
|
|
235904
236293
|
return path13.split(pathSep).includes(".ather-code") ? 0 : 1;
|
|
@@ -235922,7 +236311,7 @@ function isPlainObject5(value) {
|
|
|
235922
236311
|
}
|
|
235923
236312
|
async function readSkillJsonMetadata(skillDirPath) {
|
|
235924
236313
|
try {
|
|
235925
|
-
const raw = await getFsImplementation().readFile(
|
|
236314
|
+
const raw = await getFsImplementation().readFile(join88(skillDirPath, "skill.json"), {
|
|
235926
236315
|
encoding: "utf-8"
|
|
235927
236316
|
});
|
|
235928
236317
|
const parsed = JSON.parse(raw);
|
|
@@ -236095,7 +236484,7 @@ async function findSkillMarkdownFiles(basePath) {
|
|
|
236095
236484
|
}
|
|
236096
236485
|
const childDirs = [];
|
|
236097
236486
|
for (const entry of entries2) {
|
|
236098
|
-
const entryPath =
|
|
236487
|
+
const entryPath = join88(skillDirPath, entry.name);
|
|
236099
236488
|
if (isSkillFile2(entryPath)) {
|
|
236100
236489
|
skillFiles.push(entryPath);
|
|
236101
236490
|
continue;
|
|
@@ -236130,7 +236519,7 @@ async function findSkillMarkdownFiles(basePath) {
|
|
|
236130
236519
|
}
|
|
236131
236520
|
const topLevelDirs = [];
|
|
236132
236521
|
for (const entry of entries) {
|
|
236133
|
-
const entryPath =
|
|
236522
|
+
const entryPath = join88(basePath, entry.name);
|
|
236134
236523
|
if (entry.isDirectory()) {
|
|
236135
236524
|
topLevelDirs.push(entryPath);
|
|
236136
236525
|
continue;
|
|
@@ -236158,7 +236547,7 @@ async function loadSkillsFromSkillsDir(basePath, source) {
|
|
|
236158
236547
|
const skillFiles = await findSkillMarkdownFiles(basePath);
|
|
236159
236548
|
const results = await Promise.all(skillFiles.map(async (skillFilePath) => {
|
|
236160
236549
|
try {
|
|
236161
|
-
const skillDirPath =
|
|
236550
|
+
const skillDirPath = dirname45(skillFilePath);
|
|
236162
236551
|
let content;
|
|
236163
236552
|
try {
|
|
236164
236553
|
content = await fs2.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -236202,7 +236591,7 @@ function isSkillFile2(filePath) {
|
|
|
236202
236591
|
function transformSkillFiles(files) {
|
|
236203
236592
|
const filesByDir = new Map;
|
|
236204
236593
|
for (const file2 of files) {
|
|
236205
|
-
const dir =
|
|
236594
|
+
const dir = dirname45(file2.filePath);
|
|
236206
236595
|
const dirFiles = filesByDir.get(dir) ?? [];
|
|
236207
236596
|
dirFiles.push(file2);
|
|
236208
236597
|
filesByDir.set(dir, dirFiles);
|
|
@@ -236231,15 +236620,15 @@ function buildNamespace(targetDir, baseDir) {
|
|
|
236231
236620
|
return relativePath ? relativePath.split(pathSep).join(":") : "";
|
|
236232
236621
|
}
|
|
236233
236622
|
function getSkillCommandName(filePath, baseDir) {
|
|
236234
|
-
const skillDirectory =
|
|
236235
|
-
const parentOfSkillDir =
|
|
236623
|
+
const skillDirectory = dirname45(filePath);
|
|
236624
|
+
const parentOfSkillDir = dirname45(skillDirectory);
|
|
236236
236625
|
const commandBaseName = basename23(skillDirectory);
|
|
236237
236626
|
const namespace = buildNamespace(parentOfSkillDir, baseDir);
|
|
236238
236627
|
return namespace ? `${namespace}:${commandBaseName}` : commandBaseName;
|
|
236239
236628
|
}
|
|
236240
236629
|
function getRegularCommandName(filePath, baseDir) {
|
|
236241
236630
|
const fileName = basename23(filePath);
|
|
236242
|
-
const fileDirectory =
|
|
236631
|
+
const fileDirectory = dirname45(filePath);
|
|
236243
236632
|
const commandBaseName = fileName.replace(/\.md$/, "");
|
|
236244
236633
|
const namespace = buildNamespace(fileDirectory, baseDir);
|
|
236245
236634
|
return namespace ? `${namespace}:${commandBaseName}` : commandBaseName;
|
|
@@ -236262,7 +236651,7 @@ async function loadSkillsFromCommandsDir(cwd2) {
|
|
|
236262
236651
|
} of processedFiles) {
|
|
236263
236652
|
try {
|
|
236264
236653
|
const isSkillFormat = isSkillFile2(filePath);
|
|
236265
|
-
const skillDirectory = isSkillFormat ?
|
|
236654
|
+
const skillDirectory = isSkillFormat ? dirname45(filePath) : undefined;
|
|
236266
236655
|
const cmdName = getCommandName2({
|
|
236267
236656
|
baseDir,
|
|
236268
236657
|
filePath,
|
|
@@ -236307,7 +236696,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
236307
236696
|
const resolvedCwd = cwd2.endsWith(pathSep) ? cwd2.slice(0, -1) : cwd2;
|
|
236308
236697
|
const newDirs = [];
|
|
236309
236698
|
for (const filePath of filePaths) {
|
|
236310
|
-
let currentDir =
|
|
236699
|
+
let currentDir = dirname45(filePath);
|
|
236311
236700
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
236312
236701
|
for (const skillDir of getProjectSkillsPaths(currentDir)) {
|
|
236313
236702
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
@@ -236322,7 +236711,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
236322
236711
|
} catch {}
|
|
236323
236712
|
}
|
|
236324
236713
|
}
|
|
236325
|
-
const parent =
|
|
236714
|
+
const parent = dirname45(currentDir);
|
|
236326
236715
|
if (parent === currentDir)
|
|
236327
236716
|
break;
|
|
236328
236717
|
currentDir = parent;
|
|
@@ -236426,8 +236815,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
236426
236815
|
init_types2();
|
|
236427
236816
|
import_ignore2 = __toESM(require_ignore(), 1);
|
|
236428
236817
|
getSkillDirCommands = memoize_default(async (cwd2) => {
|
|
236429
|
-
const userSkillsDir =
|
|
236430
|
-
const managedSkillsDir =
|
|
236818
|
+
const userSkillsDir = join88(getAtherCodeConfigHomeDir(), "skills");
|
|
236819
|
+
const managedSkillsDir = join88(getManagedFilePath(), ".ather-code", "skills");
|
|
236431
236820
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2).sort(compareSkillDirPrecedence);
|
|
236432
236821
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
236433
236822
|
const additionalDirs = getAdditionalDirectoriesForAtherCodeMd();
|
|
@@ -237407,8 +237796,8 @@ async function calculateDeferredToolDescriptionChars(tools, getToolPermissionCon
|
|
|
237407
237796
|
tools,
|
|
237408
237797
|
agents
|
|
237409
237798
|
});
|
|
237410
|
-
const
|
|
237411
|
-
return tool2.name.length + description.length +
|
|
237799
|
+
const inputSchema45 = tool2.inputJSONSchema ? jsonStringify(tool2.inputJSONSchema) : tool2.inputSchema ? jsonStringify(zodToJsonSchema(tool2.inputSchema)) : "";
|
|
237800
|
+
return tool2.name.length + description.length + inputSchema45.length;
|
|
237412
237801
|
}));
|
|
237413
237802
|
return sizes.reduce((total, size) => total + size, 0);
|
|
237414
237803
|
}
|
|
@@ -237606,9 +237995,9 @@ var init_toolSearch = __esm(() => {
|
|
|
237606
237995
|
});
|
|
237607
237996
|
|
|
237608
237997
|
// src/services/vcr.ts
|
|
237609
|
-
import { createHash as createHash13, randomUUID as
|
|
237610
|
-
import { mkdir as
|
|
237611
|
-
import { dirname as
|
|
237998
|
+
import { createHash as createHash13, randomUUID as randomUUID20 } from "crypto";
|
|
237999
|
+
import { mkdir as mkdir24, readFile as readFile23, writeFile as writeFile20 } from "fs/promises";
|
|
238000
|
+
import { dirname as dirname46, join as join89 } from "path";
|
|
237612
238001
|
function shouldUseVCR() {
|
|
237613
238002
|
if (false) {}
|
|
237614
238003
|
if (false) {}
|
|
@@ -237619,9 +238008,9 @@ async function withFixture(input, fixtureName, f) {
|
|
|
237619
238008
|
return await f();
|
|
237620
238009
|
}
|
|
237621
238010
|
const hash = createHash13("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
237622
|
-
const filename =
|
|
238011
|
+
const filename = join89(process.env.ATHER_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
237623
238012
|
try {
|
|
237624
|
-
const cached3 = jsonParse(await
|
|
238013
|
+
const cached3 = jsonParse(await readFile23(filename, { encoding: "utf8" }));
|
|
237625
238014
|
return cached3;
|
|
237626
238015
|
} catch (e) {
|
|
237627
238016
|
const code = getErrnoCode(e);
|
|
@@ -237633,8 +238022,8 @@ async function withFixture(input, fixtureName, f) {
|
|
|
237633
238022
|
throw new Error(`Fixture missing: ${filename}. Re-run tests with VCR_RECORD=1, then commit the result.`);
|
|
237634
238023
|
}
|
|
237635
238024
|
const result = await f();
|
|
237636
|
-
await
|
|
237637
|
-
await
|
|
238025
|
+
await mkdir24(dirname46(filename), { recursive: true });
|
|
238026
|
+
await writeFile20(filename, jsonStringify(result, null, 2), {
|
|
237638
238027
|
encoding: "utf8"
|
|
237639
238028
|
});
|
|
237640
238029
|
return result;
|
|
@@ -237653,11 +238042,11 @@ async function withVCR(messages, f) {
|
|
|
237653
238042
|
return true;
|
|
237654
238043
|
}));
|
|
237655
238044
|
const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
|
|
237656
|
-
const filename =
|
|
238045
|
+
const filename = join89(process.env.ATHER_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash13("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
237657
238046
|
try {
|
|
237658
|
-
const cached3 = jsonParse(await
|
|
238047
|
+
const cached3 = jsonParse(await readFile23(filename, { encoding: "utf8" }));
|
|
237659
238048
|
cached3.output.forEach(addCachedCostToTotalSessionCost);
|
|
237660
|
-
return cached3.output.map((message, index) => mapMessage(message, hydrateValue, index,
|
|
238049
|
+
return cached3.output.map((message, index) => mapMessage(message, hydrateValue, index, randomUUID20()));
|
|
237661
238050
|
} catch (e) {
|
|
237662
238051
|
const code = getErrnoCode(e);
|
|
237663
238052
|
if (code !== "ENOENT") {
|
|
@@ -237672,8 +238061,8 @@ ${jsonStringify(dehydratedInput, null, 2)}`);
|
|
|
237672
238061
|
if (env3.isCI && !isEnvTruthy(process.env.VCR_RECORD)) {
|
|
237673
238062
|
return results;
|
|
237674
238063
|
}
|
|
237675
|
-
await
|
|
237676
|
-
await
|
|
238064
|
+
await mkdir24(dirname46(filename), { recursive: true });
|
|
238065
|
+
await writeFile20(filename, jsonStringify({
|
|
237677
238066
|
input: dehydratedInput,
|
|
237678
238067
|
output: results.map((message, index) => mapMessage(message, dehydrateValue, index))
|
|
237679
238068
|
}, null, 2), { encoding: "utf8" });
|
|
@@ -238096,7 +238485,7 @@ async function countTokensWithBedrock({
|
|
|
238096
238485
|
containsThinking
|
|
238097
238486
|
}) {
|
|
238098
238487
|
try {
|
|
238099
|
-
const
|
|
238488
|
+
const client2 = await createBedrockRuntimeClient();
|
|
238100
238489
|
const modelId = isFoundationModel(model) ? model : await getInferenceProfileBackingModel(model);
|
|
238101
238490
|
if (!modelId) {
|
|
238102
238491
|
return null;
|
|
@@ -238123,7 +238512,7 @@ async function countTokensWithBedrock({
|
|
|
238123
238512
|
}
|
|
238124
238513
|
}
|
|
238125
238514
|
};
|
|
238126
|
-
const response = await
|
|
238515
|
+
const response = await client2.send(new CountTokensCommand(input));
|
|
238127
238516
|
const tokenCount = response.inputTokens ?? null;
|
|
238128
238517
|
return tokenCount;
|
|
238129
238518
|
} catch (error40) {
|
|
@@ -238145,7 +238534,7 @@ var init_tokenEstimation = __esm(() => {
|
|
|
238145
238534
|
init_slowOperations();
|
|
238146
238535
|
init_toolSearch();
|
|
238147
238536
|
init_ather_code3();
|
|
238148
|
-
|
|
238537
|
+
init_client5();
|
|
238149
238538
|
init_vcr();
|
|
238150
238539
|
});
|
|
238151
238540
|
|
|
@@ -238803,12 +239192,12 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
238803
239192
|
});
|
|
238804
239193
|
|
|
238805
239194
|
// src/services/SessionMemory/prompts.ts
|
|
238806
|
-
import { readFile as
|
|
238807
|
-
import { join as
|
|
239195
|
+
import { readFile as readFile24 } from "fs/promises";
|
|
239196
|
+
import { join as join90 } from "path";
|
|
238808
239197
|
async function loadSessionMemoryTemplate() {
|
|
238809
|
-
const templatePath =
|
|
239198
|
+
const templatePath = join90(getAtherCodeConfigHomeDir(), "session-memory", "config", "template.md");
|
|
238810
239199
|
try {
|
|
238811
|
-
return await
|
|
239200
|
+
return await readFile24(templatePath, { encoding: "utf-8" });
|
|
238812
239201
|
} catch (e) {
|
|
238813
239202
|
const code = getErrnoCode(e);
|
|
238814
239203
|
if (code === "ENOENT") {
|
|
@@ -242318,9 +242707,9 @@ var init_modelFailureCache = __esm(() => {
|
|
|
242318
242707
|
|
|
242319
242708
|
// src/services/creditsTracker.ts
|
|
242320
242709
|
import { readFileSync as readFileSync18, writeFileSync as writeFileSync11, mkdirSync as mkdirSync13, existsSync as existsSync15, chmodSync as chmodSync8 } from "node:fs";
|
|
242321
|
-
import { dirname as
|
|
242710
|
+
import { dirname as dirname47, join as join91 } from "node:path";
|
|
242322
242711
|
function getCreditsFilePath() {
|
|
242323
|
-
return
|
|
242712
|
+
return join91(getAtherCodeConfigHomeDir(), CREDITS_FILE_NAME);
|
|
242324
242713
|
}
|
|
242325
242714
|
function todayUtcDayKey() {
|
|
242326
242715
|
return new Date().toISOString().slice(0, 10);
|
|
@@ -242386,7 +242775,7 @@ function getCreditsState() {
|
|
|
242386
242775
|
}
|
|
242387
242776
|
function saveCreditsState(state2) {
|
|
242388
242777
|
const filePath = getCreditsFilePath();
|
|
242389
|
-
mkdirSync13(
|
|
242778
|
+
mkdirSync13(dirname47(filePath), { recursive: true });
|
|
242390
242779
|
writeFileSync11(filePath, JSON.stringify(state2, null, 2), { encoding: "utf8", mode: 384 });
|
|
242391
242780
|
try {
|
|
242392
242781
|
chmodSync8(filePath, 384);
|
|
@@ -243239,9 +243628,9 @@ var init_requestExecutor = __esm(() => {
|
|
|
243239
243628
|
});
|
|
243240
243629
|
|
|
243241
243630
|
// src/utils/requestLogging.ts
|
|
243242
|
-
import { randomUUID as
|
|
243631
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
243243
243632
|
function createCorrelationId() {
|
|
243244
|
-
return
|
|
243633
|
+
return randomUUID21();
|
|
243245
243634
|
}
|
|
243246
243635
|
function logApiCallStart(provider, model) {
|
|
243247
243636
|
const correlationId = createCorrelationId();
|
|
@@ -244152,7 +244541,7 @@ var init_openaiShim = __esm(() => {
|
|
|
244152
244541
|
|
|
244153
244542
|
// src/services/api/client.ts
|
|
244154
244543
|
import Anthropic from "@anthropic-ai/sdk";
|
|
244155
|
-
import { randomUUID as
|
|
244544
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
244156
244545
|
function createStderrLogger() {
|
|
244157
244546
|
return {
|
|
244158
244547
|
error: (msg, ...args) => console.error("[Anthropic SDK ERROR]", msg, ...args),
|
|
@@ -244640,7 +245029,7 @@ function buildFetch(fetchOverride, source) {
|
|
|
244640
245029
|
return (input, init) => {
|
|
244641
245030
|
const headers = new Headers(init?.headers);
|
|
244642
245031
|
if (injectClientRequestId && !headers.has(CLIENT_REQUEST_ID_HEADER)) {
|
|
244643
|
-
headers.set(CLIENT_REQUEST_ID_HEADER,
|
|
245032
|
+
headers.set(CLIENT_REQUEST_ID_HEADER, randomUUID22());
|
|
244644
245033
|
}
|
|
244645
245034
|
try {
|
|
244646
245035
|
const url3 = input instanceof Request ? input.url : String(input);
|
|
@@ -244651,7 +245040,7 @@ function buildFetch(fetchOverride, source) {
|
|
|
244651
245040
|
};
|
|
244652
245041
|
}
|
|
244653
245042
|
var importOptionalRuntimeModuleForClient, NEARAI_MODEL_PREFIXES, CLIENT_REQUEST_ID_HEADER = "x-client-request-id";
|
|
244654
|
-
var
|
|
245043
|
+
var init_client5 = __esm(() => {
|
|
244655
245044
|
init_auth();
|
|
244656
245045
|
init_effort();
|
|
244657
245046
|
init_http2();
|
|
@@ -245015,7 +245404,7 @@ var init_atherCodeAiLimits = __esm(() => {
|
|
|
245015
245404
|
init_model();
|
|
245016
245405
|
init_providers();
|
|
245017
245406
|
init_ather_code3();
|
|
245018
|
-
|
|
245407
|
+
init_client5();
|
|
245019
245408
|
init_rateLimitMocking();
|
|
245020
245409
|
init_rateLimitMessages();
|
|
245021
245410
|
EARLY_WARNING_CONFIGS = [
|
|
@@ -250791,9 +251180,9 @@ var init_permissionSetup = __esm(() => {
|
|
|
250791
251180
|
|
|
250792
251181
|
// src/utils/markdownConfigLoader.ts
|
|
250793
251182
|
import { statSync as statSync10 } from "fs";
|
|
250794
|
-
import { lstat as lstat6, readdir as readdir17, readFile as
|
|
251183
|
+
import { lstat as lstat6, readdir as readdir17, readFile as readFile25, realpath as realpath9, stat as stat26 } from "fs/promises";
|
|
250795
251184
|
import { homedir as homedir22 } from "os";
|
|
250796
|
-
import { dirname as
|
|
251185
|
+
import { dirname as dirname48, join as join92, resolve as resolve30, sep as sep21 } from "path";
|
|
250797
251186
|
function getMaxMarkdownFileSizeBytes() {
|
|
250798
251187
|
const raw = process.env.ATHER_CODE_MAX_MARKDOWN_FILE_SIZE_BYTES;
|
|
250799
251188
|
if (!raw)
|
|
@@ -250901,7 +251290,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
|
|
|
250901
251290
|
break;
|
|
250902
251291
|
}
|
|
250903
251292
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
250904
|
-
const configSubdir =
|
|
251293
|
+
const configSubdir = join92(current2, configDirName, subdir);
|
|
250905
251294
|
try {
|
|
250906
251295
|
statSync10(configSubdir);
|
|
250907
251296
|
dirs.push(configSubdir);
|
|
@@ -250913,7 +251302,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
|
|
|
250913
251302
|
if (gitRoot && normalizePathForComparison(current2) === normalizePathForComparison(gitRoot)) {
|
|
250914
251303
|
break;
|
|
250915
251304
|
}
|
|
250916
|
-
const parent =
|
|
251305
|
+
const parent = dirname48(current2);
|
|
250917
251306
|
if (parent === current2) {
|
|
250918
251307
|
break;
|
|
250919
251308
|
}
|
|
@@ -250949,7 +251338,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
250949
251338
|
if (signal.aborted) {
|
|
250950
251339
|
break;
|
|
250951
251340
|
}
|
|
250952
|
-
const fullPath =
|
|
251341
|
+
const fullPath = join92(currentDir, entry.name);
|
|
250953
251342
|
try {
|
|
250954
251343
|
if (entry.isSymbolicLink()) {
|
|
250955
251344
|
try {
|
|
@@ -251020,7 +251409,7 @@ async function loadMarkdownFiles(dir) {
|
|
|
251020
251409
|
logForDebugging(`Skipping oversized markdown file ${filePath} (${fileStat.size} bytes > ${maxFileSize} max). Set ATHER_CODE_MAX_MARKDOWN_FILE_SIZE_BYTES to override.`, { level: "warn" });
|
|
251021
251410
|
return null;
|
|
251022
251411
|
}
|
|
251023
|
-
const rawContent = await
|
|
251412
|
+
const rawContent = await readFile25(filePath, { encoding: "utf-8" });
|
|
251024
251413
|
const { frontmatter, content } = parseFrontmatter(rawContent, filePath);
|
|
251025
251414
|
return {
|
|
251026
251415
|
filePath,
|
|
@@ -251067,17 +251456,17 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
251067
251456
|
oversizedMarkdownSkips = new Map;
|
|
251068
251457
|
loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd2) {
|
|
251069
251458
|
const searchStartTime = Date.now();
|
|
251070
|
-
const userDir =
|
|
251071
|
-
const managedDir =
|
|
251459
|
+
const userDir = join92(getAtherCodeConfigHomeDir(), subdir);
|
|
251460
|
+
const managedDir = join92(getManagedFilePath(), ".ather-code", subdir);
|
|
251072
251461
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd2);
|
|
251073
251462
|
const gitRoot = findGitRoot(cwd2);
|
|
251074
251463
|
const canonicalRoot = findCanonicalGitRoot(cwd2);
|
|
251075
251464
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
251076
|
-
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(
|
|
251465
|
+
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(join92(gitRoot, configDirName, subdir)));
|
|
251077
251466
|
const worktreeHasSubdir = projectDirs.some((dir) => worktreeSubdirs.includes(normalizePathForComparison(dir)));
|
|
251078
251467
|
if (!worktreeHasSubdir) {
|
|
251079
251468
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
251080
|
-
const mainConfigSubdir =
|
|
251469
|
+
const mainConfigSubdir = join92(canonicalRoot, configDirName, subdir);
|
|
251081
251470
|
if (!projectDirs.includes(mainConfigSubdir)) {
|
|
251082
251471
|
projectDirs.push(mainConfigSubdir);
|
|
251083
251472
|
}
|
|
@@ -251336,7 +251725,7 @@ ${EXPLANATORY_FEATURE_PROMPT}`
|
|
|
251336
251725
|
});
|
|
251337
251726
|
|
|
251338
251727
|
// src/utils/messages/factories.ts
|
|
251339
|
-
import { randomUUID as
|
|
251728
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
251340
251729
|
function isSyntheticMessage(message) {
|
|
251341
251730
|
return message.type !== "progress" && message.type !== "attachment" && message.type !== "system" && Array.isArray(message.message.content) && message.message.content[0]?.type === "text" && SYNTHETIC_MESSAGES.has(message.message.content[0].text);
|
|
251342
251731
|
}
|
|
@@ -251382,10 +251771,10 @@ function baseCreateAssistantMessage({
|
|
|
251382
251771
|
}) {
|
|
251383
251772
|
return {
|
|
251384
251773
|
type: "assistant",
|
|
251385
|
-
uuid:
|
|
251774
|
+
uuid: randomUUID23(),
|
|
251386
251775
|
timestamp: new Date().toISOString(),
|
|
251387
251776
|
message: {
|
|
251388
|
-
id:
|
|
251777
|
+
id: randomUUID23(),
|
|
251389
251778
|
container: null,
|
|
251390
251779
|
model: SYNTHETIC_MODEL,
|
|
251391
251780
|
role: "assistant",
|
|
@@ -251471,7 +251860,7 @@ function createUserMessage({
|
|
|
251471
251860
|
isCompactSummary,
|
|
251472
251861
|
isCollapseSummary,
|
|
251473
251862
|
summarizeMetadata,
|
|
251474
|
-
uuid: uuid3 ||
|
|
251863
|
+
uuid: uuid3 || randomUUID23(),
|
|
251475
251864
|
timestamp: timestamp ?? new Date().toISOString(),
|
|
251476
251865
|
toolUseResult,
|
|
251477
251866
|
imagePermissionToolUseIds,
|
|
@@ -251542,7 +251931,7 @@ function createProgressMessage({
|
|
|
251542
251931
|
data,
|
|
251543
251932
|
toolUseID,
|
|
251544
251933
|
parentToolUseID,
|
|
251545
|
-
uuid:
|
|
251934
|
+
uuid: randomUUID23(),
|
|
251546
251935
|
timestamp: new Date().toISOString()
|
|
251547
251936
|
};
|
|
251548
251937
|
}
|
|
@@ -252765,7 +253154,7 @@ function projectSnippedView(messages) {
|
|
|
252765
253154
|
}
|
|
252766
253155
|
|
|
252767
253156
|
// src/utils/messages/systemFactories.ts
|
|
252768
|
-
import { randomUUID as
|
|
253157
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
252769
253158
|
function createSystemMessage(content, level, toolUseID, preventContinuation) {
|
|
252770
253159
|
return {
|
|
252771
253160
|
type: "system",
|
|
@@ -252773,7 +253162,7 @@ function createSystemMessage(content, level, toolUseID, preventContinuation) {
|
|
|
252773
253162
|
content,
|
|
252774
253163
|
isMeta: false,
|
|
252775
253164
|
timestamp: new Date().toISOString(),
|
|
252776
|
-
uuid:
|
|
253165
|
+
uuid: randomUUID24(),
|
|
252777
253166
|
toolUseID,
|
|
252778
253167
|
level,
|
|
252779
253168
|
...preventContinuation && { preventContinuation }
|
|
@@ -252788,7 +253177,7 @@ function createPermissionRetryMessage(commands) {
|
|
|
252788
253177
|
level: "info",
|
|
252789
253178
|
isMeta: false,
|
|
252790
253179
|
timestamp: new Date().toISOString(),
|
|
252791
|
-
uuid:
|
|
253180
|
+
uuid: randomUUID24()
|
|
252792
253181
|
};
|
|
252793
253182
|
}
|
|
252794
253183
|
function createBridgeStatusMessage(url3, upgradeNudge) {
|
|
@@ -252800,7 +253189,7 @@ function createBridgeStatusMessage(url3, upgradeNudge) {
|
|
|
252800
253189
|
upgradeNudge,
|
|
252801
253190
|
isMeta: false,
|
|
252802
253191
|
timestamp: new Date().toISOString(),
|
|
252803
|
-
uuid:
|
|
253192
|
+
uuid: randomUUID24()
|
|
252804
253193
|
};
|
|
252805
253194
|
}
|
|
252806
253195
|
function createScheduledTaskFireMessage(content) {
|
|
@@ -252810,7 +253199,7 @@ function createScheduledTaskFireMessage(content) {
|
|
|
252810
253199
|
content,
|
|
252811
253200
|
isMeta: false,
|
|
252812
253201
|
timestamp: new Date().toISOString(),
|
|
252813
|
-
uuid:
|
|
253202
|
+
uuid: randomUUID24()
|
|
252814
253203
|
};
|
|
252815
253204
|
}
|
|
252816
253205
|
function createStopHookSummaryMessage2(hookCount, hookInfos, hookErrors, preventedContinuation, stopReason, hasOutput, level, toolUseID, hookLabel, totalDurationMs) {
|
|
@@ -252825,7 +253214,7 @@ function createStopHookSummaryMessage2(hookCount, hookInfos, hookErrors, prevent
|
|
|
252825
253214
|
hasOutput,
|
|
252826
253215
|
level,
|
|
252827
253216
|
timestamp: new Date().toISOString(),
|
|
252828
|
-
uuid:
|
|
253217
|
+
uuid: randomUUID24(),
|
|
252829
253218
|
toolUseID,
|
|
252830
253219
|
hookLabel,
|
|
252831
253220
|
totalDurationMs
|
|
@@ -252841,7 +253230,7 @@ function createTurnDurationMessage(durationMs, budget, messageCount) {
|
|
|
252841
253230
|
budgetNudges: budget?.nudges,
|
|
252842
253231
|
messageCount,
|
|
252843
253232
|
timestamp: new Date().toISOString(),
|
|
252844
|
-
uuid:
|
|
253233
|
+
uuid: randomUUID24(),
|
|
252845
253234
|
isMeta: false
|
|
252846
253235
|
};
|
|
252847
253236
|
}
|
|
@@ -252851,7 +253240,7 @@ function createAwaySummaryMessage(content) {
|
|
|
252851
253240
|
subtype: "away_summary",
|
|
252852
253241
|
content,
|
|
252853
253242
|
timestamp: new Date().toISOString(),
|
|
252854
|
-
uuid:
|
|
253243
|
+
uuid: randomUUID24(),
|
|
252855
253244
|
isMeta: false
|
|
252856
253245
|
};
|
|
252857
253246
|
}
|
|
@@ -252861,7 +253250,7 @@ function createMemorySavedMessage(writtenPaths) {
|
|
|
252861
253250
|
subtype: "memory_saved",
|
|
252862
253251
|
writtenPaths,
|
|
252863
253252
|
timestamp: new Date().toISOString(),
|
|
252864
|
-
uuid:
|
|
253253
|
+
uuid: randomUUID24(),
|
|
252865
253254
|
isMeta: false
|
|
252866
253255
|
};
|
|
252867
253256
|
}
|
|
@@ -252870,7 +253259,7 @@ function createAgentsKilledMessage() {
|
|
|
252870
253259
|
type: "system",
|
|
252871
253260
|
subtype: "agents_killed",
|
|
252872
253261
|
timestamp: new Date().toISOString(),
|
|
252873
|
-
uuid:
|
|
253262
|
+
uuid: randomUUID24(),
|
|
252874
253263
|
isMeta: false
|
|
252875
253264
|
};
|
|
252876
253265
|
}
|
|
@@ -252890,7 +253279,7 @@ function createApiMetricsMessage(metrics) {
|
|
|
252890
253279
|
classifierCount: metrics.classifierCount,
|
|
252891
253280
|
configWriteCount: metrics.configWriteCount,
|
|
252892
253281
|
timestamp: new Date().toISOString(),
|
|
252893
|
-
uuid:
|
|
253282
|
+
uuid: randomUUID24(),
|
|
252894
253283
|
isMeta: false
|
|
252895
253284
|
};
|
|
252896
253285
|
}
|
|
@@ -252901,7 +253290,7 @@ function createCommandInputMessage(content) {
|
|
|
252901
253290
|
content,
|
|
252902
253291
|
level: "info",
|
|
252903
253292
|
timestamp: new Date().toISOString(),
|
|
252904
|
-
uuid:
|
|
253293
|
+
uuid: randomUUID24(),
|
|
252905
253294
|
isMeta: false
|
|
252906
253295
|
};
|
|
252907
253296
|
}
|
|
@@ -252912,7 +253301,7 @@ function createCompactBoundaryMessage(trigger, preTokens, lastPreCompactMessageU
|
|
|
252912
253301
|
content: `Conversation compacted`,
|
|
252913
253302
|
isMeta: false,
|
|
252914
253303
|
timestamp: new Date().toISOString(),
|
|
252915
|
-
uuid:
|
|
253304
|
+
uuid: randomUUID24(),
|
|
252916
253305
|
level: "info",
|
|
252917
253306
|
compactMetadata: {
|
|
252918
253307
|
trigger,
|
|
@@ -252934,7 +253323,7 @@ function createMicrocompactBoundaryMessage(trigger, preTokens, tokensSaved, comp
|
|
|
252934
253323
|
content: "Context microcompacted",
|
|
252935
253324
|
isMeta: false,
|
|
252936
253325
|
timestamp: new Date().toISOString(),
|
|
252937
|
-
uuid:
|
|
253326
|
+
uuid: randomUUID24(),
|
|
252938
253327
|
level: "info",
|
|
252939
253328
|
microcompactMetadata: {
|
|
252940
253329
|
trigger,
|
|
@@ -252956,7 +253345,7 @@ function createSystemAPIErrorMessage(error40, retryInMs, retryAttempt, maxRetrie
|
|
|
252956
253345
|
retryAttempt,
|
|
252957
253346
|
maxRetries,
|
|
252958
253347
|
timestamp: new Date().toISOString(),
|
|
252959
|
-
uuid:
|
|
253348
|
+
uuid: randomUUID24()
|
|
252960
253349
|
};
|
|
252961
253350
|
}
|
|
252962
253351
|
function isCompactBoundaryMessage(message) {
|
|
@@ -253107,7 +253496,7 @@ __export(exports_messages, {
|
|
|
253107
253496
|
CANCEL_MESSAGE: () => CANCEL_MESSAGE,
|
|
253108
253497
|
AUTO_REJECT_MESSAGE: () => AUTO_REJECT_MESSAGE
|
|
253109
253498
|
});
|
|
253110
|
-
import { randomUUID as
|
|
253499
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
253111
253500
|
function getTeammateMailbox() {
|
|
253112
253501
|
return init_teammateMailbox(), __toCommonJS(exports_teammateMailbox);
|
|
253113
253502
|
}
|
|
@@ -255282,7 +255671,7 @@ function createToolUseSummaryMessage(summary, precedingToolUseIds) {
|
|
|
255282
255671
|
type: "tool_use_summary",
|
|
255283
255672
|
summary,
|
|
255284
255673
|
precedingToolUseIds,
|
|
255285
|
-
uuid:
|
|
255674
|
+
uuid: randomUUID25(),
|
|
255286
255675
|
timestamp: new Date().toISOString()
|
|
255287
255676
|
};
|
|
255288
255677
|
}
|
|
@@ -255614,7 +256003,7 @@ var init_messages = __esm(() => {
|
|
|
255614
256003
|
// src/utils/transcriptFileLock.ts
|
|
255615
256004
|
import { lstatSync as lstatSync2, readlinkSync as readlinkSync2 } from "node:fs";
|
|
255616
256005
|
import { lstat as lstat7, readlink as readlink3 } from "node:fs/promises";
|
|
255617
|
-
import { dirname as
|
|
256006
|
+
import { dirname as dirname49, isAbsolute as isAbsolute24, resolve as resolve31 } from "node:path";
|
|
255618
256007
|
async function resolveTranscriptMutationTarget(requestedPath) {
|
|
255619
256008
|
let currentPath = resolve31(requestedPath);
|
|
255620
256009
|
const visited = new Set;
|
|
@@ -255634,7 +256023,7 @@ async function resolveTranscriptMutationTarget(requestedPath) {
|
|
|
255634
256023
|
if (!fileStat.isSymbolicLink())
|
|
255635
256024
|
return currentPath;
|
|
255636
256025
|
const linkTarget = await readlink3(currentPath);
|
|
255637
|
-
currentPath = isAbsolute24(linkTarget) ? linkTarget : resolve31(
|
|
256026
|
+
currentPath = isAbsolute24(linkTarget) ? linkTarget : resolve31(dirname49(currentPath), linkTarget);
|
|
255638
256027
|
}
|
|
255639
256028
|
throw new Error(`Cannot lock transcript symlink chain: ${requestedPath}`);
|
|
255640
256029
|
}
|
|
@@ -255657,7 +256046,7 @@ function resolveTranscriptMutationTargetSync(requestedPath) {
|
|
|
255657
256046
|
if (!fileStat.isSymbolicLink())
|
|
255658
256047
|
return currentPath;
|
|
255659
256048
|
const linkTarget = readlinkSync2(currentPath);
|
|
255660
|
-
currentPath = isAbsolute24(linkTarget) ? linkTarget : resolve31(
|
|
256049
|
+
currentPath = isAbsolute24(linkTarget) ? linkTarget : resolve31(dirname49(currentPath), linkTarget);
|
|
255661
256050
|
}
|
|
255662
256051
|
throw new Error(`Cannot lock transcript symlink chain: ${requestedPath}`);
|
|
255663
256052
|
}
|
|
@@ -255764,10 +256153,10 @@ __export(exports_replayIndex, {
|
|
|
255764
256153
|
loadReplayIndex: () => loadReplayIndex,
|
|
255765
256154
|
fileExists: () => fileExists
|
|
255766
256155
|
});
|
|
255767
|
-
import { chmod as
|
|
255768
|
-
import { join as
|
|
256156
|
+
import { chmod as chmod5, readFile as readFile26, writeFile as writeFile21, stat as stat27 } from "fs/promises";
|
|
256157
|
+
import { join as join93, dirname as dirname50 } from "path";
|
|
255769
256158
|
function getReplayIndexPath(sessionId, transcriptPath) {
|
|
255770
|
-
return
|
|
256159
|
+
return join93(dirname50(transcriptPath), `${sessionId}.replay.json`);
|
|
255771
256160
|
}
|
|
255772
256161
|
async function fileExists(path13) {
|
|
255773
256162
|
try {
|
|
@@ -255816,7 +256205,7 @@ async function loadReplayIndex(sessionId, transcriptPath) {
|
|
|
255816
256205
|
const replayPath = getReplayIndexPath(sessionId, transcriptPath);
|
|
255817
256206
|
try {
|
|
255818
256207
|
if (await fileExists(replayPath)) {
|
|
255819
|
-
const content = await
|
|
256208
|
+
const content = await readFile26(replayPath, "utf-8");
|
|
255820
256209
|
const index = JSON.parse(content);
|
|
255821
256210
|
if (isReplayIndex(index, sessionId)) {
|
|
255822
256211
|
return index;
|
|
@@ -255832,18 +256221,18 @@ async function loadReplayIndex(sessionId, transcriptPath) {
|
|
|
255832
256221
|
async function writeReplayIndex(sessionId, transcriptPath, index) {
|
|
255833
256222
|
const replayPath = getReplayIndexPath(sessionId, transcriptPath);
|
|
255834
256223
|
try {
|
|
255835
|
-
const dir =
|
|
256224
|
+
const dir = dirname50(replayPath);
|
|
255836
256225
|
try {
|
|
255837
256226
|
await stat27(dir);
|
|
255838
256227
|
} catch {
|
|
255839
|
-
const { mkdir:
|
|
255840
|
-
await
|
|
256228
|
+
const { mkdir: mkdir25 } = await import("fs/promises");
|
|
256229
|
+
await mkdir25(dir, { recursive: true, mode: 448 });
|
|
255841
256230
|
}
|
|
255842
|
-
await
|
|
256231
|
+
await writeFile21(replayPath, JSON.stringify(index, null, 2), {
|
|
255843
256232
|
encoding: "utf-8",
|
|
255844
256233
|
mode: 384
|
|
255845
256234
|
});
|
|
255846
|
-
await
|
|
256235
|
+
await chmod5(replayPath, 384);
|
|
255847
256236
|
logForDebugging(`Wrote replay index for session ${sessionId} to ${replayPath}`);
|
|
255848
256237
|
} catch (error40) {
|
|
255849
256238
|
logError(error40);
|
|
@@ -255958,14 +256347,14 @@ import { closeSync as closeSync3, fstatSync, openSync as openSync4, readSync as
|
|
|
255958
256347
|
import {
|
|
255959
256348
|
appendFile as fsAppendFile,
|
|
255960
256349
|
open as fsOpen2,
|
|
255961
|
-
mkdir as
|
|
256350
|
+
mkdir as mkdir25,
|
|
255962
256351
|
readdir as readdir18,
|
|
255963
|
-
readFile as
|
|
256352
|
+
readFile as readFile27,
|
|
255964
256353
|
stat as stat28,
|
|
255965
256354
|
unlink as unlink10,
|
|
255966
|
-
writeFile as
|
|
256355
|
+
writeFile as writeFile22
|
|
255967
256356
|
} from "fs/promises";
|
|
255968
|
-
import { basename as basename25, dirname as
|
|
256357
|
+
import { basename as basename25, dirname as dirname51, join as join94 } from "path";
|
|
255969
256358
|
function getBuiltInCommandNames() {
|
|
255970
256359
|
if (builtInCommandNamesCache)
|
|
255971
256360
|
return builtInCommandNamesCache;
|
|
@@ -256174,14 +256563,14 @@ function isEphemeralToolProgress(dataType) {
|
|
|
256174
256563
|
}
|
|
256175
256564
|
function getTranscriptPath() {
|
|
256176
256565
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
256177
|
-
return
|
|
256566
|
+
return join94(projectDir, `${getSessionId()}.jsonl`);
|
|
256178
256567
|
}
|
|
256179
256568
|
function getTranscriptPathForSession(sessionId) {
|
|
256180
256569
|
if (sessionId === getSessionId()) {
|
|
256181
256570
|
return getTranscriptPath();
|
|
256182
256571
|
}
|
|
256183
256572
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
256184
|
-
return
|
|
256573
|
+
return join94(projectDir, `${sessionId}.jsonl`);
|
|
256185
256574
|
}
|
|
256186
256575
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
256187
256576
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -256193,21 +256582,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
256193
256582
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
256194
256583
|
const sessionId = getSessionId();
|
|
256195
256584
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
256196
|
-
const base2 = subdir ?
|
|
256197
|
-
return
|
|
256585
|
+
const base2 = subdir ? join94(projectDir, sessionId, "subagents", subdir) : join94(projectDir, sessionId, "subagents");
|
|
256586
|
+
return join94(base2, `agent-${agentId}.jsonl`);
|
|
256198
256587
|
}
|
|
256199
256588
|
function getAgentMetadataPath(agentId) {
|
|
256200
256589
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
256201
256590
|
}
|
|
256202
256591
|
async function writeAgentMetadata(agentId, metadata) {
|
|
256203
256592
|
const path13 = getAgentMetadataPath(agentId);
|
|
256204
|
-
await
|
|
256593
|
+
await mkdir25(dirname51(path13), { recursive: true });
|
|
256205
256594
|
await replaceFileAtomic(path13, JSON.stringify(metadata));
|
|
256206
256595
|
}
|
|
256207
256596
|
async function readAgentMetadata(agentId) {
|
|
256208
256597
|
const path13 = getAgentMetadataPath(agentId);
|
|
256209
256598
|
try {
|
|
256210
|
-
const raw = await
|
|
256599
|
+
const raw = await readFile27(path13, "utf-8");
|
|
256211
256600
|
return JSON.parse(raw);
|
|
256212
256601
|
} catch (e) {
|
|
256213
256602
|
if (isFsInaccessible(e))
|
|
@@ -256217,20 +256606,20 @@ async function readAgentMetadata(agentId) {
|
|
|
256217
256606
|
}
|
|
256218
256607
|
function getRemoteAgentsDir() {
|
|
256219
256608
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
256220
|
-
return
|
|
256609
|
+
return join94(projectDir, getSessionId(), "remote-agents");
|
|
256221
256610
|
}
|
|
256222
256611
|
function getRemoteAgentMetadataPath(taskId) {
|
|
256223
|
-
return
|
|
256612
|
+
return join94(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
256224
256613
|
}
|
|
256225
256614
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
256226
256615
|
const path13 = getRemoteAgentMetadataPath(taskId);
|
|
256227
|
-
await
|
|
256228
|
-
await
|
|
256616
|
+
await mkdir25(dirname51(path13), { recursive: true });
|
|
256617
|
+
await writeFile22(path13, JSON.stringify(metadata));
|
|
256229
256618
|
}
|
|
256230
256619
|
async function readRemoteAgentMetadata(taskId) {
|
|
256231
256620
|
const path13 = getRemoteAgentMetadataPath(taskId);
|
|
256232
256621
|
try {
|
|
256233
|
-
const raw = await
|
|
256622
|
+
const raw = await readFile27(path13, "utf-8");
|
|
256234
256623
|
return JSON.parse(raw);
|
|
256235
256624
|
} catch (e) {
|
|
256236
256625
|
if (isFsInaccessible(e))
|
|
@@ -256263,7 +256652,7 @@ async function listRemoteAgentMetadata() {
|
|
|
256263
256652
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
256264
256653
|
continue;
|
|
256265
256654
|
try {
|
|
256266
|
-
const raw = await
|
|
256655
|
+
const raw = await readFile27(join94(dir, entry.name), "utf-8");
|
|
256267
256656
|
results.push(JSON.parse(raw));
|
|
256268
256657
|
} catch (e) {
|
|
256269
256658
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -256273,7 +256662,7 @@ async function listRemoteAgentMetadata() {
|
|
|
256273
256662
|
}
|
|
256274
256663
|
function sessionIdExists(sessionId) {
|
|
256275
256664
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
256276
|
-
const sessionFile =
|
|
256665
|
+
const sessionFile = join94(projectDir, `${sessionId}.jsonl`);
|
|
256277
256666
|
const fs2 = getFsImplementation();
|
|
256278
256667
|
try {
|
|
256279
256668
|
fs2.statSync(sessionFile);
|
|
@@ -256309,7 +256698,7 @@ function getProject() {
|
|
|
256309
256698
|
if (!shouldSkipSessionPersistence()) {
|
|
256310
256699
|
const { writeReplayIndex: writeReplayIndex2 } = await Promise.resolve().then(() => (init_replayIndex(), exports_replayIndex));
|
|
256311
256700
|
for (const { sessionId, builder, projectDir } of replayBuilders) {
|
|
256312
|
-
const transcriptPath = projectDir ?
|
|
256701
|
+
const transcriptPath = projectDir ? join94(projectDir, `${sessionId}.jsonl`) : getTranscriptPathForSession(sessionId);
|
|
256313
256702
|
const index = builder.build(sessionId);
|
|
256314
256703
|
await writeReplayIndex2(sessionId, transcriptPath, index);
|
|
256315
256704
|
}
|
|
@@ -256459,7 +256848,7 @@ class Project {
|
|
|
256459
256848
|
}
|
|
256460
256849
|
async appendDirectlyToFile(filePath, data) {
|
|
256461
256850
|
transcriptRewriteHooksForTesting.beforeFileAppend?.(filePath);
|
|
256462
|
-
await
|
|
256851
|
+
await mkdir25(dirname51(filePath), { recursive: true, mode: 448 });
|
|
256463
256852
|
await withTranscriptFileLock(filePath, async (signal) => {
|
|
256464
256853
|
signal.throwIfAborted();
|
|
256465
256854
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
@@ -257190,7 +257579,7 @@ async function hydrateRemoteSession(sessionId, ingressUrl) {
|
|
|
257190
257579
|
return false;
|
|
257191
257580
|
}
|
|
257192
257581
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
257193
|
-
await
|
|
257582
|
+
await mkdir25(projectDir, { recursive: true, mode: 448 });
|
|
257194
257583
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
257195
257584
|
await project2.replaceTranscriptFile(sessionFile, serializeTranscriptEntries(remoteLogs));
|
|
257196
257585
|
logForDebugging(`Hydrated ${remoteLogs.length} entries from remote`);
|
|
@@ -257220,7 +257609,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
257220
257609
|
return false;
|
|
257221
257610
|
}
|
|
257222
257611
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
257223
|
-
await
|
|
257612
|
+
await mkdir25(projectDir, { recursive: true, mode: 448 });
|
|
257224
257613
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
257225
257614
|
await project2.replaceTranscriptFile(sessionFile, serializeTranscriptEntries(events.map((event) => event.payload)));
|
|
257226
257615
|
logForDebugging(`Hydrated ${events.length} foreground entries from CCR v2 internal events`);
|
|
@@ -257251,7 +257640,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
257251
257640
|
await Promise.all(Array.from(byAgent, async ([agentId, entries]) => {
|
|
257252
257641
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
257253
257642
|
try {
|
|
257254
|
-
await
|
|
257643
|
+
await mkdir25(dirname51(agentFile), { recursive: true, mode: 448 });
|
|
257255
257644
|
await project2.replaceTranscriptFile(agentFile, serializeTranscriptEntries(entries));
|
|
257256
257645
|
} catch {
|
|
257257
257646
|
subagentWriteFailures++;
|
|
@@ -257873,7 +258262,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
257873
258262
|
sessionBranch: sessionBranches.get(sessionId)
|
|
257874
258263
|
};
|
|
257875
258264
|
}
|
|
257876
|
-
const content = await
|
|
258265
|
+
const content = await readFile27(filePath, { encoding: "utf-8" });
|
|
257877
258266
|
let parsed;
|
|
257878
258267
|
try {
|
|
257879
258268
|
parsed = jsonParse(content);
|
|
@@ -258009,7 +258398,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
258009
258398
|
`;
|
|
258010
258399
|
if (project?._deferSynchronousAppend(fullPath, line))
|
|
258011
258400
|
return;
|
|
258012
|
-
fs2.mkdirSync(
|
|
258401
|
+
fs2.mkdirSync(dirname51(fullPath), { mode: 448 });
|
|
258013
258402
|
withTranscriptFileLockSync(fullPath, () => {
|
|
258014
258403
|
fs2.appendFileSync(fullPath, line, { mode: 384 });
|
|
258015
258404
|
});
|
|
@@ -258548,7 +258937,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
258548
258937
|
}
|
|
258549
258938
|
}
|
|
258550
258939
|
}
|
|
258551
|
-
buf ??= await
|
|
258940
|
+
buf ??= await readFile27(filePath);
|
|
258552
258941
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.ATHER_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
258553
258942
|
buf = walkChainBeforeParse(buf);
|
|
258554
258943
|
}
|
|
@@ -258725,7 +259114,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
258725
259114
|
};
|
|
258726
259115
|
}
|
|
258727
259116
|
async function loadSessionFile(sessionId) {
|
|
258728
|
-
const sessionFile =
|
|
259117
|
+
const sessionFile = join94(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
258729
259118
|
return loadTranscriptFile(sessionFile);
|
|
258730
259119
|
}
|
|
258731
259120
|
function clearSessionMessagesCache() {
|
|
@@ -258797,7 +259186,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
258797
259186
|
} catch {
|
|
258798
259187
|
return [];
|
|
258799
259188
|
}
|
|
258800
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
259189
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join94(projectsDir, dirent.name));
|
|
258801
259190
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
258802
259191
|
const allLogs = logsPerProject.flat();
|
|
258803
259192
|
const deduped = new Map;
|
|
@@ -258822,7 +259211,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
258822
259211
|
} catch {
|
|
258823
259212
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
258824
259213
|
}
|
|
258825
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
259214
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join94(projectsDir, dirent.name));
|
|
258826
259215
|
const rawLogs = [];
|
|
258827
259216
|
for (const projectDir of projectDirs) {
|
|
258828
259217
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -258883,7 +259272,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
258883
259272
|
for (const { path: wtPath, prefix } of indexed) {
|
|
258884
259273
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
258885
259274
|
seenDirs.add(dirName);
|
|
258886
|
-
allLogs.push(...await getSessionFilesLite(
|
|
259275
|
+
allLogs.push(...await getSessionFilesLite(join94(projectsDir, dirent.name), undefined, wtPath));
|
|
258887
259276
|
break;
|
|
258888
259277
|
}
|
|
258889
259278
|
}
|
|
@@ -258952,7 +259341,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
258952
259341
|
return transcripts;
|
|
258953
259342
|
}
|
|
258954
259343
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
258955
|
-
const subagentsDir =
|
|
259344
|
+
const subagentsDir = join94(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
258956
259345
|
let entries;
|
|
258957
259346
|
try {
|
|
258958
259347
|
entries = await readdir18(subagentsDir, { withFileTypes: true });
|
|
@@ -259080,7 +259469,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
259080
259469
|
const sessionId = validateUuid2(basename25(dirent.name, ".jsonl"));
|
|
259081
259470
|
if (!sessionId)
|
|
259082
259471
|
continue;
|
|
259083
|
-
candidates.push({ sessionId, filePath:
|
|
259472
|
+
candidates.push({ sessionId, filePath: join94(projectDir, dirent.name) });
|
|
259084
259473
|
}
|
|
259085
259474
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
259086
259475
|
try {
|
|
@@ -259508,7 +259897,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
259508
259897
|
init_slowOperations();
|
|
259509
259898
|
init_transcriptFileLock();
|
|
259510
259899
|
init_uuid();
|
|
259511
|
-
VERSION3 = typeof MACRO !== "undefined" ? "0.
|
|
259900
|
+
VERSION3 = typeof MACRO !== "undefined" ? "0.35.0" : "unknown";
|
|
259512
259901
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
259513
259902
|
TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
|
|
259514
259903
|
transcriptRewriteHooksForTesting = {};
|
|
@@ -259523,7 +259912,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
259523
259912
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
259524
259913
|
agentTranscriptSubdirs = new Map;
|
|
259525
259914
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
259526
|
-
return
|
|
259915
|
+
return join94(getProjectsDir(), sanitizePath(projectDir));
|
|
259527
259916
|
});
|
|
259528
259917
|
PERSISTED_OUTPUT_TAG2 = Buffer.from("<persisted-output>");
|
|
259529
259918
|
TOOL_USE_RESULT_KEY = Buffer.from('"toolUseResult":');
|
|
@@ -259886,41 +260275,41 @@ var init_memdir = __esm(() => {
|
|
|
259886
260275
|
});
|
|
259887
260276
|
|
|
259888
260277
|
// src/tools/AgentTool/agentMemory.ts
|
|
259889
|
-
import { join as
|
|
260278
|
+
import { join as join95, normalize as normalize12, sep as sep22 } from "path";
|
|
259890
260279
|
function sanitizeAgentTypeForPath(agentType) {
|
|
259891
260280
|
return agentType.replace(/:/g, "-");
|
|
259892
260281
|
}
|
|
259893
260282
|
function getLocalAgentMemoryDir(dirName) {
|
|
259894
260283
|
if (process.env.ATHER_CODE_REMOTE_MEMORY_DIR) {
|
|
259895
|
-
return
|
|
260284
|
+
return join95(process.env.ATHER_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep22;
|
|
259896
260285
|
}
|
|
259897
|
-
return
|
|
260286
|
+
return join95(getCwd(), ".ather-code", "agent-memory-local", dirName) + sep22;
|
|
259898
260287
|
}
|
|
259899
260288
|
function getAgentMemoryDir(agentType, scope) {
|
|
259900
260289
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
259901
260290
|
switch (scope) {
|
|
259902
260291
|
case "project":
|
|
259903
|
-
return
|
|
260292
|
+
return join95(getCwd(), ".ather-code", "agent-memory", dirName) + sep22;
|
|
259904
260293
|
case "local":
|
|
259905
260294
|
return getLocalAgentMemoryDir(dirName);
|
|
259906
260295
|
case "user":
|
|
259907
|
-
return
|
|
260296
|
+
return join95(getMemoryBaseDir(), "agent-memory", dirName) + sep22;
|
|
259908
260297
|
}
|
|
259909
260298
|
}
|
|
259910
260299
|
function isAgentMemoryPath(absolutePath) {
|
|
259911
260300
|
const normalizedPath = normalize12(absolutePath);
|
|
259912
260301
|
const memoryBase = getMemoryBaseDir();
|
|
259913
|
-
if (normalizedPath.startsWith(
|
|
260302
|
+
if (normalizedPath.startsWith(join95(memoryBase, "agent-memory") + sep22)) {
|
|
259914
260303
|
return true;
|
|
259915
260304
|
}
|
|
259916
|
-
if (normalizedPath.startsWith(
|
|
260305
|
+
if (normalizedPath.startsWith(join95(getCwd(), ".ather-code", "agent-memory") + sep22)) {
|
|
259917
260306
|
return true;
|
|
259918
260307
|
}
|
|
259919
260308
|
if (process.env.ATHER_CODE_REMOTE_MEMORY_DIR) {
|
|
259920
|
-
if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(
|
|
260309
|
+
if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(join95(process.env.ATHER_CODE_REMOTE_MEMORY_DIR, "projects") + sep22)) {
|
|
259921
260310
|
return true;
|
|
259922
260311
|
}
|
|
259923
|
-
} else if (normalizedPath.startsWith(
|
|
260312
|
+
} else if (normalizedPath.startsWith(join95(getCwd(), ".ather-code", "agent-memory-local") + sep22)) {
|
|
259924
260313
|
return true;
|
|
259925
260314
|
}
|
|
259926
260315
|
return false;
|
|
@@ -259995,7 +260384,7 @@ __export(exports_filesystem, {
|
|
|
259995
260384
|
});
|
|
259996
260385
|
import { randomBytes as randomBytes10 } from "crypto";
|
|
259997
260386
|
import { homedir as homedir23, tmpdir as tmpdir5 } from "os";
|
|
259998
|
-
import { join as
|
|
260387
|
+
import { join as join96, normalize as normalize13, posix as posix5, sep as sep23 } from "path";
|
|
259999
260388
|
function normalizeCaseForComparison(path13) {
|
|
260000
260389
|
return path13.toLowerCase();
|
|
260001
260390
|
}
|
|
@@ -260004,11 +260393,11 @@ function getAtherCodeSkillScope(filePath) {
|
|
|
260004
260393
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
260005
260394
|
const bases = [
|
|
260006
260395
|
{
|
|
260007
|
-
dir: expandPath(
|
|
260396
|
+
dir: expandPath(join96(getOriginalCwd(), ".ather-code", "skills")),
|
|
260008
260397
|
prefix: "/.ather-code/skills/"
|
|
260009
260398
|
},
|
|
260010
260399
|
{
|
|
260011
|
-
dir: expandPath(
|
|
260400
|
+
dir: expandPath(join96(homedir23(), ".ather-code", "skills")),
|
|
260012
260401
|
prefix: "~/.ather-code/skills/"
|
|
260013
260402
|
}
|
|
260014
260403
|
];
|
|
@@ -260063,13 +260452,13 @@ function isAtherCodeConfigFilePath(filePath) {
|
|
|
260063
260452
|
if (isAtherCodeSettingsPath(filePath)) {
|
|
260064
260453
|
return true;
|
|
260065
260454
|
}
|
|
260066
|
-
const commandsDir =
|
|
260067
|
-
const agentsDir =
|
|
260068
|
-
const skillsDir =
|
|
260455
|
+
const commandsDir = join96(getOriginalCwd(), ".ather-code", "commands");
|
|
260456
|
+
const agentsDir = join96(getOriginalCwd(), ".ather-code", "agents");
|
|
260457
|
+
const skillsDir = join96(getOriginalCwd(), ".ather-code", "skills");
|
|
260069
260458
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
260070
260459
|
}
|
|
260071
260460
|
function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
260072
|
-
const expectedPrefix =
|
|
260461
|
+
const expectedPrefix = join96(plansDir, planSlug);
|
|
260073
260462
|
const normalizedPath = normalize13(absolutePath);
|
|
260074
260463
|
if (!normalizedPath.endsWith(".md")) {
|
|
260075
260464
|
return false;
|
|
@@ -260077,7 +260466,7 @@ function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
|
260077
260466
|
if (normalizedPath === expectedPrefix + ".md") {
|
|
260078
260467
|
return true;
|
|
260079
260468
|
}
|
|
260080
|
-
const agentPrefix =
|
|
260469
|
+
const agentPrefix = join96(plansDir, AGENT_PLANS_SUBDIR, `${planSlug}-agent-`);
|
|
260081
260470
|
if (!normalizedPath.startsWith(agentPrefix)) {
|
|
260082
260471
|
return false;
|
|
260083
260472
|
}
|
|
@@ -260092,10 +260481,10 @@ function isSessionPlanFile(absolutePath) {
|
|
|
260092
260481
|
return isResolvedPathWithinPlansDir(absolutePath, plansDir);
|
|
260093
260482
|
}
|
|
260094
260483
|
function getSessionMemoryDir() {
|
|
260095
|
-
return
|
|
260484
|
+
return join96(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep23;
|
|
260096
260485
|
}
|
|
260097
260486
|
function getSessionMemoryPath() {
|
|
260098
|
-
return
|
|
260487
|
+
return join96(getSessionMemoryDir(), "summary.md");
|
|
260099
260488
|
}
|
|
260100
260489
|
function isSessionMemoryPath(absolutePath) {
|
|
260101
260490
|
const normalizedPath = normalize13(absolutePath);
|
|
@@ -260118,15 +260507,15 @@ function getAtherCodeTempDirName() {
|
|
|
260118
260507
|
}
|
|
260119
260508
|
function ensureUsableTempDir(fs2, dirPath) {
|
|
260120
260509
|
fs2.mkdirSync(dirPath, { mode: 448 });
|
|
260121
|
-
const probeDir =
|
|
260510
|
+
const probeDir = join96(dirPath, `.write-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
260122
260511
|
fs2.mkdirSync(probeDir, { mode: 448 });
|
|
260123
260512
|
fs2.rmdirSync(probeDir);
|
|
260124
260513
|
}
|
|
260125
260514
|
function getProjectTempDir() {
|
|
260126
|
-
return
|
|
260515
|
+
return join96(getAtherCodeTempDir(), sanitizePath(getOriginalCwd())) + sep23;
|
|
260127
260516
|
}
|
|
260128
260517
|
function getScratchpadDir() {
|
|
260129
|
-
return
|
|
260518
|
+
return join96(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
260130
260519
|
}
|
|
260131
260520
|
async function ensureScratchpadDir() {
|
|
260132
260521
|
if (!isScratchpadEnabled()) {
|
|
@@ -260177,7 +260566,7 @@ function getActiveSessionPlanFilePath(agentId) {
|
|
|
260177
260566
|
return getPlanFilePath2(agentId);
|
|
260178
260567
|
}
|
|
260179
260568
|
function isAtherCodeCommitMessagePath(absolutePath) {
|
|
260180
|
-
const expectedPath =
|
|
260569
|
+
const expectedPath = join96(getOriginalCwd(), ".git", "ATHER_CODE_COMMIT_MSG");
|
|
260181
260570
|
const expectedForms = getPathsForPermissionCheck(expectedPath);
|
|
260182
260571
|
const targetForms = getPathsForPermissionCheck(absolutePath);
|
|
260183
260572
|
return targetForms.length > 0 && targetForms.every((target) => expectedForms.some((expected) => pathsEqualForPermission(target, expected)));
|
|
@@ -260753,7 +261142,7 @@ function checkEditableInternalPath(absolutePath, input, toolPermissionContext) {
|
|
|
260753
261142
|
}
|
|
260754
261143
|
};
|
|
260755
261144
|
}
|
|
260756
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
261145
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join96(getOriginalCwd(), ".ather-code", "launch.json"))) {
|
|
260757
261146
|
return {
|
|
260758
261147
|
behavior: "allow",
|
|
260759
261148
|
updatedInput: input,
|
|
@@ -260860,7 +261249,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
260860
261249
|
}
|
|
260861
261250
|
};
|
|
260862
261251
|
}
|
|
260863
|
-
const tasksDir =
|
|
261252
|
+
const tasksDir = join96(getAtherCodeConfigHomeDir(), "tasks") + sep23;
|
|
260864
261253
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
260865
261254
|
return {
|
|
260866
261255
|
behavior: "allow",
|
|
@@ -260871,7 +261260,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
260871
261260
|
}
|
|
260872
261261
|
};
|
|
260873
261262
|
}
|
|
260874
|
-
const teamsReadDir =
|
|
261263
|
+
const teamsReadDir = join96(getAtherCodeConfigHomeDir(), "teams") + sep23;
|
|
260875
261264
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
260876
261265
|
return {
|
|
260877
261266
|
behavior: "allow",
|
|
@@ -260949,14 +261338,14 @@ var init_filesystem = __esm(() => {
|
|
|
260949
261338
|
try {
|
|
260950
261339
|
resolvedBaseTmpDir = fs2.realpathSync(baseTmpDir);
|
|
260951
261340
|
} catch {}
|
|
260952
|
-
const fullPath =
|
|
261341
|
+
const fullPath = join96(resolvedBaseTmpDir, getAtherCodeTempDirName()) + sep23;
|
|
260953
261342
|
try {
|
|
260954
261343
|
ensureUsableTempDir(fs2, fullPath);
|
|
260955
261344
|
} catch (e) {
|
|
260956
261345
|
if (isFsInaccessible(e)) {
|
|
260957
261346
|
const fallbackDirs = [
|
|
260958
|
-
|
|
260959
|
-
|
|
261347
|
+
join96(tmpdir5(), "ather-code-code", getAtherCodeTempDirName()) + sep23,
|
|
261348
|
+
join96(getAtherCodeConfigHomeDir(), "tmp", getAtherCodeTempDirName()) + sep23
|
|
260960
261349
|
];
|
|
260961
261350
|
for (const fallbackDir of fallbackDirs) {
|
|
260962
261351
|
try {
|
|
@@ -260975,7 +261364,7 @@ var init_filesystem = __esm(() => {
|
|
|
260975
261364
|
});
|
|
260976
261365
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
260977
261366
|
const nonce = randomBytes10(16).toString("hex");
|
|
260978
|
-
return
|
|
261367
|
+
return join96(getAtherCodeTempDir(), "bundled-skills", "0.35.0", nonce);
|
|
260979
261368
|
});
|
|
260980
261369
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
260981
261370
|
});
|
|
@@ -260983,24 +261372,24 @@ var init_filesystem = __esm(() => {
|
|
|
260983
261372
|
// src/utils/task/diskOutput.ts
|
|
260984
261373
|
import { constants as fsConstants3 } from "fs";
|
|
260985
261374
|
import {
|
|
260986
|
-
mkdir as
|
|
261375
|
+
mkdir as mkdir26,
|
|
260987
261376
|
open as open9,
|
|
260988
261377
|
stat as stat29,
|
|
260989
261378
|
symlink as symlink3,
|
|
260990
261379
|
unlink as unlink11
|
|
260991
261380
|
} from "fs/promises";
|
|
260992
|
-
import { join as
|
|
261381
|
+
import { join as join97 } from "path";
|
|
260993
261382
|
function getTaskOutputDir() {
|
|
260994
261383
|
if (_taskOutputDir === undefined) {
|
|
260995
|
-
_taskOutputDir =
|
|
261384
|
+
_taskOutputDir = join97(getProjectTempDir(), getSessionId(), "tasks");
|
|
260996
261385
|
}
|
|
260997
261386
|
return _taskOutputDir;
|
|
260998
261387
|
}
|
|
260999
261388
|
async function ensureOutputDir() {
|
|
261000
|
-
await
|
|
261389
|
+
await mkdir26(getTaskOutputDir(), { recursive: true });
|
|
261001
261390
|
}
|
|
261002
261391
|
function getTaskOutputPath(taskId) {
|
|
261003
|
-
return
|
|
261392
|
+
return join97(getTaskOutputDir(), `${taskId}.output`);
|
|
261004
261393
|
}
|
|
261005
261394
|
function track(p) {
|
|
261006
261395
|
_pendingOps.add(p);
|
|
@@ -261778,9 +262167,9 @@ var init_hookHelpers = __esm(() => {
|
|
|
261778
262167
|
});
|
|
261779
262168
|
|
|
261780
262169
|
// src/utils/hooks/execPromptHook.ts
|
|
261781
|
-
import { randomUUID as
|
|
262170
|
+
import { randomUUID as randomUUID26 } from "crypto";
|
|
261782
262171
|
async function execPromptHook(hook, hookName, hookEvent, jsonInput, signal, toolUseContext, messages, toolUseID) {
|
|
261783
|
-
const effectiveToolUseID = toolUseID || `hook-${
|
|
262172
|
+
const effectiveToolUseID = toolUseID || `hook-${randomUUID26()}`;
|
|
261784
262173
|
try {
|
|
261785
262174
|
const processedPrompt = addArgumentsToPrompt(hook.prompt, jsonInput);
|
|
261786
262175
|
logForDebugging(`Hooks: Processing prompt hook with prompt: ${processedPrompt}`);
|
|
@@ -261934,9 +262323,9 @@ var init_execPromptHook = __esm(() => {
|
|
|
261934
262323
|
});
|
|
261935
262324
|
|
|
261936
262325
|
// src/utils/hooks/execAgentHook.ts
|
|
261937
|
-
import { randomUUID as
|
|
262326
|
+
import { randomUUID as randomUUID27 } from "crypto";
|
|
261938
262327
|
async function execAgentHook(hook, hookName, hookEvent, jsonInput, signal, toolUseContext, toolUseID, _messages, agentName) {
|
|
261939
|
-
const effectiveToolUseID = toolUseID || `hook-${
|
|
262328
|
+
const effectiveToolUseID = toolUseID || `hook-${randomUUID27()}`;
|
|
261940
262329
|
const transcriptPath = toolUseContext.agentId ? getAgentTranscriptPath(toolUseContext.agentId) : getTranscriptPath();
|
|
261941
262330
|
const hookStartTime = Date.now();
|
|
261942
262331
|
try {
|
|
@@ -261971,7 +262360,7 @@ When done, return your result using the ${SYNTHETIC_OUTPUT_TOOL_NAME} tool with:
|
|
|
261971
262360
|
]);
|
|
261972
262361
|
const model = hook.model ?? getSmallFastModel();
|
|
261973
262362
|
const MAX_AGENT_TURNS = 50;
|
|
261974
|
-
const hookAgentId = asAgentId(`hook-agent-${
|
|
262363
|
+
const hookAgentId = asAgentId(`hook-agent-${randomUUID27()}`);
|
|
261975
262364
|
const agentToolUseContext = {
|
|
261976
262365
|
...toolUseContext,
|
|
261977
262366
|
agentId: hookAgentId,
|
|
@@ -262321,7 +262710,7 @@ __export(exports_hookChains, {
|
|
|
262321
262710
|
});
|
|
262322
262711
|
import { createHash as createHash15 } from "crypto";
|
|
262323
262712
|
import { statSync as statSync11 } from "fs";
|
|
262324
|
-
import { join as
|
|
262713
|
+
import { join as join98, resolve as resolve32 } from "path";
|
|
262325
262714
|
function asAnalyticsString(value) {
|
|
262326
262715
|
return value;
|
|
262327
262716
|
}
|
|
@@ -262350,7 +262739,7 @@ function getConfigPath(pathOverride) {
|
|
|
262350
262739
|
if (configuredPath) {
|
|
262351
262740
|
return resolve32(getSafeOriginalCwd(), configuredPath);
|
|
262352
262741
|
}
|
|
262353
|
-
return
|
|
262742
|
+
return join98(getSafeOriginalCwd(), DEFAULT_HOOK_CHAINS_RELATIVE_PATH);
|
|
262354
262743
|
}
|
|
262355
262744
|
function getSafeOriginalCwd() {
|
|
262356
262745
|
try {
|
|
@@ -263279,7 +263668,7 @@ var init_hookChains = __esm(() => {
|
|
|
263279
263668
|
init_teammate();
|
|
263280
263669
|
init_teammateMailbox();
|
|
263281
263670
|
init_v4();
|
|
263282
|
-
DEFAULT_HOOK_CHAINS_RELATIVE_PATH =
|
|
263671
|
+
DEFAULT_HOOK_CHAINS_RELATIVE_PATH = join98(".ather-code", "hook-chains.json");
|
|
263283
263672
|
MAX_GUARD_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
263284
263673
|
CONFIG_CACHE_MAX_AGE_MS = 5 * 60 * 1000;
|
|
263285
263674
|
HookChainOutcomeSchema = exports_external.enum(["success", "failed", "timeout", "unknown"]);
|
|
@@ -263403,7 +263792,7 @@ __export(exports_hooks, {
|
|
|
263403
263792
|
});
|
|
263404
263793
|
import { basename as basename26 } from "path";
|
|
263405
263794
|
import { spawn as spawn6 } from "child_process";
|
|
263406
|
-
import { randomUUID as
|
|
263795
|
+
import { randomUUID as randomUUID28 } from "crypto";
|
|
263407
263796
|
function dedupeRegisteredPluginHooks(registeredHooks) {
|
|
263408
263797
|
const seenPluginMatchers = new Set;
|
|
263409
263798
|
const deduped = [];
|
|
@@ -264539,7 +264928,7 @@ async function* executeHooks({
|
|
|
264539
264928
|
parentToolUseID: toolUseID,
|
|
264540
264929
|
toolUseID,
|
|
264541
264930
|
timestamp: new Date().toISOString(),
|
|
264542
|
-
uuid:
|
|
264931
|
+
uuid: randomUUID28()
|
|
264543
264932
|
}
|
|
264544
264933
|
};
|
|
264545
264934
|
}
|
|
@@ -264601,7 +264990,7 @@ async function* executeHooks({
|
|
|
264601
264990
|
const { signal: abortSignal, cleanup } = createCombinedAbortSignal(signal, {
|
|
264602
264991
|
timeoutMs: commandTimeoutMs
|
|
264603
264992
|
});
|
|
264604
|
-
const hookId =
|
|
264993
|
+
const hookId = randomUUID28();
|
|
264605
264994
|
const hookStartMs = Date.now();
|
|
264606
264995
|
const hookCommand = getHookDisplayText(hook);
|
|
264607
264996
|
try {
|
|
@@ -265249,7 +265638,7 @@ async function executeHooksOutsideREPL({
|
|
|
265249
265638
|
const callbackTimeoutMs = hook.timeout ? hook.timeout * 1000 : timeoutMs;
|
|
265250
265639
|
const { signal: abortSignal2, cleanup: cleanup2 } = createCombinedAbortSignal(signal, { timeoutMs: callbackTimeoutMs });
|
|
265251
265640
|
try {
|
|
265252
|
-
const toolUseID =
|
|
265641
|
+
const toolUseID = randomUUID28();
|
|
265253
265642
|
const json2 = await hook.callback(hookInput, toolUseID, abortSignal2, hookIndex);
|
|
265254
265643
|
cleanup2?.();
|
|
265255
265644
|
if (isAsyncHookJSONOutput(json2)) {
|
|
@@ -265360,7 +265749,7 @@ async function executeHooksOutsideREPL({
|
|
|
265360
265749
|
const commandTimeoutMs = hook.timeout ? hook.timeout * 1000 : timeoutMs;
|
|
265361
265750
|
const { signal: abortSignal, cleanup } = createCombinedAbortSignal(signal, { timeoutMs: commandTimeoutMs });
|
|
265362
265751
|
try {
|
|
265363
|
-
const result = await execCommandHook(hook, hookEvent, hookName, jsonInput, abortSignal,
|
|
265752
|
+
const result = await execCommandHook(hook, hookEvent, hookName, jsonInput, abortSignal, randomUUID28(), hookIndex, pluginRoot, pluginId);
|
|
265364
265753
|
cleanup?.();
|
|
265365
265754
|
if (result.aborted) {
|
|
265366
265755
|
logForDebugging(`${hookName} [${hook.command}] cancelled`);
|
|
@@ -265578,7 +265967,7 @@ async function* executeStopHooks(permissionMode, signal, timeoutMs = TOOL_HOOK_E
|
|
|
265578
265967
|
};
|
|
265579
265968
|
yield* executeHooks({
|
|
265580
265969
|
hookInput,
|
|
265581
|
-
toolUseID:
|
|
265970
|
+
toolUseID: randomUUID28(),
|
|
265582
265971
|
signal,
|
|
265583
265972
|
timeoutMs,
|
|
265584
265973
|
toolUseContext,
|
|
@@ -265595,7 +265984,7 @@ async function* executeTeammateIdleHooks(teammateName, teamName, permissionMode,
|
|
|
265595
265984
|
};
|
|
265596
265985
|
yield* executeHooks({
|
|
265597
265986
|
hookInput,
|
|
265598
|
-
toolUseID:
|
|
265987
|
+
toolUseID: randomUUID28(),
|
|
265599
265988
|
signal,
|
|
265600
265989
|
timeoutMs
|
|
265601
265990
|
});
|
|
@@ -265612,7 +266001,7 @@ async function* executeTaskCreatedHooks(taskId, taskSubject, taskDescription, te
|
|
|
265612
266001
|
};
|
|
265613
266002
|
yield* executeHooks({
|
|
265614
266003
|
hookInput,
|
|
265615
|
-
toolUseID:
|
|
266004
|
+
toolUseID: randomUUID28(),
|
|
265616
266005
|
signal,
|
|
265617
266006
|
timeoutMs,
|
|
265618
266007
|
toolUseContext
|
|
@@ -265632,7 +266021,7 @@ async function* executeTaskCompletedHooks(taskId, taskSubject, taskDescription,
|
|
|
265632
266021
|
let preventedContinuation = false;
|
|
265633
266022
|
for await (const result of executeHooks({
|
|
265634
266023
|
hookInput,
|
|
265635
|
-
toolUseID:
|
|
266024
|
+
toolUseID: randomUUID28(),
|
|
265636
266025
|
signal,
|
|
265637
266026
|
timeoutMs,
|
|
265638
266027
|
toolUseContext
|
|
@@ -265670,7 +266059,7 @@ async function* executeUserPromptSubmitHooks(prompt, permissionMode, toolUseCont
|
|
|
265670
266059
|
};
|
|
265671
266060
|
yield* executeHooks({
|
|
265672
266061
|
hookInput,
|
|
265673
|
-
toolUseID:
|
|
266062
|
+
toolUseID: randomUUID28(),
|
|
265674
266063
|
signal: toolUseContext.abortController.signal,
|
|
265675
266064
|
timeoutMs: TOOL_HOOK_EXECUTION_TIMEOUT_MS,
|
|
265676
266065
|
toolUseContext,
|
|
@@ -265687,7 +266076,7 @@ async function* executeSessionStartHooks(source, sessionId, agentType, model, si
|
|
|
265687
266076
|
};
|
|
265688
266077
|
yield* executeHooks({
|
|
265689
266078
|
hookInput,
|
|
265690
|
-
toolUseID:
|
|
266079
|
+
toolUseID: randomUUID28(),
|
|
265691
266080
|
matchQuery: source,
|
|
265692
266081
|
signal,
|
|
265693
266082
|
timeoutMs,
|
|
@@ -265702,7 +266091,7 @@ async function* executeSetupHooks(trigger, signal, timeoutMs = TOOL_HOOK_EXECUTI
|
|
|
265702
266091
|
};
|
|
265703
266092
|
yield* executeHooks({
|
|
265704
266093
|
hookInput,
|
|
265705
|
-
toolUseID:
|
|
266094
|
+
toolUseID: randomUUID28(),
|
|
265706
266095
|
matchQuery: trigger,
|
|
265707
266096
|
signal,
|
|
265708
266097
|
timeoutMs,
|
|
@@ -265718,7 +266107,7 @@ async function* executeSubagentStartHooks(agentId, agentType, signal, timeoutMs
|
|
|
265718
266107
|
};
|
|
265719
266108
|
yield* executeHooks({
|
|
265720
266109
|
hookInput,
|
|
265721
|
-
toolUseID:
|
|
266110
|
+
toolUseID: randomUUID28(),
|
|
265722
266111
|
matchQuery: agentType,
|
|
265723
266112
|
signal,
|
|
265724
266113
|
timeoutMs
|
|
@@ -266081,7 +266470,7 @@ async function executeStatusLineCommand(statusLineInput, signal, timeoutMs = 500
|
|
|
266081
266470
|
const { signal: abortSignal, cleanup } = signal ? { signal, cleanup: () => {} } : createCombinedAbortSignal(undefined, { timeoutMs });
|
|
266082
266471
|
try {
|
|
266083
266472
|
const jsonInput = jsonStringify(statusLineInput);
|
|
266084
|
-
const result = await execCommandHook(statusLine, "StatusLine", "statusLine", jsonInput, abortSignal,
|
|
266473
|
+
const result = await execCommandHook(statusLine, "StatusLine", "statusLine", jsonInput, abortSignal, randomUUID28());
|
|
266085
266474
|
if (result.aborted) {
|
|
266086
266475
|
return;
|
|
266087
266476
|
}
|
|
@@ -266127,7 +266516,7 @@ async function executeFileSuggestionCommand(fileSuggestionInput, signal, timeout
|
|
|
266127
266516
|
try {
|
|
266128
266517
|
const jsonInput = jsonStringify(fileSuggestionInput);
|
|
266129
266518
|
const hook = { type: "command", command: fileSuggestion.command };
|
|
266130
|
-
const result = await execCommandHook(hook, "FileSuggestion", "FileSuggestion", jsonInput, abortSignal,
|
|
266519
|
+
const result = await execCommandHook(hook, "FileSuggestion", "FileSuggestion", jsonInput, abortSignal, randomUUID28());
|
|
266131
266520
|
if (result.aborted || result.status !== 0) {
|
|
266132
266521
|
return [];
|
|
266133
266522
|
}
|
|
@@ -266379,14 +266768,14 @@ var init_hooks4 = __esm(() => {
|
|
|
266379
266768
|
// src/utils/worktree.ts
|
|
266380
266769
|
import {
|
|
266381
266770
|
copyFile as copyFile6,
|
|
266382
|
-
mkdir as
|
|
266771
|
+
mkdir as mkdir27,
|
|
266383
266772
|
readdir as readdir19,
|
|
266384
|
-
readFile as
|
|
266773
|
+
readFile as readFile28,
|
|
266385
266774
|
stat as stat31,
|
|
266386
266775
|
symlink as symlink4,
|
|
266387
266776
|
utimes as utimes2
|
|
266388
266777
|
} from "fs/promises";
|
|
266389
|
-
import { basename as basename27, dirname as
|
|
266778
|
+
import { basename as basename27, dirname as dirname53, join as join99 } from "path";
|
|
266390
266779
|
function validateWorktreeSlug(slug) {
|
|
266391
266780
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
266392
266781
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -266401,7 +266790,7 @@ function validateWorktreeSlug(slug) {
|
|
|
266401
266790
|
}
|
|
266402
266791
|
}
|
|
266403
266792
|
async function mkdirRecursive(dirPath) {
|
|
266404
|
-
await
|
|
266793
|
+
await mkdir27(dirPath, { recursive: true });
|
|
266405
266794
|
}
|
|
266406
266795
|
async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
266407
266796
|
for (const dir of dirsToSymlink) {
|
|
@@ -266409,8 +266798,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
266409
266798
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
266410
266799
|
continue;
|
|
266411
266800
|
}
|
|
266412
|
-
const sourcePath =
|
|
266413
|
-
const destPath =
|
|
266801
|
+
const sourcePath = join99(repoRootPath, dir);
|
|
266802
|
+
const destPath = join99(worktreePath, dir);
|
|
266414
266803
|
try {
|
|
266415
266804
|
await symlink4(sourcePath, destPath, "dir");
|
|
266416
266805
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -266444,7 +266833,7 @@ async function withGitWorktreeMutationLock(repoRoot, fn) {
|
|
|
266444
266833
|
}
|
|
266445
266834
|
}
|
|
266446
266835
|
function worktreesDir(repoRoot) {
|
|
266447
|
-
return
|
|
266836
|
+
return join99(repoRoot, ".ather-code", "worktrees");
|
|
266448
266837
|
}
|
|
266449
266838
|
function flattenSlug(slug) {
|
|
266450
266839
|
return slug.replaceAll("/", "+");
|
|
@@ -266458,7 +266847,7 @@ function buildRevParseFailureMessage(baseBranch, stderr, exitCode) {
|
|
|
266458
266847
|
return `Failed to resolve base branch "${baseBranch}": ${detail}${hint}`;
|
|
266459
266848
|
}
|
|
266460
266849
|
function worktreePathFor(repoRoot, slug) {
|
|
266461
|
-
return
|
|
266850
|
+
return join99(worktreesDir(repoRoot), flattenSlug(slug));
|
|
266462
266851
|
}
|
|
266463
266852
|
async function autoConfigureLongPathsForWorktrees(repoRoot) {
|
|
266464
266853
|
if (_testDeps.getPlatform() !== "windows") {
|
|
@@ -266575,7 +266964,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
266575
266964
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
266576
266965
|
let includeContent;
|
|
266577
266966
|
try {
|
|
266578
|
-
includeContent = await
|
|
266967
|
+
includeContent = await readFile28(join99(repoRoot, ".worktreeinclude"), "utf-8");
|
|
266579
266968
|
} catch {
|
|
266580
266969
|
return [];
|
|
266581
266970
|
}
|
|
@@ -266630,10 +267019,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
266630
267019
|
}
|
|
266631
267020
|
const copied = [];
|
|
266632
267021
|
for (const relativePath2 of files) {
|
|
266633
|
-
const srcPath =
|
|
266634
|
-
const destPath =
|
|
267022
|
+
const srcPath = join99(repoRoot, relativePath2);
|
|
267023
|
+
const destPath = join99(worktreePath, relativePath2);
|
|
266635
267024
|
try {
|
|
266636
|
-
await
|
|
267025
|
+
await mkdir27(dirname53(destPath), { recursive: true });
|
|
266637
267026
|
await copyFile6(srcPath, destPath);
|
|
266638
267027
|
copied.push(relativePath2);
|
|
266639
267028
|
} catch (e) {
|
|
@@ -266647,10 +267036,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
266647
267036
|
}
|
|
266648
267037
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
266649
267038
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
266650
|
-
const sourceSettingsLocal =
|
|
267039
|
+
const sourceSettingsLocal = join99(repoRoot, localSettingsRelativePath);
|
|
266651
267040
|
try {
|
|
266652
|
-
const destSettingsLocal =
|
|
266653
|
-
await mkdirRecursive(
|
|
267041
|
+
const destSettingsLocal = join99(worktreePath, localSettingsRelativePath);
|
|
267042
|
+
await mkdirRecursive(dirname53(destSettingsLocal));
|
|
266654
267043
|
await copyFile6(sourceSettingsLocal, destSettingsLocal);
|
|
266655
267044
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
266656
267045
|
} catch (e) {
|
|
@@ -266659,8 +267048,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
266659
267048
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
266660
267049
|
}
|
|
266661
267050
|
}
|
|
266662
|
-
const huskyPath =
|
|
266663
|
-
const gitHooksPath =
|
|
267051
|
+
const huskyPath = join99(repoRoot, ".husky");
|
|
267052
|
+
const gitHooksPath = join99(repoRoot, ".git", "hooks");
|
|
266664
267053
|
let hooksPath = null;
|
|
266665
267054
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
266666
267055
|
try {
|
|
@@ -266921,7 +267310,7 @@ var init_worktree = __esm(() => {
|
|
|
266921
267310
|
getPlatform: () => getPlatform(),
|
|
266922
267311
|
getInitialSettings: () => getInitialSettings(),
|
|
266923
267312
|
execFileNoThrowWithCwd: (exe, args, opts) => execFileNoThrowWithCwd(exe, args, opts),
|
|
266924
|
-
mkdir: (path13, opts) =>
|
|
267313
|
+
mkdir: (path13, opts) => mkdir27(path13, opts),
|
|
266925
267314
|
readWorktreeHeadSha: (path13) => readWorktreeHeadSha(path13),
|
|
266926
267315
|
resolveGitDir: (path13) => resolveGitDir(path13),
|
|
266927
267316
|
resolveRef: (gitDir, ref) => resolveRef(gitDir, ref),
|
|
@@ -267176,14 +267565,14 @@ Date: ${getSessionStartDate()}`
|
|
|
267176
267565
|
].filter((s) => s !== null);
|
|
267177
267566
|
}
|
|
267178
267567
|
function getMcpInstructions(mcpClients) {
|
|
267179
|
-
const connectedClients = mcpClients.filter((
|
|
267180
|
-
const clientsWithInstructions = connectedClients.filter((
|
|
267568
|
+
const connectedClients = mcpClients.filter((client2) => client2.type === "connected");
|
|
267569
|
+
const clientsWithInstructions = connectedClients.filter((client2) => client2.instructions);
|
|
267181
267570
|
if (clientsWithInstructions.length === 0) {
|
|
267182
267571
|
return null;
|
|
267183
267572
|
}
|
|
267184
|
-
const instructionBlocks = clientsWithInstructions.map((
|
|
267185
|
-
return `## ${
|
|
267186
|
-
${
|
|
267573
|
+
const instructionBlocks = clientsWithInstructions.map((client2) => {
|
|
267574
|
+
return `## ${client2.name}
|
|
267575
|
+
${client2.instructions}`;
|
|
267187
267576
|
}).join(`
|
|
267188
267577
|
|
|
267189
267578
|
`);
|
|
@@ -267859,7 +268248,7 @@ function insertBlockAfterToolResults(content, block2) {
|
|
|
267859
268248
|
}
|
|
267860
268249
|
|
|
267861
268250
|
// src/services/api/ather-code.ts
|
|
267862
|
-
import { randomUUID as
|
|
268251
|
+
import { randomUUID as randomUUID29 } from "crypto";
|
|
267863
268252
|
import {
|
|
267864
268253
|
APIError as APIError12,
|
|
267865
268254
|
APIUserAbortError as APIUserAbortError6
|
|
@@ -268834,7 +269223,7 @@ ${deferredToolList}
|
|
|
268834
269223
|
if (!options2.agentId) {
|
|
268835
269224
|
headlessProfilerCheckpoint("api_request_sent");
|
|
268836
269225
|
}
|
|
268837
|
-
clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ?
|
|
269226
|
+
clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ? randomUUID29() : undefined;
|
|
268838
269227
|
const attemptApiCallKey = startActiveApiCall({
|
|
268839
269228
|
clientRequestId,
|
|
268840
269229
|
model: options2.model,
|
|
@@ -269083,7 +269472,7 @@ ${deferredToolList}
|
|
|
269083
269472
|
},
|
|
269084
269473
|
requestId: streamRequestId ?? undefined,
|
|
269085
269474
|
type: "assistant",
|
|
269086
|
-
uuid:
|
|
269475
|
+
uuid: randomUUID29(),
|
|
269087
269476
|
timestamp: new Date().toISOString(),
|
|
269088
269477
|
...false,
|
|
269089
269478
|
...advisorModel && { advisorModel }
|
|
@@ -269308,7 +269697,7 @@ ${deferredToolList}
|
|
|
269308
269697
|
},
|
|
269309
269698
|
requestId: streamRequestId ?? undefined,
|
|
269310
269699
|
type: "assistant",
|
|
269311
|
-
uuid:
|
|
269700
|
+
uuid: randomUUID29(),
|
|
269312
269701
|
timestamp: new Date().toISOString(),
|
|
269313
269702
|
...false,
|
|
269314
269703
|
...advisorModel && {
|
|
@@ -269398,7 +269787,7 @@ ${deferredToolList}
|
|
|
269398
269787
|
},
|
|
269399
269788
|
requestId: streamRequestId ?? undefined,
|
|
269400
269789
|
type: "assistant",
|
|
269401
|
-
uuid:
|
|
269790
|
+
uuid: randomUUID29(),
|
|
269402
269791
|
timestamp: new Date().toISOString(),
|
|
269403
269792
|
...false,
|
|
269404
269793
|
...advisorModel && { advisorModel }
|
|
@@ -269842,7 +270231,7 @@ var init_ather_code3 = __esm(() => {
|
|
|
269842
270231
|
init_utils4();
|
|
269843
270232
|
init_vcr();
|
|
269844
270233
|
init_authRouting();
|
|
269845
|
-
|
|
270234
|
+
init_client5();
|
|
269846
270235
|
init_errors4();
|
|
269847
270236
|
init_logging();
|
|
269848
270237
|
init_promptCacheBreakDetection();
|
|
@@ -269945,18 +270334,18 @@ function assertFunction(value, field) {
|
|
|
269945
270334
|
}
|
|
269946
270335
|
|
|
269947
270336
|
// src/utils/imageStore.ts
|
|
269948
|
-
import { mkdir as
|
|
269949
|
-
import { join as
|
|
270337
|
+
import { mkdir as mkdir28, open as open10 } from "fs/promises";
|
|
270338
|
+
import { join as join100 } from "path";
|
|
269950
270339
|
function getImageStoreDir() {
|
|
269951
|
-
return
|
|
270340
|
+
return join100(getAtherCodeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
|
|
269952
270341
|
}
|
|
269953
270342
|
async function ensureImageStoreDir() {
|
|
269954
270343
|
const dir = getImageStoreDir();
|
|
269955
|
-
await
|
|
270344
|
+
await mkdir28(dir, { recursive: true });
|
|
269956
270345
|
}
|
|
269957
270346
|
function getImagePath(imageId, mediaType) {
|
|
269958
270347
|
const extension2 = mediaType.split("/")[1] || "png";
|
|
269959
|
-
return
|
|
270348
|
+
return join100(getImageStoreDir(), `${imageId}.${extension2}`);
|
|
269960
270349
|
}
|
|
269961
270350
|
async function storeImage(content) {
|
|
269962
270351
|
if (content.type !== "image") {
|
|
@@ -270031,9 +270420,9 @@ function matchesKeepGoingKeyword(input) {
|
|
|
270031
270420
|
}
|
|
270032
270421
|
|
|
270033
270422
|
// src/utils/processUserInput/processTextPrompt.ts
|
|
270034
|
-
import { randomUUID as
|
|
270423
|
+
import { randomUUID as randomUUID30 } from "crypto";
|
|
270035
270424
|
function processTextPrompt(input, imageContentBlocks, imagePasteIds, attachmentMessages, uuid3, permissionMode, isMeta) {
|
|
270036
|
-
const promptId =
|
|
270425
|
+
const promptId = randomUUID30();
|
|
270037
270426
|
setPromptId(promptId);
|
|
270038
270427
|
const userPromptText = typeof input === "string" ? input : input.find((block2) => block2.type === "text")?.text || "";
|
|
270039
270428
|
startInteractionSpan(userPromptText);
|
|
@@ -274554,7 +274943,7 @@ async function* runPowerShellCommand({
|
|
|
274554
274943
|
}
|
|
274555
274944
|
}
|
|
274556
274945
|
var EOL2 = `
|
|
274557
|
-
`, MAX_PERSISTED_POWERSHELL_OUTPUT_SIZE, PS_SEARCH_COMMANDS, PS_READ_COMMANDS, PS_SEMANTIC_NEUTRAL_COMMANDS, PROGRESS_THRESHOLD_MS3 = 2000, PROGRESS_INTERVAL_MS = 1000, ASSISTANT_BLOCKING_BUDGET_MS2 = 15000, DISALLOWED_AUTO_BACKGROUND_COMMANDS2, WINDOWS_SANDBOX_POLICY_REFUSAL = "Enterprise policy requires sandboxing, but sandboxing is not available on native Windows. Shell command execution is blocked on this platform by policy.", isBackgroundTasksDisabled3, fullInputSchema3,
|
|
274946
|
+
`, MAX_PERSISTED_POWERSHELL_OUTPUT_SIZE, PS_SEARCH_COMMANDS, PS_READ_COMMANDS, PS_SEMANTIC_NEUTRAL_COMMANDS, PROGRESS_THRESHOLD_MS3 = 2000, PROGRESS_INTERVAL_MS = 1000, ASSISTANT_BLOCKING_BUDGET_MS2 = 15000, DISALLOWED_AUTO_BACKGROUND_COMMANDS2, WINDOWS_SANDBOX_POLICY_REFUSAL = "Enterprise policy requires sandboxing, but sandboxing is not available on native Windows. Shell command execution is blocked on this platform by policy.", isBackgroundTasksDisabled3, fullInputSchema3, inputSchema45, outputSchema36, COMMON_BACKGROUND_COMMANDS2, PowerShellTool;
|
|
274558
274947
|
var init_PowerShellTool3 = __esm(() => {
|
|
274559
274948
|
init_v4();
|
|
274560
274949
|
init_state();
|
|
@@ -274625,7 +275014,7 @@ var init_PowerShellTool3 = __esm(() => {
|
|
|
274625
275014
|
dangerouslyDisableSandbox: semanticBoolean(exports_external.boolean().optional()).describe("Set this to true to dangerously override sandbox mode and run commands without sandboxing."),
|
|
274626
275015
|
_dangerouslyDisableSandboxApproved: exports_external.boolean().optional().describe("Internal: user-approved sandbox override")
|
|
274627
275016
|
}));
|
|
274628
|
-
|
|
275017
|
+
inputSchema45 = lazySchema(() => isBackgroundTasksDisabled3 ? fullInputSchema3().omit({
|
|
274629
275018
|
run_in_background: true,
|
|
274630
275019
|
dangerouslyDisableSandbox: true,
|
|
274631
275020
|
_dangerouslyDisableSandboxApproved: true
|
|
@@ -274633,7 +275022,7 @@ var init_PowerShellTool3 = __esm(() => {
|
|
|
274633
275022
|
dangerouslyDisableSandbox: true,
|
|
274634
275023
|
_dangerouslyDisableSandboxApproved: true
|
|
274635
275024
|
}));
|
|
274636
|
-
|
|
275025
|
+
outputSchema36 = lazySchema(() => exports_external.object({
|
|
274637
275026
|
stdout: exports_external.string().describe("The standard output of the command"),
|
|
274638
275027
|
stderr: exports_external.string().describe("The standard error output of the command"),
|
|
274639
275028
|
interrupted: exports_external.boolean().describe("Whether the command was interrupted"),
|
|
@@ -274687,10 +275076,10 @@ var init_PowerShellTool3 = __esm(() => {
|
|
|
274687
275076
|
return input.command;
|
|
274688
275077
|
},
|
|
274689
275078
|
get inputSchema() {
|
|
274690
|
-
return
|
|
275079
|
+
return inputSchema45();
|
|
274691
275080
|
},
|
|
274692
275081
|
get outputSchema() {
|
|
274693
|
-
return
|
|
275082
|
+
return outputSchema36();
|
|
274694
275083
|
},
|
|
274695
275084
|
userFacingName() {
|
|
274696
275085
|
return "PowerShell";
|
|
@@ -275006,7 +275395,7 @@ var exports_processBashCommand = {};
|
|
|
275006
275395
|
__export(exports_processBashCommand, {
|
|
275007
275396
|
processBashCommand: () => processBashCommand
|
|
275008
275397
|
});
|
|
275009
|
-
import { randomUUID as
|
|
275398
|
+
import { randomUUID as randomUUID31 } from "crypto";
|
|
275010
275399
|
import { jsx as jsx9, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
275011
275400
|
async function processBashCommand(inputString, precedingInputBlocks, attachmentMessages, context2, setToolJSX) {
|
|
275012
275401
|
const usePowerShell = isPowerShellToolEnabled() && resolveDefaultShell() === "powershell";
|
|
@@ -275075,7 +275464,7 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
|
|
|
275075
275464
|
const mapped = await processToolResultBlock(shellTool, {
|
|
275076
275465
|
...data,
|
|
275077
275466
|
stderr: ""
|
|
275078
|
-
},
|
|
275467
|
+
}, randomUUID31());
|
|
275079
275468
|
if (typeof mapped.content === "string") {
|
|
275080
275469
|
stdout = mapped.content;
|
|
275081
275470
|
}
|
|
@@ -275124,7 +275513,7 @@ var init_processBashCommand = __esm(() => {
|
|
|
275124
275513
|
});
|
|
275125
275514
|
|
|
275126
275515
|
// src/utils/processUserInput/processUserInput.ts
|
|
275127
|
-
import { randomUUID as
|
|
275516
|
+
import { randomUUID as randomUUID32 } from "crypto";
|
|
275128
275517
|
async function processUserInput({
|
|
275129
275518
|
input,
|
|
275130
275519
|
preExpansionInput,
|
|
@@ -275187,7 +275576,7 @@ Original prompt: ${input}`, "warning")
|
|
|
275187
275576
|
type: "hook_additional_context",
|
|
275188
275577
|
content: hookResult.additionalContexts.map(applyTruncation),
|
|
275189
275578
|
hookName: "UserPromptSubmit",
|
|
275190
|
-
toolUseID: `hook-${
|
|
275579
|
+
toolUseID: `hook-${randomUUID32()}`,
|
|
275191
275580
|
hookEvent: "UserPromptSubmit"
|
|
275192
275581
|
}));
|
|
275193
275582
|
}
|
|
@@ -275460,7 +275849,7 @@ var init_messageFilters = __esm(() => {
|
|
|
275460
275849
|
});
|
|
275461
275850
|
|
|
275462
275851
|
// src/utils/messages/systemInit.ts
|
|
275463
|
-
import { randomUUID as
|
|
275852
|
+
import { randomUUID as randomUUID33 } from "crypto";
|
|
275464
275853
|
function sdkCompatToolName(name) {
|
|
275465
275854
|
return name === AGENT_TOOL_NAME ? LEGACY_AGENT_TOOL_NAME : name;
|
|
275466
275855
|
}
|
|
@@ -275473,16 +275862,16 @@ function buildSystemInitMessage(inputs) {
|
|
|
275473
275862
|
cwd: getCwd(),
|
|
275474
275863
|
session_id: getSessionId(),
|
|
275475
275864
|
tools: inputs.tools.map((tool2) => sdkCompatToolName(tool2.name)),
|
|
275476
|
-
mcp_servers: inputs.mcpClients.map((
|
|
275477
|
-
name:
|
|
275478
|
-
status:
|
|
275865
|
+
mcp_servers: inputs.mcpClients.map((client2) => ({
|
|
275866
|
+
name: client2.name,
|
|
275867
|
+
status: client2.type
|
|
275479
275868
|
})),
|
|
275480
275869
|
model: inputs.model,
|
|
275481
275870
|
permissionMode: inputs.permissionMode,
|
|
275482
275871
|
slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
|
|
275483
275872
|
apiKeySource: getAtherApiKeyWithSource().source,
|
|
275484
275873
|
betas: getSdkBetas(),
|
|
275485
|
-
ather_code_code_version: "0.
|
|
275874
|
+
ather_code_code_version: "0.35.0",
|
|
275486
275875
|
output_style: outputStyle,
|
|
275487
275876
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
275488
275877
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -275491,7 +275880,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
275491
275880
|
path: plugin.path,
|
|
275492
275881
|
source: plugin.source
|
|
275493
275882
|
})),
|
|
275494
|
-
uuid:
|
|
275883
|
+
uuid: randomUUID33()
|
|
275495
275884
|
};
|
|
275496
275885
|
if (false) {}
|
|
275497
275886
|
initMessage.fast_mode_state = getFastModeState(inputs.model, inputs.fastMode);
|
|
@@ -275508,7 +275897,7 @@ var init_systemInit = __esm(() => {
|
|
|
275508
275897
|
});
|
|
275509
275898
|
|
|
275510
275899
|
// src/QueryEngine.ts
|
|
275511
|
-
import { randomUUID as
|
|
275900
|
+
import { randomUUID as randomUUID34 } from "crypto";
|
|
275512
275901
|
import { stripVTControlCharacters as stripAnsi2 } from "node:util";
|
|
275513
275902
|
|
|
275514
275903
|
class QueryEngine {
|
|
@@ -275535,7 +275924,7 @@ class QueryEngine {
|
|
|
275535
275924
|
this.totalUsage = EMPTY_USAGE;
|
|
275536
275925
|
}
|
|
275537
275926
|
async* submitMessage(prompt, options2) {
|
|
275538
|
-
const queryId = isInterruptionTraceEnabled() ?
|
|
275927
|
+
const queryId = isInterruptionTraceEnabled() ? randomUUID34() : undefined;
|
|
275539
275928
|
registerInterruptionController(this.abortController, {
|
|
275540
275929
|
subsystem: "query_engine",
|
|
275541
275930
|
controllerRole: "query-root",
|
|
@@ -275858,7 +276247,7 @@ class QueryEngine {
|
|
|
275858
276247
|
modelUsage: getModelUsage(),
|
|
275859
276248
|
permission_denials: this.permissionDenials,
|
|
275860
276249
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
275861
|
-
uuid:
|
|
276250
|
+
uuid: randomUUID34()
|
|
275862
276251
|
};
|
|
275863
276252
|
return;
|
|
275864
276253
|
}
|
|
@@ -275986,7 +276375,7 @@ class QueryEngine {
|
|
|
275986
276375
|
event: message.event,
|
|
275987
276376
|
session_id: getSessionId(),
|
|
275988
276377
|
parent_tool_use_id: null,
|
|
275989
|
-
uuid:
|
|
276378
|
+
uuid: randomUUID34()
|
|
275990
276379
|
};
|
|
275991
276380
|
}
|
|
275992
276381
|
break;
|
|
@@ -276018,7 +276407,7 @@ class QueryEngine {
|
|
|
276018
276407
|
modelUsage: getModelUsage(),
|
|
276019
276408
|
permission_denials: this.permissionDenials,
|
|
276020
276409
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
276021
|
-
uuid:
|
|
276410
|
+
uuid: randomUUID34(),
|
|
276022
276411
|
errors: [
|
|
276023
276412
|
renderAtherError("ATHER-AGENT-001", {
|
|
276024
276413
|
turns: String(message.attachment.maxTurns)
|
|
@@ -276121,7 +276510,7 @@ class QueryEngine {
|
|
|
276121
276510
|
modelUsage: getModelUsage(),
|
|
276122
276511
|
permission_denials: this.permissionDenials,
|
|
276123
276512
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
276124
|
-
uuid:
|
|
276513
|
+
uuid: randomUUID34(),
|
|
276125
276514
|
errors: [`Reached maximum budget ($${maxBudgetUsd})`]
|
|
276126
276515
|
};
|
|
276127
276516
|
return;
|
|
@@ -276151,7 +276540,7 @@ class QueryEngine {
|
|
|
276151
276540
|
modelUsage: getModelUsage(),
|
|
276152
276541
|
permission_denials: this.permissionDenials,
|
|
276153
276542
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
276154
|
-
uuid:
|
|
276543
|
+
uuid: randomUUID34(),
|
|
276155
276544
|
errors: [
|
|
276156
276545
|
`Failed to provide valid structured output after ${maxRetries} attempts`
|
|
276157
276546
|
]
|
|
@@ -276183,7 +276572,7 @@ class QueryEngine {
|
|
|
276183
276572
|
modelUsage: getModelUsage(),
|
|
276184
276573
|
permission_denials: this.permissionDenials,
|
|
276185
276574
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
276186
|
-
uuid:
|
|
276575
|
+
uuid: randomUUID34(),
|
|
276187
276576
|
errors: (() => {
|
|
276188
276577
|
const all4 = getInMemoryErrors();
|
|
276189
276578
|
const start = errorLogWatermark ? all4.lastIndexOf(errorLogWatermark) + 1 : 0;
|
|
@@ -276220,7 +276609,7 @@ class QueryEngine {
|
|
|
276220
276609
|
permission_denials: this.permissionDenials,
|
|
276221
276610
|
structured_output: structuredOutputFromTool,
|
|
276222
276611
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
276223
|
-
uuid:
|
|
276612
|
+
uuid: randomUUID34()
|
|
276224
276613
|
};
|
|
276225
276614
|
}
|
|
276226
276615
|
interrupt(source = "programmatic_interrupt") {
|
|
@@ -277726,9 +278115,9 @@ __export(exports_netRelay, {
|
|
|
277726
278115
|
getNetRelayEnv: () => getNetRelayEnv,
|
|
277727
278116
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
277728
278117
|
});
|
|
277729
|
-
import { mkdir as
|
|
278118
|
+
import { mkdir as mkdir29, readFile as readFile29, unlink as unlink13, writeFile as writeFile23 } from "fs/promises";
|
|
277730
278119
|
import { homedir as homedir25 } from "os";
|
|
277731
|
-
import { join as
|
|
278120
|
+
import { join as join101 } from "path";
|
|
277732
278121
|
async function initNetRelay(opts) {
|
|
277733
278122
|
if (!isEnvTruthy(process.env.ATHER_CODE_REMOTE)) {
|
|
277734
278123
|
return state2;
|
|
@@ -277749,7 +278138,7 @@ async function initNetRelay(opts) {
|
|
|
277749
278138
|
}
|
|
277750
278139
|
setNonDumpable();
|
|
277751
278140
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
277752
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
278141
|
+
const caBundlePath = opts?.caBundlePath ?? join101(homedir25(), ".ccr", "ca-bundle.crt");
|
|
277753
278142
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
277754
278143
|
if (!caOk)
|
|
277755
278144
|
return state2;
|
|
@@ -277813,7 +278202,7 @@ function isValidPemContent(content) {
|
|
|
277813
278202
|
}
|
|
277814
278203
|
async function readToken(path13) {
|
|
277815
278204
|
try {
|
|
277816
|
-
const raw = await
|
|
278205
|
+
const raw = await readFile29(path13, "utf8");
|
|
277817
278206
|
return raw.trim() || null;
|
|
277818
278207
|
} catch (err2) {
|
|
277819
278208
|
if (isENOENT(err2))
|
|
@@ -277866,9 +278255,9 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
277866
278255
|
logForDebugging(`[netRelay] ca-cert response is not valid PEM; proxy disabled`, { level: "warn" });
|
|
277867
278256
|
return false;
|
|
277868
278257
|
}
|
|
277869
|
-
const systemCa = await
|
|
277870
|
-
await
|
|
277871
|
-
await
|
|
278258
|
+
const systemCa = await readFile29(systemCaPath, "utf8").catch(() => "");
|
|
278259
|
+
await mkdir29(join101(outPath, ".."), { recursive: true });
|
|
278260
|
+
await writeFile23(outPath, systemCa + `
|
|
277872
278261
|
` + ccrCa, "utf8");
|
|
277873
278262
|
return true;
|
|
277874
278263
|
} catch (err2) {
|
|
@@ -278149,9 +278538,9 @@ var init_shared2 = __esm(() => {
|
|
|
278149
278538
|
});
|
|
278150
278539
|
|
|
278151
278540
|
// src/entrypoints/sdk/sessions.ts
|
|
278152
|
-
import { randomUUID as
|
|
278153
|
-
import { appendFile as appendFile3, mkdir as
|
|
278154
|
-
import { dirname as
|
|
278541
|
+
import { randomUUID as randomUUID35 } from "crypto";
|
|
278542
|
+
import { appendFile as appendFile3, mkdir as mkdir30, unlink as unlink14, writeFile as writeFile24 } from "fs/promises";
|
|
278543
|
+
import { dirname as dirname54, join as join102 } from "path";
|
|
278155
278544
|
function toSDKSessionInfo(info) {
|
|
278156
278545
|
return {
|
|
278157
278546
|
sessionId: info.sessionId,
|
|
@@ -278267,7 +278656,7 @@ async function getSessionMessages(sessionId, options2) {
|
|
|
278267
278656
|
async function appendJsonlEntry(filePath, entry) {
|
|
278268
278657
|
const line = JSON.stringify(entry) + `
|
|
278269
278658
|
`;
|
|
278270
|
-
await
|
|
278659
|
+
await mkdir30(dirname54(filePath), { mode: 448, recursive: true });
|
|
278271
278660
|
await withTranscriptFileLock(filePath, async (signal) => {
|
|
278272
278661
|
signal.throwIfAborted();
|
|
278273
278662
|
await appendFile3(filePath, line, { mode: 384 });
|
|
@@ -278315,9 +278704,9 @@ async function forkSession(sessionId, options2) {
|
|
|
278315
278704
|
if (entries.length === 0) {
|
|
278316
278705
|
throw new Error(`Session is empty: ${sessionId}`);
|
|
278317
278706
|
}
|
|
278318
|
-
const forkSessionId =
|
|
278319
|
-
const targetDir =
|
|
278320
|
-
const forkPath =
|
|
278707
|
+
const forkSessionId = randomUUID35();
|
|
278708
|
+
const targetDir = dirname54(resolved.filePath);
|
|
278709
|
+
const forkPath = join102(targetDir, `${forkSessionId}.jsonl`);
|
|
278321
278710
|
const uuidMap = new Map;
|
|
278322
278711
|
const mainEntries = [];
|
|
278323
278712
|
const metadataEntries = [];
|
|
@@ -278334,7 +278723,7 @@ async function forkSession(sessionId, options2) {
|
|
|
278334
278723
|
metadataEntries.push(entry);
|
|
278335
278724
|
continue;
|
|
278336
278725
|
}
|
|
278337
|
-
const newUuid =
|
|
278726
|
+
const newUuid = randomUUID35();
|
|
278338
278727
|
uuidMap.set(entry.uuid, newUuid);
|
|
278339
278728
|
mainEntries.push(entry);
|
|
278340
278729
|
if (options2?.upToMessageId && entry.uuid === options2.upToMessageId) {
|
|
@@ -278370,7 +278759,7 @@ async function forkSession(sessionId, options2) {
|
|
|
278370
278759
|
};
|
|
278371
278760
|
lines.push(JSON.stringify(forkedEntry));
|
|
278372
278761
|
}
|
|
278373
|
-
await
|
|
278762
|
+
await writeFile24(forkPath, lines.join(`
|
|
278374
278763
|
`) + `
|
|
278375
278764
|
`, {
|
|
278376
278765
|
encoding: "utf8",
|
|
@@ -278408,7 +278797,7 @@ var init_interruption = __esm(() => {
|
|
|
278408
278797
|
});
|
|
278409
278798
|
|
|
278410
278799
|
// src/entrypoints/sdk/permissions.ts
|
|
278411
|
-
import { randomUUID as
|
|
278800
|
+
import { randomUUID as randomUUID36 } from "crypto";
|
|
278412
278801
|
function createOnceOnlyResolve(resolve36) {
|
|
278413
278802
|
let resolved = false;
|
|
278414
278803
|
return (value) => {
|
|
@@ -278518,8 +278907,8 @@ function createExternalCanUseTool(userFn, fallback, permissionTarget, onPermissi
|
|
|
278518
278907
|
}
|
|
278519
278908
|
}
|
|
278520
278909
|
if (toolUseID && onPermissionRequest) {
|
|
278521
|
-
const requestId =
|
|
278522
|
-
const messageUuid =
|
|
278910
|
+
const requestId = randomUUID36();
|
|
278911
|
+
const messageUuid = randomUUID36();
|
|
278523
278912
|
const pendingPromise = permissionTarget.registerPendingPermission(toolUseID);
|
|
278524
278913
|
try {
|
|
278525
278914
|
onPermissionRequest({
|
|
@@ -278654,7 +279043,7 @@ async function connectSdkMcpServers(mcpServers) {
|
|
|
278654
279043
|
};
|
|
278655
279044
|
}
|
|
278656
279045
|
try {
|
|
278657
|
-
const
|
|
279046
|
+
const client2 = await connectToServer(name, scopedConfig, {
|
|
278658
279047
|
totalServers: Object.keys(mcpServers).length,
|
|
278659
279048
|
stdioCount: 0,
|
|
278660
279049
|
sseCount: 0,
|
|
@@ -278662,11 +279051,11 @@ async function connectSdkMcpServers(mcpServers) {
|
|
|
278662
279051
|
sseIdeCount: 0,
|
|
278663
279052
|
wsIdeCount: 0
|
|
278664
279053
|
});
|
|
278665
|
-
if (
|
|
278666
|
-
const serverTools = await fetchToolsForClient(
|
|
278667
|
-
return { client, tools: serverTools };
|
|
279054
|
+
if (client2.type === "connected") {
|
|
279055
|
+
const serverTools = await fetchToolsForClient(client2);
|
|
279056
|
+
return { client: client2, tools: serverTools };
|
|
278668
279057
|
}
|
|
278669
|
-
return { client, tools: [] };
|
|
279058
|
+
return { client: client2, tools: [] };
|
|
278670
279059
|
} catch (error40) {
|
|
278671
279060
|
const errorMessage3 = error40 instanceof Error ? error40.message : "Unknown error";
|
|
278672
279061
|
return {
|
|
@@ -278873,14 +279262,14 @@ var init_agentDefinitions = __esm(() => {
|
|
|
278873
279262
|
});
|
|
278874
279263
|
|
|
278875
279264
|
// src/entrypoints/sdk/query.ts
|
|
278876
|
-
import { randomUUID as
|
|
278877
|
-
import { dirname as
|
|
279265
|
+
import { randomUUID as randomUUID37 } from "crypto";
|
|
279266
|
+
import { dirname as dirname55 } from "path";
|
|
278878
279267
|
import { stat as stat32 } from "fs/promises";
|
|
278879
279268
|
async function loadAndInjectSessionMessages(sessionId, cwd2, engine, upToUuid) {
|
|
278880
279269
|
const resolved = await resolveSessionFilePath(sessionId, cwd2);
|
|
278881
279270
|
if (!resolved)
|
|
278882
279271
|
return { loaded: false, transcriptDir: null };
|
|
278883
|
-
const transcriptDir =
|
|
279272
|
+
const transcriptDir = dirname55(resolved.filePath);
|
|
278884
279273
|
let entries;
|
|
278885
279274
|
let preservedSegment = null;
|
|
278886
279275
|
let boundaryIndex = -1;
|
|
@@ -279114,7 +279503,7 @@ var init_query2 = __esm(() => {
|
|
|
279114
279503
|
this.appStateStore = appStateStore;
|
|
279115
279504
|
this.envOverrides = envOverrides;
|
|
279116
279505
|
this._sessionIdExplicitlyProvided = sessionId !== undefined;
|
|
279117
|
-
this._sessionId = sessionId ??
|
|
279506
|
+
this._sessionId = sessionId ?? randomUUID37();
|
|
279118
279507
|
this.shouldFork = fork;
|
|
279119
279508
|
this.continueSession = continueSession;
|
|
279120
279509
|
this.cwd = cwd2;
|
|
@@ -279383,9 +279772,9 @@ var init_query2 = __esm(() => {
|
|
|
279383
279772
|
this.interruptWithSource("sdk_close");
|
|
279384
279773
|
requestSdkRootAbort(wrapperController, "sdk_close", "sdk_query");
|
|
279385
279774
|
const mcpClients = this._engine?.getMcpClients?.() ?? [];
|
|
279386
|
-
for (const
|
|
279387
|
-
if (
|
|
279388
|
-
|
|
279775
|
+
for (const client2 of mcpClients) {
|
|
279776
|
+
if (client2.type === "connected" && client2.cleanup) {
|
|
279777
|
+
client2.cleanup().catch((err2) => {
|
|
279389
279778
|
console.warn("SDK: MCP client cleanup error:", err2 instanceof Error ? err2.message : String(err2));
|
|
279390
279779
|
});
|
|
279391
279780
|
}
|
|
@@ -279499,19 +279888,19 @@ var init_query2 = __esm(() => {
|
|
|
279499
279888
|
}
|
|
279500
279889
|
mcpServerStatus() {
|
|
279501
279890
|
const clients = this.engine.getMcpClients?.() ?? [];
|
|
279502
|
-
return clients.map((
|
|
279891
|
+
return clients.map((client2) => {
|
|
279503
279892
|
const base2 = {
|
|
279504
|
-
name:
|
|
279505
|
-
status:
|
|
279893
|
+
name: client2.name,
|
|
279894
|
+
status: client2.type
|
|
279506
279895
|
};
|
|
279507
|
-
if (
|
|
279508
|
-
base2.serverInfo =
|
|
279896
|
+
if (client2.type === "connected") {
|
|
279897
|
+
base2.serverInfo = client2.serverInfo;
|
|
279509
279898
|
}
|
|
279510
|
-
if (
|
|
279511
|
-
base2.error =
|
|
279899
|
+
if (client2.type === "failed") {
|
|
279900
|
+
base2.error = client2.error;
|
|
279512
279901
|
}
|
|
279513
|
-
if ("config" in
|
|
279514
|
-
const cfg =
|
|
279902
|
+
if ("config" in client2) {
|
|
279903
|
+
const cfg = client2.config;
|
|
279515
279904
|
if (cfg?.scope)
|
|
279516
279905
|
base2.scope = cfg.scope;
|
|
279517
279906
|
}
|
|
@@ -279554,8 +279943,8 @@ var init_query2 = __esm(() => {
|
|
|
279554
279943
|
});
|
|
279555
279944
|
|
|
279556
279945
|
// src/entrypoints/sdk/v2.ts
|
|
279557
|
-
import { randomUUID as
|
|
279558
|
-
import { dirname as
|
|
279946
|
+
import { randomUUID as randomUUID38 } from "crypto";
|
|
279947
|
+
import { dirname as dirname56 } from "path";
|
|
279559
279948
|
import { stat as stat33 } from "fs/promises";
|
|
279560
279949
|
|
|
279561
279950
|
class SDKSessionImpl {
|
|
@@ -279742,9 +280131,9 @@ class SDKSessionImpl {
|
|
|
279742
280131
|
}
|
|
279743
280132
|
this._abortController = null;
|
|
279744
280133
|
const mcpClients = this._engine?.getMcpClients?.() ?? [];
|
|
279745
|
-
for (const
|
|
279746
|
-
if (
|
|
279747
|
-
|
|
280134
|
+
for (const client2 of mcpClients) {
|
|
280135
|
+
if (client2.type === "connected" && client2.cleanup) {
|
|
280136
|
+
client2.cleanup().catch((err2) => {
|
|
279748
280137
|
console.warn("SDK: MCP client cleanup error:", err2 instanceof Error ? err2.message : String(err2));
|
|
279749
280138
|
});
|
|
279750
280139
|
}
|
|
@@ -279862,7 +280251,7 @@ function createEngineFromOptions(options2, permissionTarget, initialMessages, se
|
|
|
279862
280251
|
return { engine, appStateStore, abortController: ac };
|
|
279863
280252
|
}
|
|
279864
280253
|
function unstable_v2_createSession(options2) {
|
|
279865
|
-
const sessionId =
|
|
280254
|
+
const sessionId = randomUUID38();
|
|
279866
280255
|
const session = new SDKSessionImpl(null, sessionId, options2, null);
|
|
279867
280256
|
const { engine, appStateStore, abortController } = createEngineFromOptions(options2, session, undefined, sessionId);
|
|
279868
280257
|
session.setEngine(engine);
|
|
@@ -279972,7 +280361,7 @@ async function unstable_v2_resumeSession(sessionId, options2) {
|
|
|
279972
280361
|
session.setAppStateStore(appStateStore);
|
|
279973
280362
|
session.setAbortController(abortController);
|
|
279974
280363
|
if (resolved) {
|
|
279975
|
-
const transcriptDir =
|
|
280364
|
+
const transcriptDir = dirname56(resolved.filePath);
|
|
279976
280365
|
session.setSessionProjectDir(transcriptDir);
|
|
279977
280366
|
switchSession(sessionId, transcriptDir);
|
|
279978
280367
|
}
|
|
@@ -280029,11 +280418,11 @@ function detectStubLeaks() {
|
|
|
280029
280418
|
];
|
|
280030
280419
|
checkCriticalImportsForStubs(criticalImports);
|
|
280031
280420
|
}
|
|
280032
|
-
function tool(name, description,
|
|
280421
|
+
function tool(name, description, inputSchema46, handler, extras) {
|
|
280033
280422
|
return {
|
|
280034
280423
|
name,
|
|
280035
280424
|
description,
|
|
280036
|
-
inputSchema:
|
|
280425
|
+
inputSchema: inputSchema46,
|
|
280037
280426
|
handler,
|
|
280038
280427
|
annotations: extras?.annotations,
|
|
280039
280428
|
searchHint: extras?.searchHint,
|