negotium 0.2.20 → 0.2.21

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
@@ -1,21 +1,31 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
+ var __create = Object.create;
4
+ var __getProtoOf = Object.getPrototypeOf;
3
5
  var __defProp = Object.defineProperty;
4
- var __returnValue = (v) => v;
5
- function __exportSetter(name, newValue) {
6
- this[name] = __returnValue.bind(null, newValue);
7
- }
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __toESM = (mod, isNodeMode, target) => {
9
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
10
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
+ for (let key of __getOwnPropNames(mod))
12
+ if (!__hasOwnProp.call(to, key))
13
+ __defProp(to, key, {
14
+ get: () => mod[key],
15
+ enumerable: true
16
+ });
17
+ return to;
18
+ };
8
19
  var __export = (target, all) => {
9
20
  for (var name in all)
10
21
  __defProp(target, name, {
11
22
  get: all[name],
12
23
  enumerable: true,
13
24
  configurable: true,
14
- set: __exportSetter.bind(all, name)
25
+ set: (newValue) => all[name] = () => newValue
15
26
  });
16
27
  };
17
28
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
18
- var __promiseAll = (args) => Promise.all(args);
19
29
  var __require = import.meta.require;
20
30
 
21
31
  // ../../packages/core/src/platform/maestro-bootstrap-env.ts
@@ -906,11 +916,9 @@ function redactVaultSecrets(userId, text) {
906
916
  var vaultDb, vaultMasterKey, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
907
917
  var init_vault = __esm(async () => {
908
918
  init_config();
919
+ await init_sqlite();
920
+ await init_storage_host();
909
921
  init_vault_crypto();
910
- await __promiseAll([
911
- init_sqlite(),
912
- init_storage_host()
913
- ]);
914
922
  vaultMasterKey = VAULT_MASTER_KEY;
915
923
  VAULT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/;
916
924
  VAULT_VALUE_MAX_BYTES = 64 * 1024;
@@ -1859,7 +1867,7 @@ var exports_version = {};
1859
1867
  __export(exports_version, {
1860
1868
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
1861
1869
  });
1862
- var NEGOTIUM_VERSION = "0.2.20";
1870
+ var NEGOTIUM_VERSION = "0.2.21";
1863
1871
 
1864
1872
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
1865
1873
  import { spawn } from "child_process";
@@ -3813,10 +3821,10 @@ function formatDateBucket(d) {
3813
3821
  }
3814
3822
  var _shellCache = null, MAX_DAY_SPAN = 30, DAY_MS = 86400000, LOCAL_DATE_SKEW_DAYS = 1;
3815
3823
  var init_codex = __esm(async () => {
3824
+ await init_execution_host();
3816
3825
  init_shared();
3817
3826
  init_jsonl();
3818
3827
  init_logger();
3819
- await init_execution_host();
3820
3828
  });
3821
3829
 
3822
3830
  // ../../packages/core/src/agents/codex-app-server.ts
@@ -3920,10 +3928,8 @@ async function forkCodexSession(parentThreadId) {
3920
3928
  var forkCodexThread;
3921
3929
  var init_codex_app_server = __esm(async () => {
3922
3930
  init_codex_native_multi_agent();
3923
- await __promiseAll([
3924
- init_execution_host(),
3925
- init_codex()
3926
- ]);
3931
+ await init_execution_host();
3932
+ await init_codex();
3927
3933
  forkCodexThread = createCodexAppServerForker({
3928
3934
  spawnServer() {
3929
3935
  return spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
@@ -3941,13 +3947,11 @@ import { existsSync as existsSync7, unlinkSync as unlinkSync6 } from "fs";
3941
3947
  import { join as join9 } from "path";
3942
3948
  var VALID_EFFORTS2, codexRegistry, codexRegistryOperations;
3943
3949
  var init_codex_registry = __esm(async () => {
3950
+ await init_codex_app_server();
3951
+ await init_execution_host();
3952
+ await init_codex();
3944
3953
  init_logger();
3945
3954
  init_types();
3946
- await __promiseAll([
3947
- init_codex_app_server(),
3948
- init_execution_host(),
3949
- init_codex()
3950
- ]);
3951
3955
  VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
3952
3956
  codexRegistry = {
3953
3957
  kind: "codex",
@@ -4170,8 +4174,8 @@ function getRegistryOperations(agent) {
4170
4174
  var REGISTRIES, OPERATIONS;
4171
4175
  var init_registry = __esm(async () => {
4172
4176
  init_claude_registry();
4173
- init_maestro_registry();
4174
4177
  await init_codex_registry();
4178
+ init_maestro_registry();
4175
4179
  REGISTRIES = {
4176
4180
  claude: claudeRegistry,
4177
4181
  codex: codexRegistry,
@@ -4224,8 +4228,8 @@ function cleanupAgentFork(handle) {
4224
4228
  }
4225
4229
  var defaultForkHelpers;
4226
4230
  var init_fork = __esm(async () => {
4227
- init_logger();
4228
4231
  await init_registry();
4232
+ init_logger();
4229
4233
  defaultForkHelpers = createAgentForkHelpers({
4230
4234
  forkSession: (agent, options) => getRegistryOperations(agent).forkSession(options),
4231
4235
  exists: existsSync9,
@@ -5193,10 +5197,10 @@ async function* claudeProvider(opts) {
5193
5197
  var CLAUDE_DEFAULT_DISALLOWED_TOOLS, CLAUDE_NATIVE_AGENT_TOOLS, CLAUDE_IMAGE_MAX_BYTES, CLAUDE_IMAGE_MIME_TYPES, CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500;
5194
5198
  var init_claude_provider = __esm(async () => {
5195
5199
  init_claude_registry();
5200
+ await init_execution_host();
5196
5201
  init_vault_tool_policy();
5197
5202
  init_file_events();
5198
5203
  init_logger();
5199
- await init_execution_host();
5200
5204
  CLAUDE_DEFAULT_DISALLOWED_TOOLS = [
5201
5205
  "AskUserQuestion",
5202
5206
  "Workflow",
@@ -6410,14 +6414,12 @@ var CODEX_MCP_SERVER_NAME_OVERRIDES, CODEX_DIFF_FILE_LIMIT, CODEX_DIFF_BASELINE_
6410
6414
  var init_codex_provider = __esm(async () => {
6411
6415
  init_codex_native_multi_agent();
6412
6416
  init_codex_tree_kill();
6417
+ await init_execution_host();
6418
+ await init_codex();
6413
6419
  init_tool_format();
6414
6420
  init_file_events();
6415
6421
  init_logger();
6416
6422
  init_mcp_config();
6417
- await __promiseAll([
6418
- init_execution_host(),
6419
- init_codex()
6420
- ]);
6421
6423
  CODEX_MCP_SERVER_NAME_OVERRIDES = {
6422
6424
  playwright: "otium_playwright"
6423
6425
  };
@@ -6533,12 +6535,10 @@ function maestroProvider(opts) {
6533
6535
  var MAESTRO_DEFAULT_MAX_TOKENS = 32768, PROVIDER_ASK_USER_TOOL = "AskUserQuestion", PROVIDER_SUBAGENT_TOOL = "Agent", MAESTRO_NATIVE_TASK_TOOLS, MAESTRO_PROVIDER_OWNED_TOOL_SET, DEFAULT_MAESTRO_DISALLOWED_TOOLS, MAESTRO_ALL_BUILTIN_TOOLS, MAESTRO_TOOL_OUTPUT_DIR;
6534
6536
  var init_maestro_provider = __esm(async () => {
6535
6537
  init_maestro_bootstrap_env();
6538
+ await init_execution_host();
6536
6539
  init_vault_tool_policy();
6537
6540
  init_config();
6538
- await __promiseAll([
6539
- init_execution_host(),
6540
- init_vault()
6541
- ]);
6541
+ await init_vault();
6542
6542
  MAESTRO_NATIVE_TASK_TOOLS = [
6543
6543
  "TaskCreate",
6544
6544
  "TaskUpdate",
@@ -6684,15 +6684,13 @@ async function* runAgent(opts) {
6684
6684
  }
6685
6685
  }
6686
6686
  var init_agents = __esm(async () => {
6687
+ await init_execution_host();
6688
+ await init_registry();
6687
6689
  init_claude();
6690
+ await init_task_events();
6688
6691
  init_logger();
6692
+ await init_conversations();
6689
6693
  init_types();
6690
- await __promiseAll([
6691
- init_execution_host(),
6692
- init_registry(),
6693
- init_task_events(),
6694
- init_conversations()
6695
- ]);
6696
6694
  });
6697
6695
 
6698
6696
  // ../../packages/core/src/mcp/mcp-helpers.ts
@@ -6774,10 +6772,8 @@ function listRecentRuntimeEventsForTopic(topicId, limit = 300) {
6774
6772
  }
6775
6773
  var RUNTIME_EVENT_TYPES, types;
6776
6774
  var init_runtime_events = __esm(async () => {
6777
- await __promiseAll([
6778
- init_forum_db(),
6779
- init_storage_host()
6780
- ]);
6775
+ await init_forum_db();
6776
+ await init_storage_host();
6781
6777
  RUNTIME_EVENT_TYPES = [
6782
6778
  "message",
6783
6779
  "message-updated",
@@ -7366,10 +7362,8 @@ function getMessagesForTopicAfterRowid(topicId, afterRowid) {
7366
7362
  }
7367
7363
  var appendHooks;
7368
7364
  var init_api_messages = __esm(async () => {
7369
- await __promiseAll([
7370
- init_forum_db(),
7371
- init_storage_host()
7372
- ]);
7365
+ await init_forum_db();
7366
+ await init_storage_host();
7373
7367
  registerStorageSchemaInitializer(initializeApiMessagesSchema, 30);
7374
7368
  appendHooks = new Set;
7375
7369
  });
@@ -7492,10 +7486,8 @@ function deleteApiTopicConfig(topicId) {
7492
7486
  db.query("DELETE FROM api_topic_config WHERE topic_id = ?").run(topicId);
7493
7487
  }
7494
7488
  var init_api_topic_config = __esm(async () => {
7495
- await __promiseAll([
7496
- init_forum_db(),
7497
- init_storage_host()
7498
- ]);
7489
+ await init_forum_db();
7490
+ await init_storage_host();
7499
7491
  registerStorageSchemaInitializer(initializeApiTopicConfigSchema, 40);
7500
7492
  });
7501
7493
 
@@ -8166,10 +8158,8 @@ var DEFAULT_AGENT_ROOM_AGENT = "maestro";
8166
8158
  var init_api_topics = __esm(async () => {
8167
8159
  init_constants();
8168
8160
  init_logger();
8169
- await __promiseAll([
8170
- init_forum_db(),
8171
- init_storage_host()
8172
- ]);
8161
+ await init_forum_db();
8162
+ await init_storage_host();
8173
8163
  registerStorageSchemaInitializer(initializeApiTopicsSchema, 20);
8174
8164
  });
8175
8165
 
@@ -8370,10 +8360,8 @@ function cancelAskUserGate(topicId, messageId, ownerId, now = new Date().toISOSt
8370
8360
  }).immediate();
8371
8361
  }
8372
8362
  var init_ask_user_gates = __esm(async () => {
8373
- await __promiseAll([
8374
- init_forum_db(),
8375
- init_storage_host()
8376
- ]);
8363
+ await init_forum_db();
8364
+ await init_storage_host();
8377
8365
  registerStorageSchemaInitializer(initializeAskUserGateSchema, 31);
8378
8366
  });
8379
8367
 
@@ -8460,10 +8448,8 @@ function beginRuntimeTopicMaintenance(topicId, options = {}) {
8460
8448
  }
8461
8449
  var TOPIC_MAINTENANCE_STALE_MS = 30000, TOPIC_MAINTENANCE_HEARTBEAT_MS = 1000;
8462
8450
  var init_runtime_topic_state = __esm(async () => {
8463
- await __promiseAll([
8464
- init_forum_db(),
8465
- init_storage_host()
8466
- ]);
8451
+ await init_forum_db();
8452
+ await init_storage_host();
8467
8453
  registerStorageSchemaInitializer((database) => {
8468
8454
  database.exec(`
8469
8455
  CREATE TABLE IF NOT EXISTS runtime_topic_state (
@@ -8560,11 +8546,9 @@ function releaseRuntimeTurnLease(topicId, queryId, ownerId = RUNTIME_INSTANCE_ID
8560
8546
  }
8561
8547
  var RUNTIME_INSTANCE_ID, TURN_LEASE_STALE_MS = 1e4;
8562
8548
  var init_runtime_leases = __esm(async () => {
8563
- await __promiseAll([
8564
- init_forum_db(),
8565
- init_runtime_topic_state(),
8566
- init_storage_host()
8567
- ]);
8549
+ await init_forum_db();
8550
+ await init_runtime_topic_state();
8551
+ await init_storage_host();
8568
8552
  RUNTIME_INSTANCE_ID = `${process.pid}-${randomUUID6()}`;
8569
8553
  registerStorageSchemaInitializer((database) => {
8570
8554
  database.exec(`
@@ -8738,11 +8722,9 @@ async function waitForRequiredRuntimeProcessLease(role, options = {}) {
8738
8722
  }
8739
8723
  var PROCESS_LEASE_STALE_MS = 5000, PROCESS_LEASE_HEARTBEAT_MS = 1000;
8740
8724
  var init_runtime_process_leases = __esm(async () => {
8741
- await __promiseAll([
8742
- init_forum_db(),
8743
- init_runtime_leases(),
8744
- init_storage_host()
8745
- ]);
8725
+ await init_forum_db();
8726
+ await init_runtime_leases();
8727
+ await init_storage_host();
8746
8728
  registerStorageSchemaInitializer((database) => {
8747
8729
  database.exec(`
8748
8730
  CREATE TABLE IF NOT EXISTS runtime_process_leases (
@@ -9075,14 +9057,12 @@ function createAskUserToolDefinition(ctx) {
9075
9057
  var MAX_QUESTION_CHARS = 2000, MAX_CHOICE_LABEL_CHARS = 128, MAX_CHOICE_DESCRIPTION_CHARS = 500, MAX_CHOICES = 12, MAX_IDEMPOTENCY_KEY_CHARS = 200, ASK_GATE_OWNER_ID, ASK_GATE_LEASE_ROLE_PREFIX = "ask-user-gate:", defaultAskUserDurabilityHost, defaultAskUserRuntime;
9076
9058
  var init_ask_user = __esm(async () => {
9077
9059
  init_common();
9078
- await __promiseAll([
9079
- init_bus(),
9080
- init_api_messages(),
9081
- init_api_topic_config(),
9082
- init_api_topics(),
9083
- init_ask_user_gates(),
9084
- init_runtime_process_leases()
9085
- ]);
9060
+ await init_bus();
9061
+ await init_api_messages();
9062
+ await init_api_topic_config();
9063
+ await init_api_topics();
9064
+ await init_ask_user_gates();
9065
+ await init_runtime_process_leases();
9086
9066
  ASK_GATE_OWNER_ID = `ask-user-${process.pid}-${randomUUID7()}`;
9087
9067
  defaultAskUserDurabilityHost = {
9088
9068
  gates: {
@@ -9429,15 +9409,13 @@ function switchApiTopicAgent(opts) {
9429
9409
  };
9430
9410
  }
9431
9411
  var init_api_topic_agent_switch = __esm(async () => {
9412
+ await init_auth_check();
9432
9413
  init_model_catalog();
9414
+ await init_registry();
9433
9415
  init_logger();
9434
- await __promiseAll([
9435
- init_auth_check(),
9436
- init_registry(),
9437
- init_api_topic_config(),
9438
- init_api_topics(),
9439
- init_conversations()
9440
- ]);
9416
+ await init_api_topic_config();
9417
+ await init_api_topics();
9418
+ await init_conversations();
9441
9419
  });
9442
9420
 
9443
9421
  // ../../packages/core/src/storage/self-schedules.ts
@@ -9568,12 +9546,10 @@ function deleteSelfSchedulesForTopic(topicId) {
9568
9546
  return Number(result.changes ?? 0);
9569
9547
  }
9570
9548
  var init_self_schedules = __esm(async () => {
9571
- await __promiseAll([
9572
- init_forum_db(),
9573
- init_runtime_leases(),
9574
- init_runtime_topic_state(),
9575
- init_storage_host()
9576
- ]);
9549
+ await init_forum_db();
9550
+ await init_runtime_leases();
9551
+ await init_runtime_topic_state();
9552
+ await init_storage_host();
9577
9553
  registerStorageSchemaInitializer((database) => {
9578
9554
  database.exec(`
9579
9555
  CREATE TABLE IF NOT EXISTS runtime_self_schedules (
@@ -9953,8 +9929,8 @@ __export(exports_vault_public, {
9953
9929
  VAULT_DESCRIPTION_MAX_LENGTH: () => VAULT_DESCRIPTION_MAX_LENGTH
9954
9930
  });
9955
9931
  var init_vault_public = __esm(async () => {
9956
- init_vault_crypto();
9957
9932
  await init_vault();
9933
+ init_vault_crypto();
9958
9934
  });
9959
9935
 
9960
9936
  // ../../packages/core/src/platform/playwright/vault-broker.ts
@@ -10289,10 +10265,8 @@ function deleteBrowserProfile(ownerId, rawName) {
10289
10265
  }
10290
10266
  var DEFAULT_BROWSER_PROFILE = "default";
10291
10267
  var init_browser_profiles = __esm(async () => {
10292
- await __promiseAll([
10293
- init_forum_db(),
10294
- init_storage_host()
10295
- ]);
10268
+ await init_forum_db();
10269
+ await init_storage_host();
10296
10270
  registerStorageSchemaInitializer((database) => {
10297
10271
  database.exec(`
10298
10272
  CREATE TABLE IF NOT EXISTS browser_profiles (
@@ -10982,17 +10956,15 @@ var defaultManagerHost, managerHost, MAX_IDLE_MS, instances, usedPorts, spawning
10982
10956
  var init_manager2 = __esm(async () => {
10983
10957
  init_config();
10984
10958
  init_logger();
10959
+ await init_browser_processes();
10985
10960
  init_headed_launch();
10986
10961
  init_transport_probe();
10962
+ await init_vault_broker();
10963
+ await init_browser_profiles();
10987
10964
  init_manager_utils();
10965
+ await init_browser_processes();
10988
10966
  init_transport_probe();
10989
10967
  init_manager_utils();
10990
- await __promiseAll([
10991
- init_browser_processes(),
10992
- init_vault_broker(),
10993
- init_browser_profiles(),
10994
- init_browser_processes()
10995
- ]);
10996
10968
  defaultManagerHost = Object.freeze({
10997
10969
  portsDir: PLAYWRIGHT_PORTS_DIR,
10998
10970
  basePort: PLAYWRIGHT_BASE_PORT,
@@ -11384,8 +11356,8 @@ function wsAbortReason(reason) {
11384
11356
  var roomQueryRegistry, interSessionQueue;
11385
11357
  var init_active_rooms = __esm(async () => {
11386
11358
  init_logger();
11387
- init_types2();
11388
11359
  await init_runtime_leases();
11360
+ init_types2();
11389
11361
  roomQueryRegistry = createRoomQueryRegistry({
11390
11362
  instanceId: RUNTIME_INSTANCE_ID,
11391
11363
  internalAbortReason: "internal" /* Internal */,
@@ -11439,13 +11411,11 @@ function isLegacySharedGeneral(topicId) {
11439
11411
  }
11440
11412
  var LEGACY_PERSONAL_GENERAL_DESCRIPTION = "\uB098\uB9CC\uC758 \uAC1C\uC778 \uACF5\uAC04\uC774\uC5D0\uC694. \uB300\uD654\uC640 AI \uC791\uC5C5\uC740 \uB2E4\uB978 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uACF5\uAC1C\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.", PERSONAL_GENERAL_DESCRIPTION = "Your private General. Messages and membership are visible only to you. Workspace memory, wiki, and skills are shared with your workspace.";
11441
11413
  var init_personal_general = __esm(async () => {
11414
+ await init_registry();
11442
11415
  init_config();
11443
11416
  init_constants();
11444
- await __promiseAll([
11445
- init_registry(),
11446
- init_api_topic_config(),
11447
- init_api_topics()
11448
- ]);
11417
+ await init_api_topic_config();
11418
+ await init_api_topics();
11449
11419
  });
11450
11420
 
11451
11421
  // ../../packages/core/src/prompts/builders.ts
@@ -11931,11 +11901,9 @@ function listTopicBriefs() {
11931
11901
  return rows.map(rowToBrief);
11932
11902
  }
11933
11903
  var init_api_topic_brief = __esm(async () => {
11904
+ await init_forum_db();
11905
+ await init_storage_host();
11934
11906
  init_wiki_summary_names();
11935
- await __promiseAll([
11936
- init_forum_db(),
11937
- init_storage_host()
11938
- ]);
11939
11907
  registerStorageSchemaInitializer((database) => {
11940
11908
  database.exec(`
11941
11909
  CREATE TABLE IF NOT EXISTS api_topic_brief (
@@ -12343,20 +12311,18 @@ function listActiveMemoryArchiverSessions(userId) {
12343
12311
  }
12344
12312
  var MAX_BRIEF_ENTRIES = 8, defaultArchiverRuntime;
12345
12313
  var init_archiver = __esm(async () => {
12314
+ await init_agents();
12346
12315
  init_tool_format();
12316
+ await init_bus();
12347
12317
  init_config();
12348
12318
  init_logger();
12349
12319
  init_builders();
12350
12320
  init_background_session_policy();
12321
+ await init_api_messages();
12322
+ await init_api_topic_brief();
12323
+ await init_wiki();
12351
12324
  init_wiki_summary_names();
12352
- await __promiseAll([
12353
- init_agents(),
12354
- init_bus(),
12355
- init_api_messages(),
12356
- init_api_topic_brief(),
12357
- init_wiki(),
12358
- init_personal_general()
12359
- ]);
12325
+ await init_personal_general();
12360
12326
  defaultArchiverRuntime = createArchiverRuntime({
12361
12327
  storage: {
12362
12328
  getWikiDir: getSharedWikiDir,
@@ -12598,11 +12564,9 @@ function archiveConversationEvents(topicId, topicTitle, userId, options = {}) {
12598
12564
  }
12599
12565
  var init_topic_archive = __esm(async () => {
12600
12566
  init_logger();
12601
- await __promiseAll([
12602
- init_api_messages(),
12603
- init_conversations(),
12604
- init_wiki()
12605
- ]);
12567
+ await init_api_messages();
12568
+ await init_conversations();
12569
+ await init_wiki();
12606
12570
  });
12607
12571
 
12608
12572
  // ../../packages/core/src/storage/topic-archive-state.ts
@@ -12723,10 +12687,8 @@ function deleteTopicArchiveState(topicId) {
12723
12687
  }
12724
12688
  var ARCHIVE_JOB_STALE_MS;
12725
12689
  var init_topic_archive_state = __esm(async () => {
12726
- await __promiseAll([
12727
- init_forum_db(),
12728
- init_storage_host()
12729
- ]);
12690
+ await init_forum_db();
12691
+ await init_storage_host();
12730
12692
  registerStorageSchemaInitializer((database) => {
12731
12693
  database.exec(`
12732
12694
  CREATE TABLE IF NOT EXISTS api_topic_archive_state (
@@ -12902,15 +12864,13 @@ function archiveActiveTopicForMemory(topicId, userId, options) {
12902
12864
  }
12903
12865
  var DEFAULT_IDLE_DELAY_MS, DEFAULT_MIN_MESSAGES = 8, timers;
12904
12866
  var init_idle_archiver = __esm(async () => {
12867
+ await init_archiver();
12905
12868
  init_logger();
12906
- await __promiseAll([
12907
- init_archiver(),
12908
- init_active_rooms(),
12909
- init_api_messages(),
12910
- init_api_topics(),
12911
- init_topic_archive(),
12912
- init_topic_archive_state()
12913
- ]);
12869
+ await init_active_rooms();
12870
+ await init_api_messages();
12871
+ await init_api_topics();
12872
+ await init_topic_archive();
12873
+ await init_topic_archive_state();
12914
12874
  DEFAULT_IDLE_DELAY_MS = 6 * 60 * 60 * 1000;
12915
12875
  timers = new Map;
12916
12876
  });
@@ -13034,12 +12994,10 @@ function createTopicLogMaintenance(host) {
13034
12994
  }
13035
12995
  var defaultTopicLogMaintenance, cleanupTopicRollouts, cleanupTopicRolloutsFromEntries, rotateTopicLogs, purgeTopicLogs;
13036
12996
  var init_topic_cleanup = __esm(async () => {
12997
+ await init_agents();
12998
+ await init_registry();
13037
12999
  init_logger();
13038
- await __promiseAll([
13039
- init_agents(),
13040
- init_registry(),
13041
- init_conversations()
13042
- ]);
13000
+ await init_conversations();
13043
13001
  defaultTopicLogMaintenance = createTopicLogMaintenance({
13044
13002
  agents: SUPPORTED_AGENTS,
13045
13003
  readActiveConversation: readConversation,
@@ -13285,14 +13243,12 @@ function listBackgroundSessionsForUser(userId) {
13285
13243
  }
13286
13244
  var providers, transientSessions;
13287
13245
  var init_background_sessions = __esm(async () => {
13246
+ await init_archiver();
13288
13247
  init_tool_format();
13248
+ await init_api_topics();
13249
+ await init_runtime_events();
13250
+ await init_runtime_leases();
13289
13251
  init_background_session_policy();
13290
- await __promiseAll([
13291
- init_archiver(),
13292
- init_api_topics(),
13293
- init_runtime_events(),
13294
- init_runtime_leases()
13295
- ]);
13296
13252
  providers = new Set;
13297
13253
  transientSessions = new Map;
13298
13254
  });
@@ -13588,12 +13544,10 @@ function getRuntimeUserTurnRequest(topicId) {
13588
13544
  }
13589
13545
  var REQUEST_CLAIM_STALE_MS;
13590
13546
  var init_runtime_turn_requests = __esm(async () => {
13591
- await __promiseAll([
13592
- init_forum_db(),
13593
- init_runtime_leases(),
13594
- init_runtime_topic_state(),
13595
- init_storage_host()
13596
- ]);
13547
+ await init_forum_db();
13548
+ await init_runtime_leases();
13549
+ await init_runtime_topic_state();
13550
+ await init_storage_host();
13597
13551
  REQUEST_CLAIM_STALE_MS = TURN_LEASE_STALE_MS;
13598
13552
  registerStorageSchemaInitializer((database) => ensureRuntimeUserTurnRequestsSchema(database));
13599
13553
  });
@@ -14241,31 +14195,29 @@ async function compactTopicSession(topicId, userId, reason = "topic-session-comp
14241
14195
  }
14242
14196
  var RESET_TURN_WAIT_MS = 5000, RESET_MEMORY_ARCHIVE_WAIT_MS, COMPACTION_INLINE_CHARS = 1e5, COMPACTION_SOURCE_CHARS, COMPACTION_MEMORY_CHARS = 80000, COMPACTION_OUTPUT_CHARS = 30000, COMPACTION_TIMEOUT_MS, COMPACTION_LOG_TIMEOUT_MS, COMPACTION_LOG_MAX_CALLS = 12, COMPACTION_LOG_MAX_TOTAL_BYTES, COMPACTION_LOG_MAX_CHUNK_BYTES, COMPACT_CONTEXT_MARKER = "[Negotium compacted context]", AUTO_FORK_COMPACTION_TOKENS = 28000;
14243
14197
  var init_session = __esm(async () => {
14198
+ await init_idle_archiver();
14199
+ await init_agents();
14244
14200
  init_model_catalog();
14201
+ await init_registry();
14245
14202
  init_shared();
14203
+ await init_topic_cleanup();
14204
+ await init_bus();
14246
14205
  init_config();
14247
14206
  init_logger();
14248
14207
  init_mcp_config();
14208
+ await init_active_rooms();
14209
+ await init_background_sessions();
14249
14210
  init_usage_alert();
14250
- await __promiseAll([
14251
- init_idle_archiver(),
14252
- init_agents(),
14253
- init_registry(),
14254
- init_topic_cleanup(),
14255
- init_bus(),
14256
- init_active_rooms(),
14257
- init_background_sessions(),
14258
- init_api_messages(),
14259
- init_api_topic_brief(),
14260
- init_api_topic_config(),
14261
- init_api_topics(),
14262
- init_conversations(),
14263
- init_runtime_leases(),
14264
- init_runtime_topic_state(),
14265
- init_runtime_turn_requests(),
14266
- init_topic_archive(),
14267
- init_personal_general()
14268
- ]);
14211
+ await init_api_messages();
14212
+ await init_api_topic_brief();
14213
+ await init_api_topic_config();
14214
+ await init_api_topics();
14215
+ await init_conversations();
14216
+ await init_runtime_leases();
14217
+ await init_runtime_topic_state();
14218
+ await init_runtime_turn_requests();
14219
+ await init_topic_archive();
14220
+ await init_personal_general();
14269
14221
  RESET_MEMORY_ARCHIVE_WAIT_MS = 5 * 60 * 1000;
14270
14222
  COMPACTION_SOURCE_CHARS = 512 * 1024;
14271
14223
  COMPACTION_TIMEOUT_MS = 2 * 60000;
@@ -14596,24 +14548,22 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
14596
14548
  }
14597
14549
  var TopicTitleConflictError, TopicDeriveBusyError, TopicForkCompactionError;
14598
14550
  var init_derive = __esm(async () => {
14551
+ await init_fork();
14599
14552
  init_model_catalog();
14553
+ await init_registry();
14554
+ await init_bus();
14600
14555
  init_config();
14601
14556
  init_logger();
14602
- await __promiseAll([
14603
- init_fork(),
14604
- init_registry(),
14605
- init_bus(),
14606
- init_manager2(),
14607
- init_active_rooms(),
14608
- init_api_messages(),
14609
- init_api_topic_config(),
14610
- init_api_topics(),
14611
- init_conversations(),
14612
- init_forum_db(),
14613
- init_runtime_topic_state(),
14614
- init_personal_general(),
14615
- init_session()
14616
- ]);
14557
+ await init_manager2();
14558
+ await init_active_rooms();
14559
+ await init_api_messages();
14560
+ await init_api_topic_config();
14561
+ await init_api_topics();
14562
+ await init_conversations();
14563
+ await init_forum_db();
14564
+ await init_runtime_topic_state();
14565
+ await init_personal_general();
14566
+ await init_session();
14617
14567
  TopicTitleConflictError = class TopicTitleConflictError extends Error {
14618
14568
  title;
14619
14569
  constructor(title) {
@@ -14972,17 +14922,15 @@ Link: ${host.derivedTopics.link(derived.id)}`);
14972
14922
  }
14973
14923
  var SELF_CONFIG_MCP_KEY = "topic-config", SELF_SCHEDULE_MAX_DELAY_SECONDS = 86400, SELF_SCHEDULE_MAX_MESSAGE_LENGTH = 1e4, SELF_CONFIG_DERIVED_TOPIC_LIMIT = 5, DEFAULT_SELF_CONFIG_PRODUCT, defaultSelfConfigHost, defaultSelfConfigCore;
14974
14924
  var init_self_config_core = __esm(async () => {
14925
+ await init_api_topic_agent_switch();
14926
+ await init_auth_check();
14975
14927
  init_model_catalog();
14928
+ await init_registry();
14929
+ await init_bus();
14976
14930
  init_config();
14977
- await __promiseAll([
14978
- init_api_topic_agent_switch(),
14979
- init_auth_check(),
14980
- init_registry(),
14981
- init_bus(),
14982
- init_api_topic_config(),
14983
- init_api_topics(),
14984
- init_self_schedules()
14985
- ]);
14931
+ await init_api_topic_config();
14932
+ await init_api_topics();
14933
+ await init_self_schedules();
14986
14934
  DEFAULT_SELF_CONFIG_PRODUCT = {
14987
14935
  mcpKey: SELF_CONFIG_MCP_KEY,
14988
14936
  scheduleMaxDelaySeconds: SELF_SCHEDULE_MAX_DELAY_SECONDS,
@@ -15197,8 +15145,8 @@ function createSelfConfigToolDefinitions(ctx) {
15197
15145
  var AGENT_VALUES;
15198
15146
  var init_self_config = __esm(async () => {
15199
15147
  init_common();
15200
- init_types();
15201
15148
  await init_self_config_core();
15149
+ init_types();
15202
15150
  AGENT_VALUES = SUPPORTED_AGENTS;
15203
15151
  });
15204
15152
 
@@ -15855,11 +15803,9 @@ async function failInterruptedRemoteAskCallbacks() {
15855
15803
  }
15856
15804
  var pendingAsks, MAX_ASK_AGE_MS;
15857
15805
  var init_ask_callbacks = __esm(async () => {
15858
- await __promiseAll([
15859
- init_forum_db(),
15860
- init_session_asks(),
15861
- init_storage_host()
15862
- ]);
15806
+ await init_forum_db();
15807
+ await init_session_asks();
15808
+ await init_storage_host();
15863
15809
  registerStorageSchemaInitializer((database) => {
15864
15810
  database.exec(`
15865
15811
  CREATE TABLE IF NOT EXISTS remote_ask_callbacks (
@@ -16094,10 +16040,8 @@ paint();document.body.appendChild(b)}
16094
16040
  if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",init);else init()})();
16095
16041
  </script>`;
16096
16042
  var init_visual_store = __esm(async () => {
16097
- await __promiseAll([
16098
- init_forum_db(),
16099
- init_storage_host()
16100
- ]);
16043
+ await init_forum_db();
16044
+ await init_storage_host();
16101
16045
  registerStorageSchemaInitializer((database) => {
16102
16046
  database.exec(`
16103
16047
  CREATE TABLE IF NOT EXISTS api_topic_visuals (
@@ -16330,37 +16274,35 @@ async function deleteTopicCascadeImpl(topic, userId, options, deletingAncestorId
16330
16274
  }
16331
16275
  var DELETE_TURN_WAIT_MS = 5000, TopicArchiveRequiredError, TopicTurnStillActiveError, TopicCleanupRequiredError;
16332
16276
  var init_lifecycle = __esm(async () => {
16277
+ await init_archiver();
16278
+ await init_idle_archiver();
16279
+ await init_spawn_subagent();
16280
+ await init_topic_cleanup();
16281
+ await init_bus();
16333
16282
  init_manager();
16334
16283
  init_config();
16335
16284
  init_constants();
16336
16285
  init_logger();
16286
+ await init_manager2();
16287
+ await init_active_rooms();
16337
16288
  init_session_inbox_cleanup();
16338
16289
  init_state();
16290
+ await init_ask_callbacks();
16339
16291
  init_file_hooks();
16340
16292
  init_usage_alert();
16341
- await __promiseAll([
16342
- init_archiver(),
16343
- init_idle_archiver(),
16344
- init_spawn_subagent(),
16345
- init_topic_cleanup(),
16346
- init_bus(),
16347
- init_manager2(),
16348
- init_active_rooms(),
16349
- init_ask_callbacks(),
16350
- init_visual_store(),
16351
- init_api_messages(),
16352
- init_api_topic_brief(),
16353
- init_api_topic_config(),
16354
- init_api_topics(),
16355
- init_browser_profiles(),
16356
- init_runtime_leases(),
16357
- init_runtime_topic_state(),
16358
- init_runtime_turn_requests(),
16359
- init_self_schedules(),
16360
- init_session_asks(),
16361
- init_topic_archive(),
16362
- init_topic_archive_state()
16363
- ]);
16293
+ await init_visual_store();
16294
+ await init_api_messages();
16295
+ await init_api_topic_brief();
16296
+ await init_api_topic_config();
16297
+ await init_api_topics();
16298
+ await init_browser_profiles();
16299
+ await init_runtime_leases();
16300
+ await init_runtime_topic_state();
16301
+ await init_runtime_turn_requests();
16302
+ await init_self_schedules();
16303
+ await init_session_asks();
16304
+ await init_topic_archive();
16305
+ await init_topic_archive_state();
16364
16306
  TopicArchiveRequiredError = class TopicArchiveRequiredError extends Error {
16365
16307
  code = "TOPIC_ARCHIVE_FAILED";
16366
16308
  topicId;
@@ -16720,8 +16662,8 @@ function abortPlaywrightTurns(instanceKey, failure) {
16720
16662
  var turnsByInstance;
16721
16663
  var init_playwright_turn_abort = __esm(async () => {
16722
16664
  init_logger();
16723
- init_types2();
16724
16665
  await init_manager2();
16666
+ init_types2();
16725
16667
  turnsByInstance = new Map;
16726
16668
  onPlaywrightFailure(abortPlaywrightTurns);
16727
16669
  });
@@ -16814,10 +16756,8 @@ function upsertTaskPanelMessage(topicId, queryId, tasks, lastRenderedText) {
16814
16756
  return text2;
16815
16757
  }
16816
16758
  var init_tasks2 = __esm(async () => {
16817
- await __promiseAll([
16818
- init_bus(),
16819
- init_api_messages()
16820
- ]);
16759
+ await init_bus();
16760
+ await init_api_messages();
16821
16761
  });
16822
16762
 
16823
16763
  // ../../packages/core/src/runtime/visual-html.ts
@@ -17053,12 +16993,10 @@ var ACTIVE_VISUAL_PROMPT_MAX_CHARS = 24000, ACTIVE_VISUAL_PROMPT_TAIL_CHARS = 60
17053
16993
  var init_visuals = __esm(async () => {
17054
16994
  init_attachments();
17055
16995
  init_file_hooks();
16996
+ await init_visual_store();
17056
16997
  init_sensitive_path();
16998
+ await init_api_messages();
17057
16999
  init_visual_html();
17058
- await __promiseAll([
17059
- init_visual_store(),
17060
- init_api_messages()
17061
- ]);
17062
17000
  });
17063
17001
 
17064
17002
  // ../../packages/core/src/storage/token-stats.ts
@@ -17832,32 +17770,30 @@ ${JSON.stringify(event.input ?? {})}`);
17832
17770
  return outcome;
17833
17771
  }
17834
17772
  var init_turn_event_stream = __esm(async () => {
17773
+ await init_fork();
17774
+ await init_idle_archiver();
17775
+ await init_ask_user();
17776
+ await init_spawn_subagent();
17835
17777
  init_model_catalog();
17778
+ await init_registry();
17836
17779
  init_tool_format();
17780
+ await init_bus();
17837
17781
  init_logger();
17782
+ await init_active_rooms();
17838
17783
  init_state();
17839
17784
  init_types2();
17840
17785
  init_attachments();
17841
17786
  init_errors();
17787
+ await init_tasks2();
17788
+ await init_topic_config();
17842
17789
  init_usage_alert();
17790
+ await init_visual_store();
17791
+ await init_visuals();
17843
17792
  init_sensitive_path();
17844
- await __promiseAll([
17845
- init_fork(),
17846
- init_idle_archiver(),
17847
- init_ask_user(),
17848
- init_spawn_subagent(),
17849
- init_registry(),
17850
- init_bus(),
17851
- init_active_rooms(),
17852
- init_tasks2(),
17853
- init_topic_config(),
17854
- init_visual_store(),
17855
- init_visuals(),
17856
- init_api_messages(),
17857
- init_api_topics(),
17858
- init_runtime_turn_requests(),
17859
- init_token_stats()
17860
- ]);
17793
+ await init_api_messages();
17794
+ await init_api_topics();
17795
+ await init_runtime_turn_requests();
17796
+ await init_token_stats();
17861
17797
  });
17862
17798
 
17863
17799
  // ../../packages/core/src/runtime/turn-session.ts
@@ -17889,11 +17825,9 @@ function resolveInitialTurnSessionId(topicId, requestedSessionId, isolated) {
17889
17825
  }
17890
17826
  var init_turn_session = __esm(async () => {
17891
17827
  init_model_catalog();
17892
- await __promiseAll([
17893
- init_registry(),
17894
- init_topic_config(),
17895
- init_api_topics()
17896
- ]);
17828
+ await init_registry();
17829
+ await init_topic_config();
17830
+ await init_api_topics();
17897
17831
  });
17898
17832
 
17899
17833
  // ../../packages/core/src/storage/app-settings.ts
@@ -19236,43 +19170,41 @@ function triggerTopicAiTurn(topicId, userId, prompt, agentType, opts) {
19236
19170
  }
19237
19171
  var PLAYWRIGHT_UNAVAILABLE_NOTICE_COOLDOWN_MS, ASK_REPLY_INJECT_BATCH_MS = 500, playwrightUnavailableNoticeAt, askReplyInjectBatcher, remoteInjectWaiters, durableTurnWorker = null, durableTurnWorkerBusy = false;
19238
19172
  var init_turn_runner = __esm(async () => {
19173
+ await init_fork();
19174
+ await init_agents();
19175
+ await init_spawn_subagent();
19176
+ await init_registry();
19177
+ await init_bus();
19239
19178
  init_manager();
19240
19179
  init_constants();
19241
19180
  init_logger();
19242
19181
  init_mcp_config();
19182
+ await init_manager2();
19243
19183
  init_builders();
19184
+ await init_active_rooms();
19244
19185
  init_state();
19245
19186
  init_types2();
19246
19187
  init_attachments();
19188
+ await init_channel_context();
19247
19189
  init_errors();
19190
+ await init_playwright_turn_abort();
19191
+ await init_topic_config();
19192
+ await init_turn_event_stream();
19193
+ await init_turn_session();
19194
+ await init_visual_store();
19195
+ await init_visuals();
19196
+ await init_api_messages();
19197
+ await init_api_topic_brief();
19198
+ await init_api_topics();
19199
+ await init_app_settings();
19200
+ await init_browser_profiles();
19201
+ await init_conversations();
19202
+ await init_runtime_leases();
19203
+ await init_runtime_topic_state();
19204
+ await init_runtime_turn_requests();
19205
+ await init_wiki();
19248
19206
  init_wiki_summary_names();
19249
- await __promiseAll([
19250
- init_fork(),
19251
- init_agents(),
19252
- init_spawn_subagent(),
19253
- init_registry(),
19254
- init_bus(),
19255
- init_manager2(),
19256
- init_active_rooms(),
19257
- init_channel_context(),
19258
- init_playwright_turn_abort(),
19259
- init_topic_config(),
19260
- init_turn_event_stream(),
19261
- init_turn_session(),
19262
- init_visual_store(),
19263
- init_visuals(),
19264
- init_api_messages(),
19265
- init_api_topic_brief(),
19266
- init_api_topics(),
19267
- init_app_settings(),
19268
- init_browser_profiles(),
19269
- init_conversations(),
19270
- init_runtime_leases(),
19271
- init_runtime_topic_state(),
19272
- init_runtime_turn_requests(),
19273
- init_wiki(),
19274
- init_derive()
19275
- ]);
19207
+ await init_derive();
19276
19208
  init_model_catalog();
19277
19209
  init_attachments();
19278
19210
  init_channel_context();
@@ -19982,16 +19914,14 @@ function processOwnerIsAlive(ownerId) {
19982
19914
  var MAX_TASK_CHARS = 8000, MAX_NAME_CHARS = 80, MAX_LIVE_CHILDREN_PER_PARENT = 5, MAX_PREPARED_CHILDREN_PER_PARENT = 10, MAX_SUBAGENT_DEPTH = 2, RESULT_SUMMARY_CHARS = 300, defaultSubagentLifecycleHost, defaultSubagentLifecycle, computeSubagentDepth, canSpawnSubagentsFromTopic, takeSubagentWatch, cancelSubagentWatchForDeletedTopic, settleSubagentSuccess, settleSubagentFailure, sweepStaleSubagentCards, subagentReportMode, createSubagentManagementToolDefinitions, createSpawnSubagentToolDefinition, createPrepareSubagentToolDefinition;
19983
19915
  var init_spawn_subagent = __esm(async () => {
19984
19916
  init_common();
19917
+ await init_bus();
19985
19918
  init_logger();
19919
+ await init_api_messages();
19920
+ await init_api_topics();
19921
+ await init_runtime_leases();
19922
+ await init_runtime_turn_requests();
19986
19923
  init_wiki_summary_names();
19987
19924
  init_types();
19988
- await __promiseAll([
19989
- init_bus(),
19990
- init_api_messages(),
19991
- init_api_topics(),
19992
- init_runtime_leases(),
19993
- init_runtime_turn_requests()
19994
- ]);
19995
19925
  defaultSubagentLifecycleHost = {
19996
19926
  storage: {
19997
19927
  getTopic,
@@ -20233,10 +20163,8 @@ function recordRuntimeGatewaySubmission(submission) {
20233
20163
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(submission.clientMessageId, submission.requestId, submission.topicId, submission.messageId, submission.userId, submission.createdAt, submission.ackCursor, submission.messageCursor, submission.payloadHash ?? null);
20234
20164
  }
20235
20165
  var init_runtime_gateway_submissions = __esm(async () => {
20236
- await __promiseAll([
20237
- init_forum_db(),
20238
- init_storage_host()
20239
- ]);
20166
+ await init_forum_db();
20167
+ await init_storage_host();
20240
20168
  registerStorageSchemaInitializer((database) => {
20241
20169
  database.exec(`
20242
20170
  CREATE TABLE IF NOT EXISTS runtime_gateway_submissions (
@@ -20383,16 +20311,14 @@ function submitRuntimeGatewayTurn(params) {
20383
20311
  }
20384
20312
  var RuntimeGatewayIdempotencyConflictError;
20385
20313
  var init_submit_runtime_gateway_turn = __esm(async () => {
20386
- await __promiseAll([
20387
- init_api_messages(),
20388
- init_api_topics(),
20389
- init_forum_db(),
20390
- init_runtime_events(),
20391
- init_runtime_gateway_submissions(),
20392
- init_runtime_leases(),
20393
- init_runtime_topic_state(),
20394
- init_runtime_turn_requests()
20395
- ]);
20314
+ await init_api_messages();
20315
+ await init_api_topics();
20316
+ await init_forum_db();
20317
+ await init_runtime_events();
20318
+ await init_runtime_gateway_submissions();
20319
+ await init_runtime_leases();
20320
+ await init_runtime_topic_state();
20321
+ await init_runtime_turn_requests();
20396
20322
  RuntimeGatewayIdempotencyConflictError = class RuntimeGatewayIdempotencyConflictError extends Error {
20397
20323
  constructor(message = "clientMessageId or requestId is already bound to another turn") {
20398
20324
  super(message);
@@ -20426,11 +20352,9 @@ function submitUserMessage(params) {
20426
20352
  return { message, queryId };
20427
20353
  }
20428
20354
  var init_submit_user_message = __esm(async () => {
20429
- await __promiseAll([
20430
- init_bus(),
20431
- init_turn_runner(),
20432
- init_api_messages()
20433
- ]);
20355
+ await init_bus();
20356
+ await init_turn_runner();
20357
+ await init_api_messages();
20434
20358
  });
20435
20359
 
20436
20360
  // ../../packages/core/src/application/switch-topic-access-mode.ts
@@ -20497,10 +20421,8 @@ function switchTopicAccessMode(params) {
20497
20421
  };
20498
20422
  }
20499
20423
  var init_switch_topic_access_mode = __esm(async () => {
20500
- await __promiseAll([
20501
- init_bus(),
20502
- init_api_topics()
20503
- ]);
20424
+ await init_bus();
20425
+ await init_api_topics();
20504
20426
  });
20505
20427
 
20506
20428
  // ../../packages/core/src/application/switch-topic-effort.ts
@@ -20535,12 +20457,10 @@ function switchTopicEffort(params) {
20535
20457
  };
20536
20458
  }
20537
20459
  var init_switch_topic_effort = __esm(async () => {
20538
- await __promiseAll([
20539
- init_registry(),
20540
- init_bus(),
20541
- init_api_topic_config(),
20542
- init_api_topics()
20543
- ]);
20460
+ await init_registry();
20461
+ await init_bus();
20462
+ await init_api_topic_config();
20463
+ await init_api_topics();
20544
20464
  });
20545
20465
 
20546
20466
  // ../../packages/core/src/application/switch-topic-model.ts
@@ -20595,15 +20515,13 @@ function switchTopicModel(params) {
20595
20515
  };
20596
20516
  }
20597
20517
  var init_switch_topic_model = __esm(async () => {
20518
+ await init_api_topic_agent_switch();
20519
+ await init_auth_check();
20598
20520
  init_model_catalog();
20521
+ await init_bus();
20599
20522
  init_config();
20600
- await __promiseAll([
20601
- init_api_topic_agent_switch(),
20602
- init_auth_check(),
20603
- init_bus(),
20604
- init_api_topic_config(),
20605
- init_api_topics()
20606
- ]);
20523
+ await init_api_topic_config();
20524
+ await init_api_topics();
20607
20525
  });
20608
20526
 
20609
20527
  // ../../packages/core/src/topics/create.ts
@@ -20673,15 +20591,13 @@ function registerTopic(opts) {
20673
20591
  var DEFAULT_AGENT_ROOM_AGENT2, TopicValidationError;
20674
20592
  var init_create = __esm(async () => {
20675
20593
  init_model_catalog();
20594
+ await init_registry();
20595
+ await init_bus();
20676
20596
  init_config();
20677
20597
  init_constants();
20678
20598
  init_logger();
20599
+ await init_api_topics();
20679
20600
  init_types();
20680
- await __promiseAll([
20681
- init_registry(),
20682
- init_bus(),
20683
- init_api_topics()
20684
- ]);
20685
20601
  DEFAULT_AGENT_ROOM_AGENT2 = FALLBACK_AGENT;
20686
20602
  TopicValidationError = class TopicValidationError extends Error {
20687
20603
  constructor(message) {
@@ -20708,19 +20624,17 @@ function ownerTopic(topicId, userId) {
20708
20624
  }
20709
20625
  var TopicServiceError, topicService;
20710
20626
  var init_topic_service = __esm(async () => {
20711
- await __promiseAll([
20712
- init_ask_user(),
20713
- init_bus(),
20714
- init_active_rooms(),
20715
- init_api_topics(),
20716
- init_runtime_leases(),
20717
- init_runtime_topic_state(),
20718
- init_runtime_turn_requests(),
20719
- init_create(),
20720
- init_derive(),
20721
- init_lifecycle(),
20722
- init_session()
20723
- ]);
20627
+ await init_ask_user();
20628
+ await init_bus();
20629
+ await init_active_rooms();
20630
+ await init_api_topics();
20631
+ await init_runtime_leases();
20632
+ await init_runtime_topic_state();
20633
+ await init_runtime_turn_requests();
20634
+ await init_create();
20635
+ await init_derive();
20636
+ await init_lifecycle();
20637
+ await init_session();
20724
20638
  TopicServiceError = class TopicServiceError extends Error {
20725
20639
  code;
20726
20640
  constructor(code, message) {
@@ -22461,6 +22375,7 @@ function startSessionInboxWorker() {
22461
22375
  }
22462
22376
  var topicWorkerBusy, watcher2 = null, fallbackTimer2 = null, debouncedTrigger2 = null, leadershipTimer2 = null, workerLease2 = null, workerStarted2 = false, SESSION_INBOX_PROCESS_ROLE = "worker:session-inbox";
22463
22377
  var init_inbox = __esm(async () => {
22378
+ await init_bus();
22464
22379
  init_file_ops();
22465
22380
  init_utils();
22466
22381
  init_config();
@@ -22469,14 +22384,11 @@ var init_inbox = __esm(async () => {
22469
22384
  init_logger();
22470
22385
  init_session_inbox_path();
22471
22386
  init_types2();
22472
- await __promiseAll([
22473
- init_bus(),
22474
- init_api_messages(),
22475
- init_runtime_leases(),
22476
- init_runtime_process_leases(),
22477
- init_self_schedules(),
22478
- init_session_asks()
22479
- ]);
22387
+ await init_api_messages();
22388
+ await init_runtime_leases();
22389
+ await init_runtime_process_leases();
22390
+ await init_self_schedules();
22391
+ await init_session_asks();
22480
22392
  topicWorkerBusy = new Set;
22481
22393
  });
22482
22394
 
@@ -22712,10 +22624,27 @@ __export(exports_src, {
22712
22624
  });
22713
22625
  var init_src = __esm(async () => {
22714
22626
  init_maestro_bootstrap_env();
22627
+ await init_auth_check();
22715
22628
  init_codex_tree_kill();
22629
+ await init_fork();
22630
+ await init_agents();
22631
+ await init_ask_user();
22716
22632
  init_common();
22633
+ await init_self_config();
22634
+ await init_spawn_subagent();
22717
22635
  init_visuals2();
22718
22636
  init_model_catalog();
22637
+ await init_registry();
22638
+ await init_topic_cleanup();
22639
+ await init_execute_external_user_turn();
22640
+ await init_submit_runtime_gateway_turn();
22641
+ await init_submit_user_message();
22642
+ await init_switch_topic_access_mode();
22643
+ await init_switch_topic_effort();
22644
+ await init_switch_topic_model();
22645
+ await init_topic_service();
22646
+ await init_vault_command();
22647
+ await init_bus();
22719
22648
  init_runtime_spec();
22720
22649
  init_file_events();
22721
22650
  init_text_extractor();
@@ -22727,56 +22656,37 @@ var init_src = __esm(async () => {
22727
22656
  init_log_rotation();
22728
22657
  init_logger();
22729
22658
  init_mcp_config();
22659
+ await init_modules();
22730
22660
  init_node_plugins();
22661
+ await init_manager2();
22662
+ await init_active_rooms();
22731
22663
  init_session_inbox_path();
22732
22664
  init_types2();
22665
+ await init_ask_callbacks();
22733
22666
  init_attachments();
22667
+ await init_background_sessions();
22668
+ await init_bashrs_completions();
22669
+ await init_delivery_ack();
22734
22670
  init_file_hooks();
22671
+ await init_inbox();
22672
+ await init_turn_runner();
22735
22673
  init_sensitive_path();
22674
+ await init_api_messages();
22675
+ await init_api_topic_config();
22676
+ await init_api_topics();
22677
+ await init_app_settings();
22678
+ await init_forum_db();
22679
+ await init_runtime_events();
22680
+ await init_runtime_leases();
22681
+ await init_runtime_process_leases();
22682
+ await init_session_asks();
22683
+ await init_vault();
22684
+ await init_create();
22685
+ await init_derive();
22686
+ await init_lifecycle();
22687
+ await init_personal_general();
22688
+ await init_session();
22736
22689
  init_types();
22737
- await __promiseAll([
22738
- init_auth_check(),
22739
- init_fork(),
22740
- init_agents(),
22741
- init_ask_user(),
22742
- init_self_config(),
22743
- init_spawn_subagent(),
22744
- init_registry(),
22745
- init_topic_cleanup(),
22746
- init_execute_external_user_turn(),
22747
- init_submit_runtime_gateway_turn(),
22748
- init_submit_user_message(),
22749
- init_switch_topic_access_mode(),
22750
- init_switch_topic_effort(),
22751
- init_switch_topic_model(),
22752
- init_topic_service(),
22753
- init_vault_command(),
22754
- init_bus(),
22755
- init_modules(),
22756
- init_manager2(),
22757
- init_active_rooms(),
22758
- init_ask_callbacks(),
22759
- init_background_sessions(),
22760
- init_bashrs_completions(),
22761
- init_delivery_ack(),
22762
- init_inbox(),
22763
- init_turn_runner(),
22764
- init_api_messages(),
22765
- init_api_topic_config(),
22766
- init_api_topics(),
22767
- init_app_settings(),
22768
- init_forum_db(),
22769
- init_runtime_events(),
22770
- init_runtime_leases(),
22771
- init_runtime_process_leases(),
22772
- init_session_asks(),
22773
- init_vault(),
22774
- init_create(),
22775
- init_derive(),
22776
- init_lifecycle(),
22777
- init_personal_general(),
22778
- init_session()
22779
- ]);
22780
22690
  init_types();
22781
22691
  });
22782
22692
 
@@ -22885,13 +22795,11 @@ function migrateLegacyCompactedConversations() {
22885
22795
  var COMPACT_CONTEXT_MARKER2 = "[Negotium compacted context]", MIGRATION_NAME = "raw-active-v1";
22886
22796
  var init_conversation_migration = __esm(async () => {
22887
22797
  init_logger();
22798
+ await init_api_messages();
22799
+ await init_api_topics();
22800
+ await init_conversations();
22801
+ await init_storage_host();
22888
22802
  init_types();
22889
- await __promiseAll([
22890
- init_api_messages(),
22891
- init_api_topics(),
22892
- init_conversations(),
22893
- init_storage_host()
22894
- ]);
22895
22803
  });
22896
22804
 
22897
22805
  // ../../packages/core/src/node-host.ts
@@ -22961,41 +22869,39 @@ __export(exports_node_host, {
22961
22869
  });
22962
22870
  var init_node_host = __esm(async () => {
22963
22871
  init_codex_tree_kill();
22872
+ await init_ask_user();
22873
+ await init_spawn_subagent();
22874
+ await init_submit_runtime_gateway_turn();
22875
+ await init_submit_user_message();
22876
+ await init_switch_topic_access_mode();
22877
+ await init_switch_topic_effort();
22878
+ await init_switch_topic_model();
22879
+ await init_topic_service();
22880
+ await init_vault_command();
22881
+ await init_bus();
22964
22882
  init_runtime_spec();
22965
22883
  init_manager();
22966
22884
  init_config();
22967
22885
  init_lifecycle2();
22968
22886
  init_logger();
22969
22887
  init_mcp_config();
22888
+ await init_modules();
22970
22889
  init_node_plugins();
22890
+ await init_manager2();
22891
+ await init_active_rooms();
22892
+ await init_background_sessions();
22893
+ await init_bashrs_completions();
22971
22894
  init_file_hooks();
22972
- await __promiseAll([
22973
- init_ask_user(),
22974
- init_spawn_subagent(),
22975
- init_submit_runtime_gateway_turn(),
22976
- init_submit_user_message(),
22977
- init_switch_topic_access_mode(),
22978
- init_switch_topic_effort(),
22979
- init_switch_topic_model(),
22980
- init_topic_service(),
22981
- init_vault_command(),
22982
- init_bus(),
22983
- init_modules(),
22984
- init_manager2(),
22985
- init_active_rooms(),
22986
- init_background_sessions(),
22987
- init_bashrs_completions(),
22988
- init_inbox(),
22989
- init_turn_runner(),
22990
- init_api_messages(),
22991
- init_api_topics(),
22992
- init_runtime_events(),
22993
- init_runtime_process_leases(),
22994
- init_token_stats(),
22995
- init_derive(),
22996
- init_personal_general(),
22997
- init_session()
22998
- ]);
22895
+ await init_inbox();
22896
+ await init_turn_runner();
22897
+ await init_api_messages();
22898
+ await init_api_topics();
22899
+ await init_runtime_events();
22900
+ await init_runtime_process_leases();
22901
+ await init_token_stats();
22902
+ await init_derive();
22903
+ await init_personal_general();
22904
+ await init_session();
22999
22905
  });
23000
22906
 
23001
22907
  // ../../packages/core/src/agents/mcp-tools/inline-assets.ts
@@ -23299,34 +23205,32 @@ __export(exports_mcp_runtime_host, {
23299
23205
  EFFORT_VALUES: () => EFFORT_VALUES
23300
23206
  });
23301
23207
  var init_mcp_runtime_host = __esm(async () => {
23208
+ await init_ask_user();
23302
23209
  init_common();
23303
23210
  init_publish_html();
23211
+ await init_self_config();
23212
+ await init_spawn_subagent();
23304
23213
  init_visuals2();
23214
+ await init_bus();
23305
23215
  init_runtime_spec();
23306
23216
  init_config();
23307
23217
  init_constants();
23308
23218
  init_jsonl();
23309
23219
  init_logger();
23310
23220
  init_mcp_config();
23221
+ await init_active_rooms();
23311
23222
  init_session_inbox_path();
23223
+ await init_delivery_ack();
23312
23224
  init_file_hooks();
23313
23225
  init_sensitive_path();
23226
+ await init_api_messages();
23227
+ await init_api_topic_config();
23228
+ await init_api_topics();
23229
+ await init_create();
23230
+ await init_derive();
23231
+ await init_lifecycle();
23232
+ await init_session();
23314
23233
  init_types();
23315
- await __promiseAll([
23316
- init_ask_user(),
23317
- init_self_config(),
23318
- init_spawn_subagent(),
23319
- init_bus(),
23320
- init_active_rooms(),
23321
- init_delivery_ack(),
23322
- init_api_messages(),
23323
- init_api_topic_config(),
23324
- init_api_topics(),
23325
- init_create(),
23326
- init_derive(),
23327
- init_lifecycle(),
23328
- init_session()
23329
- ]);
23330
23234
  });
23331
23235
 
23332
23236
  // ../../packages/mcp/src/node-tools.ts
@@ -23598,8 +23502,8 @@ ${renderTaskList(tasks2)}`);
23598
23502
  }
23599
23503
  var defaultTaskMcpHost;
23600
23504
  var init_task = __esm(async () => {
23601
- init_mcp_helpers();
23602
23505
  await init_tasks();
23506
+ init_mcp_helpers();
23603
23507
  defaultTaskMcpHost = {
23604
23508
  readTasks,
23605
23509
  writeTasks
@@ -24140,11 +24044,11 @@ ${lines.join(`
24140
24044
  var AGENTS, MAX_CONCURRENT_CHECKS = 2, activeChecks = 0, checkWaiters, activeCheckAllUsers;
24141
24045
  var init_agent_health = __esm(async () => {
24142
24046
  init_claude_registry();
24047
+ await init_codex_registry();
24143
24048
  init_maestro_registry();
24144
24049
  init_config();
24145
24050
  init_jsonl();
24146
24051
  init_mcp_helpers();
24147
- await init_codex_registry();
24148
24052
  AGENTS = [
24149
24053
  { kind: "claude", registry: claudeRegistry, checker: checkClaude },
24150
24054
  { kind: "codex", registry: codexRegistry, checker: checkCodex },
@@ -24181,10 +24085,8 @@ function canSubagentTellTargetByName(identity, target) {
24181
24085
  return canSubagentTellTarget(identity, resolved.id);
24182
24086
  }
24183
24087
  var init_tell_permissions = __esm(async () => {
24184
- await __promiseAll([
24185
- init_spawn_subagent(),
24186
- init_api_topics()
24187
- ]);
24088
+ await init_spawn_subagent();
24089
+ await init_api_topics();
24188
24090
  });
24189
24091
 
24190
24092
  // ../../packages/core/src/mcp/factories/session-comm.ts
@@ -24339,10 +24241,8 @@ async function deleteManagedBrowserProfile(ownerId, rawProfile) {
24339
24241
  };
24340
24242
  }
24341
24243
  var init_profile_management = __esm(async () => {
24342
- await __promiseAll([
24343
- init_manager2(),
24344
- init_browser_profiles()
24345
- ]);
24244
+ await init_manager2();
24245
+ await init_browser_profiles();
24346
24246
  });
24347
24247
 
24348
24248
  // ../../packages/core/src/mcp/session-comm/default-host.ts
@@ -24672,20 +24572,18 @@ ${entries.join(`
24672
24572
  }
24673
24573
  var MAX_MESSAGE_LENGTH = 1e4;
24674
24574
  var init_default_host = __esm(async () => {
24575
+ await init_tell_permissions();
24675
24576
  init_config();
24676
24577
  init_jsonl();
24677
24578
  init_mcp_config();
24579
+ await init_manager2();
24580
+ await init_profile_management();
24678
24581
  init_session_inbox_path();
24582
+ await init_api_topic_config();
24583
+ await init_api_topics();
24584
+ await init_browser_profiles();
24585
+ await init_session_asks();
24679
24586
  init_types();
24680
- await __promiseAll([
24681
- init_tell_permissions(),
24682
- init_manager2(),
24683
- init_profile_management(),
24684
- init_api_topic_config(),
24685
- init_api_topics(),
24686
- init_browser_profiles(),
24687
- init_session_asks()
24688
- ]);
24689
24587
  });
24690
24588
 
24691
24589
  // ../../packages/core/src/mcp/vault-http.ts
@@ -26697,9 +26595,9 @@ function createWikiMcpServer(context, host2) {
26697
26595
  }
26698
26596
  var wikiRuntime, FILE_LOCK_WAIT_MS = 10, FILE_LOCK_TIMEOUT_MS = 5000, FILE_LOCK_STALE_MS = 30000, lockWaitArray, SEARCH_STOP_WORDS, SEARCH_MONTHS, SEARCH_RECENCY_TERMS, WIKI_SEARCH_INDEX_FILENAME = ".wiki-search-index.sqlite", WIKI_INDEX_FILENAMES, WIKI_INDEX_NAMESPACES, MAX_INDEX_DESCRIPTION_LENGTH = 400, SEARCH_CACHE_SKIPPED_NOTE = "Body-search cache was not updated; catalog retrieval still works. Run wiki_reindex to refill it.", WIKI_TOOLS, SKILL_TOOLS;
26699
26597
  var init_wiki_server = __esm(async () => {
26598
+ await init_wiki_search_index();
26700
26599
  init_config();
26701
26600
  init_wiki_summary_names();
26702
- await init_wiki_search_index();
26703
26601
  wikiRuntime = new AsyncLocalStorage3;
26704
26602
  lockWaitArray = new Int32Array(new SharedArrayBuffer(4));
26705
26603
  SEARCH_STOP_WORDS = new Set([
@@ -27304,11 +27202,9 @@ function flushSessionCache() {
27304
27202
  }
27305
27203
  var init_schema = __esm(async () => {
27306
27204
  init_logger();
27205
+ await init_forum_db();
27206
+ await init_storage_host();
27307
27207
  init_types();
27308
- await __promiseAll([
27309
- init_forum_db(),
27310
- init_storage_host()
27311
- ]);
27312
27208
  registerStorageSchemaInitializer(initializeForumSchema, 10);
27313
27209
  });
27314
27210
 
@@ -27525,9 +27421,9 @@ __export(exports_forum, {
27525
27421
  addTopic: () => addTopic
27526
27422
  });
27527
27423
  var init_forum = __esm(async () => {
27528
- await init_schema();
27529
27424
  init_agent_settings();
27530
27425
  init_repository();
27426
+ await init_schema();
27531
27427
  });
27532
27428
 
27533
27429
  // ../../packages/core/src/storage/storage-public-host.ts
@@ -27577,8 +27473,8 @@ function setTopicAgentAndClearSession(opts) {
27577
27473
  return changed;
27578
27474
  }
27579
27475
  var init_topic_settings = __esm(async () => {
27580
- init_types();
27581
27476
  await init_forum_db();
27477
+ init_types();
27582
27478
  });
27583
27479
 
27584
27480
  // ../../packages/core/src/storage/storage-public.ts
@@ -27781,45 +27677,43 @@ __export(exports_storage_public, {
27781
27677
  ConversationLogDivergedError: () => ConversationLogDivergedError
27782
27678
  });
27783
27679
  var init_storage_public = __esm(async () => {
27784
- init_wiki_summary_names();
27785
- await __promiseAll([
27786
- init_activity_log(),
27787
- init_api_messages(),
27788
- init_api_topic_brief(),
27789
- init_api_topic_config(),
27790
- init_api_topics(),
27791
- init_app_settings(),
27792
- init_ask_user_gates(),
27793
- init_conversations(),
27794
- init_forum(),
27795
- init_forum(),
27796
- init_runtime_process_leases(),
27797
- init_session_asks(),
27798
- init_storage_public_host(),
27799
- init_tasks(),
27800
- init_token_stats(),
27801
- init_topic_archive(),
27802
- init_topic_archive_state(),
27803
- init_topic_settings(),
27804
- init_wiki()
27805
- ]);
27680
+ await init_activity_log();
27806
27681
  init_activity_log();
27682
+ await init_api_messages();
27807
27683
  init_api_messages();
27684
+ await init_api_topic_brief();
27808
27685
  init_api_topic_brief();
27686
+ await init_api_topic_config();
27809
27687
  init_api_topic_config();
27688
+ await init_api_topics();
27810
27689
  init_api_topics();
27690
+ await init_app_settings();
27811
27691
  init_app_settings();
27692
+ await init_ask_user_gates();
27812
27693
  init_ask_user_gates();
27694
+ await init_conversations();
27813
27695
  init_conversations();
27696
+ await init_forum();
27697
+ await init_forum();
27698
+ await init_runtime_process_leases();
27814
27699
  init_runtime_process_leases();
27700
+ await init_session_asks();
27815
27701
  init_session_asks();
27702
+ await init_storage_public_host();
27703
+ await init_tasks();
27816
27704
  init_tasks();
27705
+ await init_token_stats();
27817
27706
  init_token_stats();
27707
+ await init_topic_archive();
27818
27708
  init_topic_archive();
27709
+ await init_topic_archive_state();
27819
27710
  init_topic_archive_state();
27711
+ await init_topic_settings();
27820
27712
  init_topic_settings();
27713
+ await init_wiki();
27821
27714
  init_wiki();
27822
27715
  init_wiki_summary_names();
27716
+ init_wiki_summary_names();
27823
27717
  });
27824
27718
 
27825
27719
  // ../../packages/mcp/src/hosted-surfaces.ts
@@ -28523,12 +28417,10 @@ async function handleNegotiumMcpRequest(req) {
28523
28417
  }
28524
28418
  var SSE_PATH, SSE_MESSAGE_PATH, STREAMABLE_PATH, FILE_DELIVERY_ACK_TIMEOUT_MS = 30000, FILE_DELIVERY_CLAIM_TIMEOUT_MS = 500, MCP_SESSION_IDLE_MS, MCP_SESSION_MAX_LIFETIME_MS, MAX_MCP_SESSIONS = 256, sseSessions, streamableSessions, closingServers;
28525
28419
  var init_server = __esm(async () => {
28420
+ await init_mcp_runtime_host();
28526
28421
  init_hosted_surfaces();
28422
+ await init_node_tools();
28527
28423
  init_sse_transport();
28528
- await __promiseAll([
28529
- init_mcp_runtime_host(),
28530
- init_node_tools()
28531
- ]);
28532
28424
  SSE_PATH = `${RUNTIME_MCP_BASE_PATH}/sse`;
28533
28425
  SSE_MESSAGE_PATH = `${RUNTIME_MCP_BASE_PATH}/message`;
28534
28426
  STREAMABLE_PATH = `${RUNTIME_MCP_BASE_PATH}/mcp`;
@@ -28541,12 +28433,10 @@ var init_server = __esm(async () => {
28541
28433
 
28542
28434
  // ../../packages/mcp/src/index.ts
28543
28435
  var init_src2 = __esm(async () => {
28436
+ await init_mcp_runtime_host();
28437
+ await init_node_tools();
28438
+ await init_server();
28544
28439
  init_sse_transport();
28545
- await __promiseAll([
28546
- init_mcp_runtime_host(),
28547
- init_node_tools(),
28548
- init_server()
28549
- ]);
28550
28440
  });
28551
28441
 
28552
28442
  // ../../packages/mcp-host/src/paths.ts
@@ -30016,10 +29906,8 @@ async function stopNodeDaemon(timeoutMs = 3000) {
30016
29906
  }
30017
29907
  var NODE_CONTROL_PROTOCOL_VERSION = 1, NODE_CONTROL_BASE_PATH = "/api/v1/control", NODE_RUNTIME_CONTRACT_VERSION = 1, NODE_RUNTIME_CONTRACT_BASE_PATH, NODE_DAEMON_ROLE = "node-daemon", NODE_DAEMON_INFO_PATH, NODE_VERSION, ControlRequestError;
30018
29908
  var init_control = __esm(async () => {
30019
- await __promiseAll([
30020
- init_node_host(),
30021
- init_files()
30022
- ]);
29909
+ await init_node_host();
29910
+ await init_files();
30023
29911
  NODE_RUNTIME_CONTRACT_BASE_PATH = `${NODE_CONTROL_BASE_PATH}/runtime/v1`;
30024
29912
  NODE_DAEMON_INFO_PATH = resolve21(RUN_DIR, "node-daemon.json");
30025
29913
  NODE_VERSION = NEGOTIUM_VERSION;
@@ -30039,21 +29927,19 @@ function runSingletonStartupMaintenance(maintenance) {
30039
29927
 
30040
29928
  // ../../packages/core/src/cron-host.ts
30041
29929
  var init_cron_host = __esm(async () => {
29930
+ await init_topic_cleanup();
29931
+ await init_bus();
30042
29932
  init_config();
30043
29933
  init_logger();
30044
29934
  init_mcp_config();
30045
- await __promiseAll([
30046
- init_topic_cleanup(),
30047
- init_bus(),
30048
- init_active_rooms(),
30049
- init_background_sessions(),
30050
- init_turn_runner(),
30051
- init_api_messages(),
30052
- init_api_topics(),
30053
- init_forum_db(),
30054
- init_runtime_leases(),
30055
- init_derive()
30056
- ]);
29935
+ await init_active_rooms();
29936
+ await init_background_sessions();
29937
+ await init_turn_runner();
29938
+ await init_api_messages();
29939
+ await init_api_topics();
29940
+ await init_forum_db();
29941
+ await init_runtime_leases();
29942
+ await init_derive();
30057
29943
  });
30058
29944
 
30059
29945
  // ../../packages/module-cron/src/schedule.ts
@@ -30940,11 +30826,9 @@ function finalizeOrphanedCronRuns(now = new Date) {
30940
30826
  }
30941
30827
  var schemaReady = false, db3;
30942
30828
  var init_store = __esm(async () => {
30829
+ await init_cron_host();
30943
30830
  init_schedule();
30944
- await __promiseAll([
30945
- init_cron_host(),
30946
- init_scripts()
30947
- ]);
30831
+ await init_scripts();
30948
30832
  db3 = db;
30949
30833
  });
30950
30834
 
@@ -31016,10 +30900,8 @@ function listCronBackgroundSessions(userId) {
31016
30900
  });
31017
30901
  }
31018
30902
  var init_background_sessions2 = __esm(async () => {
31019
- await __promiseAll([
31020
- init_cron_host(),
31021
- init_store()
31022
- ]);
30903
+ await init_cron_host();
30904
+ await init_store();
31023
30905
  });
31024
30906
 
31025
30907
  // ../../packages/module-cron/src/host.ts
@@ -31131,11 +31013,9 @@ async function rotateCronTopicContext(topicId, retainTurns = CRON_CONTEXT_RETAIN
31131
31013
  }
31132
31014
  var CRON_CONTEXT_ROTATE_EVERY = 5, CRON_CONTEXT_RETAIN_TURNS = 5;
31133
31015
  var init_context2 = __esm(async () => {
31134
- await __promiseAll([
31135
- init_cron_host(),
31136
- init_host(),
31137
- init_store()
31138
- ]);
31016
+ await init_cron_host();
31017
+ await init_host();
31018
+ await init_store();
31139
31019
  });
31140
31020
 
31141
31021
  // ../../packages/module-cron/src/scheduler.ts
@@ -31470,12 +31350,10 @@ class CronScheduler {
31470
31350
  }
31471
31351
  var DEFAULT_POLL_INTERVAL_MS = 1000, DEFAULT_RUN_TIMEOUT_MS, DEFAULT_QUEUE_TIMEOUT_MS;
31472
31352
  var init_scheduler = __esm(async () => {
31473
- await __promiseAll([
31474
- init_cron_host(),
31475
- init_context2(),
31476
- init_host(),
31477
- init_store()
31478
- ]);
31353
+ await init_cron_host();
31354
+ await init_context2();
31355
+ await init_host();
31356
+ await init_store();
31479
31357
  DEFAULT_RUN_TIMEOUT_MS = 10 * 60000;
31480
31358
  DEFAULT_QUEUE_TIMEOUT_MS = 5 * 60000;
31481
31359
  });
@@ -31598,15 +31476,13 @@ function createCronModule(options = {}) {
31598
31476
  }
31599
31477
  var SOURCE_MCP_SERVER_FILE, PACKAGED_MCP_SERVER_FILE;
31600
31478
  var init_module = __esm(async () => {
31601
- await __promiseAll([
31602
- init_cron_host(),
31603
- init_background_sessions2(),
31604
- init_context2(),
31605
- init_host(),
31606
- init_scheduler(),
31607
- init_scripts(),
31608
- init_store()
31609
- ]);
31479
+ await init_cron_host();
31480
+ await init_background_sessions2();
31481
+ await init_context2();
31482
+ await init_host();
31483
+ await init_scheduler();
31484
+ await init_scripts();
31485
+ await init_store();
31610
31486
  SOURCE_MCP_SERVER_FILE = fileURLToPath2(new URL("./mcp-server.ts", import.meta.url));
31611
31487
  PACKAGED_MCP_SERVER_FILE = fileURLToPath2(new URL("./runtime/cron/mcp-server.ts", import.meta.url));
31612
31488
  });
@@ -31694,10 +31570,8 @@ function queueCronPromptSummary(jobId, prompt, summarize = summarizeCronPrompt)
31694
31570
  }
31695
31571
  var DEFAULT_URL = "https://api.deepseek.com/v1/chat/completions", DEFAULT_MODEL = "deepseek-chat", MAX_SUMMARY_LENGTH = 60, MAX_CONCURRENT_SUMMARIES = 3, generations, pending, active = 0, nextGeneration = 0;
31696
31572
  var init_summarize = __esm(async () => {
31697
- await __promiseAll([
31698
- init_cron_host(),
31699
- init_store()
31700
- ]);
31573
+ await init_cron_host();
31574
+ await init_store();
31701
31575
  generations = new Map;
31702
31576
  pending = [];
31703
31577
  });
@@ -31767,17 +31641,15 @@ __export(exports_src2, {
31767
31641
  CRON_CONTEXT_RETAIN_TURNS: () => CRON_CONTEXT_RETAIN_TURNS
31768
31642
  });
31769
31643
  var init_src4 = __esm(async () => {
31644
+ await init_background_sessions2();
31645
+ await init_context2();
31646
+ await init_host();
31647
+ await init_module();
31770
31648
  init_schedule();
31771
- await __promiseAll([
31772
- init_background_sessions2(),
31773
- init_context2(),
31774
- init_host(),
31775
- init_module(),
31776
- init_scheduler(),
31777
- init_scripts(),
31778
- init_store(),
31779
- init_summarize()
31780
- ]);
31649
+ await init_scheduler();
31650
+ await init_scripts();
31651
+ await init_store();
31652
+ await init_summarize();
31781
31653
  });
31782
31654
 
31783
31655
  // ../../packages/node/src/index.ts
@@ -32034,16 +31906,14 @@ async function runNodeDaemon(opts = {}) {
32034
31906
  process.exit(0);
32035
31907
  }
32036
31908
  var init_src5 = __esm(async () => {
31909
+ await init_conversation_migration();
31910
+ await init_node_host();
31911
+ await init_src2();
32037
31912
  init_src3();
32038
- await __promiseAll([
32039
- init_conversation_migration(),
32040
- init_node_host(),
32041
- init_src2(),
32042
- init_control(),
32043
- init_files(),
32044
- init_control(),
32045
- init_files()
32046
- ]);
31913
+ await init_control();
31914
+ await init_files();
31915
+ await init_control();
31916
+ await init_files();
32047
31917
  });
32048
31918
 
32049
31919
  // ../../packages/adapter-sdk/src/index.ts
@@ -32945,8 +32815,8 @@ function applyRuntimeEvent(state, event) {
32945
32815
  }
32946
32816
  var NO_TOPIC_PICKER_SELECTION = -1;
32947
32817
  var init_state2 = __esm(async () => {
32948
- init_subagent_graph();
32949
32818
  await init_src();
32819
+ init_subagent_graph();
32950
32820
  });
32951
32821
 
32952
32822
  // ../../adapters/terminal/src/context-usage.ts
@@ -33002,10 +32872,8 @@ function activeContextBreakdown(state) {
33002
32872
  };
33003
32873
  }
33004
32874
  var init_context_usage = __esm(async () => {
33005
- await __promiseAll([
33006
- init_src(),
33007
- init_state2()
33008
- ]);
32875
+ await init_src();
32876
+ await init_state2();
33009
32877
  });
33010
32878
 
33011
32879
  // ../../adapters/terminal/src/path-suggest.ts
@@ -35081,16 +34949,14 @@ var theme, WORKING_FRAMES, CODE_COPY_MARKER = "\u29C9", WORKING_FRAME_INTERVAL_M
35081
34949
  }
35082
34950
  }, BARE_URL_PATTERN, URL_TRAILING_PUNCTUATION, isWrapSpace = (character) => character === " " || character === "\t", isWideBreak = (character) => runeWidth(character) === 2, NO_ROW_START, NO_ROW_END, WRAP_MIN_WIDTH = 2, FRAME_MIN_INNER_WIDTH = 4, FRAME_TITLE_MIN_INNER_WIDTH = 8, TABLE_MAX_WIDTH_FRACTION = 0.92, TABLE_MIN_COL_WIDTH = 4, FILE_PREVIEW_MAX_LINES = 12, messageLayoutCache, INLINE_TASK_LIMIT = 5, TASK_SIDEBAR_MIN_WIDTH = 110, TASK_SIDEBAR_WIDTH = 36, TASK_SIDEBAR_GAP = 1, TOPIC_FILTER_ROW_INDEX = 2, TOPIC_FILTER_LABEL = " Filter: ", COMPOSER_GUTTER = 4, COMPOSER_RIGHT_MARGIN = 1, COMPOSER_MIN_CONTENT_WIDTH = 4, NOTICE_STYLE;
35083
34951
  var init_render = __esm(async () => {
34952
+ await init_src();
35084
34953
  init_color_depth();
35085
34954
  init_commands();
34955
+ await init_context_usage();
35086
34956
  init_path_suggest();
34957
+ await init_state2();
35087
34958
  init_terminal_width();
35088
34959
  init_terminal_width();
35089
- await __promiseAll([
35090
- init_src(),
35091
- init_context_usage(),
35092
- init_state2()
35093
- ]);
35094
34960
  theme = {
35095
34961
  canvas: [10, 11, 15],
35096
34962
  surface: [18, 20, 27],
@@ -35387,11 +35253,9 @@ function topicFilterPasteText(payload) {
35387
35253
  }
35388
35254
  var MESSAGE_MUTATING_AI_STATUS_KINDS, SGR_MOUSE_PATTERN, TERMINAL_VAULT_USAGE = "Usage: /vault, /vault list, /vault set KEY VALUE [description], or /vault del KEY", BRACKETED_PASTE_START = "\x1B[200~", BRACKETED_PASTE_END = "\x1B[201~", PASTED_TAB_WIDTH = 4, ESC2 = "\\u001b", ESC_CHAR = "\x1B", BEL = "\\u0007", OSC_PATTERN, STRING_COMMAND_PATTERN, CSI_PATTERN, SS3_PATTERN, LONE_ESCAPE_PATTERN, REMAINING_CONTROL_PATTERN, MAX_ESCAPE_CARRY = 32, SS3_CURSOR_PATTERN, MOD_SHIFT = 1, MOD_ALT = 2, MOD_CTRL = 4, MOD_LOCKS = 192, MOD_EXOTIC = 56, CTRL_BYTES, LEGACY_TEXT_KEYS, CSI_U_PATTERN, CSI_LETTER_PATTERN, CSI_TILDE_PATTERN, NEWLINE_KEY_CHUNKS, MODIFIED_ENTER_PATTERN;
35389
35255
  var init_app_helpers = __esm(async () => {
35390
- await __promiseAll([
35391
- init_src(),
35392
- init_render(),
35393
- init_state2()
35394
- ]);
35256
+ await init_src();
35257
+ await init_render();
35258
+ await init_state2();
35395
35259
  MESSAGE_MUTATING_AI_STATUS_KINDS = new Set(["tool_call", "tool_output"]);
35396
35260
  SGR_MOUSE_PATTERN = new RegExp("\\u001b\\[<(\\d{1,5});(\\d{1,5});(\\d{1,5})([mM])", "g");
35397
35261
  OSC_PATTERN = new RegExp(`${ESC2}\\][^${BEL}${ESC2}]{0,1024}(?:${BEL}|${ESC2}\\\\)`, "g");
@@ -35988,12 +35852,10 @@ class RemoteNegotiumClient {
35988
35852
  }
35989
35853
  var MESSAGE_HISTORY_PAGE_SIZE = 50, INITIAL_MESSAGE_HISTORY_PAGE_COUNT = 3, INITIAL_MESSAGE_HISTORY_LIMIT;
35990
35854
  var init_client = __esm(async () => {
35991
- await __promiseAll([
35992
- init_src(),
35993
- init_storage_public(),
35994
- init_src5(),
35995
- init_history_store()
35996
- ]);
35855
+ await init_src();
35856
+ await init_storage_public();
35857
+ await init_src5();
35858
+ await init_history_store();
35997
35859
  INITIAL_MESSAGE_HISTORY_LIMIT = MESSAGE_HISTORY_PAGE_SIZE * INITIAL_MESSAGE_HISTORY_PAGE_COUNT;
35998
35860
  });
35999
35861
 
@@ -36405,11 +36267,9 @@ async function runTerminalCommand(commandLine, context) {
36405
36267
  context.queueRender();
36406
36268
  }
36407
36269
  var init_command_router = __esm(async () => {
36408
- await __promiseAll([
36409
- init_src(),
36410
- init_app_helpers(),
36411
- init_state2()
36412
- ]);
36270
+ await init_src();
36271
+ await init_app_helpers();
36272
+ await init_state2();
36413
36273
  });
36414
36274
 
36415
36275
  // ../../adapters/terminal/src/screen-renderer.ts
@@ -39050,22 +38910,20 @@ class TerminalApp {
39050
38910
  }
39051
38911
  var KITTY_KEYBOARD_PUSH = "\x1B[>1u", KITTY_KEYBOARD_POP = "\x1B[<u", CANVAS_RGB, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, ABORT_ENTER_ALT_SCREEN, NEW_TOPIC_KEY = "\x0E", DELETE_TOPIC_KEY = "\x04", TOGGLE_ACCESS_MODE_KEY = "\x10", FILTER_BACKSPACE_KEYS, CONFIRM_KEYS, CANCEL_KEYS, INPUT_CARRY_FLUSH_MS = 15;
39052
38912
  var init_app = __esm(async () => {
38913
+ await init_src();
38914
+ await init_app_helpers();
38915
+ await init_client();
39053
38916
  init_color_depth();
38917
+ await init_command_router();
39054
38918
  init_commands();
39055
38919
  init_path_suggest();
38920
+ await init_render();
39056
38921
  init_screen_renderer();
39057
38922
  init_selection();
38923
+ await init_state2();
39058
38924
  init_subagent_graph();
39059
38925
  init_terminal_restore();
39060
- await __promiseAll([
39061
- init_src(),
39062
- init_app_helpers(),
39063
- init_client(),
39064
- init_command_router(),
39065
- init_render(),
39066
- init_state2(),
39067
- init_app_helpers()
39068
- ]);
38926
+ await init_app_helpers();
39069
38927
  CANVAS_RGB = [10, 11, 15];
39070
38928
  ENTER_ALT_SCREEN = altScreenSequences().enter;
39071
38929
  EXIT_ALT_SCREEN = altScreenSequences().exit;
@@ -39104,13 +38962,11 @@ function startTerminalAdapter(options) {
39104
38962
  }
39105
38963
  var terminalAdapter;
39106
38964
  var init_src6 = __esm(async () => {
39107
- await __promiseAll([
39108
- init_app(),
39109
- init_client(),
39110
- init_app(),
39111
- init_client(),
39112
- init_render()
39113
- ]);
38965
+ await init_app();
38966
+ await init_client();
38967
+ await init_app();
38968
+ await init_client();
38969
+ await init_render();
39114
38970
  terminalAdapter = defineNegotiumAdapter({
39115
38971
  name: "terminal",
39116
38972
  capabilities: {
@@ -39648,8 +39504,8 @@ function createTelegramCommandRouter(context) {
39648
39504
  };
39649
39505
  }
39650
39506
  var init_commands2 = __esm(async () => {
39651
- init_telegram_api();
39652
39507
  await init_src();
39508
+ init_telegram_api();
39653
39509
  });
39654
39510
 
39655
39511
  // ../../adapters/telegram/src/mapping-store.ts
@@ -41387,23 +41243,19 @@ Warning: enable the bot administrator permission "Manage Topics" before creating
41387
41243
  }
41388
41244
  var FORUM_TOPIC_NAME_MAX = 128, MAX_PARENT_HOPS = 5, DEFAULT_SEND_TIMEOUT_MS = 60000, PHOTO_EXTS;
41389
41245
  var init_adapter = __esm(async () => {
41246
+ await init_src();
41247
+ await init_commands2();
41248
+ await init_mapping_store();
41249
+ await init_media_intake();
41390
41250
  init_telegram_api();
41391
- await __promiseAll([
41392
- init_src(),
41393
- init_commands2(),
41394
- init_mapping_store(),
41395
- init_media_intake()
41396
- ]);
41397
41251
  PHOTO_EXTS = new Set(["png", "jpg", "jpeg", "gif", "webp"]);
41398
41252
  });
41399
41253
 
41400
41254
  // ../../adapters/telegram/src/index.ts
41401
41255
  var telegramAdapter;
41402
41256
  var init_src7 = __esm(async () => {
41403
- await __promiseAll([
41404
- init_adapter(),
41405
- init_mapping_store()
41406
- ]);
41257
+ await init_adapter();
41258
+ await init_mapping_store();
41407
41259
  telegramAdapter = defineNegotiumAdapter({
41408
41260
  name: "telegram",
41409
41261
  capabilities: {
@@ -41565,12 +41417,10 @@ async function runTelegramCli(args = process.argv.slice(2)) {
41565
41417
  await completed;
41566
41418
  }
41567
41419
  var init_cli2 = __esm(async () => {
41420
+ await init_src();
41421
+ await init_src5();
41568
41422
  init_env_auth();
41569
- await __promiseAll([
41570
- init_src(),
41571
- init_src5(),
41572
- init_src7()
41573
- ]);
41423
+ await init_src7();
41574
41424
  if (false) {}
41575
41425
  });
41576
41426
 
@@ -42277,8 +42127,8 @@ function startCanonicalMcpBridge(options = {}) {
42277
42127
  var MAX_BODY_BYTES, BODY_READ_TIMEOUT_MS = 1e4, MAX_INFLIGHT = 32, CAPABILITY_TTL_MS, MAX_CAPABILITIES = 2048, FORWARD_TIMEOUT_MS = 25000, TOOL_ALLOWLIST;
42278
42128
  var init_canonical_mcp_bridge = __esm(async () => {
42279
42129
  init_canonical_bridge_config();
42280
- init_protocol();
42281
42130
  await init_central();
42131
+ init_protocol();
42282
42132
  MAX_BODY_BYTES = 1024 * 1024;
42283
42133
  CAPABILITY_TTL_MS = 60 * 60 * 1000;
42284
42134
  TOOL_ALLOWLIST = {
@@ -42420,6 +42270,27 @@ function cleanupPeerStateForLocalTopic(localTopicId) {
42420
42270
  return { sessions, turns, terminalOutbox, inboxRequests, remoteAsks };
42421
42271
  })();
42422
42272
  }
42273
+ function sweepStalePeerBindings(topicExists) {
42274
+ const stale = [
42275
+ ...new Set(listPeerSessions().map((row) => row.local_topic_id).filter((localTopicId) => localTopicId && !topicExists(localTopicId)))
42276
+ ];
42277
+ const removed = {
42278
+ sessions: 0,
42279
+ turns: 0,
42280
+ terminalOutbox: 0,
42281
+ inboxRequests: 0,
42282
+ remoteAsks: 0
42283
+ };
42284
+ for (const localTopicId of stale) {
42285
+ const result = cleanupPeerStateForLocalTopic(localTopicId);
42286
+ removed.sessions += result.sessions;
42287
+ removed.turns += result.turns;
42288
+ removed.terminalOutbox += result.terminalOutbox;
42289
+ removed.inboxRequests += result.inboxRequests;
42290
+ removed.remoteAsks += result.remoteAsks;
42291
+ }
42292
+ return { topicIds: stale, removed };
42293
+ }
42423
42294
  function failInterruptedPeerTurnRequestsOnStartup() {
42424
42295
  return db.run(`UPDATE otium_peer_turn_requests
42425
42296
  SET status = 'failed', error = 'worker restarted during turn', updated_at = ?
@@ -42984,12 +42855,10 @@ function stopEventBackflow() {
42984
42855
  }
42985
42856
  var FORWARDED_TYPES, TERMINAL_TYPES, PEER_EVENT_MAX_ATTEMPTS = 5, PEER_EVENT_RETRY_BASE_MS = 100, PEER_EVENT_TIMEOUT_MS = 15000, PEER_EVENT_MAX_PENDING = 256, activeForwarders, unsubscribe = null, terminalOutboxTimer = null, terminalOutboxFlushInFlight = false;
42986
42857
  var init_event_backflow = __esm(async () => {
42858
+ await init_src();
42859
+ await init_central();
42987
42860
  init_protocol();
42988
- await __promiseAll([
42989
- init_src(),
42990
- init_central(),
42991
- init_store2()
42992
- ]);
42861
+ await init_store2();
42993
42862
  FORWARDED_TYPES = new Set([
42994
42863
  "message",
42995
42864
  "message_updated",
@@ -43166,11 +43035,9 @@ function isMcpToolResult(value) {
43166
43035
  }
43167
43036
  var PEER_BRIDGE_TIMEOUT_MS2 = 15000, otiumPeerRuntimeBridge;
43168
43037
  var init_runtime_bridge = __esm(async () => {
43169
- await __promiseAll([
43170
- init_src(),
43171
- init_central(),
43172
- init_event_backflow()
43173
- ]);
43038
+ await init_src();
43039
+ await init_central();
43040
+ await init_event_backflow();
43174
43041
  otiumPeerRuntimeBridge = {
43175
43042
  async flushEvents(localTopicId) {
43176
43043
  const forwarder = getActiveForwarder(localTopicId);
@@ -43665,12 +43532,10 @@ async function acceptRemoteAskReplyResult(args) {
43665
43532
  }
43666
43533
  var PEER_TIMEOUT_MS = 15000, PENDING_ASK_TTL_MS2, peerReplyFlush = null, otiumPeerSessionBridge;
43667
43534
  var init_session_bridge = __esm(async () => {
43535
+ await init_src();
43536
+ await init_central();
43668
43537
  init_protocol();
43669
- await __promiseAll([
43670
- init_src(),
43671
- init_central(),
43672
- init_store2()
43673
- ]);
43538
+ await init_store2();
43674
43539
  PENDING_ASK_TTL_MS2 = 15 * 60 * 1000;
43675
43540
  otiumPeerSessionBridge = { forward, sessions, reply };
43676
43541
  });
@@ -44065,13 +43930,11 @@ function acceptSharedTopicMessages(messages, localTopicId, sourceNode) {
44065
43930
  }
44066
43931
  var RETRY_MS = 1000;
44067
43932
  var init_shared_topic_sync = __esm(async () => {
43933
+ await init_src();
43934
+ await init_central();
43935
+ await init_event_backflow();
44068
43936
  init_protocol();
44069
- await __promiseAll([
44070
- init_src(),
44071
- init_central(),
44072
- init_event_backflow(),
44073
- init_store2()
44074
- ]);
43937
+ await init_store2();
44075
43938
  });
44076
43939
 
44077
43940
  // ../../adapters/otium/src/relay-protocol.ts
@@ -44741,10 +44604,8 @@ function listOtiumTopicBindings() {
44741
44604
  });
44742
44605
  }
44743
44606
  var init_bindings = __esm(async () => {
44744
- await __promiseAll([
44745
- init_src(),
44746
- init_store2()
44747
- ]);
44607
+ await init_src();
44608
+ await init_store2();
44748
44609
  });
44749
44610
 
44750
44611
  // ../../adapters/otium/src/enrollment.ts
@@ -44984,10 +44845,8 @@ function commitEnrollment(join43, options = {}) {
44984
44845
  }
44985
44846
  var INFO;
44986
44847
  var init_enrollment = __esm(async () => {
44987
- await __promiseAll([
44988
- init_src(),
44989
- init_join()
44990
- ]);
44848
+ await init_src();
44849
+ await init_join();
44991
44850
  INFO = Buffer.from("otium-node-enrollment-v1", "utf8");
44992
44851
  });
44993
44852
 
@@ -45183,12 +45042,10 @@ function abortHostedPeerTurn(hostNodeId, requestId, userId, topicTitle) {
45183
45042
  }
45184
45043
  var EFFORT_LEVELS, turnTrigger;
45185
45044
  var init_turn_bridge = __esm(async () => {
45186
- await __promiseAll([
45187
- init_src(),
45188
- init_event_backflow(),
45189
- init_peer_files(),
45190
- init_store2()
45191
- ]);
45045
+ await init_src();
45046
+ await init_event_backflow();
45047
+ await init_peer_files();
45048
+ await init_store2();
45192
45049
  EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
45193
45050
  });
45194
45051
 
@@ -45842,17 +45699,15 @@ async function handleOtiumPeerRequest(req) {
45842
45699
  }
45843
45700
  var RUNTIME_VERSION;
45844
45701
  var init_peer_server = __esm(async () => {
45702
+ await init_src();
45703
+ await init_bindings();
45704
+ await init_central();
45705
+ await init_peer_files();
45845
45706
  init_protocol();
45846
- await __promiseAll([
45847
- init_src(),
45848
- init_bindings(),
45849
- init_central(),
45850
- init_peer_files(),
45851
- init_session_bridge(),
45852
- init_shared_topic_sync(),
45853
- init_store2(),
45854
- init_turn_bridge()
45855
- ]);
45707
+ await init_session_bridge();
45708
+ await init_shared_topic_sync();
45709
+ await init_store2();
45710
+ await init_turn_bridge();
45856
45711
  RUNTIME_VERSION = NEGOTIUM_VERSION;
45857
45712
  });
45858
45713
 
@@ -45864,6 +45719,10 @@ function startOtiumNodeRuntime(options) {
45864
45719
  if (failed > 0) {
45865
45720
  logger.warn({ failed }, "otium: failed interrupted peer turns from previous process");
45866
45721
  }
45722
+ const staleBindings = sweepStalePeerBindings((localTopicId) => getTopic(localTopicId) !== null);
45723
+ if (staleBindings.topicIds.length > 0) {
45724
+ logger.info({ topicIds: staleBindings.topicIds, ...staleBindings.removed }, "otium: removed peer state for local topics deleted while this node was offline");
45725
+ }
45867
45726
  const stopBackflow = startEventBackflow();
45868
45727
  const stopSharedTopicSync = startSharedTopicSync(join43);
45869
45728
  const unregisterRuntimeBridge = registerPeerRuntimeBridge(otiumPeerRuntimeBridge);
@@ -45950,33 +45809,31 @@ function startOtiumAdapter(options) {
45950
45809
  }
45951
45810
  var otiumAdapter;
45952
45811
  var init_src8 = __esm(async () => {
45812
+ await init_src();
45813
+ await init_canonical_mcp_bridge();
45814
+ await init_central();
45815
+ await init_event_backflow();
45816
+ await init_join();
45817
+ await init_peer_files();
45818
+ await init_runtime_bridge();
45819
+ await init_session_bridge();
45953
45820
  init_session_bridge_ipc();
45821
+ await init_shared_topic_sync();
45822
+ await init_store2();
45954
45823
  init_tunnel_client();
45824
+ await init_bindings();
45825
+ await init_central();
45826
+ await init_enrollment();
45827
+ await init_event_backflow();
45828
+ await init_join();
45829
+ await init_peer_server();
45955
45830
  init_protocol();
45956
45831
  init_relay_protocol();
45832
+ await init_runtime_bridge();
45833
+ await init_shared_topic_sync();
45834
+ await init_store2();
45957
45835
  init_tunnel_client();
45958
- await __promiseAll([
45959
- init_src(),
45960
- init_canonical_mcp_bridge(),
45961
- init_central(),
45962
- init_event_backflow(),
45963
- init_join(),
45964
- init_peer_files(),
45965
- init_runtime_bridge(),
45966
- init_session_bridge(),
45967
- init_shared_topic_sync(),
45968
- init_store2(),
45969
- init_bindings(),
45970
- init_central(),
45971
- init_enrollment(),
45972
- init_event_backflow(),
45973
- init_join(),
45974
- init_peer_server(),
45975
- init_runtime_bridge(),
45976
- init_shared_topic_sync(),
45977
- init_store2(),
45978
- init_turn_bridge()
45979
- ]);
45836
+ await init_turn_bridge();
45980
45837
  otiumAdapter = defineNegotiumAdapter({
45981
45838
  name: "otium",
45982
45839
  capabilities: {
@@ -46036,13 +45893,11 @@ function mountConfiguredOtiumNodeRuntime() {
46036
45893
  };
46037
45894
  }
46038
45895
  var init_node_runtime = __esm(async () => {
45896
+ await init_src();
45897
+ await init_src8();
45898
+ await init_join();
45899
+ await init_peer_server();
46039
45900
  init_protocol();
46040
- await __promiseAll([
46041
- init_src(),
46042
- init_src8(),
46043
- init_join(),
46044
- init_peer_server()
46045
- ]);
46046
45901
  });
46047
45902
 
46048
45903
  // ../../adapters/otium/src/join-cli.ts
@@ -46139,11 +45994,9 @@ async function joinCommand(args) {
46139
45994
  console.log("\nnext: `negotium-otium serve` (mounts the otium peer routes automatically)");
46140
45995
  }
46141
45996
  var init_join_cli = __esm(async () => {
46142
- await __promiseAll([
46143
- init_central(),
46144
- init_enrollment(),
46145
- init_join()
46146
- ]);
45997
+ await init_central();
45998
+ await init_enrollment();
45999
+ await init_join();
46147
46000
  });
46148
46001
 
46149
46002
  // ../../adapters/otium/src/sidecar.ts
@@ -46233,13 +46086,11 @@ async function runOtiumSidecar(options) {
46233
46086
  await completed;
46234
46087
  }
46235
46088
  var init_sidecar = __esm(async () => {
46089
+ await init_src();
46090
+ await init_src5();
46091
+ await init_join();
46236
46092
  init_protocol();
46237
46093
  init_tunnel_client();
46238
- await __promiseAll([
46239
- init_src(),
46240
- init_src5(),
46241
- init_join()
46242
- ]);
46243
46094
  });
46244
46095
 
46245
46096
  // ../../adapters/otium/src/cli.ts
@@ -46895,10 +46746,8 @@ async function cronCommand(args) {
46895
46746
  }
46896
46747
  var USER_ID = "local";
46897
46748
  var init_cron = __esm(async () => {
46898
- await __promiseAll([
46899
- init_src(),
46900
- init_src4()
46901
- ]);
46749
+ await init_src();
46750
+ await init_src4();
46902
46751
  });
46903
46752
 
46904
46753
  // ../cli/src/adapter-loader.ts
@@ -47161,4 +47010,4 @@ switch (command) {
47161
47010
  }
47162
47011
  }
47163
47012
 
47164
- //# debugId=69B455239128A0A264756E2164756E21
47013
+ //# debugId=5D43DAEFFAA3D35464756E2164756E21