open-agents-ai 0.187.134 → 0.187.135

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.
Files changed (2) hide show
  1. package/dist/index.js +508 -226
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -242342,11 +242342,11 @@ var require_out = __commonJS({
242342
242342
  async.read(path5, getSettings(optionsOrSettingsOrCallback), callback);
242343
242343
  }
242344
242344
  exports.stat = stat6;
242345
- function statSync20(path5, optionsOrSettings) {
242345
+ function statSync21(path5, optionsOrSettings) {
242346
242346
  const settings = getSettings(optionsOrSettings);
242347
242347
  return sync.read(path5, settings);
242348
242348
  }
242349
- exports.statSync = statSync20;
242349
+ exports.statSync = statSync21;
242350
242350
  function getSettings(settingsOrOptions = {}) {
242351
242351
  if (settingsOrOptions instanceof settings_1.default) {
242352
242352
  return settingsOrOptions;
@@ -245714,7 +245714,7 @@ print("${sentinel}")
245714
245714
  if (!this.proc || this.proc.killed) {
245715
245715
  return { success: false, path: "" };
245716
245716
  }
245717
- const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync37 } = await import("node:fs");
245717
+ const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync38 } = await import("node:fs");
245718
245718
  const sessionDir = join24(this.cwd, ".oa", "rlm");
245719
245719
  mkdirSync40(sessionDir, { recursive: true });
245720
245720
  const sessionPath = join24(sessionDir, "session.json");
@@ -245740,7 +245740,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
245740
245740
  trajectoryCount: this.trajectory.length,
245741
245741
  subCallCount: this.subCallCount
245742
245742
  };
245743
- writeFileSync37(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
245743
+ writeFileSync38(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
245744
245744
  return { success: true, path: sessionPath };
245745
245745
  }
245746
245746
  } catch {
@@ -246349,7 +246349,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246349
246349
  /** Update memory scores based on task outcome. Called after task completion.
246350
246350
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
246351
246351
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
246352
- const { readFileSync: readFileSync56, writeFileSync: writeFileSync37, existsSync: existsSync71, mkdirSync: mkdirSync40 } = __require("node:fs");
246352
+ const { readFileSync: readFileSync56, writeFileSync: writeFileSync38, existsSync: existsSync71, mkdirSync: mkdirSync40 } = __require("node:fs");
246353
246353
  const metaDir = join25(this.cwd, ".oa", "memory", "metabolism");
246354
246354
  const storeFile = join25(metaDir, "store.json");
246355
246355
  if (!existsSync71(storeFile))
@@ -246381,7 +246381,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246381
246381
  }
246382
246382
  if (updated) {
246383
246383
  mkdirSync40(metaDir, { recursive: true });
246384
- writeFileSync37(storeFile, JSON.stringify(store2, null, 2));
246384
+ writeFileSync38(storeFile, JSON.stringify(store2, null, 2));
246385
246385
  }
246386
246386
  }
246387
246387
  // ── Storage ──────────────────────────────────────────────────────────
@@ -246827,7 +246827,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246827
246827
  }
246828
246828
  /** Archive a strategy variant synchronously (for task completion path) */
246829
246829
  archiveVariantSync(strategy, outcome, tags = []) {
246830
- const { readFileSync: readFileSync56, writeFileSync: writeFileSync37, existsSync: existsSync71, mkdirSync: mkdirSync40 } = __require("node:fs");
246830
+ const { readFileSync: readFileSync56, writeFileSync: writeFileSync38, existsSync: existsSync71, mkdirSync: mkdirSync40 } = __require("node:fs");
246831
246831
  const dir = join27(this.cwd, ".oa", "arche");
246832
246832
  const archiveFile = join27(dir, "variants.json");
246833
246833
  let variants = [];
@@ -246849,7 +246849,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246849
246849
  if (variants.length > 50)
246850
246850
  variants = variants.slice(-50);
246851
246851
  mkdirSync40(dir, { recursive: true });
246852
- writeFileSync37(archiveFile, JSON.stringify(variants, null, 2));
246852
+ writeFileSync38(archiveFile, JSON.stringify(variants, null, 2));
246853
246853
  }
246854
246854
  async saveArchive(variants) {
246855
246855
  const dir = join27(this.cwd, ".oa", "arche");
@@ -253972,16 +253972,20 @@ var init_process_health = __esm({
253972
253972
 
253973
253973
  // packages/execution/dist/tools/camera-capture.js
253974
253974
  import { execSync as execSync27 } from "node:child_process";
253975
- import { readFileSync as readFileSync21, unlinkSync as unlinkSync5, existsSync as existsSync28, mkdirSync as mkdirSync10 } from "node:fs";
253975
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync11, unlinkSync as unlinkSync5, existsSync as existsSync28, mkdirSync as mkdirSync10, statSync as statSync10 } from "node:fs";
253976
253976
  import { join as join44 } from "node:path";
253977
253977
  import { tmpdir as tmpdir8 } from "node:os";
253978
- var CameraCaptureTool;
253978
+ var KANDAO_USB_VENDORS, QOOCAM_WIFI_PASSWORD, QOOCAM_DEFAULT_IP, OSC_TIMEOUT, CameraCaptureTool;
253979
253979
  var init_camera_capture = __esm({
253980
253980
  "packages/execution/dist/tools/camera-capture.js"() {
253981
253981
  "use strict";
253982
+ KANDAO_USB_VENDORS = ["12d1", "2aad"];
253983
+ QOOCAM_WIFI_PASSWORD = "12345678";
253984
+ QOOCAM_DEFAULT_IP = "192.168.173.1";
253985
+ OSC_TIMEOUT = 15e3;
253982
253986
  CameraCaptureTool = class {
253983
253987
  name = "camera_capture";
253984
- description = "Access system cameras to capture images. Actions: 'list' to enumerate cameras, 'capture' to grab a JPEG frame, 'info' to query camera capabilities. Use this when you need to SEE the physical environment \u2014 take a photo, check what's on a desk, read a whiteboard, inspect hardware, or observe any real-world scene. The captured image can then be analyzed with vision tools.";
253988
+ description = "Access system cameras to capture images. Supports USB webcams (v4l2) AND Kandao QooCam 8K/Pro 360 cameras (auto-connects via WiFi). Actions: 'list' to enumerate all cameras, 'capture' to grab a JPEG frame, 'info' to query camera capabilities. Use this when you need to SEE the physical environment \u2014 take a photo, check what's on a desk, read a whiteboard, inspect hardware, or observe any real-world scene. The captured image can be analyzed with vision tools.";
253985
253989
  parameters = {
253986
253990
  type: "object",
253987
253991
  properties: {
@@ -253992,15 +253996,15 @@ var init_camera_capture = __esm({
253992
253996
  },
253993
253997
  device: {
253994
253998
  type: "string",
253995
- description: "Camera device path (e.g. /dev/video0). Default: first available camera."
253999
+ description: "Camera device path (e.g. /dev/video0) or 'qoocam' for the QooCam 360 camera. Default: auto-detect best camera."
253996
254000
  },
253997
254001
  width: {
253998
254002
  type: "number",
253999
- description: "Capture width in pixels (default: 1280)"
254003
+ description: "Capture width in pixels (default: 1280 for USB, native for QooCam)"
254000
254004
  },
254001
254005
  height: {
254002
254006
  type: "number",
254003
- description: "Capture height in pixels (default: 720)"
254007
+ description: "Capture height in pixels (default: 720 for USB, native for QooCam)"
254004
254008
  },
254005
254009
  output_path: {
254006
254010
  type: "string",
@@ -254015,11 +254019,11 @@ var init_camera_capture = __esm({
254015
254019
  try {
254016
254020
  switch (action) {
254017
254021
  case "list":
254018
- return this.listCameras(start2);
254022
+ return await this.listCameras(start2);
254019
254023
  case "capture":
254020
- return this.captureFrame(args, start2);
254024
+ return await this.captureFrame(args, start2);
254021
254025
  case "info":
254022
- return this.cameraInfo(args, start2);
254026
+ return await this.cameraInfo(args, start2);
254023
254027
  default:
254024
254028
  return { success: false, output: "", error: `Unknown action: ${action}. Use list, capture, or info.`, durationMs: performance.now() - start2 };
254025
254029
  }
@@ -254027,7 +254031,74 @@ var init_camera_capture = __esm({
254027
254031
  return { success: false, output: "", error: `camera_capture error: ${err instanceof Error ? err.message : String(err)}`, durationMs: performance.now() - start2 };
254028
254032
  }
254029
254033
  }
254030
- listCameras(start2) {
254034
+ // =========================================================================
254035
+ // List cameras — v4l2 + QooCam discovery
254036
+ // =========================================================================
254037
+ async listCameras(start2) {
254038
+ const cameras = [];
254039
+ const v4l2 = this.discoverV4l2Devices();
254040
+ for (const d2 of v4l2) {
254041
+ cameras.push(` ${d2.device}: ${d2.name} (${d2.driver}) [v4l2]`);
254042
+ }
254043
+ const qoocam = await this.discoverQooCam();
254044
+ if (qoocam.found) {
254045
+ const status = qoocam.connected ? `connected at ${qoocam.ip}, battery ${qoocam.battery ?? "?"}%` : qoocam.ssid ? `WiFi available: ${qoocam.ssid} (use device='qoocam' to auto-connect)` : `USB detected but not connected via WiFi`;
254046
+ cameras.push(` qoocam: ${qoocam.model || "QooCam 8K"} \u2014 ${status} [osc]`);
254047
+ }
254048
+ if (cameras.length === 0) {
254049
+ return {
254050
+ success: true,
254051
+ output: "No cameras found. Connect a USB camera, or power on a QooCam with WiFi hotspot enabled.",
254052
+ durationMs: performance.now() - start2
254053
+ };
254054
+ }
254055
+ return {
254056
+ success: true,
254057
+ output: `Found ${cameras.length} camera(s):
254058
+ ${cameras.join("\n")}`,
254059
+ durationMs: performance.now() - start2
254060
+ };
254061
+ }
254062
+ // =========================================================================
254063
+ // Capture frame — auto-selects v4l2 or QooCam
254064
+ // =========================================================================
254065
+ async captureFrame(args, start2) {
254066
+ const device = args["device"] || "";
254067
+ const outputPath = args["output_path"];
254068
+ if (device === "qoocam" || device.startsWith("qoocam")) {
254069
+ return this.captureQooCam(args, start2);
254070
+ }
254071
+ const v4l2Device = device || this.findFirstV4l2Camera();
254072
+ if (!v4l2Device) {
254073
+ const qoocam = await this.discoverQooCam();
254074
+ if (qoocam.found) {
254075
+ return this.captureQooCam(args, start2);
254076
+ }
254077
+ return { success: false, output: "", error: "No camera found. Connect a USB camera or enable QooCam WiFi hotspot.", durationMs: performance.now() - start2 };
254078
+ }
254079
+ return this.captureV4l2(v4l2Device, args, start2);
254080
+ }
254081
+ // =========================================================================
254082
+ // Camera info
254083
+ // =========================================================================
254084
+ async cameraInfo(args, start2) {
254085
+ const device = args["device"] || "";
254086
+ if (device === "qoocam" || device.startsWith("qoocam")) {
254087
+ return this.qoocamInfo(start2);
254088
+ }
254089
+ const v4l2Device = device || this.findFirstV4l2Camera();
254090
+ if (!v4l2Device) {
254091
+ const qoocam = await this.discoverQooCam();
254092
+ if (qoocam.found)
254093
+ return this.qoocamInfo(start2);
254094
+ return { success: false, output: "", error: "No camera found.", durationMs: performance.now() - start2 };
254095
+ }
254096
+ return this.v4l2Info(v4l2Device, start2);
254097
+ }
254098
+ // =========================================================================
254099
+ // V4L2 backend (standard USB/CSI cameras)
254100
+ // =========================================================================
254101
+ discoverV4l2Devices() {
254031
254102
  const devices = [];
254032
254103
  try {
254033
254104
  const devs = execSync27("ls /dev/video* 2>/dev/null", { encoding: "utf8", timeout: 5e3 }).trim().split("\n").filter(Boolean);
@@ -254055,26 +254126,17 @@ var init_camera_capture = __esm({
254055
254126
  }
254056
254127
  } catch {
254057
254128
  }
254058
- if (devices.length === 0) {
254059
- return {
254060
- success: true,
254061
- output: "No cameras found. Connect a USB camera or enable a built-in camera.",
254062
- durationMs: performance.now() - start2
254063
- };
254064
- }
254065
- const lines = devices.map((d2) => ` ${d2.device}: ${d2.name} (${d2.driver})`);
254066
- return {
254067
- success: true,
254068
- output: `Found ${devices.length} camera(s):
254069
- ${lines.join("\n")}`,
254070
- durationMs: performance.now() - start2
254071
- };
254129
+ return devices;
254072
254130
  }
254073
- captureFrame(args, start2) {
254074
- const device = args["device"] || this.findFirstCamera();
254075
- if (!device) {
254076
- return { success: false, output: "", error: "No camera device found. Connect a USB camera first.", durationMs: performance.now() - start2 };
254131
+ findFirstV4l2Camera() {
254132
+ try {
254133
+ const devs = execSync27("ls /dev/video* 2>/dev/null", { encoding: "utf8", timeout: 3e3 }).trim().split("\n");
254134
+ return devs[0] || null;
254135
+ } catch {
254136
+ return null;
254077
254137
  }
254138
+ }
254139
+ captureV4l2(device, args, start2) {
254078
254140
  const width = args["width"] || 1280;
254079
254141
  const height = args["height"] || 720;
254080
254142
  const outputPath = args["output_path"];
@@ -254097,7 +254159,6 @@ ${lines.join("\n")}`,
254097
254159
  "1",
254098
254160
  "-q:v",
254099
254161
  "2",
254100
- // JPEG quality (2 = high quality)
254101
254162
  "-y",
254102
254163
  tempFile
254103
254164
  ].join(" ");
@@ -254106,42 +254167,14 @@ ${lines.join("\n")}`,
254106
254167
  } catch (err) {
254107
254168
  const msg = err instanceof Error ? err.message : String(err);
254108
254169
  if (msg.includes("Device or resource busy")) {
254109
- return { success: false, output: "", error: `Camera ${device} is busy \u2014 another process may be using it. Close other camera apps and retry.`, durationMs: performance.now() - start2 };
254170
+ return { success: false, output: "", error: `Camera ${device} is busy \u2014 close other camera apps.`, durationMs: performance.now() - start2 };
254110
254171
  }
254111
254172
  return { success: false, output: "", error: `Failed to capture from ${device}: ${msg.slice(0, 300)}`, durationMs: performance.now() - start2 };
254112
254173
  }
254113
- if (!existsSync28(tempFile)) {
254114
- return { success: false, output: "", error: `Capture produced no output file. Camera may not support ${width}x${height}.`, durationMs: performance.now() - start2 };
254115
- }
254116
- if (outputPath) {
254117
- return {
254118
- success: true,
254119
- output: `Frame captured and saved to: ${outputPath}`,
254120
- durationMs: performance.now() - start2
254121
- };
254122
- }
254123
- const data = readFileSync21(tempFile);
254124
- try {
254125
- unlinkSync5(tempFile);
254126
- } catch {
254127
- }
254128
- const base642 = data.toString("base64");
254129
- const sizeKB = Math.round(data.length / 1024);
254130
- return {
254131
- success: true,
254132
- output: `Captured ${width}x${height} frame from ${device} (${sizeKB}KB JPEG).
254133
-
254134
- Base64 image data (use with vision tools):
254135
- data:image/jpeg;base64,${base642}`,
254136
- durationMs: performance.now() - start2
254137
- };
254174
+ return this.returnCapturedFile(tempFile, `${width}x${height}`, device, outputPath, start2);
254138
254175
  }
254139
- cameraInfo(args, start2) {
254140
- const device = args["device"] || this.findFirstCamera();
254141
- if (!device) {
254142
- return { success: false, output: "", error: "No camera device found.", durationMs: performance.now() - start2 };
254143
- }
254144
- let info = `Camera: ${device}
254176
+ v4l2Info(device, start2) {
254177
+ let info = `Camera: ${device} [v4l2]
254145
254178
  `;
254146
254179
  try {
254147
254180
  const formats = execSync27(`v4l2-ctl -d ${device} --list-formats-ext 2>/dev/null`, { encoding: "utf8", timeout: 5e3 });
@@ -254152,18 +254185,267 @@ data:image/jpeg;base64,${base642}`,
254152
254185
  const lines = probe.split("\n").filter((l2) => l2.includes("Raw") || l2.includes("Compressed") || l2.includes("video4linux2"));
254153
254186
  info += "\nFormats (ffmpeg probe):\n" + (lines.length > 0 ? lines.join("\n") : "Could not query formats");
254154
254187
  } catch {
254155
- info += "\nCould not query camera capabilities (v4l2-ctl and ffmpeg probe both failed)";
254188
+ info += "\nCould not query camera capabilities";
254156
254189
  }
254157
254190
  }
254158
254191
  return { success: true, output: info, durationMs: performance.now() - start2 };
254159
254192
  }
254160
- findFirstCamera() {
254193
+ // =========================================================================
254194
+ // QooCam OSC backend (WiFi 360 camera)
254195
+ // =========================================================================
254196
+ /** Discover QooCam: check USB presence, scan WiFi for .OSC SSID, probe if connected */
254197
+ async discoverQooCam() {
254198
+ let usbDetected = false;
254161
254199
  try {
254162
- const devs = execSync27("ls /dev/video* 2>/dev/null", { encoding: "utf8", timeout: 3e3 }).trim().split("\n");
254163
- return devs[0] || null;
254200
+ const lsusb = execSync27("lsusb 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
254201
+ for (const vendor of KANDAO_USB_VENDORS) {
254202
+ if (lsusb.toLowerCase().includes(vendor)) {
254203
+ usbDetected = true;
254204
+ break;
254205
+ }
254206
+ }
254207
+ if (lsusb.toLowerCase().includes("kandao") || lsusb.toLowerCase().includes("qoocam"))
254208
+ usbDetected = true;
254164
254209
  } catch {
254165
- return null;
254166
254210
  }
254211
+ let ssid = null;
254212
+ try {
254213
+ const wifiList = execSync27("nmcli device wifi list 2>/dev/null", { encoding: "utf8", timeout: 1e4 });
254214
+ const oscMatch = wifiList.match(/\b(QooCam[^\s]*\.OSC)\b/i);
254215
+ if (oscMatch)
254216
+ ssid = oscMatch[1];
254217
+ } catch {
254218
+ }
254219
+ let connected = false;
254220
+ let ip = QOOCAM_DEFAULT_IP;
254221
+ try {
254222
+ const activeConns = execSync27("nmcli connection show --active 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
254223
+ if (activeConns.toLowerCase().includes("qoocam") || activeConns.includes(".OSC")) {
254224
+ connected = true;
254225
+ }
254226
+ } catch {
254227
+ }
254228
+ let model;
254229
+ let battery;
254230
+ if (connected) {
254231
+ try {
254232
+ const info = await this.oscFetch("GET", "/osc/info");
254233
+ model = info?.model;
254234
+ } catch {
254235
+ connected = false;
254236
+ }
254237
+ }
254238
+ if (connected) {
254239
+ try {
254240
+ const state = await this.oscFetch("POST", "/osc/state");
254241
+ battery = state?.state?.batteryLevel != null ? Math.round(state.state.batteryLevel * 100) : void 0;
254242
+ } catch {
254243
+ }
254244
+ }
254245
+ return {
254246
+ found: usbDetected || ssid != null || connected,
254247
+ connected,
254248
+ ip: connected ? ip : void 0,
254249
+ ssid: ssid ?? void 0,
254250
+ model,
254251
+ battery
254252
+ };
254253
+ }
254254
+ /** Connect to QooCam WiFi hotspot if not already connected */
254255
+ connectQooCamWiFi() {
254256
+ try {
254257
+ const active = execSync27("nmcli connection show --active 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
254258
+ if (active.toLowerCase().includes("qoocam") || active.includes(".OSC")) {
254259
+ try {
254260
+ execSync27(`ping -c 1 -W 2 ${QOOCAM_DEFAULT_IP}`, { timeout: 5e3, stdio: "pipe" });
254261
+ return { connected: true };
254262
+ } catch {
254263
+ }
254264
+ }
254265
+ } catch {
254266
+ }
254267
+ let ssid = null;
254268
+ try {
254269
+ execSync27("nmcli device wifi rescan 2>/dev/null", { timeout: 5e3, stdio: "pipe" });
254270
+ execSync27("sleep 2", { timeout: 5e3 });
254271
+ const wifiList = execSync27("nmcli device wifi list 2>/dev/null", { encoding: "utf8", timeout: 1e4 });
254272
+ const oscMatch = wifiList.match(/\b(QooCam[^\s]*\.OSC)\b/i);
254273
+ if (oscMatch)
254274
+ ssid = oscMatch[1];
254275
+ } catch {
254276
+ }
254277
+ if (!ssid) {
254278
+ return { connected: false, error: "QooCam WiFi hotspot not found. Ensure the camera is powered on with WiFi in Hotspot mode." };
254279
+ }
254280
+ let wifiIface = "wlp69s0";
254281
+ try {
254282
+ const ifaces = execSync27("nmcli device status 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
254283
+ const wifiLine = ifaces.split("\n").find((l2) => l2.includes("wifi") && !l2.includes("wifi-p2p"));
254284
+ if (wifiLine)
254285
+ wifiIface = wifiLine.trim().split(/\s+/)[0];
254286
+ } catch {
254287
+ }
254288
+ try {
254289
+ execSync27(`nmcli device wifi connect "${ssid}" password "${QOOCAM_WIFI_PASSWORD}" ifname ${wifiIface}`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" });
254290
+ } catch (err) {
254291
+ const msg = err instanceof Error ? err.message : String(err);
254292
+ return { connected: false, error: `Failed to connect to ${ssid}: ${msg.slice(0, 200)}` };
254293
+ }
254294
+ try {
254295
+ execSync27("sleep 2", { timeout: 5e3 });
254296
+ execSync27(`ping -c 1 -W 3 ${QOOCAM_DEFAULT_IP}`, { timeout: 8e3, stdio: "pipe" });
254297
+ return { connected: true };
254298
+ } catch {
254299
+ return { connected: false, error: `Connected to ${ssid} but camera not reachable at ${QOOCAM_DEFAULT_IP}` };
254300
+ }
254301
+ }
254302
+ /** Capture a frame from QooCam via OSC API */
254303
+ async captureQooCam(args, start2) {
254304
+ const outputPath = args["output_path"];
254305
+ const conn = this.connectQooCamWiFi();
254306
+ if (!conn.connected) {
254307
+ return { success: false, output: "", error: conn.error || "Could not connect to QooCam", durationMs: performance.now() - start2 };
254308
+ }
254309
+ try {
254310
+ const state = await this.oscFetch("POST", "/osc/state");
254311
+ const captureMode = state?.state?._captureMode;
254312
+ if (captureMode && captureMode !== "image") {
254313
+ await this.oscFetch("POST", "/osc/commands/execute", {
254314
+ name: "camera.setOptions",
254315
+ parameters: { options: { captureMode: "image" } }
254316
+ });
254317
+ }
254318
+ } catch {
254319
+ }
254320
+ let fileUrl;
254321
+ let width = 0;
254322
+ let height = 0;
254323
+ try {
254324
+ const result = await this.oscFetch("POST", "/osc/commands/execute", {
254325
+ name: "camera.takePicture"
254326
+ });
254327
+ if (result?.state === "error") {
254328
+ return { success: false, output: "", error: `QooCam capture failed: ${result.error?.message || JSON.stringify(result.error)}`, durationMs: performance.now() - start2 };
254329
+ }
254330
+ const entry = result?.results?.entries?.[0];
254331
+ if (!entry?.fileUrl) {
254332
+ return { success: false, output: "", error: "QooCam took a picture but returned no file URL", durationMs: performance.now() - start2 };
254333
+ }
254334
+ fileUrl = entry.fileUrl;
254335
+ width = entry.width || 0;
254336
+ height = entry.height || 0;
254337
+ } catch (err) {
254338
+ return { success: false, output: "", error: `QooCam OSC error: ${err instanceof Error ? err.message : String(err)}`, durationMs: performance.now() - start2 };
254339
+ }
254340
+ const captureDir = join44(tmpdir8(), "oa-camera");
254341
+ if (!existsSync28(captureDir))
254342
+ mkdirSync10(captureDir, { recursive: true });
254343
+ const tempFile = outputPath || join44(captureDir, `qoocam-${Date.now()}.jpg`);
254344
+ try {
254345
+ execSync27(`curl -s --connect-timeout 5 --max-time 30 "http://${QOOCAM_DEFAULT_IP}${fileUrl}" -o "${tempFile}"`, { timeout: 35e3, stdio: "pipe" });
254346
+ } catch (err) {
254347
+ return { success: false, output: "", error: `Failed to download frame from QooCam: ${err instanceof Error ? err.message : String(err)}`, durationMs: performance.now() - start2 };
254348
+ }
254349
+ const res = width && height ? `${width}x${height}` : "native";
254350
+ return this.returnCapturedFile(tempFile, res, "QooCam 8K (OSC/WiFi)", outputPath, start2);
254351
+ }
254352
+ /** Get QooCam info via OSC */
254353
+ async qoocamInfo(start2) {
254354
+ const conn = this.connectQooCamWiFi();
254355
+ if (!conn.connected) {
254356
+ return { success: false, output: "", error: conn.error || "Could not connect to QooCam", durationMs: performance.now() - start2 };
254357
+ }
254358
+ let info = "Camera: QooCam [OSC/WiFi]\n";
254359
+ try {
254360
+ const oscInfo = await this.oscFetch("GET", "/osc/info");
254361
+ info += ` Model: ${oscInfo.model || "unknown"}
254362
+ `;
254363
+ info += ` Manufacturer: ${oscInfo.manufacturer || "unknown"}
254364
+ `;
254365
+ info += ` Serial: ${oscInfo.serialNumber || "unknown"}
254366
+ `;
254367
+ info += ` Firmware: ${oscInfo.firmwareVersion || "unknown"}
254368
+ `;
254369
+ info += ` Gyro: ${oscInfo.gyro ?? "unknown"}
254370
+ `;
254371
+ info += ` HDR Merge: ${oscInfo._hdrMerge ?? "unknown"}
254372
+ `;
254373
+ info += ` Live 10-bit: ${oscInfo._live10Bit ?? "unknown"}
254374
+ `;
254375
+ } catch {
254376
+ info += " (could not query /osc/info)\n";
254377
+ }
254378
+ try {
254379
+ const oscState = await this.oscFetch("POST", "/osc/state");
254380
+ const s2 = oscState?.state || {};
254381
+ info += `
254382
+ Battery: ${s2.batteryLevel != null ? Math.round(s2.batteryLevel * 100) + "%" : "unknown"}`;
254383
+ info += ` ${s2._batteryCharging ? "(charging)" : ""}
254384
+ `;
254385
+ info += ` Mode: ${s2._captureMode || "unknown"}
254386
+ `;
254387
+ info += ` SD Card: ${s2._SDCardAvailable ? `${(s2._sdcardAvailableMemery ?? 0).toFixed(1)}GB free / ${(s2._sdcardTotalMemery ?? 0).toFixed(1)}GB total` : "not available"}
254388
+ `;
254389
+ info += ` Shooting: ${s2._isShooting ? "yes" : "no"}
254390
+ `;
254391
+ info += ` HDMI In: ${s2._hdmiIn ? "yes" : "no"}
254392
+ `;
254393
+ info += ` Live Mode: ${s2._liveProMode || "unknown"}
254394
+ `;
254395
+ } catch {
254396
+ info += " (could not query /osc/state)\n";
254397
+ }
254398
+ return { success: true, output: info, durationMs: performance.now() - start2 };
254399
+ }
254400
+ // =========================================================================
254401
+ // OSC HTTP helpers
254402
+ // =========================================================================
254403
+ async oscFetch(method, path5, body) {
254404
+ const url = `http://${QOOCAM_DEFAULT_IP}${path5}`;
254405
+ const opts = {
254406
+ method,
254407
+ headers: body ? { "Content-Type": "application/json" } : void 0,
254408
+ body: body ? JSON.stringify(body) : void 0,
254409
+ signal: AbortSignal.timeout(OSC_TIMEOUT)
254410
+ };
254411
+ const resp = await fetch(url, opts);
254412
+ const text = await resp.text();
254413
+ try {
254414
+ return JSON.parse(text);
254415
+ } catch {
254416
+ return text;
254417
+ }
254418
+ }
254419
+ // =========================================================================
254420
+ // Shared helpers
254421
+ // =========================================================================
254422
+ returnCapturedFile(filePath, resolution, source, userOutputPath, start2) {
254423
+ if (!existsSync28(filePath)) {
254424
+ return { success: false, output: "", error: "Capture produced no output file.", durationMs: performance.now() - start2 };
254425
+ }
254426
+ const data = readFileSync21(filePath);
254427
+ const sizeKB = Math.round(data.length / 1024);
254428
+ if (userOutputPath) {
254429
+ return {
254430
+ success: true,
254431
+ output: `Captured ${resolution} frame from ${source} (${sizeKB}KB JPEG).
254432
+ Saved to: ${userOutputPath}`,
254433
+ durationMs: performance.now() - start2
254434
+ };
254435
+ }
254436
+ try {
254437
+ unlinkSync5(filePath);
254438
+ } catch {
254439
+ }
254440
+ const base642 = data.toString("base64");
254441
+ return {
254442
+ success: true,
254443
+ output: `Captured ${resolution} frame from ${source} (${sizeKB}KB JPEG).
254444
+
254445
+ Base64 image data (use with vision tools):
254446
+ data:image/jpeg;base64,${base642}`,
254447
+ durationMs: performance.now() - start2
254448
+ };
254167
254449
  }
254168
254450
  };
254169
254451
  }
@@ -254171,7 +254453,7 @@ data:image/jpeg;base64,${base642}`,
254171
254453
 
254172
254454
  // packages/execution/dist/tools/audio-capture.js
254173
254455
  import { execSync as execSync28 } from "node:child_process";
254174
- import { readFileSync as readFileSync22, unlinkSync as unlinkSync6, existsSync as existsSync29, mkdirSync as mkdirSync11, statSync as statSync10 } from "node:fs";
254456
+ import { readFileSync as readFileSync22, unlinkSync as unlinkSync6, existsSync as existsSync29, mkdirSync as mkdirSync11, statSync as statSync11 } from "node:fs";
254175
254457
  import { join as join45 } from "node:path";
254176
254458
  import { tmpdir as tmpdir9 } from "node:os";
254177
254459
  var AudioCaptureTool;
@@ -254344,7 +254626,7 @@ ${devices.join("\n")}`,
254344
254626
  if (!existsSync29(tempFile)) {
254345
254627
  return { success: false, output: "", error: "Recording produced no output. Device may not support the requested format.", durationMs: performance.now() - start2 };
254346
254628
  }
254347
- const fileSize = statSync10(tempFile).size;
254629
+ const fileSize = statSync11(tempFile).size;
254348
254630
  const sizeKB = Math.round(fileSize / 1024);
254349
254631
  return {
254350
254632
  success: true,
@@ -254411,7 +254693,7 @@ Saved to: ${tempFile}`,
254411
254693
 
254412
254694
  // packages/execution/dist/tools/audio-playback.js
254413
254695
  import { execSync as execSync29 } from "node:child_process";
254414
- import { existsSync as existsSync30, statSync as statSync11 } from "node:fs";
254696
+ import { existsSync as existsSync30, statSync as statSync12 } from "node:fs";
254415
254697
  var AudioPlaybackTool;
254416
254698
  var init_audio_playback = __esm({
254417
254699
  "packages/execution/dist/tools/audio-playback.js"() {
@@ -254483,7 +254765,7 @@ var init_audio_playback = __esm({
254483
254765
  return { success: false, output: "", error: `Audio file not found: ${file}`, durationMs: performance.now() - start2 };
254484
254766
  }
254485
254767
  const device = args["device"] || "default";
254486
- const size = statSync11(file).size;
254768
+ const size = statSync12(file).size;
254487
254769
  const ext = file.split(".").pop()?.toLowerCase() || "";
254488
254770
  let cmd;
254489
254771
  if (ext === "wav") {
@@ -256291,7 +256573,7 @@ var init_plugin_system = __esm({
256291
256573
  });
256292
256574
 
256293
256575
  // packages/execution/dist/tools/notebook-edit.js
256294
- import { readFileSync as readFileSync25, writeFileSync as writeFileSync11, existsSync as existsSync34 } from "node:fs";
256576
+ import { readFileSync as readFileSync25, writeFileSync as writeFileSync12, existsSync as existsSync34 } from "node:fs";
256295
256577
  function readNotebook(path5) {
256296
256578
  if (!existsSync34(path5))
256297
256579
  return `File not found: ${path5}`;
@@ -256308,7 +256590,7 @@ function readNotebook(path5) {
256308
256590
  }
256309
256591
  }
256310
256592
  function writeNotebook(path5, nb) {
256311
- writeFileSync11(path5, JSON.stringify(nb, null, 1) + "\n", "utf8");
256593
+ writeFileSync12(path5, JSON.stringify(nb, null, 1) + "\n", "utf8");
256312
256594
  }
256313
256595
  function sourceToLines(source) {
256314
256596
  const lines = source.split("\n");
@@ -256592,7 +256874,7 @@ var init_environment_snapshot = __esm({
256592
256874
 
256593
256875
  // packages/execution/dist/tools/video-understand.js
256594
256876
  import { execSync as execSync32 } from "node:child_process";
256595
- import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync12, readFileSync as readFileSync26, readdirSync as readdirSync8, unlinkSync as unlinkSync7 } from "node:fs";
256877
+ import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync13, readFileSync as readFileSync26, readdirSync as readdirSync8, unlinkSync as unlinkSync7 } from "node:fs";
256596
256878
  import { join as join49, basename as basename11 } from "node:path";
256597
256879
  import { createHash as createHash2 } from "node:crypto";
256598
256880
  function isYouTubeUrl2(url) {
@@ -256762,7 +257044,7 @@ var init_video_understand = __esm({
256762
257044
  for (const frame of frames.filter((f2) => !f2.isDuplicate)) {
256763
257045
  const dest = join49(permanentDir, basename11(frame.path));
256764
257046
  try {
256765
- writeFileSync12(dest, readFileSync26(frame.path));
257047
+ writeFileSync13(dest, readFileSync26(frame.path));
256766
257048
  frame.path = dest;
256767
257049
  } catch {
256768
257050
  }
@@ -256799,7 +257081,7 @@ var init_video_understand = __esm({
256799
257081
  };
256800
257082
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
256801
257083
  const resultFile = join49(outDir, `understanding-${timestamp}.json`);
256802
- writeFileSync12(resultFile, JSON.stringify(result, null, 2), "utf-8");
257084
+ writeFileSync13(resultFile, JSON.stringify(result, null, 2), "utf-8");
256803
257085
  try {
256804
257086
  const memDir = join49(this.workingDir, ".oa", "memory");
256805
257087
  mkdirSync13(memDir, { recursive: true });
@@ -256822,7 +257104,7 @@ var init_video_understand = __esm({
256822
257104
  });
256823
257105
  if (indexEntries.length > 30)
256824
257106
  indexEntries = indexEntries.slice(-30);
256825
- writeFileSync12(indexFile, JSON.stringify(indexEntries, null, 2), "utf-8");
257107
+ writeFileSync13(indexFile, JSON.stringify(indexEntries, null, 2), "utf-8");
256826
257108
  const CHUNK_WINDOW = 30;
256827
257109
  const transcriptFile = join49(memDir, "video-transcripts.json");
256828
257110
  let transcriptEntries = {};
@@ -256853,7 +257135,7 @@ var init_video_understand = __esm({
256853
257135
  Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
256854
257136
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
256855
257137
  };
256856
- writeFileSync12(transcriptFile, JSON.stringify(transcriptEntries, null, 2), "utf-8");
257138
+ writeFileSync13(transcriptFile, JSON.stringify(transcriptEntries, null, 2), "utf-8");
256857
257139
  } catch {
256858
257140
  }
256859
257141
  const lines = [];
@@ -257173,7 +257455,7 @@ var init_gitWorktree = __esm({
257173
257455
  });
257174
257456
 
257175
257457
  // packages/execution/dist/patchApplier.js
257176
- import { readFileSync as readFileSync28, writeFileSync as writeFileSync13, existsSync as existsSync37, mkdirSync as mkdirSync14 } from "node:fs";
257458
+ import { readFileSync as readFileSync28, writeFileSync as writeFileSync14, existsSync as existsSync37, mkdirSync as mkdirSync14 } from "node:fs";
257177
257459
  import { dirname as dirname14 } from "node:path";
257178
257460
  import { spawn as spawn16 } from "node:child_process";
257179
257461
  async function applyPatch(patch) {
@@ -257194,17 +257476,17 @@ function applyBlockReplace(patch) {
257194
257476
  throw new Error(`Block not found in "${patch.filePath}": the oldContent string was not found in the file.`);
257195
257477
  }
257196
257478
  const updated = original.replace(patch.oldContent, patch.newContent);
257197
- writeFileSync13(patch.filePath, updated, "utf-8");
257479
+ writeFileSync14(patch.filePath, updated, "utf-8");
257198
257480
  }
257199
257481
  function applyRewrite(patch) {
257200
- writeFileSync13(patch.filePath, patch.newContent, "utf-8");
257482
+ writeFileSync14(patch.filePath, patch.newContent, "utf-8");
257201
257483
  }
257202
257484
  function applyNewFile(patch) {
257203
257485
  if (existsSync37(patch.filePath)) {
257204
257486
  throw new Error(`Cannot create new file: "${patch.filePath}" already exists.`);
257205
257487
  }
257206
257488
  mkdirSync14(dirname14(patch.filePath), { recursive: true });
257207
- writeFileSync13(patch.filePath, patch.newContent, "utf-8");
257489
+ writeFileSync14(patch.filePath, patch.newContent, "utf-8");
257208
257490
  }
257209
257491
  async function applyUnifiedDiff(patch) {
257210
257492
  const { filePath, diff } = patch;
@@ -257561,7 +257843,7 @@ var init_buildRunner = __esm({
257561
257843
  });
257562
257844
 
257563
257845
  // packages/execution/dist/constraints.js
257564
- import { existsSync as existsSync38, readFileSync as readFileSync29, writeFileSync as writeFileSync14, mkdirSync as mkdirSync15 } from "node:fs";
257846
+ import { existsSync as existsSync38, readFileSync as readFileSync29, writeFileSync as writeFileSync15, mkdirSync as mkdirSync15 } from "node:fs";
257565
257847
  import { join as join52 } from "node:path";
257566
257848
  import { homedir as homedir14 } from "node:os";
257567
257849
  function loadConstraints(projectRoot) {
@@ -257593,7 +257875,7 @@ function addProjectConstraint(projectRoot, constraint) {
257593
257875
  }
257594
257876
  data.constraints.push(constraint);
257595
257877
  mkdirSync15(join52(projectRoot, ".oa"), { recursive: true });
257596
- writeFileSync14(path5, JSON.stringify(data, null, 2), "utf-8");
257878
+ writeFileSync15(path5, JSON.stringify(data, null, 2), "utf-8");
257597
257879
  projectConstraints = data.constraints;
257598
257880
  }
257599
257881
  function getAllConstraints() {
@@ -263553,11 +263835,11 @@ ${errOutput}`;
263553
263835
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
263554
263836
  });
263555
263837
  try {
263556
- const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync37 } = __require("node:fs");
263838
+ const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync38 } = __require("node:fs");
263557
263839
  const { join: join91 } = __require("node:path");
263558
263840
  const resultsDir = join91(process.cwd(), ".oa", "tool-results");
263559
263841
  mkdirSync40(resultsDir, { recursive: true });
263560
- writeFileSync37(join91(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
263842
+ writeFileSync38(join91(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
263561
263843
  # Turn: ${turn}
263562
263844
  # Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
263563
263845
  # Size: ${result.output.length} chars, ${lineCount} lines
@@ -263696,7 +263978,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
263696
263978
  if (!this._workingDirectory)
263697
263979
  return;
263698
263980
  try {
263699
- const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync37 } = __require("node:fs");
263981
+ const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync38 } = __require("node:fs");
263700
263982
  const { join: join91 } = __require("node:path");
263701
263983
  const sessionDir = join91(this._workingDirectory, ".oa", "session", this._sessionId);
263702
263984
  mkdirSync40(sessionDir, { recursive: true });
@@ -263711,7 +263993,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
263711
263993
  memexEntryCount: this._memexArchive.size,
263712
263994
  fileRegistrySize: this._fileRegistry.size
263713
263995
  };
263714
- writeFileSync37(join91(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
263996
+ writeFileSync38(join91(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
263715
263997
  } catch {
263716
263998
  }
263717
263999
  }
@@ -265132,12 +265414,12 @@ ${result}`
265132
265414
  let resizedBase64 = null;
265133
265415
  try {
265134
265416
  const { execSync: execSync46 } = await import("node:child_process");
265135
- const { writeFileSync: writeFileSync37, readFileSync: readFileSync56, unlinkSync: unlinkSync17 } = await import("node:fs");
265417
+ const { writeFileSync: writeFileSync38, readFileSync: readFileSync56, unlinkSync: unlinkSync17 } = await import("node:fs");
265136
265418
  const { join: join91 } = await import("node:path");
265137
265419
  const { tmpdir: tmpdir14 } = await import("node:os");
265138
265420
  const tmpIn = join91(tmpdir14(), `oa_img_in_${Date.now()}.png`);
265139
265421
  const tmpOut = join91(tmpdir14(), `oa_img_out_${Date.now()}.jpg`);
265140
- writeFileSync37(tmpIn, buffer2);
265422
+ writeFileSync38(tmpIn, buffer2);
265141
265423
  const pyBin = process.platform === "win32" ? "python" : "python3";
265142
265424
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
265143
265425
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
@@ -265762,7 +266044,7 @@ var init_constraint_learner = __esm({
265762
266044
  });
265763
266045
 
265764
266046
  // packages/orchestrator/dist/nexusBackend.js
265765
- import { existsSync as existsSync40, statSync as statSync12, openSync, readSync, closeSync, unlinkSync as unlinkSync8, writeFileSync as writeFileSync15 } from "node:fs";
266047
+ import { existsSync as existsSync40, statSync as statSync13, openSync, readSync, closeSync, unlinkSync as unlinkSync8, writeFileSync as writeFileSync16 } from "node:fs";
265766
266048
  import { watch as fsWatch } from "node:fs";
265767
266049
  import { join as join56 } from "node:path";
265768
266050
  import { tmpdir as tmpdir10 } from "node:os";
@@ -265915,7 +266197,7 @@ var init_nexusBackend = __esm({
265915
266197
  */
265916
266198
  async *chatCompletionStream(request) {
265917
266199
  const streamFile = join56(tmpdir10(), `nexus-stream-${randomBytes14(6).toString("hex")}.jsonl`);
265918
- writeFileSync15(streamFile, "", "utf8");
266200
+ writeFileSync16(streamFile, "", "utf8");
265919
266201
  const daemonArgs = {
265920
266202
  model: this.model,
265921
266203
  messages: JSON.stringify(request.messages),
@@ -266068,7 +266350,7 @@ var init_nexusBackend = __esm({
266068
266350
  finish();
266069
266351
  }, 50);
266070
266352
  });
266071
- const stat6 = statSync12(streamFile, { throwIfNoEntry: false });
266353
+ const stat6 = statSync13(streamFile, { throwIfNoEntry: false });
266072
266354
  if (!stat6 || stat6.size <= position)
266073
266355
  continue;
266074
266356
  const fd = openSync(streamFile, "r");
@@ -267561,7 +267843,7 @@ __export(listen_exports, {
267561
267843
  waitForTranscribeCli: () => waitForTranscribeCli
267562
267844
  });
267563
267845
  import { spawn as spawn17, execSync as execSync34 } from "node:child_process";
267564
- import { existsSync as existsSync41, mkdirSync as mkdirSync16, writeFileSync as writeFileSync16, readdirSync as readdirSync9 } from "node:fs";
267846
+ import { existsSync as existsSync41, mkdirSync as mkdirSync16, writeFileSync as writeFileSync17, readdirSync as readdirSync9 } from "node:fs";
267565
267847
  import { join as join57, dirname as dirname16 } from "node:path";
267566
267848
  import { homedir as homedir15 } from "node:os";
267567
267849
  import { fileURLToPath as fileURLToPath9 } from "node:url";
@@ -268207,7 +268489,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
268207
268489
  const transcriptDir = join57(outputDir, ".oa", "transcripts");
268208
268490
  mkdirSync16(transcriptDir, { recursive: true });
268209
268491
  const outFile = join57(transcriptDir, `${basename19(filePath)}.txt`);
268210
- writeFileSync16(outFile, result.text, "utf-8");
268492
+ writeFileSync17(outFile, result.text, "utf-8");
268211
268493
  }
268212
268494
  return {
268213
268495
  text: result.text,
@@ -274233,7 +274515,7 @@ import { EventEmitter as EventEmitter5 } from "node:events";
274233
274515
  import { randomBytes as randomBytes15 } from "node:crypto";
274234
274516
  import { URL as URL2 } from "node:url";
274235
274517
  import { loadavg, cpus as cpus2, totalmem as totalmem2, freemem as freemem2 } from "node:os";
274236
- import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync17, unlinkSync as unlinkSync9, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync13 } from "node:fs";
274518
+ import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync18, unlinkSync as unlinkSync9, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync14 } from "node:fs";
274237
274519
  import { join as join58 } from "node:path";
274238
274520
  function cleanForwardHeaders(raw, targetHost) {
274239
274521
  const out = {};
@@ -274268,7 +274550,7 @@ function readExposeState(stateDir) {
274268
274550
  function writeExposeState(stateDir, state) {
274269
274551
  try {
274270
274552
  mkdirSync17(stateDir, { recursive: true });
274271
- writeFileSync17(join58(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
274553
+ writeFileSync18(join58(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
274272
274554
  } catch {
274273
274555
  }
274274
274556
  }
@@ -274384,7 +274666,7 @@ function readP2PExposeState(stateDir) {
274384
274666
  function writeP2PExposeState(stateDir, state) {
274385
274667
  try {
274386
274668
  mkdirSync17(stateDir, { recursive: true });
274387
- writeFileSync17(join58(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
274669
+ writeFileSync18(join58(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
274388
274670
  } catch {
274389
274671
  }
274390
274672
  }
@@ -275516,7 +275798,7 @@ ${this.formatConnectionInfo()}`);
275516
275798
  let recentActive = 0;
275517
275799
  for (const f2 of files.slice(-10)) {
275518
275800
  try {
275519
- const st = statSync13(join58(invocDir, f2));
275801
+ const st = statSync14(join58(invocDir, f2));
275520
275802
  if (now - st.mtimeMs < 1e4) recentActive++;
275521
275803
  } catch {
275522
275804
  }
@@ -275786,7 +276068,7 @@ var init_types = __esm({
275786
276068
 
275787
276069
  // packages/cli/src/tui/p2p/secret-vault.ts
275788
276070
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes16, scryptSync as scryptSync2, createHash as createHash3 } from "node:crypto";
275789
- import { readFileSync as readFileSync32, writeFileSync as writeFileSync18, existsSync as existsSync43, mkdirSync as mkdirSync18 } from "node:fs";
276071
+ import { readFileSync as readFileSync32, writeFileSync as writeFileSync19, existsSync as existsSync43, mkdirSync as mkdirSync18 } from "node:fs";
275790
276072
  import { dirname as dirname17 } from "node:path";
275791
276073
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
275792
276074
  var init_secret_vault = __esm({
@@ -275995,7 +276277,7 @@ var init_secret_vault = __esm({
275995
276277
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
275996
276278
  const dir = dirname17(this.storePath);
275997
276279
  if (!existsSync43(dir)) mkdirSync18(dir, { recursive: true });
275998
- writeFileSync18(this.storePath, blob, { mode: 384 });
276280
+ writeFileSync19(this.storePath, blob, { mode: 384 });
275999
276281
  }
276000
276282
  /**
276001
276283
  * Load vault from disk, decrypting with the given passphrase.
@@ -277745,7 +278027,7 @@ __export(oa_directory_exports, {
277745
278027
  writeIndexData: () => writeIndexData,
277746
278028
  writeIndexMeta: () => writeIndexMeta
277747
278029
  });
277748
- import { existsSync as existsSync45, mkdirSync as mkdirSync19, readFileSync as readFileSync34, writeFileSync as writeFileSync19, readdirSync as readdirSync11, statSync as statSync14, unlinkSync as unlinkSync10 } from "node:fs";
278030
+ import { existsSync as existsSync45, mkdirSync as mkdirSync19, readFileSync as readFileSync34, writeFileSync as writeFileSync20, readdirSync as readdirSync11, statSync as statSync15, unlinkSync as unlinkSync10 } from "node:fs";
277749
278031
  import { join as join62, relative as relative4, basename as basename12 } from "node:path";
277750
278032
  import { homedir as homedir16 } from "node:os";
277751
278033
  function initOaDirectory(repoRoot) {
@@ -277759,7 +278041,7 @@ function initOaDirectory(repoRoot) {
277759
278041
  if (existsSync45(gitignorePath)) {
277760
278042
  const content = readFileSync34(gitignorePath, "utf-8");
277761
278043
  if (!content.includes(settingsPattern)) {
277762
- writeFileSync19(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
278044
+ writeFileSync20(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
277763
278045
  }
277764
278046
  }
277765
278047
  } catch {
@@ -277784,7 +278066,7 @@ function saveProjectSettings(repoRoot, settings) {
277784
278066
  mkdirSync19(oaPath, { recursive: true });
277785
278067
  const existing = loadProjectSettings(repoRoot);
277786
278068
  const merged = { ...existing, ...settings };
277787
- writeFileSync19(join62(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
278069
+ writeFileSync20(join62(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
277788
278070
  }
277789
278071
  function loadGlobalSettings() {
277790
278072
  const settingsPath = join62(homedir16(), ".open-agents", "settings.json");
@@ -277801,7 +278083,7 @@ function saveGlobalSettings(settings) {
277801
278083
  mkdirSync19(dir, { recursive: true });
277802
278084
  const existing = loadGlobalSettings();
277803
278085
  const merged = { ...existing, ...settings };
277804
- writeFileSync19(join62(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
278086
+ writeFileSync20(join62(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
277805
278087
  }
277806
278088
  function resolveSettings(repoRoot) {
277807
278089
  const global2 = loadGlobalSettings();
@@ -277878,7 +278160,7 @@ function readIndexMeta(repoRoot) {
277878
278160
  function writeIndexMeta(repoRoot, meta) {
277879
278161
  const metaPath = join62(repoRoot, OA_DIR, "index", "meta.json");
277880
278162
  mkdirSync19(join62(repoRoot, OA_DIR, "index"), { recursive: true });
277881
- writeFileSync19(metaPath, JSON.stringify(meta, null, 2), "utf-8");
278163
+ writeFileSync20(metaPath, JSON.stringify(meta, null, 2), "utf-8");
277882
278164
  }
277883
278165
  function readIndexData(repoRoot, filename) {
277884
278166
  const filePath = join62(repoRoot, OA_DIR, "index", filename);
@@ -277891,7 +278173,7 @@ function readIndexData(repoRoot, filename) {
277891
278173
  function writeIndexData(repoRoot, filename, data) {
277892
278174
  const filePath = join62(repoRoot, OA_DIR, "index", filename);
277893
278175
  mkdirSync19(join62(repoRoot, OA_DIR, "index"), { recursive: true });
277894
- writeFileSync19(filePath, JSON.stringify(data, null, 2), "utf-8");
278176
+ writeFileSync20(filePath, JSON.stringify(data, null, 2), "utf-8");
277895
278177
  }
277896
278178
  function generateProjectMap(repoRoot) {
277897
278179
  const sections = [];
@@ -277940,13 +278222,13 @@ ${tree2}\`\`\`
277940
278222
  const content = sections.join("\n");
277941
278223
  const contextDir = join62(repoRoot, OA_DIR, "context");
277942
278224
  mkdirSync19(contextDir, { recursive: true });
277943
- writeFileSync19(join62(contextDir, "project-map.md"), content, "utf-8");
278225
+ writeFileSync20(join62(contextDir, "project-map.md"), content, "utf-8");
277944
278226
  return content;
277945
278227
  }
277946
278228
  function saveSession(repoRoot, session) {
277947
278229
  const historyDir = join62(repoRoot, OA_DIR, "history");
277948
278230
  mkdirSync19(historyDir, { recursive: true });
277949
- writeFileSync19(
278231
+ writeFileSync20(
277950
278232
  join62(historyDir, `${session.id}.json`),
277951
278233
  JSON.stringify(session, null, 2),
277952
278234
  "utf-8"
@@ -277957,7 +278239,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
277957
278239
  if (!existsSync45(historyDir)) return [];
277958
278240
  try {
277959
278241
  const files = readdirSync11(historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
277960
- const stat6 = statSync14(join62(historyDir, f2));
278242
+ const stat6 = statSync15(join62(historyDir, f2));
277961
278243
  return { file: f2, mtime: stat6.mtimeMs };
277962
278244
  }).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
277963
278245
  return files.map((f2) => {
@@ -277976,7 +278258,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
277976
278258
  function savePendingTask(repoRoot, task) {
277977
278259
  const historyDir = join62(repoRoot, OA_DIR, "history");
277978
278260
  mkdirSync19(historyDir, { recursive: true });
277979
- writeFileSync19(
278261
+ writeFileSync20(
277980
278262
  join62(historyDir, PENDING_TASK_FILE),
277981
278263
  JSON.stringify(task, null, 2) + "\n",
277982
278264
  "utf-8"
@@ -278015,7 +278297,7 @@ function saveSessionContext(repoRoot, entry) {
278015
278297
  ctx3.entries = ctx3.entries.slice(-ctx3.maxEntries);
278016
278298
  }
278017
278299
  ctx3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
278018
- writeFileSync19(filePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
278300
+ writeFileSync20(filePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
278019
278301
  try {
278020
278302
  const diaryLines = ["# Session Diary", ""];
278021
278303
  for (const e2 of ctx3.entries.slice(-10)) {
@@ -278029,7 +278311,7 @@ function saveSessionContext(repoRoot, entry) {
278029
278311
  if (e2.summary) diaryLines.push(`Summary: ${e2.summary.slice(0, 200)}`);
278030
278312
  diaryLines.push("");
278031
278313
  }
278032
- writeFileSync19(join62(contextDir, "session-diary.md"), diaryLines.join("\n"), "utf-8");
278314
+ writeFileSync20(join62(contextDir, "session-diary.md"), diaryLines.join("\n"), "utf-8");
278033
278315
  } catch {
278034
278316
  }
278035
278317
  }
@@ -278072,7 +278354,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
278072
278354
  const autoName = meta.name || generateSessionName(stripped);
278073
278355
  const autoDesc = meta.description || generateSessionDescription(stripped);
278074
278356
  const contentPath = join62(sessDir, `${sessionId}.jsonl`);
278075
- writeFileSync19(contentPath, stripped.join("\n"), "utf-8");
278357
+ writeFileSync20(contentPath, stripped.join("\n"), "utf-8");
278076
278358
  const indexPath = join62(sessDir, SESSIONS_INDEX);
278077
278359
  let index = [];
278078
278360
  try {
@@ -278103,7 +278385,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
278103
278385
  } catch {
278104
278386
  }
278105
278387
  }
278106
- writeFileSync19(indexPath, JSON.stringify(index, null, 2), "utf-8");
278388
+ writeFileSync20(indexPath, JSON.stringify(index, null, 2), "utf-8");
278107
278389
  }
278108
278390
  function listSessions(repoRoot) {
278109
278391
  const indexPath = join62(repoRoot, OA_DIR, SESSIONS_DIR, SESSIONS_INDEX);
@@ -278133,7 +278415,7 @@ function deleteSession(repoRoot, sessionId) {
278133
278415
  if (existsSync45(indexPath)) {
278134
278416
  let index = JSON.parse(readFileSync34(indexPath, "utf-8"));
278135
278417
  index = index.filter((s2) => s2.id !== sessionId);
278136
- writeFileSync19(indexPath, JSON.stringify(index, null, 2), "utf-8");
278418
+ writeFileSync20(indexPath, JSON.stringify(index, null, 2), "utf-8");
278137
278419
  }
278138
278420
  return true;
278139
278421
  } catch {
@@ -278268,7 +278550,7 @@ function loadUsageFile(filePath) {
278268
278550
  function saveUsageFile(filePath, data) {
278269
278551
  const dir = join62(filePath, "..");
278270
278552
  mkdirSync19(dir, { recursive: true });
278271
- writeFileSync19(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
278553
+ writeFileSync20(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
278272
278554
  }
278273
278555
  function recordUsage(kind, value2, opts) {
278274
278556
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -282886,7 +283168,7 @@ __export(personaplex_exports, {
282886
283168
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
282887
283169
  stopPersonaPlex: () => stopPersonaPlex
282888
283170
  });
282889
- import { existsSync as existsSync46, writeFileSync as writeFileSync20, readFileSync as readFileSync36, mkdirSync as mkdirSync20, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync15 } from "node:fs";
283171
+ import { existsSync as existsSync46, writeFileSync as writeFileSync21, readFileSync as readFileSync36, mkdirSync as mkdirSync20, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync16 } from "node:fs";
282890
283172
  import { join as join63, dirname as dirname20 } from "node:path";
282891
283173
  import { homedir as homedir17 } from "node:os";
282892
283174
  import { execSync as execSync37, spawn as spawn20 } from "node:child_process";
@@ -283024,7 +283306,7 @@ function getWeightTier() {
283024
283306
  if (saved in WEIGHT_REPOS) {
283025
283307
  const vram = detected.vramGB;
283026
283308
  if (saved === "nf4-distilled" && vram < 24) {
283027
- writeFileSync20(tierFile, "nf4");
283309
+ writeFileSync21(tierFile, "nf4");
283028
283310
  return "nf4";
283029
283311
  }
283030
283312
  return saved;
@@ -283154,7 +283436,7 @@ async function installPersonaPlex(onInfo, weightTier) {
283154
283436
  let src2 = readFileSync36(serverFile, "utf8");
283155
283437
  if (src2.includes('int(request["seed"])')) {
283156
283438
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
283157
- writeFileSync20(serverFile, src2);
283439
+ writeFileSync21(serverFile, src2);
283158
283440
  log22("Applied seed parameter bug fix to moshi server.");
283159
283441
  }
283160
283442
  }
@@ -283258,7 +283540,7 @@ $2if filename.endswith(".safetensors"):`
283258
283540
  ${patchPoint}`
283259
283541
  );
283260
283542
  }
283261
- writeFileSync20(loadersFile, src2);
283543
+ writeFileSync21(loadersFile, src2);
283262
283544
  log22("Patched loaders.py with 2-bit TurboQuant native dequant support.");
283263
283545
  }
283264
283546
  }
@@ -283356,7 +283638,7 @@ $2if filename.endswith(".safetensors"):`
283356
283638
  await execAsync(`"${python}" -c "from huggingface_hub import hf_hub_download; hf_hub_download('${nf4.repo}', '${nf4.file}', token=False)"`, {
283357
283639
  timeout: 6e5
283358
283640
  });
283359
- writeFileSync20(join63(PERSONAPLEX_DIR, "weight_tier"), "nf4");
283641
+ writeFileSync21(join63(PERSONAPLEX_DIR, "weight_tier"), "nf4");
283360
283642
  log22(`Downloaded INT4 weights instead (${nf4.sizeGB}GB, public).`);
283361
283643
  } catch {
283362
283644
  log22("Weight download failed.");
@@ -283368,8 +283650,8 @@ $2if filename.endswith(".safetensors"):`
283368
283650
  log22("Weights will download on first server launch.");
283369
283651
  }
283370
283652
  }
283371
- writeFileSync20(join63(PERSONAPLEX_DIR, "weight_tier"), tier);
283372
- writeFileSync20(join63(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
283653
+ writeFileSync21(join63(PERSONAPLEX_DIR, "weight_tier"), tier);
283654
+ writeFileSync21(join63(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
283373
283655
  log22(`PersonaPlex installed (${tier} tier). Use /call to start voice session.`);
283374
283656
  return true;
283375
283657
  }
@@ -283420,7 +283702,7 @@ print('Converted')
283420
283702
  }
283421
283703
  if (existsSync46(cachedBf16)) {
283422
283704
  extraArgs.push("--moshi-weight", cachedBf16);
283423
- log22(`Using distilled weights: ${(statSync15(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
283705
+ log22(`Using distilled weights: ${(statSync16(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
283424
283706
  } else {
283425
283707
  extraArgs.push("--moshi-weight", weightPath);
283426
283708
  }
@@ -283451,7 +283733,7 @@ print('Converted')
283451
283733
  );
283452
283734
  if (existsSync46(cachedBf16)) {
283453
283735
  extraArgs.push("--moshi-weight", cachedBf16);
283454
- log22(`Using dequantized cache: ${(statSync15(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
283736
+ log22(`Using dequantized cache: ${(statSync16(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
283455
283737
  }
283456
283738
  } catch (e2) {
283457
283739
  log22(`Dequantization failed \u2014 server will try to load original weights`);
@@ -283536,8 +283818,8 @@ print('Converted')
283536
283818
  cwd: PERSONAPLEX_DIR
283537
283819
  });
283538
283820
  if (child.pid) {
283539
- writeFileSync20(PID_FILE, String(child.pid));
283540
- writeFileSync20(PORT_FILE, String(PORT));
283821
+ writeFileSync21(PID_FILE, String(child.pid));
283822
+ writeFileSync21(PORT_FILE, String(PORT));
283541
283823
  registry2.register({
283542
283824
  name: "PersonaPlex",
283543
283825
  pid: child.pid,
@@ -283797,7 +284079,7 @@ function patchFrontendVoiceList(onInfo) {
283797
284079
  if (js.includes(needle)) {
283798
284080
  const additions = customVoices.map((v) => `"${v}"`).join(", ");
283799
284081
  js = js.replace(needle, `"VARM4.pt", ${additions}]`);
283800
- writeFileSync20(jsPath, js);
284082
+ writeFileSync21(jsPath, js);
283801
284083
  log22(`Added ${customVoices.length} custom voice(s) to frontend: ${customVoices.map((v) => v.replace(".pt", "")).join(", ")}`);
283802
284084
  }
283803
284085
  }
@@ -283893,7 +284175,7 @@ __export(setup_exports, {
283893
284175
  import * as readline from "node:readline";
283894
284176
  import { execSync as execSync38, spawn as spawn21, exec as exec4 } from "node:child_process";
283895
284177
  import { promisify as promisify7 } from "node:util";
283896
- import { existsSync as existsSync47, writeFileSync as writeFileSync21, readFileSync as readFileSync37, appendFileSync as appendFileSync2, mkdirSync as mkdirSync21 } from "node:fs";
284178
+ import { existsSync as existsSync47, writeFileSync as writeFileSync22, readFileSync as readFileSync37, appendFileSync as appendFileSync2, mkdirSync as mkdirSync21 } from "node:fs";
283897
284179
  import { join as join64 } from "node:path";
283898
284180
  import { homedir as homedir18, platform as platform3 } from "node:os";
283899
284181
  async function checkToolSupport(modelName, backendUrl = "http://localhost:11434") {
@@ -284997,7 +285279,7 @@ async function doSetup(config, rl) {
284997
285279
  const modelDir2 = join64(homedir18(), ".open-agents", "models");
284998
285280
  mkdirSync21(modelDir2, { recursive: true });
284999
285281
  const modelfilePath = join64(modelDir2, `Modelfile.${customName}`);
285000
- writeFileSync21(modelfilePath, modelfileContent + "\n", "utf8");
285282
+ writeFileSync22(modelfilePath, modelfileContent + "\n", "utf8");
285001
285283
  process.stdout.write(` ${c3.dim("Creating model...")} `);
285002
285284
  execSync38(`ollama create ${customName} -f ${modelfilePath}`, {
285003
285285
  stdio: "pipe",
@@ -285335,7 +285617,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
285335
285617
  }
285336
285618
  try {
285337
285619
  mkdirSync21(_visionMarkerDir, { recursive: true });
285338
- writeFileSync21(_visionMarkerFile, JSON.stringify({
285620
+ writeFileSync22(_visionMarkerFile, JSON.stringify({
285339
285621
  installed: [..._visionPreviouslyInstalled],
285340
285622
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
285341
285623
  }, null, 2));
@@ -285573,7 +285855,7 @@ function createExpandedVariant(baseModel, specs, sizeGB, kvBytesPerToken, archMa
285573
285855
  const modelDir2 = join64(homedir18(), ".open-agents", "models");
285574
285856
  mkdirSync21(modelDir2, { recursive: true });
285575
285857
  const modelfilePath = join64(modelDir2, `Modelfile.${customName}`);
285576
- writeFileSync21(modelfilePath, modelfileContent + "\n", "utf8");
285858
+ writeFileSync22(modelfilePath, modelfileContent + "\n", "utf8");
285577
285859
  execSync38(`ollama create ${customName} -f ${modelfilePath}`, {
285578
285860
  stdio: "pipe",
285579
285861
  timeout: 12e4
@@ -285598,7 +285880,7 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
285598
285880
  const modelDir2 = join64(homedir18(), ".open-agents", "models");
285599
285881
  mkdirSync21(modelDir2, { recursive: true });
285600
285882
  const modelfilePath = join64(modelDir2, `Modelfile.${customName}`);
285601
- writeFileSync21(modelfilePath, modelfileContent + "\n", "utf8");
285883
+ writeFileSync22(modelfilePath, modelfileContent + "\n", "utf8");
285602
285884
  await execAsync2(`ollama create ${customName} -f ${modelfilePath}`, {
285603
285885
  timeout: 12e4
285604
285886
  });
@@ -286484,7 +286766,7 @@ __export(daemon_exports, {
286484
286766
  stopDaemon: () => stopDaemon
286485
286767
  });
286486
286768
  import { spawn as spawn22 } from "node:child_process";
286487
- import { existsSync as existsSync50, readFileSync as readFileSync38, writeFileSync as writeFileSync22, mkdirSync as mkdirSync22, unlinkSync as unlinkSync12 } from "node:fs";
286769
+ import { existsSync as existsSync50, readFileSync as readFileSync38, writeFileSync as writeFileSync23, mkdirSync as mkdirSync22, unlinkSync as unlinkSync12 } from "node:fs";
286488
286770
  import { join as join66 } from "node:path";
286489
286771
  import { homedir as homedir19 } from "node:os";
286490
286772
  import { fileURLToPath as fileURLToPath13 } from "node:url";
@@ -286555,7 +286837,7 @@ async function startDaemon() {
286555
286837
  child.unref();
286556
286838
  const pid = child.pid ?? null;
286557
286839
  if (pid) {
286558
- writeFileSync22(PID_FILE2, String(pid), "utf8");
286840
+ writeFileSync23(PID_FILE2, String(pid), "utf8");
286559
286841
  }
286560
286842
  return pid;
286561
286843
  } catch {
@@ -287023,7 +287305,7 @@ __export(sponsor_wizard_exports, {
287023
287305
  saveSponsorConfig: () => saveSponsorConfig,
287024
287306
  showSponsorDashboard: () => showSponsorDashboard
287025
287307
  });
287026
- import { existsSync as existsSync51, readFileSync as readFileSync39, writeFileSync as writeFileSync23, mkdirSync as mkdirSync23 } from "node:fs";
287308
+ import { existsSync as existsSync51, readFileSync as readFileSync39, writeFileSync as writeFileSync24, mkdirSync as mkdirSync23 } from "node:fs";
287027
287309
  import { join as join67 } from "node:path";
287028
287310
  function colorPreview(code8) {
287029
287311
  return `\x1B[38;5;${code8}m\u2588\u2588\u2588\u2588\x1B[0m (${code8})`;
@@ -287055,7 +287337,7 @@ function saveSponsorConfig(projectDir, config) {
287055
287337
  const dir = sponsorDir(projectDir);
287056
287338
  mkdirSync23(dir, { recursive: true });
287057
287339
  config.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
287058
- writeFileSync23(configPath(projectDir), JSON.stringify(config, null, 2), "utf8");
287340
+ writeFileSync24(configPath(projectDir), JSON.stringify(config, null, 2), "utf8");
287059
287341
  }
287060
287342
  function defaultConfig2() {
287061
287343
  return {
@@ -287935,7 +288217,7 @@ __export(voice_exports, {
287935
288217
  registerCustomOnnxModel: () => registerCustomOnnxModel,
287936
288218
  resetNarrationContext: () => resetNarrationContext
287937
288219
  });
287938
- import { existsSync as existsSync52, mkdirSync as mkdirSync24, writeFileSync as writeFileSync24, readFileSync as readFileSync40, unlinkSync as unlinkSync13, readdirSync as readdirSync13, statSync as statSync16 } from "node:fs";
288220
+ import { existsSync as existsSync52, mkdirSync as mkdirSync24, writeFileSync as writeFileSync25, readFileSync as readFileSync40, unlinkSync as unlinkSync13, readdirSync as readdirSync13, statSync as statSync17 } from "node:fs";
287939
288221
  import { join as join68, dirname as dirname22 } from "node:path";
287940
288222
  import { homedir as homedir20, tmpdir as tmpdir12, platform as platform4 } from "node:os";
287941
288223
  import { execSync as execSync40, spawn as nodeSpawn } from "node:child_process";
@@ -288066,7 +288348,7 @@ def main():
288066
288348
  if __name__ == "__main__": main()
288067
288349
  `;
288068
288350
  try {
288069
- writeFileSync24(targetPath, script, { mode: 493 });
288351
+ writeFileSync25(targetPath, script, { mode: 493 });
288070
288352
  } catch {
288071
288353
  }
288072
288354
  }
@@ -288907,7 +289189,7 @@ var init_voice = __esm({
288907
289189
  const destPath = join68(refsDir, destFilename);
288908
289190
  try {
288909
289191
  const data = readFileSync40(audioPath);
288910
- writeFileSync24(destPath, data);
289192
+ writeFileSync25(destPath, data);
288911
289193
  } catch (err) {
288912
289194
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
288913
289195
  }
@@ -288978,7 +289260,7 @@ var init_voice = __esm({
288978
289260
  saveCloneMeta(meta) {
288979
289261
  const dir = luxttsCloneRefsDir();
288980
289262
  if (!existsSync52(dir)) mkdirSync24(dir, { recursive: true });
288981
- writeFileSync24(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
289263
+ writeFileSync25(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
288982
289264
  }
288983
289265
  /** Audio file extensions recognized as clone references */
288984
289266
  static AUDIO_EXTS = /* @__PURE__ */ new Set(["wav", "mp3", "ogg", "flac", "m4a", "opus", "aac"]);
@@ -288998,7 +289280,7 @@ var init_voice = __esm({
288998
289280
  const p2 = join68(dir, f2);
288999
289281
  let size = 0;
289000
289282
  try {
289001
- size = statSync16(p2).size;
289283
+ size = statSync17(p2).size;
289002
289284
  } catch {
289003
289285
  }
289004
289286
  return {
@@ -289504,7 +289786,7 @@ var init_voice = __esm({
289504
289786
  buffer2.writeInt16LE(rSample < 0 ? rSample * 32768 : rSample * 32767, pos);
289505
289787
  pos += 2;
289506
289788
  }
289507
- writeFileSync24(path5, buffer2);
289789
+ writeFileSync25(path5, buffer2);
289508
289790
  }
289509
289791
  // -------------------------------------------------------------------------
289510
289792
  // Phonemization
@@ -289578,7 +289860,7 @@ var init_voice = __esm({
289578
289860
  return buffer2;
289579
289861
  }
289580
289862
  writeWav(samples, sampleRate, path5) {
289581
- writeFileSync24(path5, this.buildWavBuffer(samples, sampleRate));
289863
+ writeFileSync25(path5, this.buildWavBuffer(samples, sampleRate));
289582
289864
  }
289583
289865
  // -------------------------------------------------------------------------
289584
289866
  // Audio playback (system default speakers)
@@ -289807,7 +290089,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
289807
290089
  samples[i2] = Math.round(samples[i2] * volume);
289808
290090
  }
289809
290091
  const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
289810
- writeFileSync24(wavPath, scaled);
290092
+ writeFileSync25(wavPath, scaled);
289811
290093
  }
289812
290094
  } catch {
289813
290095
  }
@@ -290271,7 +290553,7 @@ if __name__ == '__main__':
290271
290553
  `;
290272
290554
  const scriptPath2 = luxttsInferScript();
290273
290555
  mkdirSync24(voiceDir(), { recursive: true });
290274
- writeFileSync24(scriptPath2, script);
290556
+ writeFileSync25(scriptPath2, script);
290275
290557
  }
290276
290558
  /** Ensure the LuxTTS daemon is running, spawn if needed */
290277
290559
  async ensureLuxttsDaemon() {
@@ -290411,7 +290693,7 @@ if __name__ == '__main__':
290411
290693
  }
290412
290694
  const header = wavData.subarray(0, 44);
290413
290695
  const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
290414
- writeFileSync24(wavPath, scaled);
290696
+ writeFileSync25(wavPath, scaled);
290415
290697
  }
290416
290698
  } catch {
290417
290699
  }
@@ -290529,13 +290811,13 @@ if __name__ == '__main__':
290529
290811
  const existing = JSON.parse(readFileSync40(pkgPath, "utf8"));
290530
290812
  if (!existing.dependencies?.["phonemizer"]) {
290531
290813
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
290532
- writeFileSync24(pkgPath, JSON.stringify(existing, null, 2));
290814
+ writeFileSync25(pkgPath, JSON.stringify(existing, null, 2));
290533
290815
  }
290534
290816
  } catch {
290535
290817
  }
290536
290818
  }
290537
290819
  if (!existsSync52(pkgPath)) {
290538
- writeFileSync24(pkgPath, JSON.stringify({
290820
+ writeFileSync25(pkgPath, JSON.stringify({
290539
290821
  name: "open-agents-voice",
290540
290822
  private: true,
290541
290823
  dependencies: expectedDeps
@@ -290620,7 +290902,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
290620
290902
  const configResp = await fetch(model.configUrl);
290621
290903
  if (!configResp.ok) throw new Error(`Failed to download config: HTTP ${configResp.status}`);
290622
290904
  const configText = await configResp.text();
290623
- writeFileSync24(configPath2, configText);
290905
+ writeFileSync25(configPath2, configText);
290624
290906
  }
290625
290907
  if (!existsSync52(onnxPath)) {
290626
290908
  renderInfo(`Downloading ${model.label} voice model (this may take a minute)...`);
@@ -290644,7 +290926,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
290644
290926
  }
290645
290927
  }
290646
290928
  const fullBuffer = Buffer.concat(chunks);
290647
- writeFileSync24(onnxPath, fullBuffer);
290929
+ writeFileSync25(onnxPath, fullBuffer);
290648
290930
  renderInfo(`${model.label} model downloaded (${formatBytes2(fullBuffer.length)}).`);
290649
290931
  }
290650
290932
  }
@@ -290685,7 +290967,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
290685
290967
  // packages/cli/src/tui/commands.ts
290686
290968
  import * as nodeOs from "node:os";
290687
290969
  import { execSync as nodeExecSync } from "node:child_process";
290688
- import { existsSync as existsSync53, readFileSync as readFileSync41, writeFileSync as writeFileSync25, mkdirSync as mkdirSync25, readdirSync as readdirSync14, statSync as statSync17, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
290970
+ import { existsSync as existsSync53, readFileSync as readFileSync41, writeFileSync as writeFileSync26, mkdirSync as mkdirSync25, readdirSync as readdirSync14, statSync as statSync18, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
290689
290971
  import { join as join69 } from "node:path";
290690
290972
  async function _immediateReregister(newUrl) {
290691
290973
  if (!_lastRegisteredSponsorPayload) return;
@@ -291622,7 +291904,7 @@ async function handleSlashCommand(input, ctx3) {
291622
291904
  ipfsFiles = files.length;
291623
291905
  for (const f2 of files) {
291624
291906
  try {
291625
- ipfsBytes += statSync17(join69(ipfsLocalDir, f2)).size;
291907
+ ipfsBytes += statSync18(join69(ipfsLocalDir, f2)).size;
291626
291908
  } catch {
291627
291909
  }
291628
291910
  }
@@ -291635,7 +291917,7 @@ async function handleSlashCommand(input, ctx3) {
291635
291917
  else {
291636
291918
  heliaBlocks++;
291637
291919
  try {
291638
- heliaBytes += statSync17(join69(dir, entry.name)).size;
291920
+ heliaBytes += statSync18(join69(dir, entry.name)).size;
291639
291921
  } catch {
291640
291922
  }
291641
291923
  }
@@ -291727,7 +292009,7 @@ async function handleSlashCommand(input, ctx3) {
291727
292009
  const count = memStore.count();
291728
292010
  lines.push(`
291729
292011
  ${c3.bold("Structured Memory (SQLite)")}`);
291730
- lines.push(` Memories: ${c3.bold(String(count))} DB: ${c3.dim(formatFileSize(statSync17(dbPath).size))}`);
292012
+ lines.push(` Memories: ${c3.bold(String(count))} DB: ${c3.dim(formatFileSize(statSync18(dbPath).size))}`);
291731
292013
  cDb(db);
291732
292014
  }
291733
292015
  } catch {
@@ -291758,7 +292040,7 @@ async function handleSlashCommand(input, ctx3) {
291758
292040
  walkStorage(full, subCat);
291759
292041
  } else {
291760
292042
  try {
291761
- const sz = statSync17(full).size;
292043
+ const sz = statSync18(full).size;
291762
292044
  totalBytes += sz;
291763
292045
  if (!categories[category]) categories[category] = { files: 0, bytes: 0 };
291764
292046
  categories[category].files++;
@@ -291937,7 +292219,7 @@ async function handleSlashCommand(input, ctx3) {
291937
292219
  };
291938
292220
  const jwtFile = join69(ctx3.repoRoot, ".oa", "fortemi-jwt.json");
291939
292221
  mkdirSync25(join69(ctx3.repoRoot, ".oa"), { recursive: true });
291940
- writeFileSync25(jwtFile, JSON.stringify(jwtPayload, null, 2));
292222
+ writeFileSync26(jwtFile, JSON.stringify(jwtPayload, null, 2));
291941
292223
  renderInfo(`Launching fortemi-react from ${fDir}...`);
291942
292224
  try {
291943
292225
  const { spawn: spawn26 } = __require("node:child_process");
@@ -291952,7 +292234,7 @@ async function handleSlashCommand(input, ctx3) {
291952
292234
  renderInfo(`JWT saved to ${jwtFile}`);
291953
292235
  renderInfo("Memory operations will proxy to fortemi when available.");
291954
292236
  const bridgeFile = join69(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
291955
- writeFileSync25(bridgeFile, JSON.stringify({
292237
+ writeFileSync26(bridgeFile, JSON.stringify({
291956
292238
  url: "http://localhost:3000",
291957
292239
  pid: child.pid,
291958
292240
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -294091,7 +294373,7 @@ async function showCohereDashboard(ctx3) {
294091
294373
  const snapItems = snaps.slice(0, 20).map((f2) => ({
294092
294374
  key: f2,
294093
294375
  label: f2.replace(".json", ""),
294094
- detail: `${formatFileSize(statSync17(join69(snapDir, f2)).size)}`
294376
+ detail: `${formatFileSize(statSync18(join69(snapDir, f2)).size)}`
294095
294377
  }));
294096
294378
  if (snapItems.length > 0) {
294097
294379
  await tuiSelect({
@@ -295152,10 +295434,10 @@ async function handleSponsoredEndpoint(ctx3, local) {
295152
295434
  sponsors.push(...verified);
295153
295435
  if (verified.length > 0) {
295154
295436
  try {
295155
- const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync37 } = __require("node:fs");
295437
+ const { mkdirSync: mkdirSync40, writeFileSync: writeFileSync38 } = __require("node:fs");
295156
295438
  mkdirSync40(sponsorDir2, { recursive: true });
295157
295439
  const cached = verified.map((s2) => ({ ...s2, lastVerified: Date.now() }));
295158
- writeFileSync37(knownFile, JSON.stringify(cached, null, 2));
295440
+ writeFileSync38(knownFile, JSON.stringify(cached, null, 2));
295159
295441
  } catch {
295160
295442
  }
295161
295443
  }
@@ -295252,7 +295534,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
295252
295534
  const existing = existsSync53(knownFile) ? JSON.parse(readFileSync41(knownFile, "utf8")) : [];
295253
295535
  const updated = existing.filter((s2) => (s2.url || s2.peerId || s2.name) !== saveKey);
295254
295536
  updated.push(selected);
295255
- writeFileSync25(knownFile, JSON.stringify(updated, null, 2), "utf8");
295537
+ writeFileSync26(knownFile, JSON.stringify(updated, null, 2), "utf8");
295256
295538
  } catch {
295257
295539
  }
295258
295540
  renderInfo(`Connected to sponsored endpoint: ${selected.name}`);
@@ -295320,11 +295602,11 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
295320
295602
  const models = await fetchModels(peerUrl, authKey);
295321
295603
  if (models.length > 0) {
295322
295604
  try {
295323
- const { writeFileSync: writeFileSync37, mkdirSync: mkdirSync40 } = await import("node:fs");
295605
+ const { writeFileSync: writeFileSync38, mkdirSync: mkdirSync40 } = await import("node:fs");
295324
295606
  const { join: join91, dirname: dirname28 } = await import("node:path");
295325
295607
  const cachePath = join91(ctx3.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
295326
295608
  mkdirSync40(dirname28(cachePath), { recursive: true });
295327
- writeFileSync37(cachePath, JSON.stringify({
295609
+ writeFileSync38(cachePath, JSON.stringify({
295328
295610
  peerId,
295329
295611
  cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
295330
295612
  models: models.map((m2) => ({ name: m2.name, size: m2.size, parameterSize: m2.parameterSize }))
@@ -297853,7 +298135,7 @@ __export(banner_exports, {
297853
298135
  saveBannerDesign: () => saveBannerDesign,
297854
298136
  setGridText: () => setGridText
297855
298137
  });
297856
- import { existsSync as existsSync55, readFileSync as readFileSync43, writeFileSync as writeFileSync26, mkdirSync as mkdirSync26 } from "node:fs";
298138
+ import { existsSync as existsSync55, readFileSync as readFileSync43, writeFileSync as writeFileSync27, mkdirSync as mkdirSync26 } from "node:fs";
297857
298139
  import { join as join71 } from "node:path";
297858
298140
  function generateMnemonic(seed) {
297859
298141
  let h = 2166136261;
@@ -297986,7 +298268,7 @@ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor =
297986
298268
  function saveBannerDesign(workDir, design) {
297987
298269
  const dir = join71(workDir, ".oa", "banners");
297988
298270
  mkdirSync26(dir, { recursive: true });
297989
- writeFileSync26(join71(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
298271
+ writeFileSync27(join71(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
297990
298272
  }
297991
298273
  function loadBannerDesign(workDir, id) {
297992
298274
  const file = join71(workDir, ".oa", "banners", `${id}.json`);
@@ -298306,7 +298588,7 @@ var init_banner = __esm({
298306
298588
  });
298307
298589
 
298308
298590
  // packages/cli/src/tui/carousel-descriptors.ts
298309
- import { existsSync as existsSync56, readFileSync as readFileSync44, writeFileSync as writeFileSync27, mkdirSync as mkdirSync27, readdirSync as readdirSync16 } from "node:fs";
298591
+ import { existsSync as existsSync56, readFileSync as readFileSync44, writeFileSync as writeFileSync28, mkdirSync as mkdirSync27, readdirSync as readdirSync16 } from "node:fs";
298310
298592
  import { join as join72, basename as basename14 } from "node:path";
298311
298593
  function loadToolProfile(repoRoot) {
298312
298594
  const filePath = join72(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
@@ -298320,7 +298602,7 @@ function loadToolProfile(repoRoot) {
298320
298602
  function saveToolProfile(repoRoot, profile) {
298321
298603
  const contextDir = join72(repoRoot, OA_DIR, "context");
298322
298604
  mkdirSync27(contextDir, { recursive: true });
298323
- writeFileSync27(join72(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
298605
+ writeFileSync28(join72(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
298324
298606
  }
298325
298607
  function categorizeToolCall(toolName) {
298326
298608
  for (const cat2 of TOOL_CATEGORIES) {
@@ -298392,7 +298674,7 @@ function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
298392
298674
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
298393
298675
  sourceHash
298394
298676
  };
298395
- writeFileSync27(join72(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
298677
+ writeFileSync28(join72(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
298396
298678
  }
298397
298679
  function generateDescriptors(repoRoot) {
298398
298680
  const profile = loadToolProfile(repoRoot);
@@ -299351,7 +299633,7 @@ var init_promptLoader3 = __esm({
299351
299633
  });
299352
299634
 
299353
299635
  // packages/cli/src/tui/dream-engine.ts
299354
- import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync28, readFileSync as readFileSync46, existsSync as existsSync58, readdirSync as readdirSync17 } from "node:fs";
299636
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync29, readFileSync as readFileSync46, existsSync as existsSync58, readdirSync as readdirSync17 } from "node:fs";
299355
299637
  import { join as join75, basename as basename15 } from "node:path";
299356
299638
  import { execSync as execSync42 } from "node:child_process";
299357
299639
  function setDreamWriteContent(fn) {
@@ -299571,7 +299853,7 @@ var init_dream_engine = __esm({
299571
299853
  try {
299572
299854
  const dir = join75(targetPath, "..");
299573
299855
  mkdirSync29(dir, { recursive: true });
299574
- writeFileSync28(targetPath, content, "utf-8");
299856
+ writeFileSync29(targetPath, content, "utf-8");
299575
299857
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
299576
299858
  } catch (err) {
299577
299859
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -299611,7 +299893,7 @@ var init_dream_engine = __esm({
299611
299893
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
299612
299894
  }
299613
299895
  content = content.replace(oldStr, newStr);
299614
- writeFileSync28(targetPath, content, "utf-8");
299896
+ writeFileSync29(targetPath, content, "utf-8");
299615
299897
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
299616
299898
  } catch (err) {
299617
299899
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -299657,7 +299939,7 @@ var init_dream_engine = __esm({
299657
299939
  try {
299658
299940
  const dir = join75(targetPath, "..");
299659
299941
  mkdirSync29(dir, { recursive: true });
299660
- writeFileSync28(targetPath, content, "utf-8");
299942
+ writeFileSync29(targetPath, content, "utf-8");
299661
299943
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
299662
299944
  } catch (err) {
299663
299945
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -299697,7 +299979,7 @@ var init_dream_engine = __esm({
299697
299979
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
299698
299980
  }
299699
299981
  content = content.replace(oldStr, newStr);
299700
- writeFileSync28(targetPath, content, "utf-8");
299982
+ writeFileSync29(targetPath, content, "utf-8");
299701
299983
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
299702
299984
  } catch (err) {
299703
299985
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -299855,7 +300137,7 @@ ${result.summary}`;
299855
300137
  renderDreamContraction(cycle);
299856
300138
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
299857
300139
  const summaryPath = join75(this.dreamsDir, `cycle-${cycle}-summary.md`);
299858
- writeFileSync28(summaryPath, cycleSummary, "utf-8");
300140
+ writeFileSync29(summaryPath, cycleSummary, "utf-8");
299859
300141
  }
299860
300142
  if (mode === "lucid" && !this.abortController.signal.aborted) {
299861
300143
  this.saveVersionCheckpoint(cycle);
@@ -300516,7 +300798,7 @@ ${summaryResult}
300516
300798
  `;
300517
300799
  try {
300518
300800
  mkdirSync29(this.dreamsDir, { recursive: true });
300519
- writeFileSync28(reportPath, report, "utf-8");
300801
+ writeFileSync29(reportPath, report, "utf-8");
300520
300802
  } catch {
300521
300803
  }
300522
300804
  renderSwarmComplete(workspace);
@@ -300601,10 +300883,10 @@ ${summaryResult}
300601
300883
  encoding: "utf-8",
300602
300884
  timeout: 5e3
300603
300885
  }).trim();
300604
- writeFileSync28(join75(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
300605
- writeFileSync28(join75(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
300606
- writeFileSync28(join75(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
300607
- writeFileSync28(
300886
+ writeFileSync29(join75(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
300887
+ writeFileSync29(join75(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
300888
+ writeFileSync29(join75(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
300889
+ writeFileSync29(
300608
300890
  join75(checkpointDir, "checkpoint.json"),
300609
300891
  JSON.stringify({
300610
300892
  cycle,
@@ -300616,7 +300898,7 @@ ${summaryResult}
300616
300898
  );
300617
300899
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
300618
300900
  } catch {
300619
- writeFileSync28(
300901
+ writeFileSync29(
300620
300902
  join75(checkpointDir, "checkpoint.json"),
300621
300903
  JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2),
300622
300904
  "utf-8"
@@ -300678,7 +300960,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
300678
300960
  ---
300679
300961
  *Auto-generated by open-agents dream engine*
300680
300962
  `;
300681
- writeFileSync28(join75(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
300963
+ writeFileSync29(join75(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
300682
300964
  } catch {
300683
300965
  }
300684
300966
  }
@@ -300764,7 +301046,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
300764
301046
  durationMs
300765
301047
  });
300766
301048
  try {
300767
- writeFileSync28(
301049
+ writeFileSync29(
300768
301050
  join75(memoryDir, ".last-consolidation"),
300769
301051
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), summary: result.summary?.slice(0, 500) }) + "\n"
300770
301052
  );
@@ -300782,7 +301064,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
300782
301064
  /** Save dream state for resume/inspection */
300783
301065
  saveDreamState() {
300784
301066
  try {
300785
- writeFileSync28(
301067
+ writeFileSync29(
300786
301068
  join75(this.dreamsDir, "dream-state.json"),
300787
301069
  JSON.stringify(this.state, null, 2) + "\n",
300788
301070
  "utf-8"
@@ -301153,7 +301435,7 @@ var init_bless_engine = __esm({
301153
301435
  });
301154
301436
 
301155
301437
  // packages/cli/src/tui/dmn-engine.ts
301156
- import { existsSync as existsSync59, readFileSync as readFileSync47, writeFileSync as writeFileSync29, mkdirSync as mkdirSync30, readdirSync as readdirSync18, unlinkSync as unlinkSync14 } from "node:fs";
301438
+ import { existsSync as existsSync59, readFileSync as readFileSync47, writeFileSync as writeFileSync30, mkdirSync as mkdirSync30, readdirSync as readdirSync18, unlinkSync as unlinkSync14 } from "node:fs";
301157
301439
  import { join as join76, basename as basename16 } from "node:path";
301158
301440
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
301159
301441
  const competenceReport = competence.length > 0 ? competence.map((c7) => {
@@ -301920,7 +302202,7 @@ OUTPUT: Call task_complete with JSON:
301920
302202
  }
301921
302203
  saveState() {
301922
302204
  try {
301923
- writeFileSync29(
302205
+ writeFileSync30(
301924
302206
  join76(this.stateDir, "state.json"),
301925
302207
  JSON.stringify(this.state, null, 2) + "\n",
301926
302208
  "utf-8"
@@ -301931,7 +302213,7 @@ OUTPUT: Call task_complete with JSON:
301931
302213
  saveCycleResult(result) {
301932
302214
  try {
301933
302215
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
301934
- writeFileSync29(
302216
+ writeFileSync30(
301935
302217
  join76(this.historyDir, filename),
301936
302218
  JSON.stringify(result, null, 2) + "\n",
301937
302219
  "utf-8"
@@ -305923,7 +306205,7 @@ var init_chat_session = __esm({
305923
306205
  });
305924
306206
 
305925
306207
  // packages/cli/src/api/usage-tracker.ts
305926
- import { mkdirSync as mkdirSync33, readFileSync as readFileSync51, writeFileSync as writeFileSync30, existsSync as existsSync64 } from "node:fs";
306208
+ import { mkdirSync as mkdirSync33, readFileSync as readFileSync51, writeFileSync as writeFileSync31, existsSync as existsSync64 } from "node:fs";
305927
306209
  import { join as join81 } from "node:path";
305928
306210
  function initUsageTracker(oaDir) {
305929
306211
  const dir = join81(oaDir, "usage");
@@ -305967,7 +306249,7 @@ function flush2() {
305967
306249
  if (!initialized2 || !dirty) return;
305968
306250
  try {
305969
306251
  store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
305970
- writeFileSync30(usageFile, JSON.stringify(store, null, 2), "utf-8");
306252
+ writeFileSync31(usageFile, JSON.stringify(store, null, 2), "utf-8");
305971
306253
  dirty = false;
305972
306254
  } catch {
305973
306255
  }
@@ -305995,7 +306277,7 @@ var init_usage_tracker = __esm({
305995
306277
  });
305996
306278
 
305997
306279
  // packages/cli/src/api/profiles.ts
305998
- import { existsSync as existsSync65, readFileSync as readFileSync52, writeFileSync as writeFileSync31, mkdirSync as mkdirSync34, readdirSync as readdirSync22, unlinkSync as unlinkSync16 } from "node:fs";
306280
+ import { existsSync as existsSync65, readFileSync as readFileSync52, writeFileSync as writeFileSync32, mkdirSync as mkdirSync34, readdirSync as readdirSync22, unlinkSync as unlinkSync16 } from "node:fs";
305999
306281
  import { join as join82 } from "node:path";
306000
306282
  import { homedir as homedir23 } from "node:os";
306001
306283
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes18, scryptSync as scryptSync3 } from "node:crypto";
@@ -306065,10 +306347,10 @@ function saveProfile(profile, password, scope = "global", projectDir) {
306065
306347
  profile.modified = (/* @__PURE__ */ new Date()).toISOString();
306066
306348
  if (password) {
306067
306349
  const encrypted = encryptProfile(profile, password);
306068
- writeFileSync31(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
306350
+ writeFileSync32(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
306069
306351
  } else {
306070
306352
  profile.encrypted = false;
306071
- writeFileSync31(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
306353
+ writeFileSync32(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
306072
306354
  }
306073
306355
  }
306074
306356
  function deleteProfile(name10, scope = "global", projectDir) {
@@ -306190,7 +306472,7 @@ var init_profiles = __esm({
306190
306472
 
306191
306473
  // packages/cli/src/docker.ts
306192
306474
  import { execSync as execSync43, spawn as spawn23 } from "node:child_process";
306193
- import { existsSync as existsSync66, mkdirSync as mkdirSync35, writeFileSync as writeFileSync32 } from "node:fs";
306475
+ import { existsSync as existsSync66, mkdirSync as mkdirSync35, writeFileSync as writeFileSync33 } from "node:fs";
306194
306476
  import { join as join83, resolve as resolve33, dirname as dirname24 } from "node:path";
306195
306477
  import { homedir as homedir24 } from "node:os";
306196
306478
  import { fileURLToPath as fileURLToPath15 } from "node:url";
@@ -306415,8 +306697,8 @@ chown -R node:node /workspace /home/node/.oa /home/node/.open-agents 2>/dev/null
306415
306697
  if [ "$1" = "oa" ]; then shift; exec su - node -c "cd /workspace && oa $*"; fi
306416
306698
  exec "$@"
306417
306699
  `;
306418
- writeFileSync32(join83(dir, "Dockerfile"), dockerfile);
306419
- writeFileSync32(join83(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
306700
+ writeFileSync33(join83(dir, "Dockerfile"), dockerfile);
306701
+ writeFileSync33(join83(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
306420
306702
  }
306421
306703
  function hasNvidiaGpu() {
306422
306704
  try {
@@ -306495,7 +306777,7 @@ import { createRequire as createRequire4 } from "node:module";
306495
306777
  import { fileURLToPath as fileURLToPath16 } from "node:url";
306496
306778
  import { dirname as dirname25, join as join84, resolve as resolve34 } from "node:path";
306497
306779
  import { spawn as spawn24, execSync as execSync44 } from "node:child_process";
306498
- import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync33, readFileSync as readFileSync53, readdirSync as readdirSync23, existsSync as existsSync67 } from "node:fs";
306780
+ import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync34, readFileSync as readFileSync53, readdirSync as readdirSync23, existsSync as existsSync67 } from "node:fs";
306499
306781
  import { randomBytes as randomBytes19, randomUUID as randomUUID5 } from "node:crypto";
306500
306782
  function getVersion3() {
306501
306783
  try {
@@ -307376,7 +307658,7 @@ async function handleV1Run(req2, res) {
307376
307658
  job.sandbox = sandbox;
307377
307659
  }
307378
307660
  job.pid = child.pid ?? 0;
307379
- writeFileSync33(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307661
+ writeFileSync34(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307380
307662
  runningProcesses.set(id, child);
307381
307663
  if (streamMode) {
307382
307664
  res.writeHead(200, {
@@ -307403,7 +307685,7 @@ async function handleV1Run(req2, res) {
307403
307685
  job.status = code8 === 0 ? "completed" : "failed";
307404
307686
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
307405
307687
  try {
307406
- writeFileSync33(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307688
+ writeFileSync34(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307407
307689
  } catch {
307408
307690
  }
307409
307691
  runningProcesses.delete(id);
@@ -307443,7 +307725,7 @@ async function handleV1Run(req2, res) {
307443
307725
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
307444
307726
  }
307445
307727
  try {
307446
- writeFileSync33(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307728
+ writeFileSync34(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307447
307729
  } catch {
307448
307730
  }
307449
307731
  runningProcesses.delete(id);
@@ -307511,7 +307793,7 @@ function handleV1RunsDelete(res, id) {
307511
307793
  job.error = "Aborted via API";
307512
307794
  const dir = jobsDir();
307513
307795
  try {
307514
- writeFileSync33(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307796
+ writeFileSync34(join84(dir, `${id}.json`), JSON.stringify(job, null, 2));
307515
307797
  } catch {
307516
307798
  }
307517
307799
  runningProcesses.delete(id);
@@ -308410,7 +308692,7 @@ import { cwd } from "node:process";
308410
308692
  import { resolve as resolve35, join as join85, dirname as dirname26, extname as extname11 } from "node:path";
308411
308693
  import { createRequire as createRequire5 } from "node:module";
308412
308694
  import { fileURLToPath as fileURLToPath17 } from "node:url";
308413
- import { readFileSync as readFileSync54, writeFileSync as writeFileSync34, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync37 } from "node:fs";
308695
+ import { readFileSync as readFileSync54, writeFileSync as writeFileSync35, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync37 } from "node:fs";
308414
308696
  import { existsSync as existsSync68 } from "node:fs";
308415
308697
  import { execSync as execSync45 } from "node:child_process";
308416
308698
  import { homedir as homedir25 } from "node:os";
@@ -310054,7 +310336,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
310054
310336
  }
310055
310337
  ikState.session_count = (ikState.session_count || 0) + 1;
310056
310338
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
310057
- writeFileSync34(ikFile, JSON.stringify(ikState, null, 2));
310339
+ writeFileSync35(ikFile, JSON.stringify(ikState, null, 2));
310058
310340
  } catch (ikErr) {
310059
310341
  try {
310060
310342
  console.error("[IK-OBSERVE]", ikErr);
@@ -310086,7 +310368,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
310086
310368
  if (ikState.version_history.length > 200) ikState.version_history = ikState.version_history.slice(-200);
310087
310369
  ikState.session_count = (ikState.session_count || 0) + 1;
310088
310370
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
310089
- writeFileSync34(ikFile, JSON.stringify(ikState, null, 2));
310371
+ writeFileSync35(ikFile, JSON.stringify(ikState, null, 2));
310090
310372
  }
310091
310373
  } catch {
310092
310374
  }
@@ -311104,7 +311386,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
311104
311386
  if (Math.random() < 0.02) {
311105
311387
  const all2 = readFileSync54(HISTORY_FILE, "utf8").trim().split("\n");
311106
311388
  if (all2.length > MAX_HISTORY_LINES) {
311107
- writeFileSync34(HISTORY_FILE, all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
311389
+ writeFileSync35(HISTORY_FILE, all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
311108
311390
  }
311109
311391
  }
311110
311392
  } catch {
@@ -313811,7 +314093,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
313811
314093
  ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
313812
314094
  ikState.session_count = (ikState.session_count || 0) + 1;
313813
314095
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
313814
- writeFileSync34(ikFile, JSON.stringify(ikState, null, 2));
314096
+ writeFileSync35(ikFile, JSON.stringify(ikState, null, 2));
313815
314097
  } catch (ikErr) {
313816
314098
  }
313817
314099
  try {
@@ -313843,7 +314125,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
313843
314125
  });
313844
314126
  if (variants.length > 50) variants = variants.slice(-50);
313845
314127
  mkdirSync37(archeDir, { recursive: true });
313846
- writeFileSync34(archeFile, JSON.stringify(variants, null, 2));
314128
+ writeFileSync35(archeFile, JSON.stringify(variants, null, 2));
313847
314129
  } catch {
313848
314130
  }
313849
314131
  }
@@ -313861,7 +314143,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
313861
314143
  updated = true;
313862
314144
  }
313863
314145
  if (updated) {
313864
- writeFileSync34(metaFile, JSON.stringify(store2, null, 2));
314146
+ writeFileSync35(metaFile, JSON.stringify(store2, null, 2));
313865
314147
  }
313866
314148
  }
313867
314149
  } catch {
@@ -313951,7 +314233,7 @@ Rules:
313951
314233
  });
313952
314234
  if (store2.length > 100) store2 = store2.slice(-100);
313953
314235
  mkdirSync37(metaDir, { recursive: true });
313954
- writeFileSync34(storeFile, JSON.stringify(store2, null, 2));
314236
+ writeFileSync35(storeFile, JSON.stringify(store2, null, 2));
313955
314237
  }
313956
314238
  }
313957
314239
  } catch {
@@ -314001,7 +314283,7 @@ Rules:
314001
314283
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
314002
314284
  ikState.session_count = (ikState.session_count || 0) + 1;
314003
314285
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
314004
- writeFileSync34(ikFile, JSON.stringify(ikState, null, 2));
314286
+ writeFileSync35(ikFile, JSON.stringify(ikState, null, 2));
314005
314287
  }
314006
314288
  const metaFile = join85(repoRoot, ".oa", "memory", "metabolism", "store.json");
314007
314289
  if (existsSync68(metaFile)) {
@@ -314013,7 +314295,7 @@ Rules:
314013
314295
  item.scores.utility = Math.max(0, (item.scores.utility || 0.5) - 0.05);
314014
314296
  item.scores.confidence = Math.max(0, (item.scores.confidence || 0.5) - 0.02);
314015
314297
  }
314016
- writeFileSync34(metaFile, JSON.stringify(store2, null, 2));
314298
+ writeFileSync35(metaFile, JSON.stringify(store2, null, 2));
314017
314299
  }
314018
314300
  try {
314019
314301
  const archeDir = join85(repoRoot, ".oa", "arche");
@@ -314035,7 +314317,7 @@ Rules:
314035
314317
  });
314036
314318
  if (variants.length > 50) variants = variants.slice(-50);
314037
314319
  mkdirSync37(archeDir, { recursive: true });
314038
- writeFileSync34(archeFile, JSON.stringify(variants, null, 2));
314320
+ writeFileSync35(archeFile, JSON.stringify(variants, null, 2));
314039
314321
  } catch {
314040
314322
  }
314041
314323
  } catch {
@@ -314117,7 +314399,7 @@ __export(run_exports, {
314117
314399
  });
314118
314400
  import { resolve as resolve36 } from "node:path";
314119
314401
  import { spawn as spawn25 } from "node:child_process";
314120
- import { mkdirSync as mkdirSync38, writeFileSync as writeFileSync35, readFileSync as readFileSync55, readdirSync as readdirSync25, existsSync as existsSync69 } from "node:fs";
314402
+ import { mkdirSync as mkdirSync38, writeFileSync as writeFileSync36, readFileSync as readFileSync55, readdirSync as readdirSync25, existsSync as existsSync69 } from "node:fs";
314121
314403
  import { randomBytes as randomBytes20 } from "node:crypto";
314122
314404
  import { join as join86 } from "node:path";
314123
314405
  function jobsDir2(repoPath) {
@@ -314238,7 +314520,7 @@ async function runBackground(task, config, opts) {
314238
314520
  }
314239
314521
  });
314240
314522
  job.pid = child.pid ?? 0;
314241
- writeFileSync35(join86(dir, `${id}.json`), JSON.stringify(job, null, 2));
314523
+ writeFileSync36(join86(dir, `${id}.json`), JSON.stringify(job, null, 2));
314242
314524
  let output = "";
314243
314525
  child.stdout?.on("data", (chunk) => {
314244
314526
  output += chunk.toString();
@@ -314254,7 +314536,7 @@ async function runBackground(task, config, opts) {
314254
314536
  job.summary = result.summary;
314255
314537
  job.durationMs = result.durationMs;
314256
314538
  job.error = result.error;
314257
- writeFileSync35(join86(dir, `${id}.json`), JSON.stringify(job, null, 2));
314539
+ writeFileSync36(join86(dir, `${id}.json`), JSON.stringify(job, null, 2));
314258
314540
  } catch {
314259
314541
  }
314260
314542
  });
@@ -314529,7 +314811,7 @@ __export(index_repo_exports, {
314529
314811
  indexRepoCommand: () => indexRepoCommand
314530
314812
  });
314531
314813
  import { resolve as resolve37 } from "node:path";
314532
- import { existsSync as existsSync70, statSync as statSync19 } from "node:fs";
314814
+ import { existsSync as existsSync70, statSync as statSync20 } from "node:fs";
314533
314815
  import { cwd as cwd2 } from "node:process";
314534
314816
  async function indexRepoCommand(opts, _config3) {
314535
314817
  const repoRoot = resolve37(opts.repoPath ?? cwd2());
@@ -314539,7 +314821,7 @@ async function indexRepoCommand(opts, _config3) {
314539
314821
  printError(`Path does not exist: ${repoRoot}`);
314540
314822
  process.exit(1);
314541
314823
  }
314542
- const stat6 = statSync19(repoRoot);
314824
+ const stat6 = statSync20(repoRoot);
314543
314825
  if (!stat6.isDirectory()) {
314544
314826
  printError(`Path is not a directory: ${repoRoot}`);
314545
314827
  process.exit(1);
@@ -315077,7 +315359,7 @@ __export(eval_exports, {
315077
315359
  evalCommand: () => evalCommand
315078
315360
  });
315079
315361
  import { tmpdir as tmpdir13 } from "node:os";
315080
- import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync36 } from "node:fs";
315362
+ import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync37 } from "node:fs";
315081
315363
  import { join as join89 } from "node:path";
315082
315364
  async function evalCommand(opts, config) {
315083
315365
  const suiteName = opts.suite ?? "basic";
@@ -315209,7 +315491,7 @@ async function evalCommand(opts, config) {
315209
315491
  function createTempEvalRepo() {
315210
315492
  const dir = join89(tmpdir13(), `open-agents-eval-${Date.now()}`);
315211
315493
  mkdirSync39(dir, { recursive: true });
315212
- writeFileSync36(
315494
+ writeFileSync37(
315213
315495
  join89(dir, "package.json"),
315214
315496
  JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
315215
315497
  "utf8"