@hasna/assistants 1.1.46 → 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 = [];
@@ -79359,18 +79771,34 @@ To update fields, use the web UI or edit the identity file directly.
79359
79771
  handler: async (_args, context) => {
79360
79772
  const assistant = context.getAssistantManager?.()?.getActive();
79361
79773
  const identity = context.getIdentityManager?.()?.getActive();
79362
- if (!assistant || !identity) {
79774
+ const model = context.getModel?.();
79775
+ if (!assistant && !identity) {
79363
79776
  context.emit("text", `No active assistant or identity.
79364
79777
  `);
79778
+ if (model) {
79779
+ context.emit("text", `Model: ${model}
79780
+ `);
79781
+ }
79365
79782
  context.emit("done");
79366
79783
  return { handled: true };
79367
79784
  }
79368
- context.emit("text", `Assistant: ${assistant.name}
79785
+ if (assistant) {
79786
+ context.emit("text", `Assistant: ${assistant.name}
79787
+ `);
79788
+ }
79789
+ if (identity) {
79790
+ context.emit("text", `Identity: ${identity.name}
79791
+ `);
79792
+ context.emit("text", `Display name: ${identity.profile.displayName || identity.name}
79369
79793
  `);
79370
- context.emit("text", `Identity: ${identity.name}
79794
+ } else if (assistant) {
79795
+ context.emit("text", `Identity: (not configured)
79371
79796
  `);
79372
- context.emit("text", `Display name: ${identity.profile.displayName}
79797
+ }
79798
+ if (model) {
79799
+ context.emit("text", `Model: ${model}
79373
79800
  `);
79801
+ }
79374
79802
  context.emit("done");
79375
79803
  return { handled: true };
79376
79804
  }
@@ -84615,9 +85043,9 @@ Format the summary as a brief bullet-point list. This summary will replace the c
84615
85043
  if (action === "show" || action === "paths") {
84616
85044
  const storageDir = context.getStorageDir?.() || getConfigDir();
84617
85045
  const configPaths = [
84618
- join28(context.cwd, ".assistants", "config.json"),
84619
- join28(context.cwd, ".assistants", "config.local.json"),
84620
- join28(storageDir, "config.json")
85046
+ join29(context.cwd, ".assistants", "config.json"),
85047
+ join29(context.cwd, ".assistants", "config.local.json"),
85048
+ join29(storageDir, "config.json")
84621
85049
  ];
84622
85050
  let message = `
84623
85051
  **Configuration**
@@ -84626,21 +85054,21 @@ Format the summary as a brief bullet-point list. This summary will replace the c
84626
85054
  message += `**Config File Locations:**
84627
85055
  `;
84628
85056
  for (const path2 of configPaths) {
84629
- const exists = existsSync20(path2);
85057
+ const exists = existsSync21(path2);
84630
85058
  message += ` ${exists ? "\u2713" : "\u25CB"} ${path2}
84631
85059
  `;
84632
85060
  }
84633
85061
  const envHome = process.env.HOME || process.env.USERPROFILE;
84634
- const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir13();
85062
+ const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir15();
84635
85063
  message += `
84636
85064
  **Commands Directories:**
84637
85065
  `;
84638
- message += ` - Project: ${join28(context.cwd, ".assistants", "commands")}
85066
+ message += ` - Project: ${join29(context.cwd, ".assistants", "commands")}
84639
85067
  `;
84640
- message += ` - User/Workspace: ${join28(storageDir, "commands")}
85068
+ message += ` - User/Workspace: ${join29(storageDir, "commands")}
84641
85069
  `;
84642
- if (storageDir !== join28(homeDir, ".assistants")) {
84643
- message += ` - Global fallback: ${join28(homeDir, ".assistants", "commands")}
85070
+ if (storageDir !== join29(homeDir, ".assistants")) {
85071
+ message += ` - Global fallback: ${join29(homeDir, ".assistants", "commands")}
84644
85072
  `;
84645
85073
  }
84646
85074
  context.emit("text", message);
@@ -85556,7 +85984,7 @@ ${error2 instanceof Error ? error2.message : String(error2)}
85556
85984
  selfHandled: true,
85557
85985
  content: "",
85558
85986
  handler: async (args, context) => {
85559
- const commandsDir = join28(context.cwd, ".assistants", "commands");
85987
+ const commandsDir = join29(context.cwd, ".assistants", "commands");
85560
85988
  mkdirSync13(commandsDir, { recursive: true });
85561
85989
  const exampleCommand = `---
85562
85990
  name: reflect
@@ -85572,8 +86000,8 @@ Please summarize the last interaction and suggest 2-3 next steps.
85572
86000
  - Focus on clarity
85573
86001
  - Ask a follow-up question if needed
85574
86002
  `;
85575
- const examplePath = join28(commandsDir, "reflect.md");
85576
- if (!existsSync20(examplePath)) {
86003
+ const examplePath = join29(commandsDir, "reflect.md");
86004
+ if (!existsSync21(examplePath)) {
85577
86005
  writeFileSync13(examplePath, exampleCommand);
85578
86006
  }
85579
86007
  let message = `
@@ -86303,7 +86731,7 @@ Memory Statistics
86303
86731
  return { handled: true };
86304
86732
  }
86305
86733
  if (action === "export") {
86306
- const filePath = rest[0] || join28(context.getStorageDir?.() || getConfigDir(), "memories-export.json");
86734
+ const filePath = rest[0] || join29(context.getStorageDir?.() || getConfigDir(), "memories-export.json");
86307
86735
  const memories = await manager.export();
86308
86736
  try {
86309
86737
  const content = JSON.stringify(memories, null, 2);
@@ -86521,7 +86949,7 @@ Importing ${validMemories.length} valid entries (skipping ${errors.length} inval
86521
86949
  const heartbeatConfig = context.getHeartbeatConfig?.() ?? null;
86522
86950
  const historyPathTemplate = heartbeatConfig?.historyPath;
86523
86951
  const storageDir = context.getStorageDir?.();
86524
- const runsDir = storageDir ? join28(storageDir, "heartbeats", "runs") : undefined;
86952
+ const runsDir = storageDir ? join29(storageDir, "heartbeats", "runs") : undefined;
86525
86953
  if (!cleanedArgs || cleanedArgs === "ui") {
86526
86954
  context.emit("done");
86527
86955
  return { handled: true, showPanel: "heartbeat" };
@@ -86733,8 +87161,8 @@ Connector "${connectorName}" not found.
86733
87161
  `;
86734
87162
  try {
86735
87163
  let timeoutId = null;
86736
- const timeoutPromise = new Promise((resolve5) => {
86737
- timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve5);
87164
+ const timeoutPromise = new Promise((resolve6) => {
87165
+ timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve6);
86738
87166
  });
86739
87167
  const runtime = getRuntime();
86740
87168
  const cli2 = connector.cli || `connect-${connector.name}`;
@@ -86813,8 +87241,8 @@ Connector "${connectorName}" not found.
86813
87241
  let timeoutId = null;
86814
87242
  try {
86815
87243
  const cli = connector.cli || `connect-${connector.name}`;
86816
- const timeoutPromise = new Promise((resolve5) => {
86817
- timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve5);
87244
+ const timeoutPromise = new Promise((resolve6) => {
87245
+ timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve6);
86818
87246
  });
86819
87247
  const runtime = getRuntime();
86820
87248
  const execPromise = (async () => {
@@ -87223,7 +87651,7 @@ Not a git repository or git not available.
87223
87651
  context.setProjectContext(projectContext);
87224
87652
  }
87225
87653
  }
87226
- var VERSION2 = "1.1.46";
87654
+ var VERSION2 = "1.1.48";
87227
87655
  var init_builtin = __esm(async () => {
87228
87656
  init_src2();
87229
87657
  init_store();
@@ -87445,7 +87873,7 @@ var init_values2 = __esm(() => {
87445
87873
  });
87446
87874
 
87447
87875
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
87448
- var sleep4 = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
87876
+ var sleep4 = (ms) => new Promise((resolve6) => setTimeout(resolve6, ms));
87449
87877
 
87450
87878
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/version.mjs
87451
87879
  var VERSION3 = "0.74.0";
@@ -88143,8 +88571,8 @@ var init_api_promise2 = __esm(() => {
88143
88571
  init_parse2();
88144
88572
  APIPromise2 = class APIPromise2 extends Promise {
88145
88573
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse2) {
88146
- super((resolve5) => {
88147
- resolve5(null);
88574
+ super((resolve6) => {
88575
+ resolve6(null);
88148
88576
  });
88149
88577
  this.responsePromise = responsePromise;
88150
88578
  this.parseResponse = parseResponse2;
@@ -89100,12 +89528,12 @@ var init_BetaMessageStream = __esm(() => {
89100
89528
  }
89101
89529
  return this._emit("error", new AnthropicError(String(error3)));
89102
89530
  });
89103
- __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve5, reject) => {
89104
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve5, "f");
89531
+ __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve6, reject) => {
89532
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve6, "f");
89105
89533
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
89106
89534
  }), "f");
89107
- __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve5, reject) => {
89108
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve5, "f");
89535
+ __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve6, reject) => {
89536
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve6, "f");
89109
89537
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectEndPromise, reject, "f");
89110
89538
  }), "f");
89111
89539
  __classPrivateFieldGet2(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
@@ -89226,11 +89654,11 @@ var init_BetaMessageStream = __esm(() => {
89226
89654
  return this;
89227
89655
  }
89228
89656
  emitted(event) {
89229
- return new Promise((resolve5, reject) => {
89657
+ return new Promise((resolve6, reject) => {
89230
89658
  __classPrivateFieldSet2(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
89231
89659
  if (event !== "error")
89232
89660
  this.once("error", reject);
89233
- this.once(event, resolve5);
89661
+ this.once(event, resolve6);
89234
89662
  });
89235
89663
  }
89236
89664
  async done() {
@@ -89563,7 +89991,7 @@ var init_BetaMessageStream = __esm(() => {
89563
89991
  if (done) {
89564
89992
  return { value: undefined, done: true };
89565
89993
  }
89566
- 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 });
89567
89995
  }
89568
89996
  const chunk = pushQueue.shift();
89569
89997
  return { value: chunk, done: false };
@@ -89625,13 +90053,13 @@ Wrap your summary in <summary></summary> tags.`;
89625
90053
 
89626
90054
  // node_modules/.bun/@anthropic-ai+sdk@0.74.0+3c5d820c62823f0b/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs
89627
90055
  function promiseWithResolvers() {
89628
- let resolve5;
90056
+ let resolve6;
89629
90057
  let reject;
89630
90058
  const promise = new Promise((res, rej) => {
89631
- resolve5 = res;
90059
+ resolve6 = res;
89632
90060
  reject = rej;
89633
90061
  });
89634
- return { promise, resolve: resolve5, reject };
90062
+ return { promise, resolve: resolve6, reject };
89635
90063
  }
89636
90064
  async function generateToolResponse(params, lastMessage = params.messages.at(-1)) {
89637
90065
  if (!lastMessage || lastMessage.role !== "assistant" || !lastMessage.content || typeof lastMessage.content === "string") {
@@ -90386,12 +90814,12 @@ var init_MessageStream = __esm(() => {
90386
90814
  }
90387
90815
  return this._emit("error", new AnthropicError(String(error3)));
90388
90816
  });
90389
- __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve5, reject) => {
90390
- __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve5, "f");
90817
+ __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve6, reject) => {
90818
+ __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve6, "f");
90391
90819
  __classPrivateFieldSet2(this, _MessageStream_rejectConnectedPromise, reject, "f");
90392
90820
  }), "f");
90393
- __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve5, reject) => {
90394
- __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve5, "f");
90821
+ __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve6, reject) => {
90822
+ __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve6, "f");
90395
90823
  __classPrivateFieldSet2(this, _MessageStream_rejectEndPromise, reject, "f");
90396
90824
  }), "f");
90397
90825
  __classPrivateFieldGet2(this, _MessageStream_connectedPromise, "f").catch(() => {});
@@ -90512,11 +90940,11 @@ var init_MessageStream = __esm(() => {
90512
90940
  return this;
90513
90941
  }
90514
90942
  emitted(event) {
90515
- return new Promise((resolve5, reject) => {
90943
+ return new Promise((resolve6, reject) => {
90516
90944
  __classPrivateFieldSet2(this, _MessageStream_catchingPromiseCreated, true, "f");
90517
90945
  if (event !== "error")
90518
90946
  this.once("error", reject);
90519
- this.once(event, resolve5);
90947
+ this.once(event, resolve6);
90520
90948
  });
90521
90949
  }
90522
90950
  async done() {
@@ -90824,7 +91252,7 @@ var init_MessageStream = __esm(() => {
90824
91252
  if (done) {
90825
91253
  return { value: undefined, done: true };
90826
91254
  }
90827
- 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 });
90828
91256
  }
90829
91257
  const chunk = pushQueue.shift();
90830
91258
  return { value: chunk, done: false };
@@ -91622,6 +92050,11 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91622
92050
  if (docBlock) {
91623
92051
  content.push(docBlock);
91624
92052
  }
92053
+ } else if (doc.type === "image") {
92054
+ const imageBlock = this.convertImageToBlock(doc);
92055
+ if (imageBlock) {
92056
+ content.push(imageBlock);
92057
+ }
91625
92058
  }
91626
92059
  }
91627
92060
  }
@@ -91682,6 +92115,27 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91682
92115
  }
91683
92116
  return null;
91684
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
+ }
91685
92139
  convertTools(tools) {
91686
92140
  return tools.map((tool) => ({
91687
92141
  name: tool.name,
@@ -91918,11 +92372,51 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91918
92372
  pendingToolUseIds.delete(toolResult.toolCallId);
91919
92373
  }
91920
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
+ }
91921
92398
  } else if (msg.content) {
91922
- result.push({
91923
- role: "user",
91924
- content: msg.content
91925
- });
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
+ }
91926
92420
  }
91927
92421
  } else if (msg.role === "assistant") {
91928
92422
  const assistantMsg = {
@@ -91951,6 +92445,25 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
91951
92445
  }
91952
92446
  return result;
91953
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
+ }
91954
92467
  convertTools(tools) {
91955
92468
  return tools.map((tool) => ({
91956
92469
  type: "function",
@@ -92274,34 +92787,34 @@ var init_recovery = __esm(async () => {
92274
92787
  });
92275
92788
 
92276
92789
  // packages/core/src/heartbeat/finder.ts
92277
- import { existsSync as existsSync21, readdirSync as readdirSync7, readFileSync as readFileSync13 } from "fs";
92278
- 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";
92279
92792
  function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 * 60 * 1000, baseDir) {
92280
92793
  const configDir = baseDir ?? getConfigDir();
92281
- const heartbeatsDir = join29(configDir, "heartbeats");
92282
- const stateDir = join29(configDir, "state");
92283
- const sessionsDir = join29(configDir, "sessions");
92794
+ const heartbeatsDir = join30(configDir, "heartbeats");
92795
+ const stateDir = join30(configDir, "state");
92796
+ const sessionsDir = join30(configDir, "sessions");
92284
92797
  const recoverableSessions = [];
92285
- if (!existsSync21(heartbeatsDir)) {
92798
+ if (!existsSync22(heartbeatsDir)) {
92286
92799
  return recoverableSessions;
92287
92800
  }
92288
92801
  const now2 = Date.now();
92289
92802
  const heartbeatFiles = readdirSync7(heartbeatsDir).filter((f) => f.endsWith(".json"));
92290
92803
  for (const file of heartbeatFiles) {
92291
92804
  const sessionId = file.replace(".json", "");
92292
- const heartbeatPath = join29(heartbeatsDir, file);
92293
- const statePath = join29(stateDir, `${sessionId}.json`);
92294
- 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`);
92295
92808
  try {
92296
- const heartbeatContent = readFileSync13(heartbeatPath, "utf-8");
92809
+ const heartbeatContent = readFileSync14(heartbeatPath, "utf-8");
92297
92810
  const heartbeat = JSON.parse(heartbeatContent);
92298
92811
  const heartbeatAge = now2 - new Date(heartbeat.timestamp).getTime();
92299
92812
  if (heartbeatAge < staleThresholdMs) {
92300
92813
  continue;
92301
92814
  }
92302
92815
  let state = null;
92303
- if (existsSync21(statePath)) {
92304
- const stateContent = readFileSync13(statePath, "utf-8");
92816
+ if (existsSync22(statePath)) {
92817
+ const stateContent = readFileSync14(statePath, "utf-8");
92305
92818
  state = JSON.parse(stateContent);
92306
92819
  }
92307
92820
  if (state) {
@@ -92312,9 +92825,9 @@ function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 *
92312
92825
  }
92313
92826
  let messageCount = 0;
92314
92827
  let cwd = state?.context?.cwd || process.cwd();
92315
- if (existsSync21(sessionPath)) {
92828
+ if (existsSync22(sessionPath)) {
92316
92829
  try {
92317
- const sessionContent = readFileSync13(sessionPath, "utf-8");
92830
+ const sessionContent = readFileSync14(sessionPath, "utf-8");
92318
92831
  const sessionData = JSON.parse(sessionContent);
92319
92832
  messageCount = sessionData.messages?.length || 0;
92320
92833
  cwd = sessionData.cwd || cwd;
@@ -92346,16 +92859,16 @@ function findRecoverableSessions(staleThresholdMs = 120000, maxAgeMs = 24 * 60 *
92346
92859
  }
92347
92860
  function clearRecoveryState(sessionId, baseDir) {
92348
92861
  const configDir = baseDir ?? getConfigDir();
92349
- const heartbeatPath = join29(configDir, "heartbeats", `${sessionId}.json`);
92350
- const statePath = join29(configDir, "state", `${sessionId}.json`);
92862
+ const heartbeatPath = join30(configDir, "heartbeats", `${sessionId}.json`);
92863
+ const statePath = join30(configDir, "state", `${sessionId}.json`);
92351
92864
  const { unlinkSync: unlinkSync4 } = __require("fs");
92352
92865
  try {
92353
- if (existsSync21(heartbeatPath)) {
92866
+ if (existsSync22(heartbeatPath)) {
92354
92867
  unlinkSync4(heartbeatPath);
92355
92868
  }
92356
92869
  } catch {}
92357
92870
  try {
92358
- if (existsSync21(statePath)) {
92871
+ if (existsSync22(statePath)) {
92359
92872
  unlinkSync4(statePath);
92360
92873
  }
92361
92874
  } catch {}
@@ -92484,11 +92997,11 @@ var init_watchdog = __esm(async () => {
92484
92997
  });
92485
92998
 
92486
92999
  // packages/core/src/heartbeat/install-skills.ts
92487
- import { join as join30 } from "path";
93000
+ import { join as join31 } from "path";
92488
93001
  async function writeSkillIfNeeded(dir, skillName, content) {
92489
93002
  const { mkdir: mkdir10, writeFile: writeFile8, readFile: readFile11 } = await import("fs/promises");
92490
- const skillDir = join30(dir, `skill-${skillName}`);
92491
- const skillFile = join30(skillDir, "SKILL.md");
93003
+ const skillDir = join31(dir, `skill-${skillName}`);
93004
+ const skillFile = join31(skillDir, "SKILL.md");
92492
93005
  await mkdir10(skillDir, { recursive: true });
92493
93006
  try {
92494
93007
  const existing = await readFile11(skillFile, "utf-8");
@@ -92507,7 +93020,7 @@ async function writeSkillIfNeeded(dir, skillName, content) {
92507
93020
  }
92508
93021
  }
92509
93022
  async function installHeartbeatSkills() {
92510
- const sharedSkillsDir = join30(getConfigDir(), "shared", "skills");
93023
+ const sharedSkillsDir = join31(getConfigDir(), "shared", "skills");
92511
93024
  const installed = [];
92512
93025
  const results = await Promise.all([
92513
93026
  writeSkillIfNeeded(sharedSkillsDir, "main-loop", MAIN_LOOP_SKILL),
@@ -92861,128 +93374,6 @@ var init_llm_response = __esm(() => {
92861
93374
  init_schema();
92862
93375
  });
92863
93376
 
92864
- // packages/core/src/voice/utils.ts
92865
- import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
92866
- import { homedir as homedir14 } from "os";
92867
- import { join as join31 } from "path";
92868
- import { spawnSync } from "child_process";
92869
- function loadApiKeyFromSecrets2(key) {
92870
- const envHome = process.env.HOME || process.env.USERPROFILE;
92871
- const homeDir = envHome && envHome.trim().length > 0 ? envHome : homedir14();
92872
- const secretsPath = join31(homeDir, ".secrets");
92873
- if (!existsSync22(secretsPath))
92874
- return;
92875
- try {
92876
- const content = readFileSync14(secretsPath, "utf-8");
92877
- const match = content.match(new RegExp(`export\\s+${key}\\s*=\\s*['"]?([^'"\\n]+)['"]?`));
92878
- return match?.[1];
92879
- } catch {
92880
- return;
92881
- }
92882
- }
92883
- function findExecutable(name) {
92884
- const command = process.platform === "win32" ? "where" : "which";
92885
- const result = spawnSync(command, [name], { encoding: "utf-8" });
92886
- if (result.status === 0 && result.stdout) {
92887
- const output = result.stdout.trim().split(`
92888
- `)[0]?.trim();
92889
- return output || null;
92890
- }
92891
- return null;
92892
- }
92893
- var init_utils4 = () => {};
92894
-
92895
- // packages/core/src/voice/stt.ts
92896
- class WhisperSTT {
92897
- apiKey;
92898
- model;
92899
- language;
92900
- constructor(options = {}) {
92901
- this.apiKey = options.apiKey || process.env.OPENAI_API_KEY || loadApiKeyFromSecrets2("OPENAI_API_KEY") || "";
92902
- this.model = options.model || "whisper-1";
92903
- this.language = options.language;
92904
- }
92905
- async transcribe(audioBuffer) {
92906
- if (!this.apiKey) {
92907
- throw new Error("Missing OPENAI_API_KEY for Whisper STT. Set it in env or ~/.secrets.");
92908
- }
92909
- const form = new FormData;
92910
- form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
92911
- form.append("model", this.model);
92912
- if (this.language) {
92913
- form.append("language", this.language);
92914
- }
92915
- const response = await fetch("https://api.openai.com/v1/audio/transcriptions", {
92916
- method: "POST",
92917
- headers: {
92918
- Authorization: `Bearer ${this.apiKey}`
92919
- },
92920
- body: form
92921
- });
92922
- if (!response.ok) {
92923
- const errorText = await response.text();
92924
- throw new Error(`Whisper STT failed (${response.status}): ${errorText || response.statusText}`);
92925
- }
92926
- const result = await response.json();
92927
- return {
92928
- text: result.text || "",
92929
- confidence: 1,
92930
- language: result.language
92931
- };
92932
- }
92933
- async startListening() {
92934
- throw new Error("Real-time transcription is not supported. Use VoiceManager.listen().");
92935
- }
92936
- }
92937
-
92938
- class ElevenLabsSTT {
92939
- apiKey;
92940
- model;
92941
- language;
92942
- constructor(options = {}) {
92943
- this.apiKey = options.apiKey || process.env.ELEVENLABS_API_KEY || loadApiKeyFromSecrets2("ELEVENLABS_API_KEY") || "";
92944
- this.model = options.model || "scribe_v2";
92945
- this.language = options.language;
92946
- }
92947
- async transcribe(audioBuffer) {
92948
- if (!this.apiKey) {
92949
- throw new Error("Missing ELEVENLABS_API_KEY for ElevenLabs STT. Set it in env or ~/.secrets.");
92950
- }
92951
- const form = new FormData;
92952
- form.append("file", new Blob([audioBuffer], { type: "audio/wav" }), "audio.wav");
92953
- form.append("model_id", this.model);
92954
- if (this.language) {
92955
- form.append("language_code", this.language);
92956
- }
92957
- const response = await fetch("https://api.elevenlabs.io/v1/speech-to-text", {
92958
- method: "POST",
92959
- headers: {
92960
- "xi-api-key": this.apiKey
92961
- },
92962
- body: form
92963
- });
92964
- if (!response.ok) {
92965
- const errorText = await response.text();
92966
- throw new Error(`ElevenLabs STT failed (${response.status}): ${errorText || response.statusText}`);
92967
- }
92968
- const result = await response.json();
92969
- return {
92970
- text: result.text || "",
92971
- confidence: 1,
92972
- language: result.language_code
92973
- };
92974
- }
92975
- }
92976
-
92977
- class SystemSTT {
92978
- async transcribe(_audioBuffer) {
92979
- throw new Error("System STT is not available yet. Use Whisper STT instead.");
92980
- }
92981
- }
92982
- var init_stt = __esm(() => {
92983
- init_utils4();
92984
- });
92985
-
92986
93377
  // packages/core/src/voice/tts.ts
92987
93378
  import { spawnSync as spawnSync2 } from "child_process";
92988
93379
  import { tmpdir as tmpdir2 } from "os";
@@ -93157,14 +93548,14 @@ class AudioPlayer {
93157
93548
  if (!player) {
93158
93549
  throw new Error("No supported audio player found. Install afplay, ffplay, mpg123, or aplay.");
93159
93550
  }
93160
- await new Promise((resolve5, reject) => {
93551
+ await new Promise((resolve6, reject) => {
93161
93552
  this.playing = true;
93162
93553
  this.currentProcess = spawn(player.command, [...player.args, tempFile], { stdio: "ignore" });
93163
93554
  this.currentProcess.on("close", () => {
93164
93555
  this.playing = false;
93165
93556
  this.currentProcess = null;
93166
93557
  unlink8(tempFile, () => {});
93167
- resolve5();
93558
+ resolve6();
93168
93559
  });
93169
93560
  this.currentProcess.on("error", (error3) => {
93170
93561
  this.playing = false;
@@ -93189,14 +93580,14 @@ class AudioPlayer {
93189
93580
  unlink8(tempFile, () => {});
93190
93581
  throw new Error("No supported audio player found.");
93191
93582
  }
93192
- return new Promise((resolve5, reject) => {
93583
+ return new Promise((resolve6, reject) => {
93193
93584
  this.playing = true;
93194
93585
  this.currentProcess = spawn(player.command, [...player.args, tempFile]);
93195
93586
  this.currentProcess.on("close", () => {
93196
93587
  this.playing = false;
93197
93588
  this.currentProcess = null;
93198
93589
  unlink8(tempFile, () => {});
93199
- resolve5();
93590
+ resolve6();
93200
93591
  });
93201
93592
  this.currentProcess.on("error", (error3) => {
93202
93593
  this.playing = false;
@@ -93269,12 +93660,12 @@ class AudioRecorder {
93269
93660
  if (!recorder) {
93270
93661
  throw new Error("No supported audio recorder found. Install sox or ffmpeg.");
93271
93662
  }
93272
- await new Promise((resolve5, reject) => {
93663
+ await new Promise((resolve6, reject) => {
93273
93664
  this.currentProcess = spawn2(recorder.command, recorder.args, { stdio: "ignore" });
93274
93665
  this.currentProcess.on("close", (code) => {
93275
93666
  this.currentProcess = null;
93276
93667
  if (code === 0 || this.stoppedIntentionally) {
93277
- resolve5();
93668
+ resolve6();
93278
93669
  } else {
93279
93670
  reject(new Error("Audio recording failed."));
93280
93671
  }
@@ -93307,12 +93698,12 @@ class AudioRecorder {
93307
93698
  if (!recorder) {
93308
93699
  return this.record({ ...options, durationSeconds: options.durationSeconds ?? 5 });
93309
93700
  }
93310
- await new Promise((resolve5, reject) => {
93701
+ await new Promise((resolve6, reject) => {
93311
93702
  this.currentProcess = spawn2(recorder.command, recorder.args, { stdio: "ignore" });
93312
93703
  this.currentProcess.on("close", (code) => {
93313
93704
  this.currentProcess = null;
93314
93705
  if (code === 0 || this.stoppedIntentionally) {
93315
- resolve5();
93706
+ resolve6();
93316
93707
  } else {
93317
93708
  reject(new Error("Audio recording failed."));
93318
93709
  }
@@ -93921,6 +94312,7 @@ class AssistantManager {
93921
94312
  name: options.name,
93922
94313
  description: options.description,
93923
94314
  avatar: options.avatar,
94315
+ color: options.color,
93924
94316
  settings: { ...DEFAULT_SETTINGS, ...options.settings || {} },
93925
94317
  createdAt: now2,
93926
94318
  updatedAt: now2
@@ -95120,7 +95512,7 @@ var require_headStream = __commonJS((exports) => {
95120
95512
  if ((0, stream_type_check_1.isReadableStream)(stream)) {
95121
95513
  return (0, headStream_browser_1.headStream)(stream, bytes);
95122
95514
  }
95123
- return new Promise((resolve5, reject) => {
95515
+ return new Promise((resolve6, reject) => {
95124
95516
  const collector = new Collector;
95125
95517
  collector.limit = bytes;
95126
95518
  stream.pipe(collector);
@@ -95131,7 +95523,7 @@ var require_headStream = __commonJS((exports) => {
95131
95523
  collector.on("error", reject);
95132
95524
  collector.on("finish", function() {
95133
95525
  const bytes2 = new Uint8Array(Buffer.concat(this.buffers));
95134
- resolve5(bytes2);
95526
+ resolve6(bytes2);
95135
95527
  });
95136
95528
  });
95137
95529
  };
@@ -95311,21 +95703,21 @@ var require_dist_cjs11 = __commonJS((exports) => {
95311
95703
  let sendBody = true;
95312
95704
  if (!externalAgent && expect === "100-continue") {
95313
95705
  sendBody = await Promise.race([
95314
- new Promise((resolve5) => {
95315
- 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)));
95316
95708
  }),
95317
- new Promise((resolve5) => {
95709
+ new Promise((resolve6) => {
95318
95710
  httpRequest.on("continue", () => {
95319
95711
  timing.clearTimeout(timeoutId);
95320
- resolve5(true);
95712
+ resolve6(true);
95321
95713
  });
95322
95714
  httpRequest.on("response", () => {
95323
95715
  timing.clearTimeout(timeoutId);
95324
- resolve5(false);
95716
+ resolve6(false);
95325
95717
  });
95326
95718
  httpRequest.on("error", () => {
95327
95719
  timing.clearTimeout(timeoutId);
95328
- resolve5(false);
95720
+ resolve6(false);
95329
95721
  });
95330
95722
  })
95331
95723
  ]);
@@ -95392,13 +95784,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95392
95784
  return socketWarningTimestamp;
95393
95785
  }
95394
95786
  constructor(options) {
95395
- this.configProvider = new Promise((resolve5, reject) => {
95787
+ this.configProvider = new Promise((resolve6, reject) => {
95396
95788
  if (typeof options === "function") {
95397
95789
  options().then((_options) => {
95398
- resolve5(this.resolveDefaultConfig(_options));
95790
+ resolve6(this.resolveDefaultConfig(_options));
95399
95791
  }).catch(reject);
95400
95792
  } else {
95401
- resolve5(this.resolveDefaultConfig(options));
95793
+ resolve6(this.resolveDefaultConfig(options));
95402
95794
  }
95403
95795
  });
95404
95796
  }
@@ -95441,7 +95833,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95441
95833
  const config = this.config;
95442
95834
  let writeRequestBodyPromise = undefined;
95443
95835
  const timeouts = [];
95444
- const resolve5 = async (arg) => {
95836
+ const resolve6 = async (arg) => {
95445
95837
  await writeRequestBodyPromise;
95446
95838
  timeouts.forEach(timing.clearTimeout);
95447
95839
  _resolve(arg);
@@ -95507,7 +95899,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95507
95899
  headers: getTransformedHeaders(res.headers),
95508
95900
  body: res
95509
95901
  });
95510
- resolve5({ response: httpResponse });
95902
+ resolve6({ response: httpResponse });
95511
95903
  });
95512
95904
  req.on("error", (err) => {
95513
95905
  if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
@@ -95690,13 +96082,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95690
96082
  return new NodeHttp2Handler(instanceOrOptions);
95691
96083
  }
95692
96084
  constructor(options) {
95693
- this.configProvider = new Promise((resolve5, reject) => {
96085
+ this.configProvider = new Promise((resolve6, reject) => {
95694
96086
  if (typeof options === "function") {
95695
96087
  options().then((opts) => {
95696
- resolve5(opts || {});
96088
+ resolve6(opts || {});
95697
96089
  }).catch(reject);
95698
96090
  } else {
95699
- resolve5(options || {});
96091
+ resolve6(options || {});
95700
96092
  }
95701
96093
  });
95702
96094
  }
@@ -95716,7 +96108,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95716
96108
  return new Promise((_resolve, _reject) => {
95717
96109
  let fulfilled = false;
95718
96110
  let writeRequestBodyPromise = undefined;
95719
- const resolve5 = async (arg) => {
96111
+ const resolve6 = async (arg) => {
95720
96112
  await writeRequestBodyPromise;
95721
96113
  _resolve(arg);
95722
96114
  };
@@ -95772,7 +96164,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95772
96164
  body: req
95773
96165
  });
95774
96166
  fulfilled = true;
95775
- resolve5({ response: httpResponse });
96167
+ resolve6({ response: httpResponse });
95776
96168
  if (disableConcurrentStreams) {
95777
96169
  session.close();
95778
96170
  this.connectionManager.deleteSession(authority, session);
@@ -95850,7 +96242,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95850
96242
  if (isReadableStreamInstance(stream2)) {
95851
96243
  return collectReadableStream(stream2);
95852
96244
  }
95853
- return new Promise((resolve5, reject) => {
96245
+ return new Promise((resolve6, reject) => {
95854
96246
  const collector = new Collector;
95855
96247
  stream2.pipe(collector);
95856
96248
  stream2.on("error", (err) => {
@@ -95860,7 +96252,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
95860
96252
  collector.on("error", reject);
95861
96253
  collector.on("finish", function() {
95862
96254
  const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
95863
- resolve5(bytes);
96255
+ resolve6(bytes);
95864
96256
  });
95865
96257
  });
95866
96258
  };
@@ -95901,7 +96293,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
95901
96293
  return new Request(url, requestOptions);
95902
96294
  }
95903
96295
  function requestTimeout(timeoutInMs = 0) {
95904
- return new Promise((resolve5, reject) => {
96296
+ return new Promise((resolve6, reject) => {
95905
96297
  if (timeoutInMs) {
95906
96298
  setTimeout(() => {
95907
96299
  const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
@@ -96018,7 +96410,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96018
96410
  requestTimeout(requestTimeoutInMs)
96019
96411
  ];
96020
96412
  if (abortSignal) {
96021
- raceOfPromises.push(new Promise((resolve5, reject) => {
96413
+ raceOfPromises.push(new Promise((resolve6, reject) => {
96022
96414
  const onAbort = () => {
96023
96415
  const abortError = new Error("Request aborted");
96024
96416
  abortError.name = "AbortError";
@@ -96082,7 +96474,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96082
96474
  return collected;
96083
96475
  }
96084
96476
  function readToBase64(blob) {
96085
- return new Promise((resolve5, reject) => {
96477
+ return new Promise((resolve6, reject) => {
96086
96478
  const reader = new FileReader;
96087
96479
  reader.onloadend = () => {
96088
96480
  if (reader.readyState !== 2) {
@@ -96091,7 +96483,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
96091
96483
  const result = reader.result ?? "";
96092
96484
  const commaIndex = result.indexOf(",");
96093
96485
  const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
96094
- resolve5(result.substring(dataOffset));
96486
+ resolve6(result.substring(dataOffset));
96095
96487
  };
96096
96488
  reader.onabort = () => reject(new Error("Read aborted"));
96097
96489
  reader.onerror = () => reject(reader.error);
@@ -97190,11 +97582,11 @@ var require_tslib = __commonJS((exports, module) => {
97190
97582
  };
97191
97583
  __awaiter = function(thisArg, _arguments, P, generator) {
97192
97584
  function adopt(value) {
97193
- return value instanceof P ? value : new P(function(resolve5) {
97194
- resolve5(value);
97585
+ return value instanceof P ? value : new P(function(resolve6) {
97586
+ resolve6(value);
97195
97587
  });
97196
97588
  }
97197
- return new (P || (P = Promise))(function(resolve5, reject) {
97589
+ return new (P || (P = Promise))(function(resolve6, reject) {
97198
97590
  function fulfilled(value) {
97199
97591
  try {
97200
97592
  step(generator.next(value));
@@ -97210,7 +97602,7 @@ var require_tslib = __commonJS((exports, module) => {
97210
97602
  }
97211
97603
  }
97212
97604
  function step(result) {
97213
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
97605
+ result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
97214
97606
  }
97215
97607
  step((generator = generator.apply(thisArg, _arguments || [])).next());
97216
97608
  });
@@ -97439,14 +97831,14 @@ var require_tslib = __commonJS((exports, module) => {
97439
97831
  }, i);
97440
97832
  function verb(n) {
97441
97833
  i[n] = o[n] && function(v) {
97442
- return new Promise(function(resolve5, reject) {
97443
- 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);
97444
97836
  });
97445
97837
  };
97446
97838
  }
97447
- function settle(resolve5, reject, d, v) {
97839
+ function settle(resolve6, reject, d, v) {
97448
97840
  Promise.resolve(v).then(function(v2) {
97449
- resolve5({ value: v2, done: d });
97841
+ resolve6({ value: v2, done: d });
97450
97842
  }, reject);
97451
97843
  }
97452
97844
  };
@@ -109754,7 +110146,7 @@ var require_dist_cjs39 = __commonJS((exports) => {
109754
110146
  this.refillTokenBucket();
109755
110147
  if (amount > this.currentCapacity) {
109756
110148
  const delay = (amount - this.currentCapacity) / this.fillRate * 1000;
109757
- await new Promise((resolve5) => DefaultRateLimiter.setTimeoutFn(resolve5, delay));
110149
+ await new Promise((resolve6) => DefaultRateLimiter.setTimeoutFn(resolve6, delay));
109758
110150
  }
109759
110151
  this.currentCapacity = this.currentCapacity - amount;
109760
110152
  }
@@ -110087,7 +110479,7 @@ var require_dist_cjs40 = __commonJS((exports) => {
110087
110479
  const delayFromResponse = getDelayFromRetryAfterHeader(err.$response);
110088
110480
  const delay = Math.max(delayFromResponse || 0, delayFromDecider);
110089
110481
  totalDelay += delay;
110090
- await new Promise((resolve5) => setTimeout(resolve5, delay));
110482
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
110091
110483
  continue;
110092
110484
  }
110093
110485
  if (!err.$metadata) {
@@ -110246,7 +110638,7 @@ var require_dist_cjs40 = __commonJS((exports) => {
110246
110638
  attempts = retryToken.getRetryCount();
110247
110639
  const delay = retryToken.getRetryDelay();
110248
110640
  totalRetryDelay += delay;
110249
- await new Promise((resolve5) => setTimeout(resolve5, delay));
110641
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
110250
110642
  }
110251
110643
  }
110252
110644
  } else {
@@ -115307,7 +115699,7 @@ var init_dist_es9 = __esm(() => {
115307
115699
  import { Buffer as Buffer3 } from "buffer";
115308
115700
  import { request } from "http";
115309
115701
  function httpRequest(options) {
115310
- return new Promise((resolve5, reject) => {
115702
+ return new Promise((resolve6, reject) => {
115311
115703
  const req = request({
115312
115704
  method: "GET",
115313
115705
  ...options,
@@ -115332,7 +115724,7 @@ function httpRequest(options) {
115332
115724
  chunks.push(chunk);
115333
115725
  });
115334
115726
  res.on("end", () => {
115335
- resolve5(Buffer3.concat(chunks));
115727
+ resolve6(Buffer3.concat(chunks));
115336
115728
  req.destroy();
115337
115729
  });
115338
115730
  });
@@ -115793,7 +116185,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
115793
116185
  try {
115794
116186
  return await toRetry();
115795
116187
  } catch (e2) {
115796
- await new Promise((resolve5) => setTimeout(resolve5, delayMs));
116188
+ await new Promise((resolve6) => setTimeout(resolve6, delayMs));
115797
116189
  }
115798
116190
  }
115799
116191
  return await toRetry();
@@ -121550,7 +121942,7 @@ var require_signin = __commonJS((exports) => {
121550
121942
  // node_modules/.bun/@aws-sdk+credential-provider-login@3.972.5/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
121551
121943
  import { createHash as createHash4, createPrivateKey, createPublicKey, sign } from "crypto";
121552
121944
  import { promises as fs2 } from "fs";
121553
- import { homedir as homedir15 } from "os";
121945
+ import { homedir as homedir16 } from "os";
121554
121946
  import { dirname as dirname16, join as join37 } from "path";
121555
121947
  var import_property_provider18, import_protocol_http11, import_shared_ini_file_loader6, LoginCredentialsFetcher;
121556
121948
  var init_LoginCredentialsFetcher = __esm(() => {
@@ -121711,7 +122103,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
121711
122103
  await fs2.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
121712
122104
  }
121713
122105
  getTokenFilePath() {
121714
- 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");
121715
122107
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
121716
122108
  const loginSessionSha256 = createHash4("sha256").update(loginSessionBytes).digest("hex");
121717
122109
  return join37(directory, `${loginSessionSha256}.json`);
@@ -122819,7 +123211,7 @@ async function* readabletoIterable(readStream) {
122819
123211
  streamEnded = true;
122820
123212
  });
122821
123213
  while (!generationEnded) {
122822
- const value = await new Promise((resolve5) => setTimeout(() => resolve5(records.shift()), 0));
123214
+ const value = await new Promise((resolve6) => setTimeout(() => resolve6(records.shift()), 0));
122823
123215
  if (value) {
122824
123216
  yield value;
122825
123217
  }
@@ -122895,14 +123287,14 @@ var readableStreamHasher = (hashCtor, readableStream) => {
122895
123287
  const hash = new hashCtor;
122896
123288
  const hashCalculator = new HashCalculator(hash);
122897
123289
  readableStream.pipe(hashCalculator);
122898
- return new Promise((resolve5, reject) => {
123290
+ return new Promise((resolve6, reject) => {
122899
123291
  readableStream.on("error", (err) => {
122900
123292
  hashCalculator.end();
122901
123293
  reject(err);
122902
123294
  });
122903
123295
  hashCalculator.on("error", reject);
122904
123296
  hashCalculator.on("finish", () => {
122905
- hash.digest().then(resolve5).catch(reject);
123297
+ hash.digest().then(resolve6).catch(reject);
122906
123298
  });
122907
123299
  });
122908
123300
  };
@@ -125555,7 +125947,7 @@ var getCircularReplacer = () => {
125555
125947
 
125556
125948
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/utils/sleep.js
125557
125949
  var sleep5 = (seconds) => {
125558
- return new Promise((resolve5) => setTimeout(resolve5, seconds * 1000));
125950
+ return new Promise((resolve6) => setTimeout(resolve6, seconds * 1000));
125559
125951
  };
125560
125952
 
125561
125953
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/waiter.js
@@ -125673,8 +126065,8 @@ var init_utils5 = () => {};
125673
126065
  // node_modules/.bun/@smithy+util-waiter@4.2.8/node_modules/@smithy/util-waiter/dist-es/createWaiter.js
125674
126066
  var abortTimeout = (abortSignal) => {
125675
126067
  let onAbort;
125676
- const promise = new Promise((resolve5) => {
125677
- onAbort = () => resolve5({ state: WaiterState.ABORTED });
126068
+ const promise = new Promise((resolve6) => {
126069
+ onAbort = () => resolve6({ state: WaiterState.ABORTED });
125678
126070
  if (typeof abortSignal.addEventListener === "function") {
125679
126071
  abortSignal.addEventListener("abort", onAbort);
125680
126072
  } else {
@@ -136186,8 +136578,8 @@ var require_simple_parser2 = __commonJS((exports, module) => {
136186
136578
  }
136187
136579
  let promise;
136188
136580
  if (!callback) {
136189
- promise = new Promise((resolve5, reject) => {
136190
- callback = callbackPromise(resolve5, reject);
136581
+ promise = new Promise((resolve6, reject) => {
136582
+ callback = callbackPromise(resolve6, reject);
136191
136583
  });
136192
136584
  }
136193
136585
  options = options || {};
@@ -136273,13 +136665,13 @@ var require_simple_parser2 = __commonJS((exports, module) => {
136273
136665
  }
136274
136666
  return promise;
136275
136667
  };
136276
- function callbackPromise(resolve5, reject) {
136668
+ function callbackPromise(resolve6, reject) {
136277
136669
  return function(...args) {
136278
136670
  let err = args.shift();
136279
136671
  if (err) {
136280
136672
  reject(err);
136281
136673
  } else {
136282
- resolve5(...args);
136674
+ resolve6(...args);
136283
136675
  }
136284
136676
  };
136285
136677
  }
@@ -137084,11 +137476,11 @@ var require_dist = __commonJS((exports) => {
137084
137476
  var require_request = __commonJS((exports) => {
137085
137477
  var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P2, generator) {
137086
137478
  function adopt(value) {
137087
- return value instanceof P2 ? value : new P2(function(resolve5) {
137088
- resolve5(value);
137479
+ return value instanceof P2 ? value : new P2(function(resolve6) {
137480
+ resolve6(value);
137089
137481
  });
137090
137482
  }
137091
- return new (P2 || (P2 = Promise))(function(resolve5, reject) {
137483
+ return new (P2 || (P2 = Promise))(function(resolve6, reject) {
137092
137484
  function fulfilled(value) {
137093
137485
  try {
137094
137486
  step(generator.next(value));
@@ -137104,7 +137496,7 @@ var require_request = __commonJS((exports) => {
137104
137496
  }
137105
137497
  }
137106
137498
  function step(result) {
137107
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
137499
+ result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
137108
137500
  }
137109
137501
  step((generator = generator.apply(thisArg, _arguments || [])).next());
137110
137502
  });
@@ -137234,7 +137626,7 @@ var require_request = __commonJS((exports) => {
137234
137626
  }
137235
137627
  function sendWithRetry(url, init, retryScheduleInMs, nextInterval = 50, triesLeft = 2, fetchImpl = fetch, retryCount = 1) {
137236
137628
  return __awaiter2(this, undefined, undefined, function* () {
137237
- const sleep7 = (interval) => new Promise((resolve5) => setTimeout(resolve5, interval));
137629
+ const sleep7 = (interval) => new Promise((resolve6) => setTimeout(resolve6, interval));
137238
137630
  try {
137239
137631
  const response = yield fetchImpl(url, init);
137240
137632
  if (triesLeft <= 0 || response.status < 500) {
@@ -149096,14 +149488,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149096
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. ");
149097
149489
  actScopeDepth = prevActScopeDepth;
149098
149490
  }
149099
- function recursivelyFlushAsyncActWork(returnValue, resolve5, reject) {
149491
+ function recursivelyFlushAsyncActWork(returnValue, resolve6, reject) {
149100
149492
  var queue = ReactSharedInternals.actQueue;
149101
149493
  if (queue !== null)
149102
149494
  if (queue.length !== 0)
149103
149495
  try {
149104
149496
  flushActQueue(queue);
149105
149497
  enqueueTask(function() {
149106
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
149498
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
149107
149499
  });
149108
149500
  return;
149109
149501
  } catch (error3) {
@@ -149111,7 +149503,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149111
149503
  }
149112
149504
  else
149113
149505
  ReactSharedInternals.actQueue = null;
149114
- 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);
149115
149507
  }
149116
149508
  function flushActQueue(queue) {
149117
149509
  if (!isFlushing) {
@@ -149287,14 +149679,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149287
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 () => ...);"));
149288
149680
  });
149289
149681
  return {
149290
- then: function(resolve5, reject) {
149682
+ then: function(resolve6, reject) {
149291
149683
  didAwaitActCall = true;
149292
149684
  thenable.then(function(returnValue) {
149293
149685
  popActScope(prevActQueue, prevActScopeDepth);
149294
149686
  if (prevActScopeDepth === 0) {
149295
149687
  try {
149296
149688
  flushActQueue(queue), enqueueTask(function() {
149297
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
149689
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
149298
149690
  });
149299
149691
  } catch (error$0) {
149300
149692
  ReactSharedInternals.thrownErrors.push(error$0);
@@ -149305,7 +149697,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149305
149697
  reject(_thrownError);
149306
149698
  }
149307
149699
  } else
149308
- resolve5(returnValue);
149700
+ resolve6(returnValue);
149309
149701
  }, function(error3) {
149310
149702
  popActScope(prevActQueue, prevActScopeDepth);
149311
149703
  0 < ReactSharedInternals.thrownErrors.length ? (error3 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error3)) : reject(error3);
@@ -149321,11 +149713,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
149321
149713
  if (0 < ReactSharedInternals.thrownErrors.length)
149322
149714
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
149323
149715
  return {
149324
- then: function(resolve5, reject) {
149716
+ then: function(resolve6, reject) {
149325
149717
  didAwaitActCall = true;
149326
149718
  prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
149327
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve5, reject);
149328
- })) : resolve5(returnValue$jscomp$0);
149719
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve6, reject);
149720
+ })) : resolve6(returnValue$jscomp$0);
149329
149721
  }
149330
149722
  };
149331
149723
  };
@@ -160593,7 +160985,7 @@ var React, ReactDOM, REACT_ELEMENT_TYPE, REACT_PORTAL_TYPE, REACT_FRAGMENT_TYPE,
160593
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=
160594
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=
160595
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) {
160596
- return new Promise(function(resolve5, reject) {
160988
+ return new Promise(function(resolve6, reject) {
160597
160989
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
160598
160990
  onAllReady = res;
160599
160991
  onFatalError = rej;
@@ -160623,7 +161015,7 @@ $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))
160623
161015
  }
160624
161016
  }, { highWaterMark: 2048 });
160625
161017
  stream.allReady = allReady;
160626
- resolve5(stream);
161018
+ resolve6(stream);
160627
161019
  }, function(error3) {
160628
161020
  allReady.catch(function() {});
160629
161021
  reject(error3);
@@ -167280,7 +167672,7 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167280
167672
  }
167281
167673
  return a4;
167282
167674
  }, __spreadProps = (a4, b7) => __defProps(a4, __getOwnPropDescs(b7)), __async = (__this, __arguments, generator) => {
167283
- return new Promise((resolve5, reject) => {
167675
+ return new Promise((resolve6, reject) => {
167284
167676
  var fulfilled = (value) => {
167285
167677
  try {
167286
167678
  step(generator.next(value));
@@ -167295,7 +167687,7 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167295
167687
  reject(e5);
167296
167688
  }
167297
167689
  };
167298
- 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);
167299
167691
  step((generator = generator.apply(__this, __arguments)).next());
167300
167692
  });
167301
167693
  }, plainTextSelectors, modifiedHtml, defaults2, pretty = (str2, options = {}) => {
@@ -167317,10 +167709,10 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167317
167709
  }
167318
167710
  });
167319
167711
  stream.pipe(writable);
167320
- yield new Promise((resolve5, reject) => {
167712
+ yield new Promise((resolve6, reject) => {
167321
167713
  writable.on("error", reject);
167322
167714
  writable.on("close", () => {
167323
- resolve5();
167715
+ resolve6();
167324
167716
  });
167325
167717
  });
167326
167718
  }
@@ -167332,12 +167724,12 @@ var import_react, import_jsx_runtime, __defProp2, __defProps, __getOwnPropDescs,
167332
167724
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
167333
167725
  html2 = yield readStream(yield reactDOMServer.renderToReadableStream(suspendedElement));
167334
167726
  } else {
167335
- yield new Promise((resolve5, reject) => {
167727
+ yield new Promise((resolve6, reject) => {
167336
167728
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
167337
167729
  onAllReady() {
167338
167730
  return __async(this, null, function* () {
167339
167731
  html2 = yield readStream(stream);
167340
- resolve5();
167732
+ resolve6();
167341
167733
  });
167342
167734
  },
167343
167735
  onError(error3) {
@@ -170904,12 +171296,12 @@ var init_secrets_client = __esm(() => {
170904
171296
  // packages/core/src/wallet/storage/local-client.ts
170905
171297
  import { dirname as dirname17, join as join40 } from "path";
170906
171298
  import { existsSync as existsSync26, mkdirSync as mkdirSync17, readFileSync as readFileSync18 } from "fs";
170907
- import { homedir as homedir16 } from "os";
171299
+ import { homedir as homedir17 } from "os";
170908
171300
 
170909
171301
  class LocalWalletClient {
170910
171302
  baseDir;
170911
171303
  constructor(options = {}) {
170912
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir16();
171304
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir17();
170913
171305
  this.baseDir = options.baseDir || join40(envHome, ".assistants");
170914
171306
  }
170915
171307
  getWalletFilePath(assistantId) {
@@ -171778,12 +172170,12 @@ var init_secrets_client2 = __esm(() => {
171778
172170
  // packages/core/src/secrets/storage/local-client.ts
171779
172171
  import { dirname as dirname18, join as join41 } from "path";
171780
172172
  import { existsSync as existsSync27, mkdirSync as mkdirSync18, readFileSync as readFileSync19 } from "fs";
171781
- import { homedir as homedir17 } from "os";
172173
+ import { homedir as homedir18 } from "os";
171782
172174
 
171783
172175
  class LocalSecretsClient {
171784
172176
  baseDir;
171785
172177
  constructor(options = {}) {
171786
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir17();
172178
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir18();
171787
172179
  this.baseDir = options.baseDir || join41(envHome, ".assistants");
171788
172180
  }
171789
172181
  getScopeFilePath(scope, assistantId) {
@@ -172386,11 +172778,11 @@ var init_secrets = __esm(() => {
172386
172778
 
172387
172779
  // packages/core/src/messages/storage/local-storage.ts
172388
172780
  import { join as join42 } from "path";
172389
- import { homedir as homedir18 } from "os";
172781
+ import { homedir as homedir19 } from "os";
172390
172782
  import { mkdir as mkdir13, readdir as readdir5, rm as rm5, open as open4, readFile as readFile16 } from "fs/promises";
172391
172783
  function getMessagesBasePath() {
172392
172784
  const envOverride = process.env.ASSISTANTS_DIR;
172393
- const home = envOverride && envOverride.trim() ? envOverride : homedir18();
172785
+ const home = envOverride && envOverride.trim() ? envOverride : homedir19();
172394
172786
  return join42(home, ".assistants", "messages");
172395
172787
  }
172396
172788
 
@@ -173688,11 +174080,11 @@ var init_messages5 = __esm(async () => {
173688
174080
 
173689
174081
  // packages/core/src/webhooks/storage/local-storage.ts
173690
174082
  import { join as join44 } from "path";
173691
- import { homedir as homedir19 } from "os";
174083
+ import { homedir as homedir20 } from "os";
173692
174084
  import { mkdir as mkdir14, readdir as readdir6, rm as rm6 } from "fs/promises";
173693
174085
  function getWebhooksBasePath() {
173694
174086
  const envOverride = process.env.ASSISTANTS_DIR;
173695
- const home = envOverride && envOverride.trim() ? envOverride : homedir19();
174087
+ const home = envOverride && envOverride.trim() ? envOverride : homedir20();
173696
174088
  return join44(home, ".assistants", "webhooks");
173697
174089
  }
173698
174090
 
@@ -176570,8 +176962,8 @@ class ChannelAgentPool {
176570
176962
  this.clientFactory = options?.clientFactory;
176571
176963
  }
176572
176964
  async triggerResponses(channelName, personName, message, channelMembers, excludeAssistantId) {
176573
- return new Promise((resolve5, reject) => {
176574
- 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 });
176575
176967
  this.drainQueue();
176576
176968
  });
176577
176969
  }
@@ -178071,7 +178463,12 @@ class TwilioClient {
178071
178463
  body.append("To", params.to);
178072
178464
  body.append("From", params.from);
178073
178465
  if (params.url) {
178074
- 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);
178075
178472
  } else if (params.twiml) {
178076
178473
  body.append("Twiml", params.twiml);
178077
178474
  }
@@ -178253,7 +178650,8 @@ class CallManager {
178253
178650
  connecting: ["ringing", "active", "ending"],
178254
178651
  ringing: ["bridging", "active", "ending"],
178255
178652
  bridging: ["active", "ending"],
178256
- active: ["ending"],
178653
+ active: ["on-hold", "ending"],
178654
+ "on-hold": ["active", "ending"],
178257
178655
  ending: []
178258
178656
  };
178259
178657
  if (!validTransitions[call.state].includes(state)) {
@@ -178501,7 +178899,7 @@ class BridgeConnection {
178501
178899
  }
178502
178900
  async connect() {
178503
178901
  const url = `${ELEVENLABS_WS_BASE}?agent_id=${this.config.elevenLabsAgentId}`;
178504
- return new Promise((resolve5, reject) => {
178902
+ return new Promise((resolve6, reject) => {
178505
178903
  try {
178506
178904
  this.elevenLabsWs = new WebSocket(url, {
178507
178905
  headers: {
@@ -178510,7 +178908,7 @@ class BridgeConnection {
178510
178908
  });
178511
178909
  this.elevenLabsWs.onopen = () => {
178512
178910
  this.state = "active";
178513
- resolve5();
178911
+ resolve6();
178514
178912
  };
178515
178913
  this.elevenLabsWs.onmessage = (event) => {
178516
178914
  this.handleElevenLabsMessage(event.data);
@@ -178597,6 +178995,129 @@ var init_voice_bridge = __esm(() => {
178597
178995
  init_src2();
178598
178996
  });
178599
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
+
178600
179121
  // packages/core/src/telephony/manager.ts
178601
179122
  class TelephonyManager {
178602
179123
  assistantId;
@@ -178606,6 +179127,7 @@ class TelephonyManager {
178606
179127
  twilioClient = null;
178607
179128
  callManager;
178608
179129
  voiceBridge = null;
179130
+ streamServer = null;
178609
179131
  constructor(options) {
178610
179132
  this.assistantId = options.assistantId;
178611
179133
  this.assistantName = options.assistantName;
@@ -178712,7 +179234,7 @@ class TelephonyManager {
178712
179234
  id: log3.id
178713
179235
  };
178714
179236
  }
178715
- async makeCall(to3, from) {
179237
+ async makeCall(to3, from, firstMessage) {
178716
179238
  if (!this.twilioClient) {
178717
179239
  return {
178718
179240
  success: false,
@@ -178738,7 +179260,8 @@ class TelephonyManager {
178738
179260
  from: fromNumber,
178739
179261
  url: `${webhookUrl}/api/v1/telephony/webhooks/voice`,
178740
179262
  statusCallback: `${webhookUrl}/api/v1/telephony/webhooks/voice-status`,
178741
- record: this.config.voice?.recordCalls
179263
+ record: this.config.voice?.recordCalls,
179264
+ firstMessage
178742
179265
  });
178743
179266
  if (!result.success) {
178744
179267
  return { success: false, message: `Failed to make call: ${result.error}` };
@@ -178766,6 +179289,120 @@ class TelephonyManager {
178766
179289
  id: log3.id
178767
179290
  };
178768
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
+ }
178769
179406
  getCallHistory(options) {
178770
179407
  const scope = options?.scope ?? "assistant";
178771
179408
  return this.store.listCallLogs({
@@ -178937,6 +179574,7 @@ class TelephonyManager {
178937
179574
  return this.store.cleanup(maxAgeDays, maxCallLogs, maxSmsLogs);
178938
179575
  }
178939
179576
  close() {
179577
+ this.stopStreamServer();
178940
179578
  this.callManager.endAllCalls();
178941
179579
  this.voiceBridge?.closeAll();
178942
179580
  this.store.close();
@@ -178974,7 +179612,7 @@ var init_manager8 = __esm(async () => {
178974
179612
  });
178975
179613
 
178976
179614
  // packages/core/src/telephony/tools.ts
178977
- function createTelephonyToolExecutors(getTelephonyManager) {
179615
+ function createTelephonyToolExecutors(getTelephonyManager, getContactsManager) {
178978
179616
  return {
178979
179617
  telephony_send_sms: async (input) => {
178980
179618
  const manager = getTelephonyManager();
@@ -179011,11 +179649,27 @@ function createTelephonyToolExecutors(getTelephonyManager) {
179011
179649
  if (!manager) {
179012
179650
  return "Error: Telephony is not enabled. Set telephony.enabled: true in config.";
179013
179651
  }
179014
- 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
+ }
179015
179668
  if (!to3)
179016
- return "Error: Phone number (to) is required.";
179669
+ return "Error: Phone number (to) or contact_name is required.";
179017
179670
  const from = input.from ? String(input.from).trim() : undefined;
179018
- 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);
179019
179673
  return result.success ? result.message : `Error: ${result.message}`;
179020
179674
  },
179021
179675
  telephony_call_history: async (input) => {
@@ -179164,17 +179818,68 @@ function createTelephonyToolExecutors(getTelephonyManager) {
179164
179818
  lines.push(`Recent calls: ${status.recentCalls}`);
179165
179819
  lines.push(`Recent messages: ${status.recentMessages}`);
179166
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(`
179167
179872
  `);
179168
179873
  }
179169
179874
  };
179170
179875
  }
179171
- function registerTelephonyTools(registry, getTelephonyManager) {
179172
- const executors = createTelephonyToolExecutors(getTelephonyManager);
179876
+ function registerTelephonyTools(registry, getTelephonyManager, getContactsManager) {
179877
+ const executors = createTelephonyToolExecutors(getTelephonyManager, getContactsManager);
179173
179878
  for (const tool of telephonyTools) {
179174
179879
  registry.register(tool, executors[tool.name]);
179175
179880
  }
179176
179881
  }
179177
- 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;
179178
179883
  var init_tools12 = __esm(() => {
179179
179884
  telephonySendSmsTool = {
179180
179885
  name: "telephony_send_sms",
@@ -179222,20 +179927,28 @@ var init_tools12 = __esm(() => {
179222
179927
  };
179223
179928
  telephonyCallTool = {
179224
179929
  name: "telephony_call",
179225
- 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.",
179226
179931
  parameters: {
179227
179932
  type: "object",
179228
179933
  properties: {
179229
179934
  to: {
179230
179935
  type: "string",
179231
- 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."
179232
179941
  },
179233
179942
  from: {
179234
179943
  type: "string",
179235
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)"
179236
179949
  }
179237
179950
  },
179238
- required: ["to"]
179951
+ required: []
179239
179952
  }
179240
179953
  };
179241
179954
  telephonyCallHistoryTool = {
@@ -179325,6 +180038,57 @@ var init_tools12 = __esm(() => {
179325
180038
  required: []
179326
180039
  }
179327
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
+ };
179328
180092
  telephonyTools = [
179329
180093
  telephonySendSmsTool,
179330
180094
  telephonySendWhatsappTool,
@@ -179333,7 +180097,11 @@ var init_tools12 = __esm(() => {
179333
180097
  telephonySmsHistoryTool,
179334
180098
  telephonyPhoneNumbersTool,
179335
180099
  telephonyRoutingRulesTool,
179336
- telephonyStatusTool
180100
+ telephonyStatusTool,
180101
+ telephonyHoldTool,
180102
+ telephonyResumeTool,
180103
+ telephonyEndCallTool,
180104
+ telephonyActiveCallsTool
179337
180105
  ];
179338
180106
  });
179339
180107
 
@@ -181604,13 +182372,13 @@ var init_contacts = __esm(async () => {
181604
182372
 
181605
182373
  // packages/core/src/sessions/store.ts
181606
182374
  import { join as join52 } from "path";
181607
- import { homedir as homedir20 } from "os";
182375
+ import { homedir as homedir21 } from "os";
181608
182376
  import { existsSync as existsSync35, mkdirSync as mkdirSync23, writeFileSync as writeFileSync15, readFileSync as readFileSync20, readdirSync as readdirSync10, unlinkSync as unlinkSync5 } from "fs";
181609
182377
 
181610
182378
  class SessionStore {
181611
182379
  basePath;
181612
182380
  constructor(basePath) {
181613
- const envHome = process.env.HOME || process.env.USERPROFILE || homedir20();
182381
+ const envHome = process.env.HOME || process.env.USERPROFILE || homedir21();
181614
182382
  this.basePath = basePath || join52(envHome, ".assistants", "sessions");
181615
182383
  this.ensureDir();
181616
182384
  }
@@ -187468,12 +188236,12 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
187468
188236
  return resultWithId;
187469
188237
  }
187470
188238
  createTimeout(ms2, runner, subassistantId) {
187471
- return new Promise((resolve5) => {
188239
+ return new Promise((resolve6) => {
187472
188240
  const timerId = setTimeout(() => {
187473
188241
  this.activeTimeouts.delete(subassistantId);
187474
188242
  this.activeRunners.delete(subassistantId);
187475
188243
  runner.stop();
187476
- resolve5({
188244
+ resolve6({
187477
188245
  success: false,
187478
188246
  error: `Subassistant timed out after ${Math.round(ms2 / 1000)} seconds`,
187479
188247
  turns: 0,
@@ -187492,7 +188260,7 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
187492
188260
  }
187493
188261
  }
187494
188262
  sleep(ms2) {
187495
- return new Promise((resolve5) => setTimeout(resolve5, ms2));
188263
+ return new Promise((resolve6) => setTimeout(resolve6, ms2));
187496
188264
  }
187497
188265
  }
187498
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;
@@ -187843,7 +188611,7 @@ var init_resolver = __esm(() => {
187843
188611
  // packages/core/src/capabilities/storage.ts
187844
188612
  import { existsSync as existsSync38, mkdirSync as mkdirSync26, readFileSync as readFileSync21, writeFileSync as writeFileSync16 } from "fs";
187845
188613
  import { join as join55, dirname as dirname26 } from "path";
187846
- import { homedir as homedir21 } from "os";
188614
+ import { homedir as homedir22 } from "os";
187847
188615
 
187848
188616
  class CapabilityStorage {
187849
188617
  config;
@@ -187858,7 +188626,7 @@ class CapabilityStorage {
187858
188626
  if (this.config.storagePath) {
187859
188627
  return this.config.storagePath;
187860
188628
  }
187861
- const home = process.env.HOME || process.env.USERPROFILE || homedir21();
188629
+ const home = process.env.HOME || process.env.USERPROFILE || homedir22();
187862
188630
  return join55(home, ".assistants", "capabilities", "store.json");
187863
188631
  }
187864
188632
  load() {
@@ -188363,6 +189131,7 @@ var init_loop = __esm(async () => {
188363
189131
  init_filesystem(),
188364
189132
  init_feedback(),
188365
189133
  init_scheduler(),
189134
+ init_audio2(),
188366
189135
  init_skills(),
188367
189136
  init_subagent(),
188368
189137
  init_executor2(),
@@ -188619,6 +189388,7 @@ var init_loop = __esm(async () => {
188619
189388
  FilesystemTools.registerAll(this.toolRegistry, this.sessionId);
188620
189389
  WebTools.registerAll(this.toolRegistry);
188621
189390
  ImageTools.registerAll(this.toolRegistry);
189391
+ AudioTools.registerAll(this.toolRegistry);
188622
189392
  this.toolRegistry.register(SkillTool.tool, SkillTool.executor);
188623
189393
  const skillListTool = createSkillListTool(() => this.skillLoader);
188624
189394
  this.toolRegistry.register(skillListTool.tool, skillListTool.executor);
@@ -188702,7 +189472,13 @@ var init_loop = __esm(async () => {
188702
189472
  const assistantId = assistant?.id || this.sessionId;
188703
189473
  const assistantName = assistant?.name || "assistant";
188704
189474
  this.telephonyManager = createTelephonyManager(assistantId, assistantName, this.config.telephony);
188705
- 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
+ }
188706
189482
  }
188707
189483
  if (this.config?.orders?.enabled) {
188708
189484
  const assistant = this.assistantManager?.getActive();
@@ -189209,8 +189985,8 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
189209
189985
  this.emit({ type: "text", content: `
189210
189986
  [Agent paused - budget exceeded. Use /budgets resume to continue.]
189211
189987
  ` });
189212
- await new Promise((resolve5) => {
189213
- this.pauseResolve = resolve5;
189988
+ await new Promise((resolve6) => {
189989
+ this.pauseResolve = resolve6;
189214
189990
  });
189215
189991
  this.pauseResolve = null;
189216
189992
  if (this.shouldStop)
@@ -190590,7 +191366,7 @@ ${effects.message}
190590
191366
  const delay = this.energyEffects?.processingDelayMs ?? 0;
190591
191367
  if (delay <= 0)
190592
191368
  return;
190593
- await new Promise((resolve5) => setTimeout(resolve5, delay));
191369
+ await new Promise((resolve6) => setTimeout(resolve6, delay));
190594
191370
  }
190595
191371
  applyEnergyPersonality(systemPrompt) {
190596
191372
  if (!systemPrompt)
@@ -191368,7 +192144,7 @@ class StatsTracker {
191368
192144
 
191369
192145
  // packages/core/src/tools/connector-index.ts
191370
192146
  import { join as join57, dirname as dirname27 } from "path";
191371
- import { homedir as homedir22 } from "os";
192147
+ import { homedir as homedir23 } from "os";
191372
192148
  import { existsSync as existsSync39, mkdirSync as mkdirSync27, writeFileSync as writeFileSync17, readFileSync as readFileSync22 } from "fs";
191373
192149
  var TAG_KEYWORDS, INDEX_VERSION = 1, INDEX_TTL_MS, ConnectorIndex;
191374
192150
  var init_connector_index = __esm(() => {
@@ -191403,7 +192179,7 @@ var init_connector_index = __esm(() => {
191403
192179
  }
191404
192180
  getHomeDir() {
191405
192181
  const envHome = process.env.HOME || process.env.USERPROFILE;
191406
- return envHome && envHome.trim().length > 0 ? envHome : homedir22();
192182
+ return envHome && envHome.trim().length > 0 ? envHome : homedir23();
191407
192183
  }
191408
192184
  getCachePath() {
191409
192185
  return join57(this.getHomeDir(), ".assistants", "cache", "connector-index.json");
@@ -192358,9 +193134,13 @@ __export(exports_src3, {
192358
193134
  telephonySendWhatsappTool: () => telephonySendWhatsappTool,
192359
193135
  telephonySendSmsTool: () => telephonySendSmsTool,
192360
193136
  telephonyRoutingRulesTool: () => telephonyRoutingRulesTool,
193137
+ telephonyResumeTool: () => telephonyResumeTool,
192361
193138
  telephonyPhoneNumbersTool: () => telephonyPhoneNumbersTool,
193139
+ telephonyHoldTool: () => telephonyHoldTool,
193140
+ telephonyEndCallTool: () => telephonyEndCallTool,
192362
193141
  telephonyCallTool: () => telephonyCallTool,
192363
193142
  telephonyCallHistoryTool: () => telephonyCallHistoryTool,
193143
+ telephonyActiveCallsTool: () => telephonyActiveCallsTool,
192364
193144
  tasksStatusTool: () => tasksStatusTool,
192365
193145
  tasksNextTool: () => tasksNextTool,
192366
193146
  tasksListTool: () => tasksListTool,
@@ -192377,6 +193157,7 @@ __export(exports_src3, {
192377
193157
  storesGetTool: () => storesGetTool,
192378
193158
  storesAddTool: () => storesAddTool,
192379
193159
  startTask: () => startTask,
193160
+ startStreamServer: () => startStreamServer,
192380
193161
  signPayload: () => signPayload,
192381
193162
  severityFromString: () => severityFromString,
192382
193163
  setSecurityLogger: () => setSecurityLogger,
@@ -192900,6 +193681,7 @@ __export(exports_src3, {
192900
193681
  BuiltinCommands: () => BuiltinCommands,
192901
193682
  BudgetTracker: () => BudgetTracker,
192902
193683
  BashTool: () => BashTool,
193684
+ AudioTools: () => AudioTools,
192903
193685
  AudioRecorder: () => AudioRecorder,
192904
193686
  AudioPlayer: () => AudioPlayer,
192905
193687
  AssistantRegistryService: () => AssistantRegistryService,
@@ -192956,6 +193738,7 @@ var init_src3 = __esm(async () => {
192956
193738
  init_bash(),
192957
193739
  init_filesystem(),
192958
193740
  init_feedback(),
193741
+ init_audio2(),
192959
193742
  init_scheduler(),
192960
193743
  init_heartbeat(),
192961
193744
  init_logs(),
@@ -193365,14 +194148,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193365
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. ");
193366
194149
  actScopeDepth = prevActScopeDepth;
193367
194150
  }
193368
- function recursivelyFlushAsyncActWork(returnValue, resolve5, reject) {
194151
+ function recursivelyFlushAsyncActWork(returnValue, resolve6, reject) {
193369
194152
  var queue = ReactSharedInternals2.actQueue;
193370
194153
  if (queue !== null)
193371
194154
  if (queue.length !== 0)
193372
194155
  try {
193373
194156
  flushActQueue(queue);
193374
194157
  enqueueTask(function() {
193375
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
194158
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
193376
194159
  });
193377
194160
  return;
193378
194161
  } catch (error3) {
@@ -193380,7 +194163,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193380
194163
  }
193381
194164
  else
193382
194165
  ReactSharedInternals2.actQueue = null;
193383
- 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);
193384
194167
  }
193385
194168
  function flushActQueue(queue) {
193386
194169
  if (!isFlushing) {
@@ -193556,14 +194339,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193556
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 () => ...);"));
193557
194340
  });
193558
194341
  return {
193559
- then: function(resolve5, reject) {
194342
+ then: function(resolve6, reject) {
193560
194343
  didAwaitActCall = true;
193561
194344
  thenable.then(function(returnValue) {
193562
194345
  popActScope(prevActQueue, prevActScopeDepth);
193563
194346
  if (prevActScopeDepth === 0) {
193564
194347
  try {
193565
194348
  flushActQueue(queue), enqueueTask(function() {
193566
- return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
194349
+ return recursivelyFlushAsyncActWork(returnValue, resolve6, reject);
193567
194350
  });
193568
194351
  } catch (error$0) {
193569
194352
  ReactSharedInternals2.thrownErrors.push(error$0);
@@ -193574,7 +194357,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193574
194357
  reject(_thrownError);
193575
194358
  }
193576
194359
  } else
193577
- resolve5(returnValue);
194360
+ resolve6(returnValue);
193578
194361
  }, function(error3) {
193579
194362
  popActScope(prevActQueue, prevActScopeDepth);
193580
194363
  0 < ReactSharedInternals2.thrownErrors.length ? (error3 = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, reject(error3)) : reject(error3);
@@ -193590,11 +194373,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
193590
194373
  if (0 < ReactSharedInternals2.thrownErrors.length)
193591
194374
  throw callback = aggregateErrors(ReactSharedInternals2.thrownErrors), ReactSharedInternals2.thrownErrors.length = 0, callback;
193592
194375
  return {
193593
- then: function(resolve5, reject) {
194376
+ then: function(resolve6, reject) {
193594
194377
  didAwaitActCall = true;
193595
194378
  prevActScopeDepth === 0 ? (ReactSharedInternals2.actQueue = queue, enqueueTask(function() {
193596
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve5, reject);
193597
- })) : resolve5(returnValue$jscomp$0);
194379
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve6, reject);
194380
+ })) : resolve6(returnValue$jscomp$0);
193598
194381
  }
193599
194382
  };
193600
194383
  };
@@ -198920,8 +199703,8 @@ It can also happen if the client has a browser extension installed which messes
198920
199703
  currentEntangledActionThenable = {
198921
199704
  status: "pending",
198922
199705
  value: undefined,
198923
- then: function(resolve5) {
198924
- entangledListeners.push(resolve5);
199706
+ then: function(resolve6) {
199707
+ entangledListeners.push(resolve6);
198925
199708
  }
198926
199709
  };
198927
199710
  }
@@ -198945,8 +199728,8 @@ It can also happen if the client has a browser extension installed which messes
198945
199728
  status: "pending",
198946
199729
  value: null,
198947
199730
  reason: null,
198948
- then: function(resolve5) {
198949
- listeners.push(resolve5);
199731
+ then: function(resolve6) {
199732
+ listeners.push(resolve6);
198950
199733
  }
198951
199734
  };
198952
199735
  thenable.then(function() {
@@ -210843,8 +211626,8 @@ class Ink {
210843
211626
  }
210844
211627
  }
210845
211628
  async waitUntilExit() {
210846
- this.exitPromise ||= new Promise((resolve5, reject) => {
210847
- this.resolveExitPromise = resolve5;
211629
+ this.exitPromise ||= new Promise((resolve6, reject) => {
211630
+ this.resolveExitPromise = resolve6;
210848
211631
  this.rejectExitPromise = reject;
210849
211632
  });
210850
211633
  return this.exitPromise;
@@ -211637,14 +212420,14 @@ var require_filesystem = __commonJS((exports, module) => {
211637
212420
  fs5.close(fd, () => {});
211638
212421
  return buffer.subarray(0, bytesRead);
211639
212422
  };
211640
- var readFile18 = (path3) => new Promise((resolve5, reject) => {
212423
+ var readFile18 = (path3) => new Promise((resolve6, reject) => {
211641
212424
  fs5.open(path3, "r", (err, fd) => {
211642
212425
  if (err) {
211643
212426
  reject(err);
211644
212427
  } else {
211645
212428
  const buffer = Buffer.alloc(MAX_LENGTH);
211646
212429
  fs5.read(fd, buffer, 0, MAX_LENGTH, 0, (_3, bytesRead) => {
211647
- resolve5(buffer.subarray(0, bytesRead));
212430
+ resolve6(buffer.subarray(0, bytesRead));
211648
212431
  fs5.close(fd, () => {});
211649
212432
  });
211650
212433
  }
@@ -211705,10 +212488,10 @@ var require_detect_libc = __commonJS((exports, module) => {
211705
212488
  var commandOut = "";
211706
212489
  var safeCommand = () => {
211707
212490
  if (!commandOut) {
211708
- return new Promise((resolve5) => {
212491
+ return new Promise((resolve6) => {
211709
212492
  childProcess.exec(command, (err, out) => {
211710
212493
  commandOut = err ? " " : out;
211711
- resolve5(commandOut);
212494
+ resolve6(commandOut);
211712
212495
  });
211713
212496
  });
211714
212497
  }
@@ -214265,14 +215048,14 @@ var require_input = __commonJS((exports, module) => {
214265
215048
  return this;
214266
215049
  } else {
214267
215050
  if (this._isStreamInput()) {
214268
- return new Promise((resolve5, reject) => {
215051
+ return new Promise((resolve6, reject) => {
214269
215052
  const finished = () => {
214270
215053
  this._flattenBufferIn();
214271
215054
  sharp.metadata(this.options, (err, metadata2) => {
214272
215055
  if (err) {
214273
215056
  reject(is3.nativeError(err, stack));
214274
215057
  } else {
214275
- resolve5(metadata2);
215058
+ resolve6(metadata2);
214276
215059
  }
214277
215060
  });
214278
215061
  };
@@ -214283,12 +215066,12 @@ var require_input = __commonJS((exports, module) => {
214283
215066
  }
214284
215067
  });
214285
215068
  } else {
214286
- return new Promise((resolve5, reject) => {
215069
+ return new Promise((resolve6, reject) => {
214287
215070
  sharp.metadata(this.options, (err, metadata2) => {
214288
215071
  if (err) {
214289
215072
  reject(is3.nativeError(err, stack));
214290
215073
  } else {
214291
- resolve5(metadata2);
215074
+ resolve6(metadata2);
214292
215075
  }
214293
215076
  });
214294
215077
  });
@@ -214321,25 +215104,25 @@ var require_input = __commonJS((exports, module) => {
214321
215104
  return this;
214322
215105
  } else {
214323
215106
  if (this._isStreamInput()) {
214324
- return new Promise((resolve5, reject) => {
215107
+ return new Promise((resolve6, reject) => {
214325
215108
  this.on("finish", function() {
214326
215109
  this._flattenBufferIn();
214327
215110
  sharp.stats(this.options, (err, stats2) => {
214328
215111
  if (err) {
214329
215112
  reject(is3.nativeError(err, stack));
214330
215113
  } else {
214331
- resolve5(stats2);
215114
+ resolve6(stats2);
214332
215115
  }
214333
215116
  });
214334
215117
  });
214335
215118
  });
214336
215119
  } else {
214337
- return new Promise((resolve5, reject) => {
215120
+ return new Promise((resolve6, reject) => {
214338
215121
  sharp.stats(this.options, (err, stats2) => {
214339
215122
  if (err) {
214340
215123
  reject(is3.nativeError(err, stack));
214341
215124
  } else {
214342
- resolve5(stats2);
215125
+ resolve6(stats2);
214343
215126
  }
214344
215127
  });
214345
215128
  });
@@ -217738,7 +218521,7 @@ var require_output = __commonJS((exports, module) => {
217738
218521
  return this;
217739
218522
  } else {
217740
218523
  if (this._isStreamInput()) {
217741
- return new Promise((resolve5, reject) => {
218524
+ return new Promise((resolve6, reject) => {
217742
218525
  this.once("finish", () => {
217743
218526
  this._flattenBufferIn();
217744
218527
  sharp.pipeline(this.options, (err, data, info) => {
@@ -217746,24 +218529,24 @@ var require_output = __commonJS((exports, module) => {
217746
218529
  reject(is3.nativeError(err, stack));
217747
218530
  } else {
217748
218531
  if (this.options.resolveWithObject) {
217749
- resolve5({ data, info });
218532
+ resolve6({ data, info });
217750
218533
  } else {
217751
- resolve5(data);
218534
+ resolve6(data);
217752
218535
  }
217753
218536
  }
217754
218537
  });
217755
218538
  });
217756
218539
  });
217757
218540
  } else {
217758
- return new Promise((resolve5, reject) => {
218541
+ return new Promise((resolve6, reject) => {
217759
218542
  sharp.pipeline(this.options, (err, data, info) => {
217760
218543
  if (err) {
217761
218544
  reject(is3.nativeError(err, stack));
217762
218545
  } else {
217763
218546
  if (this.options.resolveWithObject) {
217764
- resolve5({ data, info });
218547
+ resolve6({ data, info });
217765
218548
  } else {
217766
- resolve5(data);
218549
+ resolve6(data);
217767
218550
  }
217768
218551
  }
217769
218552
  });
@@ -217999,7 +218782,7 @@ var init_image2 = __esm(() => {
217999
218782
 
218000
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
218001
218784
  function queryEscapeSequence(message, stdin, stdout, setRawMode) {
218002
- return new Promise((resolve5) => {
218785
+ return new Promise((resolve6) => {
218003
218786
  const responseTimeout = 100;
218004
218787
  let responseTimeoutId = undefined;
218005
218788
  const timeoutBetweenReplies = 50;
@@ -218027,18 +218810,18 @@ function queryEscapeSequence(message, stdin, stdout, setRawMode) {
218027
218810
  runningReply += data;
218028
218811
  timeoutBetweenRepliesId = setTimeout(() => {
218029
218812
  restoreState();
218030
- resolve5(runningReply.length > 0 ? runningReply : undefined);
218813
+ resolve6(runningReply.length > 0 ? runningReply : undefined);
218031
218814
  }, timeoutBetweenReplies);
218032
218815
  };
218033
218816
  const onClose = () => {
218034
218817
  restoreState();
218035
- resolve5(runningReply.length > 0 ? runningReply : undefined);
218818
+ resolve6(runningReply.length > 0 ? runningReply : undefined);
218036
218819
  };
218037
218820
  stdin.on("data", onData);
218038
218821
  stdin.on("close", onClose);
218039
218822
  responseTimeoutId = setTimeout(() => {
218040
218823
  restoreState();
218041
- resolve5(undefined);
218824
+ resolve6(undefined);
218042
218825
  }, responseTimeout);
218043
218826
  stdout.write(message);
218044
218827
  });
@@ -218291,12 +219074,12 @@ var require_isexe = __commonJS((exports, module) => {
218291
219074
  if (typeof Promise !== "function") {
218292
219075
  throw new TypeError("callback not provided");
218293
219076
  }
218294
- return new Promise(function(resolve5, reject) {
219077
+ return new Promise(function(resolve6, reject) {
218295
219078
  isexe(path3, options || {}, function(er3, is3) {
218296
219079
  if (er3) {
218297
219080
  reject(er3);
218298
219081
  } else {
218299
- resolve5(is3);
219082
+ resolve6(is3);
218300
219083
  }
218301
219084
  });
218302
219085
  });
@@ -218358,27 +219141,27 @@ var require_which = __commonJS((exports, module) => {
218358
219141
  opt = {};
218359
219142
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
218360
219143
  const found = [];
218361
- const step = (i5) => new Promise((resolve5, reject) => {
219144
+ const step = (i5) => new Promise((resolve6, reject) => {
218362
219145
  if (i5 === pathEnv.length)
218363
- return opt.all && found.length ? resolve5(found) : reject(getNotFoundError(cmd));
219146
+ return opt.all && found.length ? resolve6(found) : reject(getNotFoundError(cmd));
218364
219147
  const ppRaw = pathEnv[i5];
218365
219148
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
218366
219149
  const pCmd = path3.join(pathPart, cmd);
218367
219150
  const p5 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
218368
- resolve5(subStep(p5, i5, 0));
219151
+ resolve6(subStep(p5, i5, 0));
218369
219152
  });
218370
- const subStep = (p5, i5, ii3) => new Promise((resolve5, reject) => {
219153
+ const subStep = (p5, i5, ii3) => new Promise((resolve6, reject) => {
218371
219154
  if (ii3 === pathExt.length)
218372
- return resolve5(step(i5 + 1));
219155
+ return resolve6(step(i5 + 1));
218373
219156
  const ext = pathExt[ii3];
218374
219157
  isexe(p5 + ext, { pathExt: pathExtExe }, (er3, is3) => {
218375
219158
  if (!er3 && is3) {
218376
219159
  if (opt.all)
218377
219160
  found.push(p5 + ext);
218378
219161
  else
218379
- return resolve5(p5 + ext);
219162
+ return resolve6(p5 + ext);
218380
219163
  }
218381
- return resolve5(subStep(p5, i5, ii3 + 1));
219164
+ return resolve6(subStep(p5, i5, ii3 + 1));
218382
219165
  });
218383
219166
  });
218384
219167
  return cb2 ? step(0).then((res) => cb2(null, res), cb2) : step(0);
@@ -219265,7 +220048,7 @@ var require_kill = __commonJS((exports, module) => {
219265
220048
  return spawnedPromise;
219266
220049
  }
219267
220050
  let timeoutId;
219268
- const timeoutPromise = new Promise((resolve5, reject) => {
220051
+ const timeoutPromise = new Promise((resolve6, reject) => {
219269
220052
  timeoutId = setTimeout(() => {
219270
220053
  timeoutKill(spawned, killSignal, reject);
219271
220054
  }, timeout);
@@ -219376,7 +220159,7 @@ var require_get_stream = __commonJS((exports, module) => {
219376
220159
  };
219377
220160
  const { maxBuffer } = options;
219378
220161
  const stream2 = bufferStream(options);
219379
- await new Promise((resolve5, reject) => {
220162
+ await new Promise((resolve6, reject) => {
219380
220163
  const rejectPromise = (error3) => {
219381
220164
  if (error3 && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
219382
220165
  error3.bufferedData = stream2.getBufferedValue();
@@ -219386,7 +220169,7 @@ var require_get_stream = __commonJS((exports, module) => {
219386
220169
  (async () => {
219387
220170
  try {
219388
220171
  await streamPipelinePromisified(inputStream, stream2);
219389
- resolve5();
220172
+ resolve6();
219390
220173
  } catch (error3) {
219391
220174
  rejectPromise(error3);
219392
220175
  }
@@ -219533,9 +220316,9 @@ var require_promise = __commonJS((exports, module) => {
219533
220316
  return spawned;
219534
220317
  };
219535
220318
  var getSpawnedPromise = (spawned) => {
219536
- return new Promise((resolve5, reject) => {
220319
+ return new Promise((resolve6, reject) => {
219537
220320
  spawned.on("exit", (exitCode, signal) => {
219538
- resolve5({ exitCode, signal });
220321
+ resolve6({ exitCode, signal });
219539
220322
  });
219540
220323
  spawned.on("error", (error3) => {
219541
220324
  reject(error3);
@@ -233169,7 +233952,7 @@ await __promiseAll([
233169
233952
  var import_react83 = __toESM(require_react2(), 1);
233170
233953
  import { spawn as spawn3 } from "child_process";
233171
233954
  import { join as join61 } from "path";
233172
- import { homedir as homedir23 } from "os";
233955
+ import { homedir as homedir24 } from "os";
233173
233956
 
233174
233957
  // packages/terminal/src/components/Input.tsx
233175
233958
  await init_build2();
@@ -233999,7 +234782,7 @@ var Input = import_react28.default.forwardRef(function Input2({
233999
234782
  `).length;
234000
234783
  return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
234001
234784
  flexDirection: "column",
234002
- marginTop: 1,
234785
+ marginTop: 0,
234003
234786
  children: [
234004
234787
  assistantName && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
234005
234788
  justifyContent: "flex-end",
@@ -236055,7 +236838,7 @@ function ActiveToolsPanel({ activityLog, now: now2, verboseTools }) {
236055
236838
  const anyRunning = toolCalls.some((c6) => c6.status === "running");
236056
236839
  const anyError = toolCalls.some((c6) => c6.status === "failed");
236057
236840
  const summary = buildToolCallSummary(toolCalls.map((c6) => c6.toolCall), anyRunning);
236058
- const icon = anyRunning ? "\u25D0" : anyError ? "\u2717" : "\u25CF";
236841
+ const icon = anyRunning ? "\u25CB" : anyError ? "\u2717" : "\u25CF";
236059
236842
  const iconColor = anyRunning ? "gray" : anyError ? "red" : "green";
236060
236843
  const suffix2 = anyRunning ? "\u2026" : "";
236061
236844
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
@@ -236086,7 +236869,7 @@ function ActiveToolsPanel({ activityLog, now: now2, verboseTools }) {
236086
236869
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
236087
236870
  flexDirection: "column",
236088
236871
  children: toolCalls.map((call) => {
236089
- const icon = call.status === "running" ? "\u25D0" : call.status === "failed" ? "\u2717" : "\u25CF";
236872
+ const icon = call.status === "running" ? "\u25CB" : call.status === "failed" ? "\u2717" : "\u25CF";
236090
236873
  const iconColor = call.status === "running" ? "gray" : call.status === "failed" ? "red" : "green";
236091
236874
  const elapsedMs = (call.endTime ?? now2) - call.startTime;
236092
236875
  const elapsedText = formatDuration3(elapsedMs);
@@ -236248,7 +237031,7 @@ function ToolCallPanel({
236248
237031
  const anyError = toolCalls.some((tc) => resultMap.get(tc.id)?.isError);
236249
237032
  const isRunning = !allComplete;
236250
237033
  const summary = buildToolCallSummary(toolCalls, isRunning);
236251
- const icon = isRunning ? "\u25D0" : anyError ? "\u2717" : "\u25CF";
237034
+ const icon = isRunning ? "\u25CB" : anyError ? "\u2717" : "\u25CF";
236252
237035
  const iconColor = isRunning ? "gray" : anyError ? "red" : "green";
236253
237036
  const suffix2 = isRunning ? "\u2026" : "";
236254
237037
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
@@ -236282,7 +237065,7 @@ function ToolCallPanel({
236282
237065
  const result = resultMap.get(toolCall.id);
236283
237066
  const isRunning = !result;
236284
237067
  const isError = result?.isError;
236285
- const icon = isRunning ? "\u25D0" : isError ? "\u2717" : "\u25CF";
237068
+ const icon = isRunning ? "\u25CB" : isError ? "\u2717" : "\u25CF";
236286
237069
  const iconColor = isRunning ? "gray" : isError ? "red" : "green";
236287
237070
  const title = getToolCallTitle(toolCall);
236288
237071
  const prefix2 = isRunning ? "Calling " : "";
@@ -237114,9 +237897,6 @@ function ProcessingIndicator({
237114
237897
  parts.push(formatTime(elapsed));
237115
237898
  parts.push(`\u2193 ${formatTokens(tokenCount)} tokens`);
237116
237899
  }
237117
- if (isThinking) {
237118
- parts.push("thinking");
237119
- }
237120
237900
  const label = loadingWord;
237121
237901
  return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
237122
237902
  marginY: 1,
@@ -237146,11 +237926,13 @@ function ProcessingIndicator({
237146
237926
  }
237147
237927
 
237148
237928
  // packages/terminal/src/components/WelcomeBanner.tsx
237929
+ init_src2();
237149
237930
  await init_build2();
237150
237931
  var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
237151
237932
  function WelcomeBanner({ version: version4, model, directory }) {
237152
237933
  const homeDir = process.env.HOME || "";
237153
237934
  const displayDir = homeDir && directory.startsWith(homeDir) ? "~" + directory.slice(homeDir.length) : directory;
237935
+ const displayModel = getModelDisplayName(model);
237154
237936
  return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
237155
237937
  flexDirection: "column",
237156
237938
  marginBottom: 1,
@@ -237169,7 +237951,7 @@ function WelcomeBanner({ version: version4, model, directory }) {
237169
237951
  }, undefined, false, undefined, this),
237170
237952
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237171
237953
  bold: true,
237172
- children: "Assistants"
237954
+ children: "Hasna Assistants"
237173
237955
  }, undefined, false, undefined, this),
237174
237956
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237175
237957
  dimColor: true,
@@ -237189,7 +237971,7 @@ function WelcomeBanner({ version: version4, model, directory }) {
237189
237971
  children: "model: "
237190
237972
  }, undefined, false, undefined, this),
237191
237973
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237192
- children: model
237974
+ children: displayModel
237193
237975
  }, undefined, false, undefined, this),
237194
237976
  /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text3, {
237195
237977
  dimColor: true,
@@ -247342,7 +248124,7 @@ function ChannelsPanel({ manager, onClose, activePersonId, activePersonName, act
247342
248124
  }, undefined, false, undefined, this),
247343
248125
  /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
247344
248126
  justifyContent: "flex-end",
247345
- marginTop: 1,
248127
+ marginTop: 0,
247346
248128
  children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text3, {
247347
248129
  backgroundColor: SLACK_COLOR,
247348
248130
  color: "white",
@@ -263389,7 +264171,7 @@ var HOOK_TYPE_SET = new Set(["command", "prompt", "assistant"]);
263389
264171
  var HOOK_LOCATION_SET = new Set(["project", "user", "local"]);
263390
264172
  var HOOK_EVENT_MAP = new Map(Array.from(HOOK_EVENT_SET).map((ev) => [ev.toLowerCase(), ev]));
263391
264173
  async function runShellCommand(command, cwd2) {
263392
- return new Promise((resolve5, reject) => {
264174
+ return new Promise((resolve6, reject) => {
263393
264175
  const child = spawn3(command, { cwd: cwd2, shell: true, env: process.env });
263394
264176
  const stdoutChunks = [];
263395
264177
  const stderrChunks = [];
@@ -263418,7 +264200,7 @@ async function runShellCommand(command, cwd2) {
263418
264200
  }
263419
264201
  child.on("error", (error3) => reject(error3));
263420
264202
  child.on("close", (code) => {
263421
- resolve5({
264203
+ resolve6({
263422
264204
  stdout: Buffer.concat(stdoutChunks).toString("utf8").trimEnd(),
263423
264205
  stderr: Buffer.concat(stderrChunks).toString("utf8").trimEnd(),
263424
264206
  exitCode: code,
@@ -263715,7 +264497,7 @@ function App2({ cwd: cwd2, version: version4 }) {
263715
264497
  setInlinePending((prev) => prev.filter((msg) => msg.id !== id));
263716
264498
  }, []);
263717
264499
  const beginAskUser = import_react83.useCallback((sessionId, request2) => {
263718
- return new Promise((resolve5, reject) => {
264500
+ return new Promise((resolve6, reject) => {
263719
264501
  if (askUserStateRef.current.has(sessionId)) {
263720
264502
  reject(new Error("Another interview is already in progress for this session."));
263721
264503
  return;
@@ -263725,7 +264507,7 @@ function App2({ cwd: cwd2, version: version4 }) {
263725
264507
  request: request2,
263726
264508
  index: 0,
263727
264509
  answers: {},
263728
- resolve: resolve5,
264510
+ resolve: resolve6,
263729
264511
  reject
263730
264512
  };
263731
264513
  askUserStateRef.current.set(sessionId, state);
@@ -264906,7 +265688,7 @@ function App2({ cwd: cwd2, version: version4 }) {
264906
265688
  }, [recoverableSessions, createSessionFromRecovery, workspaceBaseDir]);
264907
265689
  const handleOnboardingComplete = import_react83.useCallback(async (result) => {
264908
265690
  const { existsSync: existsSync43, mkdirSync: mkdirSync29, readFileSync: readFileSync24, writeFileSync: writeFileSync18, appendFileSync: appendFileSync4 } = await import("fs");
264909
- const secretsPath = join61(homedir23(), ".secrets");
265691
+ const secretsPath = join61(homedir24(), ".secrets");
264910
265692
  const providerInfo = getProviderInfo(result.provider);
264911
265693
  const envName = providerInfo?.apiKeyEnv || "ANTHROPIC_API_KEY";
264912
265694
  const keyExport = `export ${envName}="${result.apiKey}"`;
@@ -268078,7 +268860,7 @@ Interactive Mode:
268078
268860
  // packages/terminal/src/index.tsx
268079
268861
  var jsx_dev_runtime51 = __toESM(require_jsx_dev_runtime(), 1);
268080
268862
  setRuntime(bunRuntime);
268081
- var VERSION4 = "1.1.46";
268863
+ var VERSION4 = "1.1.48";
268082
268864
  var SYNC_START = "\x1B[?2026h";
268083
268865
  var SYNC_END = "\x1B[?2026l";
268084
268866
  function enableSynchronizedOutput() {
@@ -268197,4 +268979,4 @@ export {
268197
268979
  main
268198
268980
  };
268199
268981
 
268200
- //# debugId=C70AF0E9056DF44864756E2164756E21
268982
+ //# debugId=43453D06C0B5235264756E2164756E21