@automagik/omni 2.260525.1 → 2.260528.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/index.js CHANGED
@@ -4665,15 +4665,17 @@ var exports_embedded_canonical_migration = {};
4665
4665
  __export(exports_embedded_canonical_migration, {
4666
4666
  readDataDirMajor: () => readDataDirMajor,
4667
4667
  migrateUnmountedEmbeddedToCanonical: () => migrateUnmountedEmbeddedToCanonical,
4668
+ embeddedPostgresPackage: () => embeddedPostgresPackage,
4668
4669
  compareVersionDesc: () => compareVersionDesc,
4669
4670
  compareEmbeddedVsCanonicalCounts: () => compareEmbeddedVsCanonicalCounts,
4671
+ MIGRATION_SKIP_TABLES: () => MIGRATION_SKIP_TABLES,
4670
4672
  EMBEDDED_PGSERVE_DATA_DIR: () => EMBEDDED_PGSERVE_DATA_DIR
4671
4673
  });
4672
4674
  import { execFileSync as execFileSync3, spawn, spawnSync as spawnSync2 } from "child_process";
4673
- import { existsSync as existsSync9, mkdtempSync, readFileSync as readFileSync6 } from "fs";
4675
+ import { existsSync as existsSync9, mkdirSync as mkdirSync6, mkdtempSync, readFileSync as readFileSync6, readdirSync as readdirSync2, symlinkSync } from "fs";
4674
4676
  import { createServer } from "net";
4675
- import { homedir as homedir7, tmpdir } from "os";
4676
- import { join as join11 } from "path";
4677
+ import { arch, homedir as homedir7, platform, tmpdir } from "os";
4678
+ import { dirname as dirname2, join as join11 } from "path";
4677
4679
  import { setTimeout as sleep2 } from "timers/promises";
4678
4680
  function defaultLog(line) {
4679
4681
  process.stdout.write(`${line}
@@ -4724,12 +4726,94 @@ function compareVersionDesc(a, b) {
4724
4726
  }
4725
4727
  function safeReaddir(path) {
4726
4728
  try {
4727
- const { readdirSync: readdirSync2 } = __require("fs");
4728
4729
  return readdirSync2(path);
4729
4730
  } catch {
4730
4731
  return [];
4731
4732
  }
4732
4733
  }
4734
+ function embeddedPostgresPackage() {
4735
+ const a = arch() === "arm64" ? "arm64" : arch() === "x64" ? "x64" : null;
4736
+ if (!a)
4737
+ return null;
4738
+ if (platform() === "linux")
4739
+ return `@embedded-postgres/linux-${a}`;
4740
+ if (platform() === "darwin")
4741
+ return `@embedded-postgres/darwin-${a}`;
4742
+ if (platform() === "win32" && a === "x64")
4743
+ return "@embedded-postgres/windows-x64";
4744
+ return null;
4745
+ }
4746
+ function latestReaderVersion(pkg, major) {
4747
+ try {
4748
+ const raw2 = execFileSync3("npm", ["view", pkg, "versions", "--json"], { encoding: "utf8", timeout: 30000 });
4749
+ const versions = JSON.parse(raw2);
4750
+ const list2 = Array.isArray(versions) ? versions : [versions];
4751
+ const matching = list2.filter((v) => v.startsWith(`${major}.`)).sort(compareVersionDesc);
4752
+ return matching.length ? matching[0] : null;
4753
+ } catch {
4754
+ return null;
4755
+ }
4756
+ }
4757
+ function materializeReaderLibs(nativeDir) {
4758
+ const libDir = join11(nativeDir, "lib");
4759
+ try {
4760
+ const pkgRoot = dirname2(nativeDir);
4761
+ const pairs = JSON.parse(readFileSync6(join11(nativeDir, "pg-symlinks.json"), "utf8"));
4762
+ for (const { source, target } of pairs) {
4763
+ const tgt = join11(pkgRoot, target);
4764
+ if (!existsSync9(tgt)) {
4765
+ try {
4766
+ symlinkSync(join11(pkgRoot, source), tgt);
4767
+ } catch {}
4768
+ }
4769
+ }
4770
+ } catch {}
4771
+ for (const f of safeReaddir(libDir)) {
4772
+ const m = f.match(/^(.*\.so\.\d+)\.\d+/);
4773
+ if (!m)
4774
+ continue;
4775
+ const base = join11(libDir, m[1]);
4776
+ if (!existsSync9(base)) {
4777
+ try {
4778
+ symlinkSync(join11(libDir, f), base);
4779
+ } catch {}
4780
+ }
4781
+ }
4782
+ }
4783
+ function fetchEmbeddedReader(major, log) {
4784
+ const pkg = embeddedPostgresPackage();
4785
+ if (!pkg)
4786
+ return null;
4787
+ const cacheDir = join11(homedir7(), ".omni", "cache", `pg-reader-${major}`);
4788
+ const nativeDir = join11(cacheDir, "node_modules", pkg, "native");
4789
+ const binary = join11(nativeDir, "bin", "postgres");
4790
+ if (existsSync9(binary) && binaryMajor(binary) === major) {
4791
+ materializeReaderLibs(nativeDir);
4792
+ return { binary, libDir: join11(nativeDir, "lib") };
4793
+ }
4794
+ const version = latestReaderVersion(pkg, major);
4795
+ if (!version)
4796
+ return null;
4797
+ log(` fetching PG ${major} reader (${pkg}@${version}) \u2014 one-time, cached at ${cacheDir}`);
4798
+ try {
4799
+ mkdirSync6(cacheDir, { recursive: true });
4800
+ const res = spawnSync2("bun", ["add", `${pkg}@${version}`], { cwd: cacheDir, encoding: "utf8", timeout: 180000 });
4801
+ if (res.status !== 0 || !existsSync9(binary))
4802
+ return null;
4803
+ materializeReaderLibs(nativeDir);
4804
+ return binaryMajor(binary) === major ? { binary, libDir: join11(nativeDir, "lib") } : null;
4805
+ } catch {
4806
+ return null;
4807
+ }
4808
+ }
4809
+ function resolveReaderForMajor(wantMajor, log) {
4810
+ const installed = findAutopgPostgresBinary(wantMajor);
4811
+ if (installed)
4812
+ return { binary: installed };
4813
+ if (wantMajor === null)
4814
+ return null;
4815
+ return fetchEmbeddedReader(wantMajor, log);
4816
+ }
4733
4817
  async function findFreePort() {
4734
4818
  return new Promise((resolve, reject) => {
4735
4819
  const server = createServer();
@@ -4747,10 +4831,17 @@ async function findFreePort() {
4747
4831
  });
4748
4832
  });
4749
4833
  }
4750
- async function spawnTempPostmaster(binary, dataDir, port, log) {
4834
+ async function spawnTempPostmaster(reader, dataDir, port, log) {
4751
4835
  const socketDir = mkdtempSync(join11(tmpdir(), "omni-migrate-pg-"));
4752
4836
  log(` spawning temp postmaster: pid=\u2026 port=${port} socket=${socketDir}`);
4753
- const child = spawn(binary, [
4837
+ let env2 = process.env;
4838
+ if (reader.libDir) {
4839
+ const loaderVar = platform() === "darwin" ? "DYLD_LIBRARY_PATH" : platform() === "win32" ? "PATH" : "LD_LIBRARY_PATH";
4840
+ const sep = platform() === "win32" ? ";" : ":";
4841
+ const prev = process.env[loaderVar];
4842
+ env2 = { ...process.env, [loaderVar]: prev ? `${reader.libDir}${sep}${prev}` : reader.libDir };
4843
+ }
4844
+ const child = spawn(reader.binary, [
4754
4845
  "-D",
4755
4846
  dataDir,
4756
4847
  "-p",
@@ -4761,7 +4852,8 @@ async function spawnTempPostmaster(binary, dataDir, port, log) {
4761
4852
  `unix_socket_directories=${socketDir}`
4762
4853
  ], {
4763
4854
  stdio: ["ignore", "pipe", "pipe"],
4764
- detached: false
4855
+ detached: false,
4856
+ env: env2
4765
4857
  });
4766
4858
  let started = false;
4767
4859
  let crashed = null;
@@ -4804,6 +4896,19 @@ async function spawnTempPostmaster(binary, dataDir, port, log) {
4804
4896
  }
4805
4897
  };
4806
4898
  }
4899
+ function listTables(args) {
4900
+ return psqlCapture([...args, "-tAc", `SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY tablename`]).split(`
4901
+ `).map((s) => s.trim()).filter(Boolean);
4902
+ }
4903
+ function listColumns(args, table, insertableOnly = false) {
4904
+ const filter = insertableOnly ? `AND is_generated <> 'ALWAYS'` : "";
4905
+ return psqlCapture([
4906
+ ...args,
4907
+ "-tAc",
4908
+ `SELECT column_name FROM information_schema.columns WHERE table_schema='public' AND table_name='${table}' ${filter} ORDER BY ordinal_position`
4909
+ ]).split(`
4910
+ `).map((s) => s.trim()).filter(Boolean);
4911
+ }
4807
4912
  function psqlCapture(args) {
4808
4913
  const result = spawnSync2("psql", args, {
4809
4914
  encoding: "utf-8",
@@ -4815,10 +4920,15 @@ function psqlCapture(args) {
4815
4920
  }
4816
4921
  return result.stdout ?? "";
4817
4922
  }
4818
- async function copyTable(table, srcArgs, dstArgs, log) {
4923
+ async function copyTable(table, columns, srcArgs, dstArgs, log) {
4924
+ if (columns.length === 0) {
4925
+ log(` skip ${table} (no shared columns)`);
4926
+ return;
4927
+ }
4928
+ const colList = columns.map((c2) => `"${c2}"`).join(", ");
4819
4929
  const tmpFile = join11(tmpdir(), `omni-migrate-${table}-${process.pid}.copy`);
4820
4930
  try {
4821
- const srcResult = spawnSync2("psql", [...srcArgs, "-c", `\\copy public.${table} TO '${tmpFile}' WITH (FORMAT binary)`], {
4931
+ const srcResult = spawnSync2("psql", [...srcArgs, "-c", `\\copy public."${table}" (${colList}) TO '${tmpFile}' WITH (FORMAT text)`], {
4822
4932
  stdio: ["ignore", "pipe", "pipe"],
4823
4933
  env: { ...process.env, PGPASSWORD: "postgres" },
4824
4934
  timeout: 600000,
@@ -4832,7 +4942,7 @@ async function copyTable(table, srcArgs, dstArgs, log) {
4832
4942
  "-c",
4833
4943
  `SET session_replication_role='replica';`,
4834
4944
  "-c",
4835
- `\\copy public.${table} FROM '${tmpFile}' WITH (FORMAT binary)`
4945
+ `\\copy public."${table}" (${colList}) FROM '${tmpFile}' WITH (FORMAT text)`
4836
4946
  ], {
4837
4947
  stdio: ["ignore", "pipe", "pipe"],
4838
4948
  env: { ...process.env, PGPASSWORD: "postgres" },
@@ -4875,17 +4985,17 @@ async function compareEmbeddedVsCanonicalCounts(opts = {}) {
4875
4985
  return { kind: "skipped", reason: "embedded dir absent" };
4876
4986
  }
4877
4987
  const wantMajor = readDataDirMajor(EMBEDDED_DIR);
4878
- const binary = findAutopgPostgresBinary(wantMajor);
4879
- if (!binary) {
4988
+ const reader = resolveReaderForMajor(wantMajor, () => {});
4989
+ if (!reader) {
4880
4990
  return {
4881
4991
  kind: "skipped",
4882
- reason: wantMajor ? `no PostgreSQL ${wantMajor} reader under ~/.local/share/autopg (embedded dir is PG ${wantMajor})` : "autopg postgres binary not found"
4992
+ reason: wantMajor ? `no PostgreSQL ${wantMajor} reader available (autopg or fetchable embedded-postgres) for the PG ${wantMajor} embedded dir` : "autopg postgres binary not found"
4883
4993
  };
4884
4994
  }
4885
4995
  const tempPort = await findFreePort();
4886
4996
  let temp = null;
4887
4997
  try {
4888
- temp = await spawnTempPostmaster(binary, EMBEDDED_DIR, tempPort, () => {});
4998
+ temp = await spawnTempPostmaster(reader, EMBEDDED_DIR, tempPort, () => {});
4889
4999
  const srcArgs = ["-h", "127.0.0.1", "-p", String(tempPort), "-U", "postgres", "-d", "omni"];
4890
5000
  const dstArgs = ["-h", "127.0.0.1", "-p", String(canonicalPort), "-U", "postgres", "-d", "omni"];
4891
5001
  const tablesRaw = psqlCapture([
@@ -4901,8 +5011,8 @@ async function compareEmbeddedVsCanonicalCounts(opts = {}) {
4901
5011
  let totalExtra = 0;
4902
5012
  for (const t of tables) {
4903
5013
  try {
4904
- const em = Number.parseInt(psqlCapture([...srcArgs, "-tAc", `SELECT count(*) FROM public.${t}`]).trim(), 10);
4905
- const ca = Number.parseInt(psqlCapture([...dstArgs, "-tAc", `SELECT count(*) FROM public.${t}`]).trim(), 10);
5014
+ const em = Number.parseInt(psqlCapture([...srcArgs, "-tAc", `SELECT count(*) FROM public."${t}"`]).trim(), 10);
5015
+ const ca = Number.parseInt(psqlCapture([...dstArgs, "-tAc", `SELECT count(*) FROM public."${t}"`]).trim(), 10);
4906
5016
  if (Number.isFinite(em) && Number.isFinite(ca) && em > ca) {
4907
5017
  divergent.push(t);
4908
5018
  totalExtra += em - ca;
@@ -4931,40 +5041,42 @@ async function migrateUnmountedEmbeddedToCanonical(opts = {}) {
4931
5041
  return { status: "skipped", reason: "embedded dir missing PG_VERSION" };
4932
5042
  }
4933
5043
  const wantMajor = readDataDirMajor(EMBEDDED_DIR);
4934
- const binary = findAutopgPostgresBinary(wantMajor);
4935
- if (!binary) {
5044
+ const reader = resolveReaderForMajor(wantMajor, log);
5045
+ if (!reader) {
4936
5046
  return {
4937
5047
  status: "skipped",
4938
- reason: wantMajor ? `no PostgreSQL ${wantMajor} reader installed under ~/.local/share/autopg \u2014 your data is PG ${wantMajor}; install a matching autopg/reader so it can be dumped into the canonical cluster` : "autopg postgres binary not found \u2014 install autopg first"
5048
+ reason: wantMajor ? `could not obtain a PostgreSQL ${wantMajor} reader (no installed autopg match and embedded-postgres fetch unavailable \u2014 unsupported platform or offline)` : "autopg postgres binary not found \u2014 install autopg first"
4939
5049
  };
4940
5050
  }
4941
- log(` using postgres binary: ${binary} (matched PG ${wantMajor ?? "?"})`);
5051
+ log(` using postgres binary: ${reader.binary} (matched PG ${wantMajor ?? "?"}${reader.libDir ? ", fetched reader" : ""})`);
4942
5052
  log(" stopping omni-api during data copy");
4943
5053
  spawnSync2("pm2", ["stop", "omni-api"], { stdio: "inherit" });
4944
5054
  const tempPort = await findFreePort();
4945
5055
  const t0 = Date.now();
4946
- const temp = await spawnTempPostmaster(binary, EMBEDDED_DIR, tempPort, log);
5056
+ const temp = await spawnTempPostmaster(reader, EMBEDDED_DIR, tempPort, log);
4947
5057
  let apiRestarted = false;
4948
5058
  try {
4949
5059
  const srcBaseArgs = ["-h", "127.0.0.1", "-p", String(tempPort), "-U", "postgres", "-d", "omni"];
4950
5060
  const dstBaseArgs = ["-h", "127.0.0.1", "-p", String(canonicalPort), "-U", "postgres", "-d", "omni"];
4951
- const tablesRaw = psqlCapture([
4952
- ...srcBaseArgs,
4953
- "-tAc",
4954
- `SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY tablename`
4955
- ]);
4956
- const tables = tablesRaw.split(`
4957
- `).map((s) => s.trim()).filter(Boolean);
4958
- if (tables.length === 0) {
5061
+ const srcTables = new Set(listTables(srcBaseArgs));
5062
+ if (srcTables.size === 0) {
4959
5063
  return { status: "skipped", reason: "embedded omni has no public tables" };
4960
5064
  }
4961
- const SKIP_TABLES = new Set(["media_content"]);
4962
- const filteredTables = tables.filter((t) => !SKIP_TABLES.has(t));
4963
- const skipped = tables.filter((t) => SKIP_TABLES.has(t));
5065
+ const dstTables = listTables(dstBaseArgs);
5066
+ const tables = dstTables.filter((t) => srcTables.has(t));
5067
+ const onlyEmbedded = [...srcTables].filter((t) => !dstTables.includes(t));
5068
+ if (onlyEmbedded.length > 0) {
5069
+ log(` ${onlyEmbedded.length} obsolete embedded-only table(s) skipped: ${onlyEmbedded.join(", ")}`);
5070
+ }
5071
+ if (tables.length === 0) {
5072
+ return { status: "skipped", reason: "no tables shared between embedded and canonical schemas" };
5073
+ }
5074
+ const filteredTables = tables.filter((t) => !MIGRATION_SKIP_TABLES.has(t));
5075
+ const skipped = tables.filter((t) => MIGRATION_SKIP_TABLES.has(t));
4964
5076
  if (skipped.length > 0)
4965
5077
  log(` skipping ${skipped.length} table(s) (rebuilt at runtime): ${skipped.join(", ")}`);
4966
5078
  log(` ${filteredTables.length} tables to migrate`);
4967
- const truncateList = filteredTables.map((t) => `public.${t}`).join(",");
5079
+ const truncateList = filteredTables.map((t) => `public."${t}"`).join(",");
4968
5080
  psqlCapture([
4969
5081
  ...dstBaseArgs,
4970
5082
  "-c",
@@ -4972,7 +5084,9 @@ async function migrateUnmountedEmbeddedToCanonical(opts = {}) {
4972
5084
  ]);
4973
5085
  log(" truncated canonical (CASCADE)");
4974
5086
  for (const t of filteredTables) {
4975
- await copyTable(t, srcBaseArgs, dstBaseArgs, log);
5087
+ const srcCols = new Set(listColumns(srcBaseArgs, t));
5088
+ const sharedCols = listColumns(dstBaseArgs, t, true).filter((c2) => srcCols.has(c2));
5089
+ await copyTable(t, sharedCols, srcBaseArgs, dstBaseArgs, log);
4976
5090
  }
4977
5091
  resetSequences(dstBaseArgs, log);
4978
5092
  return { status: "migrated", tables: filteredTables.length, durationMs: Date.now() - t0 };
@@ -4983,9 +5097,10 @@ async function migrateUnmountedEmbeddedToCanonical(opts = {}) {
4983
5097
  apiRestarted = true;
4984
5098
  }
4985
5099
  }
4986
- var EMBEDDED_DIR, EMBEDDED_PGSERVE_DATA_DIR;
5100
+ var EMBEDDED_DIR, MIGRATION_SKIP_TABLES, EMBEDDED_PGSERVE_DATA_DIR;
4987
5101
  var init_embedded_canonical_migration = __esm(() => {
4988
5102
  EMBEDDED_DIR = join11(homedir7(), ".omni", "data", "pgserve");
5103
+ MIGRATION_SKIP_TABLES = new Set(["media_content", "api_keys", "api_key_audit_logs"]);
4989
5104
  EMBEDDED_PGSERVE_DATA_DIR = EMBEDDED_DIR;
4990
5105
  });
4991
5106
 
@@ -35629,6 +35744,100 @@ var init_types6 = __esm(() => {
35629
35744
  };
35630
35745
  });
35631
35746
 
35747
+ // ../core/src/providers/execution-context.ts
35748
+ function compactEnv(values) {
35749
+ return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== undefined));
35750
+ }
35751
+ function inferChatType(context) {
35752
+ if (context.type === "dm")
35753
+ return "dm";
35754
+ if (context.source.chatId === context.sender.platformUserId)
35755
+ return "dm";
35756
+ if (context.source.threadId)
35757
+ return "channel";
35758
+ return "group";
35759
+ }
35760
+ function compactCustomer(customer) {
35761
+ if (!customer)
35762
+ return;
35763
+ const compacted = Object.fromEntries(Object.entries(customer).filter(([, value]) => value !== undefined));
35764
+ return Object.keys(compacted).length > 0 ? compacted : undefined;
35765
+ }
35766
+ function buildOmniExecutionContext(context) {
35767
+ const userId = context.sender.personId ?? context.sender.platformUserId;
35768
+ const sessionId = context.sessionId || context.source.threadId || context.source.chatId || userId;
35769
+ const customer = compactCustomer(context.customer);
35770
+ return {
35771
+ identity: {
35772
+ userId,
35773
+ ...context.sender.personId ? { personId: context.sender.personId } : {},
35774
+ platformUserId: context.sender.platformUserId,
35775
+ ...context.sender.displayName ? { displayName: context.sender.displayName } : {}
35776
+ },
35777
+ source: {
35778
+ channel: context.source.channelType,
35779
+ instanceId: context.source.instanceId,
35780
+ chatId: context.source.chatId,
35781
+ ...context.source.threadId ? { threadId: context.source.threadId } : {},
35782
+ messageId: context.source.messageId
35783
+ },
35784
+ session: {
35785
+ id: sessionId,
35786
+ ...context.sessionStrategy ? { strategy: context.sessionStrategy } : {}
35787
+ },
35788
+ trace: {
35789
+ id: context.traceId
35790
+ },
35791
+ ...customer ? { customer } : {}
35792
+ };
35793
+ }
35794
+ function buildOmniEnv(context, executionContext = buildOmniExecutionContext(context)) {
35795
+ return compactEnv({
35796
+ ...context.env ?? {},
35797
+ OMNI_USER_ID: executionContext.identity.userId,
35798
+ OMNI_PERSON_ID: executionContext.identity.personId,
35799
+ OMNI_PLATFORM_USER_ID: executionContext.identity.platformUserId,
35800
+ OMNI_SENDER: executionContext.identity.platformUserId,
35801
+ OMNI_DISPLAY_NAME: executionContext.identity.displayName,
35802
+ OMNI_INSTANCE: executionContext.source.instanceId,
35803
+ OMNI_CHAT: executionContext.source.chatId,
35804
+ OMNI_MESSAGE: executionContext.source.messageId,
35805
+ OMNI_CHANNEL: executionContext.source.channel,
35806
+ OMNI_SESSION: executionContext.session.id,
35807
+ OMNI_TRACE_ID: executionContext.trace.id,
35808
+ OMNI_THREAD: executionContext.source.threadId,
35809
+ OMNI_EXTERNAL_USER_ID: executionContext.customer?.externalUserId,
35810
+ OMNI_CUSTOMER_ID: executionContext.customer?.customerId,
35811
+ OMNI_ORGANIZATION_ID: executionContext.customer?.organizationId,
35812
+ OMNI_TENANT_ID: executionContext.customer?.tenantId
35813
+ });
35814
+ }
35815
+ function buildProviderRequestContext(context) {
35816
+ const executionContext = buildOmniExecutionContext(context);
35817
+ return {
35818
+ userId: executionContext.identity.userId,
35819
+ sessionId: executionContext.session.id,
35820
+ platform: {
35821
+ id: executionContext.identity.platformUserId,
35822
+ channel: executionContext.source.channel,
35823
+ instanceId: executionContext.source.instanceId
35824
+ },
35825
+ sender: {
35826
+ ...executionContext.identity.displayName ? { displayName: executionContext.identity.displayName } : {}
35827
+ },
35828
+ chat: {
35829
+ type: inferChatType(context),
35830
+ id: executionContext.source.chatId,
35831
+ ...executionContext.source.threadId ? { threadId: executionContext.source.threadId } : {}
35832
+ },
35833
+ messageId: executionContext.source.messageId,
35834
+ ...context.content.referencedMessageId ? { replyToMessageId: context.content.referencedMessageId } : {},
35835
+ env: buildOmniEnv(context, executionContext),
35836
+ executionContext
35837
+ };
35838
+ }
35839
+ var OMNI_EXECUTION_CONTEXT_EXTENSION_URI = "https://omni.dev/extensions/execution-context/v1";
35840
+
35632
35841
  // ../core/src/providers/agno-client.ts
35633
35842
  class AgnoClient {
35634
35843
  baseUrl;
@@ -35975,10 +36184,10 @@ var init_agno_client = __esm(() => {
35975
36184
  // ../core/src/providers/claude-code-executable.ts
35976
36185
  import { existsSync as nodeExistsSync } from "fs";
35977
36186
  import { createRequire } from "module";
35978
- function archLinkerNames(arch) {
35979
- if (arch === "x64")
36187
+ function archLinkerNames(arch2) {
36188
+ if (arch2 === "x64")
35980
36189
  return { musl: "x86_64", glibc: "x86-64" };
35981
- if (arch === "arm64")
36190
+ if (arch2 === "arm64")
35982
36191
  return { musl: "aarch64", glibc: "aarch64" };
35983
36192
  return null;
35984
36193
  }
@@ -35991,41 +36200,41 @@ function glibcLinkerCandidates(glibcName, muslName, nodeArch) {
35991
36200
  return [`/lib64/${fileName}`, `/lib/${muslName}-linux-gnu/${fileName}`, `/lib/${fileName}`];
35992
36201
  }
35993
36202
  function detectLinuxLibc(options = {}) {
35994
- const platform = options.platform ?? process.platform;
35995
- if (platform !== "linux")
36203
+ const platform2 = options.platform ?? process.platform;
36204
+ if (platform2 !== "linux")
35996
36205
  return "unknown";
35997
- const arch = options.arch ?? process.arch;
35998
- const names = archLinkerNames(arch);
36206
+ const arch2 = options.arch ?? process.arch;
36207
+ const names = archLinkerNames(arch2);
35999
36208
  if (!names)
36000
36209
  return "unknown";
36001
36210
  const exists = options.existsSync ?? nodeExistsSync;
36002
36211
  if (exists(muslLinkerPath(names.musl)))
36003
36212
  return "musl";
36004
- if (glibcLinkerCandidates(names.glibc, names.musl, arch).some(exists))
36213
+ if (glibcLinkerCandidates(names.glibc, names.musl, arch2).some(exists))
36005
36214
  return "glibc";
36006
36215
  return "unknown";
36007
36216
  }
36008
36217
  function resolveClaudeCodeExecutable(options = {}) {
36009
- const platform = options.platform ?? process.platform;
36010
- if (platform !== "linux")
36218
+ const platform2 = options.platform ?? process.platform;
36219
+ if (platform2 !== "linux")
36011
36220
  return;
36012
- const libc = options.libc ?? detectLinuxLibc({ platform, arch: options.arch });
36221
+ const libc = options.libc ?? detectLinuxLibc({ platform: platform2, arch: options.arch });
36013
36222
  if (libc === "unknown")
36014
36223
  return;
36015
- const arch = options.arch ?? process.arch;
36016
- if (arch !== "x64" && arch !== "arm64")
36224
+ const arch2 = options.arch ?? process.arch;
36225
+ if (arch2 !== "x64" && arch2 !== "arm64")
36017
36226
  return;
36018
- const suffix = libc === "musl" ? `-${arch}-musl` : `-${arch}`;
36227
+ const suffix = libc === "musl" ? `-${arch2}-musl` : `-${arch2}`;
36019
36228
  const specifier = `@anthropic-ai/claude-agent-sdk-linux${suffix}/claude`;
36020
36229
  const resolve2 = options.resolve ?? createRequire(import.meta.url).resolve;
36021
36230
  try {
36022
36231
  const resolved = resolve2(specifier);
36023
- log6.debug("Resolved Claude Code executable for host libc", { libc, arch, resolved });
36232
+ log6.debug("Resolved Claude Code executable for host libc", { libc, arch: arch2, resolved });
36024
36233
  return resolved;
36025
36234
  } catch (error2) {
36026
36235
  log6.debug("Claude Code subpackage not installed; falling back to SDK default", {
36027
36236
  libc,
36028
- arch,
36237
+ arch: arch2,
36029
36238
  specifier,
36030
36239
  error: String(error2)
36031
36240
  });
@@ -36034,9 +36243,9 @@ function resolveClaudeCodeExecutable(options = {}) {
36034
36243
  }
36035
36244
  function describeClaudeCodeStartupError(error2, options = {}) {
36036
36245
  const raw2 = String(error2);
36037
- const platform = options.platform ?? process.platform;
36246
+ const platform2 = options.platform ?? process.platform;
36038
36247
  const isStartupCrash = /process exited with code 1/i.test(raw2);
36039
- if (!isStartupCrash || platform !== "linux")
36248
+ if (!isStartupCrash || platform2 !== "linux")
36040
36249
  return raw2;
36041
36250
  const configuredHint = options.explicitExecutablePath ? `Configured pathToClaudeCodeExecutable=${options.explicitExecutablePath} did not launch \u2014 verify the binary is executable on this host.` : "Set `pathToClaudeCodeExecutable` on the provider to the correct SDK binary for this host, " + "or remove the mismatched optional subpackage " + "(e.g. `bun remove @anthropic-ai/claude-agent-sdk-linux-x64-musl` on glibc).";
36042
36251
  return `${raw2} \u2014 Claude Code binary failed to start. This is typically a glibc/musl ABI mismatch: the SDK resolved an optional subpackage whose native binary cannot execute on this host's dynamic linker. ${configuredHint}`;
@@ -60044,12 +60253,11 @@ class AgnoAgentProvider {
60044
60253
  message2 = `[${context.sender.displayName}]: ${message2}`;
60045
60254
  }
60046
60255
  const request = {
60256
+ ...buildProviderRequestContext(context),
60047
60257
  message: message2,
60048
60258
  agentId: this.config.agentId,
60049
60259
  agentType: this.config.agentType,
60050
60260
  stream: false,
60051
- sessionId: context.sessionId,
60052
- userId: context.sender.platformUserId,
60053
60261
  timeoutMs: this.config.timeoutMs ?? 60000
60054
60262
  };
60055
60263
  log8.info("Triggering Agno agent", {
@@ -60105,20 +60313,6 @@ function boundContextMessages(contextMessages) {
60105
60313
  }
60106
60314
  return bounded;
60107
60315
  }
60108
- function buildOmniEnv(context) {
60109
- return {
60110
- ...context.env ?? {},
60111
- OMNI_INSTANCE: context.source.instanceId,
60112
- OMNI_CHAT: context.source.chatId,
60113
- OMNI_MESSAGE: context.source.messageId,
60114
- OMNI_CHANNEL: context.source.channelType,
60115
- OMNI_SESSION: context.sessionId,
60116
- OMNI_TRACE_ID: context.traceId,
60117
- OMNI_SENDER: context.sender.platformUserId,
60118
- ...context.sender.personId ? { OMNI_PERSON_ID: context.sender.personId } : {},
60119
- ...context.source.threadId ? { OMNI_THREAD: context.source.threadId } : {}
60120
- };
60121
- }
60122
60316
 
60123
60317
  class ClaudeCodeAgentProvider {
60124
60318
  id;
@@ -60242,13 +60436,12 @@ ${fileList}`;
60242
60436
  }
60243
60437
  const { message: message2, resolvedSessionId, internalSessionKey } = prepared;
60244
60438
  const request = {
60439
+ ...buildProviderRequestContext(context),
60245
60440
  message: message2,
60246
60441
  agentId: "claude-code",
60247
60442
  stream: false,
60248
60443
  sessionId: resolvedSessionId,
60249
- userId: context.sender.personId ?? context.sender.platformUserId,
60250
60444
  timeoutMs: this.options.timeoutMs ?? 120000,
60251
- env: buildOmniEnv(context),
60252
60445
  ...context.source.chatId ? { mcpUrlParams: { chat_id: context.source.chatId } } : {}
60253
60446
  };
60254
60447
  log9.info("Triggering Claude Code agent", {
@@ -60285,13 +60478,12 @@ ${fileList}`;
60285
60478
  }
60286
60479
  const { message: message2, resolvedSessionId, internalSessionKey } = prepared;
60287
60480
  const request = {
60481
+ ...buildProviderRequestContext(context),
60288
60482
  message: message2,
60289
60483
  agentId: "claude-code",
60290
60484
  stream: true,
60291
60485
  sessionId: resolvedSessionId,
60292
- userId: context.sender.personId ?? context.sender.platformUserId,
60293
60486
  timeoutMs: this.options.timeoutMs ?? 120000,
60294
- env: buildOmniEnv(context),
60295
60487
  ...context.source.chatId ? { mcpUrlParams: { chat_id: context.source.chatId } } : {}
60296
60488
  };
60297
60489
  log9.info("Triggering Claude Code agent (stream)", {
@@ -60387,6 +60579,7 @@ class WebhookAgentProvider {
60387
60579
  emoji: context.content.emoji
60388
60580
  },
60389
60581
  traceId: context.traceId,
60582
+ executionContext: buildOmniExecutionContext(context),
60390
60583
  replyEndpoint: "POST /api/v2/messages/send"
60391
60584
  };
60392
60585
  log10.info("Sending webhook trigger", {
@@ -61802,10 +61995,9 @@ class AgUiAgentProvider {
61802
61995
  return { parts: [], metadata: { runId: "", providerId: this.id, durationMs: 0 } };
61803
61996
  }
61804
61997
  const request = {
61998
+ ...buildProviderRequestContext(context),
61805
61999
  message: message2,
61806
62000
  agentId: this.config.agentId,
61807
- sessionId: context.sessionId,
61808
- userId: context.sender.platformUserId,
61809
62001
  timeoutMs: this.config.timeoutMs ?? 60000
61810
62002
  };
61811
62003
  log14.info("Triggering AG-UI agent", { agentId: this.config.agentId, traceId: context.traceId });
@@ -61832,10 +62024,9 @@ class AgUiAgentProvider {
61832
62024
  return;
61833
62025
  }
61834
62026
  const request = {
62027
+ ...buildProviderRequestContext(context),
61835
62028
  message: message2,
61836
62029
  agentId: this.config.agentId,
61837
- sessionId: context.sessionId,
61838
- userId: context.sender.platformUserId,
61839
62030
  timeoutMs: this.config.timeoutMs ?? 60000
61840
62031
  };
61841
62032
  log14.info("Streaming AG-UI agent", { agentId: this.config.agentId, traceId: context.traceId });
@@ -61994,16 +62185,23 @@ class A2AClient {
61994
62185
  }
61995
62186
  }
61996
62187
  buildJsonRpcRequest(method, request) {
62188
+ const message2 = {
62189
+ role: "ROLE_USER",
62190
+ parts: [{ text: request.message, mediaType: "text/plain" }],
62191
+ messageId: `msg-${crypto.randomUUID()}`
62192
+ };
62193
+ if (request.executionContext) {
62194
+ message2.extensions = [OMNI_EXECUTION_CONTEXT_EXTENSION_URI];
62195
+ message2.metadata = {
62196
+ omniExecutionContext: request.executionContext
62197
+ };
62198
+ }
61997
62199
  return {
61998
62200
  jsonrpc: "2.0",
61999
62201
  id: `omni-${crypto.randomUUID()}`,
62000
62202
  method,
62001
62203
  params: {
62002
- message: {
62003
- role: "ROLE_USER",
62004
- parts: [{ text: request.message, mediaType: "text/plain" }],
62005
- messageId: `msg-${crypto.randomUUID()}`
62006
- },
62204
+ message: message2,
62007
62205
  configuration: {
62008
62206
  acceptedOutputModes: ["text/plain"],
62009
62207
  returnImmediately: true
@@ -62219,10 +62417,9 @@ class A2AAgentProvider {
62219
62417
  return { parts: [], metadata: { runId: "", providerId: this.id, durationMs: 0 } };
62220
62418
  }
62221
62419
  const request = {
62420
+ ...buildProviderRequestContext(context),
62222
62421
  message: message2,
62223
62422
  agentId: this.config.agentId,
62224
- sessionId: context.sessionId,
62225
- userId: context.sender.platformUserId,
62226
62423
  timeoutMs: this.config.timeoutMs ?? 60000
62227
62424
  };
62228
62425
  log16.info("Triggering A2A agent", { agentId: this.config.agentId, traceId: context.traceId });
@@ -62252,10 +62449,9 @@ class A2AAgentProvider {
62252
62449
  return;
62253
62450
  }
62254
62451
  const request = {
62452
+ ...buildProviderRequestContext(context),
62255
62453
  message: message2,
62256
62454
  agentId: this.config.agentId,
62257
- sessionId: context.sessionId,
62258
- userId: context.sender.platformUserId,
62259
62455
  timeoutMs: this.config.timeoutMs ?? 60000
62260
62456
  };
62261
62457
  log16.info("Streaming A2A agent", { agentId: this.config.agentId, traceId: context.traceId });
@@ -62351,7 +62547,8 @@ class NatsGenieProvider {
62351
62547
  traceId: context.traceId,
62352
62548
  messageId: context.source.messageId,
62353
62549
  files: context.content.files,
62354
- env: context.env
62550
+ env: buildOmniEnv(context),
62551
+ executionContext: buildOmniExecutionContext(context)
62355
62552
  };
62356
62553
  try {
62357
62554
  await this.ensureConnected();
@@ -63334,6 +63531,9 @@ __export(exports_src, {
63334
63531
  calculateBackoffDelay: () => calculateBackoffDelay,
63335
63532
  buildSubscribePattern: () => buildSubscribePattern,
63336
63533
  buildSubject: () => buildSubject,
63534
+ buildProviderRequestContext: () => buildProviderRequestContext,
63535
+ buildOmniExecutionContext: () => buildOmniExecutionContext,
63536
+ buildOmniEnv: () => buildOmniEnv,
63337
63537
  buildConversationKey: () => buildConversationKey,
63338
63538
  buildConsumerConfig: () => buildConsumerConfig,
63339
63539
  armSequence: () => armSequence,
@@ -63378,6 +63578,7 @@ __export(exports_src, {
63378
63578
  OpenClawAgentProvider: () => OpenClawAgentProvider,
63379
63579
  OmniEventRecordSchema: () => OmniEventRecordSchema,
63380
63580
  OmniError: () => OmniError,
63581
+ OMNI_EXECUTION_CONTEXT_EXTENSION_URI: () => OMNI_EXECUTION_CONTEXT_EXTENSION_URI,
63381
63582
  NotFoundError: () => NotFoundError,
63382
63583
  NonEmptyStringSchema: () => NonEmptyStringSchema,
63383
63584
  NatsGenieProvider: () => NatsGenieProvider,
@@ -82855,7 +83056,7 @@ var require_path = __commonJS((exports) => {
82855
83056
  function join21(...args) {
82856
83057
  return normalizePath(args.join("/"));
82857
83058
  }
82858
- function dirname6(path) {
83059
+ function dirname7(path) {
82859
83060
  const result = splitPath(path);
82860
83061
  const root = result[0] || "";
82861
83062
  let dir = result[1];
@@ -82875,7 +83076,7 @@ var require_path = __commonJS((exports) => {
82875
83076
  return f10;
82876
83077
  }
82877
83078
  exports.basename = basename6;
82878
- exports.dirname = dirname6;
83079
+ exports.dirname = dirname7;
82879
83080
  exports.isAbsolute = isAbsolute;
82880
83081
  exports.join = join21;
82881
83082
  exports.normalizePath = normalizePath;
@@ -124502,7 +124703,7 @@ import { fileURLToPath } from "url";
124502
124703
  // package.json
124503
124704
  var package_default = {
124504
124705
  name: "@automagik/omni",
124505
- version: "2.260525.1",
124706
+ version: "2.260528.1",
124506
124707
  description: "LLM-optimized CLI for Omni",
124507
124708
  type: "module",
124508
124709
  bin: {
@@ -128373,7 +128574,7 @@ function createDeadLettersCommand() {
128373
128574
  }
128374
128575
 
128375
128576
  // src/commands/doctor.ts
128376
- import { existsSync as existsSync10, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
128577
+ import { existsSync as existsSync10, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
128377
128578
  import { homedir as homedir8 } from "os";
128378
128579
  import { join as join13, resolve } from "path";
128379
128580
  init_config();
@@ -129776,12 +129977,12 @@ init_output();
129776
129977
 
129777
129978
  // src/server-bundle.ts
129778
129979
  init_output();
129779
- import { dirname as dirname2, join as join12 } from "path";
129980
+ import { dirname as dirname3, join as join12 } from "path";
129780
129981
  import { fileURLToPath as fileURLToPath2 } from "url";
129781
129982
  function getServerBundlePath() {
129782
129983
  try {
129783
129984
  const thisFile = fileURLToPath2(import.meta.url);
129784
- const distDir = dirname2(thisFile);
129985
+ const distDir = dirname3(thisFile);
129785
129986
  return join12(distDir, "server", "index.js");
129786
129987
  } catch {
129787
129988
  return join12(process.cwd(), "dist", "server", "index.js");
@@ -129790,7 +129991,7 @@ function getServerBundlePath() {
129790
129991
  function getServerLauncherPath() {
129791
129992
  try {
129792
129993
  const thisFile = fileURLToPath2(import.meta.url);
129793
- const distDir = dirname2(thisFile);
129994
+ const distDir = dirname3(thisFile);
129794
129995
  return join12(distDir, "..", "bin", "omni-server");
129795
129996
  } catch {
129796
129997
  return join12(process.cwd(), "bin", "omni-server");
@@ -129962,7 +130163,7 @@ function scanForOrphans(dir, acc, depth, maxDepth = 4) {
129962
130163
  return;
129963
130164
  let entries;
129964
130165
  try {
129965
- entries = readdirSync2(dir);
130166
+ entries = readdirSync3(dir);
129966
130167
  } catch {
129967
130168
  return;
129968
130169
  }
@@ -131456,7 +131657,7 @@ function createHistoryCommand() {
131456
131657
 
131457
131658
  // src/commands/imagine.ts
131458
131659
  import { writeFileSync as writeFileSync8 } from "fs";
131459
- import { basename as basename2, dirname as dirname3, extname as extname2, join as join14 } from "path";
131660
+ import { basename as basename2, dirname as dirname4, extname as extname2, join as join14 } from "path";
131460
131661
  init_output();
131461
131662
  var ALLOWED_ASPECT_RATIOS = ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"];
131462
131663
  function extensionForMime(mimeType) {
@@ -131467,7 +131668,7 @@ function extensionForMime(mimeType) {
131467
131668
  return ".png";
131468
131669
  }
131469
131670
  function buildOutputPath(outputBase, index, total, mimeType) {
131470
- const dir = dirname3(outputBase);
131671
+ const dir = dirname4(outputBase);
131471
131672
  const ext = extname2(outputBase) || extensionForMime(mimeType);
131472
131673
  const stem = basename2(outputBase, extname2(outputBase));
131473
131674
  if (total <= 1) {
@@ -131591,7 +131792,7 @@ function createImagineCommand() {
131591
131792
  }
131592
131793
 
131593
131794
  // src/commands/install.ts
131594
- import { existsSync as existsSync12, mkdirSync as mkdirSync6 } from "fs";
131795
+ import { existsSync as existsSync12, mkdirSync as mkdirSync7 } from "fs";
131595
131796
  import { homedir as homedir9 } from "os";
131596
131797
  import { join as join15 } from "path";
131597
131798
  init_config();
@@ -131701,7 +131902,7 @@ async function startServices(cfg, forceCleanup, forceSystemd, useCanonicalPgserv
131701
131902
  Or build locally: make cli-build-full`);
131702
131903
  return false;
131703
131904
  }
131704
- mkdirSync6(getPm2LogDir(), { recursive: true });
131905
+ mkdirSync7(getPm2LogDir(), { recursive: true });
131705
131906
  await installPm2Logrotate();
131706
131907
  const runtimeEnv = buildInstallRuntimeEnv(cfg, forceCleanup, useCanonicalPgserve);
131707
131908
  await runPm2(["delete", PM2_PROCESSES.api]);
@@ -131722,7 +131923,7 @@ async function startServices(cfg, forceCleanup, forceSystemd, useCanonicalPgserv
131722
131923
  if (existsSync12(NATS_BINARY_PATH)) {
131723
131924
  const natsSpinner = ora(`Starting ${PM2_PROCESSES.nats}...`).start();
131724
131925
  const natsDataDir = join15(cfg.dataDir, "nats");
131725
- mkdirSync6(natsDataDir, { recursive: true });
131926
+ mkdirSync7(natsDataDir, { recursive: true });
131726
131927
  const natsArgs = buildPm2StartArgs({
131727
131928
  kind: "nats",
131728
131929
  script: NATS_BINARY_PATH,
@@ -133399,8 +133600,8 @@ function createLogsCommand() {
133399
133600
  }
133400
133601
 
133401
133602
  // src/commands/media.ts
133402
- import { createWriteStream as createWriteStream2, existsSync as existsSync14, mkdirSync as mkdirSync8, statSync as statSync4 } from "fs";
133403
- import { basename as basename4, dirname as dirname4, resolve as resolve2 } from "path";
133603
+ import { createWriteStream as createWriteStream2, existsSync as existsSync14, mkdirSync as mkdirSync9, statSync as statSync4 } from "fs";
133604
+ import { basename as basename4, dirname as dirname5, resolve as resolve2 } from "path";
133404
133605
  import { Readable } from "stream";
133405
133606
  import { pipeline } from "stream/promises";
133406
133607
  init_config();
@@ -133467,9 +133668,9 @@ function resolveOutputPath(outputPath, result) {
133467
133668
  return resolved;
133468
133669
  }
133469
133670
  async function downloadToFile(url, apiKey, destinationPath) {
133470
- const destDir = dirname4(destinationPath);
133671
+ const destDir = dirname5(destinationPath);
133471
133672
  if (!existsSync14(destDir))
133472
- mkdirSync8(destDir, { recursive: true });
133673
+ mkdirSync9(destDir, { recursive: true });
133473
133674
  const resp = await fetch(url, {
133474
133675
  method: "GET",
133475
133676
  headers: apiKey ? { "x-api-key": apiKey } : undefined
@@ -134422,9 +134623,9 @@ init_output();
134422
134623
  init_src();
134423
134624
  import { execFileSync as execFileSync4, execSync } from "child_process";
134424
134625
  import * as nodeCrypto2 from "crypto";
134425
- import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
134626
+ import { existsSync as existsSync15, mkdirSync as mkdirSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
134426
134627
  import { homedir as homedir11 } from "os";
134427
- import { dirname as dirname5, resolve as resolve3 } from "path";
134628
+ import { dirname as dirname6, resolve as resolve3 } from "path";
134428
134629
  import { createInterface as createInterface2 } from "readline";
134429
134630
  init_config();
134430
134631
  init_output();
@@ -134661,7 +134862,7 @@ function readOpenClawConfig(configPath) {
134661
134862
  return JSON.parse(raw2);
134662
134863
  }
134663
134864
  function writeOpenClawConfig(configPath, config2) {
134664
- mkdirSync9(dirname5(configPath), { recursive: true, mode: 448 });
134865
+ mkdirSync10(dirname6(configPath), { recursive: true, mode: 448 });
134665
134866
  writeFileSync9(configPath, `${JSON.stringify(config2, null, 2)}
134666
134867
  `, { mode: 384 });
134667
134868
  }
@@ -136438,7 +136639,7 @@ function pickFilename(mimeType, provider) {
136438
136639
  }
136439
136640
 
136440
136641
  // src/commands/start.ts
136441
- import { existsSync as existsSync18, mkdirSync as mkdirSync10 } from "fs";
136642
+ import { existsSync as existsSync18, mkdirSync as mkdirSync11 } from "fs";
136442
136643
  import { homedir as homedir12 } from "os";
136443
136644
  import { join as join17 } from "path";
136444
136645
  init_config();
@@ -136454,7 +136655,7 @@ async function runStart() {
136454
136655
  }
136455
136656
  const serverConfig = loadServerConfig();
136456
136657
  const apiPort = serverConfig.port;
136457
- mkdirSync10(getPm2LogDir(), { recursive: true });
136658
+ mkdirSync11(getPm2LogDir(), { recursive: true });
136458
136659
  info(`Starting ${PM2_PROCESSES.api} (port ${apiPort})...`);
136459
136660
  const cliConfig = loadConfig();
136460
136661
  const env2 = buildRuntimeEnv(serverConfig, cliConfig);
@@ -136474,7 +136675,7 @@ async function runStart() {
136474
136675
  if (existsSync18(natsPath)) {
136475
136676
  info(`Starting ${PM2_PROCESSES.nats}...`);
136476
136677
  const natsDataDir = join17(serverConfig.dataDir, "nats");
136477
- mkdirSync10(natsDataDir, { recursive: true });
136678
+ mkdirSync11(natsDataDir, { recursive: true });
136478
136679
  const natsArgs = buildPm2StartArgs({
136479
136680
  kind: "nats",
136480
136681
  script: natsPath,
@@ -137177,7 +137378,7 @@ async function cleanupLegacyArtifacts(skipList) {
137177
137378
  init_output();
137178
137379
 
137179
137380
  // src/update-diagnostics.ts
137180
- import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync13, writeFileSync as writeFileSync10 } from "fs";
137381
+ import { existsSync as existsSync19, mkdirSync as mkdirSync12, readFileSync as readFileSync13, writeFileSync as writeFileSync10 } from "fs";
137181
137382
  import { homedir as homedir13 } from "os";
137182
137383
  import { join as join18 } from "path";
137183
137384
  var UPDATE_DIAGNOSTICS_SCHEMA_VERSION = 1;
@@ -137246,7 +137447,7 @@ function writeDiagnostics(state, exitCode) {
137246
137447
  const path = getDiagnosticsPath(state.startedAt);
137247
137448
  try {
137248
137449
  if (!existsSync19(dir)) {
137249
- mkdirSync11(dir, { recursive: true, mode: 448 });
137450
+ mkdirSync12(dir, { recursive: true, mode: 448 });
137250
137451
  }
137251
137452
  writeFileSync10(path, `${JSON.stringify(state, null, 2)}
137252
137453
  `, { mode: 384 });
@@ -137826,9 +138027,9 @@ function createVoiceCommand() {
137826
138027
  const startTime = Date.now();
137827
138028
  let saveDir = "";
137828
138029
  if (opts.save) {
137829
- const { mkdirSync: mkdirSync12 } = await import("fs");
138030
+ const { mkdirSync: mkdirSync13 } = await import("fs");
137830
138031
  saveDir = opts.save;
137831
- mkdirSync12(saveDir, { recursive: true });
138032
+ mkdirSync13(saveDir, { recursive: true });
137832
138033
  info(`Saving audio to: ${saveDir}`);
137833
138034
  }
137834
138035
  ws.onopen = () => {
@@ -138137,7 +138338,7 @@ function getConfigSummary() {
138137
138338
 
138138
138339
  // src/telemetry.ts
138139
138340
  init_config();
138140
- import { arch, platform, release } from "os";
138341
+ import { arch as arch2, platform as platform2, release } from "os";
138141
138342
  var OMNI_SENTRY_DSN = "https://2b2ca6f407e3d13409aa7dd8d12483f2@o4509714066571264.ingest.us.sentry.io/4510982636371968";
138142
138343
  var SENSITIVE_FLAGS = new Set([
138143
138344
  "--api-key",
@@ -138219,8 +138420,8 @@ function ensureSentry() {
138219
138420
  }
138220
138421
  });
138221
138422
  Sentry.setTag("cli.version", VERSION);
138222
- Sentry.setTag("os.platform", platform());
138223
- Sentry.setTag("os.arch", arch());
138423
+ Sentry.setTag("os.platform", platform2());
138424
+ Sentry.setTag("os.arch", arch2());
138224
138425
  Sentry.setTag("os.release", release());
138225
138426
  Sentry.setTag("runtime", `bun/${process.versions.bun ?? "unknown"}`);
138226
138427
  sentryModule = Sentry;