@hasna/assistants 1.1.47 → 1.1.48

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/index.js CHANGED
@@ -827,10 +827,21 @@ class AssistantContext {
827
827
  truncated: false
828
828
  });
829
829
  } else {
830
- processedResults.push({
831
- ...result,
832
- rawContent
833
- });
830
+ const imageAttachment = this.extractImageAttachment(rawContent);
831
+ if (imageAttachment) {
832
+ documents.push(imageAttachment);
833
+ processedResults.push({
834
+ ...result,
835
+ content: `Image loaded: ${imageAttachment.name || "image"} (${this.formatBytes(imageAttachment.source.type === "base64" ? imageAttachment.source.data.length * 0.75 : 0)})`,
836
+ rawContent: `Image loaded: ${imageAttachment.name || "image"} (${this.formatBytes(imageAttachment.source.type === "base64" ? imageAttachment.source.data.length * 0.75 : 0)})`,
837
+ truncated: false
838
+ });
839
+ } else {
840
+ processedResults.push({
841
+ ...result,
842
+ rawContent
843
+ });
844
+ }
834
845
  }
835
846
  }
836
847
  const message = {
@@ -867,6 +878,29 @@ class AssistantContext {
867
878
  } catch {}
868
879
  return null;
869
880
  }
881
+ extractImageAttachment(content) {
882
+ if (!content)
883
+ return null;
884
+ try {
885
+ const parsed = JSON.parse(content);
886
+ if (parsed && parsed.__image_attachment__ === true) {
887
+ if (!parsed.data || typeof parsed.data !== "string") {
888
+ return null;
889
+ }
890
+ return {
891
+ type: "image",
892
+ source: {
893
+ type: "base64",
894
+ mediaType: parsed.mediaType || "image/png",
895
+ data: parsed.data
896
+ },
897
+ name: parsed.name,
898
+ mediaType: parsed.mediaType
899
+ };
900
+ }
901
+ } catch {}
902
+ return null;
903
+ }
870
904
  formatBytes(bytes) {
871
905
  if (bytes < 1024)
872
906
  return `${bytes} B`;
@@ -11590,13 +11624,19 @@ function createAssistantToolExecutors(context) {
11590
11624
  settings.model = input.model;
11591
11625
  if (input.maxTokens)
11592
11626
  settings.maxTokens = input.maxTokens;
11593
- if (input.temperature)
11627
+ if (input.temperature !== undefined)
11594
11628
  settings.temperature = input.temperature;
11595
11629
  if (input.systemPromptAddition)
11596
11630
  settings.systemPromptAddition = input.systemPromptAddition;
11631
+ if (input.enabledTools)
11632
+ settings.enabledTools = input.enabledTools;
11633
+ if (input.disabledTools)
11634
+ settings.disabledTools = input.disabledTools;
11597
11635
  const assistant = await manager.createAssistant({
11598
11636
  name: name.trim(),
11599
11637
  description: input.description,
11638
+ avatar: input.avatar,
11639
+ color: input.color,
11600
11640
  settings: Object.keys(settings).length > 0 ? settings : undefined
11601
11641
  });
11602
11642
  return JSON.stringify({
@@ -11638,6 +11678,10 @@ function createAssistantToolExecutors(context) {
11638
11678
  updates.name = input.name;
11639
11679
  if (input.description !== undefined)
11640
11680
  updates.description = input.description;
11681
+ if (input.avatar !== undefined)
11682
+ updates.avatar = input.avatar;
11683
+ if (input.color !== undefined)
11684
+ updates.color = input.color;
11641
11685
  const settings = {};
11642
11686
  if (input.model)
11643
11687
  settings.model = input.model;
@@ -11647,6 +11691,10 @@ function createAssistantToolExecutors(context) {
11647
11691
  settings.temperature = input.temperature;
11648
11692
  if (input.systemPromptAddition !== undefined)
11649
11693
  settings.systemPromptAddition = input.systemPromptAddition;
11694
+ if (input.enabledTools !== undefined)
11695
+ settings.enabledTools = input.enabledTools;
11696
+ if (input.disabledTools !== undefined)
11697
+ settings.disabledTools = input.disabledTools;
11650
11698
  if (Object.keys(settings).length > 0) {
11651
11699
  updates.settings = settings;
11652
11700
  }
@@ -11814,6 +11862,14 @@ var init_assistant = __esm(() => {
11814
11862
  type: "string",
11815
11863
  description: "Optional description of the assistant"
11816
11864
  },
11865
+ avatar: {
11866
+ type: "string",
11867
+ description: 'Optional avatar emoji or icon for the assistant (e.g., "\uD83E\uDD16", "\uD83E\uDDE0", "\uD83D\uDD27")'
11868
+ },
11869
+ color: {
11870
+ type: "string",
11871
+ description: 'Optional theme color for the assistant (e.g., "cyan", "green", "magenta", "#ff6600")'
11872
+ },
11817
11873
  model: {
11818
11874
  type: "string",
11819
11875
  description: 'LLM model to use (e.g., "claude-opus-4-5", "claude-sonnet-4-20250514")'
@@ -11828,7 +11884,17 @@ var init_assistant = __esm(() => {
11828
11884
  },
11829
11885
  temperature: {
11830
11886
  type: "number",
11831
- description: "Optional temperature setting (0.0-1.0)"
11887
+ description: "Optional temperature setting (0.0-2.0)"
11888
+ },
11889
+ enabledTools: {
11890
+ type: "array",
11891
+ description: "Optional list of tool names this assistant can use (whitelist)",
11892
+ items: { type: "string", description: "Tool name" }
11893
+ },
11894
+ disabledTools: {
11895
+ type: "array",
11896
+ description: "Optional list of tool names this assistant cannot use (blacklist)",
11897
+ items: { type: "string", description: "Tool name" }
11832
11898
  }
11833
11899
  },
11834
11900
  required: ["name"]
@@ -11836,7 +11902,7 @@ var init_assistant = __esm(() => {
11836
11902
  };
11837
11903
  assistantUpdateTool = {
11838
11904
  name: "assistant_update",
11839
- description: "Update an existing assistant's configuration.",
11905
+ description: "Update an existing assistant's configuration. Supports changing name, description, avatar, color, model, system prompt, tokens, temperature, and tool access.",
11840
11906
  parameters: {
11841
11907
  type: "object",
11842
11908
  properties: {
@@ -11852,6 +11918,14 @@ var init_assistant = __esm(() => {
11852
11918
  type: "string",
11853
11919
  description: "New description for the assistant"
11854
11920
  },
11921
+ avatar: {
11922
+ type: "string",
11923
+ description: 'New avatar emoji or icon (e.g., "\uD83E\uDD16", "\uD83E\uDDE0", "\uD83D\uDD27")'
11924
+ },
11925
+ color: {
11926
+ type: "string",
11927
+ description: 'New theme color (e.g., "cyan", "green", "magenta", "#ff6600")'
11928
+ },
11855
11929
  model: {
11856
11930
  type: "string",
11857
11931
  description: "New LLM model to use"
@@ -11866,7 +11940,17 @@ var init_assistant = __esm(() => {
11866
11940
  },
11867
11941
  temperature: {
11868
11942
  type: "number",
11869
- description: "New temperature setting"
11943
+ description: "New temperature setting (0.0-2.0)"
11944
+ },
11945
+ enabledTools: {
11946
+ type: "array",
11947
+ description: "Tool names this assistant can use (whitelist, replaces existing)",
11948
+ items: { type: "string", description: "Tool name" }
11949
+ },
11950
+ disabledTools: {
11951
+ type: "array",
11952
+ description: "Tool names this assistant cannot use (blacklist, replaces existing)",
11953
+ items: { type: "string", description: "Tool name" }
11870
11954
  }
11871
11955
  },
11872
11956
  required: ["id"]
@@ -23803,9 +23887,26 @@ var init_filesystem = __esm(async () => {
23803
23887
  static setSessionId(sessionId) {
23804
23888
  currentSessionId = sessionId;
23805
23889
  }
23890
+ static IMAGE_EXTENSIONS = new Set([
23891
+ ".png",
23892
+ ".jpg",
23893
+ ".jpeg",
23894
+ ".gif",
23895
+ ".webp",
23896
+ ".bmp"
23897
+ ]);
23898
+ static MAX_IMAGE_SIZE = 20 * 1024 * 1024;
23899
+ static IMAGE_MIME_TYPES = {
23900
+ ".png": "image/png",
23901
+ ".jpg": "image/jpeg",
23902
+ ".jpeg": "image/jpeg",
23903
+ ".gif": "image/gif",
23904
+ ".webp": "image/webp",
23905
+ ".bmp": "image/bmp"
23906
+ };
23806
23907
  static readTool = {
23807
23908
  name: "read",
23808
- description: "Read the contents of a file",
23909
+ description: "Read the contents of a file. For images (png, jpg, gif, webp, bmp), the file is sent to the LLM for visual analysis. For PDFs, the file is attached as a document. For all other files, returns text content with line numbers.",
23809
23910
  parameters: {
23810
23911
  type: "object",
23811
23912
  properties: {
@@ -23890,6 +23991,33 @@ var init_filesystem = __esm(async () => {
23890
23991
  suggestion: "Check the file path and try again."
23891
23992
  });
23892
23993
  }
23994
+ const ext = "." + path2.split(".").pop()?.toLowerCase();
23995
+ if (ext === ".pdf") {
23996
+ return FilesystemTools.readPdfExecutor(input);
23997
+ }
23998
+ if (FilesystemTools.IMAGE_EXTENSIONS.has(ext)) {
23999
+ if (file.size > FilesystemTools.MAX_IMAGE_SIZE) {
24000
+ throw new ToolExecutionError(`Image file too large: ${(file.size / 1024 / 1024).toFixed(1)}MB (max 20MB)`, {
24001
+ toolName: "read",
24002
+ toolInput: input,
24003
+ code: ErrorCodes.VALIDATION_OUT_OF_RANGE,
24004
+ recoverable: false,
24005
+ retryable: false,
24006
+ suggestion: "Use a smaller image file (max 20MB)."
24007
+ });
24008
+ }
24009
+ const buffer = await file.arrayBuffer();
24010
+ const base64Data = Buffer.from(buffer).toString("base64");
24011
+ const mediaType = FilesystemTools.IMAGE_MIME_TYPES[ext] || "image/png";
24012
+ return JSON.stringify({
24013
+ __image_attachment__: true,
24014
+ path: validated.resolved,
24015
+ name: path2.split("/").pop() || "image",
24016
+ mediaType,
24017
+ data: base64Data,
24018
+ size: file.size
24019
+ });
24020
+ }
23893
24021
  const limits = getLimits();
23894
24022
  if (exceedsFileReadLimit(file.size, limits.maxFileReadSize)) {
23895
24023
  throw new ToolExecutionError(`File exceeds size limit (${limits.maxFileReadSize} bytes)`, {
@@ -26027,8 +26155,292 @@ var init_image = __esm(() => {
26027
26155
  };
26028
26156
  });
26029
26157
 
26158
+ // packages/core/src/voice/utils.ts
26159
+ import { existsSync as existsSync14, readFileSync as readFileSync8 } from "fs";
26160
+ import { homedir as homedir9 } from "os";
26161
+ import { join as join18 } from "path";
26162
+ import { spawnSync } from "child_process";
26163
+ function loadApiKeyFromSecrets2(key) {
26164
+ const envHome = process.env.HOME || process.env.USERPROFILE;
26165
+ const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir9();
26166
+ const secretsPath = join18(homeDir, ".secrets");
26167
+ if (!existsSync14(secretsPath))
26168
+ return;
26169
+ try {
26170
+ const content = readFileSync8(secretsPath, "utf-8");
26171
+ const match = content.match(new RegExp(`export\\s+${key}\\s*=\\s*['"]?([^'"\\n]+)['"]?`));
26172
+ return match?.[1];
26173
+ } catch {
26174
+ return;
26175
+ }
26176
+ }
26177
+ function findExecutable(name) {
26178
+ const command = process.platform === "win32" ? "where" : "which";
26179
+ const result = spawnSync(command, [name], { encoding: "utf-8" });
26180
+ if (result.status === 0 && result.stdout) {
26181
+ const output = result.stdout.trim().split(`
26182
+ `)[0]?.trim();
26183
+ return output || null;
26184
+ }
26185
+ return null;
26186
+ }
26187
+ var init_utils4 = () => {};
26188
+
26189
+ // packages/core/src/voice/stt.ts
26190
+ class WhisperSTT {
26191
+ apiKey;
26192
+ model;
26193
+ language;
26194
+ constructor(options = {}) {
26195
+ this.apiKey = options.apiKey || process.env.OPENAI_API_KEY || loadApiKeyFromSecrets2("OPENAI_API_KEY") || "";
26196
+ this.model = options.model || "whisper-1";
26197
+ this.language = options.language;
26198
+ }
26199
+ async transcribe(audioBuffer) {
26200
+ if (!this.apiKey) {
26201
+ throw new Error("Missing OPENAI_API_KEY for Whisper STT. Set it in env or ~/.secrets.");
26202
+ }
26203
+ const form = new FormData;
26204
+ form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
26205
+ form.append("model", this.model);
26206
+ if (this.language) {
26207
+ form.append("language", this.language);
26208
+ }
26209
+ const response = await fetch("https://api.openai.com/v1/audio/transcriptions", {
26210
+ method: "POST",
26211
+ headers: {
26212
+ Authorization: `Bearer ${this.apiKey}`
26213
+ },
26214
+ body: form
26215
+ });
26216
+ if (!response.ok) {
26217
+ const errorText = await response.text();
26218
+ throw new Error(`Whisper STT failed (${response.status}): ${errorText || response.statusText}`);
26219
+ }
26220
+ const result = await response.json();
26221
+ return {
26222
+ text: result.text || "",
26223
+ confidence: 1,
26224
+ language: result.language
26225
+ };
26226
+ }
26227
+ async startListening() {
26228
+ throw new Error("Real-time transcription is not supported. Use VoiceManager.listen().");
26229
+ }
26230
+ }
26231
+
26232
+ class ElevenLabsSTT {
26233
+ apiKey;
26234
+ model;
26235
+ language;
26236
+ constructor(options = {}) {
26237
+ this.apiKey = options.apiKey || process.env.ELEVENLABS_API_KEY || loadApiKeyFromSecrets2("ELEVENLABS_API_KEY") || "";
26238
+ this.model = options.model || "scribe_v2";
26239
+ this.language = options.language;
26240
+ }
26241
+ async transcribe(audioBuffer) {
26242
+ if (!this.apiKey) {
26243
+ throw new Error("Missing ELEVENLABS_API_KEY for ElevenLabs STT. Set it in env or ~/.secrets.");
26244
+ }
26245
+ const form = new FormData;
26246
+ form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
26247
+ form.append("model_id", this.model);
26248
+ if (this.language) {
26249
+ form.append("language_code", this.language);
26250
+ }
26251
+ const response = await fetch("https://api.elevenlabs.io/v1/speech-to-text", {
26252
+ method: "POST",
26253
+ headers: {
26254
+ "xi-api-key": this.apiKey
26255
+ },
26256
+ body: form
26257
+ });
26258
+ if (!response.ok) {
26259
+ const errorText = await response.text();
26260
+ throw new Error(`ElevenLabs STT failed (${response.status}): ${errorText || response.statusText}`);
26261
+ }
26262
+ const result = await response.json();
26263
+ return {
26264
+ text: result.text || "",
26265
+ confidence: 1,
26266
+ language: result.language_code
26267
+ };
26268
+ }
26269
+ }
26270
+
26271
+ class SystemSTT {
26272
+ async transcribe(_audioBuffer) {
26273
+ throw new Error("System STT is not available yet. Use Whisper STT instead.");
26274
+ }
26275
+ }
26276
+ var init_stt = __esm(() => {
26277
+ init_utils4();
26278
+ });
26279
+
26280
+ // packages/core/src/tools/audio.ts
26281
+ import { resolve as resolve5 } from "path";
26282
+ import { homedir as homedir10 } from "os";
26283
+ function resolveInputPath(baseCwd, inputPath) {
26284
+ const envHome = process.env.HOME || process.env.USERPROFILE;
26285
+ const home = envHome && envHome.trim().length > 0 ? envHome : homedir10();
26286
+ if (inputPath === "~")
26287
+ return home;
26288
+ if (inputPath.startsWith("~/"))
26289
+ return resolve5(home, inputPath.slice(2));
26290
+ return resolve5(baseCwd, inputPath);
26291
+ }
26292
+ var AUDIO_EXTENSIONS, MAX_AUDIO_SIZE, AudioTools;
26293
+ var init_audio2 = __esm(async () => {
26294
+ init_errors();
26295
+ init_paths();
26296
+ init_path_validator();
26297
+ init_stt();
26298
+ await __promiseAll([
26299
+ init_logger(),
26300
+ init_runtime()
26301
+ ]);
26302
+ AUDIO_EXTENSIONS = new Set([
26303
+ ".wav",
26304
+ ".mp3",
26305
+ ".m4a",
26306
+ ".flac",
26307
+ ".ogg",
26308
+ ".webm",
26309
+ ".aac"
26310
+ ]);
26311
+ MAX_AUDIO_SIZE = 25 * 1024 * 1024;
26312
+ AudioTools = class AudioTools {
26313
+ static readAudioTool = {
26314
+ name: "read_audio",
26315
+ description: "Transcribe an audio file to text using ElevenLabs Scribe. " + "Supports wav, mp3, m4a, flac, ogg, webm, aac. Max 25MB. " + "Requires ELEVENLABS_API_KEY.",
26316
+ parameters: {
26317
+ type: "object",
26318
+ properties: {
26319
+ path: {
26320
+ type: "string",
26321
+ description: "Path to the audio file (absolute or relative to cwd)"
26322
+ },
26323
+ language: {
26324
+ type: "string",
26325
+ description: "Language code for transcription (optional, auto-detected)"
26326
+ },
26327
+ cwd: {
26328
+ type: "string",
26329
+ description: "Base working directory for relative paths (optional)"
26330
+ }
26331
+ },
26332
+ required: ["path"]
26333
+ }
26334
+ };
26335
+ static readAudioExecutor = async (input) => {
26336
+ const baseCwd = input.cwd || process.cwd();
26337
+ const rawPath = String(input.path || "").trim();
26338
+ const language = input.language;
26339
+ if (!rawPath) {
26340
+ throw new ToolExecutionError("Audio file path is required", {
26341
+ toolName: "read_audio",
26342
+ toolInput: input,
26343
+ code: ErrorCodes.VALIDATION_OUT_OF_RANGE,
26344
+ recoverable: false,
26345
+ retryable: false,
26346
+ suggestion: "Provide a valid audio file path."
26347
+ });
26348
+ }
26349
+ const path2 = resolveInputPath(baseCwd, rawPath);
26350
+ try {
26351
+ const safety = await isPathSafe(path2, "read", { cwd: baseCwd });
26352
+ if (!safety.safe) {
26353
+ getSecurityLogger().log({
26354
+ eventType: "path_violation",
26355
+ severity: "high",
26356
+ details: {
26357
+ tool: "read_audio",
26358
+ path: path2,
26359
+ reason: safety.reason || "Blocked path"
26360
+ },
26361
+ sessionId: input.sessionId || "unknown"
26362
+ });
26363
+ throw new ToolExecutionError(safety.reason || "Blocked path", {
26364
+ toolName: "read_audio",
26365
+ toolInput: input,
26366
+ code: ErrorCodes.TOOL_PERMISSION_DENIED,
26367
+ recoverable: false,
26368
+ retryable: false
26369
+ });
26370
+ }
26371
+ const validated = await validatePath(path2, { allowSymlinks: true });
26372
+ if (!validated.valid) {
26373
+ throw new ToolExecutionError(validated.error || "Invalid path", {
26374
+ toolName: "read_audio",
26375
+ toolInput: input,
26376
+ code: ErrorCodes.VALIDATION_OUT_OF_RANGE,
26377
+ recoverable: false,
26378
+ retryable: false,
26379
+ suggestion: "Provide a valid audio file path."
26380
+ });
26381
+ }
26382
+ const runtime = getRuntime();
26383
+ const file = runtime.file(validated.resolved);
26384
+ if (!await file.exists()) {
26385
+ throw new ToolExecutionError(`Audio file not found: ${path2}`, {
26386
+ toolName: "read_audio",
26387
+ toolInput: input,
26388
+ code: ErrorCodes.TOOL_EXECUTION_FAILED,
26389
+ recoverable: false,
26390
+ retryable: false,
26391
+ suggestion: "Check the file path and try again."
26392
+ });
26393
+ }
26394
+ const ext = "." + path2.split(".").pop()?.toLowerCase();
26395
+ if (!AUDIO_EXTENSIONS.has(ext)) {
26396
+ throw new ToolExecutionError(`Unsupported audio format: ${ext}. Supported: ${[...AUDIO_EXTENSIONS].join(", ")}`, {
26397
+ toolName: "read_audio",
26398
+ toolInput: input,
26399
+ code: ErrorCodes.VALIDATION_OUT_OF_RANGE,
26400
+ recoverable: false,
26401
+ retryable: false,
26402
+ suggestion: `Use one of: ${[...AUDIO_EXTENSIONS].join(", ")}`
26403
+ });
26404
+ }
26405
+ if (file.size > MAX_AUDIO_SIZE) {
26406
+ throw new ToolExecutionError(`Audio file too large: ${(file.size / 1024 / 1024).toFixed(1)}MB (max 25MB)`, {
26407
+ toolName: "read_audio",
26408
+ toolInput: input,
26409
+ code: ErrorCodes.VALIDATION_OUT_OF_RANGE,
26410
+ recoverable: false,
26411
+ retryable: false,
26412
+ suggestion: "Use a smaller audio file (max 25MB)."
26413
+ });
26414
+ }
26415
+ const buffer = await file.arrayBuffer();
26416
+ const stt = new ElevenLabsSTT({ language });
26417
+ const result = await stt.transcribe(buffer);
26418
+ const fileName = path2.split("/").pop() || "audio";
26419
+ const duration = result.duration ? ` (${result.duration}s)` : "";
26420
+ const lang = result.language ? ` [${result.language}]` : "";
26421
+ return `Transcription of ${fileName}${duration}${lang}:
26422
+
26423
+ ${result.text}`;
26424
+ } catch (error2) {
26425
+ if (error2 instanceof ToolExecutionError)
26426
+ throw error2;
26427
+ throw new ToolExecutionError(error2 instanceof Error ? error2.message : String(error2), {
26428
+ toolName: "read_audio",
26429
+ toolInput: input,
26430
+ code: ErrorCodes.TOOL_EXECUTION_FAILED,
26431
+ recoverable: true,
26432
+ retryable: false
26433
+ });
26434
+ }
26435
+ };
26436
+ static registerAll(registry) {
26437
+ registry.register(AudioTools.readAudioTool, AudioTools.readAudioExecutor);
26438
+ }
26439
+ };
26440
+ });
26441
+
26030
26442
  // packages/core/src/skills/create.ts
26031
- import { join as join18, dirname as dirname7 } from "path";
26443
+ import { join as join19, dirname as dirname7 } from "path";
26032
26444
  import { mkdir as mkdir7, stat, writeFile as writeFile4, rm } from "fs/promises";
26033
26445
  function slugify(input) {
26034
26446
  return input.trim().toLowerCase().replace(/[^a-z0-9\s_-]/g, "").replace(/[\s_]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
@@ -26085,9 +26497,9 @@ function buildDefaultContent() {
26085
26497
  }
26086
26498
  function resolveSkillRoot(scope, cwd) {
26087
26499
  if (scope === "global") {
26088
- return join18(getConfigDir(), "shared", "skills");
26500
+ return join19(getConfigDir(), "shared", "skills");
26089
26501
  }
26090
- return join18(cwd, ".assistants", "skills");
26502
+ return join19(cwd, ".assistants", "skills");
26091
26503
  }
26092
26504
  async function pathExists(path2) {
26093
26505
  try {
@@ -26105,8 +26517,8 @@ async function createSkill(options) {
26105
26517
  const scope = options.scope ?? "project";
26106
26518
  const { skillName, dirName } = normalizeName2(options.name);
26107
26519
  const root = resolveSkillRoot(scope, options.cwd);
26108
- const directory = join18(root, dirName);
26109
- const filePath = join18(directory, "SKILL.md");
26520
+ const directory = join19(root, dirName);
26521
+ const filePath = join19(directory, "SKILL.md");
26110
26522
  if (!options.overwrite && await pathExists(filePath)) {
26111
26523
  throw new Error(`Skill already exists at ${filePath}`);
26112
26524
  }
@@ -26739,7 +27151,7 @@ var init_wait = __esm(() => {
26739
27151
 
26740
27152
  // packages/core/src/agent/subagent.ts
26741
27153
  function sleepSafe(ms) {
26742
- return new Promise((resolve5) => safeSetTimeout(resolve5, ms));
27154
+ return new Promise((resolve6) => safeSetTimeout(resolve6, ms));
26743
27155
  }
26744
27156
  async function runHookAssistant(options) {
26745
27157
  const { hook, input, timeout, cwd, allowedTools, llmClient } = options;
@@ -30891,42 +31303,42 @@ var require_queue = __commonJS((exports, module) => {
30891
31303
  queue.drained = drained;
30892
31304
  return queue;
30893
31305
  function push(value) {
30894
- var p = new Promise(function(resolve5, reject) {
31306
+ var p = new Promise(function(resolve6, reject) {
30895
31307
  pushCb(value, function(err, result) {
30896
31308
  if (err) {
30897
31309
  reject(err);
30898
31310
  return;
30899
31311
  }
30900
- resolve5(result);
31312
+ resolve6(result);
30901
31313
  });
30902
31314
  });
30903
31315
  p.catch(noop2);
30904
31316
  return p;
30905
31317
  }
30906
31318
  function unshift(value) {
30907
- var p = new Promise(function(resolve5, reject) {
31319
+ var p = new Promise(function(resolve6, reject) {
30908
31320
  unshiftCb(value, function(err, result) {
30909
31321
  if (err) {
30910
31322
  reject(err);
30911
31323
  return;
30912
31324
  }
30913
- resolve5(result);
31325
+ resolve6(result);
30914
31326
  });
30915
31327
  });
30916
31328
  p.catch(noop2);
30917
31329
  return p;
30918
31330
  }
30919
31331
  function drained() {
30920
- var p = new Promise(function(resolve5) {
31332
+ var p = new Promise(function(resolve6) {
30921
31333
  process.nextTick(function() {
30922
31334
  if (queue.idle()) {
30923
- resolve5();
31335
+ resolve6();
30924
31336
  } else {
30925
31337
  var previousDrain = queue.drain;
30926
31338
  queue.drain = function() {
30927
31339
  if (typeof previousDrain === "function")
30928
31340
  previousDrain();
30929
- resolve5();
31341
+ resolve6();
30930
31342
  queue.drain = previousDrain;
30931
31343
  };
30932
31344
  }
@@ -31387,9 +31799,9 @@ var require_stream3 = __commonJS((exports) => {
31387
31799
  });
31388
31800
  }
31389
31801
  _getStat(filepath) {
31390
- return new Promise((resolve5, reject) => {
31802
+ return new Promise((resolve6, reject) => {
31391
31803
  this._stat(filepath, this._fsStatSettings, (error2, stats) => {
31392
- return error2 === null ? resolve5(stats) : reject(error2);
31804
+ return error2 === null ? resolve6(stats) : reject(error2);
31393
31805
  });
31394
31806
  });
31395
31807
  }
@@ -31411,10 +31823,10 @@ var require_async5 = __commonJS((exports) => {
31411
31823
  this._readerStream = new stream_1.default(this._settings);
31412
31824
  }
31413
31825
  dynamic(root, options) {
31414
- return new Promise((resolve5, reject) => {
31826
+ return new Promise((resolve6, reject) => {
31415
31827
  this._walkAsync(root, options, (error2, entries) => {
31416
31828
  if (error2 === null) {
31417
- resolve5(entries);
31829
+ resolve6(entries);
31418
31830
  } else {
31419
31831
  reject(error2);
31420
31832
  }
@@ -31424,10 +31836,10 @@ var require_async5 = __commonJS((exports) => {
31424
31836
  async static(patterns, options) {
31425
31837
  const entries = [];
31426
31838
  const stream = this._readerStream.static(patterns, options);
31427
- return new Promise((resolve5, reject) => {
31839
+ return new Promise((resolve6, reject) => {
31428
31840
  stream.once("error", reject);
31429
31841
  stream.on("data", (entry) => entries.push(entry));
31430
- stream.once("end", () => resolve5(entries));
31842
+ stream.once("end", () => resolve6(entries));
31431
31843
  });
31432
31844
  }
31433
31845
  }
@@ -32056,8 +32468,8 @@ var require_out4 = __commonJS((exports, module) => {
32056
32468
  });
32057
32469
 
32058
32470
  // packages/core/src/skills/loader.ts
32059
- import { join as join19, basename as basename4, dirname as dirname9 } from "path";
32060
- import { homedir as homedir9 } from "os";
32471
+ import { join as join20, basename as basename4, dirname as dirname9 } from "path";
32472
+ import { homedir as homedir11 } from "os";
32061
32473
  import { readFile as readFile6, stat as stat2 } from "fs/promises";
32062
32474
 
32063
32475
  class SkillLoader {
@@ -32065,10 +32477,10 @@ class SkillLoader {
32065
32477
  async loadAll(projectDir = process.cwd(), options = {}) {
32066
32478
  const includeContent = options.includeContent ?? true;
32067
32479
  const envHome = process.env.HOME || process.env.USERPROFILE;
32068
- const userHome = envHome && envHome.trim().length > 0 ? envHome : homedir9();
32069
- const userSkillsDir = join19(userHome, ".assistants", "shared", "skills");
32480
+ const userHome = envHome && envHome.trim().length > 0 ? envHome : homedir11();
32481
+ const userSkillsDir = join20(userHome, ".assistants", "shared", "skills");
32070
32482
  await this.loadFromDirectory(userSkillsDir, { includeContent });
32071
- const projectSkillsDir = join19(projectDir, ".assistants", "skills");
32483
+ const projectSkillsDir = join20(projectDir, ".assistants", "skills");
32072
32484
  await this.loadFromDirectory(projectSkillsDir, { includeContent });
32073
32485
  const nestedFiles = await import_fast_glob.default("**/.assistants/skills/*/SKILL.md", {
32074
32486
  cwd: projectDir,
@@ -32076,7 +32488,7 @@ class SkillLoader {
32076
32488
  ignore: ["**/node_modules/**"]
32077
32489
  });
32078
32490
  for (const file of nestedFiles) {
32079
- await this.loadSkillFile(join19(projectDir, file), { includeContent });
32491
+ await this.loadSkillFile(join20(projectDir, file), { includeContent });
32080
32492
  }
32081
32493
  }
32082
32494
  async loadFromDirectory(dir, options = {}) {
@@ -32092,13 +32504,13 @@ class SkillLoader {
32092
32504
  const filesToLoad = [];
32093
32505
  const skillPrefixFiles = await import_fast_glob.default("skill-*/SKILL.md", { cwd: dir });
32094
32506
  for (const file of skillPrefixFiles) {
32095
- filesToLoad.push(join19(dir, file));
32507
+ filesToLoad.push(join20(dir, file));
32096
32508
  }
32097
32509
  const regularFiles = await import_fast_glob.default("*/SKILL.md", { cwd: dir });
32098
32510
  for (const file of regularFiles) {
32099
32511
  const dirName = file.split(/[\\/]/)[0];
32100
32512
  if (!dirName.startsWith("skill-")) {
32101
- filesToLoad.push(join19(dir, file));
32513
+ filesToLoad.push(join20(dir, file));
32102
32514
  }
32103
32515
  }
32104
32516
  const loadTasks = [];
@@ -32215,9 +32627,9 @@ var init_loader2 = __esm(() => {
32215
32627
  import_fast_glob = __toESM(require_out4(), 1);
32216
32628
  });
32217
32629
  // packages/core/src/commands/loader.ts
32218
- import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
32219
- import { join as join20, basename as basename5, extname as extname2 } from "path";
32220
- import { homedir as homedir10 } from "os";
32630
+ import { existsSync as existsSync15, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
32631
+ import { join as join21, basename as basename5, extname as extname2 } from "path";
32632
+ import { homedir as homedir12 } from "os";
32221
32633
 
32222
32634
  class CommandLoader {
32223
32635
  commands = new Map;
@@ -32228,18 +32640,18 @@ class CommandLoader {
32228
32640
  async loadAll() {
32229
32641
  this.commands.clear();
32230
32642
  const envHome = process.env.HOME || process.env.USERPROFILE;
32231
- const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir10();
32232
- const globalDir = join20(homeDir, ".assistants", "commands");
32643
+ const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir12();
32644
+ const globalDir = join21(homeDir, ".assistants", "commands");
32233
32645
  await this.loadFromDirectory(globalDir, "global");
32234
- const projectDir = join20(this.cwd, ".assistants", "commands");
32646
+ const projectDir = join21(this.cwd, ".assistants", "commands");
32235
32647
  await this.loadFromDirectory(projectDir, "project");
32236
32648
  }
32237
32649
  async loadFromDirectory(dir, source, prefix = "") {
32238
- if (!existsSync14(dir))
32650
+ if (!existsSync15(dir))
32239
32651
  return;
32240
32652
  const entries = readdirSync5(dir);
32241
32653
  for (const entry of entries) {
32242
- const fullPath = join20(dir, entry);
32654
+ const fullPath = join21(dir, entry);
32243
32655
  const stat3 = statSync2(fullPath);
32244
32656
  if (stat3.isDirectory()) {
32245
32657
  const newPrefix = prefix ? `${prefix}:${entry}` : entry;
@@ -32605,10 +33017,10 @@ function formatAbsoluteTime(timestamp) {
32605
33017
  return new Date(timestamp).toLocaleString();
32606
33018
  }
32607
33019
  // packages/core/src/jobs/job-store.ts
32608
- import { join as join21 } from "path";
33020
+ import { join as join22 } from "path";
32609
33021
  import { mkdir as mkdir8, readdir as readdir3, readFile as readFile7, unlink as unlink5, writeFile as writeFile5 } from "fs/promises";
32610
33022
  function jobsDir() {
32611
- return join21(getConfigDir(), "jobs");
33023
+ return join22(getConfigDir(), "jobs");
32612
33024
  }
32613
33025
  function isSafeId4(id) {
32614
33026
  return SAFE_ID_PATTERN5.test(id);
@@ -32616,7 +33028,7 @@ function isSafeId4(id) {
32616
33028
  function jobPath(id) {
32617
33029
  if (!isSafeId4(id))
32618
33030
  return null;
32619
- return join21(jobsDir(), `${id}.json`);
33031
+ return join22(jobsDir(), `${id}.json`);
32620
33032
  }
32621
33033
  async function ensureDir() {
32622
33034
  await mkdir8(jobsDir(), { recursive: true });
@@ -32663,7 +33075,7 @@ async function listJobs() {
32663
33075
  if (!file.endsWith(".json"))
32664
33076
  continue;
32665
33077
  try {
32666
- const raw = await readFile7(join21(dir, file), "utf-8");
33078
+ const raw = await readFile7(join22(dir, file), "utf-8");
32667
33079
  const job = JSON.parse(raw);
32668
33080
  if (job?.id)
32669
33081
  jobs.push(job);
@@ -32939,7 +33351,7 @@ class JobManager {
32939
33351
  const startTime = Date.now();
32940
33352
  const pollInterval = 500;
32941
33353
  while (Date.now() - startTime < waitMs) {
32942
- await new Promise((resolve5) => setTimeout(resolve5, pollInterval));
33354
+ await new Promise((resolve6) => setTimeout(resolve6, pollInterval));
32943
33355
  const currentJob = await readJob(jobId);
32944
33356
  if (!currentJob)
32945
33357
  return null;
@@ -33296,16 +33708,16 @@ var init_types3 = __esm(() => {
33296
33708
  });
33297
33709
 
33298
33710
  // packages/core/src/tasks/store.ts
33299
- import { join as join22 } from "path";
33711
+ import { join as join23 } from "path";
33300
33712
  import { mkdir as mkdir9, readFile as readFile8, open as open3, unlink as unlink6 } from "fs/promises";
33301
33713
  function tasksDir(cwd) {
33302
- return join22(cwd, TASKS_DIR);
33714
+ return join23(cwd, TASKS_DIR);
33303
33715
  }
33304
33716
  function tasksPath(cwd) {
33305
- return join22(tasksDir(cwd), TASKS_FILE);
33717
+ return join23(tasksDir(cwd), TASKS_FILE);
33306
33718
  }
33307
33719
  function taskLockPath(cwd) {
33308
- return join22(tasksDir(cwd), TASKS_LOCK_FILE);
33720
+ return join23(tasksDir(cwd), TASKS_LOCK_FILE);
33309
33721
  }
33310
33722
  async function ensureTasksDir(cwd) {
33311
33723
  await mkdir9(tasksDir(cwd), { recursive: true });
@@ -34188,8 +34600,8 @@ var init_evaluator = __esm(() => {
34188
34600
  });
34189
34601
 
34190
34602
  // packages/core/src/guardrails/store.ts
34191
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync9, existsSync as existsSync15, mkdirSync as mkdirSync8 } from "fs";
34192
- import { join as join23, dirname as dirname10 } from "path";
34603
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync9, existsSync as existsSync16, mkdirSync as mkdirSync8 } from "fs";
34604
+ import { join as join24, dirname as dirname10 } from "path";
34193
34605
  import { createHash as createHash3 } from "crypto";
34194
34606
  function generatePolicyId(name, scope) {
34195
34607
  const hash = createHash3("sha256").update(`${name}-${scope}-${Date.now()}`).digest("hex").slice(0, 8);
@@ -34213,20 +34625,20 @@ class GuardrailsStore {
34213
34625
  getFilePath(location) {
34214
34626
  switch (location) {
34215
34627
  case "user":
34216
- return join23(this.baseDir || getConfigDir(), "guardrails.json");
34628
+ return join24(this.baseDir || getConfigDir(), "guardrails.json");
34217
34629
  case "project":
34218
- return join23(this.cwd, ".assistants", "guardrails.json");
34630
+ return join24(this.cwd, ".assistants", "guardrails.json");
34219
34631
  case "local":
34220
- return join23(this.cwd, ".assistants", "guardrails.local.json");
34632
+ return join24(this.cwd, ".assistants", "guardrails.local.json");
34221
34633
  }
34222
34634
  }
34223
34635
  loadFrom(location) {
34224
34636
  const filePath = this.getFilePath(location);
34225
- if (!existsSync15(filePath)) {
34637
+ if (!existsSync16(filePath)) {
34226
34638
  return null;
34227
34639
  }
34228
34640
  try {
34229
- const content = readFileSync8(filePath, "utf-8");
34641
+ const content = readFileSync9(filePath, "utf-8");
34230
34642
  const data = JSON.parse(content);
34231
34643
  const config = data.guardrails || data;
34232
34644
  ensurePolicyIds(config);
@@ -34238,7 +34650,7 @@ class GuardrailsStore {
34238
34650
  save(location, config) {
34239
34651
  const filePath = this.getFilePath(location);
34240
34652
  const dir = dirname10(filePath);
34241
- if (!existsSync15(dir)) {
34653
+ if (!existsSync16(dir)) {
34242
34654
  mkdirSync8(dir, { recursive: true });
34243
34655
  }
34244
34656
  ensurePolicyIds(config);
@@ -63642,8 +64054,8 @@ var require_core3 = __commonJS((exports) => {
63642
64054
  function many1(p) {
63643
64055
  return ab(p, many(p), (head, tail) => [head, ...tail]);
63644
64056
  }
63645
- function ab(pa, pb, join24) {
63646
- return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join24(ma.value, vb, data, i, j)));
64057
+ function ab(pa, pb, join25) {
64058
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join25(ma.value, vb, data, i, j)));
63647
64059
  }
63648
64060
  function left(pa, pb) {
63649
64061
  return ab(pa, pb, (va) => va);
@@ -63651,8 +64063,8 @@ var require_core3 = __commonJS((exports) => {
63651
64063
  function right(pa, pb) {
63652
64064
  return ab(pa, pb, (va, vb) => vb);
63653
64065
  }
63654
- function abc(pa, pb, pc, join24) {
63655
- return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join24(ma.value, mb.value, vc, data, i, j))));
64066
+ function abc(pa, pb, pc, join25) {
64067
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join25(ma.value, mb.value, vc, data, i, j))));
63656
64068
  }
63657
64069
  function middle(pa, pb, pc) {
63658
64070
  return abc(pa, pb, pc, (ra, rb) => rb);
@@ -72110,8 +72522,8 @@ var require_simple_parser = __commonJS((exports, module) => {
72110
72522
  }
72111
72523
  let promise;
72112
72524
  if (!callback) {
72113
- promise = new Promise((resolve5, reject) => {
72114
- callback = callbackPromise(resolve5, reject);
72525
+ promise = new Promise((resolve6, reject) => {
72526
+ callback = callbackPromise(resolve6, reject);
72115
72527
  });
72116
72528
  }
72117
72529
  options = options || {};
@@ -72197,13 +72609,13 @@ var require_simple_parser = __commonJS((exports, module) => {
72197
72609
  }
72198
72610
  return promise;
72199
72611
  };
72200
- function callbackPromise(resolve5, reject) {
72612
+ function callbackPromise(resolve6, reject) {
72201
72613
  return function(...args) {
72202
72614
  let err = args.shift();
72203
72615
  if (err) {
72204
72616
  reject(err);
72205
72617
  } else {
72206
- resolve5(...args);
72618
+ resolve6(...args);
72207
72619
  }
72208
72620
  };
72209
72621
  }
@@ -72366,11 +72778,11 @@ var init_email_parser = __esm(() => {
72366
72778
  });
72367
72779
 
72368
72780
  // packages/core/src/workspace/shared.ts
72369
- import { join as join24 } from "path";
72781
+ import { join as join25 } from "path";
72370
72782
  import {
72371
- existsSync as existsSync16,
72783
+ existsSync as existsSync17,
72372
72784
  mkdirSync as mkdirSync9,
72373
- readFileSync as readFileSync9,
72785
+ readFileSync as readFileSync10,
72374
72786
  readdirSync as readdirSync6,
72375
72787
  rmSync,
72376
72788
  renameSync as renameSync2
@@ -72379,12 +72791,12 @@ import {
72379
72791
  class SharedWorkspaceManager {
72380
72792
  basePath;
72381
72793
  constructor(basePath) {
72382
- this.basePath = basePath || join24(getConfigDir(), "workspaces");
72794
+ this.basePath = basePath || join25(getConfigDir(), "workspaces");
72383
72795
  this.ensureDir();
72384
72796
  this.migrateAgentsToAssistants();
72385
72797
  }
72386
72798
  ensureDir() {
72387
- if (!existsSync16(this.basePath)) {
72799
+ if (!existsSync17(this.basePath)) {
72388
72800
  mkdirSync9(this.basePath, { recursive: true });
72389
72801
  }
72390
72802
  }
@@ -72392,20 +72804,20 @@ class SharedWorkspaceManager {
72392
72804
  try {
72393
72805
  const dirs = readdirSync6(this.basePath, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
72394
72806
  for (const dir of dirs) {
72395
- const wsPath = join24(this.basePath, dir);
72396
- const oldAgentsDir = join24(wsPath, "agents");
72397
- const newAssistantsDir = join24(wsPath, "assistants");
72398
- if (existsSync16(oldAgentsDir) && !existsSync16(newAssistantsDir)) {
72807
+ const wsPath = join25(this.basePath, dir);
72808
+ const oldAgentsDir = join25(wsPath, "agents");
72809
+ const newAssistantsDir = join25(wsPath, "assistants");
72810
+ if (existsSync17(oldAgentsDir) && !existsSync17(newAssistantsDir)) {
72399
72811
  renameSync2(oldAgentsDir, newAssistantsDir);
72400
72812
  }
72401
72813
  }
72402
72814
  } catch {}
72403
72815
  }
72404
72816
  getWorkspacePath(id) {
72405
- return join24(this.basePath, id);
72817
+ return join25(this.basePath, id);
72406
72818
  }
72407
72819
  getMetadataPath(id) {
72408
- return join24(this.getWorkspacePath(id), "workspace.json");
72820
+ return join25(this.getWorkspacePath(id), "workspace.json");
72409
72821
  }
72410
72822
  create(name, createdBy, participants, description) {
72411
72823
  const id = `ws_${generateId().slice(0, 8)}`;
@@ -72420,9 +72832,9 @@ class SharedWorkspaceManager {
72420
72832
  status: "active"
72421
72833
  };
72422
72834
  const wsPath = this.getWorkspacePath(id);
72423
- mkdirSync9(join24(wsPath, "shared"), { recursive: true });
72835
+ mkdirSync9(join25(wsPath, "shared"), { recursive: true });
72424
72836
  for (const assistantId of workspace.participants) {
72425
- mkdirSync9(join24(wsPath, "assistants", assistantId), { recursive: true });
72837
+ mkdirSync9(join25(wsPath, "assistants", assistantId), { recursive: true });
72426
72838
  }
72427
72839
  atomicWriteFileSync(this.getMetadataPath(id), JSON.stringify(workspace, null, 2));
72428
72840
  return workspace;
@@ -72437,17 +72849,17 @@ class SharedWorkspaceManager {
72437
72849
  workspace.updatedAt = Date.now();
72438
72850
  atomicWriteFileSync(this.getMetadataPath(workspaceId), JSON.stringify(workspace, null, 2));
72439
72851
  }
72440
- const assistantDir = join24(this.getWorkspacePath(workspaceId), "assistants", assistantId);
72441
- if (!existsSync16(assistantDir)) {
72852
+ const assistantDir = join25(this.getWorkspacePath(workspaceId), "assistants", assistantId);
72853
+ if (!existsSync17(assistantDir)) {
72442
72854
  mkdirSync9(assistantDir, { recursive: true });
72443
72855
  }
72444
72856
  }
72445
72857
  get(workspaceId) {
72446
72858
  try {
72447
72859
  const metadataPath = this.getMetadataPath(workspaceId);
72448
- if (!existsSync16(metadataPath))
72860
+ if (!existsSync17(metadataPath))
72449
72861
  return null;
72450
- return JSON.parse(readFileSync9(metadataPath, "utf-8"));
72862
+ return JSON.parse(readFileSync10(metadataPath, "utf-8"));
72451
72863
  } catch {
72452
72864
  return null;
72453
72865
  }
@@ -72456,10 +72868,10 @@ class SharedWorkspaceManager {
72456
72868
  return this.getWorkspacePath(workspaceId);
72457
72869
  }
72458
72870
  getSharedPath(workspaceId) {
72459
- return join24(this.getWorkspacePath(workspaceId), "shared");
72871
+ return join25(this.getWorkspacePath(workspaceId), "shared");
72460
72872
  }
72461
72873
  getAssistantPath(workspaceId, assistantId) {
72462
- return join24(this.getWorkspacePath(workspaceId), "assistants", assistantId);
72874
+ return join25(this.getWorkspacePath(workspaceId), "assistants", assistantId);
72463
72875
  }
72464
72876
  list(includeArchived = false) {
72465
72877
  try {
@@ -72492,7 +72904,7 @@ class SharedWorkspaceManager {
72492
72904
  }
72493
72905
  delete(workspaceId) {
72494
72906
  const wsPath = this.getWorkspacePath(workspaceId);
72495
- if (existsSync16(wsPath)) {
72907
+ if (existsSync17(wsPath)) {
72496
72908
  rmSync(wsPath, { recursive: true, force: true });
72497
72909
  }
72498
72910
  }
@@ -72504,23 +72916,23 @@ var init_shared2 = __esm(async () => {
72504
72916
  });
72505
72917
 
72506
72918
  // packages/core/src/workspace/active.ts
72507
- import { join as join25 } from "path";
72508
- import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync11 } from "fs";
72919
+ import { join as join26 } from "path";
72920
+ import { existsSync as existsSync18, mkdirSync as mkdirSync10, readFileSync as readFileSync11, writeFileSync as writeFileSync11 } from "fs";
72509
72921
  function isValidId2(id) {
72510
72922
  return typeof id === "string" && id.length > 0 && SAFE_ID_PATTERN6.test(id);
72511
72923
  }
72512
72924
  function getWorkspaceRoot(baseDir) {
72513
- return join25(baseDir ?? getConfigDir(), "workspaces");
72925
+ return join26(baseDir ?? getConfigDir(), "workspaces");
72514
72926
  }
72515
72927
  function getActiveWorkspacePath(baseDir) {
72516
- return join25(getWorkspaceRoot(baseDir), "active.json");
72928
+ return join26(getWorkspaceRoot(baseDir), "active.json");
72517
72929
  }
72518
72930
  function getActiveWorkspaceId(baseDir) {
72519
72931
  try {
72520
72932
  const activePath = getActiveWorkspacePath(baseDir);
72521
- if (!existsSync17(activePath))
72933
+ if (!existsSync18(activePath))
72522
72934
  return null;
72523
- const raw = readFileSync10(activePath, "utf-8");
72935
+ const raw = readFileSync11(activePath, "utf-8");
72524
72936
  const data = JSON.parse(raw);
72525
72937
  const id = data.id ?? null;
72526
72938
  if (id && !isValidId2(id)) {
@@ -72536,7 +72948,7 @@ function setActiveWorkspaceId(id, baseDir) {
72536
72948
  throw new Error(`Invalid workspace id: "${id}"`);
72537
72949
  }
72538
72950
  const root = getWorkspaceRoot(baseDir);
72539
- if (!existsSync17(root)) {
72951
+ if (!existsSync18(root)) {
72540
72952
  mkdirSync10(root, { recursive: true });
72541
72953
  }
72542
72954
  const activePath = getActiveWorkspacePath(baseDir);
@@ -72548,11 +72960,11 @@ function getWorkspaceDataDir(workspaceId, baseDir) {
72548
72960
  if (!isValidId2(workspaceId)) {
72549
72961
  throw new Error(`Invalid workspace id: "${workspaceId}"`);
72550
72962
  }
72551
- return join25(getWorkspaceRoot(baseDir), workspaceId, ".assistants");
72963
+ return join26(getWorkspaceRoot(baseDir), workspaceId, ".assistants");
72552
72964
  }
72553
72965
  function ensureWorkspaceDataDir(workspaceId, baseDir) {
72554
72966
  const dir = getWorkspaceDataDir(workspaceId, baseDir);
72555
- if (!existsSync17(dir)) {
72967
+ if (!existsSync18(dir)) {
72556
72968
  mkdirSync10(dir, { recursive: true });
72557
72969
  }
72558
72970
  initAssistantsDir(dir);
@@ -72633,9 +73045,9 @@ var init_defaults2 = __esm(() => {
72633
73045
  });
72634
73046
 
72635
73047
  // packages/core/src/budget/tracker.ts
72636
- import { join as join26, dirname as dirname11 } from "path";
72637
- import { homedir as homedir11 } from "os";
72638
- import { existsSync as existsSync18, mkdirSync as mkdirSync11, readFileSync as readFileSync11 } from "fs";
73048
+ import { join as join27, dirname as dirname11 } from "path";
73049
+ import { homedir as homedir13 } from "os";
73050
+ import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync12 } from "fs";
72639
73051
  function createEmptyUsage() {
72640
73052
  const now2 = new Date().toISOString();
72641
73053
  return {
@@ -72668,19 +73080,19 @@ class BudgetTracker {
72668
73080
  }
72669
73081
  }
72670
73082
  getStatePath() {
72671
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir11();
72672
- return join26(envHome, ".assistants", "budget", `${this.sessionId}.json`);
73083
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir13();
73084
+ return join27(envHome, ".assistants", "budget", `${this.sessionId}.json`);
72673
73085
  }
72674
73086
  getProjectStatePath(projectId) {
72675
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir11();
72676
- return join26(envHome, ".assistants", "budget", `project-${projectId}.json`);
73087
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir13();
73088
+ return join27(envHome, ".assistants", "budget", `project-${projectId}.json`);
72677
73089
  }
72678
73090
  loadState() {
72679
73091
  try {
72680
73092
  const statePath = this.getStatePath();
72681
- if (!existsSync18(statePath))
73093
+ if (!existsSync19(statePath))
72682
73094
  return;
72683
- const data = JSON.parse(readFileSync11(statePath, "utf-8"));
73095
+ const data = JSON.parse(readFileSync12(statePath, "utf-8"));
72684
73096
  if (data.version !== PERSISTENCE_VERSION && data.version !== 1)
72685
73097
  return;
72686
73098
  this.sessionUsage = data.session;
@@ -72699,9 +73111,9 @@ class BudgetTracker {
72699
73111
  loadProjectState(projectId) {
72700
73112
  try {
72701
73113
  const statePath = this.getProjectStatePath(projectId);
72702
- if (!existsSync18(statePath))
73114
+ if (!existsSync19(statePath))
72703
73115
  return createEmptyUsage();
72704
- const data = JSON.parse(readFileSync11(statePath, "utf-8"));
73116
+ const data = JSON.parse(readFileSync12(statePath, "utf-8"));
72705
73117
  return data;
72706
73118
  } catch {
72707
73119
  return createEmptyUsage();
@@ -72713,7 +73125,7 @@ class BudgetTracker {
72713
73125
  try {
72714
73126
  const statePath = this.getProjectStatePath(projectId);
72715
73127
  const stateDir = dirname11(statePath);
72716
- if (!existsSync18(stateDir)) {
73128
+ if (!existsSync19(stateDir)) {
72717
73129
  mkdirSync11(stateDir, { recursive: true });
72718
73130
  }
72719
73131
  atomicWriteFileSync(statePath, JSON.stringify(usage, null, 2));
@@ -72725,7 +73137,7 @@ class BudgetTracker {
72725
73137
  try {
72726
73138
  const statePath = this.getStatePath();
72727
73139
  const stateDir = dirname11(statePath);
72728
- if (!existsSync18(stateDir)) {
73140
+ if (!existsSync19(stateDir)) {
72729
73141
  mkdirSync11(stateDir, { recursive: true });
72730
73142
  }
72731
73143
  const state = {
@@ -73342,9 +73754,9 @@ var init_types4 = __esm(() => {
73342
73754
  });
73343
73755
 
73344
73756
  // packages/core/src/registry/store.ts
73345
- import { existsSync as existsSync19, mkdirSync as mkdirSync12, readFileSync as readFileSync12, writeFileSync as writeFileSync12 } from "fs";
73346
- import { join as join27, dirname as dirname12 } from "path";
73347
- import { homedir as homedir12 } from "os";
73757
+ import { existsSync as existsSync20, mkdirSync as mkdirSync12, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "fs";
73758
+ import { join as join28, dirname as dirname12 } from "path";
73759
+ import { homedir as homedir14 } from "os";
73348
73760
  function generateAssistantId() {
73349
73761
  return `assistant_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
73350
73762
  }
@@ -73480,15 +73892,15 @@ class RegistryStore {
73480
73892
  if (this.config.storagePath) {
73481
73893
  return this.config.storagePath;
73482
73894
  }
73483
- const home = process.env.HOME || process.env.USERPROFILE || homedir12();
73484
- return join27(home, ".assistants", "registry", "assistants.json");
73895
+ const home = process.env.HOME || process.env.USERPROFILE || homedir14();
73896
+ return join28(home, ".assistants", "registry", "assistants.json");
73485
73897
  }
73486
73898
  loadFromFile() {
73487
73899
  try {
73488
73900
  const path2 = this.getStoragePath();
73489
- if (!existsSync19(path2))
73901
+ if (!existsSync20(path2))
73490
73902
  return;
73491
- const data = JSON.parse(readFileSync12(path2, "utf-8"));
73903
+ const data = JSON.parse(readFileSync13(path2, "utf-8"));
73492
73904
  if (Array.isArray(data.assistants)) {
73493
73905
  for (const assistant of data.assistants) {
73494
73906
  this.assistants.set(assistant.id, assistant);
@@ -73502,7 +73914,7 @@ class RegistryStore {
73502
73914
  try {
73503
73915
  const path2 = this.getStoragePath();
73504
73916
  const dir = dirname12(path2);
73505
- if (!existsSync19(dir)) {
73917
+ if (!existsSync20(dir)) {
73506
73918
  mkdirSync12(dir, { recursive: true });
73507
73919
  }
73508
73920
  const data = {
@@ -75473,7 +75885,7 @@ class TaskGraphScheduler {
75473
75885
  this.stopped = true;
75474
75886
  }
75475
75887
  sleep(ms) {
75476
- return new Promise((resolve5) => setTimeout(resolve5, ms));
75888
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
75477
75889
  }
75478
75890
  }
75479
75891
  function aggregateTaskResults(graph, aggregationStrategy = "concatenate") {
@@ -76790,7 +77202,7 @@ ${task.description}`,
76790
77202
  };
76791
77203
  }
76792
77204
  sleep(ms) {
76793
- return new Promise((resolve5) => setTimeout(resolve5, ms));
77205
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
76794
77206
  }
76795
77207
  }
76796
77208
  function createSwarmDispatcher(subassistantManager, context, config) {
@@ -78295,11 +78707,11 @@ var init_swarm = __esm(() => {
78295
78707
  });
78296
78708
 
78297
78709
  // packages/core/src/commands/builtin.ts
78298
- import { join as join28 } from "path";
78299
- import { homedir as homedir13, platform as platform2, release, arch as arch2 } from "os";
78300
- import { existsSync as existsSync20, mkdirSync as mkdirSync13, writeFileSync as writeFileSync13 } from "fs";
78301
- function resolveAuthTimeout(resolve5) {
78302
- resolve5({ exitCode: 1, stdout: { toString: () => "{}" } });
78710
+ import { join as join29 } from "path";
78711
+ import { homedir as homedir15, platform as platform2, release, arch as arch2 } from "os";
78712
+ import { existsSync as existsSync21, mkdirSync as mkdirSync13, writeFileSync as writeFileSync13 } from "fs";
78713
+ function resolveAuthTimeout(resolve6) {
78714
+ resolve6({ exitCode: 1, stdout: { toString: () => "{}" } });
78303
78715
  }
78304
78716
  function splitArgs(input) {
78305
78717
  const args = [];
@@ -84631,9 +85043,9 @@ Format the summary as a brief bullet-point list. This summary will replace the c
84631
85043
  if (action === "show" || action === "paths") {
84632
85044
  const storageDir = context.getStorageDir?.() || getConfigDir();
84633
85045
  const configPaths = [
84634
- join28(context.cwd, ".assistants", "config.json"),
84635
- join28(context.cwd, ".assistants", "config.local.json"),
84636
- join28(storageDir, "config.json")
85046
+ join29(context.cwd, ".assistants", "config.json"),
85047
+ join29(context.cwd, ".assistants", "config.local.json"),
85048
+ join29(storageDir, "config.json")
84637
85049
  ];
84638
85050
  let message = `
84639
85051
  **Configuration**
@@ -84642,21 +85054,21 @@ Format the summary as a brief bullet-point list. This summary will replace the c
84642
85054
  message += `**Config File Locations:**
84643
85055
  `;
84644
85056
  for (const path2 of configPaths) {
84645
- const exists = existsSync20(path2);
85057
+ const exists = existsSync21(path2);
84646
85058
  message += ` ${exists ? "\u2713" : "\u25CB"} ${path2}
84647
85059
  `;
84648
85060
  }
84649
85061
  const envHome = process.env.HOME || process.env.USERPROFILE;
84650
- const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir13();
85062
+ const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir15();
84651
85063
  message += `
84652
85064
  **Commands Directories:**
84653
85065
  `;
84654
- message += ` - Project: ${join28(context.cwd, ".assistants", "commands")}
85066
+ message += ` - Project: ${join29(context.cwd, ".assistants", "commands")}
84655
85067
  `;
84656
- message += ` - User/Workspace: ${join28(storageDir, "commands")}
85068
+ message += ` - User/Workspace: ${join29(storageDir, "commands")}
84657
85069
  `;
84658
- if (storageDir !== join28(homeDir, ".assistants")) {
84659
- message += ` - Global fallback: ${join28(homeDir, ".assistants", "commands")}
85070
+ if (storageDir !== join29(homeDir, ".assistants")) {
85071
+ message += ` - Global fallback: ${join29(homeDir, ".assistants", "commands")}
84660
85072
  `;
84661
85073
  }
84662
85074
  context.emit("text", message);
@@ -85572,7 +85984,7 @@ ${error2 instanceof Error ? error2.message : String(error2)}
85572
85984
  selfHandled: true,
85573
85985
  content: "",
85574
85986
  handler: async (args, context) => {
85575
- const commandsDir = join28(context.cwd, ".assistants", "commands");
85987
+ const commandsDir = join29(context.cwd, ".assistants", "commands");
85576
85988
  mkdirSync13(commandsDir, { recursive: true });
85577
85989
  const exampleCommand = `---
85578
85990
  name: reflect
@@ -85588,8 +86000,8 @@ Please summarize the last interaction and suggest 2-3 next steps.
85588
86000
  - Focus on clarity
85589
86001
  - Ask a follow-up question if needed
85590
86002
  `;
85591
- const examplePath = join28(commandsDir, "reflect.md");
85592
- if (!existsSync20(examplePath)) {
86003
+ const examplePath = join29(commandsDir, "reflect.md");
86004
+ if (!existsSync21(examplePath)) {
85593
86005
  writeFileSync13(examplePath, exampleCommand);
85594
86006
  }
85595
86007
  let message = `
@@ -86319,7 +86731,7 @@ Memory Statistics
86319
86731
  return { handled: true };
86320
86732
  }
86321
86733
  if (action === "export") {
86322
- const filePath = rest[0] || join28(context.getStorageDir?.() || getConfigDir(), "memories-export.json");
86734
+ const filePath = rest[0] || join29(context.getStorageDir?.() || getConfigDir(), "memories-export.json");
86323
86735
  const memories = await manager.export();
86324
86736
  try {
86325
86737
  const content = JSON.stringify(memories, null, 2);
@@ -86537,7 +86949,7 @@ Importing ${validMemories.length} valid entries (skipping ${errors.length} inval
86537
86949
  const heartbeatConfig = context.getHeartbeatConfig?.() ?? null;
86538
86950
  const historyPathTemplate = heartbeatConfig?.historyPath;
86539
86951
  const storageDir = context.getStorageDir?.();
86540
- const runsDir = storageDir ? join28(storageDir, "heartbeats", "runs") : undefined;
86952
+ const runsDir = storageDir ? join29(storageDir, "heartbeats", "runs") : undefined;
86541
86953
  if (!cleanedArgs || cleanedArgs === "ui") {
86542
86954
  context.emit("done");
86543
86955
  return { handled: true, showPanel: "heartbeat" };
@@ -86749,8 +87161,8 @@ Connector "${connectorName}" not found.
86749
87161
  `;
86750
87162
  try {
86751
87163
  let timeoutId = null;
86752
- const timeoutPromise = new Promise((resolve5) => {
86753
- timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve5);
87164
+ const timeoutPromise = new Promise((resolve6) => {
87165
+ timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve6);
86754
87166
  });
86755
87167
  const runtime = getRuntime();
86756
87168
  const cli2 = connector.cli || `connect-${connector.name}`;
@@ -86829,8 +87241,8 @@ Connector "${connectorName}" not found.
86829
87241
  let timeoutId = null;
86830
87242
  try {
86831
87243
  const cli = connector.cli || `connect-${connector.name}`;
86832
- const timeoutPromise = new Promise((resolve5) => {
86833
- timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve5);
87244
+ const timeoutPromise = new Promise((resolve6) => {
87245
+ timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve6);
86834
87246
  });
86835
87247
  const runtime = getRuntime();
86836
87248
  const execPromise = (async () => {
@@ -87239,7 +87651,7 @@ Not a git repository or git not available.
87239
87651
  context.setProjectContext(projectContext);
87240
87652
  }
87241
87653
  }
87242
- var VERSION2 = "1.1.47";
87654
+ var VERSION2 = "1.1.48";
87243
87655
  var init_builtin = __esm(async () => {
87244
87656
  init_src2();
87245
87657
  init_store();
@@ -87461,7 +87873,7 @@ var init_values2 = __esm(() => {
87461
87873
  });
87462
87874
 
87463
87875
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
87464
- var sleep4 = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
87876
+ var sleep4 = (ms) => new Promise((resolve6) => setTimeout(resolve6, ms));
87465
87877
 
87466
87878
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/version.mjs
87467
87879
  var VERSION3 = "0.74.0";
@@ -88159,8 +88571,8 @@ var init_api_promise2 = __esm(() => {
88159
88571
  init_parse2();
88160
88572
  APIPromise2 = class APIPromise2 extends Promise {
88161
88573
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse2) {
88162
- super((resolve5) => {
88163
- resolve5(null);
88574
+ super((resolve6) => {
88575
+ resolve6(null);
88164
88576
  });
88165
88577
  this.responsePromise = responsePromise;
88166
88578
  this.parseResponse = parseResponse2;
@@ -89116,12 +89528,12 @@ var init_BetaMessageStream = __esm(() => {
89116
89528
  }
89117
89529
  return this._emit("error", new AnthropicError(String(error3)));
89118
89530
  });
89119
- __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve5, reject) => {
89120
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve5, "f");
89531
+ __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve6, reject) => {
89532
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve6, "f");
89121
89533
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
89122
89534
  }), "f");
89123
- __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve5, reject) => {
89124
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve5, "f");
89535
+ __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve6, reject) => {
89536
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve6, "f");
89125
89537
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectEndPromise, reject, "f");
89126
89538
  }), "f");
89127
89539
  __classPrivateFieldGet2(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
@@ -89242,11 +89654,11 @@ var init_BetaMessageStream = __esm(() => {
89242
89654
  return this;
89243
89655
  }
89244
89656
  emitted(event) {
89245
- return new Promise((resolve5, reject) => {
89657
+ return new Promise((resolve6, reject) => {
89246
89658
  __classPrivateFieldSet2(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
89247
89659
  if (event !== "error")
89248
89660
  this.once("error", reject);
89249
- this.once(event, resolve5);
89661
+ this.once(event, resolve6);
89250
89662
  });
89251
89663
  }
89252
89664
  async done() {
@@ -89579,7 +89991,7 @@ var init_BetaMessageStream = __esm(() => {
89579
89991
  if (done) {
89580
89992
  return { value: undefined, done: true };
89581
89993
  }
89582
- return new Promise((resolve5, reject) => readQueue.push({ resolve: resolve5, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
89994
+ return new Promise((resolve6, reject) => readQueue.push({ resolve: resolve6, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
89583
89995
  }
89584
89996
  const chunk = pushQueue.shift();
89585
89997
  return { value: chunk, done: false };
@@ -89641,13 +90053,13 @@ Wrap your summary in <summary></summary> tags.`;
89641
90053
 
89642
90054
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs
89643
90055
  function promiseWithResolvers() {
89644
- let resolve5;
90056
+ let resolve6;
89645
90057
  let reject;
89646
90058
  const promise = new Promise((res, rej) => {
89647
- resolve5 = res;
90059
+ resolve6 = res;
89648
90060
  reject = rej;
89649
90061
  });
89650
- return { promise, resolve: resolve5, reject };
90062
+ return { promise, resolve: resolve6, reject };
89651
90063
  }
89652
90064
  async function generateToolResponse(params, lastMessage = params.messages.at(-1)) {
89653
90065
  if (!lastMessage || lastMessage.role !== "assistant" || !lastMessage.content || typeof lastMessage.content === "string") {
@@ -90402,12 +90814,12 @@ var init_MessageStream = __esm(() => {
90402
90814
  }
90403
90815
  return this._emit("error", new AnthropicError(String(error3)));
90404
90816
  });
90405
- __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve5, reject) => {
90406
- __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve5, "f");
90817
+ __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve6, reject) => {
90818
+ __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve6, "f");
90407
90819
  __classPrivateFieldSet2(this, _MessageStream_rejectConnectedPromise, reject, "f");
90408
90820
  }), "f");
90409
- __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve5, reject) => {
90410
- __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve5, "f");
90821
+ __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve6, reject) => {
90822
+ __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve6, "f");
90411
90823
  __classPrivateFieldSet2(this, _MessageStream_rejectEndPromise, reject, "f");
90412
90824
  }), "f");
90413
90825
  __classPrivateFieldGet2(this, _MessageStream_connectedPromise, "f").catch(() => {});
@@ -90528,11 +90940,11 @@ var init_MessageStream = __esm(() => {
90528
90940
  return this;
90529
90941
  }
90530
90942
  emitted(event) {
90531
- return new Promise((resolve5, reject) => {
90943
+ return new Promise((resolve6, reject) => {
90532
90944
  __classPrivateFieldSet2(this, _MessageStream_catchingPromiseCreated, true, "f");
90533
90945
  if (event !== "error")
90534
90946
  this.once("error", reject);
90535
- this.once(event, resolve5);
90947
+ this.once(event, resolve6);
90536
90948
  });
90537
90949
  }
90538
90950
  async done() {
@@ -90840,7 +91252,7 @@ var init_MessageStream = __esm(() => {
90840
91252
  if (done) {
90841
91253
  return { value: undefined, done: true };
90842
91254
  }
90843
- return new Promise((resolve5, reject) => readQueue.push({ resolve: resolve5, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
91255
+ return new Promise((resolve6, reject) => readQueue.push({ resolve: resolve6, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
90844
91256
  }
90845
91257
  const chunk = pushQueue.shift();
90846
91258
  return { value: chunk, done: false };
@@ -91638,6 +92050,11 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91638
92050
  if (docBlock) {
91639
92051
  content.push(docBlock);
91640
92052
  }
92053
+ } else if (doc.type === "image") {
92054
+ const imageBlock = this.convertImageToBlock(doc);
92055
+ if (imageBlock) {
92056
+ content.push(imageBlock);
92057
+ }
91641
92058
  }
91642
92059
  }
91643
92060
  }
@@ -91698,6 +92115,27 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91698
92115
  }
91699
92116
  return null;
91700
92117
  }
92118
+ convertImageToBlock(doc) {
92119
+ if (doc.source.type === "base64") {
92120
+ return {
92121
+ type: "image",
92122
+ source: {
92123
+ type: "base64",
92124
+ media_type: doc.mediaType || doc.source.mediaType || "image/png",
92125
+ data: doc.source.data
92126
+ }
92127
+ };
92128
+ } else if (doc.source.type === "url") {
92129
+ return {
92130
+ type: "image",
92131
+ source: {
92132
+ type: "url",
92133
+ url: doc.source.url
92134
+ }
92135
+ };
92136
+ }
92137
+ return null;
92138
+ }
91701
92139
  convertTools(tools) {
91702
92140
  return tools.map((tool) => ({
91703
92141
  name: tool.name,
@@ -91934,11 +92372,51 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91934
92372
  pendingToolUseIds.delete(toolResult.toolCallId);
91935
92373
  }
91936
92374
  }
92375
+ if (msg.documents && msg.documents.length > 0) {
92376
+ const imageParts = [];
92377
+ for (const doc of msg.documents) {
92378
+ if (doc.type === "image") {
92379
+ const imageContent = this.convertImageToPart(doc);
92380
+ if (imageContent) {
92381
+ imageParts.push(imageContent);
92382
+ }
92383
+ } else if (doc.type === "pdf") {
92384
+ imageParts.push({
92385
+ type: "text",
92386
+ text: `[PDF document attached: ${doc.name || "document.pdf"}. Note: PDF native viewing is not supported by this model. The PDF content was attached but may not be readable.]`
92387
+ });
92388
+ }
92389
+ }
92390
+ if (imageParts.length > 0) {
92391
+ imageParts.push({ type: "text", text: "Please analyze the attached media." });
92392
+ result.push({
92393
+ role: "user",
92394
+ content: imageParts
92395
+ });
92396
+ }
92397
+ }
91937
92398
  } else if (msg.content) {
91938
- result.push({
91939
- role: "user",
91940
- content: msg.content
91941
- });
92399
+ if (msg.documents && msg.documents.length > 0) {
92400
+ const contentParts = [];
92401
+ for (const doc of msg.documents) {
92402
+ if (doc.type === "image") {
92403
+ const imageContent = this.convertImageToPart(doc);
92404
+ if (imageContent) {
92405
+ contentParts.push(imageContent);
92406
+ }
92407
+ }
92408
+ }
92409
+ contentParts.push({ type: "text", text: msg.content });
92410
+ result.push({
92411
+ role: "user",
92412
+ content: contentParts
92413
+ });
92414
+ } else {
92415
+ result.push({
92416
+ role: "user",
92417
+ content: msg.content
92418
+ });
92419
+ }
91942
92420
  }
91943
92421
  } else if (msg.role === "assistant") {
91944
92422
  const assistantMsg = {
@@ -91967,6 +92445,25 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91967
92445
  }
91968
92446
  return result;
91969
92447
  }
92448
+ convertImageToPart(doc) {
92449
+ if (doc.source.type === "base64") {
92450
+ const mediaType = doc.mediaType || doc.source.mediaType || "image/png";
92451
+ return {
92452
+ type: "image_url",
92453
+ image_url: {
92454
+ url: `data:${mediaType};base64,${doc.source.data}`
92455
+ }
92456
+ };
92457
+ } else if (doc.source.type === "url") {
92458
+ return {
92459
+ type: "image_url",
92460
+ image_url: {
92461
+ url: doc.source.url
92462
+ }
92463
+ };
92464
+ }
92465
+ return null;
92466
+ }
91970
92467
  convertTools(tools) {
91971
92468
  return tools.map((tool) => ({
91972
92469
  type: "function",
@@ -92290,34 +92787,34 @@ var init_recovery = __esm(async () => {
92290
92787
  });
92291
92788
 
92292
92789
  // packages/core/src/heartbeat/finder.ts
92293
- import { existsSync as existsSync21, readdirSync as readdirSync7, readFileSync as readFileSync13 } from "fs";
92294
- import { join as join29 } from "path";
92790
+ import { existsSync as existsSync22, readdirSync as readdirSync7, readFileSync as readFileSync14 } from "fs";
92791
+ import { join as join30 } from "path";
92295
92792
  function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 * 60 * 1000, baseDir) {
92296
92793
  const configDir = baseDir ?? getConfigDir();
92297
- const heartbeatsDir = join29(configDir, "heartbeats");
92298
- const stateDir = join29(configDir, "state");
92299
- const sessionsDir = join29(configDir, "sessions");
92794
+ const heartbeatsDir = join30(configDir, "heartbeats");
92795
+ const stateDir = join30(configDir, "state");
92796
+ const sessionsDir = join30(configDir, "sessions");
92300
92797
  const recoverableSessions = [];
92301
- if (!existsSync21(heartbeatsDir)) {
92798
+ if (!existsSync22(heartbeatsDir)) {
92302
92799
  return recoverableSessions;
92303
92800
  }
92304
92801
  const now2 = Date.now();
92305
92802
  const heartbeatFiles = readdirSync7(heartbeatsDir).filter((f) => f.endsWith(".json"));
92306
92803
  for (const file of heartbeatFiles) {
92307
92804
  const sessionId = file.replace(".json", "");
92308
- const heartbeatPath = join29(heartbeatsDir, file);
92309
- const statePath = join29(stateDir, `${sessionId}.json`);
92310
- const sessionPath = join29(sessionsDir, `${sessionId}.json`);
92805
+ const heartbeatPath = join30(heartbeatsDir, file);
92806
+ const statePath = join30(stateDir, `${sessionId}.json`);
92807
+ const sessionPath = join30(sessionsDir, `${sessionId}.json`);
92311
92808
  try {
92312
- const heartbeatContent = readFileSync13(heartbeatPath, "utf-8");
92809
+ const heartbeatContent = readFileSync14(heartbeatPath, "utf-8");
92313
92810
  const heartbeat = JSON.parse(heartbeatContent);
92314
92811
  const heartbeatAge = now2 - new Date(heartbeat.timestamp).getTime();
92315
92812
  if (heartbeatAge < staleThresholdMs) {
92316
92813
  continue;
92317
92814
  }
92318
92815
  let state = null;
92319
- if (existsSync21(statePath)) {
92320
- const stateContent = readFileSync13(statePath, "utf-8");
92816
+ if (existsSync22(statePath)) {
92817
+ const stateContent = readFileSync14(statePath, "utf-8");
92321
92818
  state = JSON.parse(stateContent);
92322
92819
  }
92323
92820
  if (state) {
@@ -92328,9 +92825,9 @@ function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 *
92328
92825
  }
92329
92826
  let messageCount = 0;
92330
92827
  let cwd = state?.context?.cwd || process.cwd();
92331
- if (existsSync21(sessionPath)) {
92828
+ if (existsSync22(sessionPath)) {
92332
92829
  try {
92333
- const sessionContent = readFileSync13(sessionPath, "utf-8");
92830
+ const sessionContent = readFileSync14(sessionPath, "utf-8");
92334
92831
  const sessionData = JSON.parse(sessionContent);
92335
92832
  messageCount = sessionData.messages?.length || 0;
92336
92833
  cwd = sessionData.cwd || cwd;
@@ -92362,16 +92859,16 @@ function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 *
92362
92859
  }
92363
92860
  function clearRecoveryState(sessionId, baseDir) {
92364
92861
  const configDir = baseDir ?? getConfigDir();
92365
- const heartbeatPath = join29(configDir, "heartbeats", `${sessionId}.json`);
92366
- const statePath = join29(configDir, "state", `${sessionId}.json`);
92862
+ const heartbeatPath = join30(configDir, "heartbeats", `${sessionId}.json`);
92863
+ const statePath = join30(configDir, "state", `${sessionId}.json`);
92367
92864
  const { unlinkSync: unlinkSync4 } = __require("fs");
92368
92865
  try {
92369
- if (existsSync21(heartbeatPath)) {
92866
+ if (existsSync22(heartbeatPath)) {
92370
92867
  unlinkSync4(heartbeatPath);
92371
92868
  }
92372
92869
  } catch {}
92373
92870
  try {
92374
- if (existsSync21(statePath)) {
92871
+ if (existsSync22(statePath)) {
92375
92872
  unlinkSync4(statePath);
92376
92873
  }
92377
92874
  } catch {}
@@ -92500,11 +92997,11 @@ var init_watchdog = __esm(async () => {
92500
92997
  });
92501
92998
 
92502
92999
  // packages/core/src/heartbeat/install-skills.ts
92503
- import { join as join30 } from "path";
93000
+ import { join as join31 } from "path";
92504
93001
  async function writeSkillIfNeeded(dir, skillName, content) {
92505
93002
  const { mkdir: mkdir10, writeFile: writeFile8, readFile: readFile11 } = await import("fs/promises");
92506
- const skillDir = join30(dir, `skill-${skillName}`);
92507
- const skillFile = join30(skillDir, "SKILL.md");
93003
+ const skillDir = join31(dir, `skill-${skillName}`);
93004
+ const skillFile = join31(skillDir, "SKILL.md");
92508
93005
  await mkdir10(skillDir, { recursive: true });
92509
93006
  try {
92510
93007
  const existing = await readFile11(skillFile, "utf-8");
@@ -92523,7 +93020,7 @@ async function writeSkillIfNeeded(dir, skillName, content) {
92523
93020
  }
92524
93021
  }
92525
93022
  async function installHeartbeatSkills() {
92526
- const sharedSkillsDir = join30(getConfigDir(), "shared", "skills");
93023
+ const sharedSkillsDir = join31(getConfigDir(), "shared", "skills");
92527
93024
  const installed = [];
92528
93025
  const results = await Promise.all([
92529
93026
  writeSkillIfNeeded(sharedSkillsDir, "main-loop", MAIN_LOOP_SKILL),
@@ -92877,128 +93374,6 @@ var init_llm_response = __esm(() => {
92877
93374
  init_schema();
92878
93375
  });
92879
93376
 
92880
- // packages/core/src/voice/utils.ts
92881
- import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
92882
- import { homedir as homedir14 } from "os";
92883
- import { join as join31 } from "path";
92884
- import { spawnSync } from "child_process";
92885
- function loadApiKeyFromSecrets2(key) {
92886
- const envHome = process.env.HOME || process.env.USERPROFILE;
92887
- const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir14();
92888
- const secretsPath = join31(homeDir, ".secrets");
92889
- if (!existsSync22(secretsPath))
92890
- return;
92891
- try {
92892
- const content = readFileSync14(secretsPath, "utf-8");
92893
- const match = content.match(new RegExp(`export\\s+${key}\\s*=\\s*['"]?([^'"\\n]+)['"]?`));
92894
- return match?.[1];
92895
- } catch {
92896
- return;
92897
- }
92898
- }
92899
- function findExecutable(name) {
92900
- const command = process.platform === "win32" ? "where" : "which";
92901
- const result = spawnSync(command, [name], { encoding: "utf-8" });
92902
- if (result.status === 0 && result.stdout) {
92903
- const output = result.stdout.trim().split(`
92904
- `)[0]?.trim();
92905
- return output || null;
92906
- }
92907
- return null;
92908
- }
92909
- var init_utils4 = () => {};
92910
-
92911
- // packages/core/src/voice/stt.ts
92912
- class WhisperSTT {
92913
- apiKey;
92914
- model;
92915
- language;
92916
- constructor(options = {}) {
92917
- this.apiKey = options.apiKey || process.env.OPENAI_API_KEY || loadApiKeyFromSecrets2("OPENAI_API_KEY") || "";
92918
- this.model = options.model || "whisper-1";
92919
- this.language = options.language;
92920
- }
92921
- async transcribe(audioBuffer) {
92922
- if (!this.apiKey) {
92923
- throw new Error("Missing OPENAI_API_KEY for Whisper STT. Set it in env or ~/.secrets.");
92924
- }
92925
- const form = new FormData;
92926
- form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
92927
- form.append("model", this.model);
92928
- if (this.language) {
92929
- form.append("language", this.language);
92930
- }
92931
- const response = await fetch("https://api.openai.com/v1/audio/transcriptions", {
92932
- method: "POST",
92933
- headers: {
92934
- Authorization: `Bearer ${this.apiKey}`
92935
- },
92936
- body: form
92937
- });
92938
- if (!response.ok) {
92939
- const errorText = await response.text();
92940
- throw new Error(`Whisper STT failed (${response.status}): ${errorText || response.statusText}`);
92941
- }
92942
- const result = await response.json();
92943
- return {
92944
- text: result.text || "",
92945
- confidence: 1,
92946
- language: result.language
92947
- };
92948
- }
92949
- async startListening() {
92950
- throw new Error("Real-time transcription is not supported. Use VoiceManager.listen().");
92951
- }
92952
- }
92953
-
92954
- class ElevenLabsSTT {
92955
- apiKey;
92956
- model;
92957
- language;
92958
- constructor(options = {}) {
92959
- this.apiKey = options.apiKey || process.env.ELEVENLABS_API_KEY || loadApiKeyFromSecrets2("ELEVENLABS_API_KEY") || "";
92960
- this.model = options.model || "scribe_v2";
92961
- this.language = options.language;
92962
- }
92963
- async transcribe(audioBuffer) {
92964
- if (!this.apiKey) {
92965
- throw new Error("Missing ELEVENLABS_API_KEY for ElevenLabs STT. Set it in env or ~/.secrets.");
92966
- }
92967
- const form = new FormData;
92968
- form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
92969
- form.append("model_id", this.model);
92970
- if (this.language) {
92971
- form.append("language_code", this.language);
92972
- }
92973
- const response = await fetch("https://api.elevenlabs.io/v1/speech-to-text", {
92974
- method: "POST",
92975
- headers: {
92976
- "xi-api-key": this.apiKey
92977
- },
92978
- body: form
92979
- });
92980
- if (!response.ok) {
92981
- const errorText = await response.text();
92982
- throw new Error(`ElevenLabs STT failed (${response.status}): ${errorText || response.statusText}`);
92983
- }
92984
- const result = await response.json();
92985
- return {
92986
- text: result.text || "",
92987
- confidence: 1,
92988
- language: result.language_code
92989
- };
92990
- }
92991
- }
92992
-
92993
- class SystemSTT {
92994
- async transcribe(_audioBuffer) {
92995
- throw new Error("System STT is not available yet. Use Whisper STT instead.");
92996
- }
92997
- }
92998
- var init_stt = __esm(() => {
92999
- init_utils4();
93000
- });
93001
-
93002
93377
  // packages/core/src/voice/tts.ts
93003
93378
  import { spawnSync as spawnSync2 } from "child_process";
93004
93379
  import { tmpdir as tmpdir2 } from "os";
@@ -93173,14 +93548,14 @@ class AudioPlayer {
93173
93548
  if (!player) {
93174
93549
  throw new Error("No supported audio player found. Install afplay, ffplay, mpg123, or aplay.");
93175
93550
  }
93176
- await new Promise((resolve5, reject) => {
93551
+ await new Promise((resolve6, reject) => {
93177
93552
  this.playing = true;
93178
93553
  this.currentProcess = spawn(player.command, [...player.args, tempFile], { stdio: "ignore" });
93179
93554
  this.currentProcess.on("close", () => {
93180
93555
  this.playing = false;
93181
93556
  this.currentProcess = null;
93182
93557
  unlink8(tempFile, () => {});
93183
- resolve5();
93558
+ resolve6();
93184
93559
  });
93185
93560
  this.currentProcess.on("error", (error3) => {
93186
93561
  this.playing = false;
@@ -93205,14 +93580,14 @@ class AudioPlayer {
93205
93580
  unlink8(tempFile, () => {});
93206
93581
  throw new Error("No supported audio player found.");
93207
93582
  }
93208
- return new Promise((resolve5, reject) => {
93583
+ return new Promise((resolve6, reject) => {
93209
93584
  this.playing = true;
93210
93585
  this.currentProcess = spawn(player.command, [...player.args, tempFile]);
93211
93586
  this.currentProcess.on("close", () => {
93212
93587
  this.playing = false;
93213
93588
  this.currentProcess = null;
93214
93589
  unlink8(tempFile, () => {});
93215
- resolve5();
93590
+ resolve6();
93216
93591
  });
93217
93592
  this.currentProcess.on("error", (error3) => {
93218
93593
  this.playing = false;
@@ -93285,12 +93660,12 @@ class AudioRecorder {
93285
93660
  if (!recorder) {
93286
93661
  throw new Error("No supported audio recorder found. Install sox or ffmpeg.");
93287
93662
  }
93288
- await new Promise((resolve5, reject) => {
93663
+ await new Promise((resolve6, reject) => {
93289
93664
  this.currentProcess = spawn2(recorder.command, recorder.args, { stdio: "ignore" });
93290
93665
  this.currentProcess.on("close", (code) => {
93291
93666
  this.currentProcess = null;
93292
93667
  if (code === 0 || this.stoppedIntentionally) {
93293
- resolve5();
93668
+ resolve6();
93294
93669
  } else {
93295
93670
  reject(new Error("Audio recording failed."));
93296
93671
  }
@@ -93323,12 +93698,12 @@ class AudioRecorder {
93323
93698
  if (!recorder) {
93324
93699
  return this.record({ ...options, durationSeconds: options.durationSeconds ?? 5 });
93325
93700
  }
93326
- await new Promise((resolve5, reject) => {
93701
+ await new Promise((resolve6, reject) => {
93327
93702
  this.currentProcess = spawn2(recorder.command, recorder.args, { stdio: "ignore" });
93328
93703
  this.currentProcess.on("close", (code) => {
93329
93704
  this.currentProcess = null;
93330
93705
  if (code === 0 || this.stoppedIntentionally) {
93331
- resolve5();
93706
+ resolve6();
93332
93707
  } else {
93333
93708
  reject(new Error("Audio recording failed."));
93334
93709
  }
@@ -93937,6 +94312,7 @@ class AssistantManager {
93937
94312
  name: options.name,
93938
94313
  description: options.description,
93939
94314
  avatar: options.avatar,
94315
+ color: options.color,
93940
94316
  settings: { ...DEFAULT_SETTINGS, ...options.settings || {} },
93941
94317
  createdAt: now2,
93942
94318
  updatedAt: now2
@@ -95136,7 +95512,7 @@ var require_headStream = __commonJS((exports) => {
95136
95512
  if ((0, stream_type_check_1.isReadableStream)(stream)) {
95137
95513
  return (0, headStream_browser_1.headStream)(stream, bytes);
95138
95514
  }
95139
- return new Promise((resolve5, reject) => {
95515
+ return new Promise((resolve6, reject) => {
95140
95516
  const collector = new Collector;
95141
95517
  collector.limit = bytes;
95142
95518
  stream.pipe(collector);
@@ -95147,7 +95523,7 @@ var require_headStream = __commonJS((exports) => {
95147
95523
  collector.on("error", reject);
95148
95524
  collector.on("finish", function() {
95149
95525
  const bytes2 = new Uint8Array(Buffer.concat(this.buffers));
95150
- resolve5(bytes2);
95526
+ resolve6(bytes2);
95151
95527
  });
95152
95528
  });
95153
95529
  };
@@ -95327,21 +95703,21 @@ var require_dist_cjs11 = __commonJS((exports) => {
95327
95703
  let sendBody = true;
95328
95704
  if (!externalAgent && expect === "100-continue") {
95329
95705
  sendBody = await Promise.race([
95330
- new Promise((resolve5) => {
95331
- timeoutId = Number(timing.setTimeout(() => resolve5(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
95706
+ new Promise((resolve6) => {
95707
+ timeoutId = Number(timing.setTimeout(() => resolve6(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
95332
95708
  }),
95333
- new Promise((resolve5) => {
95709
+ new Promise((resolve6) => {
95334
95710
  httpRequest.on("continue", () => {
95335
95711
  timing.clearTimeout(timeoutId);
95336
- resolve5(true);
95712
+ resolve6(true);
95337
95713
  });
95338
95714
  httpRequest.on("response", () => {
95339
95715
  timing.clearTimeout(timeoutId);
95340
- resolve5(false);
95716
+ resolve6(false);
95341
95717
  });
95342
95718
  httpRequest.on("error", () => {
95343
95719
  timing.clearTimeout(timeoutId);
95344
- resolve5(false);
95720
+ resolve6(false);
95345
95721
  });
95346
95722
  })
95347
95723
  ]);
@@ -95408,13 +95784,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95408
95784
  return socketWarningTimestamp;
95409
95785
  }
95410
95786
  constructor(options) {
95411
- this.configProvider = new Promise((resolve5, reject) => {
95787
+ this.configProvider = new Promise((resolve6, reject) => {
95412
95788
  if (typeof options === "function") {
95413
95789
  options().then((_options) => {
95414
- resolve5(this.resolveDefaultConfig(_options));
95790
+ resolve6(this.resolveDefaultConfig(_options));
95415
95791
  }).catch(reject);
95416
95792
  } else {
95417
- resolve5(this.resolveDefaultConfig(options));
95793
+ resolve6(this.resolveDefaultConfig(options));
95418
95794
  }
95419
95795
  });
95420
95796
  }
@@ -95457,7 +95833,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95457
95833
  const config = this.config;
95458
95834
  let writeRequestBodyPromise = undefined;
95459
95835
  const timeouts = [];
95460
- const resolve5 = async (arg) => {
95836
+ const resolve6 = async (arg) => {
95461
95837
  await writeRequestBodyPromise;
95462
95838
  timeouts.forEach(timing.clearTimeout);
95463
95839
  _resolve(arg);
@@ -95523,7 +95899,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95523
95899
  headers: getTransformedHeaders(res.headers),
95524
95900
  body: res
95525
95901
  });
95526
- resolve5({ response: httpResponse });
95902
+ resolve6({ response: httpResponse });
95527
95903
  });
95528
95904
  req.on("error", (err) => {
95529
95905
  if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
@@ -95706,13 +96082,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95706
96082
  return new NodeHttp2Handler(instanceOrOptions);
95707
96083
  }
95708
96084
  constructor(options) {
95709
- this.configProvider = new Promise((resolve5, reject) => {
96085
+ this.configProvider = new Promise((resolve6, reject) => {
95710
96086
  if (typeof options === "function") {
95711
96087
  options().then((opts) => {
95712
- resolve5(opts || {});
96088
+ resolve6(opts || {});
95713
96089
  }).catch(reject);
95714
96090
  } else {
95715
- resolve5(options || {});
96091
+ resolve6(options || {});
95716
96092
  }
95717
96093
  });
95718
96094
  }
@@ -95732,7 +96108,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95732
96108
  return new Promise((_resolve, _reject) => {
95733
96109
  let fulfilled = false;
95734
96110
  let writeRequestBodyPromise = undefined;
95735
- const resolve5 = async (arg) => {
96111
+ const resolve6 = async (arg) => {
95736
96112
  await writeRequestBodyPromise;
95737
96113
  _resolve(arg);
95738
96114
  };
@@ -95788,7 +96164,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95788
96164
  body: req
95789
96165
  });
95790
96166
  fulfilled = true;
95791
- resolve5({ response: httpResponse });
96167
+ resolve6({ response: httpResponse });
95792
96168
  if (disableConcurrentStreams) {
95793
96169
  session.close();
95794
96170
  this.connectionManager.deleteSession(authority, session);
@@ -95866,7 +96242,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95866
96242
  if (isReadableStreamInstance(stream2)) {
95867
96243
  return collectReadableStream(stream2);
95868
96244
  }
95869
- return new Promise((resolve5, reject) => {
96245
+ return new Promise((resolve6, reject) => {
95870
96246
  const collector = new Collector;
95871
96247
  stream2.pipe(collector);
95872
96248
  stream2.on("error", (err) => {
@@ -95876,7 +96252,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95876
96252
  collector.on("error", reject);
95877
96253
  collector.on("finish", function() {
95878
96254
  const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
95879
- resolve5(bytes);
96255
+ resolve6(bytes);
95880
96256
  });
95881
96257
  });
95882
96258
  };
@@ -95917,7 +96293,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
95917
96293
  return new Request(url, requestOptions);
95918
96294
  }
95919
96295
  function requestTimeout(timeoutInMs = 0) {
95920
- return new Promise((resolve5, reject) => {
96296
+ return new Promise((resolve6, reject) => {
95921
96297
  if (timeoutInMs) {
95922
96298
  setTimeout(() => {
95923
96299
  const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
@@ -96034,7 +96410,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96034
96410
  requestTimeout(requestTimeoutInMs)
96035
96411
  ];
96036
96412
  if (abortSignal) {
96037
- raceOfPromises.push(new Promise((resolve5, reject) => {
96413
+ raceOfPromises.push(new Promise((resolve6, reject) => {
96038
96414
  const onAbort = () => {
96039
96415
  const abortError = new Error("Request aborted");
96040
96416
  abortError.name = "AbortError";
@@ -96098,7 +96474,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96098
96474
  return collected;
96099
96475
  }
96100
96476
  function readToBase64(blob) {
96101
- return new Promise((resolve5, reject) => {
96477
+ return new Promise((resolve6, reject) => {
96102
96478
  const reader = new FileReader;
96103
96479
  reader.onloadend = () => {
96104
96480
  if (reader.readyState !== 2) {
@@ -96107,7 +96483,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96107
96483
  const result = reader.result ?? "";
96108
96484
  const commaIndex = result.indexOf(",");
96109
96485
  const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
96110
- resolve5(result.substring(dataOffset));
96486
+ resolve6(result.substring(dataOffset));
96111
96487
  };
96112
96488
  reader.onabort = () => reject(new Error("Read aborted"));
96113
96489
  reader.onerror = () => reject(reader.error);
@@ -97206,11 +97582,11 @@ var require_tslib = __commonJS((exports, module) => {
97206
97582
  };
97207
97583
  __awaiter = function(thisArg, _arguments, P, generator) {
97208
97584
  function adopt(value) {
97209
- return value instanceof P ? value : new P(function(resolve5) {
97210
- resolve5(value);
97585
+ return value instanceof P ? value : new P(function(resolve6) {
97586
+ resolve6(value);
97211
97587
  });
97212
97588
  }
97213
- return new (P || (P = Promise))(function(resolve5, reject) {
97589
+ return new (P || (P = Promise))(function(resolve6, reject) {
97214
97590
  function fulfilled(value) {
97215
97591
  try {
97216
97592
  step(generator.next(value));
@@ -97226,7 +97602,7 @@ var require_tslib = __commonJS((exports, module) => {
97226
97602
  }
97227
97603
  }
97228
97604
  function step(result) {
97229
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
97605
+ result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
97230
97606
  }
97231
97607
  step((generator = generator.apply(thisArg, _arguments || [])).next());
97232
97608
  });
@@ -97455,14 +97831,14 @@ var require_tslib = __commonJS((exports, module) => {
97455
97831
  }, i);
97456
97832
  function verb(n) {
97457
97833
  i[n] = o[n] && function(v) {
97458
- return new Promise(function(resolve5, reject) {
97459
- v = o[n](v), settle(resolve5, reject, v.done, v.value);
97834
+ return new Promise(function(resolve6, reject) {
97835
+ v = o[n](v), settle(resolve6, reject, v.done, v.value);
97460
97836
  });
97461
97837
  };
97462
97838
  }
97463
- function settle(resolve5, reject, d, v) {
97839
+ function settle(resolve6, reject, d, v) {
97464
97840
  Promise.resolve(v).then(function(v2) {
97465
- resolve5({ value: v2, done: d });
97841
+ resolve6({ value: v2, done: d });
97466
97842
  }, reject);
97467
97843
  }
97468
97844
  };
@@ -109770,7 +110146,7 @@ var require_dist_cjs39 = __commonJS((exports) => {
109770
110146
  this.refillTokenBucket();
109771
110147
  if (amount > this.currentCapacity) {
109772
110148
  const delay = (amount - this.currentCapacity) / this.fillRate * 1000;
109773
- await new Promise((resolve5) => DefaultRateLimiter.setTimeoutFn(resolve5, delay));
110149
+ await new Promise((resolve6) => DefaultRateLimiter.setTimeoutFn(resolve6, delay));
109774
110150
  }
109775
110151
  this.currentCapacity = this.currentCapacity - amount;
109776
110152
  }
@@ -110103,7 +110479,7 @@ var require_dist_cjs40 = __commonJS((exports) => {
110103
110479
  const delayFromResponse = getDelayFromRetryAfterHeader(err.$response);
110104
110480
  const delay = Math.max(delayFromResponse || 0, delayFromDecider);
110105
110481
  totalDelay += delay;
110106
- await new Promise((resolve5) => setTimeout(resolve5, delay));
110482
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
110107
110483
  continue;
110108
110484
  }
110109
110485
  if (!err.$metadata) {
@@ -110262,7 +110638,7 @@ var require_dist_cjs40 = __commonJS((exports) => {
110262
110638
  attempts = retryToken.getRetryCount();
110263
110639
  const delay = retryToken.getRetryDelay();
110264
110640
  totalRetryDelay += delay;
110265
- await new Promise((resolve5) => setTimeout(resolve5, delay));
110641
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
110266
110642
  }
110267
110643
  }
110268
110644
  } else {
@@ -115323,7 +115699,7 @@ var init_dist_es9 = __esm(() => {
115323
115699
  import { Buffer as Buffer3 } from "buffer";
115324
115700
  import { request } from "http";
115325
115701
  function httpRequest(options) {
115326
- return new Promise((resolve5, reject) => {
115702
+ return new Promise((resolve6, reject) => {
115327
115703
  const req = request({
115328
115704
  method: "GET",
115329
115705
  ...options,
@@ -115348,7 +115724,7 @@ function httpRequest(options) {
115348
115724
  chunks.push(chunk);
115349
115725
  });
115350
115726
  res.on("end", () => {
115351
- resolve5(Buffer3.concat(chunks));
115727
+ resolve6(Buffer3.concat(chunks));
115352
115728
  req.destroy();
115353
115729
  });
115354
115730
  });
@@ -115809,7 +116185,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
115809
116185
  try {
115810
116186
  return await toRetry();
115811
116187
  } catch (e2) {
115812
- await new Promise((resolve5) => setTimeout(resolve5, delayMs));
116188
+ await new Promise((resolve6) => setTimeout(resolve6, delayMs));
115813
116189
  }
115814
116190
  }
115815
116191
  return await toRetry();
@@ -121566,7 +121942,7 @@ var require_signin = __commonJS((exports) => {
121566
121942
  // node_modules/.bun/@aws-sdk+credential-provider-login@3.972.5/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
121567
121943
  import { createHash as createHash4, createPrivateKey, createPublicKey, sign } from "crypto";
121568
121944
  import { promises as fs2 } from "fs";
121569
- import { homedir as homedir15 } from "os";
121945
+ import { homedir as homedir16 } from "os";
121570
121946
  import { dirname as dirname16, join as join37 } from "path";
121571
121947
  var import_property_provider18, import_protocol_http11, import_shared_ini_file_loader6, LoginCredentialsFetcher;
121572
121948
  var init_LoginCredentialsFetcher = __esm(() => {
@@ -121727,7 +122103,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
121727
122103
  await fs2.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
121728
122104
  }
121729
122105
  getTokenFilePath() {
121730
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join37(homedir15(), ".aws", "login", "cache");
122106
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join37(homedir16(), ".aws", "login", "cache");
121731
122107
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
121732
122108
  const loginSessionSha256 = createHash4("sha256").update(loginSessionBytes).digest("hex");
121733
122109
  return join37(directory, `${loginSessionSha256}.json`);
@@ -122835,7 +123211,7 @@ async function* readabletoIterable(readStream) {
122835
123211
  streamEnded = true;
122836
123212
  });
122837
123213
  while (!generationEnded) {
122838
- const value = await new Promise((resolve5) => setTimeout(() => resolve5(records.shift()), 0));
123214
+ const value = await new Promise((resolve6) => setTimeout(() => resolve6(records.shift()), 0));
122839
123215
  if (value) {
122840
123216
  yield value;
122841
123217
  }
@@ -122911,14 +123287,14 @@ var readableStreamHasher = (hashCtor, readableStream) => {
122911
123287
  const hash = new hashCtor;
122912
123288
  const hashCalculator = new HashCalculator(hash);
122913
123289
  readableStream.pipe(hashCalculator);
122914
- return new Promise((resolve5, reject) => {
123290
+ return new Promise((resolve6, reject) => {
122915
123291
  readableStream.on("error", (err) => {
122916
123292
  hashCalculator.end();
122917
123293
  reject(err);
122918
123294
  });
122919
123295
  hashCalculator.on("error", reject);
122920
123296
  hashCalculator.on("finish", () => {
122921
- hash.digest().then(resolve5).catch(reject);
123297
+ hash.digest().then(resolve6).catch(reject);
122922
123298
  });
122923
123299
  });
122924
123300
  };
@@ -125571,7 +125947,7 @@ var getCircularReplacer = () => {
125571
125947
 
125572
125948
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/utils/sleep.js
125573
125949
  var sleep5 = (seconds) => {
125574
- return new Promise((resolve5) => setTimeout(resolve5, seconds * 1000));
125950
+ return new Promise((resolve6) => setTimeout(resolve6, seconds * 1000));
125575
125951
  };
125576
125952
 
125577
125953
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/waiter.js
@@ -125689,8 +126065,8 @@ var init_utils5 = () => {};
125689
126065
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/createWaiter.js
125690
126066
  var abortTimeout = (abortSignal) => {
125691
126067
  let onAbort;
125692
- const promise = new Promise((resolve5) => {
125693
- onAbort = () => resolve5({ state: WaiterState.ABORTED });
126068
+ const promise = new Promise((resolve6) => {
126069
+ onAbort = () => resolve6({ state: WaiterState.ABORTED });
125694
126070
  if (typeof abortSignal.addEventListener === "function") {
125695
126071
  abortSignal.addEventListener("abort", onAbort);
125696
126072
  } else {
@@ -136202,8 +136578,8 @@ var require_simple_parser2 = __commonJS((exports, module) => {
136202
136578
  }
136203
136579
  let promise;
136204
136580
  if (!callback) {
136205
- promise = new Promise((resolve5, reject) => {
136206
- callback = callbackPromise(resolve5, reject);
136581
+ promise = new Promise((resolve6, reject) => {
136582
+ callback = callbackPromise(resolve6, reject);
136207
136583
  });
136208
136584
  }
136209
136585
  options = options || {};
@@ -136289,13 +136665,13 @@ var require_simple_parser2 = __commonJS((exports, module) => {
136289
136665
  }
136290
136666
  return promise;
136291
136667
  };
136292
- function callbackPromise(resolve5, reject) {
136668
+ function callbackPromise(resolve6, reject) {
136293
136669
  return function(...args) {
136294
136670
  let err = args.shift();
136295
136671
  if (err) {
136296
136672
  reject(err);
136297
136673
  } else {
136298
- resolve5(...args);
136674
+ resolve6(...args);
136299
136675
  }
136300
136676
  };
136301
136677
  }
@@ -137100,11 +137476,11 @@ var require_dist = __commonJS((exports) => {
137100
137476
  var require_request = __commonJS((exports) => {
137101
137477
  var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P2, generator) {
137102
137478
  function adopt(value) {
137103
- return value instanceof P2 ? value : new P2(function(resolve5) {
137104
- resolve5(value);
137479
+ return value instanceof P2 ? value : new P2(function(resolve6) {
137480
+ resolve6(value);
137105
137481
  });
137106
137482
  }
137107
- return new (P2 || (P2 = Promise))(function(resolve5, reject) {
137483
+ return new (P2 || (P2 = Promise))(function(resolve6, reject) {
137108
137484
  function fulfilled(value) {
137109
137485
  try {
137110
137486
  step(generator.next(value));
@@ -137120,7 +137496,7 @@ var require_request = __commonJS((exports) => {
137120
137496
  }
137121
137497
  }
137122
137498
  function step(result) {
137123
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
137499
+ result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
137124
137500
  }
137125
137501
  step((generator = generator.apply(thisArg, _arguments || [])).next());
137126
137502
  });
@@ -137250,7 +137626,7 @@ var require_request = __commonJS((exports) => {
137250
137626
  }
137251
137627
  function sendWithRetry(url, init, retryScheduleInMs, nextInterval = 50, triesLeft = 2, fetchImpl = fetch, retryCount = 1) {
137252
137628
  return __awaiter2(this, undefined, undefined, function* () {
137253
- const sleep7 = (interval) => new Promise((resolve5) => setTimeout(resolve5, interval));
137629
+ const sleep7 = (interval) => new Promise((resolve6) => setTimeout(resolve6, interval));
137254
137630
  try {
137255
137631
  const response = yield fetchImpl(url, init);
137256
137632
  if (triesLeft <= 0 || response.status < 500) {
@@ -149112,14 +149488,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149112
149488
  prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
149113
149489
  actScopeDepth = prevActScopeDepth;
149114
149490
  }
149115
- function recursivelyFlushAsyncActWork(returnValue, resolve5, reject) {
149491
+ function recursivelyFlushAsyncActWork(returnValue, resolve6, reject) {
149116
149492
  var queue = ReactSharedInternals.actQueue;
149117
149493
  if (queue !== null)
149118
149494
  if (queue.length !== 0)
149119
149495
  try {
149120
149496
  flushActQueue(queue);
149121
149497
  enqueueTask(function() {
149122
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
149498
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
149123
149499
  });
149124
149500
  return;
149125
149501
  } catch (error3) {
@@ -149127,7 +149503,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149127
149503
  }
149128
149504
  else
149129
149505
  ReactSharedInternals.actQueue = null;
149130
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve5(returnValue);
149506
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve6(returnValue);
149131
149507
  }
149132
149508
  function flushActQueue(queue) {
149133
149509
  if (!isFlushing) {
@@ -149303,14 +149679,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149303
149679
  didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
149304
149680
  });
149305
149681
  return {
149306
- then: function(resolve5, reject) {
149682
+ then: function(resolve6, reject) {
149307
149683
  didAwaitActCall = true;
149308
149684
  thenable.then(function(returnValue) {
149309
149685
  popActScope(prevActQueue, prevActScopeDepth);
149310
149686
  if (prevActScopeDepth === 0) {
149311
149687
  try {
149312
149688
  flushActQueue(queue), enqueueTask(function() {
149313
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
149689
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
149314
149690
  });
149315
149691
  } catch (error$0) {
149316
149692
  ReactSharedInternals.thrownErrors.push(error$0);
@@ -149321,7 +149697,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149321
149697
  reject(_thrownError);
149322
149698
  }
149323
149699
  } else
149324
- resolve5(returnValue);
149700
+ resolve6(returnValue);
149325
149701
  }, function(error3) {
149326
149702
  popActScope(prevActQueue, prevActScopeDepth);
149327
149703
  0 < ReactSharedInternals.thrownErrors.length ? (error3 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error3)) : reject(error3);
@@ -149337,11 +149713,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149337
149713
  if (0 < ReactSharedInternals.thrownErrors.length)
149338
149714
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
149339
149715
  return {
149340
- then: function(resolve5, reject) {
149716
+ then: function(resolve6, reject) {
149341
149717
  didAwaitActCall = true;
149342
149718
  prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
149343
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve5, reject);
149344
- })) : resolve5(returnValue$jscomp$0);
149719
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve6, reject);
149720
+ })) : resolve6(returnValue$jscomp$0);
149345
149721
  }
149346
149722
  };
149347
149723
  };
@@ -160609,7 +160985,7 @@ var React, ReactDOM, REACT_ELEMENT_TYPE, REACT_PORTAL_TYPE, REACT_FRAGMENT_TYPE,
160609
160985
  $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))?(a.previousSibling.data="$~",$RB.push(a,b),2===$RB.length&&("number"!==typeof $RT?requestAnimationFrame($RV.bind(null,$RB)):(a=performance.now(),setTimeout($RV.bind(null,$RB),2300>a&&2E3<a?2300-a:$RT+300-a)))):b.parentNode.removeChild(b)};`, completeBoundaryScript1Partial = '$RC("', completeBoundaryWithStylesScript1FullPartial = `$RM=new Map;$RR=function(n,w,p){function u(q){this._p=null;q()}for(var r=new Map,t=document,h,b,e=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=[],k=0;b=e[k++];)"not all"===b.getAttribute("media")?v.push(b):("LINK"===b.tagName&&$RM.set(b.getAttribute("href"),b),r.set(b.dataset.precedence,h=b));e=0;b=[];var l,a;for(k=!0;;){if(k){var f=p[e++];if(!f){k=!1;e=0;continue}var c=!1,m=0;var d=f[m++];if(a=$RM.get(d)){var g=a._p;c=!0}else{a=t.createElement("link");a.href=d;a.rel=
160610
160986
  "stylesheet";for(a.dataset.precedence=l=f[m++];g=f[m++];)a.setAttribute(g,f[m++]);g=a._p=new Promise(function(q,x){a.onload=u.bind(a,q);a.onerror=u.bind(a,x)});$RM.set(d,a)}d=a.getAttribute("media");!g||d&&!matchMedia(d).matches||b.push(g);if(c)continue}else{a=v[e++];if(!a)break;l=a.getAttribute("data-precedence");a.removeAttribute("media")}c=r.get(l)||h;c===h&&(h=a);r.set(l,a);c?c.parentNode.insertBefore(a,c.nextSibling):(c=t.head,c.insertBefore(a,c.firstChild))}if(p=document.getElementById(n))p.previousSibling.data=
160611
160987
  "$~";Promise.all(b).then($RC.bind(null,n,w),$RX.bind(null,n,"CSS failed to load"))};$RR("`, completeBoundaryWithStylesScript1Partial = '$RR("', completeBoundaryScript2 = '","', completeBoundaryScript3a = '",', completeBoundaryScript3b = '"', completeBoundaryScriptEnd = ")</script>", clientRenderScriptFunctionOnly = '$RX=function(b,c,d,e,f){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),f&&(a.cstck=f),b._reactRetry&&b._reactRetry())};', clientRenderScript1Full = '$RX=function(b,c,d,e,f){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),f&&(a.cstck=f),b._reactRetry&&b._reactRetry())};;$RX("', clientRenderScript1Partial = '$RX("', clientRenderScript1A = '"', clientRenderErrorScriptArgInterstitial = ",", clientRenderScriptEnd = ")</script>", regexForJSStringsInInstructionScripts, regexForJSStringsInScripts, lateStyleTagResourceOpen1 = ' media="not all" data-precedence="', lateStyleTagResourceOpen2 = '" data-href="', lateStyleTagResourceOpen3 = '">', lateStyleTagTemplateClose = "</style>", currentlyRenderingBoundaryHasStylesToHoist = false, destinationHasCapacity = true, stylesheetFlushingQueue, styleTagResourceOpen1 = ' data-precedence="', styleTagResourceOpen2 = '" data-href="', spaceSeparator = " ", styleTagResourceOpen3 = '">', styleTagResourceClose = "</style>", completedShellIdAttributeStart = ' id="', arrayFirstOpenBracket = "[", arraySubsequentOpenBracket = ",[", arrayInterstitial = ",", arrayCloseBracket = "]", PENDING$1 = 0, PRELOADED = 1, PREAMBLE = 2, LATE = 3, regexForHrefInLinkHeaderURLContext, regexForLinkHeaderQuotedParamValueContext, bind, REACT_CLIENT_REFERENCE, emptyContextObject, rendererSigil, currentActiveSnapshot = null, didWarnAboutNoopUpdateForComponent, didWarnAboutDeprecatedWillMount, didWarnAboutUninitializedState, didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate, didWarnAboutLegacyLifecyclesAndDerivedState, didWarnAboutUndefinedDerivedState, didWarnAboutDirectlyAssigningPropsToState, didWarnAboutContextTypes$1, didWarnAboutChildContextTypes, didWarnAboutInvalidateContextType, didWarnOnInvalidCallback, classComponentUpdater, emptyTreeContext, clz32, log2, LN2, SuspenseException, suspendedThenable = null, objectIs, currentlyRenderingComponent = null, currentlyRenderingTask = null, currentlyRenderingRequest = null, currentlyRenderingKeyPath = null, firstWorkInProgressHook = null, workInProgressHook = null, isReRender = false, didScheduleRenderPhaseUpdate = false, localIdCounter = 0, actionStateCounter = 0, actionStateMatchingIndex = -1, thenableIndexCounter = 0, thenableState = null, renderPhaseUpdates = null, numberOfReRenders = 0, isInHookUserCodeInDev = false, currentHookNameInDev, HooksDispatcher, currentResumableState = null, currentTaskInDEV = null, DefaultAsyncDispatcher, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd, prefix, suffix, reentry = false, componentFrameCache, callComponent, callComponentInDEV, callRender, callRenderInDEV, callLazyInit, callLazyInitInDEV, lastResetTime = 0, getCurrentTime, localPerformance, localDate, CLIENT_RENDERED = 4, PENDING = 0, COMPLETED = 1, FLUSHED = 2, ABORTED = 3, ERRORED = 4, POSTPONED = 5, CLOSED = 14, currentRequest = null, didWarnAboutBadClass, didWarnAboutContextTypes, didWarnAboutContextTypeOnFunctionComponent, didWarnAboutGetDerivedStateOnFunctionComponent, didWarnAboutReassigningProps = false, didWarnAboutGenerators = false, didWarnAboutMaps = false, flushedByteSize = 0, flushingPartialBoundaries = false, isomorphicReactPackageVersion$jscomp$inline_766, $renderToReadableStream = function(children2, options) {
160612
- return new Promise(function(resolve5, reject) {
160988
+ return new Promise(function(resolve6, reject) {
160613
160989
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
160614
160990
  onAllReady = res;
160615
160991
  onFatalError = rej;
@@ -160639,7 +161015,7 @@ $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))
160639
161015
  }
160640
161016
  }, { highWaterMark: 2048 });
160641
161017
  stream.allReady = allReady;
160642
- resolve5(stream);
161018
+ resolve6(stream);
160643
161019
  }, function(error3) {
160644
161020
  allReady.catch(function() {});
160645
161021
  reject(error3);
@@ -167296,7 +167672,7 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167296
167672
  }
167297
167673
  return a4;
167298
167674
  }, __spreadProps = (a4, b7) => __defProps(a4, __getOwnPropDescs(b7)), __async = (__this, __arguments, generator) => {
167299
- return new Promise((resolve5, reject) => {
167675
+ return new Promise((resolve6, reject) => {
167300
167676
  var fulfilled = (value) => {
167301
167677
  try {
167302
167678
  step(generator.next(value));
@@ -167311,7 +167687,7 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167311
167687
  reject(e5);
167312
167688
  }
167313
167689
  };
167314
- var step = (x5) => x5.done ? resolve5(x5.value) : Promise.resolve(x5.value).then(fulfilled, rejected);
167690
+ var step = (x5) => x5.done ? resolve6(x5.value) : Promise.resolve(x5.value).then(fulfilled, rejected);
167315
167691
  step((generator = generator.apply(__this, __arguments)).next());
167316
167692
  });
167317
167693
  }, plainTextSelectors, modifiedHtml, defaults2, pretty = (str2, options = {}) => {
@@ -167333,10 +167709,10 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167333
167709
  }
167334
167710
  });
167335
167711
  stream.pipe(writable);
167336
- yield new Promise((resolve5, reject) => {
167712
+ yield new Promise((resolve6, reject) => {
167337
167713
  writable.on("error", reject);
167338
167714
  writable.on("close", () => {
167339
- resolve5();
167715
+ resolve6();
167340
167716
  });
167341
167717
  });
167342
167718
  }
@@ -167348,12 +167724,12 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167348
167724
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
167349
167725
  html2 = yield readStream(yield reactDOMServer.renderToReadableStream(suspendedElement));
167350
167726
  } else {
167351
- yield new Promise((resolve5, reject) => {
167727
+ yield new Promise((resolve6, reject) => {
167352
167728
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
167353
167729
  onAllReady() {
167354
167730
  return __async(this, null, function* () {
167355
167731
  html2 = yield readStream(stream);
167356
- resolve5();
167732
+ resolve6();
167357
167733
  });
167358
167734
  },
167359
167735
  onError(error3) {
@@ -170920,12 +171296,12 @@ var init_secrets_client = __esm(() => {
170920
171296
  // packages/core/src/wallet/storage/local-client.ts
170921
171297
  import { dirname as dirname17, join as join40 } from "path";
170922
171298
  import { existsSync as existsSync26, mkdirSync as mkdirSync17, readFileSync as readFileSync18 } from "fs";
170923
- import { homedir as homedir16 } from "os";
171299
+ import { homedir as homedir17 } from "os";
170924
171300
 
170925
171301
  class LocalWalletClient {
170926
171302
  baseDir;
170927
171303
  constructor(options = {}) {
170928
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir16();
171304
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir17();
170929
171305
  this.baseDir = options.baseDir || join40(envHome, ".assistants");
170930
171306
  }
170931
171307
  getWalletFilePath(assistantId) {
@@ -171794,12 +172170,12 @@ var init_secrets_client2 = __esm(() => {
171794
172170
  // packages/core/src/secrets/storage/local-client.ts
171795
172171
  import { dirname as dirname18, join as join41 } from "path";
171796
172172
  import { existsSync as existsSync27, mkdirSync as mkdirSync18, readFileSync as readFileSync19 } from "fs";
171797
- import { homedir as homedir17 } from "os";
172173
+ import { homedir as homedir18 } from "os";
171798
172174
 
171799
172175
  class LocalSecretsClient {
171800
172176
  baseDir;
171801
172177
  constructor(options = {}) {
171802
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir17();
172178
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir18();
171803
172179
  this.baseDir = options.baseDir || join41(envHome, ".assistants");
171804
172180
  }
171805
172181
  getScopeFilePath(scope, assistantId) {
@@ -172402,11 +172778,11 @@ var init_secrets = __esm(() => {
172402
172778
 
172403
172779
  // packages/core/src/messages/storage/local-storage.ts
172404
172780
  import { join as join42 } from "path";
172405
- import { homedir as homedir18 } from "os";
172781
+ import { homedir as homedir19 } from "os";
172406
172782
  import { mkdir as mkdir13, readdir as readdir5, rm as rm5, open as open4, readFile as readFile16 } from "fs/promises";
172407
172783
  function getMessagesBasePath() {
172408
172784
  const envOverride = process.env.ASSISTANTS_DIR;
172409
- const home = envOverride && envOverride.trim() ? envOverride : homedir18();
172785
+ const home = envOverride && envOverride.trim() ? envOverride : homedir19();
172410
172786
  return join42(home, ".assistants", "messages");
172411
172787
  }
172412
172788
 
@@ -173704,11 +174080,11 @@ var init_messages5 = __esm(async () => {
173704
174080
 
173705
174081
  // packages/core/src/webhooks/storage/local-storage.ts
173706
174082
  import { join as join44 } from "path";
173707
- import { homedir as homedir19 } from "os";
174083
+ import { homedir as homedir20 } from "os";
173708
174084
  import { mkdir as mkdir14, readdir as readdir6, rm as rm6 } from "fs/promises";
173709
174085
  function getWebhooksBasePath() {
173710
174086
  const envOverride = process.env.ASSISTANTS_DIR;
173711
- const home = envOverride && envOverride.trim() ? envOverride : homedir19();
174087
+ const home = envOverride && envOverride.trim() ? envOverride : homedir20();
173712
174088
  return join44(home, ".assistants", "webhooks");
173713
174089
  }
173714
174090
 
@@ -176586,8 +176962,8 @@ class ChannelAgentPool {
176586
176962
  this.clientFactory = options?.clientFactory;
176587
176963
  }
176588
176964
  async triggerResponses(channelName, personName, message, channelMembers, excludeAssistantId) {
176589
- return new Promise((resolve5, reject) => {
176590
- this.queue.push({ channelName, personName, message, channelMembers, excludeAssistantId, resolve: resolve5, reject });
176965
+ return new Promise((resolve6, reject) => {
176966
+ this.queue.push({ channelName, personName, message, channelMembers, excludeAssistantId, resolve: resolve6, reject });
176591
176967
  this.drainQueue();
176592
176968
  });
176593
176969
  }
@@ -178087,7 +178463,12 @@ class TwilioClient {
178087
178463
  body.append("To", params.to);
178088
178464
  body.append("From", params.from);
178089
178465
  if (params.url) {
178090
- body.append("Url", params.url);
178466
+ let url = params.url;
178467
+ if (params.firstMessage) {
178468
+ const sep2 = url.includes("?") ? "&" : "?";
178469
+ url += `${sep2}firstMessage=${encodeURIComponent(params.firstMessage)}`;
178470
+ }
178471
+ body.append("Url", url);
178091
178472
  } else if (params.twiml) {
178092
178473
  body.append("Twiml", params.twiml);
178093
178474
  }
@@ -178269,7 +178650,8 @@ class CallManager {
178269
178650
  connecting: ["ringing", "active", "ending"],
178270
178651
  ringing: ["bridging", "active", "ending"],
178271
178652
  bridging: ["active", "ending"],
178272
- active: ["ending"],
178653
+ active: ["on-hold", "ending"],
178654
+ "on-hold": ["active", "ending"],
178273
178655
  ending: []
178274
178656
  };
178275
178657
  if (!validTransitions[call.state].includes(state)) {
@@ -178517,7 +178899,7 @@ class BridgeConnection {
178517
178899
  }
178518
178900
  async connect() {
178519
178901
  const url = `${ELEVENLABS_WS_BASE}?agent_id=${this.config.elevenLabsAgentId}`;
178520
- return new Promise((resolve5, reject) => {
178902
+ return new Promise((resolve6, reject) => {
178521
178903
  try {
178522
178904
  this.elevenLabsWs = new WebSocket(url, {
178523
178905
  headers: {
@@ -178526,7 +178908,7 @@ class BridgeConnection {
178526
178908
  });
178527
178909
  this.elevenLabsWs.onopen = () => {
178528
178910
  this.state = "active";
178529
- resolve5();
178911
+ resolve6();
178530
178912
  };
178531
178913
  this.elevenLabsWs.onmessage = (event) => {
178532
178914
  this.handleElevenLabsMessage(event.data);
@@ -178613,6 +178995,129 @@ var init_voice_bridge = __esm(() => {
178613
178995
  init_src2();
178614
178996
  });
178615
178997
 
178998
+ // packages/core/src/telephony/stream-server.ts
178999
+ function startStreamServer(config) {
179000
+ const port = config.port || DEFAULT_PORT;
179001
+ const host = config.host || "0.0.0.0";
179002
+ const sessions = new Map;
179003
+ const server = Bun.serve({
179004
+ port,
179005
+ hostname: host,
179006
+ fetch(req, server2) {
179007
+ const url = new URL(req.url);
179008
+ if (url.pathname === "/stream" || url.pathname === "/") {
179009
+ const upgraded = server2.upgrade(req);
179010
+ if (!upgraded) {
179011
+ return new Response("WebSocket upgrade failed", { status: 400 });
179012
+ }
179013
+ return;
179014
+ }
179015
+ if (url.pathname === "/health") {
179016
+ return new Response("ok");
179017
+ }
179018
+ return new Response("Not Found", { status: 404 });
179019
+ },
179020
+ websocket: {
179021
+ open(ws3) {
179022
+ sessions.set(ws3, { callSid: "", streamSid: "", bridgeId: null });
179023
+ },
179024
+ async message(ws3, data) {
179025
+ try {
179026
+ const text = typeof data === "string" ? data : new TextDecoder().decode(data);
179027
+ const msg = JSON.parse(text);
179028
+ const session = sessions.get(ws3);
179029
+ if (!session)
179030
+ return;
179031
+ switch (msg.event) {
179032
+ case "connected":
179033
+ break;
179034
+ case "start": {
179035
+ const startData = msg.start;
179036
+ if (!startData)
179037
+ break;
179038
+ const callSid = startData.callSid;
179039
+ const streamSid = startData.streamSid;
179040
+ session.callSid = callSid;
179041
+ session.streamSid = streamSid;
179042
+ config.callManager.setStreamSid(callSid, streamSid);
179043
+ const sendToTwilio = (message) => {
179044
+ try {
179045
+ ws3.send(message);
179046
+ } catch {}
179047
+ };
179048
+ try {
179049
+ const bridgeId = await config.voiceBridge.createBridge(callSid, streamSid, sendToTwilio);
179050
+ session.bridgeId = bridgeId;
179051
+ config.callManager.setBridgeId(callSid, bridgeId);
179052
+ config.callManager.updateState(callSid, "active");
179053
+ const callLog = config.store.getCallLogBySid(callSid);
179054
+ if (callLog) {
179055
+ config.store.updateCallLog(callLog.id, {
179056
+ status: "in-progress",
179057
+ startedAt: new Date().toISOString()
179058
+ });
179059
+ }
179060
+ } catch (error3) {
179061
+ console.error(`[StreamServer] Failed to create bridge for ${callSid}:`, error3);
179062
+ ws3.close();
179063
+ }
179064
+ break;
179065
+ }
179066
+ case "media": {
179067
+ if (!session.bridgeId)
179068
+ break;
179069
+ config.callManager.touchCall(session.callSid);
179070
+ config.voiceBridge.handleTwilioMedia(session.bridgeId, msg);
179071
+ break;
179072
+ }
179073
+ case "stop": {
179074
+ if (session.bridgeId) {
179075
+ config.voiceBridge.closeBridge(session.bridgeId);
179076
+ }
179077
+ const call = config.callManager.endCall(session.callSid);
179078
+ if (call) {
179079
+ const callLog = config.store.getCallLogBySid(session.callSid);
179080
+ if (callLog) {
179081
+ const duration = Math.floor((Date.now() - call.startedAt) / 1000);
179082
+ config.store.updateCallLog(callLog.id, {
179083
+ status: "completed",
179084
+ endedAt: new Date().toISOString(),
179085
+ duration
179086
+ });
179087
+ }
179088
+ }
179089
+ sessions.delete(ws3);
179090
+ break;
179091
+ }
179092
+ }
179093
+ } catch (error3) {
179094
+ console.error("[StreamServer] Error handling message:", error3);
179095
+ }
179096
+ },
179097
+ close(ws3) {
179098
+ const session = sessions.get(ws3);
179099
+ if (session) {
179100
+ if (session.bridgeId) {
179101
+ config.voiceBridge.closeBridge(session.bridgeId);
179102
+ }
179103
+ if (session.callSid) {
179104
+ config.callManager.endCall(session.callSid);
179105
+ }
179106
+ sessions.delete(ws3);
179107
+ }
179108
+ }
179109
+ }
179110
+ });
179111
+ console.log(`[StreamServer] Listening on ${host}:${port}`);
179112
+ return {
179113
+ stop: () => {
179114
+ server.stop();
179115
+ },
179116
+ port
179117
+ };
179118
+ }
179119
+ var DEFAULT_PORT = 8765;
179120
+
178616
179121
  // packages/core/src/telephony/manager.ts
178617
179122
  class TelephonyManager {
178618
179123
  assistantId;
@@ -178622,6 +179127,7 @@ class TelephonyManager {
178622
179127
  twilioClient = null;
178623
179128
  callManager;
178624
179129
  voiceBridge = null;
179130
+ streamServer = null;
178625
179131
  constructor(options) {
178626
179132
  this.assistantId = options.assistantId;
178627
179133
  this.assistantName = options.assistantName;
@@ -178728,7 +179234,7 @@ class TelephonyManager {
178728
179234
  id: log3.id
178729
179235
  };
178730
179236
  }
178731
- async makeCall(to3, from) {
179237
+ async makeCall(to3, from, firstMessage) {
178732
179238
  if (!this.twilioClient) {
178733
179239
  return {
178734
179240
  success: false,
@@ -178754,7 +179260,8 @@ class TelephonyManager {
178754
179260
  from: fromNumber,
178755
179261
  url: `${webhookUrl}/api/v1/telephony/webhooks/voice`,
178756
179262
  statusCallback: `${webhookUrl}/api/v1/telephony/webhooks/voice-status`,
178757
- record: this.config.voice?.recordCalls
179263
+ record: this.config.voice?.recordCalls,
179264
+ firstMessage
178758
179265
  });
178759
179266
  if (!result.success) {
178760
179267
  return { success: false, message: `Failed to make call: ${result.error}` };
@@ -178782,6 +179289,120 @@ class TelephonyManager {
178782
179289
  id: log3.id
178783
179290
  };
178784
179291
  }
179292
+ async holdCall(callSid) {
179293
+ if (!this.twilioClient) {
179294
+ return { success: false, message: "Twilio is not configured." };
179295
+ }
179296
+ const call = callSid ? this.callManager.getCall(callSid) : this.getMostRecentActiveCall();
179297
+ if (!call) {
179298
+ return { success: false, message: callSid ? `Call ${callSid} not found.` : "No active call." };
179299
+ }
179300
+ if (call.state === "on-hold") {
179301
+ return { success: false, message: "Call is already on hold." };
179302
+ }
179303
+ if (call.bridgeId && this.voiceBridge) {
179304
+ this.voiceBridge.closeBridge(call.bridgeId);
179305
+ }
179306
+ const holdTwiml = `<?xml version="1.0" encoding="UTF-8"?><Response><Say>Please hold.</Say><Play loop="0">http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-B8-V1.mp3</Play></Response>`;
179307
+ const result = await this.twilioClient.updateCall(call.callSid, { twiml: holdTwiml });
179308
+ if (!result.success) {
179309
+ return { success: false, message: `Failed to hold call: ${result.error}` };
179310
+ }
179311
+ this.callManager.updateState(call.callSid, "on-hold");
179312
+ return { success: true, message: `Call ${call.callSid} is now on hold.`, callSid: call.callSid };
179313
+ }
179314
+ async resumeCall(callSid) {
179315
+ if (!this.twilioClient) {
179316
+ return { success: false, message: "Twilio is not configured." };
179317
+ }
179318
+ const call = callSid ? this.callManager.getCall(callSid) : this.getMostRecentHeldCall();
179319
+ if (!call) {
179320
+ return { success: false, message: callSid ? `Call ${callSid} not found.` : "No held call." };
179321
+ }
179322
+ if (call.state !== "on-hold") {
179323
+ return { success: false, message: "Call is not on hold." };
179324
+ }
179325
+ const webhookUrl = this.config.webhookUrl || process.env.TELEPHONY_WEBHOOK_URL;
179326
+ if (!webhookUrl) {
179327
+ return { success: false, message: "No webhook URL configured." };
179328
+ }
179329
+ const result = await this.twilioClient.updateCall(call.callSid, {
179330
+ url: `${webhookUrl}/api/v1/telephony/webhooks/voice`
179331
+ });
179332
+ if (!result.success) {
179333
+ return { success: false, message: `Failed to resume call: ${result.error}` };
179334
+ }
179335
+ this.callManager.updateState(call.callSid, "active");
179336
+ return { success: true, message: `Call ${call.callSid} resumed.`, callSid: call.callSid };
179337
+ }
179338
+ async endCall(callSid) {
179339
+ if (!this.twilioClient) {
179340
+ return { success: false, message: "Twilio is not configured." };
179341
+ }
179342
+ const call = callSid ? this.callManager.getCall(callSid) : this.getMostRecentActiveCall() || this.getMostRecentHeldCall();
179343
+ if (!call) {
179344
+ return { success: false, message: callSid ? `Call ${callSid} not found.` : "No active call." };
179345
+ }
179346
+ if (call.bridgeId && this.voiceBridge) {
179347
+ this.voiceBridge.closeBridge(call.bridgeId);
179348
+ }
179349
+ const result = await this.twilioClient.updateCall(call.callSid, { status: "completed" });
179350
+ if (!result.success) {
179351
+ return { success: false, message: `Failed to end call: ${result.error}` };
179352
+ }
179353
+ const endedCall = this.callManager.endCall(call.callSid);
179354
+ if (endedCall) {
179355
+ const callLog = this.store.getCallLogBySid(call.callSid);
179356
+ if (callLog) {
179357
+ const duration = Math.floor((Date.now() - endedCall.startedAt) / 1000);
179358
+ this.store.updateCallLog(callLog.id, {
179359
+ status: "completed",
179360
+ endedAt: new Date().toISOString(),
179361
+ duration
179362
+ });
179363
+ }
179364
+ }
179365
+ return { success: true, message: `Call ${call.callSid} ended.`, callSid: call.callSid };
179366
+ }
179367
+ getActiveCalls() {
179368
+ return this.callManager.getActiveCalls().map((call) => ({
179369
+ ...call,
179370
+ durationSeconds: Math.floor((Date.now() - call.startedAt) / 1000)
179371
+ }));
179372
+ }
179373
+ getMostRecentActiveCall() {
179374
+ const calls = this.callManager.getActiveCalls().filter((c6) => c6.state === "active" || c6.state === "bridging" || c6.state === "connecting" || c6.state === "ringing");
179375
+ if (calls.length === 0)
179376
+ return null;
179377
+ return calls.reduce((latest, c6) => c6.startedAt > latest.startedAt ? c6 : latest);
179378
+ }
179379
+ getMostRecentHeldCall() {
179380
+ const calls = this.callManager.getActiveCalls().filter((c6) => c6.state === "on-hold");
179381
+ if (calls.length === 0)
179382
+ return null;
179383
+ return calls.reduce((latest, c6) => c6.startedAt > latest.startedAt ? c6 : latest);
179384
+ }
179385
+ startStreamServer(port) {
179386
+ if (this.streamServer) {
179387
+ return { port: this.streamServer.port };
179388
+ }
179389
+ if (!this.voiceBridge) {
179390
+ throw new Error("Voice bridge is not configured. Set ELEVENLABS_API_KEY and ELEVENLABS_AGENT_ID.");
179391
+ }
179392
+ this.streamServer = startStreamServer({
179393
+ port: port || 8765,
179394
+ voiceBridge: this.voiceBridge,
179395
+ callManager: this.callManager,
179396
+ store: this.store
179397
+ });
179398
+ return { port: this.streamServer.port };
179399
+ }
179400
+ stopStreamServer() {
179401
+ if (this.streamServer) {
179402
+ this.streamServer.stop();
179403
+ this.streamServer = null;
179404
+ }
179405
+ }
178785
179406
  getCallHistory(options) {
178786
179407
  const scope = options?.scope ?? "assistant";
178787
179408
  return this.store.listCallLogs({
@@ -178953,6 +179574,7 @@ class TelephonyManager {
178953
179574
  return this.store.cleanup(maxAgeDays, maxCallLogs, maxSmsLogs);
178954
179575
  }
178955
179576
  close() {
179577
+ this.stopStreamServer();
178956
179578
  this.callManager.endAllCalls();
178957
179579
  this.voiceBridge?.closeAll();
178958
179580
  this.store.close();
@@ -178990,7 +179612,7 @@ var init_manager8 = __esm(async () => {
178990
179612
  });
178991
179613
 
178992
179614
  // packages/core/src/telephony/tools.ts
178993
- function createTelephonyToolExecutors(getTelephonyManager) {
179615
+ function createTelephonyToolExecutors(getTelephonyManager, getContactsManager) {
178994
179616
  return {
178995
179617
  telephony_send_sms: async (input) => {
178996
179618
  const manager = getTelephonyManager();
@@ -179027,11 +179649,27 @@ function createTelephonyToolExecutors(getTelephonyManager) {
179027
179649
  if (!manager) {
179028
179650
  return "Error: Telephony is not enabled. Set telephony.enabled: true in config.";
179029
179651
  }
179030
- const to3 = String(input.to || "").trim();
179652
+ let to3 = String(input.to || "").trim();
179653
+ const contactName = String(input.contact_name || "").trim();
179654
+ if (!to3 && contactName && getContactsManager) {
179655
+ const contacts = getContactsManager();
179656
+ if (contacts) {
179657
+ const results = contacts.searchContacts(contactName);
179658
+ if (results.length === 0) {
179659
+ return `Error: No contact found matching "${contactName}".`;
179660
+ }
179661
+ const match = results[0];
179662
+ if (!match.primaryPhone) {
179663
+ return `Error: Contact "${match.name}" has no phone number.`;
179664
+ }
179665
+ to3 = match.primaryPhone;
179666
+ }
179667
+ }
179031
179668
  if (!to3)
179032
- return "Error: Phone number (to) is required.";
179669
+ return "Error: Phone number (to) or contact_name is required.";
179033
179670
  const from = input.from ? String(input.from).trim() : undefined;
179034
- const result = await manager.makeCall(to3, from);
179671
+ const firstMessage = input.first_message ? String(input.first_message).trim() : undefined;
179672
+ const result = await manager.makeCall(to3, from, firstMessage);
179035
179673
  return result.success ? result.message : `Error: ${result.message}`;
179036
179674
  },
179037
179675
  telephony_call_history: async (input) => {
@@ -179180,17 +179818,68 @@ function createTelephonyToolExecutors(getTelephonyManager) {
179180
179818
  lines.push(`Recent calls: ${status.recentCalls}`);
179181
179819
  lines.push(`Recent messages: ${status.recentMessages}`);
179182
179820
  return lines.join(`
179821
+ `);
179822
+ },
179823
+ telephony_hold: async (input) => {
179824
+ const manager = getTelephonyManager();
179825
+ if (!manager) {
179826
+ return "Error: Telephony is not enabled.";
179827
+ }
179828
+ const callSid = input.call_sid ? String(input.call_sid).trim() : undefined;
179829
+ const result = await manager.holdCall(callSid);
179830
+ return result.success ? result.message : `Error: ${result.message}`;
179831
+ },
179832
+ telephony_resume: async (input) => {
179833
+ const manager = getTelephonyManager();
179834
+ if (!manager) {
179835
+ return "Error: Telephony is not enabled.";
179836
+ }
179837
+ const callSid = input.call_sid ? String(input.call_sid).trim() : undefined;
179838
+ const result = await manager.resumeCall(callSid);
179839
+ return result.success ? result.message : `Error: ${result.message}`;
179840
+ },
179841
+ telephony_end_call: async (input) => {
179842
+ const manager = getTelephonyManager();
179843
+ if (!manager) {
179844
+ return "Error: Telephony is not enabled.";
179845
+ }
179846
+ const callSid = input.call_sid ? String(input.call_sid).trim() : undefined;
179847
+ const result = await manager.endCall(callSid);
179848
+ return result.success ? result.message : `Error: ${result.message}`;
179849
+ },
179850
+ telephony_active_calls: async () => {
179851
+ const manager = getTelephonyManager();
179852
+ if (!manager) {
179853
+ return "Error: Telephony is not enabled.";
179854
+ }
179855
+ const calls = manager.getActiveCalls();
179856
+ if (calls.length === 0) {
179857
+ return "No active calls.";
179858
+ }
179859
+ const lines = [];
179860
+ lines.push(`## Active Calls (${calls.length})`);
179861
+ lines.push("");
179862
+ for (const call of calls) {
179863
+ const dir = call.direction === "inbound" ? "IN" : "OUT";
179864
+ const mins = Math.floor(call.durationSeconds / 60);
179865
+ const secs = call.durationSeconds % 60;
179866
+ const duration = `${mins}m ${secs}s`;
179867
+ lines.push(`[${dir}] ${call.fromNumber} \u2192 ${call.toNumber} | ${call.state} | ${duration}`);
179868
+ lines.push(` SID: ${call.callSid}`);
179869
+ lines.push("");
179870
+ }
179871
+ return lines.join(`
179183
179872
  `);
179184
179873
  }
179185
179874
  };
179186
179875
  }
179187
- function registerTelephonyTools(registry, getTelephonyManager) {
179188
- const executors = createTelephonyToolExecutors(getTelephonyManager);
179876
+ function registerTelephonyTools(registry, getTelephonyManager, getContactsManager) {
179877
+ const executors = createTelephonyToolExecutors(getTelephonyManager, getContactsManager);
179189
179878
  for (const tool of telephonyTools) {
179190
179879
  registry.register(tool, executors[tool.name]);
179191
179880
  }
179192
179881
  }
179193
- var telephonySendSmsTool, telephonySendWhatsappTool, telephonyCallTool, telephonyCallHistoryTool, telephonySmsHistoryTool, telephonyPhoneNumbersTool, telephonyRoutingRulesTool, telephonyStatusTool, telephonyTools;
179882
+ var telephonySendSmsTool, telephonySendWhatsappTool, telephonyCallTool, telephonyCallHistoryTool, telephonySmsHistoryTool, telephonyPhoneNumbersTool, telephonyRoutingRulesTool, telephonyStatusTool, telephonyHoldTool, telephonyResumeTool, telephonyEndCallTool, telephonyActiveCallsTool, telephonyTools;
179194
179883
  var init_tools12 = __esm(() => {
179195
179884
  telephonySendSmsTool = {
179196
179885
  name: "telephony_send_sms",
@@ -179238,20 +179927,28 @@ var init_tools12 = __esm(() => {
179238
179927
  };
179239
179928
  telephonyCallTool = {
179240
179929
  name: "telephony_call",
179241
- description: "Initiate an outbound voice call. The call will be connected to the AI voice agent.",
179930
+ description: "Initiate an outbound voice call. The call will be connected to the AI voice agent. You can provide a phone number directly or a contact name to look up.",
179242
179931
  parameters: {
179243
179932
  type: "object",
179244
179933
  properties: {
179245
179934
  to: {
179246
179935
  type: "string",
179247
- description: 'Phone number to call in E.164 format (e.g., "+15551234567")'
179936
+ description: 'Phone number to call in E.164 format (e.g., "+15551234567"). Required if contact_name is not provided.'
179937
+ },
179938
+ contact_name: {
179939
+ type: "string",
179940
+ description: "Name of a contact to call. Their phone number will be looked up from the contacts list."
179248
179941
  },
179249
179942
  from: {
179250
179943
  type: "string",
179251
179944
  description: "Caller phone number (optional, uses default if not set)"
179945
+ },
179946
+ first_message: {
179947
+ type: "string",
179948
+ description: "First message the AI agent should say when the call connects (optional)"
179252
179949
  }
179253
179950
  },
179254
- required: ["to"]
179951
+ required: []
179255
179952
  }
179256
179953
  };
179257
179954
  telephonyCallHistoryTool = {
@@ -179341,6 +180038,57 @@ var init_tools12 = __esm(() => {
179341
180038
  required: []
179342
180039
  }
179343
180040
  };
180041
+ telephonyHoldTool = {
180042
+ name: "telephony_hold",
180043
+ description: "Put the current active call on hold. The caller will hear hold music.",
180044
+ parameters: {
180045
+ type: "object",
180046
+ properties: {
180047
+ call_sid: {
180048
+ type: "string",
180049
+ description: "Call SID to hold (optional, defaults to most recent active call)"
180050
+ }
180051
+ },
180052
+ required: []
180053
+ }
180054
+ };
180055
+ telephonyResumeTool = {
180056
+ name: "telephony_resume",
180057
+ description: "Resume a call that is on hold. Reconnects to the AI voice agent.",
180058
+ parameters: {
180059
+ type: "object",
180060
+ properties: {
180061
+ call_sid: {
180062
+ type: "string",
180063
+ description: "Call SID to resume (optional, defaults to most recent held call)"
180064
+ }
180065
+ },
180066
+ required: []
180067
+ }
180068
+ };
180069
+ telephonyEndCallTool = {
180070
+ name: "telephony_end_call",
180071
+ description: "End/hang up the current call.",
180072
+ parameters: {
180073
+ type: "object",
180074
+ properties: {
180075
+ call_sid: {
180076
+ type: "string",
180077
+ description: "Call SID to end (optional, defaults to most recent active or held call)"
180078
+ }
180079
+ },
180080
+ required: []
180081
+ }
180082
+ };
180083
+ telephonyActiveCallsTool = {
180084
+ name: "telephony_active_calls",
180085
+ description: "List all currently active calls with their state and duration.",
180086
+ parameters: {
180087
+ type: "object",
180088
+ properties: {},
180089
+ required: []
180090
+ }
180091
+ };
179344
180092
  telephonyTools = [
179345
180093
  telephonySendSmsTool,
179346
180094
  telephonySendWhatsappTool,
@@ -179349,7 +180097,11 @@ var init_tools12 = __esm(() => {
179349
180097
  telephonySmsHistoryTool,
179350
180098
  telephonyPhoneNumbersTool,
179351
180099
  telephonyRoutingRulesTool,
179352
- telephonyStatusTool
180100
+ telephonyStatusTool,
180101
+ telephonyHoldTool,
180102
+ telephonyResumeTool,
180103
+ telephonyEndCallTool,
180104
+ telephonyActiveCallsTool
179353
180105
  ];
179354
180106
  });
179355
180107
 
@@ -181620,13 +182372,13 @@ var init_contacts = __esm(async () => {
181620
182372
 
181621
182373
  // packages/core/src/sessions/store.ts
181622
182374
  import { join as join52 } from "path";
181623
- import { homedir as homedir20 } from "os";
182375
+ import { homedir as homedir21 } from "os";
181624
182376
  import { existsSync as existsSync35, mkdirSync as mkdirSync23, writeFileSync as writeFileSync15, readFileSync as readFileSync20, readdirSync as readdirSync10, unlinkSync as unlinkSync5 } from "fs";
181625
182377
 
181626
182378
  class SessionStore {
181627
182379
  basePath;
181628
182380
  constructor(basePath) {
181629
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir20();
182381
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir21();
181630
182382
  this.basePath = basePath || join52(envHome, ".assistants", "sessions");
181631
182383
  this.ensureDir();
181632
182384
  }
@@ -187484,12 +188236,12 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
187484
188236
  return resultWithId;
187485
188237
  }
187486
188238
  createTimeout(ms2, runner, subassistantId) {
187487
- return new Promise((resolve5) => {
188239
+ return new Promise((resolve6) => {
187488
188240
  const timerId = setTimeout(() => {
187489
188241
  this.activeTimeouts.delete(subassistantId);
187490
188242
  this.activeRunners.delete(subassistantId);
187491
188243
  runner.stop();
187492
- resolve5({
188244
+ resolve6({
187493
188245
  success: false,
187494
188246
  error: `Subassistant timed out after ${Math.round(ms2 / 1000)} seconds`,
187495
188247
  turns: 0,
@@ -187508,7 +188260,7 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
187508
188260
  }
187509
188261
  }
187510
188262
  sleep(ms2) {
187511
- return new Promise((resolve5) => setTimeout(resolve5, ms2));
188263
+ return new Promise((resolve6) => setTimeout(resolve6, ms2));
187512
188264
  }
187513
188265
  }
187514
188266
  var DEFAULT_MAX_DEPTH = 3, DEFAULT_MAX_CONCURRENT = 5, DEFAULT_MAX_TURNS = 10, MAX_ALLOWED_TURNS = 25, DEFAULT_TIMEOUT_MS3 = 120000, DEFAULT_SUBASSISTANT_TOOLS, FORBIDDEN_SUBASSISTANT_TOOLS;
@@ -187859,7 +188611,7 @@ var init_resolver = __esm(() => {
187859
188611
  // packages/core/src/capabilities/storage.ts
187860
188612
  import { existsSync as existsSync38, mkdirSync as mkdirSync26, readFileSync as readFileSync21, writeFileSync as writeFileSync16 } from "fs";
187861
188613
  import { join as join55, dirname as dirname26 } from "path";
187862
- import { homedir as homedir21 } from "os";
188614
+ import { homedir as homedir22 } from "os";
187863
188615
 
187864
188616
  class CapabilityStorage {
187865
188617
  config;
@@ -187874,7 +188626,7 @@ class CapabilityStorage {
187874
188626
  if (this.config.storagePath) {
187875
188627
  return this.config.storagePath;
187876
188628
  }
187877
- const home = process.env.HOME || process.env.USERPROFILE || homedir21();
188629
+ const home = process.env.HOME || process.env.USERPROFILE || homedir22();
187878
188630
  return join55(home, ".assistants", "capabilities", "store.json");
187879
188631
  }
187880
188632
  load() {
@@ -188379,6 +189131,7 @@ var init_loop = __esm(async () => {
188379
189131
  init_filesystem(),
188380
189132
  init_feedback(),
188381
189133
  init_scheduler(),
189134
+ init_audio2(),
188382
189135
  init_skills(),
188383
189136
  init_subagent(),
188384
189137
  init_executor2(),
@@ -188635,6 +189388,7 @@ var init_loop = __esm(async () => {
188635
189388
  FilesystemTools.registerAll(this.toolRegistry, this.sessionId);
188636
189389
  WebTools.registerAll(this.toolRegistry);
188637
189390
  ImageTools.registerAll(this.toolRegistry);
189391
+ AudioTools.registerAll(this.toolRegistry);
188638
189392
  this.toolRegistry.register(SkillTool.tool, SkillTool.executor);
188639
189393
  const skillListTool = createSkillListTool(() => this.skillLoader);
188640
189394
  this.toolRegistry.register(skillListTool.tool, skillListTool.executor);
@@ -188718,7 +189472,13 @@ var init_loop = __esm(async () => {
188718
189472
  const assistantId = assistant?.id || this.sessionId;
188719
189473
  const assistantName = assistant?.name || "assistant";
188720
189474
  this.telephonyManager = createTelephonyManager(assistantId, assistantName, this.config.telephony);
188721
- registerTelephonyTools(this.toolRegistry, () => this.telephonyManager);
189475
+ registerTelephonyTools(this.toolRegistry, () => this.telephonyManager, () => this.contactsManager);
189476
+ if (this.telephonyManager.getVoiceBridge()) {
189477
+ try {
189478
+ const { port } = this.telephonyManager.startStreamServer();
189479
+ console.log(`[Telephony] Stream server started on port ${port}`);
189480
+ } catch {}
189481
+ }
188722
189482
  }
188723
189483
  if (this.config?.orders?.enabled) {
188724
189484
  const assistant = this.assistantManager?.getActive();
@@ -189225,8 +189985,8 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
189225
189985
  this.emit({ type: "text", content: `
189226
189986
  [Agent paused - budget exceeded. Use /budgets resume to continue.]
189227
189987
  ` });
189228
- await new Promise((resolve5) => {
189229
- this.pauseResolve = resolve5;
189988
+ await new Promise((resolve6) => {
189989
+ this.pauseResolve = resolve6;
189230
189990
  });
189231
189991
  this.pauseResolve = null;
189232
189992
  if (this.shouldStop)
@@ -190606,7 +191366,7 @@ ${effects.message}
190606
191366
  const delay = this.energyEffects?.processingDelayMs ?? 0;
190607
191367
  if (delay <= 0)
190608
191368
  return;
190609
- await new Promise((resolve5) => setTimeout(resolve5, delay));
191369
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
190610
191370
  }
190611
191371
  applyEnergyPersonality(systemPrompt) {
190612
191372
  if (!systemPrompt)
@@ -191384,7 +192144,7 @@ class StatsTracker {
191384
192144
 
191385
192145
  // packages/core/src/tools/connector-index.ts
191386
192146
  import { join as join57, dirname as dirname27 } from "path";
191387
- import { homedir as homedir22 } from "os";
192147
+ import { homedir as homedir23 } from "os";
191388
192148
  import { existsSync as existsSync39, mkdirSync as mkdirSync27, writeFileSync as writeFileSync17, readFileSync as readFileSync22 } from "fs";
191389
192149
  var TAG_KEYWORDS, INDEX_VERSION = 1, INDEX_TTL_MS, ConnectorIndex;
191390
192150
  var init_connector_index = __esm(() => {
@@ -191419,7 +192179,7 @@ var init_connector_index = __esm(() => {
191419
192179
  }
191420
192180
  getHomeDir() {
191421
192181
  const envHome = process.env.HOME || process.env.USERPROFILE;
191422
- return envHome && envHome.trim().length > 0 ? envHome : homedir22();
192182
+ return envHome && envHome.trim().length > 0 ? envHome : homedir23();
191423
192183
  }
191424
192184
  getCachePath() {
191425
192185
  return join57(this.getHomeDir(), ".assistants", "cache", "connector-index.json");
@@ -192374,9 +193134,13 @@ __export(exports_src3, {
192374
193134
  telephonySendWhatsappTool: () => telephonySendWhatsappTool,
192375
193135
  telephonySendSmsTool: () => telephonySendSmsTool,
192376
193136
  telephonyRoutingRulesTool: () => telephonyRoutingRulesTool,
193137
+ telephonyResumeTool: () => telephonyResumeTool,
192377
193138
  telephonyPhoneNumbersTool: () => telephonyPhoneNumbersTool,
193139
+ telephonyHoldTool: () => telephonyHoldTool,
193140
+ telephonyEndCallTool: () => telephonyEndCallTool,
192378
193141
  telephonyCallTool: () => telephonyCallTool,
192379
193142
  telephonyCallHistoryTool: () => telephonyCallHistoryTool,
193143
+ telephonyActiveCallsTool: () => telephonyActiveCallsTool,
192380
193144
  tasksStatusTool: () => tasksStatusTool,
192381
193145
  tasksNextTool: () => tasksNextTool,
192382
193146
  tasksListTool: () => tasksListTool,
@@ -192393,6 +193157,7 @@ __export(exports_src3, {
192393
193157
  storesGetTool: () => storesGetTool,
192394
193158
  storesAddTool: () => storesAddTool,
192395
193159
  startTask: () => startTask,
193160
+ startStreamServer: () => startStreamServer,
192396
193161
  signPayload: () => signPayload,
192397
193162
  severityFromString: () => severityFromString,
192398
193163
  setSecurityLogger: () => setSecurityLogger,
@@ -192916,6 +193681,7 @@ __export(exports_src3, {
192916
193681
  BuiltinCommands: () => BuiltinCommands,
192917
193682
  BudgetTracker: () => BudgetTracker,
192918
193683
  BashTool: () => BashTool,
193684
+ AudioTools: () => AudioTools,
192919
193685
  AudioRecorder: () => AudioRecorder,
192920
193686
  AudioPlayer: () => AudioPlayer,
192921
193687
  AssistantRegistryService: () => AssistantRegistryService,
@@ -192972,6 +193738,7 @@ var init_src3 = __esm(async () => {
192972
193738
  init_bash(),
192973
193739
  init_filesystem(),
192974
193740
  init_feedback(),
193741
+ init_audio2(),
192975
193742
  init_scheduler(),
192976
193743
  init_heartbeat(),
192977
193744
  init_logs(),
@@ -193381,14 +194148,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193381
194148
  prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
193382
194149
  actScopeDepth = prevActScopeDepth;
193383
194150
  }
193384
- function recursivelyFlushAsyncActWork(returnValue, resolve5, reject) {
194151
+ function recursivelyFlushAsyncActWork(returnValue, resolve6, reject) {
193385
194152
  var queue = ReactSharedInternals2.actQueue;
193386
194153
  if (queue !== null)
193387
194154
  if (queue.length !== 0)
193388
194155
  try {
193389
194156
  flushActQueue(queue);
193390
194157
  enqueueTask(function() {
193391
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
194158
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
193392
194159
  });
193393
194160
  return;
193394
194161
  } catch (error3) {
@@ -193396,7 +194163,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193396
194163
  }
193397
194164
  else
193398
194165
  ReactSharedInternals2.actQueue = null;
193399
- 0 < ReactSharedInternals2.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, reject(queue)) : resolve5(returnValue);
194166
+ 0 < ReactSharedInternals2.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, reject(queue)) : resolve6(returnValue);
193400
194167
  }
193401
194168
  function flushActQueue(queue) {
193402
194169
  if (!isFlushing) {
@@ -193572,14 +194339,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193572
194339
  didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
193573
194340
  });
193574
194341
  return {
193575
- then: function(resolve5, reject) {
194342
+ then: function(resolve6, reject) {
193576
194343
  didAwaitActCall = true;
193577
194344
  thenable.then(function(returnValue) {
193578
194345
  popActScope(prevActQueue, prevActScopeDepth);
193579
194346
  if (prevActScopeDepth === 0) {
193580
194347
  try {
193581
194348
  flushActQueue(queue), enqueueTask(function() {
193582
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
194349
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
193583
194350
  });
193584
194351
  } catch (error$0) {
193585
194352
  ReactSharedInternals2.thrownErrors.push(error$0);
@@ -193590,7 +194357,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193590
194357
  reject(_thrownError);
193591
194358
  }
193592
194359
  } else
193593
- resolve5(returnValue);
194360
+ resolve6(returnValue);
193594
194361
  }, function(error3) {
193595
194362
  popActScope(prevActQueue, prevActScopeDepth);
193596
194363
  0 < ReactSharedInternals2.thrownErrors.length ? (error3 = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, reject(error3)) : reject(error3);
@@ -193606,11 +194373,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193606
194373
  if (0 < ReactSharedInternals2.thrownErrors.length)
193607
194374
  throw callback = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, callback;
193608
194375
  return {
193609
- then: function(resolve5, reject) {
194376
+ then: function(resolve6, reject) {
193610
194377
  didAwaitActCall = true;
193611
194378
  prevActScopeDepth === 0 ? (ReactSharedInternals2.actQueue = queue, enqueueTask(function() {
193612
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve5, reject);
193613
- })) : resolve5(returnValue$jscomp$0);
194379
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve6, reject);
194380
+ })) : resolve6(returnValue$jscomp$0);
193614
194381
  }
193615
194382
  };
193616
194383
  };
@@ -198936,8 +199703,8 @@ It can also happen if the client has a browser extension installed which messes
198936
199703
  currentEntangledActionThenable = {
198937
199704
  status: "pending",
198938
199705
  value: undefined,
198939
- then: function(resolve5) {
198940
- entangledListeners.push(resolve5);
199706
+ then: function(resolve6) {
199707
+ entangledListeners.push(resolve6);
198941
199708
  }
198942
199709
  };
198943
199710
  }
@@ -198961,8 +199728,8 @@ It can also happen if the client has a browser extension installed which messes
198961
199728
  status: "pending",
198962
199729
  value: null,
198963
199730
  reason: null,
198964
- then: function(resolve5) {
198965
- listeners.push(resolve5);
199731
+ then: function(resolve6) {
199732
+ listeners.push(resolve6);
198966
199733
  }
198967
199734
  };
198968
199735
  thenable.then(function() {
@@ -210859,8 +211626,8 @@ class Ink {
210859
211626
  }
210860
211627
  }
210861
211628
  async waitUntilExit() {
210862
- this.exitPromise ||= new Promise((resolve5, reject) => {
210863
- this.resolveExitPromise = resolve5;
211629
+ this.exitPromise ||= new Promise((resolve6, reject) => {
211630
+ this.resolveExitPromise = resolve6;
210864
211631
  this.rejectExitPromise = reject;
210865
211632
  });
210866
211633
  return this.exitPromise;
@@ -211653,14 +212420,14 @@ var require_filesystem = __commonJS((exports, module) => {
211653
212420
  fs5.close(fd, () => {});
211654
212421
  return buffer.subarray(0, bytesRead);
211655
212422
  };
211656
- var readFile18 = (path3) => new Promise((resolve5, reject) => {
212423
+ var readFile18 = (path3) => new Promise((resolve6, reject) => {
211657
212424
  fs5.open(path3, "r", (err, fd) => {
211658
212425
  if (err) {
211659
212426
  reject(err);
211660
212427
  } else {
211661
212428
  const buffer = Buffer.alloc(MAX_LENGTH);
211662
212429
  fs5.read(fd, buffer, 0, MAX_LENGTH, 0, (_3, bytesRead) => {
211663
- resolve5(buffer.subarray(0, bytesRead));
212430
+ resolve6(buffer.subarray(0, bytesRead));
211664
212431
  fs5.close(fd, () => {});
211665
212432
  });
211666
212433
  }
@@ -211721,10 +212488,10 @@ var require_detect_libc = __commonJS((exports, module) => {
211721
212488
  var commandOut = "";
211722
212489
  var safeCommand = () => {
211723
212490
  if (!commandOut) {
211724
- return new Promise((resolve5) => {
212491
+ return new Promise((resolve6) => {
211725
212492
  childProcess.exec(command, (err, out) => {
211726
212493
  commandOut = err ? " " : out;
211727
- resolve5(commandOut);
212494
+ resolve6(commandOut);
211728
212495
  });
211729
212496
  });
211730
212497
  }
@@ -214281,14 +215048,14 @@ var require_input = __commonJS((exports, module) => {
214281
215048
  return this;
214282
215049
  } else {
214283
215050
  if (this._isStreamInput()) {
214284
- return new Promise((resolve5, reject) => {
215051
+ return new Promise((resolve6, reject) => {
214285
215052
  const finished = () => {
214286
215053
  this._flattenBufferIn();
214287
215054
  sharp.metadata(this.options, (err, metadata2) => {
214288
215055
  if (err) {
214289
215056
  reject(is3.nativeError(err, stack));
214290
215057
  } else {
214291
- resolve5(metadata2);
215058
+ resolve6(metadata2);
214292
215059
  }
214293
215060
  });
214294
215061
  };
@@ -214299,12 +215066,12 @@ var require_input = __commonJS((exports, module) => {
214299
215066
  }
214300
215067
  });
214301
215068
  } else {
214302
- return new Promise((resolve5, reject) => {
215069
+ return new Promise((resolve6, reject) => {
214303
215070
  sharp.metadata(this.options, (err, metadata2) => {
214304
215071
  if (err) {
214305
215072
  reject(is3.nativeError(err, stack));
214306
215073
  } else {
214307
- resolve5(metadata2);
215074
+ resolve6(metadata2);
214308
215075
  }
214309
215076
  });
214310
215077
  });
@@ -214337,25 +215104,25 @@ var require_input = __commonJS((exports, module) => {
214337
215104
  return this;
214338
215105
  } else {
214339
215106
  if (this._isStreamInput()) {
214340
- return new Promise((resolve5, reject) => {
215107
+ return new Promise((resolve6, reject) => {
214341
215108
  this.on("finish", function() {
214342
215109
  this._flattenBufferIn();
214343
215110
  sharp.stats(this.options, (err, stats2) => {
214344
215111
  if (err) {
214345
215112
  reject(is3.nativeError(err, stack));
214346
215113
  } else {
214347
- resolve5(stats2);
215114
+ resolve6(stats2);
214348
215115
  }
214349
215116
  });
214350
215117
  });
214351
215118
  });
214352
215119
  } else {
214353
- return new Promise((resolve5, reject) => {
215120
+ return new Promise((resolve6, reject) => {
214354
215121
  sharp.stats(this.options, (err, stats2) => {
214355
215122
  if (err) {
214356
215123
  reject(is3.nativeError(err, stack));
214357
215124
  } else {
214358
- resolve5(stats2);
215125
+ resolve6(stats2);
214359
215126
  }
214360
215127
  });
214361
215128
  });
@@ -217754,7 +218521,7 @@ var require_output = __commonJS((exports, module) => {
217754
218521
  return this;
217755
218522
  } else {
217756
218523
  if (this._isStreamInput()) {
217757
- return new Promise((resolve5, reject) => {
218524
+ return new Promise((resolve6, reject) => {
217758
218525
  this.once("finish", () => {
217759
218526
  this._flattenBufferIn();
217760
218527
  sharp.pipeline(this.options, (err, data, info) => {
@@ -217762,24 +218529,24 @@ var require_output = __commonJS((exports, module) => {
217762
218529
  reject(is3.nativeError(err, stack));
217763
218530
  } else {
217764
218531
  if (this.options.resolveWithObject) {
217765
- resolve5({ data, info });
218532
+ resolve6({ data, info });
217766
218533
  } else {
217767
- resolve5(data);
218534
+ resolve6(data);
217768
218535
  }
217769
218536
  }
217770
218537
  });
217771
218538
  });
217772
218539
  });
217773
218540
  } else {
217774
- return new Promise((resolve5, reject) => {
218541
+ return new Promise((resolve6, reject) => {
217775
218542
  sharp.pipeline(this.options, (err, data, info) => {
217776
218543
  if (err) {
217777
218544
  reject(is3.nativeError(err, stack));
217778
218545
  } else {
217779
218546
  if (this.options.resolveWithObject) {
217780
- resolve5({ data, info });
218547
+ resolve6({ data, info });
217781
218548
  } else {
217782
- resolve5(data);
218549
+ resolve6(data);
217783
218550
  }
217784
218551
  }
217785
218552
  });
@@ -218015,7 +218782,7 @@ var init_image2 = __esm(() => {
218015
218782
 
218016
218783
  // node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/queryEscapeSequence.js
218017
218784
  function queryEscapeSequence(message, stdin, stdout, setRawMode) {
218018
- return new Promise((resolve5) => {
218785
+ return new Promise((resolve6) => {
218019
218786
  const responseTimeout = 100;
218020
218787
  let responseTimeoutId = undefined;
218021
218788
  const timeoutBetweenReplies = 50;
@@ -218043,18 +218810,18 @@ function queryEscapeSequence(message, stdin, stdout, setRawMode) {
218043
218810
  runningReply += data;
218044
218811
  timeoutBetweenRepliesId = setTimeout(() => {
218045
218812
  restoreState();
218046
- resolve5(runningReply.length > 0 ? runningReply : undefined);
218813
+ resolve6(runningReply.length > 0 ? runningReply : undefined);
218047
218814
  }, timeoutBetweenReplies);
218048
218815
  };
218049
218816
  const onClose = () => {
218050
218817
  restoreState();
218051
- resolve5(runningReply.length > 0 ? runningReply : undefined);
218818
+ resolve6(runningReply.length > 0 ? runningReply : undefined);
218052
218819
  };
218053
218820
  stdin.on("data", onData);
218054
218821
  stdin.on("close", onClose);
218055
218822
  responseTimeoutId = setTimeout(() => {
218056
218823
  restoreState();
218057
- resolve5(undefined);
218824
+ resolve6(undefined);
218058
218825
  }, responseTimeout);
218059
218826
  stdout.write(message);
218060
218827
  });
@@ -218307,12 +219074,12 @@ var require_isexe = __commonJS((exports, module) => {
218307
219074
  if (typeof Promise !== "function") {
218308
219075
  throw new TypeError("callback not provided");
218309
219076
  }
218310
- return new Promise(function(resolve5, reject) {
219077
+ return new Promise(function(resolve6, reject) {
218311
219078
  isexe(path3, options || {}, function(er3, is3) {
218312
219079
  if (er3) {
218313
219080
  reject(er3);
218314
219081
  } else {
218315
- resolve5(is3);
219082
+ resolve6(is3);
218316
219083
  }
218317
219084
  });
218318
219085
  });
@@ -218374,27 +219141,27 @@ var require_which = __commonJS((exports, module) => {
218374
219141
  opt = {};
218375
219142
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
218376
219143
  const found = [];
218377
- const step = (i5) => new Promise((resolve5, reject) => {
219144
+ const step = (i5) => new Promise((resolve6, reject) => {
218378
219145
  if (i5 === pathEnv.length)
218379
- return opt.all && found.length ? resolve5(found) : reject(getNotFoundError(cmd));
219146
+ return opt.all && found.length ? resolve6(found) : reject(getNotFoundError(cmd));
218380
219147
  const ppRaw = pathEnv[i5];
218381
219148
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
218382
219149
  const pCmd = path3.join(pathPart, cmd);
218383
219150
  const p5 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
218384
- resolve5(subStep(p5, i5, 0));
219151
+ resolve6(subStep(p5, i5, 0));
218385
219152
  });
218386
- const subStep = (p5, i5, ii3) => new Promise((resolve5, reject) => {
219153
+ const subStep = (p5, i5, ii3) => new Promise((resolve6, reject) => {
218387
219154
  if (ii3 === pathExt.length)
218388
- return resolve5(step(i5 + 1));
219155
+ return resolve6(step(i5 + 1));
218389
219156
  const ext = pathExt[ii3];
218390
219157
  isexe(p5 + ext, { pathExt: pathExtExe }, (er3, is3) => {
218391
219158
  if (!er3 && is3) {
218392
219159
  if (opt.all)
218393
219160
  found.push(p5 + ext);
218394
219161
  else
218395
- return resolve5(p5 + ext);
219162
+ return resolve6(p5 + ext);
218396
219163
  }
218397
- return resolve5(subStep(p5, i5, ii3 + 1));
219164
+ return resolve6(subStep(p5, i5, ii3 + 1));
218398
219165
  });
218399
219166
  });
218400
219167
  return cb2 ? step(0).then((res) => cb2(null, res), cb2) : step(0);
@@ -219281,7 +220048,7 @@ var require_kill = __commonJS((exports, module) => {
219281
220048
  return spawnedPromise;
219282
220049
  }
219283
220050
  let timeoutId;
219284
- const timeoutPromise = new Promise((resolve5, reject) => {
220051
+ const timeoutPromise = new Promise((resolve6, reject) => {
219285
220052
  timeoutId = setTimeout(() => {
219286
220053
  timeoutKill(spawned, killSignal, reject);
219287
220054
  }, timeout);
@@ -219392,7 +220159,7 @@ var require_get_stream = __commonJS((exports, module) => {
219392
220159
  };
219393
220160
  const { maxBuffer } = options;
219394
220161
  const stream2 = bufferStream(options);
219395
- await new Promise((resolve5, reject) => {
220162
+ await new Promise((resolve6, reject) => {
219396
220163
  const rejectPromise = (error3) => {
219397
220164
  if (error3 && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
219398
220165
  error3.bufferedData = stream2.getBufferedValue();
@@ -219402,7 +220169,7 @@ var require_get_stream = __commonJS((exports, module) => {
219402
220169
  (async () => {
219403
220170
  try {
219404
220171
  await streamPipelinePromisified(inputStream, stream2);
219405
- resolve5();
220172
+ resolve6();
219406
220173
  } catch (error3) {
219407
220174
  rejectPromise(error3);
219408
220175
  }
@@ -219549,9 +220316,9 @@ var require_promise = __commonJS((exports, module) => {
219549
220316
  return spawned;
219550
220317
  };
219551
220318
  var getSpawnedPromise = (spawned) => {
219552
- return new Promise((resolve5, reject) => {
220319
+ return new Promise((resolve6, reject) => {
219553
220320
  spawned.on("exit", (exitCode, signal) => {
219554
- resolve5({ exitCode, signal });
220321
+ resolve6({ exitCode, signal });
219555
220322
  });
219556
220323
  spawned.on("error", (error3) => {
219557
220324
  reject(error3);
@@ -233185,7 +233952,7 @@ await __promiseAll([
233185
233952
  var import_react83 = __toESM(require_react2(), 1);
233186
233953
  import { spawn as spawn3 } from "child_process";
233187
233954
  import { join as join61 } from "path";
233188
- import { homedir as homedir23 } from "os";
233955
+ import { homedir as homedir24 } from "os";
233189
233956
 
233190
233957
  // packages/terminal/src/components/Input.tsx
233191
233958
  await init_build2();
@@ -236071,7 +236838,7 @@ function ActiveToolsPanel({ activityLog, now: now2, verboseTools }) {
236071
236838
  const anyRunning = toolCalls.some((c6) => c6.status === "running");
236072
236839
  const anyError = toolCalls.some((c6) => c6.status === "failed");
236073
236840
  const summary = buildToolCallSummary(toolCalls.map((c6) => c6.toolCall), anyRunning);
236074
- const icon = anyRunning ? "\u25D0" : anyError ? "\u2717" : "\u25CF";
236841
+ const icon = anyRunning ? "\u25CB" : anyError ? "\u2717" : "\u25CF";
236075
236842
  const iconColor = anyRunning ? "gray" : anyError ? "red" : "green";
236076
236843
  const suffix2 = anyRunning ? "\u2026" : "";
236077
236844
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
@@ -236102,7 +236869,7 @@ function ActiveToolsPanel({ activityLog, now: now2, verboseTools }) {
236102
236869
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
236103
236870
  flexDirection: "column",
236104
236871
  children: toolCalls.map((call) => {
236105
- const icon = call.status === "running" ? "\u25D0" : call.status === "failed" ? "\u2717" : "\u25CF";
236872
+ const icon = call.status === "running" ? "\u25CB" : call.status === "failed" ? "\u2717" : "\u25CF";
236106
236873
  const iconColor = call.status === "running" ? "gray" : call.status === "failed" ? "red" : "green";
236107
236874
  const elapsedMs = (call.endTime ?? now2) - call.startTime;
236108
236875
  const elapsedText = formatDuration3(elapsedMs);
@@ -236264,7 +237031,7 @@ function ToolCallPanel({
236264
237031
  const anyError = toolCalls.some((tc) => resultMap.get(tc.id)?.isError);
236265
237032
  const isRunning = !allComplete;
236266
237033
  const summary = buildToolCallSummary(toolCalls, isRunning);
236267
- const icon = isRunning ? "\u25D0" : anyError ? "\u2717" : "\u25CF";
237034
+ const icon = isRunning ? "\u25CB" : anyError ? "\u2717" : "\u25CF";
236268
237035
  const iconColor = isRunning ? "gray" : anyError ? "red" : "green";
236269
237036
  const suffix2 = isRunning ? "\u2026" : "";
236270
237037
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
@@ -236298,7 +237065,7 @@ function ToolCallPanel({
236298
237065
  const result = resultMap.get(toolCall.id);
236299
237066
  const isRunning = !result;
236300
237067
  const isError = result?.isError;
236301
- const icon = isRunning ? "\u25D0" : isError ? "\u2717" : "\u25CF";
237068
+ const icon = isRunning ? "\u25CB" : isError ? "\u2717" : "\u25CF";
236302
237069
  const iconColor = isRunning ? "gray" : isError ? "red" : "green";
236303
237070
  const title = getToolCallTitle(toolCall);
236304
237071
  const prefix2 = isRunning ? "Calling " : "";
@@ -237159,11 +237926,13 @@ function ProcessingIndicator({
237159
237926
  }
237160
237927
 
237161
237928
  // packages/terminal/src/components/WelcomeBanner.tsx
237929
+ init_src2();
237162
237930
  await init_build2();
237163
237931
  var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
237164
237932
  function WelcomeBanner({ version: version4, model, directory }) {
237165
237933
  const homeDir = process.env.HOME || "";
237166
237934
  const displayDir = homeDir && directory.startsWith(homeDir) ? "~" + directory.slice(homeDir.length) : directory;
237935
+ const displayModel = getModelDisplayName(model);
237167
237936
  return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
237168
237937
  flexDirection: "column",
237169
237938
  marginBottom: 1,
@@ -237182,7 +237951,7 @@ function WelcomeBanner({ version: version4, model, directory }) {
237182
237951
  }, undefined, false, undefined, this),
237183
237952
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237184
237953
  bold: true,
237185
- children: "Assistants"
237954
+ children: "Hasna Assistants"
237186
237955
  }, undefined, false, undefined, this),
237187
237956
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237188
237957
  dimColor: true,
@@ -237202,7 +237971,7 @@ function WelcomeBanner({ version: version4, model, directory }) {
237202
237971
  children: "model: "
237203
237972
  }, undefined, false, undefined, this),
237204
237973
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237205
- children: model
237974
+ children: displayModel
237206
237975
  }, undefined, false, undefined, this),
237207
237976
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237208
237977
  dimColor: true,
@@ -263402,7 +264171,7 @@ var HOOK_TYPE_SET = new Set(["command", "prompt", "assistant"]);
263402
264171
  var HOOK_LOCATION_SET = new Set(["project", "user", "local"]);
263403
264172
  var HOOK_EVENT_MAP = new Map(Array.from(HOOK_EVENT_SET).map((ev) => [ev.toLowerCase(), ev]));
263404
264173
  async function runShellCommand(command, cwd2) {
263405
- return new Promise((resolve5, reject) => {
264174
+ return new Promise((resolve6, reject) => {
263406
264175
  const child = spawn3(command, { cwd: cwd2, shell: true, env: process.env });
263407
264176
  const stdoutChunks = [];
263408
264177
  const stderrChunks = [];
@@ -263431,7 +264200,7 @@ async function runShellCommand(command, cwd2) {
263431
264200
  }
263432
264201
  child.on("error", (error3) => reject(error3));
263433
264202
  child.on("close", (code) => {
263434
- resolve5({
264203
+ resolve6({
263435
264204
  stdout: Buffer.concat(stdoutChunks).toString("utf8").trimEnd(),
263436
264205
  stderr: Buffer.concat(stderrChunks).toString("utf8").trimEnd(),
263437
264206
  exitCode: code,
@@ -263728,7 +264497,7 @@ function App2({ cwd: cwd2, version: version4 }) {
263728
264497
  setInlinePending((prev) => prev.filter((msg) => msg.id !== id));
263729
264498
  }, []);
263730
264499
  const beginAskUser = import_react83.useCallback((sessionId, request2) => {
263731
- return new Promise((resolve5, reject) => {
264500
+ return new Promise((resolve6, reject) => {
263732
264501
  if (askUserStateRef.current.has(sessionId)) {
263733
264502
  reject(new Error("Another interview is already in progress for this session."));
263734
264503
  return;
@@ -263738,7 +264507,7 @@ function App2({ cwd: cwd2, version: version4 }) {
263738
264507
  request: request2,
263739
264508
  index: 0,
263740
264509
  answers: {},
263741
- resolve: resolve5,
264510
+ resolve: resolve6,
263742
264511
  reject
263743
264512
  };
263744
264513
  askUserStateRef.current.set(sessionId, state);
@@ -264919,7 +265688,7 @@ function App2({ cwd: cwd2, version: version4 }) {
264919
265688
  }, [recoverableSessions, createSessionFromRecovery, workspaceBaseDir]);
264920
265689
  const handleOnboardingComplete = import_react83.useCallback(async (result) => {
264921
265690
  const { existsSync: existsSync43, mkdirSync: mkdirSync29, readFileSync: readFileSync24, writeFileSync: writeFileSync18, appendFileSync: appendFileSync4 } = await import("fs");
264922
- const secretsPath = join61(homedir23(), ".secrets");
265691
+ const secretsPath = join61(homedir24(), ".secrets");
264923
265692
  const providerInfo = getProviderInfo(result.provider);
264924
265693
  const envName = providerInfo?.apiKeyEnv || "ANTHROPIC_API_KEY";
264925
265694
  const keyExport = `export ${envName}="${result.apiKey}"`;
@@ -268091,7 +268860,7 @@ Interactive Mode:
268091
268860
  // packages/terminal/src/index.tsx
268092
268861
  var jsx_dev_runtime51 = __toESM(require_jsx_dev_runtime(), 1);
268093
268862
  setRuntime(bunRuntime);
268094
- var VERSION4 = "1.1.47";
268863
+ var VERSION4 = "1.1.48";
268095
268864
  var SYNC_START = "\x1B[?2026h";
268096
268865
  var SYNC_END = "\x1B[?2026l";
268097
268866
  function enableSynchronizedOutput() {
@@ -268210,4 +268979,4 @@ export {
268210
268979
  main
268211
268980
  };
268212
268981
 
268213
- //# debugId=BE2A3F631A03959464756E2164756E21
268982
+ //# debugId=43453D06C0B5235264756E2164756E21