negotium 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/agent-helpers.js +233 -307
  2. package/dist/agent-helpers.js.map +3 -3
  3. package/dist/background-bash.js.map +1 -1
  4. package/dist/browser-runtime.js +17 -1
  5. package/dist/browser-runtime.js.map +2 -2
  6. package/dist/canonical-mcp-bridge.js +1 -1
  7. package/dist/{chunk-g2kqfdwm.js → chunk-rhp26p2c.js} +18 -3
  8. package/dist/{chunk-g2kqfdwm.js.map → chunk-rhp26p2c.js.map} +2 -2
  9. package/dist/{chunk-r0xs3t81.js → chunk-s2gez3wg.js} +18 -3
  10. package/dist/{chunk-r0xs3t81.js.map → chunk-s2gez3wg.js.map} +2 -2
  11. package/dist/hosted-agent.js +4 -3
  12. package/dist/hosted-agent.js.map +3 -3
  13. package/dist/main.js +645 -722
  14. package/dist/main.js.map +10 -9
  15. package/dist/mcp-catalog.js.map +1 -1
  16. package/dist/mcp-factories.js +219 -287
  17. package/dist/mcp-factories.js.map +3 -3
  18. package/dist/outbox.js.map +1 -1
  19. package/dist/platform-runtime.js.map +1 -1
  20. package/dist/prompts.js.map +1 -1
  21. package/dist/query-runtime.js +17 -1
  22. package/dist/query-runtime.js.map +2 -2
  23. package/dist/registry.js +4 -3
  24. package/dist/registry.js.map +3 -3
  25. package/dist/rollout.js +1 -1
  26. package/dist/runtime/src/node-host.ts +1 -1
  27. package/dist/runtime/src/version.ts +1 -1
  28. package/dist/runtime-helpers.js +17 -1
  29. package/dist/runtime-helpers.js.map +2 -2
  30. package/dist/sqlite.js +17 -1
  31. package/dist/sqlite.js.map +2 -2
  32. package/dist/storage.js +17 -6
  33. package/dist/storage.js.map +2 -2
  34. package/dist/types/packages/core/src/version.d.ts +1 -1
  35. package/dist/vault.js +17 -1
  36. package/dist/vault.js.map +2 -2
  37. package/package.json +1 -1
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.22";
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
@@ -22934,6 +22842,7 @@ __export(exports_node_host, {
22934
22842
  killOwnedCodexTreesForShutdown: () => killOwnedCodexTreesForShutdown,
22935
22843
  killAllPlaywright: () => killAllPlaywright,
22936
22844
  killAllBgBash: () => killAllBgBash,
22845
+ isTopicShared: () => isTopicShared,
22937
22846
  isParticipant: () => isParticipant,
22938
22847
  getVisibleTopics: () => getVisibleTopics,
22939
22848
  getTopicStats: () => getTopicStats,
@@ -22961,41 +22870,39 @@ __export(exports_node_host, {
22961
22870
  });
22962
22871
  var init_node_host = __esm(async () => {
22963
22872
  init_codex_tree_kill();
22873
+ await init_ask_user();
22874
+ await init_spawn_subagent();
22875
+ await init_submit_runtime_gateway_turn();
22876
+ await init_submit_user_message();
22877
+ await init_switch_topic_access_mode();
22878
+ await init_switch_topic_effort();
22879
+ await init_switch_topic_model();
22880
+ await init_topic_service();
22881
+ await init_vault_command();
22882
+ await init_bus();
22964
22883
  init_runtime_spec();
22965
22884
  init_manager();
22966
22885
  init_config();
22967
22886
  init_lifecycle2();
22968
22887
  init_logger();
22969
22888
  init_mcp_config();
22889
+ await init_modules();
22970
22890
  init_node_plugins();
22891
+ await init_manager2();
22892
+ await init_active_rooms();
22893
+ await init_background_sessions();
22894
+ await init_bashrs_completions();
22971
22895
  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
- ]);
22896
+ await init_inbox();
22897
+ await init_turn_runner();
22898
+ await init_api_messages();
22899
+ await init_api_topics();
22900
+ await init_runtime_events();
22901
+ await init_runtime_process_leases();
22902
+ await init_token_stats();
22903
+ await init_derive();
22904
+ await init_personal_general();
22905
+ await init_session();
22999
22906
  });
23000
22907
 
23001
22908
  // ../../packages/core/src/agents/mcp-tools/inline-assets.ts
@@ -23299,34 +23206,32 @@ __export(exports_mcp_runtime_host, {
23299
23206
  EFFORT_VALUES: () => EFFORT_VALUES
23300
23207
  });
23301
23208
  var init_mcp_runtime_host = __esm(async () => {
23209
+ await init_ask_user();
23302
23210
  init_common();
23303
23211
  init_publish_html();
23212
+ await init_self_config();
23213
+ await init_spawn_subagent();
23304
23214
  init_visuals2();
23215
+ await init_bus();
23305
23216
  init_runtime_spec();
23306
23217
  init_config();
23307
23218
  init_constants();
23308
23219
  init_jsonl();
23309
23220
  init_logger();
23310
23221
  init_mcp_config();
23222
+ await init_active_rooms();
23311
23223
  init_session_inbox_path();
23224
+ await init_delivery_ack();
23312
23225
  init_file_hooks();
23313
23226
  init_sensitive_path();
23227
+ await init_api_messages();
23228
+ await init_api_topic_config();
23229
+ await init_api_topics();
23230
+ await init_create();
23231
+ await init_derive();
23232
+ await init_lifecycle();
23233
+ await init_session();
23314
23234
  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
23235
  });
23331
23236
 
23332
23237
  // ../../packages/mcp/src/node-tools.ts
@@ -23598,8 +23503,8 @@ ${renderTaskList(tasks2)}`);
23598
23503
  }
23599
23504
  var defaultTaskMcpHost;
23600
23505
  var init_task = __esm(async () => {
23601
- init_mcp_helpers();
23602
23506
  await init_tasks();
23507
+ init_mcp_helpers();
23603
23508
  defaultTaskMcpHost = {
23604
23509
  readTasks,
23605
23510
  writeTasks
@@ -24140,11 +24045,11 @@ ${lines.join(`
24140
24045
  var AGENTS, MAX_CONCURRENT_CHECKS = 2, activeChecks = 0, checkWaiters, activeCheckAllUsers;
24141
24046
  var init_agent_health = __esm(async () => {
24142
24047
  init_claude_registry();
24048
+ await init_codex_registry();
24143
24049
  init_maestro_registry();
24144
24050
  init_config();
24145
24051
  init_jsonl();
24146
24052
  init_mcp_helpers();
24147
- await init_codex_registry();
24148
24053
  AGENTS = [
24149
24054
  { kind: "claude", registry: claudeRegistry, checker: checkClaude },
24150
24055
  { kind: "codex", registry: codexRegistry, checker: checkCodex },
@@ -24181,10 +24086,8 @@ function canSubagentTellTargetByName(identity, target) {
24181
24086
  return canSubagentTellTarget(identity, resolved.id);
24182
24087
  }
24183
24088
  var init_tell_permissions = __esm(async () => {
24184
- await __promiseAll([
24185
- init_spawn_subagent(),
24186
- init_api_topics()
24187
- ]);
24089
+ await init_spawn_subagent();
24090
+ await init_api_topics();
24188
24091
  });
24189
24092
 
24190
24093
  // ../../packages/core/src/mcp/factories/session-comm.ts
@@ -24339,10 +24242,8 @@ async function deleteManagedBrowserProfile(ownerId, rawProfile) {
24339
24242
  };
24340
24243
  }
24341
24244
  var init_profile_management = __esm(async () => {
24342
- await __promiseAll([
24343
- init_manager2(),
24344
- init_browser_profiles()
24345
- ]);
24245
+ await init_manager2();
24246
+ await init_browser_profiles();
24346
24247
  });
24347
24248
 
24348
24249
  // ../../packages/core/src/mcp/session-comm/default-host.ts
@@ -24672,20 +24573,18 @@ ${entries.join(`
24672
24573
  }
24673
24574
  var MAX_MESSAGE_LENGTH = 1e4;
24674
24575
  var init_default_host = __esm(async () => {
24576
+ await init_tell_permissions();
24675
24577
  init_config();
24676
24578
  init_jsonl();
24677
24579
  init_mcp_config();
24580
+ await init_manager2();
24581
+ await init_profile_management();
24678
24582
  init_session_inbox_path();
24583
+ await init_api_topic_config();
24584
+ await init_api_topics();
24585
+ await init_browser_profiles();
24586
+ await init_session_asks();
24679
24587
  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
24588
  });
24690
24589
 
24691
24590
  // ../../packages/core/src/mcp/vault-http.ts
@@ -26697,9 +26596,9 @@ function createWikiMcpServer(context, host2) {
26697
26596
  }
26698
26597
  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
26598
  var init_wiki_server = __esm(async () => {
26599
+ await init_wiki_search_index();
26700
26600
  init_config();
26701
26601
  init_wiki_summary_names();
26702
- await init_wiki_search_index();
26703
26602
  wikiRuntime = new AsyncLocalStorage3;
26704
26603
  lockWaitArray = new Int32Array(new SharedArrayBuffer(4));
26705
26604
  SEARCH_STOP_WORDS = new Set([
@@ -27304,11 +27203,9 @@ function flushSessionCache() {
27304
27203
  }
27305
27204
  var init_schema = __esm(async () => {
27306
27205
  init_logger();
27206
+ await init_forum_db();
27207
+ await init_storage_host();
27307
27208
  init_types();
27308
- await __promiseAll([
27309
- init_forum_db(),
27310
- init_storage_host()
27311
- ]);
27312
27209
  registerStorageSchemaInitializer(initializeForumSchema, 10);
27313
27210
  });
27314
27211
 
@@ -27525,9 +27422,9 @@ __export(exports_forum, {
27525
27422
  addTopic: () => addTopic
27526
27423
  });
27527
27424
  var init_forum = __esm(async () => {
27528
- await init_schema();
27529
27425
  init_agent_settings();
27530
27426
  init_repository();
27427
+ await init_schema();
27531
27428
  });
27532
27429
 
27533
27430
  // ../../packages/core/src/storage/storage-public-host.ts
@@ -27577,8 +27474,8 @@ function setTopicAgentAndClearSession(opts) {
27577
27474
  return changed;
27578
27475
  }
27579
27476
  var init_topic_settings = __esm(async () => {
27580
- init_types();
27581
27477
  await init_forum_db();
27478
+ init_types();
27582
27479
  });
27583
27480
 
27584
27481
  // ../../packages/core/src/storage/storage-public.ts
@@ -27781,45 +27678,43 @@ __export(exports_storage_public, {
27781
27678
  ConversationLogDivergedError: () => ConversationLogDivergedError
27782
27679
  });
27783
27680
  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
- ]);
27681
+ await init_activity_log();
27806
27682
  init_activity_log();
27683
+ await init_api_messages();
27807
27684
  init_api_messages();
27685
+ await init_api_topic_brief();
27808
27686
  init_api_topic_brief();
27687
+ await init_api_topic_config();
27809
27688
  init_api_topic_config();
27689
+ await init_api_topics();
27810
27690
  init_api_topics();
27691
+ await init_app_settings();
27811
27692
  init_app_settings();
27693
+ await init_ask_user_gates();
27812
27694
  init_ask_user_gates();
27695
+ await init_conversations();
27813
27696
  init_conversations();
27697
+ await init_forum();
27698
+ await init_forum();
27699
+ await init_runtime_process_leases();
27814
27700
  init_runtime_process_leases();
27701
+ await init_session_asks();
27815
27702
  init_session_asks();
27703
+ await init_storage_public_host();
27704
+ await init_tasks();
27816
27705
  init_tasks();
27706
+ await init_token_stats();
27817
27707
  init_token_stats();
27708
+ await init_topic_archive();
27818
27709
  init_topic_archive();
27710
+ await init_topic_archive_state();
27819
27711
  init_topic_archive_state();
27712
+ await init_topic_settings();
27820
27713
  init_topic_settings();
27714
+ await init_wiki();
27821
27715
  init_wiki();
27822
27716
  init_wiki_summary_names();
27717
+ init_wiki_summary_names();
27823
27718
  });
27824
27719
 
27825
27720
  // ../../packages/mcp/src/hosted-surfaces.ts
@@ -28523,12 +28418,10 @@ async function handleNegotiumMcpRequest(req) {
28523
28418
  }
28524
28419
  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
28420
  var init_server = __esm(async () => {
28421
+ await init_mcp_runtime_host();
28526
28422
  init_hosted_surfaces();
28423
+ await init_node_tools();
28527
28424
  init_sse_transport();
28528
- await __promiseAll([
28529
- init_mcp_runtime_host(),
28530
- init_node_tools()
28531
- ]);
28532
28425
  SSE_PATH = `${RUNTIME_MCP_BASE_PATH}/sse`;
28533
28426
  SSE_MESSAGE_PATH = `${RUNTIME_MCP_BASE_PATH}/message`;
28534
28427
  STREAMABLE_PATH = `${RUNTIME_MCP_BASE_PATH}/mcp`;
@@ -28541,12 +28434,10 @@ var init_server = __esm(async () => {
28541
28434
 
28542
28435
  // ../../packages/mcp/src/index.ts
28543
28436
  var init_src2 = __esm(async () => {
28437
+ await init_mcp_runtime_host();
28438
+ await init_node_tools();
28439
+ await init_server();
28544
28440
  init_sse_transport();
28545
- await __promiseAll([
28546
- init_mcp_runtime_host(),
28547
- init_node_tools(),
28548
- init_server()
28549
- ]);
28550
28441
  });
28551
28442
 
28552
28443
  // ../../packages/mcp-host/src/paths.ts
@@ -29550,7 +29441,8 @@ function createNodeControlHandler(options) {
29550
29441
  "turn-submit-idempotent",
29551
29442
  "turn-events-sse-resume",
29552
29443
  "canonical-topic-read",
29553
- "canonical-message-read"
29444
+ "canonical-message-read",
29445
+ "canonical-topic-list"
29554
29446
  ],
29555
29447
  cursor: latestRuntimeEventSeq()
29556
29448
  });
@@ -29614,6 +29506,19 @@ function createNodeControlHandler(options) {
29614
29506
  });
29615
29507
  return Response.json({ ok: true, v: NODE_RUNTIME_CONTRACT_VERSION, ...result });
29616
29508
  }
29509
+ if (req.method === "GET" && runtimePath === "/topics") {
29510
+ const accessMode = url.searchParams.get("accessMode")?.trim();
29511
+ if (accessMode && accessMode !== "shared" && accessMode !== "private") {
29512
+ return jsonError(400, "accessMode must be 'shared' or 'private'");
29513
+ }
29514
+ const topics = getVisibleTopics().filter((topic) => accessMode === "shared" ? isTopicShared(topic) : accessMode === "private" ? !isTopicShared(topic) : true);
29515
+ return Response.json({
29516
+ ok: true,
29517
+ v: NODE_RUNTIME_CONTRACT_VERSION,
29518
+ topics,
29519
+ cursor: latestRuntimeEventSeq()
29520
+ });
29521
+ }
29617
29522
  const runtimeTopicMatch = runtimePath.match(/^\/topics\/([^/]+)$/);
29618
29523
  if (runtimeTopicMatch && req.method === "GET") {
29619
29524
  const topic = getTopic(decodeURIComponent(runtimeTopicMatch[1]));
@@ -30016,10 +29921,8 @@ async function stopNodeDaemon(timeoutMs = 3000) {
30016
29921
  }
30017
29922
  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
29923
  var init_control = __esm(async () => {
30019
- await __promiseAll([
30020
- init_node_host(),
30021
- init_files()
30022
- ]);
29924
+ await init_node_host();
29925
+ await init_files();
30023
29926
  NODE_RUNTIME_CONTRACT_BASE_PATH = `${NODE_CONTROL_BASE_PATH}/runtime/v1`;
30024
29927
  NODE_DAEMON_INFO_PATH = resolve21(RUN_DIR, "node-daemon.json");
30025
29928
  NODE_VERSION = NEGOTIUM_VERSION;
@@ -30039,21 +29942,19 @@ function runSingletonStartupMaintenance(maintenance) {
30039
29942
 
30040
29943
  // ../../packages/core/src/cron-host.ts
30041
29944
  var init_cron_host = __esm(async () => {
29945
+ await init_topic_cleanup();
29946
+ await init_bus();
30042
29947
  init_config();
30043
29948
  init_logger();
30044
29949
  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
- ]);
29950
+ await init_active_rooms();
29951
+ await init_background_sessions();
29952
+ await init_turn_runner();
29953
+ await init_api_messages();
29954
+ await init_api_topics();
29955
+ await init_forum_db();
29956
+ await init_runtime_leases();
29957
+ await init_derive();
30057
29958
  });
30058
29959
 
30059
29960
  // ../../packages/module-cron/src/schedule.ts
@@ -30940,11 +30841,9 @@ function finalizeOrphanedCronRuns(now = new Date) {
30940
30841
  }
30941
30842
  var schemaReady = false, db3;
30942
30843
  var init_store = __esm(async () => {
30844
+ await init_cron_host();
30943
30845
  init_schedule();
30944
- await __promiseAll([
30945
- init_cron_host(),
30946
- init_scripts()
30947
- ]);
30846
+ await init_scripts();
30948
30847
  db3 = db;
30949
30848
  });
30950
30849
 
@@ -31016,10 +30915,8 @@ function listCronBackgroundSessions(userId) {
31016
30915
  });
31017
30916
  }
31018
30917
  var init_background_sessions2 = __esm(async () => {
31019
- await __promiseAll([
31020
- init_cron_host(),
31021
- init_store()
31022
- ]);
30918
+ await init_cron_host();
30919
+ await init_store();
31023
30920
  });
31024
30921
 
31025
30922
  // ../../packages/module-cron/src/host.ts
@@ -31131,11 +31028,9 @@ async function rotateCronTopicContext(topicId, retainTurns = CRON_CONTEXT_RETAIN
31131
31028
  }
31132
31029
  var CRON_CONTEXT_ROTATE_EVERY = 5, CRON_CONTEXT_RETAIN_TURNS = 5;
31133
31030
  var init_context2 = __esm(async () => {
31134
- await __promiseAll([
31135
- init_cron_host(),
31136
- init_host(),
31137
- init_store()
31138
- ]);
31031
+ await init_cron_host();
31032
+ await init_host();
31033
+ await init_store();
31139
31034
  });
31140
31035
 
31141
31036
  // ../../packages/module-cron/src/scheduler.ts
@@ -31470,12 +31365,10 @@ class CronScheduler {
31470
31365
  }
31471
31366
  var DEFAULT_POLL_INTERVAL_MS = 1000, DEFAULT_RUN_TIMEOUT_MS, DEFAULT_QUEUE_TIMEOUT_MS;
31472
31367
  var init_scheduler = __esm(async () => {
31473
- await __promiseAll([
31474
- init_cron_host(),
31475
- init_context2(),
31476
- init_host(),
31477
- init_store()
31478
- ]);
31368
+ await init_cron_host();
31369
+ await init_context2();
31370
+ await init_host();
31371
+ await init_store();
31479
31372
  DEFAULT_RUN_TIMEOUT_MS = 10 * 60000;
31480
31373
  DEFAULT_QUEUE_TIMEOUT_MS = 5 * 60000;
31481
31374
  });
@@ -31598,15 +31491,13 @@ function createCronModule(options = {}) {
31598
31491
  }
31599
31492
  var SOURCE_MCP_SERVER_FILE, PACKAGED_MCP_SERVER_FILE;
31600
31493
  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
- ]);
31494
+ await init_cron_host();
31495
+ await init_background_sessions2();
31496
+ await init_context2();
31497
+ await init_host();
31498
+ await init_scheduler();
31499
+ await init_scripts();
31500
+ await init_store();
31610
31501
  SOURCE_MCP_SERVER_FILE = fileURLToPath2(new URL("./mcp-server.ts", import.meta.url));
31611
31502
  PACKAGED_MCP_SERVER_FILE = fileURLToPath2(new URL("./runtime/cron/mcp-server.ts", import.meta.url));
31612
31503
  });
@@ -31694,10 +31585,8 @@ function queueCronPromptSummary(jobId, prompt, summarize = summarizeCronPrompt)
31694
31585
  }
31695
31586
  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
31587
  var init_summarize = __esm(async () => {
31697
- await __promiseAll([
31698
- init_cron_host(),
31699
- init_store()
31700
- ]);
31588
+ await init_cron_host();
31589
+ await init_store();
31701
31590
  generations = new Map;
31702
31591
  pending = [];
31703
31592
  });
@@ -31767,17 +31656,15 @@ __export(exports_src2, {
31767
31656
  CRON_CONTEXT_RETAIN_TURNS: () => CRON_CONTEXT_RETAIN_TURNS
31768
31657
  });
31769
31658
  var init_src4 = __esm(async () => {
31659
+ await init_background_sessions2();
31660
+ await init_context2();
31661
+ await init_host();
31662
+ await init_module();
31770
31663
  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
- ]);
31664
+ await init_scheduler();
31665
+ await init_scripts();
31666
+ await init_store();
31667
+ await init_summarize();
31781
31668
  });
31782
31669
 
31783
31670
  // ../../packages/node/src/index.ts
@@ -32034,16 +31921,14 @@ async function runNodeDaemon(opts = {}) {
32034
31921
  process.exit(0);
32035
31922
  }
32036
31923
  var init_src5 = __esm(async () => {
31924
+ await init_conversation_migration();
31925
+ await init_node_host();
31926
+ await init_src2();
32037
31927
  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
- ]);
31928
+ await init_control();
31929
+ await init_files();
31930
+ await init_control();
31931
+ await init_files();
32047
31932
  });
32048
31933
 
32049
31934
  // ../../packages/adapter-sdk/src/index.ts
@@ -32945,8 +32830,8 @@ function applyRuntimeEvent(state, event) {
32945
32830
  }
32946
32831
  var NO_TOPIC_PICKER_SELECTION = -1;
32947
32832
  var init_state2 = __esm(async () => {
32948
- init_subagent_graph();
32949
32833
  await init_src();
32834
+ init_subagent_graph();
32950
32835
  });
32951
32836
 
32952
32837
  // ../../adapters/terminal/src/context-usage.ts
@@ -33002,10 +32887,8 @@ function activeContextBreakdown(state) {
33002
32887
  };
33003
32888
  }
33004
32889
  var init_context_usage = __esm(async () => {
33005
- await __promiseAll([
33006
- init_src(),
33007
- init_state2()
33008
- ]);
32890
+ await init_src();
32891
+ await init_state2();
33009
32892
  });
33010
32893
 
33011
32894
  // ../../adapters/terminal/src/path-suggest.ts
@@ -35081,16 +34964,14 @@ var theme, WORKING_FRAMES, CODE_COPY_MARKER = "\u29C9", WORKING_FRAME_INTERVAL_M
35081
34964
  }
35082
34965
  }, 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
34966
  var init_render = __esm(async () => {
34967
+ await init_src();
35084
34968
  init_color_depth();
35085
34969
  init_commands();
34970
+ await init_context_usage();
35086
34971
  init_path_suggest();
34972
+ await init_state2();
35087
34973
  init_terminal_width();
35088
34974
  init_terminal_width();
35089
- await __promiseAll([
35090
- init_src(),
35091
- init_context_usage(),
35092
- init_state2()
35093
- ]);
35094
34975
  theme = {
35095
34976
  canvas: [10, 11, 15],
35096
34977
  surface: [18, 20, 27],
@@ -35387,11 +35268,9 @@ function topicFilterPasteText(payload) {
35387
35268
  }
35388
35269
  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
35270
  var init_app_helpers = __esm(async () => {
35390
- await __promiseAll([
35391
- init_src(),
35392
- init_render(),
35393
- init_state2()
35394
- ]);
35271
+ await init_src();
35272
+ await init_render();
35273
+ await init_state2();
35395
35274
  MESSAGE_MUTATING_AI_STATUS_KINDS = new Set(["tool_call", "tool_output"]);
35396
35275
  SGR_MOUSE_PATTERN = new RegExp("\\u001b\\[<(\\d{1,5});(\\d{1,5});(\\d{1,5})([mM])", "g");
35397
35276
  OSC_PATTERN = new RegExp(`${ESC2}\\][^${BEL}${ESC2}]{0,1024}(?:${BEL}|${ESC2}\\\\)`, "g");
@@ -35988,12 +35867,10 @@ class RemoteNegotiumClient {
35988
35867
  }
35989
35868
  var MESSAGE_HISTORY_PAGE_SIZE = 50, INITIAL_MESSAGE_HISTORY_PAGE_COUNT = 3, INITIAL_MESSAGE_HISTORY_LIMIT;
35990
35869
  var init_client = __esm(async () => {
35991
- await __promiseAll([
35992
- init_src(),
35993
- init_storage_public(),
35994
- init_src5(),
35995
- init_history_store()
35996
- ]);
35870
+ await init_src();
35871
+ await init_storage_public();
35872
+ await init_src5();
35873
+ await init_history_store();
35997
35874
  INITIAL_MESSAGE_HISTORY_LIMIT = MESSAGE_HISTORY_PAGE_SIZE * INITIAL_MESSAGE_HISTORY_PAGE_COUNT;
35998
35875
  });
35999
35876
 
@@ -36405,11 +36282,9 @@ async function runTerminalCommand(commandLine, context) {
36405
36282
  context.queueRender();
36406
36283
  }
36407
36284
  var init_command_router = __esm(async () => {
36408
- await __promiseAll([
36409
- init_src(),
36410
- init_app_helpers(),
36411
- init_state2()
36412
- ]);
36285
+ await init_src();
36286
+ await init_app_helpers();
36287
+ await init_state2();
36413
36288
  });
36414
36289
 
36415
36290
  // ../../adapters/terminal/src/screen-renderer.ts
@@ -39050,22 +38925,20 @@ class TerminalApp {
39050
38925
  }
39051
38926
  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
38927
  var init_app = __esm(async () => {
38928
+ await init_src();
38929
+ await init_app_helpers();
38930
+ await init_client();
39053
38931
  init_color_depth();
38932
+ await init_command_router();
39054
38933
  init_commands();
39055
38934
  init_path_suggest();
38935
+ await init_render();
39056
38936
  init_screen_renderer();
39057
38937
  init_selection();
38938
+ await init_state2();
39058
38939
  init_subagent_graph();
39059
38940
  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
- ]);
38941
+ await init_app_helpers();
39069
38942
  CANVAS_RGB = [10, 11, 15];
39070
38943
  ENTER_ALT_SCREEN = altScreenSequences().enter;
39071
38944
  EXIT_ALT_SCREEN = altScreenSequences().exit;
@@ -39104,13 +38977,11 @@ function startTerminalAdapter(options) {
39104
38977
  }
39105
38978
  var terminalAdapter;
39106
38979
  var init_src6 = __esm(async () => {
39107
- await __promiseAll([
39108
- init_app(),
39109
- init_client(),
39110
- init_app(),
39111
- init_client(),
39112
- init_render()
39113
- ]);
38980
+ await init_app();
38981
+ await init_client();
38982
+ await init_app();
38983
+ await init_client();
38984
+ await init_render();
39114
38985
  terminalAdapter = defineNegotiumAdapter({
39115
38986
  name: "terminal",
39116
38987
  capabilities: {
@@ -39648,8 +39519,8 @@ function createTelegramCommandRouter(context) {
39648
39519
  };
39649
39520
  }
39650
39521
  var init_commands2 = __esm(async () => {
39651
- init_telegram_api();
39652
39522
  await init_src();
39523
+ init_telegram_api();
39653
39524
  });
39654
39525
 
39655
39526
  // ../../adapters/telegram/src/mapping-store.ts
@@ -41387,23 +41258,19 @@ Warning: enable the bot administrator permission "Manage Topics" before creating
41387
41258
  }
41388
41259
  var FORUM_TOPIC_NAME_MAX = 128, MAX_PARENT_HOPS = 5, DEFAULT_SEND_TIMEOUT_MS = 60000, PHOTO_EXTS;
41389
41260
  var init_adapter = __esm(async () => {
41261
+ await init_src();
41262
+ await init_commands2();
41263
+ await init_mapping_store();
41264
+ await init_media_intake();
41390
41265
  init_telegram_api();
41391
- await __promiseAll([
41392
- init_src(),
41393
- init_commands2(),
41394
- init_mapping_store(),
41395
- init_media_intake()
41396
- ]);
41397
41266
  PHOTO_EXTS = new Set(["png", "jpg", "jpeg", "gif", "webp"]);
41398
41267
  });
41399
41268
 
41400
41269
  // ../../adapters/telegram/src/index.ts
41401
41270
  var telegramAdapter;
41402
41271
  var init_src7 = __esm(async () => {
41403
- await __promiseAll([
41404
- init_adapter(),
41405
- init_mapping_store()
41406
- ]);
41272
+ await init_adapter();
41273
+ await init_mapping_store();
41407
41274
  telegramAdapter = defineNegotiumAdapter({
41408
41275
  name: "telegram",
41409
41276
  capabilities: {
@@ -41565,12 +41432,10 @@ async function runTelegramCli(args = process.argv.slice(2)) {
41565
41432
  await completed;
41566
41433
  }
41567
41434
  var init_cli2 = __esm(async () => {
41435
+ await init_src();
41436
+ await init_src5();
41568
41437
  init_env_auth();
41569
- await __promiseAll([
41570
- init_src(),
41571
- init_src5(),
41572
- init_src7()
41573
- ]);
41438
+ await init_src7();
41574
41439
  if (false) {}
41575
41440
  });
41576
41441
 
@@ -42277,8 +42142,8 @@ function startCanonicalMcpBridge(options = {}) {
42277
42142
  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
42143
  var init_canonical_mcp_bridge = __esm(async () => {
42279
42144
  init_canonical_bridge_config();
42280
- init_protocol();
42281
42145
  await init_central();
42146
+ init_protocol();
42282
42147
  MAX_BODY_BYTES = 1024 * 1024;
42283
42148
  CAPABILITY_TTL_MS = 60 * 60 * 1000;
42284
42149
  TOOL_ALLOWLIST = {
@@ -42420,6 +42285,27 @@ function cleanupPeerStateForLocalTopic(localTopicId) {
42420
42285
  return { sessions, turns, terminalOutbox, inboxRequests, remoteAsks };
42421
42286
  })();
42422
42287
  }
42288
+ function sweepStalePeerBindings(topicExists) {
42289
+ const stale = [
42290
+ ...new Set(listPeerSessions().map((row) => row.local_topic_id).filter((localTopicId) => localTopicId && !topicExists(localTopicId)))
42291
+ ];
42292
+ const removed = {
42293
+ sessions: 0,
42294
+ turns: 0,
42295
+ terminalOutbox: 0,
42296
+ inboxRequests: 0,
42297
+ remoteAsks: 0
42298
+ };
42299
+ for (const localTopicId of stale) {
42300
+ const result = cleanupPeerStateForLocalTopic(localTopicId);
42301
+ removed.sessions += result.sessions;
42302
+ removed.turns += result.turns;
42303
+ removed.terminalOutbox += result.terminalOutbox;
42304
+ removed.inboxRequests += result.inboxRequests;
42305
+ removed.remoteAsks += result.remoteAsks;
42306
+ }
42307
+ return { topicIds: stale, removed };
42308
+ }
42423
42309
  function failInterruptedPeerTurnRequestsOnStartup() {
42424
42310
  return db.run(`UPDATE otium_peer_turn_requests
42425
42311
  SET status = 'failed', error = 'worker restarted during turn', updated_at = ?
@@ -42984,12 +42870,10 @@ function stopEventBackflow() {
42984
42870
  }
42985
42871
  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
42872
  var init_event_backflow = __esm(async () => {
42873
+ await init_src();
42874
+ await init_central();
42987
42875
  init_protocol();
42988
- await __promiseAll([
42989
- init_src(),
42990
- init_central(),
42991
- init_store2()
42992
- ]);
42876
+ await init_store2();
42993
42877
  FORWARDED_TYPES = new Set([
42994
42878
  "message",
42995
42879
  "message_updated",
@@ -43166,11 +43050,9 @@ function isMcpToolResult(value) {
43166
43050
  }
43167
43051
  var PEER_BRIDGE_TIMEOUT_MS2 = 15000, otiumPeerRuntimeBridge;
43168
43052
  var init_runtime_bridge = __esm(async () => {
43169
- await __promiseAll([
43170
- init_src(),
43171
- init_central(),
43172
- init_event_backflow()
43173
- ]);
43053
+ await init_src();
43054
+ await init_central();
43055
+ await init_event_backflow();
43174
43056
  otiumPeerRuntimeBridge = {
43175
43057
  async flushEvents(localTopicId) {
43176
43058
  const forwarder = getActiveForwarder(localTopicId);
@@ -43665,12 +43547,10 @@ async function acceptRemoteAskReplyResult(args) {
43665
43547
  }
43666
43548
  var PEER_TIMEOUT_MS = 15000, PENDING_ASK_TTL_MS2, peerReplyFlush = null, otiumPeerSessionBridge;
43667
43549
  var init_session_bridge = __esm(async () => {
43550
+ await init_src();
43551
+ await init_central();
43668
43552
  init_protocol();
43669
- await __promiseAll([
43670
- init_src(),
43671
- init_central(),
43672
- init_store2()
43673
- ]);
43553
+ await init_store2();
43674
43554
  PENDING_ASK_TTL_MS2 = 15 * 60 * 1000;
43675
43555
  otiumPeerSessionBridge = { forward, sessions, reply };
43676
43556
  });
@@ -44065,13 +43945,11 @@ function acceptSharedTopicMessages(messages, localTopicId, sourceNode) {
44065
43945
  }
44066
43946
  var RETRY_MS = 1000;
44067
43947
  var init_shared_topic_sync = __esm(async () => {
43948
+ await init_src();
43949
+ await init_central();
43950
+ await init_event_backflow();
44068
43951
  init_protocol();
44069
- await __promiseAll([
44070
- init_src(),
44071
- init_central(),
44072
- init_event_backflow(),
44073
- init_store2()
44074
- ]);
43952
+ await init_store2();
44075
43953
  });
44076
43954
 
44077
43955
  // ../../adapters/otium/src/relay-protocol.ts
@@ -44741,10 +44619,8 @@ function listOtiumTopicBindings() {
44741
44619
  });
44742
44620
  }
44743
44621
  var init_bindings = __esm(async () => {
44744
- await __promiseAll([
44745
- init_src(),
44746
- init_store2()
44747
- ]);
44622
+ await init_src();
44623
+ await init_store2();
44748
44624
  });
44749
44625
 
44750
44626
  // ../../adapters/otium/src/enrollment.ts
@@ -44984,13 +44860,53 @@ function commitEnrollment(join43, options = {}) {
44984
44860
  }
44985
44861
  var INFO;
44986
44862
  var init_enrollment = __esm(async () => {
44987
- await __promiseAll([
44988
- init_src(),
44989
- init_join()
44990
- ]);
44863
+ await init_src();
44864
+ await init_join();
44991
44865
  INFO = Buffer.from("otium-node-enrollment-v1", "utf8");
44992
44866
  });
44993
44867
 
44868
+ // ../../adapters/otium/src/gateway-forward.ts
44869
+ function allowedRuntimePath(path, method) {
44870
+ if (method === "GET") {
44871
+ if (path === "/health" || path === "/events" || path === "/topics")
44872
+ return true;
44873
+ return /^\/topics\/[^/]+(\/messages)?$/.test(path);
44874
+ }
44875
+ if (method === "POST")
44876
+ return path === "/turns";
44877
+ return false;
44878
+ }
44879
+ async function forwardGatewayRequest(req, options) {
44880
+ const url = new URL(req.url);
44881
+ if (!url.pathname.startsWith(OTIUM_GATEWAY_FORWARD_PREFIX))
44882
+ return null;
44883
+ const runtimePath = url.pathname.slice(OTIUM_GATEWAY_FORWARD_PREFIX.length) || "/";
44884
+ if (!allowedRuntimePath(runtimePath, req.method)) {
44885
+ return Response.json({ ok: false, error: "gateway route not forwarded" }, { status: 404 });
44886
+ }
44887
+ const target = new URL(`${options.nodeOrigin.replace(/\/+$/, "")}${RUNTIME_CONTRACT_PATH}${runtimePath}`);
44888
+ target.search = url.search;
44889
+ const headers = new Headers(req.headers);
44890
+ headers.set("authorization", `Bearer ${NODE_CONTROL_TOKEN}`);
44891
+ headers.delete("transfer-encoding");
44892
+ headers.delete("content-length");
44893
+ headers.delete("host");
44894
+ const body = req.method === "GET" || req.method === "HEAD" ? undefined : await req.arrayBuffer();
44895
+ if (body)
44896
+ headers.set("content-length", String(body.byteLength));
44897
+ const fetchRequest = options.fetch ?? fetch;
44898
+ return fetchRequest(new Request(target.toString(), {
44899
+ method: req.method,
44900
+ headers,
44901
+ body,
44902
+ signal: req.signal
44903
+ }));
44904
+ }
44905
+ var RUNTIME_CONTRACT_PATH = "/api/v1/control/runtime/v1", OTIUM_GATEWAY_FORWARD_PREFIX = "/api/v1/peer/runtime";
44906
+ var init_gateway_forward = __esm(async () => {
44907
+ await init_src();
44908
+ });
44909
+
44994
44910
  // ../../adapters/otium/src/turn-bridge.ts
44995
44911
  import { randomUUID as randomUUID32 } from "crypto";
44996
44912
  function executionFor(payload) {
@@ -45183,12 +45099,10 @@ function abortHostedPeerTurn(hostNodeId, requestId, userId, topicTitle) {
45183
45099
  }
45184
45100
  var EFFORT_LEVELS, turnTrigger;
45185
45101
  var init_turn_bridge = __esm(async () => {
45186
- await __promiseAll([
45187
- init_src(),
45188
- init_event_backflow(),
45189
- init_peer_files(),
45190
- init_store2()
45191
- ]);
45102
+ await init_src();
45103
+ await init_event_backflow();
45104
+ await init_peer_files();
45105
+ await init_store2();
45192
45106
  EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
45193
45107
  });
45194
45108
 
@@ -45792,6 +45706,22 @@ async function handleOtiumPeerRequest(req) {
45792
45706
  }
45793
45707
  if (!path.startsWith("/api/v1/peer/"))
45794
45708
  return null;
45709
+ if (path.startsWith(OTIUM_GATEWAY_FORWARD_PREFIX)) {
45710
+ const peer = await requirePeer(req);
45711
+ if (!peer.ok)
45712
+ return peer.response;
45713
+ const notPrimary = requirePrimaryOrigin(peer);
45714
+ if (notPrimary)
45715
+ return notPrimary;
45716
+ const { inspectNodeDaemon: inspectNodeDaemon2 } = await init_src5().then(() => exports_src3);
45717
+ const node = await inspectNodeDaemon2();
45718
+ if (!node.running || !node.info) {
45719
+ return jsonError2("canonical Negotium node is unavailable", 503);
45720
+ }
45721
+ return forwardGatewayRequest(req, {
45722
+ nodeOrigin: `http://127.0.0.1:${node.info.port}`
45723
+ });
45724
+ }
45795
45725
  if (req.method === "GET") {
45796
45726
  if (path === "/api/v1/peer/capabilities") {
45797
45727
  const peer = await requirePeer(req);
@@ -45842,17 +45772,16 @@ async function handleOtiumPeerRequest(req) {
45842
45772
  }
45843
45773
  var RUNTIME_VERSION;
45844
45774
  var init_peer_server = __esm(async () => {
45775
+ await init_src();
45776
+ await init_bindings();
45777
+ await init_central();
45778
+ await init_gateway_forward();
45779
+ await init_peer_files();
45845
45780
  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
- ]);
45781
+ await init_session_bridge();
45782
+ await init_shared_topic_sync();
45783
+ await init_store2();
45784
+ await init_turn_bridge();
45856
45785
  RUNTIME_VERSION = NEGOTIUM_VERSION;
45857
45786
  });
45858
45787
 
@@ -45864,6 +45793,10 @@ function startOtiumNodeRuntime(options) {
45864
45793
  if (failed > 0) {
45865
45794
  logger.warn({ failed }, "otium: failed interrupted peer turns from previous process");
45866
45795
  }
45796
+ const staleBindings = sweepStalePeerBindings((localTopicId) => getTopic(localTopicId) !== null);
45797
+ if (staleBindings.topicIds.length > 0) {
45798
+ logger.info({ topicIds: staleBindings.topicIds, ...staleBindings.removed }, "otium: removed peer state for local topics deleted while this node was offline");
45799
+ }
45867
45800
  const stopBackflow = startEventBackflow();
45868
45801
  const stopSharedTopicSync = startSharedTopicSync(join43);
45869
45802
  const unregisterRuntimeBridge = registerPeerRuntimeBridge(otiumPeerRuntimeBridge);
@@ -45950,33 +45883,31 @@ function startOtiumAdapter(options) {
45950
45883
  }
45951
45884
  var otiumAdapter;
45952
45885
  var init_src8 = __esm(async () => {
45886
+ await init_src();
45887
+ await init_canonical_mcp_bridge();
45888
+ await init_central();
45889
+ await init_event_backflow();
45890
+ await init_join();
45891
+ await init_peer_files();
45892
+ await init_runtime_bridge();
45893
+ await init_session_bridge();
45953
45894
  init_session_bridge_ipc();
45895
+ await init_shared_topic_sync();
45896
+ await init_store2();
45954
45897
  init_tunnel_client();
45898
+ await init_bindings();
45899
+ await init_central();
45900
+ await init_enrollment();
45901
+ await init_event_backflow();
45902
+ await init_join();
45903
+ await init_peer_server();
45955
45904
  init_protocol();
45956
45905
  init_relay_protocol();
45906
+ await init_runtime_bridge();
45907
+ await init_shared_topic_sync();
45908
+ await init_store2();
45957
45909
  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
- ]);
45910
+ await init_turn_bridge();
45980
45911
  otiumAdapter = defineNegotiumAdapter({
45981
45912
  name: "otium",
45982
45913
  capabilities: {
@@ -46036,13 +45967,11 @@ function mountConfiguredOtiumNodeRuntime() {
46036
45967
  };
46037
45968
  }
46038
45969
  var init_node_runtime = __esm(async () => {
45970
+ await init_src();
45971
+ await init_src8();
45972
+ await init_join();
45973
+ await init_peer_server();
46039
45974
  init_protocol();
46040
- await __promiseAll([
46041
- init_src(),
46042
- init_src8(),
46043
- init_join(),
46044
- init_peer_server()
46045
- ]);
46046
45975
  });
46047
45976
 
46048
45977
  // ../../adapters/otium/src/join-cli.ts
@@ -46139,11 +46068,9 @@ async function joinCommand(args) {
46139
46068
  console.log("\nnext: `negotium-otium serve` (mounts the otium peer routes automatically)");
46140
46069
  }
46141
46070
  var init_join_cli = __esm(async () => {
46142
- await __promiseAll([
46143
- init_central(),
46144
- init_enrollment(),
46145
- init_join()
46146
- ]);
46071
+ await init_central();
46072
+ await init_enrollment();
46073
+ await init_join();
46147
46074
  });
46148
46075
 
46149
46076
  // ../../adapters/otium/src/sidecar.ts
@@ -46233,13 +46160,11 @@ async function runOtiumSidecar(options) {
46233
46160
  await completed;
46234
46161
  }
46235
46162
  var init_sidecar = __esm(async () => {
46163
+ await init_src();
46164
+ await init_src5();
46165
+ await init_join();
46236
46166
  init_protocol();
46237
46167
  init_tunnel_client();
46238
- await __promiseAll([
46239
- init_src(),
46240
- init_src5(),
46241
- init_join()
46242
- ]);
46243
46168
  });
46244
46169
 
46245
46170
  // ../../adapters/otium/src/cli.ts
@@ -46895,10 +46820,8 @@ async function cronCommand(args) {
46895
46820
  }
46896
46821
  var USER_ID = "local";
46897
46822
  var init_cron = __esm(async () => {
46898
- await __promiseAll([
46899
- init_src(),
46900
- init_src4()
46901
- ]);
46823
+ await init_src();
46824
+ await init_src4();
46902
46825
  });
46903
46826
 
46904
46827
  // ../cli/src/adapter-loader.ts
@@ -47161,4 +47084,4 @@ switch (command) {
47161
47084
  }
47162
47085
  }
47163
47086
 
47164
- //# debugId=69B455239128A0A264756E2164756E21
47087
+ //# debugId=31C48E669F9A292A64756E2164756E21