negotium 0.4.2 → 0.4.4

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/main.js CHANGED
@@ -273,7 +273,7 @@ function resolveDefaultModel(agent, registryDefaultModel) {
273
273
  function codexAuthFilePath() {
274
274
  return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
275
275
  }
276
- var HOME, PROJECT_ROOT, STATE_DIR_ENV, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BROWSER_RS_VERSION = "v0.1.21", BROWSER_RS_MIN_SECURE_VERSION = "0.1.15", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.7", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, BROWSER_MCP_SSE_PROXY_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5", FALLBACK_AGENT, SESSION_AGENT, GATEWAY_AGENT, FALLBACK_MODEL, SESSION_MODEL, GATEWAY_MODEL, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, _envMaxTellDepth, MAX_TELL_DEPTH;
276
+ var HOME, PROJECT_ROOT, STATE_DIR_ENV, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BROWSER_RS_VERSION = "v0.1.22", BROWSER_RS_MIN_SECURE_VERSION = "0.1.15", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.7", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, BROWSER_MCP_SSE_PROXY_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5", FALLBACK_AGENT, SESSION_AGENT, GATEWAY_AGENT, FALLBACK_MODEL, SESSION_MODEL, GATEWAY_MODEL, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, _envMaxTellDepth, MAX_TELL_DEPTH;
277
277
  var init_config = __esm(() => {
278
278
  init_config_helpers();
279
279
  init_logger();
@@ -1869,7 +1869,7 @@ var exports_version = {};
1869
1869
  __export(exports_version, {
1870
1870
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
1871
1871
  });
1872
- var NEGOTIUM_VERSION = "0.4.2";
1872
+ var NEGOTIUM_VERSION = "0.4.4";
1873
1873
 
1874
1874
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
1875
1875
  import { spawn } from "child_process";
@@ -2770,6 +2770,15 @@ function playwrightTransport(port, owner, capability, agent) {
2770
2770
  function longLivedHttpMcp(agent, port) {
2771
2771
  return agent === "codex" ? { url: `http://127.0.0.1:${port}/mcp` } : { type: "sse", url: `http://127.0.0.1:${port}/sse` };
2772
2772
  }
2773
+ function setCuaRsMcpPort(port) {
2774
+ if (port !== undefined && (!Number.isInteger(port) || port < 1 || port > 65535)) {
2775
+ throw new Error(`invalid cua-rs MCP port: ${port}`);
2776
+ }
2777
+ cuaRsMcpPort = port;
2778
+ }
2779
+ function cuaRsHttpMcp(port) {
2780
+ return { type: "http", url: `http://127.0.0.1:${port}/mcp` };
2781
+ }
2773
2782
  function backgroundBashTransport(agent, port, userId, topic) {
2774
2783
  const capability = bgBashContextCapability(userId, topic);
2775
2784
  const headers = {
@@ -2785,11 +2794,6 @@ function backgroundBashTransport(agent, port, userId, topic) {
2785
2794
  }
2786
2795
  return { type: "sse", url: `http://127.0.0.1:${port}/sse`, headers };
2787
2796
  }
2788
- function cuaRsArgs() {
2789
- const raw = envText("NEGOTIUM_CUA_RS_ALLOW_HID")?.trim().toLowerCase();
2790
- const on = raw === "1" || raw === "true" || raw === "yes";
2791
- return on ? ["--allow-hid"] : [];
2792
- }
2793
2797
  function resolveCuaRsBinary(platform2 = process.platform) {
2794
2798
  if (platform2 !== "darwin")
2795
2799
  return null;
@@ -3050,7 +3054,7 @@ function getMcpServersForQuery(opts) {
3050
3054
  peerBridge: opts.peerBridge
3051
3055
  });
3052
3056
  }
3053
- var _playwrightUnavailableNotifier, _playwrightUnavailableLastNotifiedAt, _PLAYWRIGHT_UNAVAILABLE_COOLDOWN_MS, _playwrightUnavailableThisTurn, CODEX_BROWSER_CAPABILITY_ENV = "NEGOTIUM_BROWSER_CAPABILITY", MCP_CATALOG, allForumMcpServerNames, requiredForumMcpServers, REQUIRED_FORUM_MCP_SERVERS, optionalForumMcpServers, OPTIONAL_FORUM_MCP_SERVERS, nodeMcpEntries;
3057
+ var _playwrightUnavailableNotifier, _playwrightUnavailableLastNotifiedAt, _PLAYWRIGHT_UNAVAILABLE_COOLDOWN_MS, _playwrightUnavailableThisTurn, CODEX_BROWSER_CAPABILITY_ENV = "NEGOTIUM_BROWSER_CAPABILITY", cuaRsMcpPort, MCP_CATALOG, allForumMcpServerNames, requiredForumMcpServers, REQUIRED_FORUM_MCP_SERVERS, optionalForumMcpServers, OPTIONAL_FORUM_MCP_SERVERS, nodeMcpEntries;
3054
3058
  var init_mcp_config = __esm(() => {
3055
3059
  init_canonical_bridge_config();
3056
3060
  init_runtime_spec();
@@ -3269,10 +3273,7 @@ var init_mcp_config = __esm(() => {
3269
3273
  "cua-rs": {
3270
3274
  ...commonRuntimeMcpPolicy("cua-rs"),
3271
3275
  build() {
3272
- const bin = resolveCuaRsBinary();
3273
- if (!bin)
3274
- return null;
3275
- return { command: bin, args: cuaRsArgs() };
3276
+ return cuaRsMcpPort ? cuaRsHttpMcp(cuaRsMcpPort) : null;
3276
3277
  }
3277
3278
  }
3278
3279
  };
@@ -6021,15 +6022,16 @@ function withCodexMcpServerOverrides(_name, server) {
6021
6022
  };
6022
6023
  }
6023
6024
  function toCodexMcpServers(claudeShape) {
6024
- const disabledBrowserStdio = () => ({
6025
+ const disabledStdio = () => ({
6025
6026
  command: process.execPath,
6026
6027
  args: ["-e", "process.exit(0)"],
6027
6028
  enabled: false
6028
6029
  });
6029
6030
  const out = {
6030
- playwright: disabledBrowserStdio(),
6031
- "browser-rs": disabledBrowserStdio(),
6032
- patchright: disabledBrowserStdio()
6031
+ playwright: disabledStdio(),
6032
+ "browser-rs": disabledStdio(),
6033
+ patchright: disabledStdio(),
6034
+ "cua-rs": disabledStdio()
6033
6035
  };
6034
6036
  for (const [name, srv] of Object.entries(claudeShape)) {
6035
6037
  if (!srv || typeof srv !== "object")
@@ -6639,7 +6641,8 @@ var init_codex_provider = __esm(async () => {
6639
6641
  init_logger();
6640
6642
  init_mcp_config();
6641
6643
  CODEX_MCP_SERVER_NAME_OVERRIDES = {
6642
- playwright: "otium_playwright"
6644
+ playwright: "otium_playwright",
6645
+ "cua-rs": "otium_cua_rs"
6643
6646
  };
6644
6647
  CODEX_DIFF_FILE_LIMIT = 512 * 1024;
6645
6648
  CODEX_DIFF_BASELINE_BYTE_LIMIT = 16 * 1024 * 1024;
@@ -23560,11 +23563,13 @@ __export(exports_node_host, {
23560
23563
  setNodeMcpServers: () => setNodeMcpServers,
23561
23564
  setGlobalAiName: () => setGlobalAiName,
23562
23565
  setFileHooks: () => setFileHooks,
23566
+ setCuaRsMcpPort: () => setCuaRsMcpPort,
23563
23567
  setBashrsCompletionSink: () => setBashrsCompletionSink,
23564
23568
  saveVaultEntry: () => saveVaultEntry,
23565
23569
  runtimeBus: () => runtimeBus,
23566
23570
  runShutdown: () => runShutdown,
23567
23571
  runNodeRequestHandlers: () => runNodeRequestHandlers,
23572
+ resolveCuaRsBinary: () => resolveCuaRsBinary,
23568
23573
  reconcilePendingAskUserQuestionGates: () => reconcilePendingAskUserQuestionGates,
23569
23574
  reapOrphanBrowsers: () => reapPlaywrightOrphans,
23570
23575
  readDecisions: () => readDecisions,
@@ -32613,7 +32618,9 @@ __export(exports_src3, {
32613
32618
  NODE_CONTROL_PROTOCOL_VERSION: () => NODE_CONTROL_PROTOCOL_VERSION,
32614
32619
  NODE_CONTROL_BASE_PATH: () => NODE_CONTROL_BASE_PATH
32615
32620
  });
32621
+ import { rmSync as rmSync10 } from "fs";
32616
32622
  import { createServer as createServer5 } from "net";
32623
+ import { join as join43 } from "path";
32617
32624
  async function availableLoopbackPort() {
32618
32625
  return new Promise((resolve24, reject) => {
32619
32626
  const probe = createServer5();
@@ -32633,6 +32640,13 @@ async function availableLoopbackPort() {
32633
32640
  });
32634
32641
  });
32635
32642
  }
32643
+ function readFixedNodePort() {
32644
+ const raw = process.env.NEGOTIUM_NODE_PORT;
32645
+ if (raw === undefined || raw === "")
32646
+ return;
32647
+ const port = Number.parseInt(raw, 10);
32648
+ return Number.isInteger(port) && port >= 1 && port <= 65535 ? port : undefined;
32649
+ }
32636
32650
  async function wireNodeMcps(host2, manifest) {
32637
32651
  const entries = [];
32638
32652
  for (const spec of manifest.list()) {
@@ -32662,6 +32676,41 @@ async function wireNodeMcps(host2, manifest) {
32662
32676
  logger.info({ keys: entries.map((e) => e.key) }, "node mcp: manifest servers installed");
32663
32677
  }
32664
32678
  }
32679
+ async function wireCuaRsMcp() {
32680
+ setCuaRsMcpPort(undefined);
32681
+ const binary = resolveCuaRsBinary();
32682
+ if (!binary)
32683
+ return;
32684
+ const manifestFile = join43(RUN_DIR, CUA_RS_MCP_MANIFEST_FILE);
32685
+ rmSync10(manifestFile, { force: true });
32686
+ const manifest = new McpManifest({ file: manifestFile });
32687
+ const spec = {
32688
+ key: CUA_RS_MCP_KEY,
32689
+ transport: "http",
32690
+ command: binary,
32691
+ args: ["{port}"],
32692
+ portRange: CUA_RS_MCP_PORT_RANGE,
32693
+ scope: "node",
32694
+ healthIntervalMs: 15000
32695
+ };
32696
+ manifest.add(spec);
32697
+ const host2 = new McpHost({ manifest });
32698
+ const stopSweeper = host2.startSweeper();
32699
+ try {
32700
+ const instance = await host2.ensure(CUA_RS_MCP_KEY);
32701
+ if (!instance.port)
32702
+ throw new Error("cua-rs started without an HTTP port");
32703
+ setCuaRsMcpPort(instance.port);
32704
+ logger.info({ pid: instance.pid, port: instance.port }, "cua-rs MCP server ready");
32705
+ return { host: host2, stopSweeper };
32706
+ } catch (error2) {
32707
+ stopSweeper();
32708
+ await host2.stopAll();
32709
+ setCuaRsMcpPort(undefined);
32710
+ logger.warn({ err: error2 }, "cua-rs MCP server unavailable");
32711
+ return;
32712
+ }
32713
+ }
32665
32714
  function startNode(opts = {}) {
32666
32715
  sweepStaleSubagentCards();
32667
32716
  setFileHooks(nodeFileStore.hooks);
@@ -32764,6 +32813,7 @@ function startNode(opts = {}) {
32764
32813
  const mcpHost = new McpHost;
32765
32814
  const manifest = new McpManifest;
32766
32815
  const stopSweeper = mcpHost.startSweeper();
32816
+ const cuaRsMcp = wireCuaRsMcp();
32767
32817
  let resolveCompleted;
32768
32818
  const completed = new Promise((resolve24) => {
32769
32819
  resolveCompleted = resolve24;
@@ -32773,6 +32823,11 @@ function startNode(opts = {}) {
32773
32823
  advertised = opts.advertise ? writeNodeDaemonInfo(port, startedAt) : null;
32774
32824
  } catch (error2) {
32775
32825
  stopSweeper();
32826
+ setCuaRsMcpPort(undefined);
32827
+ cuaRsMcp.then(async (managed) => {
32828
+ managed?.stopSweeper();
32829
+ await managed?.host.stopAll();
32830
+ });
32776
32831
  stopTurnRequests();
32777
32832
  stopInbox();
32778
32833
  stopBashrsCompletions();
@@ -32808,6 +32863,12 @@ function startNode(opts = {}) {
32808
32863
  stopSweeper();
32809
32864
  await mcpHost.stopAll();
32810
32865
  });
32866
+ onShutdown("cua-rs-mcp-host", 50, async () => {
32867
+ setCuaRsMcpPort(undefined);
32868
+ const managed = await cuaRsMcp;
32869
+ managed?.stopSweeper();
32870
+ await managed?.host.stopAll();
32871
+ });
32811
32872
  onShutdown("playwright", 50, () => killAllPlaywright());
32812
32873
  onShutdown("background-bash", 50, () => killAllBgBash());
32813
32874
  onShutdown("node-completed", -100, resolveCompleted);
@@ -32834,7 +32895,7 @@ async function startDefaultNode(opts = {}) {
32834
32895
  const { createCronModule: createCronModule2 } = await init_src4().then(() => exports_src2);
32835
32896
  modules.push(createCronModule2());
32836
32897
  }
32837
- const port = opts.port === 0 ? await availableLoopbackPort() : opts.port;
32898
+ const port = opts.port === 0 ? readFixedNodePort() ?? await availableLoopbackPort() : opts.port;
32838
32899
  return startNode({ ...opts, port, modules });
32839
32900
  }
32840
32901
  async function runNodeDaemon(opts = {}) {
@@ -32848,6 +32909,7 @@ async function runNodeDaemon(opts = {}) {
32848
32909
  await new Promise((resolve24) => setImmediate(resolve24));
32849
32910
  process.exit(0);
32850
32911
  }
32912
+ var CUA_RS_MCP_KEY = "cua-rs", CUA_RS_MCP_MANIFEST_FILE = "cua-rs-mcp-manifest.json", CUA_RS_MCP_PORT_RANGE;
32851
32913
  var init_src5 = __esm(async () => {
32852
32914
  await init_conversation_migration();
32853
32915
  await init_node_host();
@@ -32857,6 +32919,7 @@ var init_src5 = __esm(async () => {
32857
32919
  await init_files();
32858
32920
  await init_control();
32859
32921
  await init_files();
32922
+ CUA_RS_MCP_PORT_RANGE = { base: 9350, max: 9399 };
32860
32923
  });
32861
32924
 
32862
32925
  // ../../packages/adapter-sdk/src/index.ts
@@ -33893,7 +33956,7 @@ var init_context_usage = __esm(async () => {
33893
33956
  import { execFile as execFile3 } from "child_process";
33894
33957
  import { existsSync as existsSync36, readdirSync as readdirSync14, statSync as statSync19 } from "fs";
33895
33958
  import { homedir as homedir11 } from "os";
33896
- import { basename as basename11, dirname as dirname21, join as join43, sep as sep3 } from "path";
33959
+ import { basename as basename11, dirname as dirname21, join as join44, sep as sep3 } from "path";
33897
33960
  import { promisify as promisify3 } from "util";
33898
33961
  function indexRecursivePaths(files) {
33899
33962
  const paths = [];
@@ -33994,11 +34057,11 @@ function resolveFragment(frag) {
33994
34057
  else if (frag === "~/")
33995
34058
  path = home;
33996
34059
  else if (frag.startsWith("~/"))
33997
- path = join43(home, frag.slice(2));
34060
+ path = join44(home, frag.slice(2));
33998
34061
  else if (frag.startsWith("/"))
33999
34062
  path = frag;
34000
34063
  else
34001
- path = join43(home, frag);
34064
+ path = join44(home, frag);
34002
34065
  if (frag.endsWith("/") || frag === "" || frag === "~") {
34003
34066
  return { dir: path, prefix: "" };
34004
34067
  }
@@ -34027,7 +34090,7 @@ function rankAndSlice(dir, candidates) {
34027
34090
  });
34028
34091
  return candidates.slice(0, MAX_SUGGESTIONS).map(({ relPath, isDir }) => ({
34029
34092
  label: `${relPath}${isDir ? "/" : ""}`,
34030
- value: toToken(join43(dir, relPath), isDir),
34093
+ value: toToken(join44(dir, relPath), isDir),
34031
34094
  isDir
34032
34095
  }));
34033
34096
  }
@@ -34106,7 +34169,7 @@ function pathSuggestions(lineText, col) {
34106
34169
  let isDir = entry.isDirectory();
34107
34170
  if (!isDir && entry.isSymbolicLink()) {
34108
34171
  try {
34109
- isDir = statSync19(join43(dir, entry.name)).isDirectory();
34172
+ isDir = statSync19(join44(dir, entry.name)).isDirectory();
34110
34173
  } catch {}
34111
34174
  }
34112
34175
  return {
@@ -34133,10 +34196,10 @@ function fragmentToAbsolutePath(frag) {
34133
34196
  if (frag === "~" || frag === "~/")
34134
34197
  return home;
34135
34198
  if (frag.startsWith("~/"))
34136
- return join43(home, frag.slice(2));
34199
+ return join44(home, frag.slice(2));
34137
34200
  if (frag.startsWith("/"))
34138
34201
  return frag;
34139
- return join43(home, frag);
34202
+ return join44(home, frag);
34140
34203
  }
34141
34204
  function fragmentResolves(frag) {
34142
34205
  try {
@@ -40642,7 +40705,7 @@ var init_commands2 = __esm(async () => {
40642
40705
  // ../../adapters/telegram/src/mapping-store.ts
40643
40706
  import { Database as Database2 } from "bun:sqlite";
40644
40707
  import { mkdirSync as mkdirSync32 } from "fs";
40645
- import { dirname as dirname22, join as join44 } from "path";
40708
+ import { dirname as dirname22, join as join45 } from "path";
40646
40709
  function outboxRowToEntry(row) {
40647
40710
  return {
40648
40711
  id: row.id,
@@ -40708,7 +40771,7 @@ function migrateOutboxSchema(db4) {
40708
40771
  db4.run("CREATE INDEX IF NOT EXISTS idx_telegram_outbox_runtime_message ON outbox(runtime_message_id)");
40709
40772
  }
40710
40773
  function openMappingStore(path) {
40711
- const dbPath = path ?? join44(DATA_DIR, "adapter-telegram.db");
40774
+ const dbPath = path ?? join45(DATA_DIR, "adapter-telegram.db");
40712
40775
  if (dbPath !== ":memory:")
40713
40776
  mkdirSync32(dirname22(dbPath), { recursive: true });
40714
40777
  const db4 = new Database2(dbPath);
@@ -42608,9 +42671,9 @@ function firstCell() {
42608
42671
  return cell;
42609
42672
  return null;
42610
42673
  }
42611
- function attachOtiumCentralCell(join45) {
42612
- cells.set(join45.cellId, {
42613
- join: join45,
42674
+ function attachOtiumCentralCell(join46) {
42675
+ cells.set(join46.cellId, {
42676
+ join: join46,
42614
42677
  nodesCache: null,
42615
42678
  verifyCache: new Map,
42616
42679
  tokenCache: new Map
@@ -42622,10 +42685,10 @@ function detachOtiumCentralCell(cellId) {
42622
42685
  function attachedOtiumCells() {
42623
42686
  return [...cells.values()].map((cell) => cell.join);
42624
42687
  }
42625
- function configureOtiumCentral(join45) {
42688
+ function configureOtiumCentral(join46) {
42626
42689
  cells.clear();
42627
- if (join45)
42628
- attachOtiumCentralCell(join45);
42690
+ if (join46)
42691
+ attachOtiumCentralCell(join46);
42629
42692
  }
42630
42693
  function isOtiumCentralConfigured() {
42631
42694
  return cells.size > 0;
@@ -43047,7 +43110,7 @@ import {
43047
43110
  openSync as openSync5,
43048
43111
  readFileSync as readFileSync29,
43049
43112
  renameSync as renameSync17,
43050
- rmSync as rmSync10,
43113
+ rmSync as rmSync11,
43051
43114
  statSync as statSync20,
43052
43115
  unlinkSync as unlinkSync23,
43053
43116
  writeFileSync as writeFileSync25
@@ -43142,7 +43205,7 @@ function withJoinCredentialLock(operation) {
43142
43205
  break;
43143
43206
  } catch (error2) {
43144
43207
  if (created) {
43145
- rmSync10(lockPath, { recursive: true, force: true });
43208
+ rmSync11(lockPath, { recursive: true, force: true });
43146
43209
  throw error2;
43147
43210
  }
43148
43211
  if (error2.code !== "EEXIST")
@@ -43168,7 +43231,7 @@ function withJoinCredentialLock(operation) {
43168
43231
  const stalePath = `${lockPath}.stale.${process.pid}.${randomUUID28()}`;
43169
43232
  try {
43170
43233
  renameSync17(lockPath, stalePath);
43171
- rmSync10(stalePath, { recursive: true, force: true });
43234
+ rmSync11(stalePath, { recursive: true, force: true });
43172
43235
  } catch (staleError) {
43173
43236
  if (staleError.code !== "ENOENT")
43174
43237
  throw staleError;
@@ -43181,7 +43244,7 @@ function withJoinCredentialLock(operation) {
43181
43244
  try {
43182
43245
  const current3 = JSON.parse(readFileSync29(ownerPath, "utf8"));
43183
43246
  if (current3.pid === owner.pid && current3.token === owner.token) {
43184
- rmSync10(lockPath, { recursive: true, force: true });
43247
+ rmSync11(lockPath, { recursive: true, force: true });
43185
43248
  }
43186
43249
  } catch {}
43187
43250
  }
@@ -43189,17 +43252,17 @@ function withJoinCredentialLock(operation) {
43189
43252
  function joinsEqual(left, right) {
43190
43253
  return left.central === right.central && left.relay === right.relay && left.cellId === right.cellId && left.secret === right.secret;
43191
43254
  }
43192
- function normalizedJoin(join45) {
43255
+ function normalizedJoin(join46) {
43193
43256
  return normalizeJoin({
43194
- v: join45.v,
43195
- central: join45.central,
43196
- relay: join45.relay,
43197
- cellId: join45.cellId,
43198
- secret: join45.secret
43257
+ v: join46.v,
43258
+ central: join46.central,
43259
+ relay: join46.relay,
43260
+ cellId: join46.cellId,
43261
+ secret: join46.secret
43199
43262
  });
43200
43263
  }
43201
- function joinCredentialDigest(join45) {
43202
- return createHash11("sha256").update(JSON.stringify(normalizedJoin(join45))).digest("base64url");
43264
+ function joinCredentialDigest(join46) {
43265
+ return createHash11("sha256").update(JSON.stringify(normalizedJoin(join46))).digest("base64url");
43203
43266
  }
43204
43267
  function readPersistedJoins(path = joinFilePath()) {
43205
43268
  if (!existsSync39(path))
@@ -43218,9 +43281,9 @@ function readPersistedJoins(path = joinFilePath()) {
43218
43281
  return normalizeJoin(entry);
43219
43282
  });
43220
43283
  }
43221
- function isJoinPersisted(join45) {
43284
+ function isJoinPersisted(join46) {
43222
43285
  try {
43223
- const normalized = normalizedJoin(join45);
43286
+ const normalized = normalizedJoin(join46);
43224
43287
  return readPersistedJoins().some((persisted) => joinsEqual(persisted, normalized));
43225
43288
  } catch {
43226
43289
  return false;
@@ -43264,10 +43327,10 @@ function writeJoins(joins, allowOverwrite) {
43264
43327
  }
43265
43328
  return path;
43266
43329
  }
43267
- function saveJoinWhileLocked(join45, options = {}) {
43330
+ function saveJoinWhileLocked(join46, options = {}) {
43268
43331
  const path = joinFilePath();
43269
43332
  const directory = dirname23(path);
43270
- const normalized = normalizedJoin(join45);
43333
+ const normalized = normalizedJoin(join46);
43271
43334
  mkdirSync33(directory, { recursive: true });
43272
43335
  if (!existsSync39(path))
43273
43336
  return writeJoins([normalized], false);
@@ -43297,8 +43360,8 @@ function saveJoinWhileLocked(join45, options = {}) {
43297
43360
  const next = conflict ? existing.map((persisted) => persisted.cellId === normalized.cellId ? normalized : persisted) : [...existing, normalized];
43298
43361
  return writeJoins(next, true);
43299
43362
  }
43300
- function saveJoin(join45, options = {}) {
43301
- return withJoinCredentialLock(() => saveJoinWhileLocked(join45, options));
43363
+ function saveJoin(join46, options = {}) {
43364
+ return withJoinCredentialLock(() => saveJoinWhileLocked(join46, options));
43302
43365
  }
43303
43366
  function removeJoin(cellId) {
43304
43367
  return withJoinCredentialLock(() => {
@@ -43311,7 +43374,7 @@ function removeJoin(cellId) {
43311
43374
  if (cellId) {
43312
43375
  let remaining;
43313
43376
  try {
43314
- remaining = readPersistedJoins(path).filter((join45) => join45.cellId !== cellId);
43377
+ remaining = readPersistedJoins(path).filter((join46) => join46.cellId !== cellId);
43315
43378
  } catch {
43316
43379
  return false;
43317
43380
  }
@@ -43363,8 +43426,8 @@ var init_join = __esm(async () => {
43363
43426
 
43364
43427
  // ../../adapters/otium/src/peer-files.ts
43365
43428
  import { randomUUID as randomUUID29 } from "crypto";
43366
- import { copyFileSync as copyFileSync5, mkdirSync as mkdirSync34, rmSync as rmSync11, statSync as statSync21 } from "fs";
43367
- import { basename as basename13, extname as extname6, join as join45 } from "path";
43429
+ import { copyFileSync as copyFileSync5, mkdirSync as mkdirSync34, rmSync as rmSync12, statSync as statSync21 } from "fs";
43430
+ import { basename as basename13, extname as extname6, join as join46 } from "path";
43368
43431
  function fileType(mimeType) {
43369
43432
  if (mimeType.startsWith("image/"))
43370
43433
  return "image";
@@ -43430,7 +43493,7 @@ function recordFile(args) {
43430
43493
  function insertLocalFile(args) {
43431
43494
  const id = randomUUID29();
43432
43495
  mkdirSync34(PEER_FILES_DIR, { recursive: true });
43433
- const path = join45(PEER_FILES_DIR, `${id}-${safeFilename(args.filename)}`);
43496
+ const path = join46(PEER_FILES_DIR, `${id}-${safeFilename(args.filename)}`);
43434
43497
  copyFileSync5(args.sourcePath, path);
43435
43498
  return recordFile({ id, path, sizeBytes: statSync21(path).size, ...args });
43436
43499
  }
@@ -43438,7 +43501,7 @@ function deletePeerFilesForTopic(topicId) {
43438
43501
  const rows = db.query("SELECT path FROM otium_peer_files WHERE topic_id = ?").all(topicId);
43439
43502
  db.run("DELETE FROM otium_peer_files WHERE topic_id = ?", [topicId]);
43440
43503
  for (const row of rows)
43441
- rmSync11(row.path, { force: true });
43504
+ rmSync12(row.path, { force: true });
43442
43505
  }
43443
43506
  function installPeerFileHooks() {
43444
43507
  const previous = fileHooks();
@@ -43476,7 +43539,7 @@ function installPeerFileHooks() {
43476
43539
  var PEER_FILES_DIR;
43477
43540
  var init_peer_files = __esm(async () => {
43478
43541
  await init_src();
43479
- PEER_FILES_DIR = join45(DATA_DIR, "otium-peer-files");
43542
+ PEER_FILES_DIR = join46(DATA_DIR, "otium-peer-files");
43480
43543
  db.exec(`
43481
43544
  CREATE TABLE IF NOT EXISTS otium_peer_files (
43482
43545
  id TEXT PRIMARY KEY,
@@ -43888,19 +43951,19 @@ function readCache() {
43888
43951
  return {};
43889
43952
  }
43890
43953
  }
43891
- function cachedSurfaceScope(join46) {
43892
- const record = readCache()[join46.cellId];
43893
- if (!record || record.central !== join46.central || !record.workspaceId)
43954
+ function cachedSurfaceScope(join47) {
43955
+ const record = readCache()[join47.cellId];
43956
+ if (!record || record.central !== join47.central || !record.workspaceId)
43894
43957
  return null;
43895
43958
  return surfaceScopeFor(record.central, record.workspaceId);
43896
43959
  }
43897
- function cacheSurfaceScope(join46, workspaceId) {
43898
- const scope = surfaceScopeFor(join46.central, workspaceId);
43960
+ function cacheSurfaceScope(join47, workspaceId) {
43961
+ const scope = surfaceScopeFor(join47.central, workspaceId);
43899
43962
  const path = scopeCachePath();
43900
43963
  try {
43901
43964
  mkdirSync35(dirname24(path), { recursive: true });
43902
43965
  const cache = readCache();
43903
- cache[join46.cellId] = { central: join46.central, workspaceId, scope };
43966
+ cache[join47.cellId] = { central: join47.central, workspaceId, scope };
43904
43967
  writeFileSync26(path, `${JSON.stringify(cache, null, 2)}
43905
43968
  `, { mode: 384 });
43906
43969
  } catch (err2) {
@@ -43908,23 +43971,23 @@ function cacheSurfaceScope(join46, workspaceId) {
43908
43971
  }
43909
43972
  return scope;
43910
43973
  }
43911
- async function resolveSurfaceScope(join46) {
43912
- const cached = cachedSurfaceScope(join46);
43974
+ async function resolveSurfaceScope(join47) {
43975
+ const cached = cachedSurfaceScope(join47);
43913
43976
  if (cached)
43914
43977
  return cached;
43915
43978
  try {
43916
- const workspaceId = await peerWorkspaceIdForCell(join46.cellId);
43979
+ const workspaceId = await peerWorkspaceIdForCell(join47.cellId);
43917
43980
  if (!workspaceId)
43918
43981
  return null;
43919
- return cacheSurfaceScope(join46, workspaceId);
43982
+ return cacheSurfaceScope(join47, workspaceId);
43920
43983
  } catch (err2) {
43921
43984
  logger.warn({ err: err2 }, "otium: workspace scope unresolved (will retry on the next contact)");
43922
43985
  return null;
43923
43986
  }
43924
43987
  }
43925
43988
  function surfaceScopeForCell(cellId) {
43926
- const join46 = attachedOtiumCells().find((candidate) => candidate.cellId === cellId);
43927
- return join46 ? cachedSurfaceScope(join46) : null;
43989
+ const join47 = attachedOtiumCells().find((candidate) => candidate.cellId === cellId);
43990
+ return join47 ? cachedSurfaceScope(join47) : null;
43928
43991
  }
43929
43992
  function unscopedRoomsAddressable() {
43930
43993
  return attachedOtiumCells().length < 2;
@@ -45057,13 +45120,13 @@ function replacePendingEnrollment(pending2) {
45057
45120
  throw error2;
45058
45121
  }
45059
45122
  }
45060
- function recordClaimedCredential(pending2, join46) {
45123
+ function recordClaimedCredential(pending2, join47) {
45061
45124
  withJoinCredentialLock(() => {
45062
45125
  const current3 = JSON.parse(readFileSync31(pendingEnrollmentPath(), "utf8"));
45063
45126
  if (current3.central !== pending2.central || current3.token !== pending2.token || current3.idempotencyKey !== pending2.idempotencyKey || current3.publicKey !== pending2.publicKey) {
45064
45127
  throw new Error("pending Otium enrollment changed while its claim was in flight");
45065
45128
  }
45066
- const claimed = { digest: joinCredentialDigest(join46), cellId: join46.cellId };
45129
+ const claimed = { digest: joinCredentialDigest(join47), cellId: join47.cellId };
45067
45130
  if (current3.claimed && (current3.claimed.digest !== claimed.digest || current3.claimed.cellId !== claimed.cellId)) {
45068
45131
  throw new Error("central returned different credentials for an idempotent enrollment claim");
45069
45132
  }
@@ -45121,30 +45184,30 @@ async function claimEnrollment(invite, nodeName) {
45121
45184
  const secret = openCredential(credential, pending2.privateKey);
45122
45185
  if (!secret.startsWith("rcs_"))
45123
45186
  throw new Error("central returned an invalid runtime credential");
45124
- const join46 = {
45187
+ const join47 = {
45125
45188
  v: 2,
45126
45189
  central: invite.central,
45127
45190
  relay: String(response.relayUrl),
45128
45191
  cellId: String(response.cell?.id),
45129
45192
  secret
45130
45193
  };
45131
- if (!join46.relay || !join46.cellId || join46.cellId === "undefined") {
45194
+ if (!join47.relay || !join47.cellId || join47.cellId === "undefined") {
45132
45195
  throw new Error("central returned an incomplete enrollment response");
45133
45196
  }
45134
- assertSecureRelayUrl(join46.relay);
45135
- recordClaimedCredential(pending2, join46);
45136
- return join46;
45197
+ assertSecureRelayUrl(join47.relay);
45198
+ recordClaimedCredential(pending2, join47);
45199
+ return join47;
45137
45200
  }
45138
- function commitEnrollment(join46, options = {}) {
45201
+ function commitEnrollment(join47, options = {}) {
45139
45202
  return withJoinCredentialLock(() => {
45140
45203
  const pendingPath = pendingEnrollmentPath();
45141
45204
  const pending2 = existsSync40(pendingPath) ? JSON.parse(readFileSync31(pendingPath, "utf8")) : null;
45142
- const digest = joinCredentialDigest(join46);
45143
- if (pending2 && (!pending2.claimed || pending2.claimed.digest !== digest || pending2.claimed.cellId !== join46.cellId)) {
45205
+ const digest = joinCredentialDigest(join47);
45206
+ if (pending2 && (!pending2.claimed || pending2.claimed.digest !== digest || pending2.claimed.cellId !== join47.cellId)) {
45144
45207
  throw new Error(`pending Otium enrollment at ${pendingPath} does not match these credentials`);
45145
45208
  }
45146
- const path = saveJoinWhileLocked(join46, options);
45147
- if (!isJoinPersisted(join46)) {
45209
+ const path = saveJoinWhileLocked(join47, options);
45210
+ if (!isJoinPersisted(join47)) {
45148
45211
  throw new Error("Otium join credentials were not durably persisted");
45149
45212
  }
45150
45213
  if (!pending2)
@@ -45738,24 +45801,24 @@ function refreshDefaultSurfaceScope() {
45738
45801
  setSurfaceScopeRequired(scopes.length > 1);
45739
45802
  }
45740
45803
  function startOtiumNodeRuntime(options) {
45741
- const { join: join46 } = options;
45742
- attachOtiumCentralCell(join46);
45804
+ const { join: join47 } = options;
45805
+ attachOtiumCentralCell(join47);
45743
45806
  const releaseGlobals = acquireGlobalOtiumServices();
45744
45807
  let stopped = false;
45745
- logger.info({ central: join46.central, cellId: join46.cellId }, "otium: worker mode enabled");
45746
- mountedScopes.set(join46.cellId, cachedSurfaceScope(join46));
45808
+ logger.info({ central: join47.central, cellId: join47.cellId }, "otium: worker mode enabled");
45809
+ mountedScopes.set(join47.cellId, cachedSurfaceScope(join47));
45747
45810
  refreshDefaultSurfaceScope();
45748
- selfPeerNodeForCell(join46.cellId).then((self) => {
45811
+ selfPeerNodeForCell(join47.cellId).then((self) => {
45749
45812
  if (self) {
45750
45813
  logger.info({ nodeName: self.nodeName, baseUrl: self.baseUrl }, "otium: attached to workspace");
45751
45814
  }
45752
45815
  }).catch((err2) => {
45753
45816
  logger.warn({ err: err2 }, "otium: self check against central failed (will retry per request)");
45754
45817
  });
45755
- resolveSurfaceScope(join46).then((scope) => {
45818
+ resolveSurfaceScope(join47).then((scope) => {
45756
45819
  if (!scope || stopped)
45757
45820
  return;
45758
- mountedScopes.set(join46.cellId, scope);
45821
+ mountedScopes.set(join47.cellId, scope);
45759
45822
  refreshDefaultSurfaceScope();
45760
45823
  if (mountedScopes.size === 1)
45761
45824
  stampUnscopedOtiumTopics(scope);
@@ -45764,14 +45827,14 @@ function startOtiumNodeRuntime(options) {
45764
45827
  });
45765
45828
  return {
45766
45829
  name: "otium",
45767
- join: join46,
45830
+ join: join47,
45768
45831
  stop: () => {
45769
45832
  if (stopped)
45770
45833
  return;
45771
45834
  stopped = true;
45772
- mountedScopes.delete(join46.cellId);
45835
+ mountedScopes.delete(join47.cellId);
45773
45836
  refreshDefaultSurfaceScope();
45774
- detachOtiumCentralCell(join46.cellId);
45837
+ detachOtiumCentralCell(join47.cellId);
45775
45838
  releaseGlobals();
45776
45839
  }
45777
45840
  };
@@ -45866,14 +45929,14 @@ __export(exports_node_runtime, {
45866
45929
  function sameCredentials(left, right) {
45867
45930
  return left.central === right.central && left.relay === right.relay && left.secret === right.secret;
45868
45931
  }
45869
- function attachOtiumWorkspace(join46) {
45870
- const current3 = mounted.get(join46.cellId);
45932
+ function attachOtiumWorkspace(join47) {
45933
+ const current3 = mounted.get(join47.cellId);
45871
45934
  if (current3) {
45872
- if (sameCredentials(current3.join, join46))
45935
+ if (sameCredentials(current3.join, join47))
45873
45936
  return false;
45874
- detachOtiumWorkspace(join46.cellId);
45937
+ detachOtiumWorkspace(join47.cellId);
45875
45938
  }
45876
- mounted.set(join46.cellId, startOtiumNodeRuntime({ join: join46 }));
45939
+ mounted.set(join47.cellId, startOtiumNodeRuntime({ join: join47 }));
45877
45940
  return true;
45878
45941
  }
45879
45942
  function detachOtiumWorkspace(cellId) {
@@ -45888,7 +45951,7 @@ function mountedOtiumWorkspaces() {
45888
45951
  return [...mounted.values()].map((runtime2) => runtime2.join);
45889
45952
  }
45890
45953
  function reconcileOtiumWorkspaces(joins = loadJoins()) {
45891
- const wanted = new Map(joins.map((join46) => [join46.cellId, join46]));
45954
+ const wanted = new Map(joins.map((join47) => [join47.cellId, join47]));
45892
45955
  const detached = [];
45893
45956
  for (const cellId of [...mounted.keys()]) {
45894
45957
  if (wanted.has(cellId))
@@ -45897,8 +45960,8 @@ function reconcileOtiumWorkspaces(joins = loadJoins()) {
45897
45960
  detached.push(cellId);
45898
45961
  }
45899
45962
  const attached = [];
45900
- for (const [cellId, join46] of wanted) {
45901
- if (attachOtiumWorkspace(join46))
45963
+ for (const [cellId, join47] of wanted) {
45964
+ if (attachOtiumWorkspace(join47))
45902
45965
  attached.push(cellId);
45903
45966
  }
45904
45967
  if (attached.length > 0 || detached.length > 0) {
@@ -45921,9 +45984,9 @@ async function handleOtiumAdapterControlRequest(req) {
45921
45984
  if (req.method === "GET") {
45922
45985
  return Response.json({
45923
45986
  ok: true,
45924
- workspaces: mountedOtiumWorkspaces().map((join46) => ({
45925
- cellId: join46.cellId,
45926
- central: join46.central
45987
+ workspaces: mountedOtiumWorkspaces().map((join47) => ({
45988
+ cellId: join47.cellId,
45989
+ central: join47.central
45927
45990
  }))
45928
45991
  });
45929
45992
  }
@@ -45944,8 +46007,8 @@ function mountConfiguredOtiumNodeRuntime() {
45944
46007
  const joins = loadJoins();
45945
46008
  if (joins.length === 0)
45946
46009
  return null;
45947
- for (const join46 of joins)
45948
- attachOtiumWorkspace(join46);
46010
+ for (const join47 of joins)
46011
+ attachOtiumWorkspace(join47);
45949
46012
  registerNodeRequestHandler("otium-adapter-control", handleOtiumAdapterControlRequest);
45950
46013
  let stopped = false;
45951
46014
  return {
@@ -46057,11 +46120,11 @@ async function joinCommand(args) {
46057
46120
  process.exitCode = 1;
46058
46121
  return;
46059
46122
  }
46060
- let join46;
46123
+ let join47;
46061
46124
  let productionEnrollment = false;
46062
46125
  if (args.includes("--legacy")) {
46063
46126
  try {
46064
- join46 = parseInviteCode(code);
46127
+ join47 = parseInviteCode(code);
46065
46128
  } catch (err2) {
46066
46129
  console.error(`invalid legacy invite code: ${err2 instanceof Error ? err2.message : err2}`);
46067
46130
  process.exitCode = 1;
@@ -46087,7 +46150,7 @@ async function joinCommand(args) {
46087
46150
  return;
46088
46151
  }
46089
46152
  }
46090
- join46 = await claimEnrollment(invite, nodeName);
46153
+ join47 = await claimEnrollment(invite, nodeName);
46091
46154
  productionEnrollment = true;
46092
46155
  } catch (err2) {
46093
46156
  console.error(`enrollment failed: ${err2 instanceof Error ? err2.message : err2}`);
@@ -46098,16 +46161,16 @@ async function joinCommand(args) {
46098
46161
  let path;
46099
46162
  try {
46100
46163
  const saveOptions = { replaceExisting: args.includes("--replace") };
46101
- path = productionEnrollment ? commitEnrollment(join46, saveOptions) : saveJoin(join46, saveOptions);
46164
+ path = productionEnrollment ? commitEnrollment(join47, saveOptions) : saveJoin(join47, saveOptions);
46102
46165
  } catch (err2) {
46103
46166
  console.error(`could not save join credentials: ${err2 instanceof Error ? err2.message : err2}`);
46104
46167
  process.exitCode = 1;
46105
46168
  return;
46106
46169
  }
46107
46170
  console.log(`otium join credentials saved to ${path}`);
46108
- console.log(` central: ${join46.central}`);
46109
- console.log(` cellId: ${join46.cellId}`);
46110
- configureOtiumCentral(join46);
46171
+ console.log(` central: ${join47.central}`);
46172
+ console.log(` cellId: ${join47.cellId}`);
46173
+ configureOtiumCentral(join47);
46111
46174
  try {
46112
46175
  const self = await selfPeerNode();
46113
46176
  if (self) {
@@ -46149,19 +46212,19 @@ async function statusCommand() {
46149
46212
  return;
46150
46213
  }
46151
46214
  configureOtiumCentral(joins[0] ?? null);
46152
- for (const join46 of joins.slice(1))
46153
- attachOtiumCentralCell(join46);
46154
- for (const [index, join46] of joins.entries()) {
46215
+ for (const join47 of joins.slice(1))
46216
+ attachOtiumCentralCell(join47);
46217
+ for (const [index, join47] of joins.entries()) {
46155
46218
  if (index > 0)
46156
46219
  console.log("");
46157
- console.log(`cellId: ${join46.cellId}`);
46158
- console.log(`central: ${join46.central}`);
46159
- if (join46.relay)
46160
- console.log(`relay: ${join46.relay}`);
46220
+ console.log(`cellId: ${join47.cellId}`);
46221
+ console.log(`central: ${join47.central}`);
46222
+ if (join47.relay)
46223
+ console.log(`relay: ${join47.relay}`);
46161
46224
  try {
46162
- const self = await selfPeerNodeForCell(join46.cellId);
46225
+ const self = await selfPeerNodeForCell(join47.cellId);
46163
46226
  if (self) {
46164
- console.log(`node: ${self.nodeName ?? join46.cellId}${self.isPrimary ? " (primary)" : ""}`);
46227
+ console.log(`node: ${self.nodeName ?? join47.cellId}${self.isPrimary ? " (primary)" : ""}`);
46165
46228
  console.log(`baseUrl: ${self.baseUrl}`);
46166
46229
  } else {
46167
46230
  console.warn(" warning: central answered but this cell has no visible assignment yet \u2014 check the workspace assignment");
@@ -46197,13 +46260,13 @@ function resolveTunnelTargets(joins, relayOverride) {
46197
46260
  const targets = [];
46198
46261
  const skippedNoRelay = [];
46199
46262
  const envRelay = process.env.OTIUM_RELAY_URL?.trim();
46200
- for (const join46 of joins) {
46201
- const relayUrl = relayOverride?.trim() || join46.relay || envRelay;
46263
+ for (const join47 of joins) {
46264
+ const relayUrl = relayOverride?.trim() || join47.relay || envRelay;
46202
46265
  if (!relayUrl) {
46203
- skippedNoRelay.push(join46.cellId);
46266
+ skippedNoRelay.push(join47.cellId);
46204
46267
  continue;
46205
46268
  }
46206
- targets.push({ cellId: join46.cellId, relayUrl, secret: join46.secret });
46269
+ targets.push({ cellId: join47.cellId, relayUrl, secret: join47.secret });
46207
46270
  }
46208
46271
  return { targets, skippedNoRelay };
46209
46272
  }
@@ -46440,9 +46503,9 @@ async function runOtiumCli(args = process.argv.slice(2)) {
46440
46503
  if (joins.length === 0)
46441
46504
  throw new Error("not joined to an Otium workspace");
46442
46505
  if (!targetCellId && joins.length > 1) {
46443
- throw new Error(`this node is joined to ${joins.length} workspaces; name one to leave: ${joins.map((join46) => join46.cellId).join(", ")}`);
46506
+ throw new Error(`this node is joined to ${joins.length} workspaces; name one to leave: ${joins.map((join47) => join47.cellId).join(", ")}`);
46444
46507
  }
46445
- if (targetCellId && !joins.some((join46) => join46.cellId === targetCellId)) {
46508
+ if (targetCellId && !joins.some((join47) => join47.cellId === targetCellId)) {
46446
46509
  throw new Error(`not joined as ${targetCellId}`);
46447
46510
  }
46448
46511
  removeJoin2(targetCellId);
@@ -47229,4 +47292,4 @@ switch (command) {
47229
47292
  }
47230
47293
  }
47231
47294
 
47232
- //# debugId=805E32726887103964756E2164756E21
47295
+ //# debugId=FB1DC2846CA4438764756E2164756E21