holomime 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1472,7 +1472,7 @@ __export(training_export_exports, {
1472
1472
  extractRLHFExamples: () => extractRLHFExamples,
1473
1473
  loadTranscripts: () => loadTranscripts
1474
1474
  });
1475
- import { readdirSync as readdirSync4, readFileSync as readFileSync17 } from "fs";
1475
+ import { readdirSync as readdirSync4, readFileSync as readFileSync18 } from "fs";
1476
1476
  import { join as join13 } from "path";
1477
1477
  function extractDPOPairs(transcript) {
1478
1478
  const pairs = [];
@@ -1579,7 +1579,7 @@ function loadTranscripts(sessionsDir) {
1579
1579
  try {
1580
1580
  const files = readdirSync4(sessionsDir).filter((f) => f.endsWith(".json")).sort();
1581
1581
  return files.map((f) => {
1582
- const raw = readFileSync17(join13(sessionsDir, f), "utf-8");
1582
+ const raw = readFileSync18(join13(sessionsDir, f), "utf-8");
1583
1583
  return JSON.parse(raw);
1584
1584
  });
1585
1585
  } catch {
@@ -1844,8 +1844,8 @@ __export(train_openai_exports, {
1844
1844
  createFineTuningJob: () => createFineTuningJob,
1845
1845
  uploadTrainingFile: () => uploadTrainingFile
1846
1846
  });
1847
- import { readFileSync as readFileSync18, existsSync as existsSync15 } from "fs";
1848
- import { resolve as resolve20 } from "path";
1847
+ import { readFileSync as readFileSync19, existsSync as existsSync15 } from "fs";
1848
+ import { resolve as resolve21 } from "path";
1849
1849
  function convertDPOToOpenAI(pairs) {
1850
1850
  return pairs.map(
1851
1851
  (pair) => JSON.stringify({
@@ -1942,7 +1942,7 @@ async function getJobEvents(apiKey, jobId, limit = 5) {
1942
1942
  return data.data ?? [];
1943
1943
  }
1944
1944
  function sleep(ms) {
1945
- return new Promise((resolve44) => setTimeout(resolve44, ms));
1945
+ return new Promise((resolve45) => setTimeout(resolve45, ms));
1946
1946
  }
1947
1947
  var OPENAI_API, POLL_INTERVAL_MS, OpenAITrainProvider;
1948
1948
  var init_train_openai = __esm({
@@ -1959,10 +1959,10 @@ var init_train_openai = __esm({
1959
1959
  yield { stage: "converting", message: "Converting to OpenAI format..." };
1960
1960
  let systemPrompt;
1961
1961
  if (options.personalityPath) {
1962
- const fullPath = resolve20(process.cwd(), options.personalityPath);
1962
+ const fullPath = resolve21(process.cwd(), options.personalityPath);
1963
1963
  if (existsSync15(fullPath)) {
1964
1964
  try {
1965
- const spec = JSON.parse(readFileSync18(fullPath, "utf-8"));
1965
+ const spec = JSON.parse(readFileSync19(fullPath, "utf-8"));
1966
1966
  const name = spec.name ?? "Agent";
1967
1967
  const purpose = spec.purpose ?? "";
1968
1968
  const parts = [`You are ${name}.`];
@@ -2063,8 +2063,8 @@ __export(train_huggingface_exports, {
2063
2063
  uploadTrainingDataset: () => uploadTrainingDataset
2064
2064
  });
2065
2065
  import { spawn } from "child_process";
2066
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync16, mkdirSync as mkdirSync10, existsSync as existsSync16 } from "fs";
2067
- import { resolve as resolve21, join as join14 } from "path";
2066
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync16, mkdirSync as mkdirSync10, existsSync as existsSync16 } from "fs";
2067
+ import { resolve as resolve22, join as join14 } from "path";
2068
2068
  import { createInterface as createInterface2 } from "readline";
2069
2069
  async function checkPythonDeps() {
2070
2070
  const pythonCandidates = ["python3", "python"];
@@ -2093,14 +2093,14 @@ async function checkPythonDeps() {
2093
2093
  };
2094
2094
  }
2095
2095
  function writeHFTrainingFile(data) {
2096
- const tmpDir = resolve21(process.cwd(), ".holomime/tmp");
2096
+ const tmpDir = resolve22(process.cwd(), ".holomime/tmp");
2097
2097
  mkdirSync10(tmpDir, { recursive: true });
2098
2098
  const filePath = join14(tmpDir, `hf-train-${Date.now()}.json`);
2099
2099
  writeFileSync16(filePath, JSON.stringify(data, null, 2));
2100
2100
  return filePath;
2101
2101
  }
2102
2102
  function sleep2(ms) {
2103
- return new Promise((resolve44) => setTimeout(resolve44, ms));
2103
+ return new Promise((resolve45) => setTimeout(resolve45, ms));
2104
2104
  }
2105
2105
  async function getHFUsername(token) {
2106
2106
  const response = await fetch(`${HF_API}/whoami-v2`, {
@@ -2255,9 +2255,9 @@ var init_train_huggingface = __esm({
2255
2255
  yield { stage: "converting", message: "Writing training data..." };
2256
2256
  const dataPath = writeHFTrainingFile(data);
2257
2257
  const suffix = options.suffix ?? "holomime";
2258
- const outputDir = resolve21(process.cwd(), `.holomime/models/holomime-ft-${suffix}`);
2258
+ const outputDir = resolve22(process.cwd(), `.holomime/models/holomime-ft-${suffix}`);
2259
2259
  yield { stage: "converting", message: `Data written to ${dataPath}` };
2260
- const scriptPath = resolve21(
2260
+ const scriptPath = resolve22(
2261
2261
  new URL(".", import.meta.url).pathname,
2262
2262
  "../../scripts/train_hf.py"
2263
2263
  );
@@ -2388,10 +2388,10 @@ var init_train_huggingface = __esm({
2388
2388
  yield { stage: "converting", message: "Converting to HuggingFace TRL format..." };
2389
2389
  let systemPrompt;
2390
2390
  if (options.personalityPath) {
2391
- const fullPath = resolve21(process.cwd(), options.personalityPath);
2391
+ const fullPath = resolve22(process.cwd(), options.personalityPath);
2392
2392
  if (existsSync16(fullPath)) {
2393
2393
  try {
2394
- const spec = JSON.parse(readFileSync19(fullPath, "utf-8"));
2394
+ const spec = JSON.parse(readFileSync20(fullPath, "utf-8"));
2395
2395
  const name = spec.name ?? "Agent";
2396
2396
  const purpose = spec.purpose ?? "";
2397
2397
  const parts = [`You are ${name}.`];
@@ -2706,7 +2706,7 @@ __export(train_eval_exports, {
2706
2706
  });
2707
2707
  import { spawn as spawn2 } from "child_process";
2708
2708
  import { writeFileSync as writeFileSync17, mkdirSync as mkdirSync11 } from "fs";
2709
- import { resolve as resolve22, join as join15 } from "path";
2709
+ import { resolve as resolve23, join as join15 } from "path";
2710
2710
  import { createInterface as createInterface3 } from "readline";
2711
2711
  function generateTestPrompts(data) {
2712
2712
  const prompts = /* @__PURE__ */ new Set();
@@ -2798,11 +2798,11 @@ async function runHFAutoEval(baseModel, fineTunedModel, agentName, data, onProgr
2798
2798
  if (prompts.length === 0) {
2799
2799
  return evaluateOutcome(agentName, [], []);
2800
2800
  }
2801
- const tmpDir = resolve22(process.cwd(), ".holomime/tmp");
2801
+ const tmpDir = resolve23(process.cwd(), ".holomime/tmp");
2802
2802
  mkdirSync11(tmpDir, { recursive: true });
2803
2803
  const promptsPath = join15(tmpDir, `eval-prompts-${Date.now()}.json`);
2804
2804
  writeFileSync17(promptsPath, JSON.stringify(prompts));
2805
- const scriptPath = resolve22(
2805
+ const scriptPath = resolve23(
2806
2806
  new URL(".", import.meta.url).pathname,
2807
2807
  "../../scripts/eval_hf.py"
2808
2808
  );
@@ -3098,7 +3098,7 @@ var init_vapi_adapter = __esm({
3098
3098
  this.callbacks = callbacks;
3099
3099
  const port = this.options.port ?? 3001;
3100
3100
  const host = this.options.host ?? "0.0.0.0";
3101
- return new Promise((resolve44, reject) => {
3101
+ return new Promise((resolve45, reject) => {
3102
3102
  this.server = createServer2((req, res) => this.handleRequest(req, res));
3103
3103
  this.server.on("error", (err) => {
3104
3104
  callbacks.onError(`Vapi webhook server error: ${err.message}`);
@@ -3107,22 +3107,22 @@ var init_vapi_adapter = __esm({
3107
3107
  this.server.listen(port, host, () => {
3108
3108
  this.connected = true;
3109
3109
  callbacks.onConnected?.();
3110
- resolve44();
3110
+ resolve45();
3111
3111
  });
3112
3112
  });
3113
3113
  }
3114
3114
  async disconnect() {
3115
- return new Promise((resolve44) => {
3115
+ return new Promise((resolve45) => {
3116
3116
  if (this.server) {
3117
3117
  this.server.close(() => {
3118
3118
  this.connected = false;
3119
3119
  this.callbacks?.onDisconnected?.();
3120
3120
  this.callbacks = null;
3121
3121
  this.server = null;
3122
- resolve44();
3122
+ resolve45();
3123
3123
  });
3124
3124
  } else {
3125
- resolve44();
3125
+ resolve45();
3126
3126
  }
3127
3127
  });
3128
3128
  }
@@ -3284,7 +3284,7 @@ var generic_adapter_exports = {};
3284
3284
  __export(generic_adapter_exports, {
3285
3285
  GenericAdapter: () => GenericAdapter
3286
3286
  });
3287
- import { existsSync as existsSync28, watchFile as watchFile2, unwatchFile as unwatchFile2, readFileSync as readFileSync34 } from "fs";
3287
+ import { existsSync as existsSync28, watchFile as watchFile2, unwatchFile as unwatchFile2, readFileSync as readFileSync35 } from "fs";
3288
3288
  import { createInterface as createInterface4 } from "readline";
3289
3289
  var GenericAdapter;
3290
3290
  var init_generic_adapter = __esm({
@@ -3329,7 +3329,7 @@ var init_generic_adapter = __esm({
3329
3329
  callbacks.onError(`Input file not found: ${filePath}`);
3330
3330
  return;
3331
3331
  }
3332
- const content = readFileSync34(filePath, "utf-8");
3332
+ const content = readFileSync35(filePath, "utf-8");
3333
3333
  const lines = content.split("\n").filter(Boolean);
3334
3334
  this.connected = true;
3335
3335
  callbacks.onConnected?.();
@@ -3340,7 +3340,7 @@ var init_generic_adapter = __esm({
3340
3340
  if (this.options.watch) {
3341
3341
  watchFile2(filePath, { interval: 500 }, () => {
3342
3342
  try {
3343
- const newContent = readFileSync34(filePath, "utf-8");
3343
+ const newContent = readFileSync35(filePath, "utf-8");
3344
3344
  const newLines = newContent.split("\n").filter(Boolean);
3345
3345
  for (let i = this.processedLines; i < newLines.length; i++) {
3346
3346
  this.processLine(newLines[i]);
@@ -8689,7 +8689,7 @@ function parseRetryAfter(response) {
8689
8689
  return 0;
8690
8690
  }
8691
8691
  function delay(ms) {
8692
- return new Promise((resolve44) => setTimeout(resolve44, ms));
8692
+ return new Promise((resolve45) => setTimeout(resolve45, ms));
8693
8693
  }
8694
8694
  var OpenAIProvider = class {
8695
8695
  name = "openai";
@@ -8988,19 +8988,19 @@ async function runLiveSession(spec, diagnosis, provider, maxTurns, apply, intera
8988
8988
  onSupervisorPrompt: interactive ? async (phase, turn) => {
8989
8989
  if (skipInteractive) return null;
8990
8990
  const rl = createInterface({ input: process.stdin, output: process.stdout });
8991
- return new Promise((resolve44) => {
8991
+ return new Promise((resolve45) => {
8992
8992
  rl.question(chalk14.magenta(`
8993
8993
  [Supervisor] `) + chalk14.dim(`(phase: ${phase}, turn ${turn}) `) + chalk14.magenta(`> `), (answer) => {
8994
8994
  rl.close();
8995
8995
  const trimmed = answer.trim();
8996
- if (trimmed === "") return resolve44(null);
8996
+ if (trimmed === "") return resolve45(null);
8997
8997
  if (trimmed.toLowerCase() === "skip") {
8998
8998
  skipInteractive = true;
8999
8999
  console.log(chalk14.dim(" Supervisor mode disabled for remaining session."));
9000
- return resolve44(null);
9000
+ return resolve45(null);
9001
9001
  }
9002
9002
  console.log(chalk14.dim(` Directive injected into session context.`));
9003
- return resolve44(trimmed);
9003
+ return resolve45(trimmed);
9004
9004
  });
9005
9005
  });
9006
9006
  } : void 0
@@ -9353,20 +9353,70 @@ function printProfileQuick(spec) {
9353
9353
  import chalk16 from "chalk";
9354
9354
 
9355
9355
  // src/marketplace/registry.ts
9356
+ import { readFileSync as readFileSync13 } from "fs";
9357
+ import { resolve as resolve16, dirname as dirname3 } from "path";
9358
+ import { fileURLToPath } from "url";
9356
9359
  var REGISTRY_URL = "https://raw.githubusercontent.com/productstein/holomime-registry/main/index.json";
9360
+ function loadLocalRegistry() {
9361
+ const __dirname = dirname3(fileURLToPath(import.meta.url));
9362
+ const candidates = [
9363
+ resolve16(__dirname, "..", "registry", "index.json"),
9364
+ // from dist/
9365
+ resolve16(__dirname, "..", "..", "registry", "index.json")
9366
+ // from src/marketplace/
9367
+ ];
9368
+ for (const p of candidates) {
9369
+ try {
9370
+ const raw = readFileSync13(p, "utf-8");
9371
+ return JSON.parse(raw);
9372
+ } catch {
9373
+ continue;
9374
+ }
9375
+ }
9376
+ throw new Error("Local registry not found. Reinstall holomime.");
9377
+ }
9357
9378
  async function fetchRegistry() {
9358
- const response = await fetch(REGISTRY_URL);
9359
- if (!response.ok) {
9360
- throw new Error(`Registry unavailable (${response.status}). Check https://github.com/productstein/holomime-registry`);
9379
+ const local = loadLocalRegistry();
9380
+ try {
9381
+ const response = await fetch(REGISTRY_URL);
9382
+ if (response.ok) {
9383
+ const remote = await response.json();
9384
+ const localHandles = new Set(local.personalities.map((p) => p.handle));
9385
+ for (const p of remote.personalities) {
9386
+ if (!localHandles.has(p.handle)) {
9387
+ local.personalities.push(p);
9388
+ }
9389
+ }
9390
+ }
9391
+ } catch {
9361
9392
  }
9362
- return response.json();
9393
+ return local;
9363
9394
  }
9364
9395
  async function fetchPersonality(url) {
9365
- const response = await fetch(url);
9366
- if (!response.ok) {
9367
- throw new Error(`Could not fetch personality (${response.status}): ${url}`);
9396
+ try {
9397
+ const response = await fetch(url);
9398
+ if (response.ok) {
9399
+ return response.json();
9400
+ }
9401
+ } catch {
9368
9402
  }
9369
- return response.json();
9403
+ const match = url.match(/\/([^/]+)\.personality\.json$/);
9404
+ if (match) {
9405
+ const __dirname = dirname3(fileURLToPath(import.meta.url));
9406
+ const candidates = [
9407
+ resolve16(__dirname, "..", "registry", "personalities", `${match[1]}.personality.json`),
9408
+ resolve16(__dirname, "..", "..", "registry", "personalities", `${match[1]}.personality.json`)
9409
+ ];
9410
+ for (const p of candidates) {
9411
+ try {
9412
+ const raw = readFileSync13(p, "utf-8");
9413
+ return JSON.parse(raw);
9414
+ } catch {
9415
+ continue;
9416
+ }
9417
+ }
9418
+ }
9419
+ throw new Error(`Could not fetch personality: ${url}`);
9370
9420
  }
9371
9421
  async function createGist(spec, handle, token) {
9372
9422
  const response = await fetch("https://api.github.com/gists", {
@@ -9398,12 +9448,12 @@ async function createGist(spec, handle, token) {
9398
9448
  }
9399
9449
 
9400
9450
  // src/marketplace/api.ts
9401
- import { existsSync as existsSync13, readFileSync as readFileSync14 } from "fs";
9451
+ import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
9402
9452
  import { join as join12 } from "path";
9403
9453
  import { homedir as homedir3 } from "os";
9404
9454
 
9405
9455
  // src/marketplace/local-backend.ts
9406
- import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "fs";
9456
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "fs";
9407
9457
  import { join as join11 } from "path";
9408
9458
  import { homedir as homedir2 } from "os";
9409
9459
  function marketplaceDir() {
@@ -9443,7 +9493,7 @@ function loadIndex() {
9443
9493
  return [];
9444
9494
  }
9445
9495
  try {
9446
- return JSON.parse(readFileSync13(path, "utf-8"));
9496
+ return JSON.parse(readFileSync14(path, "utf-8"));
9447
9497
  } catch {
9448
9498
  return [];
9449
9499
  }
@@ -9457,7 +9507,7 @@ function loadStoredAsset(id) {
9457
9507
  return null;
9458
9508
  }
9459
9509
  try {
9460
- return JSON.parse(readFileSync13(path, "utf-8"));
9510
+ return JSON.parse(readFileSync14(path, "utf-8"));
9461
9511
  } catch {
9462
9512
  return null;
9463
9513
  }
@@ -9632,7 +9682,7 @@ var LocalMarketplaceBackend = class {
9632
9682
  let reviews = [];
9633
9683
  if (existsSync12(reviewFile)) {
9634
9684
  try {
9635
- reviews = JSON.parse(readFileSync13(reviewFile, "utf-8"));
9685
+ reviews = JSON.parse(readFileSync14(reviewFile, "utf-8"));
9636
9686
  } catch {
9637
9687
  reviews = [];
9638
9688
  }
@@ -9664,7 +9714,7 @@ function loadConfig() {
9664
9714
  return {};
9665
9715
  }
9666
9716
  try {
9667
- return JSON.parse(readFileSync14(configPath, "utf-8"));
9717
+ return JSON.parse(readFileSync15(configPath, "utf-8"));
9668
9718
  } catch {
9669
9719
  return {};
9670
9720
  }
@@ -9859,7 +9909,7 @@ init_types();
9859
9909
  import chalk17 from "chalk";
9860
9910
  import figures9 from "figures";
9861
9911
  import { writeFileSync as writeFileSync13, existsSync as existsSync14 } from "fs";
9862
- import { resolve as resolve16 } from "path";
9912
+ import { resolve as resolve17 } from "path";
9863
9913
  import { select as select2 } from "@inquirer/prompts";
9864
9914
  async function useCommand(handle, options) {
9865
9915
  printHeader("Use Personality");
@@ -9895,7 +9945,7 @@ async function useCommand(handle, options) {
9895
9945
  process.exit(1);
9896
9946
  return;
9897
9947
  }
9898
- const outputPath = resolve16(process.cwd(), options.output ?? ".personality.json");
9948
+ const outputPath = resolve17(process.cwd(), options.output ?? ".personality.json");
9899
9949
  if (existsSync14(outputPath)) {
9900
9950
  const overwrite = await select2({
9901
9951
  message: `.personality.json already exists. Overwrite?`,
@@ -9921,18 +9971,18 @@ async function useCommand(handle, options) {
9921
9971
  init_types();
9922
9972
  import chalk18 from "chalk";
9923
9973
  import figures10 from "figures";
9924
- import { readFileSync as readFileSync15 } from "fs";
9925
- import { resolve as resolve17 } from "path";
9974
+ import { readFileSync as readFileSync16 } from "fs";
9975
+ import { resolve as resolve18 } from "path";
9926
9976
  async function publishCommand(options) {
9927
9977
  const assetType = options.type ?? "personality";
9928
9978
  if (assetType !== "personality" || options.path) {
9929
9979
  return publishToMarketplace(assetType, options);
9930
9980
  }
9931
- const specPath = resolve17(process.cwd(), options.personality ?? ".personality.json");
9981
+ const specPath = resolve18(process.cwd(), options.personality ?? ".personality.json");
9932
9982
  printHeader("Publish Personality");
9933
9983
  let raw;
9934
9984
  try {
9935
- raw = readFileSync15(specPath, "utf-8");
9985
+ raw = readFileSync16(specPath, "utf-8");
9936
9986
  } catch {
9937
9987
  console.error(chalk18.red(` Could not read: ${specPath}`));
9938
9988
  console.log(chalk18.dim(` Run ${chalk18.cyan("holomime init")} to create a personality first.`));
@@ -10028,10 +10078,10 @@ async function publishToMarketplace(type, options) {
10028
10078
  process.exit(1);
10029
10079
  return;
10030
10080
  }
10031
- const fullPath = resolve17(process.cwd(), filePath);
10081
+ const fullPath = resolve18(process.cwd(), filePath);
10032
10082
  let raw;
10033
10083
  try {
10034
- raw = readFileSync15(fullPath, "utf-8");
10084
+ raw = readFileSync16(fullPath, "utf-8");
10035
10085
  } catch {
10036
10086
  console.error(chalk18.red(` Could not read: ${fullPath}`));
10037
10087
  console.log();
@@ -10094,8 +10144,8 @@ async function publishToMarketplace(type, options) {
10094
10144
  // src/commands/autopilot.ts
10095
10145
  import chalk19 from "chalk";
10096
10146
  import figures11 from "figures";
10097
- import { readFileSync as readFileSync16 } from "fs";
10098
- import { resolve as resolve18 } from "path";
10147
+ import { readFileSync as readFileSync17 } from "fs";
10148
+ import { resolve as resolve19 } from "path";
10099
10149
  init_log_adapter();
10100
10150
 
10101
10151
  // src/analysis/autopilot-core.ts
@@ -10153,7 +10203,7 @@ async function runAutopilot(spec, messages, provider, options) {
10153
10203
 
10154
10204
  // src/commands/autopilot.ts
10155
10205
  async function autopilotCommand(options) {
10156
- const specPath = resolve18(process.cwd(), options.personality);
10206
+ const specPath = resolve19(process.cwd(), options.personality);
10157
10207
  let spec;
10158
10208
  try {
10159
10209
  spec = loadSpec(specPath);
@@ -10162,10 +10212,10 @@ async function autopilotCommand(options) {
10162
10212
  process.exit(1);
10163
10213
  return;
10164
10214
  }
10165
- const logPath = resolve18(process.cwd(), options.log);
10215
+ const logPath = resolve19(process.cwd(), options.log);
10166
10216
  let messages;
10167
10217
  try {
10168
- const raw = JSON.parse(readFileSync16(logPath, "utf-8"));
10218
+ const raw = JSON.parse(readFileSync17(logPath, "utf-8"));
10169
10219
  const conversations = parseConversationLog(raw, options.format ?? "auto");
10170
10220
  messages = conversations.flatMap((c) => c.messages);
10171
10221
  } catch (err) {
@@ -10307,7 +10357,7 @@ async function autopilotCommand(options) {
10307
10357
  import chalk20 from "chalk";
10308
10358
  import figures12 from "figures";
10309
10359
  import { writeFileSync as writeFileSync15 } from "fs";
10310
- import { resolve as resolve19 } from "path";
10360
+ import { resolve as resolve20 } from "path";
10311
10361
  init_training_export();
10312
10362
  init_export_huggingface();
10313
10363
  async function exportCommand(options) {
@@ -10319,7 +10369,7 @@ async function exportCommand(options) {
10319
10369
  process.exit(1);
10320
10370
  return;
10321
10371
  }
10322
- const sessionsDir = resolve19(process.cwd(), options.sessions ?? ".holomime/sessions");
10372
+ const sessionsDir = resolve20(process.cwd(), options.sessions ?? ".holomime/sessions");
10323
10373
  const transcripts = await withSpinner("Loading session transcripts...", async () => {
10324
10374
  return loadTranscripts(sessionsDir);
10325
10375
  });
@@ -10367,7 +10417,7 @@ Run ${chalk20.cyan("holomime session")} first to generate session transcripts.`,
10367
10417
  }
10368
10418
  const isJsonl = format === "jsonl" || format === "huggingface" || format === "openai";
10369
10419
  const outputPath = options.output ?? `.holomime/exports/${format}-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.${isJsonl ? "jsonl" : "json"}`;
10370
- const fullPath = resolve19(process.cwd(), outputPath);
10420
+ const fullPath = resolve20(process.cwd(), outputPath);
10371
10421
  const dir = fullPath.substring(0, fullPath.lastIndexOf("/"));
10372
10422
  const { mkdirSync: mkdirSync22 } = await import("fs");
10373
10423
  mkdirSync22(dir, { recursive: true });
@@ -10463,8 +10513,8 @@ This is the closed-loop behavioral alignment system.`,
10463
10513
  // src/commands/train.ts
10464
10514
  import chalk21 from "chalk";
10465
10515
  import figures13 from "figures";
10466
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync18, mkdirSync as mkdirSync12, readdirSync as readdirSync5, existsSync as existsSync17 } from "fs";
10467
- import { resolve as resolve23, join as join16 } from "path";
10516
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync18, mkdirSync as mkdirSync12, readdirSync as readdirSync5, existsSync as existsSync17 } from "fs";
10517
+ import { resolve as resolve24, join as join16 } from "path";
10468
10518
  init_train_provider();
10469
10519
  init_train_openai();
10470
10520
  init_train_huggingface();
@@ -10479,7 +10529,7 @@ function findLatestExport(exportsDir) {
10479
10529
  }
10480
10530
  }
10481
10531
  function loadTrainingData(dataPath) {
10482
- const raw = readFileSync20(dataPath, "utf-8");
10532
+ const raw = readFileSync21(dataPath, "utf-8");
10483
10533
  const data = JSON.parse(raw);
10484
10534
  if (!data.format || !data.examples || !Array.isArray(data.examples)) {
10485
10535
  throw new Error("Invalid training data \u2014 expected holomime export format");
@@ -10488,14 +10538,14 @@ function loadTrainingData(dataPath) {
10488
10538
  }
10489
10539
  function getAgentName(personalityPath) {
10490
10540
  try {
10491
- const spec = JSON.parse(readFileSync20(personalityPath, "utf-8"));
10541
+ const spec = JSON.parse(readFileSync21(personalityPath, "utf-8"));
10492
10542
  return spec.name ?? "Agent";
10493
10543
  } catch {
10494
10544
  return "Agent";
10495
10545
  }
10496
10546
  }
10497
10547
  function deployModel(result, personalityPath) {
10498
- const trainingDir = resolve23(process.cwd(), ".holomime/training");
10548
+ const trainingDir = resolve24(process.cwd(), ".holomime/training");
10499
10549
  mkdirSync12(trainingDir, { recursive: true });
10500
10550
  const record = {
10501
10551
  ...result,
@@ -10506,9 +10556,9 @@ function deployModel(result, personalityPath) {
10506
10556
  join16(trainingDir, "latest.json"),
10507
10557
  JSON.stringify(record, null, 2) + "\n"
10508
10558
  );
10509
- const fullPath = resolve23(process.cwd(), personalityPath);
10559
+ const fullPath = resolve24(process.cwd(), personalityPath);
10510
10560
  if (existsSync17(fullPath)) {
10511
- const spec = JSON.parse(readFileSync20(fullPath, "utf-8"));
10561
+ const spec = JSON.parse(readFileSync21(fullPath, "utf-8"));
10512
10562
  spec.training = {
10513
10563
  ...spec.training ?? {},
10514
10564
  fine_tuned_model: result.modelId,
@@ -10540,7 +10590,7 @@ async function trainCommand(options) {
10540
10590
  return;
10541
10591
  }
10542
10592
  }
10543
- const dataPath = options.data ? resolve23(process.cwd(), options.data) : findLatestExport(resolve23(process.cwd(), ".holomime/exports"));
10593
+ const dataPath = options.data ? resolve24(process.cwd(), options.data) : findLatestExport(resolve24(process.cwd(), ".holomime/exports"));
10544
10594
  if (!dataPath || !existsSync17(dataPath)) {
10545
10595
  console.log();
10546
10596
  printBox(
@@ -10568,7 +10618,7 @@ Then run: ${chalk21.cyan("holomime train --data <path>")}`,
10568
10618
  return;
10569
10619
  }
10570
10620
  const method = inferMethod(data, options.method);
10571
- const agentName = getAgentName(resolve23(process.cwd(), options.personality));
10621
+ const agentName = getAgentName(resolve24(process.cwd(), options.personality));
10572
10622
  const suffix = options.suffix ?? agentName.toLowerCase().replace(/[^a-z0-9]/g, "-");
10573
10623
  console.log();
10574
10624
  console.log(chalk21.dim(` Data: ${dataPath}`));
@@ -10661,7 +10711,7 @@ Duration: ${durationMin} min`,
10661
10711
  console.log();
10662
10712
  if (!options.skipDeploy) {
10663
10713
  await withSpinner("Deploying fine-tuned model...", async () => {
10664
- deployModel(result, resolve23(process.cwd(), options.personality));
10714
+ deployModel(result, resolve24(process.cwd(), options.personality));
10665
10715
  });
10666
10716
  console.log();
10667
10717
  console.log(` ${chalk21.green(figures13.tick)} Model deployed to ${chalk21.cyan(options.personality)}`);
@@ -10797,14 +10847,14 @@ init_log_adapter();
10797
10847
  init_outcome_eval();
10798
10848
  import chalk22 from "chalk";
10799
10849
  import figures14 from "figures";
10800
- import { readFileSync as readFileSync21 } from "fs";
10801
- import { resolve as resolve24 } from "path";
10850
+ import { readFileSync as readFileSync22 } from "fs";
10851
+ import { resolve as resolve25 } from "path";
10802
10852
  async function evalCommand(options) {
10803
10853
  printHeader("Outcome Evaluation");
10804
- const beforePath = resolve24(process.cwd(), options.before);
10854
+ const beforePath = resolve25(process.cwd(), options.before);
10805
10855
  let beforeMessages;
10806
10856
  try {
10807
- const raw = JSON.parse(readFileSync21(beforePath, "utf-8"));
10857
+ const raw = JSON.parse(readFileSync22(beforePath, "utf-8"));
10808
10858
  const conversations = parseConversationLog(raw, options.format ?? "auto");
10809
10859
  beforeMessages = conversations.flatMap((c) => c.messages);
10810
10860
  } catch (err) {
@@ -10812,10 +10862,10 @@ async function evalCommand(options) {
10812
10862
  process.exit(1);
10813
10863
  return;
10814
10864
  }
10815
- const afterPath = resolve24(process.cwd(), options.after);
10865
+ const afterPath = resolve25(process.cwd(), options.after);
10816
10866
  let afterMessages;
10817
10867
  try {
10818
- const raw = JSON.parse(readFileSync21(afterPath, "utf-8"));
10868
+ const raw = JSON.parse(readFileSync22(afterPath, "utf-8"));
10819
10869
  const conversations = parseConversationLog(raw, options.format ?? "auto");
10820
10870
  afterMessages = conversations.flatMap((c) => c.messages);
10821
10871
  } catch (err) {
@@ -10826,7 +10876,7 @@ async function evalCommand(options) {
10826
10876
  let agentName = "Agent";
10827
10877
  if (options.personality) {
10828
10878
  try {
10829
- const spec = JSON.parse(readFileSync21(resolve24(process.cwd(), options.personality), "utf-8"));
10879
+ const spec = JSON.parse(readFileSync22(resolve25(process.cwd(), options.personality), "utf-8"));
10830
10880
  agentName = spec.name ?? "Agent";
10831
10881
  } catch {
10832
10882
  }
@@ -10907,8 +10957,8 @@ Grade: ${colorize(report.grade)}`,
10907
10957
  // src/commands/evolve.ts
10908
10958
  import chalk23 from "chalk";
10909
10959
  import figures15 from "figures";
10910
- import { readFileSync as readFileSync22 } from "fs";
10911
- import { resolve as resolve25 } from "path";
10960
+ import { readFileSync as readFileSync23 } from "fs";
10961
+ import { resolve as resolve26 } from "path";
10912
10962
  init_log_adapter();
10913
10963
 
10914
10964
  // src/analysis/evolve-core.ts
@@ -11167,7 +11217,7 @@ function extractRegenerationDPOPairs(beforeMessages, afterMessages, agentName) {
11167
11217
 
11168
11218
  // src/commands/evolve.ts
11169
11219
  async function evolveCommand(options) {
11170
- const specPath = resolve25(process.cwd(), options.personality);
11220
+ const specPath = resolve26(process.cwd(), options.personality);
11171
11221
  let spec;
11172
11222
  try {
11173
11223
  spec = loadSpec(specPath);
@@ -11176,10 +11226,10 @@ async function evolveCommand(options) {
11176
11226
  process.exit(1);
11177
11227
  return;
11178
11228
  }
11179
- const logPath = resolve25(process.cwd(), options.log);
11229
+ const logPath = resolve26(process.cwd(), options.log);
11180
11230
  let messages;
11181
11231
  try {
11182
- const raw = JSON.parse(readFileSync22(logPath, "utf-8"));
11232
+ const raw = JSON.parse(readFileSync23(logPath, "utf-8"));
11183
11233
  const conversations = parseConversationLog(raw, options.format ?? "auto");
11184
11234
  messages = conversations.flatMap((c) => c.messages);
11185
11235
  } catch (err) {
@@ -11245,7 +11295,7 @@ async function evolveCommand(options) {
11245
11295
  maxTurnsPerSession: maxTurns,
11246
11296
  dryRun: options.dryRun,
11247
11297
  specPath: options.apply ? specPath : void 0,
11248
- exportDpoPath: options.exportDpo ? resolve25(process.cwd(), options.exportDpo) : void 0,
11298
+ exportDpoPath: options.exportDpo ? resolve26(process.cwd(), options.exportDpo) : void 0,
11249
11299
  callbacks: {
11250
11300
  onPhaseTransition: (name) => printPhaseTransition(name),
11251
11301
  onTherapistMessage: (content) => printTherapistMessage(content),
@@ -11364,8 +11414,8 @@ async function evolveCommand(options) {
11364
11414
  // src/commands/benchmark.ts
11365
11415
  import chalk24 from "chalk";
11366
11416
  import figures16 from "figures";
11367
- import { readFileSync as readFileSync24 } from "fs";
11368
- import { resolve as resolve26 } from "path";
11417
+ import { readFileSync as readFileSync25 } from "fs";
11418
+ import { resolve as resolve27 } from "path";
11369
11419
 
11370
11420
  // src/analysis/benchmark-core.ts
11371
11421
  init_types();
@@ -11571,7 +11621,7 @@ function gradeFromScore2(score) {
11571
11621
  }
11572
11622
 
11573
11623
  // src/analysis/benchmark-publish.ts
11574
- import { readFileSync as readFileSync23, writeFileSync as writeFileSync20, existsSync as existsSync18, mkdirSync as mkdirSync13, readdirSync as readdirSync6 } from "fs";
11624
+ import { readFileSync as readFileSync24, writeFileSync as writeFileSync20, existsSync as existsSync18, mkdirSync as mkdirSync13, readdirSync as readdirSync6 } from "fs";
11575
11625
  import { join as join17 } from "path";
11576
11626
  import { homedir as homedir4 } from "os";
11577
11627
  function getBenchmarkDir(outputDir) {
@@ -11612,7 +11662,7 @@ function loadBenchmarkResults(dir) {
11612
11662
  const results = [];
11613
11663
  for (const file of files) {
11614
11664
  try {
11615
- const content = readFileSync23(join17(benchmarkDir, file), "utf-8");
11665
+ const content = readFileSync24(join17(benchmarkDir, file), "utf-8");
11616
11666
  results.push(JSON.parse(content));
11617
11667
  } catch {
11618
11668
  }
@@ -11658,7 +11708,7 @@ function compareBenchmarks(before, after) {
11658
11708
 
11659
11709
  // src/commands/benchmark.ts
11660
11710
  async function benchmarkCommand(options) {
11661
- const specPath = resolve26(process.cwd(), options.personality);
11711
+ const specPath = resolve27(process.cwd(), options.personality);
11662
11712
  let spec;
11663
11713
  try {
11664
11714
  spec = loadSpec(specPath);
@@ -11767,7 +11817,7 @@ async function benchmarkCommand(options) {
11767
11817
  }
11768
11818
  if (options.compare) {
11769
11819
  try {
11770
- const baseline = JSON.parse(readFileSync24(resolve26(process.cwd(), options.compare), "utf-8"));
11820
+ const baseline = JSON.parse(readFileSync25(resolve27(process.cwd(), options.compare), "utf-8"));
11771
11821
  const comparison = compareBenchmarks(baseline, {
11772
11822
  agent: report.agent,
11773
11823
  provider: report.provider,
@@ -11827,11 +11877,11 @@ async function benchmarkCommand(options) {
11827
11877
  import chalk25 from "chalk";
11828
11878
  import figures17 from "figures";
11829
11879
  import { existsSync as existsSync20 } from "fs";
11830
- import { resolve as resolve28 } from "path";
11880
+ import { resolve as resolve29 } from "path";
11831
11881
 
11832
11882
  // src/analysis/watch-core.ts
11833
- import { readdirSync as readdirSync7, readFileSync as readFileSync25, writeFileSync as writeFileSync21, mkdirSync as mkdirSync14, existsSync as existsSync19 } from "fs";
11834
- import { join as join18, resolve as resolve27 } from "path";
11883
+ import { readdirSync as readdirSync7, readFileSync as readFileSync26, writeFileSync as writeFileSync21, mkdirSync as mkdirSync14, existsSync as existsSync19 } from "fs";
11884
+ import { join as join18, resolve as resolve28 } from "path";
11835
11885
  init_log_adapter();
11836
11886
  var SEVERITY_ORDER2 = ["routine", "targeted", "intervention"];
11837
11887
  function severityMeetsThreshold2(severity, threshold) {
@@ -11870,7 +11920,7 @@ function startWatch(spec, options) {
11870
11920
  events.push({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), type: "new_file", filename });
11871
11921
  let messages;
11872
11922
  try {
11873
- const raw = JSON.parse(readFileSync25(join18(options.watchDir, filename), "utf-8"));
11923
+ const raw = JSON.parse(readFileSync26(join18(options.watchDir, filename), "utf-8"));
11874
11924
  const conversations = parseConversationLog(raw, "auto");
11875
11925
  messages = conversations.flatMap((c) => c.messages);
11876
11926
  } catch (err) {
@@ -11929,7 +11979,7 @@ function startWatch(spec, options) {
11929
11979
  function stop() {
11930
11980
  stopped = true;
11931
11981
  clearInterval(interval);
11932
- const logDir = resolve27(process.cwd(), ".holomime");
11982
+ const logDir = resolve28(process.cwd(), ".holomime");
11933
11983
  if (!existsSync19(logDir)) {
11934
11984
  mkdirSync14(logDir, { recursive: true });
11935
11985
  }
@@ -11943,7 +11993,7 @@ function startWatch(spec, options) {
11943
11993
 
11944
11994
  // src/commands/watch.ts
11945
11995
  async function watchCommand(options) {
11946
- const specPath = resolve28(process.cwd(), options.personality);
11996
+ const specPath = resolve29(process.cwd(), options.personality);
11947
11997
  let spec;
11948
11998
  try {
11949
11999
  spec = loadSpec(specPath);
@@ -11952,7 +12002,7 @@ async function watchCommand(options) {
11952
12002
  process.exit(1);
11953
12003
  return;
11954
12004
  }
11955
- const watchDir = resolve28(process.cwd(), options.dir);
12005
+ const watchDir = resolve29(process.cwd(), options.dir);
11956
12006
  if (!existsSync20(watchDir)) {
11957
12007
  console.error(chalk25.red(` Watch directory does not exist: ${options.dir}`));
11958
12008
  process.exit(1);
@@ -12077,12 +12127,12 @@ Press ${chalk25.cyan("Ctrl+C")} to stop.`,
12077
12127
  // src/commands/certify.ts
12078
12128
  import chalk26 from "chalk";
12079
12129
  import figures18 from "figures";
12080
- import { readFileSync as readFileSync27 } from "fs";
12081
- import { resolve as resolve30 } from "path";
12130
+ import { readFileSync as readFileSync28 } from "fs";
12131
+ import { resolve as resolve31 } from "path";
12082
12132
 
12083
12133
  // src/analysis/certify-core.ts
12084
12134
  import { writeFileSync as writeFileSync22, mkdirSync as mkdirSync15, existsSync as existsSync21 } from "fs";
12085
- import { join as join19, resolve as resolve29 } from "path";
12135
+ import { join as join19, resolve as resolve30 } from "path";
12086
12136
  function djb2Hash(str) {
12087
12137
  let hash = 0;
12088
12138
  for (let i = 0; i < str.length; i++) {
@@ -12195,7 +12245,7 @@ function verifyCredential(credential, spec) {
12195
12245
  return { valid: true };
12196
12246
  }
12197
12247
  function saveCredential(credential, outputDir) {
12198
- const dir = outputDir ?? resolve29(process.cwd(), ".holomime", "credentials");
12248
+ const dir = outputDir ?? resolve30(process.cwd(), ".holomime", "credentials");
12199
12249
  if (!existsSync21(dir)) {
12200
12250
  mkdirSync15(dir, { recursive: true });
12201
12251
  }
@@ -12210,16 +12260,16 @@ function saveCredential(credential, outputDir) {
12210
12260
  async function certifyCommand(options) {
12211
12261
  if (options.verify) {
12212
12262
  printHeader("Verify Credential");
12213
- const credPath = resolve30(process.cwd(), options.verify);
12263
+ const credPath = resolve31(process.cwd(), options.verify);
12214
12264
  let credential2;
12215
12265
  try {
12216
- credential2 = JSON.parse(readFileSync27(credPath, "utf-8"));
12266
+ credential2 = JSON.parse(readFileSync28(credPath, "utf-8"));
12217
12267
  } catch {
12218
12268
  console.error(chalk26.red(` Could not read credential file: ${options.verify}`));
12219
12269
  process.exit(1);
12220
12270
  return;
12221
12271
  }
12222
- const specPath2 = resolve30(process.cwd(), options.personality ?? ".personality.json");
12272
+ const specPath2 = resolve31(process.cwd(), options.personality ?? ".personality.json");
12223
12273
  let spec2;
12224
12274
  try {
12225
12275
  spec2 = loadSpec(specPath2);
@@ -12260,7 +12310,7 @@ async function certifyCommand(options) {
12260
12310
  return;
12261
12311
  }
12262
12312
  printHeader("Certify \u2014 Behavioral Credential");
12263
- const specPath = resolve30(process.cwd(), options.personality ?? ".personality.json");
12313
+ const specPath = resolve31(process.cwd(), options.personality ?? ".personality.json");
12264
12314
  let spec;
12265
12315
  try {
12266
12316
  spec = loadSpec(specPath);
@@ -12272,7 +12322,7 @@ async function certifyCommand(options) {
12272
12322
  let benchmarkReport;
12273
12323
  if (options.benchmark) {
12274
12324
  try {
12275
- benchmarkReport = JSON.parse(readFileSync27(resolve30(process.cwd(), options.benchmark), "utf-8"));
12325
+ benchmarkReport = JSON.parse(readFileSync28(resolve31(process.cwd(), options.benchmark), "utf-8"));
12276
12326
  } catch {
12277
12327
  console.error(chalk26.red(` Could not read benchmark report: ${options.benchmark}`));
12278
12328
  process.exit(1);
@@ -12282,7 +12332,7 @@ async function certifyCommand(options) {
12282
12332
  let evolveResult;
12283
12333
  if (options.evolve) {
12284
12334
  try {
12285
- evolveResult = JSON.parse(readFileSync27(resolve30(process.cwd(), options.evolve), "utf-8"));
12335
+ evolveResult = JSON.parse(readFileSync28(resolve31(process.cwd(), options.evolve), "utf-8"));
12286
12336
  } catch {
12287
12337
  console.error(chalk26.red(` Could not read evolve result: ${options.evolve}`));
12288
12338
  process.exit(1);
@@ -12295,7 +12345,7 @@ async function certifyCommand(options) {
12295
12345
  benchmarkReport,
12296
12346
  evolveResult
12297
12347
  });
12298
- const outputDir = options.output ? resolve30(process.cwd(), options.output) : void 0;
12348
+ const outputDir = options.output ? resolve31(process.cwd(), options.output) : void 0;
12299
12349
  const savedPath = saveCredential(credential, outputDir);
12300
12350
  console.log();
12301
12351
  const gradeColor = credential.alignment.grade === "A" ? chalk26.green : credential.alignment.grade === "B" ? chalk26.cyan : credential.alignment.grade === "C" ? chalk26.yellow : chalk26.red;
@@ -12322,17 +12372,17 @@ async function certifyCommand(options) {
12322
12372
 
12323
12373
  // src/commands/daemon.ts
12324
12374
  import chalk27 from "chalk";
12325
- import { writeFileSync as writeFileSync23, readFileSync as readFileSync28, mkdirSync as mkdirSync16, existsSync as existsSync22 } from "fs";
12326
- import { resolve as resolve31 } from "path";
12375
+ import { writeFileSync as writeFileSync23, readFileSync as readFileSync29, mkdirSync as mkdirSync16, existsSync as existsSync22 } from "fs";
12376
+ import { resolve as resolve32 } from "path";
12327
12377
  var HOLOMIME_DIR2 = ".holomime";
12328
12378
  function getDaemonStatePath() {
12329
- return resolve31(process.cwd(), HOLOMIME_DIR2, "daemon.json");
12379
+ return resolve32(process.cwd(), HOLOMIME_DIR2, "daemon.json");
12330
12380
  }
12331
12381
  function getDaemonLogPath() {
12332
- return resolve31(process.cwd(), HOLOMIME_DIR2, "daemon-log.json");
12382
+ return resolve32(process.cwd(), HOLOMIME_DIR2, "daemon-log.json");
12333
12383
  }
12334
12384
  function ensureDir2() {
12335
- const dir = resolve31(process.cwd(), HOLOMIME_DIR2);
12385
+ const dir = resolve32(process.cwd(), HOLOMIME_DIR2);
12336
12386
  if (!existsSync22(dir)) {
12337
12387
  mkdirSync16(dir, { recursive: true });
12338
12388
  }
@@ -12347,7 +12397,7 @@ function appendDaemonLog(event) {
12347
12397
  let log = [];
12348
12398
  try {
12349
12399
  if (existsSync22(logPath)) {
12350
- log = JSON.parse(readFileSync28(logPath, "utf-8"));
12400
+ log = JSON.parse(readFileSync29(logPath, "utf-8"));
12351
12401
  }
12352
12402
  } catch {
12353
12403
  log = [];
@@ -12357,8 +12407,8 @@ function appendDaemonLog(event) {
12357
12407
  }
12358
12408
  async function daemonCommand(options) {
12359
12409
  printHeader("Daemon Mode");
12360
- const specPath = resolve31(process.cwd(), options.personality ?? ".personality.json");
12361
- const watchDir = resolve31(process.cwd(), options.dir);
12410
+ const specPath = resolve32(process.cwd(), options.personality ?? ".personality.json");
12411
+ const watchDir = resolve32(process.cwd(), options.dir);
12362
12412
  const checkInterval = parseInt(options.interval ?? "30000", 10);
12363
12413
  const threshold = options.threshold ?? "targeted";
12364
12414
  let spec;
@@ -12553,13 +12603,13 @@ Log: ${getDaemonLogPath()}`,
12553
12603
  import chalk28 from "chalk";
12554
12604
  import figures19 from "figures";
12555
12605
  import { writeFileSync as writeFileSync24, mkdirSync as mkdirSync17, existsSync as existsSync24 } from "fs";
12556
- import { resolve as resolve33, join as join22 } from "path";
12606
+ import { resolve as resolve34, join as join22 } from "path";
12557
12607
 
12558
12608
  // src/analysis/fleet-core.ts
12559
- import { readFileSync as readFileSync29, existsSync as existsSync23, readdirSync as readdirSync8 } from "fs";
12560
- import { join as join21, resolve as resolve32 } from "path";
12609
+ import { readFileSync as readFileSync30, existsSync as existsSync23, readdirSync as readdirSync8 } from "fs";
12610
+ import { join as join21, resolve as resolve33 } from "path";
12561
12611
  function loadFleetConfig(configPath) {
12562
- const raw = JSON.parse(readFileSync29(configPath, "utf-8"));
12612
+ const raw = JSON.parse(readFileSync30(configPath, "utf-8"));
12563
12613
  if (!raw.agents || !Array.isArray(raw.agents)) {
12564
12614
  throw new Error("fleet.json must contain an 'agents' array");
12565
12615
  }
@@ -12573,7 +12623,7 @@ function loadFleetConfig(configPath) {
12573
12623
  }
12574
12624
  function discoverAgents(dir) {
12575
12625
  const agents = [];
12576
- const absDir = resolve32(dir);
12626
+ const absDir = resolve33(dir);
12577
12627
  if (!existsSync23(absDir)) {
12578
12628
  throw new Error(`Directory not found: ${absDir}`);
12579
12629
  }
@@ -12726,7 +12776,7 @@ async function fleetCommand(options) {
12726
12776
  let config;
12727
12777
  if (options.config) {
12728
12778
  try {
12729
- config = loadFleetConfig(resolve33(process.cwd(), options.config));
12779
+ config = loadFleetConfig(resolve34(process.cwd(), options.config));
12730
12780
  } catch (err) {
12731
12781
  console.error(chalk28.red(` Failed to load fleet config: ${err instanceof Error ? err.message : err}`));
12732
12782
  process.exit(1);
@@ -12734,7 +12784,7 @@ async function fleetCommand(options) {
12734
12784
  }
12735
12785
  } else if (options.dir) {
12736
12786
  try {
12737
- config = discoverAgents(resolve33(process.cwd(), options.dir));
12787
+ config = discoverAgents(resolve34(process.cwd(), options.dir));
12738
12788
  } catch (err) {
12739
12789
  console.error(chalk28.red(` Failed to discover agents: ${err instanceof Error ? err.message : err}`));
12740
12790
  process.exit(1);
@@ -12868,7 +12918,7 @@ Press Ctrl+C for fleet summary`,
12868
12918
  );
12869
12919
  }
12870
12920
  console.log();
12871
- const logDir = resolve33(process.cwd(), ".holomime");
12921
+ const logDir = resolve34(process.cwd(), ".holomime");
12872
12922
  if (!existsSync24(logDir)) {
12873
12923
  mkdirSync17(logDir, { recursive: true });
12874
12924
  }
@@ -12894,7 +12944,7 @@ Press Ctrl+C for fleet summary`,
12894
12944
  // src/commands/network.ts
12895
12945
  import chalk29 from "chalk";
12896
12946
  import figures20 from "figures";
12897
- import { resolve as resolve35 } from "path";
12947
+ import { resolve as resolve36 } from "path";
12898
12948
 
12899
12949
  // src/core/oversight.ts
12900
12950
  var DEFAULT_OVERSIGHT = {
@@ -12937,8 +12987,8 @@ function checkApproval(action, policy) {
12937
12987
  }
12938
12988
 
12939
12989
  // src/analysis/network-core.ts
12940
- import { existsSync as existsSync25, readdirSync as readdirSync9, readFileSync as readFileSync30 } from "fs";
12941
- import { join as join23, resolve as resolve34 } from "path";
12990
+ import { existsSync as existsSync25, readdirSync as readdirSync9, readFileSync as readFileSync31 } from "fs";
12991
+ import { join as join23, resolve as resolve35 } from "path";
12942
12992
  init_training_export();
12943
12993
  init_diagnose_core();
12944
12994
  init_behavioral_data();
@@ -13048,7 +13098,7 @@ var THERAPIST_META_SPEC = {
13048
13098
  // src/analysis/network-core.ts
13049
13099
  init_log_adapter();
13050
13100
  function discoverNetworkAgents(dir) {
13051
- const absDir = resolve34(dir);
13101
+ const absDir = resolve35(dir);
13052
13102
  if (!existsSync25(absDir)) {
13053
13103
  throw new Error(`Directory not found: ${absDir}`);
13054
13104
  }
@@ -13071,7 +13121,7 @@ function discoverNetworkAgents(dir) {
13071
13121
  return agents;
13072
13122
  }
13073
13123
  function loadNetworkConfig(configPath) {
13074
- const raw = JSON.parse(readFileSync30(configPath, "utf-8"));
13124
+ const raw = JSON.parse(readFileSync31(configPath, "utf-8"));
13075
13125
  if (!raw.agents || !Array.isArray(raw.agents)) {
13076
13126
  throw new Error("network.json must contain an 'agents' array");
13077
13127
  }
@@ -13382,7 +13432,7 @@ function loadAgentMessages(logDir) {
13382
13432
  );
13383
13433
  for (const file of files.slice(0, 10)) {
13384
13434
  try {
13385
- const raw = readFileSync30(join23(logDir, file), "utf-8");
13435
+ const raw = readFileSync31(join23(logDir, file), "utf-8");
13386
13436
  const data = JSON.parse(raw);
13387
13437
  const conversations = parseConversationLog(data);
13388
13438
  for (const conv of conversations) {
@@ -13402,7 +13452,7 @@ async function networkCommand(options) {
13402
13452
  let agents;
13403
13453
  if (options.config) {
13404
13454
  try {
13405
- agents = loadNetworkConfig(resolve35(process.cwd(), options.config));
13455
+ agents = loadNetworkConfig(resolve36(process.cwd(), options.config));
13406
13456
  } catch (err) {
13407
13457
  console.error(chalk29.red(` Failed to load network config: ${err instanceof Error ? err.message : err}`));
13408
13458
  process.exit(1);
@@ -13410,7 +13460,7 @@ async function networkCommand(options) {
13410
13460
  }
13411
13461
  } else if (options.dir) {
13412
13462
  try {
13413
- agents = discoverNetworkAgents(resolve35(process.cwd(), options.dir));
13463
+ agents = discoverNetworkAgents(resolve36(process.cwd(), options.dir));
13414
13464
  } catch (err) {
13415
13465
  console.error(chalk29.red(` Failed to discover agents: ${err instanceof Error ? err.message : err}`));
13416
13466
  process.exit(1);
@@ -13450,7 +13500,7 @@ async function networkCommand(options) {
13450
13500
  agents,
13451
13501
  pairing,
13452
13502
  oversight,
13453
- therapistSpec: options.therapist ? resolve35(process.cwd(), options.therapist) : void 0,
13503
+ therapistSpec: options.therapist ? resolve36(process.cwd(), options.therapist) : void 0,
13454
13504
  maxSessionsPerAgent: maxSessions,
13455
13505
  convergenceThreshold: convergence,
13456
13506
  maxTurnsPerSession: maxTurns
@@ -13501,7 +13551,7 @@ async function networkCommand(options) {
13501
13551
  // src/commands/share.ts
13502
13552
  import chalk30 from "chalk";
13503
13553
  import figures21 from "figures";
13504
- import { resolve as resolve36 } from "path";
13554
+ import { resolve as resolve37 } from "path";
13505
13555
  init_training_export();
13506
13556
  async function shareCommand(options) {
13507
13557
  printHeader("Share Training Data");
@@ -13512,7 +13562,7 @@ async function shareCommand(options) {
13512
13562
  process.exit(1);
13513
13563
  return;
13514
13564
  }
13515
- const sessionsDir = resolve36(process.cwd(), options.sessions ?? ".holomime/sessions");
13565
+ const sessionsDir = resolve37(process.cwd(), options.sessions ?? ".holomime/sessions");
13516
13566
  const transcripts = await withSpinner("Loading session transcripts...", async () => {
13517
13567
  return loadTranscripts(sessionsDir);
13518
13568
  });
@@ -13589,15 +13639,15 @@ Run ${chalk30.cyan("holomime session")} or ${chalk30.cyan("holomime network")} f
13589
13639
  // src/commands/prescribe.ts
13590
13640
  import chalk31 from "chalk";
13591
13641
  import figures22 from "figures";
13592
- import { readFileSync as readFileSync31, writeFileSync as writeFileSync25 } from "fs";
13593
- import { resolve as resolve37 } from "path";
13642
+ import { readFileSync as readFileSync32, writeFileSync as writeFileSync25 } from "fs";
13643
+ import { resolve as resolve38 } from "path";
13594
13644
  init_diagnose_core();
13595
13645
  init_behavioral_data();
13596
13646
  init_log_adapter();
13597
13647
  async function prescribeCommand(options) {
13598
13648
  printHeader("Prescribe");
13599
- const specPath = resolve37(process.cwd(), options.personality);
13600
- const logPath = resolve37(process.cwd(), options.log);
13649
+ const specPath = resolve38(process.cwd(), options.personality);
13650
+ const logPath = resolve38(process.cwd(), options.log);
13601
13651
  const source = options.source ?? "corpus";
13602
13652
  let spec;
13603
13653
  try {
@@ -13609,7 +13659,7 @@ async function prescribeCommand(options) {
13609
13659
  }
13610
13660
  let rawData;
13611
13661
  try {
13612
- rawData = JSON.parse(readFileSync31(logPath, "utf-8"));
13662
+ rawData = JSON.parse(readFileSync32(logPath, "utf-8"));
13613
13663
  } catch (err) {
13614
13664
  console.error(chalk31.red(` Failed to read log file: ${err instanceof Error ? err.message : err}`));
13615
13665
  process.exit(1);
@@ -13661,7 +13711,7 @@ async function prescribeCommand(options) {
13661
13711
  console.log(chalk31.dim(` ... and ${dpoPairs.length - 5} more`));
13662
13712
  }
13663
13713
  if (options.output) {
13664
- const outPath = resolve37(process.cwd(), options.output);
13714
+ const outPath = resolve38(process.cwd(), options.output);
13665
13715
  writeFileSync25(outPath, JSON.stringify({
13666
13716
  agent: spec.name,
13667
13717
  diagnosis: { patterns: patterns.map((p) => ({ id: p.id, name: p.name, severity: p.severity })) },
@@ -13684,9 +13734,9 @@ async function prescribeCommand(options) {
13684
13734
  // src/commands/interview.ts
13685
13735
  import chalk32 from "chalk";
13686
13736
  import figures23 from "figures";
13687
- import { resolve as resolve38 } from "path";
13737
+ import { resolve as resolve39 } from "path";
13688
13738
  async function interviewCommand(options) {
13689
- const specPath = resolve38(process.cwd(), options.personality);
13739
+ const specPath = resolve39(process.cwd(), options.personality);
13690
13740
  let spec;
13691
13741
  try {
13692
13742
  spec = loadSpec(specPath);
@@ -13808,7 +13858,7 @@ import { homedir as homedir6 } from "os";
13808
13858
  import { PostHog } from "posthog-node";
13809
13859
 
13810
13860
  // src/telemetry/config.ts
13811
- import { readFileSync as readFileSync32, writeFileSync as writeFileSync26, mkdirSync as mkdirSync18, existsSync as existsSync26 } from "fs";
13861
+ import { readFileSync as readFileSync33, writeFileSync as writeFileSync26, mkdirSync as mkdirSync18, existsSync as existsSync26 } from "fs";
13812
13862
  import { join as join24 } from "path";
13813
13863
  import { homedir as homedir5 } from "os";
13814
13864
  import { randomUUID } from "crypto";
@@ -13824,7 +13874,7 @@ function ensureDir3() {
13824
13874
  function readConfig() {
13825
13875
  try {
13826
13876
  if (existsSync26(CONFIG_PATH)) {
13827
- return JSON.parse(readFileSync32(CONFIG_PATH, "utf-8"));
13877
+ return JSON.parse(readFileSync33(CONFIG_PATH, "utf-8"));
13828
13878
  }
13829
13879
  } catch {
13830
13880
  }
@@ -13846,7 +13896,7 @@ function shouldTrack() {
13846
13896
  function getAnonymousId() {
13847
13897
  try {
13848
13898
  if (existsSync26(ANON_ID_PATH)) {
13849
- const id2 = readFileSync32(ANON_ID_PATH, "utf-8").trim();
13899
+ const id2 = readFileSync33(ANON_ID_PATH, "utf-8").trim();
13850
13900
  if (id2.length > 0) return id2;
13851
13901
  }
13852
13902
  } catch {
@@ -14031,8 +14081,8 @@ async function telemetryCommand(action) {
14031
14081
  init_types();
14032
14082
  import chalk36 from "chalk";
14033
14083
  import figures26 from "figures";
14034
- import { readFileSync as readFileSync33, watchFile, unwatchFile } from "fs";
14035
- import { resolve as resolve39 } from "path";
14084
+ import { readFileSync as readFileSync34, watchFile, unwatchFile } from "fs";
14085
+ import { resolve as resolve40 } from "path";
14036
14086
 
14037
14087
  // src/core/embodiment-runtime.ts
14038
14088
  import { EventEmitter } from "events";
@@ -14159,14 +14209,14 @@ var ROS2Adapter = class {
14159
14209
  });
14160
14210
  }
14161
14211
  async connect() {
14162
- return new Promise((resolve44, reject) => {
14212
+ return new Promise((resolve45, reject) => {
14163
14213
  try {
14164
14214
  this.ws = this.createWebSocket(this.endpoint);
14165
14215
  this.ws.onopen = () => {
14166
14216
  this.connected = true;
14167
14217
  this.reconnectAttempts = 0;
14168
14218
  this.advertiseTopics();
14169
- resolve44();
14219
+ resolve45();
14170
14220
  };
14171
14221
  this.ws.onclose = () => {
14172
14222
  this.connected = false;
@@ -14283,12 +14333,12 @@ var UnityAdapter = class {
14283
14333
  this.defaultTransition = options.defaultTransition ?? DEFAULT_TRANSITION;
14284
14334
  }
14285
14335
  async connect() {
14286
- return new Promise((resolve44, reject) => {
14336
+ return new Promise((resolve45, reject) => {
14287
14337
  try {
14288
14338
  this.server = createServer((req, res) => this.handleRequest(req, res));
14289
14339
  this.server.listen(this.port, this.host, () => {
14290
14340
  this.connected = true;
14291
- resolve44();
14341
+ resolve45();
14292
14342
  });
14293
14343
  this.server.on("error", (err) => {
14294
14344
  if (!this.connected) {
@@ -14306,8 +14356,8 @@ var UnityAdapter = class {
14306
14356
  }
14307
14357
  this.sseClients.clear();
14308
14358
  if (this.server) {
14309
- await new Promise((resolve44) => {
14310
- this.server.close(() => resolve44());
14359
+ await new Promise((resolve45) => {
14360
+ this.server.close(() => resolve45());
14311
14361
  });
14312
14362
  this.server = null;
14313
14363
  }
@@ -14508,7 +14558,7 @@ var WebhookAdapter = class {
14508
14558
  }
14509
14559
  if (attempt < this.maxRetries) {
14510
14560
  const delay2 = this.retryDelay * Math.pow(2, attempt);
14511
- await new Promise((resolve44) => setTimeout(resolve44, delay2));
14561
+ await new Promise((resolve45) => setTimeout(resolve45, delay2));
14512
14562
  }
14513
14563
  }
14514
14564
  throw lastError ?? new Error("Webhook push failed after retries");
@@ -14520,12 +14570,12 @@ var WebhookAdapter = class {
14520
14570
 
14521
14571
  // src/commands/embody.ts
14522
14572
  async function embodyCommand(options) {
14523
- const personalityPath = resolve39(process.cwd(), options.personality);
14573
+ const personalityPath = resolve40(process.cwd(), options.personality);
14524
14574
  const provider = options.provider ?? "anthropic";
14525
14575
  const adapterType = options.adapter;
14526
14576
  let spec;
14527
14577
  try {
14528
- const raw = JSON.parse(readFileSync33(personalityPath, "utf-8"));
14578
+ const raw = JSON.parse(readFileSync34(personalityPath, "utf-8"));
14529
14579
  const parsed = personalitySpecSchema.safeParse(raw);
14530
14580
  if (!parsed.success) {
14531
14581
  throw new Error(parsed.error.errors.map((e) => `${e.path.join(".")}: ${e.message}`).join("\n"));
@@ -14588,7 +14638,7 @@ Press ${chalk36.bold("Ctrl+C")} to stop`,
14588
14638
  const pollInterval = 1e3;
14589
14639
  watchFile(personalityPath, { interval: pollInterval }, async () => {
14590
14640
  try {
14591
- const updatedRaw = JSON.parse(readFileSync33(personalityPath, "utf-8"));
14641
+ const updatedRaw = JSON.parse(readFileSync34(personalityPath, "utf-8"));
14592
14642
  const updatedParsed = personalitySpecSchema.safeParse(updatedRaw);
14593
14643
  if (!updatedParsed.success) {
14594
14644
  console.error(chalk36.yellow(` ${figures26.warning} Invalid personality spec, skipping update`));
@@ -14661,7 +14711,7 @@ function createAdapter(type, options) {
14661
14711
  // src/commands/voice.ts
14662
14712
  import chalk37 from "chalk";
14663
14713
  import figures27 from "figures";
14664
- import { resolve as resolve40 } from "path";
14714
+ import { resolve as resolve41 } from "path";
14665
14715
 
14666
14716
  // src/adapters/voice/types.ts
14667
14717
  function voiceEventToSegment(event) {
@@ -15177,7 +15227,7 @@ function renderTrajectory(trajectory) {
15177
15227
  );
15178
15228
  }
15179
15229
  async function voiceCommand(options) {
15180
- const specPath = resolve40(process.cwd(), options.personality);
15230
+ const specPath = resolve41(process.cwd(), options.personality);
15181
15231
  let spec;
15182
15232
  try {
15183
15233
  spec = loadSpec(specPath);
@@ -15291,7 +15341,7 @@ Press ${chalk37.cyan("Ctrl+C")} to stop.`,
15291
15341
  import chalk38 from "chalk";
15292
15342
  import figures28 from "figures";
15293
15343
  import { existsSync as existsSync29, mkdirSync as mkdirSync20, writeFileSync as writeFileSync28 } from "fs";
15294
- import { join as join26, resolve as resolve41 } from "path";
15344
+ import { join as join26, resolve as resolve42 } from "path";
15295
15345
  import { select as select3 } from "@inquirer/prompts";
15296
15346
  var INSTALL_DIRS = {
15297
15347
  "personality": ".",
@@ -15340,7 +15390,7 @@ async function installCommand(handle, options) {
15340
15390
  process.exit(1);
15341
15391
  return;
15342
15392
  }
15343
- const installDir = resolve41(process.cwd(), options.output ?? INSTALL_DIRS[asset.type]);
15393
+ const installDir = resolve42(process.cwd(), options.output ?? INSTALL_DIRS[asset.type]);
15344
15394
  const filename = INSTALL_FILENAMES[asset.type](asset.handle);
15345
15395
  const installPath = join26(installDir, filename);
15346
15396
  if (!existsSync29(installDir)) {
@@ -15386,14 +15436,14 @@ async function installCommand(handle, options) {
15386
15436
  // src/commands/cure.ts
15387
15437
  import chalk39 from "chalk";
15388
15438
  import figures29 from "figures";
15389
- import { readFileSync as readFileSync36, existsSync as existsSync31 } from "fs";
15390
- import { resolve as resolve43 } from "path";
15439
+ import { readFileSync as readFileSync37, existsSync as existsSync31 } from "fs";
15440
+ import { resolve as resolve44 } from "path";
15391
15441
 
15392
15442
  // src/analysis/training-pipeline.ts
15393
- import { writeFileSync as writeFileSync29, mkdirSync as mkdirSync21, readFileSync as readFileSync35, existsSync as existsSync30 } from "fs";
15394
- import { resolve as resolve42, join as join27 } from "path";
15443
+ import { writeFileSync as writeFileSync29, mkdirSync as mkdirSync21, readFileSync as readFileSync36, existsSync as existsSync30 } from "fs";
15444
+ import { resolve as resolve43, join as join27 } from "path";
15395
15445
  function ensurePipelineDir() {
15396
- const dir = resolve42(process.cwd(), ".holomime/pipeline");
15446
+ const dir = resolve43(process.cwd(), ".holomime/pipeline");
15397
15447
  mkdirSync21(dir, { recursive: true });
15398
15448
  return dir;
15399
15449
  }
@@ -15434,10 +15484,10 @@ async function runPipeline(options) {
15434
15484
  emitProgress("diagnose", "Analyzing behavioral patterns...");
15435
15485
  const { runDiagnosis: runDiagnosis2 } = await Promise.resolve().then(() => (init_diagnose_core(), diagnose_core_exports));
15436
15486
  const { parseConversationLog: parseConversationLog2 } = await Promise.resolve().then(() => (init_log_adapter(), log_adapter_exports));
15437
- const logPath = resolve42(process.cwd(), options.logPath);
15487
+ const logPath = resolve43(process.cwd(), options.logPath);
15438
15488
  let messages;
15439
15489
  try {
15440
- const raw = JSON.parse(readFileSync35(logPath, "utf-8"));
15490
+ const raw = JSON.parse(readFileSync36(logPath, "utf-8"));
15441
15491
  const conversations = parseConversationLog2(raw, "auto");
15442
15492
  messages = conversations.flatMap((c) => c.messages);
15443
15493
  } catch (err) {
@@ -15459,7 +15509,7 @@ async function runPipeline(options) {
15459
15509
  callbacks.onStageStart?.("export", stageIndex, totalStages);
15460
15510
  emitProgress("export", "Extracting training data from conversations...");
15461
15511
  const { exportTrainingData: exportTrainingData2, loadTranscripts: loadTranscripts2 } = await Promise.resolve().then(() => (init_training_export(), training_export_exports));
15462
- const sessionsDir = resolve42(process.cwd(), ".holomime/sessions");
15512
+ const sessionsDir = resolve43(process.cwd(), ".holomime/sessions");
15463
15513
  const transcripts = loadTranscripts2(sessionsDir);
15464
15514
  let exportData;
15465
15515
  const exportFormat = options.method === "dpo" ? "dpo" : "alpaca";
@@ -15474,14 +15524,14 @@ async function runPipeline(options) {
15474
15524
  generated_at: (/* @__PURE__ */ new Date()).toISOString()
15475
15525
  };
15476
15526
  }
15477
- const exportsDir = resolve42(process.cwd(), ".holomime/exports");
15527
+ const exportsDir = resolve43(process.cwd(), ".holomime/exports");
15478
15528
  if (existsSync30(exportsDir)) {
15479
15529
  try {
15480
15530
  const { readdirSync: readdirSync10 } = await import("fs");
15481
15531
  const files = readdirSync10(exportsDir).filter((f) => f.endsWith(".json") || f.endsWith(".jsonl")).sort().reverse();
15482
15532
  if (files.length > 0 && exportData.examples.length === 0) {
15483
15533
  const latestPath = join27(exportsDir, files[0]);
15484
- const latestData = JSON.parse(readFileSync35(latestPath, "utf-8"));
15534
+ const latestData = JSON.parse(readFileSync36(latestPath, "utf-8"));
15485
15535
  if (latestData.examples && latestData.examples.length > 0) {
15486
15536
  exportData = latestData;
15487
15537
  }
@@ -15639,7 +15689,7 @@ var STAGE_DESCRIPTIONS = {
15639
15689
  };
15640
15690
  function getAgentName2(personalityPath) {
15641
15691
  try {
15642
- const spec = JSON.parse(readFileSync36(personalityPath, "utf-8"));
15692
+ const spec = JSON.parse(readFileSync37(personalityPath, "utf-8"));
15643
15693
  return spec.name ?? "Agent";
15644
15694
  } catch {
15645
15695
  return "Agent";
@@ -15655,8 +15705,8 @@ async function cureCommand(options) {
15655
15705
  process.exit(1);
15656
15706
  return;
15657
15707
  }
15658
- const personalityPath = resolve43(process.cwd(), options.personality);
15659
- const logPath = resolve43(process.cwd(), options.log);
15708
+ const personalityPath = resolve44(process.cwd(), options.personality);
15709
+ const logPath = resolve44(process.cwd(), options.log);
15660
15710
  if (!existsSync31(personalityPath)) {
15661
15711
  console.error(chalk39.red(` Personality file not found: ${options.personality}`));
15662
15712
  process.exit(1);