negotium 0.16.1 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/agent-helpers.js +347 -266
  2. package/dist/agent-helpers.js.map +7 -7
  3. package/dist/background-bash.js +2 -2
  4. package/dist/background-bash.js.map +3 -3
  5. package/dist/browser-runtime.js +2 -18
  6. package/dist/browser-runtime.js.map +3 -3
  7. package/dist/canonical-mcp-bridge.js +1 -1
  8. package/dist/{chunk-emzrsg4j.js → chunk-33exyd19.js} +3 -2
  9. package/dist/{chunk-emzrsg4j.js.map → chunk-33exyd19.js.map} +2 -2
  10. package/dist/{chunk-syp92qdd.js → chunk-atdgzpwv.js} +3 -3
  11. package/dist/{chunk-syp92qdd.js.map → chunk-atdgzpwv.js.map} +3 -3
  12. package/dist/{chunk-s2gez3wg.js → chunk-r0xs3t81.js} +3 -18
  13. package/dist/{chunk-s2gez3wg.js.map → chunk-r0xs3t81.js.map} +2 -2
  14. package/dist/{chunk-ezfxb5ad.js → chunk-zt9dey0p.js} +6 -20
  15. package/dist/{chunk-ezfxb5ad.js.map → chunk-zt9dey0p.js.map} +4 -4
  16. package/dist/hosted-agent.js +6 -6
  17. package/dist/hosted-agent.js.map +5 -5
  18. package/dist/main.js +791 -604
  19. package/dist/main.js.map +7 -7
  20. package/dist/mcp-catalog.js.map +1 -1
  21. package/dist/mcp-factories.js +322 -249
  22. package/dist/mcp-factories.js.map +7 -7
  23. package/dist/media.js +2 -2
  24. package/dist/media.js.map +3 -3
  25. package/dist/outbox.js.map +1 -1
  26. package/dist/platform-runtime.js.map +1 -1
  27. package/dist/prompts.js +2 -2
  28. package/dist/prompts.js.map +3 -3
  29. package/dist/query-runtime.js +2 -18
  30. package/dist/query-runtime.js.map +3 -3
  31. package/dist/registry.js +4 -5
  32. package/dist/registry.js.map +2 -2
  33. package/dist/rollout.js +2 -2
  34. package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +44 -28
  35. package/dist/runtime/src/platform/config.ts +1 -1
  36. package/dist/runtime/src/platform/mcp-config.ts +5 -1
  37. package/dist/runtime/src/topics/derive.ts +23 -18
  38. package/dist/runtime/src/version.ts +1 -1
  39. package/dist/runtime-gateway.js.map +1 -1
  40. package/dist/runtime-helpers.js +2 -18
  41. package/dist/runtime-helpers.js.map +3 -3
  42. package/dist/sqlite.js +1 -17
  43. package/dist/sqlite.js.map +2 -2
  44. package/dist/storage.js +6 -17
  45. package/dist/storage.js.map +2 -2
  46. package/dist/types/packages/core/src/platform/config.d.ts +1 -1
  47. package/dist/types/packages/core/src/topics/derive.d.ts +8 -4
  48. package/dist/types/packages/core/src/version.d.ts +1 -1
  49. package/dist/vault.js +2 -18
  50. package/dist/vault.js.map +3 -3
  51. package/install-browser-rs.mjs +4 -4
  52. package/package.json +1 -1
@@ -1,30 +1,20 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
2
  var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
18
7
  var __export = (target, all) => {
19
8
  for (var name in all)
20
9
  __defProp(target, name, {
21
10
  get: all[name],
22
11
  enumerable: true,
23
12
  configurable: true,
24
- set: (newValue) => all[name] = () => newValue
13
+ set: __exportSetter.bind(all, name)
25
14
  });
26
15
  };
27
16
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
+ var __promiseAll = (args) => Promise.all(args);
28
18
  var __require = import.meta.require;
29
19
 
30
20
  // ../../packages/core/src/platform/paths.ts
@@ -372,7 +362,7 @@ function resolveWhisperBackend() {
372
362
  function codexAuthFilePath() {
373
363
  return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
374
364
  }
375
- var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BINARY_EXTENSION, BROWSER_RS_VERSION = "v0.4.5", BROWSER_RS_MIN_SECURE_VERSION = "0.2.1", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.10", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER_PATH, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, ABSOLUTE_PATH_PREFIX, FILE_EXTENSIONS_REGEX, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5-1", FALLBACK_AGENT, FALLBACK_MODEL, DEFAULT_TOPIC_EFFORT, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, WHISPER_BACKEND, MLX_WHISPER_BIN, WHISPER_MODEL_MLX, _envMaxTellDepth, MAX_TELL_DEPTH;
365
+ var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BINARY_EXTENSION, BROWSER_RS_VERSION = "v0.6.0", BROWSER_RS_MIN_SECURE_VERSION = "0.2.1", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.10", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER_PATH, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, ABSOLUTE_PATH_PREFIX, FILE_EXTENSIONS_REGEX, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5-1", FALLBACK_AGENT, FALLBACK_MODEL, DEFAULT_TOPIC_EFFORT, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, WHISPER_BACKEND, MLX_WHISPER_BIN, WHISPER_MODEL_MLX, _envMaxTellDepth, MAX_TELL_DEPTH;
376
366
  var init_config = __esm(() => {
377
367
  init_config_helpers();
378
368
  init_logger();
@@ -1309,6 +1299,7 @@ var init_mcp_config = __esm(() => {
1309
1299
  ...commonRuntimeMcpPolicy("runtime"),
1310
1300
  build({
1311
1301
  userId,
1302
+ actorUserId,
1312
1303
  session,
1313
1304
  topicId,
1314
1305
  queryId,
@@ -1325,7 +1316,7 @@ var init_mcp_config = __esm(() => {
1325
1316
  if (!topicId || !agent)
1326
1317
  return null;
1327
1318
  return buildRuntimeMcpSpec(agent, {
1328
- userId,
1319
+ userId: actorUserId ?? userId,
1329
1320
  topicId,
1330
1321
  topicTitle: session,
1331
1322
  queryId,
@@ -1924,9 +1915,11 @@ function redactVaultSecrets(userId, text) {
1924
1915
  var vaultDb, vaultMasterKey, VAULT_VALUE_MAX_BYTES;
1925
1916
  var init_vault = __esm(async () => {
1926
1917
  init_config();
1927
- await init_sqlite();
1928
- await init_storage_host();
1929
1918
  init_vault_crypto();
1919
+ await __promiseAll([
1920
+ init_sqlite(),
1921
+ init_storage_host()
1922
+ ]);
1930
1923
  vaultMasterKey = VAULT_MASTER_KEY;
1931
1924
  VAULT_VALUE_MAX_BYTES = 64 * 1024;
1932
1925
  });
@@ -3118,14 +3111,14 @@ function formatDateBucket(d) {
3118
3111
  }
3119
3112
  var _shellCache = null, MAX_DAY_SPAN = 30, DAY_MS = 86400000, LOCAL_DATE_SKEW_DAYS = 1;
3120
3113
  var init_codex = __esm(async () => {
3121
- await init_execution_host();
3122
3114
  init_shared();
3123
3115
  init_jsonl();
3124
3116
  init_logger();
3117
+ await init_execution_host();
3125
3118
  });
3126
3119
 
3127
3120
  // ../../packages/core/src/version.ts
3128
- var NEGOTIUM_VERSION = "0.16.1";
3121
+ var NEGOTIUM_VERSION = "0.16.4";
3129
3122
 
3130
3123
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
3131
3124
  import { spawn as spawn2 } from "child_process";
@@ -3460,8 +3453,10 @@ async function forkCodexSession(parentThreadId) {
3460
3453
  var forkCodexThread;
3461
3454
  var init_codex_app_server = __esm(async () => {
3462
3455
  init_codex_native_multi_agent();
3463
- await init_execution_host();
3464
- await init_codex();
3456
+ await __promiseAll([
3457
+ init_execution_host(),
3458
+ init_codex()
3459
+ ]);
3465
3460
  forkCodexThread = createCodexAppServerForker({
3466
3461
  spawnServer() {
3467
3462
  return spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
@@ -3480,10 +3475,12 @@ import { existsSync as existsSync7, unlinkSync as unlinkSync6 } from "fs";
3480
3475
  import { join as join8 } from "path";
3481
3476
  var VALID_EFFORTS2, codexRegistry, codexRegistryOperations;
3482
3477
  var init_codex_registry = __esm(async () => {
3483
- await init_execution_host();
3484
- await init_codex();
3485
3478
  init_logger();
3486
3479
  init_types();
3480
+ await __promiseAll([
3481
+ init_execution_host(),
3482
+ init_codex()
3483
+ ]);
3487
3484
  VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
3488
3485
  codexRegistry = {
3489
3486
  kind: "codex",
@@ -3710,8 +3707,8 @@ function getRegistryOperations(agent) {
3710
3707
  var REGISTRIES, OPERATIONS;
3711
3708
  var init_registry = __esm(async () => {
3712
3709
  init_claude_registry();
3713
- await init_codex_registry();
3714
3710
  init_maestro_registry();
3711
+ await init_codex_registry();
3715
3712
  REGISTRIES = {
3716
3713
  claude: claudeRegistry,
3717
3714
  codex: codexRegistry,
@@ -4616,10 +4613,10 @@ async function* claudeProvider(opts) {
4616
4613
  var CLAUDE_DEFAULT_DISALLOWED_TOOLS, CLAUDE_NATIVE_AGENT_TOOLS, CLAUDE_IMAGE_MAX_BYTES, CLAUDE_IMAGE_MIME_TYPES, CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500, claudeProcessExitListeners;
4617
4614
  var init_claude_provider = __esm(async () => {
4618
4615
  init_claude_registry();
4619
- await init_execution_host();
4620
4616
  init_vault_tool_policy();
4621
4617
  init_file_events();
4622
4618
  init_logger();
4619
+ await init_execution_host();
4623
4620
  CLAUDE_DEFAULT_DISALLOWED_TOOLS = [
4624
4621
  "AskUserQuestion",
4625
4622
  "Workflow",
@@ -5039,9 +5036,9 @@ async function createCodexVaultHookBridge(userId) {
5039
5036
  var MAX_HOOK_REQUEST_BYTES, SENSITIVE_STORAGE_DENIAL = "Runtime secret storage access is not permitted", HOOK_SOCKET_ENV = "NEGOTIUM_CODEX_VAULT_HOOK_SOCKET", HOOK_TOKEN_ENV = "NEGOTIUM_CODEX_VAULT_HOOK_TOKEN", WINDOWS_BRIDGE_UNSUPPORTED;
5040
5037
  var init_codex_vault_hook_bridge = __esm(async () => {
5041
5038
  init_codex_native_multi_agent();
5042
- await init_execution_host();
5043
5039
  init_vault_tool_policy();
5044
5040
  init_ipc();
5041
+ await init_execution_host();
5045
5042
  MAX_HOOK_REQUEST_BYTES = 1024 * 1024;
5046
5043
  WINDOWS_BRIDGE_UNSUPPORTED = "Codex Vault hooks are not available on Windows: the hook-trust bypass can only be passed " + "through a wrapper executable, and the Codex SDK spawns the override without a shell, so a " + ".cmd wrapper cannot run. Use the Claude or Maestro backend on this host.";
5047
5044
  });
@@ -6255,13 +6252,15 @@ var CODEX_HOOK_TRUST_BYPASS_NOTICE = "`--dangerously-bypass-hook-trust` is enabl
6255
6252
  var init_codex_provider = __esm(async () => {
6256
6253
  init_codex_native_multi_agent();
6257
6254
  init_codex_tree_kill();
6258
- await init_codex_vault_hook_bridge();
6259
- await init_execution_host();
6260
- await init_codex();
6261
6255
  init_tool_format();
6262
6256
  init_file_events();
6263
6257
  init_logger();
6264
6258
  init_mcp_config();
6259
+ await __promiseAll([
6260
+ init_codex_vault_hook_bridge(),
6261
+ init_execution_host(),
6262
+ init_codex()
6263
+ ]);
6265
6264
  CODEX_MCP_SERVER_NAME_OVERRIDES = {
6266
6265
  playwright: "otium_playwright",
6267
6266
  "cua-rs": "otium_cua_rs"
@@ -6379,10 +6378,12 @@ function maestroProvider(opts) {
6379
6378
  var MAESTRO_DEFAULT_MAX_TOKENS = 32768, PROVIDER_ASK_USER_TOOL = "AskUserQuestion", MAESTRO_PROVIDER_OWNED_TOOL_SET, DEFAULT_MAESTRO_DISALLOWED_TOOLS, MAESTRO_ALL_BUILTIN_TOOLS, MAESTRO_TOOL_OUTPUT_DIR;
6380
6379
  var init_maestro_provider = __esm(async () => {
6381
6380
  init_maestro_bootstrap_env();
6382
- await init_execution_host();
6383
6381
  init_vault_tool_policy();
6384
6382
  init_config();
6385
- await init_vault();
6383
+ await __promiseAll([
6384
+ init_execution_host(),
6385
+ init_vault()
6386
+ ]);
6386
6387
  MAESTRO_PROVIDER_OWNED_TOOL_SET = new Set([PROVIDER_ASK_USER_TOOL]);
6387
6388
  DEFAULT_MAESTRO_DISALLOWED_TOOLS = [PROVIDER_ASK_USER_TOOL];
6388
6389
  MAESTRO_ALL_BUILTIN_TOOLS = [
@@ -6513,13 +6514,15 @@ async function* runAgent(opts) {
6513
6514
  }
6514
6515
  var loadClaudeProvider, loadCodexProvider, loadMaestroProvider;
6515
6516
  var init_agents = __esm(async () => {
6516
- await init_execution_host();
6517
- await init_registry();
6518
6517
  init_claude();
6519
- await init_task_events();
6520
6518
  init_logger();
6521
- await init_conversations();
6522
6519
  init_types();
6520
+ await __promiseAll([
6521
+ init_execution_host(),
6522
+ init_registry(),
6523
+ init_task_events(),
6524
+ init_conversations()
6525
+ ]);
6523
6526
  loadClaudeProvider = memoizeImport(() => init_claude_provider().then(() => exports_claude_provider));
6524
6527
  loadCodexProvider = memoizeImport(() => init_codex_provider().then(() => exports_codex_provider));
6525
6528
  loadMaestroProvider = memoizeImport(() => init_maestro_provider().then(() => exports_maestro_provider));
@@ -6844,8 +6847,10 @@ function listRuntimeEventsAfter(seq, limit = 500) {
6844
6847
  }
6845
6848
  var RUNTIME_EVENT_TYPES, types;
6846
6849
  var init_runtime_events = __esm(async () => {
6847
- await init_forum_db();
6848
- await init_storage_host();
6850
+ await __promiseAll([
6851
+ init_forum_db(),
6852
+ init_storage_host()
6853
+ ]);
6849
6854
  RUNTIME_EVENT_TYPES = [
6850
6855
  "message",
6851
6856
  "message-updated",
@@ -7715,8 +7720,10 @@ function getMessagesForTopicAfterRowid(topicId, afterRowid) {
7715
7720
  }
7716
7721
  var appendHooks;
7717
7722
  var init_api_messages = __esm(async () => {
7718
- await init_forum_db();
7719
- await init_storage_host();
7723
+ await __promiseAll([
7724
+ init_forum_db(),
7725
+ init_storage_host()
7726
+ ]);
7720
7727
  registerStorageSchemaInitializer(initializeApiMessagesSchema, 30);
7721
7728
  appendHooks = new Set;
7722
7729
  });
@@ -7806,9 +7813,11 @@ function deleteTopicBrief(topicId) {
7806
7813
  db.query("DELETE FROM api_topic_brief WHERE topic_id = ?").run(topicId);
7807
7814
  }
7808
7815
  var init_api_topic_brief = __esm(async () => {
7809
- await init_forum_db();
7810
- await init_storage_host();
7811
7816
  init_wiki_summary_names();
7817
+ await __promiseAll([
7818
+ init_forum_db(),
7819
+ init_storage_host()
7820
+ ]);
7812
7821
  registerStorageSchemaInitializer((database) => {
7813
7822
  database.exec(`
7814
7823
  CREATE TABLE IF NOT EXISTS api_topic_brief (
@@ -8465,8 +8474,10 @@ var init_api_topics = __esm(async () => {
8465
8474
  init_config_helpers();
8466
8475
  init_constants();
8467
8476
  init_logger();
8468
- await init_forum_db();
8469
- await init_storage_host();
8477
+ await __promiseAll([
8478
+ init_forum_db(),
8479
+ init_storage_host()
8480
+ ]);
8470
8481
  registerStorageSchemaInitializer(initializeApiTopicsSchema, 20);
8471
8482
  });
8472
8483
 
@@ -8591,8 +8602,10 @@ function deleteApiTopicConfig(topicId) {
8591
8602
  db.query("DELETE FROM api_topic_config WHERE topic_id = ?").run(topicId);
8592
8603
  }
8593
8604
  var init_api_topic_config = __esm(async () => {
8594
- await init_forum_db();
8595
- await init_storage_host();
8605
+ await __promiseAll([
8606
+ init_forum_db(),
8607
+ init_storage_host()
8608
+ ]);
8596
8609
  registerStorageSchemaInitializer(initializeApiTopicConfigSchema, 40);
8597
8610
  });
8598
8611
 
@@ -8640,11 +8653,13 @@ function isLegacySharedGeneral(topicId) {
8640
8653
  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.";
8641
8654
  var init_personal_general = __esm(async () => {
8642
8655
  init_model_catalog();
8643
- await init_registry();
8644
8656
  init_config();
8645
8657
  init_constants();
8646
- await init_api_topic_config();
8647
- await init_api_topics();
8658
+ await __promiseAll([
8659
+ init_registry(),
8660
+ init_api_topic_config(),
8661
+ init_api_topics()
8662
+ ]);
8648
8663
  });
8649
8664
 
8650
8665
  // ../../packages/core/src/agents/archiver.ts
@@ -8982,21 +8997,23 @@ function runArchiverTurn(params) {
8982
8997
  }
8983
8998
  var MAX_BRIEF_ENTRIES = 8, defaultArchiverRuntime;
8984
8999
  var init_archiver = __esm(async () => {
8985
- await init_agents();
8986
9000
  init_model_catalog();
8987
- await init_registry();
8988
9001
  init_tool_format();
8989
- await init_bus();
8990
9002
  init_config();
8991
9003
  init_logger();
8992
9004
  init_builders();
8993
9005
  init_background_session_policy();
8994
- await init_api_messages();
8995
- await init_api_topic_brief();
8996
- await init_api_topics();
8997
- await init_wiki();
8998
9006
  init_wiki_summary_names();
8999
- await init_personal_general();
9007
+ await __promiseAll([
9008
+ init_agents(),
9009
+ init_registry(),
9010
+ init_bus(),
9011
+ init_api_messages(),
9012
+ init_api_topic_brief(),
9013
+ init_api_topics(),
9014
+ init_wiki(),
9015
+ init_personal_general()
9016
+ ]);
9000
9017
  defaultArchiverRuntime = createArchiverRuntime({
9001
9018
  storage: {
9002
9019
  getWikiDir: getSharedWikiDir,
@@ -9179,8 +9196,8 @@ function cleanupAgentFork(handle) {
9179
9196
  }
9180
9197
  var defaultForkHelpers;
9181
9198
  var init_fork = __esm(async () => {
9182
- await init_registry();
9183
9199
  init_logger();
9200
+ await init_registry();
9184
9201
  defaultForkHelpers = createAgentForkHelpers({
9185
9202
  forkSession: (agent, options) => getRegistryOperations(agent).forkSession(options),
9186
9203
  exists: existsSync17,
@@ -9299,8 +9316,10 @@ function beginRuntimeTopicMaintenance(topicId, options = {}) {
9299
9316
  }
9300
9317
  var TOPIC_MAINTENANCE_STALE_MS = 30000, TOPIC_MAINTENANCE_HEARTBEAT_MS = 1000;
9301
9318
  var init_runtime_topic_state = __esm(async () => {
9302
- await init_forum_db();
9303
- await init_storage_host();
9319
+ await __promiseAll([
9320
+ init_forum_db(),
9321
+ init_storage_host()
9322
+ ]);
9304
9323
  registerStorageSchemaInitializer((database) => {
9305
9324
  database.exec(`
9306
9325
  CREATE TABLE IF NOT EXISTS runtime_topic_state (
@@ -9397,9 +9416,11 @@ function releaseRuntimeTurnLease(topicId, queryId, ownerId = RUNTIME_INSTANCE_ID
9397
9416
  }
9398
9417
  var RUNTIME_INSTANCE_ID, TURN_LEASE_STALE_MS = 1e4;
9399
9418
  var init_runtime_leases = __esm(async () => {
9400
- await init_forum_db();
9401
- await init_runtime_topic_state();
9402
- await init_storage_host();
9419
+ await __promiseAll([
9420
+ init_forum_db(),
9421
+ init_runtime_topic_state(),
9422
+ init_storage_host()
9423
+ ]);
9403
9424
  RUNTIME_INSTANCE_ID = `${process.pid}-${randomUUID8()}`;
9404
9425
  registerStorageSchemaInitializer((database) => {
9405
9426
  database.exec(`
@@ -9774,10 +9795,10 @@ function wsAbortReason(reason) {
9774
9795
  var roomQueryRegistry, interSessionQueue;
9775
9796
  var init_active_rooms = __esm(async () => {
9776
9797
  init_logger();
9777
- await init_runtime_leases();
9778
9798
  init_room_query_registry();
9779
9799
  init_types2();
9780
9800
  init_room_query_registry();
9801
+ await init_runtime_leases();
9781
9802
  roomQueryRegistry = createRoomQueryRegistry({
9782
9803
  instanceId: RUNTIME_INSTANCE_ID,
9783
9804
  internalAbortReason: "internal" /* Internal */,
@@ -9956,9 +9977,11 @@ function archiveConversationEvents(topicId, topicTitle, userId, options = {}) {
9956
9977
  }
9957
9978
  var init_topic_archive = __esm(async () => {
9958
9979
  init_logger();
9959
- await init_api_messages();
9960
- await init_conversations();
9961
- await init_wiki();
9980
+ await __promiseAll([
9981
+ init_api_messages(),
9982
+ init_conversations(),
9983
+ init_wiki()
9984
+ ]);
9962
9985
  });
9963
9986
 
9964
9987
  // ../../packages/core/src/storage/topic-archive-state.ts
@@ -10071,8 +10094,10 @@ function deleteTopicArchiveState(topicId) {
10071
10094
  }
10072
10095
  var ARCHIVE_JOB_STALE_MS;
10073
10096
  var init_topic_archive_state = __esm(async () => {
10074
- await init_forum_db();
10075
- await init_storage_host();
10097
+ await __promiseAll([
10098
+ init_forum_db(),
10099
+ init_storage_host()
10100
+ ]);
10076
10101
  registerStorageSchemaInitializer((database) => {
10077
10102
  database.exec(`
10078
10103
  CREATE TABLE IF NOT EXISTS api_topic_archive_state (
@@ -10249,13 +10274,15 @@ function archiveActiveTopicForMemory(topicId, userId, options) {
10249
10274
  }
10250
10275
  var DEFAULT_IDLE_DELAY_MS, DEFAULT_MIN_MESSAGES = 8, timers;
10251
10276
  var init_idle_archiver = __esm(async () => {
10252
- await init_archiver();
10253
10277
  init_logger();
10254
- await init_active_rooms();
10255
- await init_api_messages();
10256
- await init_api_topics();
10257
- await init_topic_archive();
10258
- await init_topic_archive_state();
10278
+ await __promiseAll([
10279
+ init_archiver(),
10280
+ init_active_rooms(),
10281
+ init_api_messages(),
10282
+ init_api_topics(),
10283
+ init_topic_archive(),
10284
+ init_topic_archive_state()
10285
+ ]);
10259
10286
  DEFAULT_IDLE_DELAY_MS = 6 * 60 * 60 * 1000;
10260
10287
  timers = new Map;
10261
10288
  });
@@ -10470,8 +10497,10 @@ function cancelAskUserGate(topicId, messageId, ownerId, now = new Date().toISOSt
10470
10497
  }).immediate();
10471
10498
  }
10472
10499
  var init_ask_user_gates = __esm(async () => {
10473
- await init_forum_db();
10474
- await init_storage_host();
10500
+ await __promiseAll([
10501
+ init_forum_db(),
10502
+ init_storage_host()
10503
+ ]);
10475
10504
  registerStorageSchemaInitializer(initializeAskUserGateSchema, 31);
10476
10505
  });
10477
10506
 
@@ -10590,9 +10619,11 @@ function acquireRuntimeProcessLease(role, options = {}) {
10590
10619
  }
10591
10620
  var PROCESS_LEASE_STALE_MS = 5000, PROCESS_LEASE_HEARTBEAT_MS = 1000;
10592
10621
  var init_runtime_process_leases = __esm(async () => {
10593
- await init_forum_db();
10594
- await init_runtime_leases();
10595
- await init_storage_host();
10622
+ await __promiseAll([
10623
+ init_forum_db(),
10624
+ init_runtime_leases(),
10625
+ init_storage_host()
10626
+ ]);
10596
10627
  registerStorageSchemaInitializer((database) => {
10597
10628
  database.exec(`
10598
10629
  CREATE TABLE IF NOT EXISTS runtime_process_leases (
@@ -10912,12 +10943,14 @@ function cancelPendingAskUserQuestions(topicId, queryId) {
10912
10943
  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;
10913
10944
  var init_ask_user = __esm(async () => {
10914
10945
  init_common();
10915
- await init_bus();
10916
- await init_api_messages();
10917
- await init_api_topic_config();
10918
- await init_api_topics();
10919
- await init_ask_user_gates();
10920
- await init_runtime_process_leases();
10946
+ await __promiseAll([
10947
+ init_bus(),
10948
+ init_api_messages(),
10949
+ init_api_topic_config(),
10950
+ init_api_topics(),
10951
+ init_ask_user_gates(),
10952
+ init_runtime_process_leases()
10953
+ ]);
10921
10954
  ASK_GATE_OWNER_ID = `ask-user-${process.pid}-${randomUUID9()}`;
10922
10955
  defaultAskUserDurabilityHost = {
10923
10956
  gates: {
@@ -11022,10 +11055,12 @@ function deleteSelfSchedulesForTopic(topicId) {
11022
11055
  return Number(result.changes ?? 0);
11023
11056
  }
11024
11057
  var init_self_schedules = __esm(async () => {
11025
- await init_forum_db();
11026
- await init_runtime_leases();
11027
- await init_runtime_topic_state();
11028
- await init_storage_host();
11058
+ await __promiseAll([
11059
+ init_forum_db(),
11060
+ init_runtime_leases(),
11061
+ init_runtime_topic_state(),
11062
+ init_storage_host()
11063
+ ]);
11029
11064
  registerStorageSchemaInitializer((database) => {
11030
11065
  database.exec(`
11031
11066
  CREATE TABLE IF NOT EXISTS runtime_self_schedules (
@@ -11383,8 +11418,8 @@ var init_transport_probe = __esm(() => {
11383
11418
 
11384
11419
  // ../../packages/core/src/storage/vault-public.ts
11385
11420
  var init_vault_public = __esm(async () => {
11386
- await init_vault();
11387
11421
  init_vault_crypto();
11422
+ await init_vault();
11388
11423
  });
11389
11424
 
11390
11425
  // ../../packages/core/src/platform/playwright/vault-broker.ts
@@ -11662,8 +11697,10 @@ function assignTopicBrowserProfile(opts) {
11662
11697
  }
11663
11698
  var DEFAULT_BROWSER_PROFILE = "default";
11664
11699
  var init_browser_profiles = __esm(async () => {
11665
- await init_forum_db();
11666
- await init_storage_host();
11700
+ await __promiseAll([
11701
+ init_forum_db(),
11702
+ init_storage_host()
11703
+ ]);
11667
11704
  registerStorageSchemaInitializer((database) => {
11668
11705
  database.exec(`
11669
11706
  CREATE TABLE IF NOT EXISTS browser_profiles (
@@ -12307,15 +12344,17 @@ var CHILD_ENVIRONMENT_KEYS, WINDOWS_CHILD_ENVIRONMENT_KEYS, defaultManagerHost,
12307
12344
  var init_manager2 = __esm(async () => {
12308
12345
  init_config();
12309
12346
  init_logger();
12310
- await init_browser_processes();
12311
12347
  init_headed_launch();
12312
12348
  init_transport_probe();
12313
- await init_vault_broker();
12314
- await init_browser_profiles();
12315
12349
  init_manager_utils();
12316
- await init_browser_processes();
12317
12350
  init_transport_probe();
12318
12351
  init_manager_utils();
12352
+ await __promiseAll([
12353
+ init_browser_processes(),
12354
+ init_vault_broker(),
12355
+ init_browser_profiles(),
12356
+ init_browser_processes()
12357
+ ]);
12319
12358
  CHILD_ENVIRONMENT_KEYS = [
12320
12359
  "HOME",
12321
12360
  "PATH",
@@ -12691,8 +12730,10 @@ var TOKEN_PRICES;
12691
12730
  var init_token_stats = __esm(async () => {
12692
12731
  init_jsonl();
12693
12732
  init_logger();
12694
- await init_api_topics();
12695
- await init_storage_host();
12733
+ await __promiseAll([
12734
+ init_api_topics(),
12735
+ init_storage_host()
12736
+ ]);
12696
12737
  TOKEN_PRICES = {
12697
12738
  "codex:gpt-6-astra": { input: 10, cacheWrite: 12.5, cacheRead: 1, output: 50 },
12698
12739
  "codex:gpt-5.6-sol": { input: 5, cacheRead: 0.5, output: 30 },
@@ -12856,10 +12897,12 @@ async function runIdleCompactForTopic(topicId, userId, options = {}) {
12856
12897
  var DEFAULT_IDLE_DELAY_MS2, DEFAULT_CONTEXT_LIMIT_DELAY_MS = 1000, CONTEXT_LIMIT_COMPACT_PERCENT = 90, DEFAULT_MIN_CONTEXT_PERCENT = 50, timers2, contextLimitTimers;
12857
12898
  var init_idle_compact = __esm(async () => {
12858
12899
  init_logger();
12859
- await init_active_rooms();
12860
- await init_api_topics();
12861
- await init_runtime_leases();
12862
- await init_token_stats();
12900
+ await __promiseAll([
12901
+ init_active_rooms(),
12902
+ init_api_topics(),
12903
+ init_runtime_leases(),
12904
+ init_token_stats()
12905
+ ]);
12863
12906
  DEFAULT_IDLE_DELAY_MS2 = 6 * 60 * 60 * 1000;
12864
12907
  timers2 = new Map;
12865
12908
  contextLimitTimers = new Map;
@@ -12984,10 +13027,12 @@ function createTopicLogMaintenance(host) {
12984
13027
  }
12985
13028
  var defaultTopicLogMaintenance, cleanupTopicRollouts, cleanupTopicRolloutsFromEntries, rotateTopicLogs, purgeTopicLogs;
12986
13029
  var init_topic_cleanup = __esm(async () => {
12987
- await init_agents();
12988
- await init_registry();
12989
13030
  init_logger();
12990
- await init_conversations();
13031
+ await __promiseAll([
13032
+ init_agents(),
13033
+ init_registry(),
13034
+ init_conversations()
13035
+ ]);
12991
13036
  defaultTopicLogMaintenance = createTopicLogMaintenance({
12992
13037
  agents: SUPPORTED_AGENTS,
12993
13038
  readActiveConversation: readConversation,
@@ -13070,12 +13115,14 @@ function text(value, maxLen) {
13070
13115
  }
13071
13116
  var providers2, transientSessions;
13072
13117
  var init_background_sessions = __esm(async () => {
13073
- await init_archiver();
13074
13118
  init_tool_format();
13075
- await init_api_topics();
13076
- await init_runtime_events();
13077
- await init_runtime_leases();
13078
13119
  init_background_session_policy();
13120
+ await __promiseAll([
13121
+ init_archiver(),
13122
+ init_api_topics(),
13123
+ init_runtime_events(),
13124
+ init_runtime_leases()
13125
+ ]);
13079
13126
  providers2 = new Set;
13080
13127
  transientSessions = new Map;
13081
13128
  });
@@ -13385,10 +13432,12 @@ function getRuntimeUserTurnRequest(topicId) {
13385
13432
  var REQUEST_CLAIM_STALE_MS;
13386
13433
  var init_runtime_turn_requests = __esm(async () => {
13387
13434
  init_user_turn_envelope();
13388
- await init_forum_db();
13389
- await init_runtime_leases();
13390
- await init_runtime_topic_state();
13391
- await init_storage_host();
13435
+ await __promiseAll([
13436
+ init_forum_db(),
13437
+ init_runtime_leases(),
13438
+ init_runtime_topic_state(),
13439
+ init_storage_host()
13440
+ ]);
13392
13441
  REQUEST_CLAIM_STALE_MS = TURN_LEASE_STALE_MS;
13393
13442
  registerStorageSchemaInitializer((database) => ensureRuntimeUserTurnRequestsSchema(database));
13394
13443
  });
@@ -14130,31 +14179,33 @@ async function compactTopicSession(topicId, userId, reason = "topic-session-comp
14130
14179
  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_RETAINED_TAIL_TOKENS = 64000, 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;
14131
14180
  var init_session = __esm(async () => {
14132
14181
  init_compaction_tool_projection();
14133
- await init_idle_archiver();
14134
- await init_idle_compact();
14135
- await init_agents();
14136
14182
  init_model_catalog();
14137
- await init_registry();
14138
14183
  init_shared();
14139
- await init_topic_cleanup();
14140
- await init_bus();
14141
14184
  init_config();
14142
14185
  init_config_helpers();
14143
14186
  init_logger();
14144
14187
  init_mcp_config();
14145
- await init_active_rooms();
14146
- await init_background_sessions();
14147
14188
  init_usage_alert();
14148
- await init_api_messages();
14149
- await init_api_topic_brief();
14150
- await init_api_topic_config();
14151
- await init_api_topics();
14152
- await init_conversations();
14153
- await init_runtime_leases();
14154
- await init_runtime_topic_state();
14155
- await init_runtime_turn_requests();
14156
- await init_topic_archive();
14157
- await init_personal_general();
14189
+ await __promiseAll([
14190
+ init_idle_archiver(),
14191
+ init_idle_compact(),
14192
+ init_agents(),
14193
+ init_registry(),
14194
+ init_topic_cleanup(),
14195
+ init_bus(),
14196
+ init_active_rooms(),
14197
+ init_background_sessions(),
14198
+ init_api_messages(),
14199
+ init_api_topic_brief(),
14200
+ init_api_topic_config(),
14201
+ init_api_topics(),
14202
+ init_conversations(),
14203
+ init_runtime_leases(),
14204
+ init_runtime_topic_state(),
14205
+ init_runtime_turn_requests(),
14206
+ init_topic_archive(),
14207
+ init_personal_general()
14208
+ ]);
14158
14209
  RESET_MEMORY_ARCHIVE_WAIT_MS = 5 * 60 * 1000;
14159
14210
  COMPACTION_SOURCE_CHARS = 512 * 1024;
14160
14211
  COMPACTION_TIMEOUT_MS = 2 * 60000;
@@ -14266,10 +14317,7 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
14266
14317
  const sourceConfig = getApiTopicConfig(sourceTopicId);
14267
14318
  const agent = subagent?.agent ?? effectiveAgentForTopic(sourceTopicId, topic);
14268
14319
  const subagentModel = agent && subagent?.model ? resolveModelForAgent(agent, subagent.model, getRegistry(agent)) : undefined;
14269
- const participants = copyHistory || subagent ? [
14270
- ...topic.participants.filter((p) => p.userId !== userId).map((p) => ({ ...p, role: "member" })),
14271
- { userId, role: "owner" }
14272
- ] : [{ userId, role: "owner" }];
14320
+ const participants = subagent ? topic.participants.map((p) => ({ ...p })) : [{ userId, role: "owner" }];
14273
14321
  const kind = topic.kind ?? inferTopicKind(topic);
14274
14322
  const surface = topic.surface ?? defaultTopicSurface();
14275
14323
  const surfaceScope = topic.surfaceScope ?? null;
@@ -14491,22 +14539,24 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
14491
14539
  }
14492
14540
  var TopicTitleConflictError, TopicDeriveBusyError, TopicForkCompactionError;
14493
14541
  var init_derive = __esm(async () => {
14494
- await init_fork();
14495
14542
  init_model_catalog();
14496
- await init_registry();
14497
- await init_bus();
14498
14543
  init_config();
14499
14544
  init_logger();
14500
- await init_manager2();
14501
- await init_active_rooms();
14502
- await init_api_messages();
14503
- await init_api_topic_config();
14504
- await init_api_topics();
14505
- await init_conversations();
14506
- await init_forum_db();
14507
- await init_runtime_topic_state();
14508
- await init_personal_general();
14509
- await init_session();
14545
+ await __promiseAll([
14546
+ init_fork(),
14547
+ init_registry(),
14548
+ init_bus(),
14549
+ init_manager2(),
14550
+ init_active_rooms(),
14551
+ init_api_messages(),
14552
+ init_api_topic_config(),
14553
+ init_api_topics(),
14554
+ init_conversations(),
14555
+ init_forum_db(),
14556
+ init_runtime_topic_state(),
14557
+ init_personal_general(),
14558
+ init_session()
14559
+ ]);
14510
14560
  TopicTitleConflictError = class TopicTitleConflictError extends Error {
14511
14561
  title;
14512
14562
  constructor(title) {
@@ -14561,9 +14611,11 @@ function deleteSessionInboxForTopic(topicId) {
14561
14611
  return Number(db.run("DELETE FROM session_inbox WHERE topic_id = ?", [topicId]).changes ?? 0);
14562
14612
  }
14563
14613
  var init_session_inbox = __esm(async () => {
14564
- await init_forum_db();
14565
14614
  init_session_inbox_signal();
14566
- await init_storage_host();
14615
+ await __promiseAll([
14616
+ init_forum_db(),
14617
+ init_storage_host()
14618
+ ]);
14567
14619
  registerStorageSchemaInitializer((database) => {
14568
14620
  database.exec(`
14569
14621
  CREATE TABLE IF NOT EXISTS session_inbox (
@@ -15207,9 +15259,11 @@ async function failInterruptedRemoteAskCallbacks() {
15207
15259
  }
15208
15260
  var pendingAsks, MAX_ASK_AGE_MS;
15209
15261
  var init_ask_callbacks = __esm(async () => {
15210
- await init_forum_db();
15211
- await init_session_asks();
15212
- await init_storage_host();
15262
+ await __promiseAll([
15263
+ init_forum_db(),
15264
+ init_session_asks(),
15265
+ init_storage_host()
15266
+ ]);
15213
15267
  registerStorageSchemaInitializer((database) => {
15214
15268
  database.exec(`
15215
15269
  CREATE TABLE IF NOT EXISTS remote_ask_callbacks (
@@ -15435,8 +15489,10 @@ paint();document.body.appendChild(b)}
15435
15489
  if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",init);else init()})();
15436
15490
  </script>`;
15437
15491
  var init_visual_store = __esm(async () => {
15438
- await init_forum_db();
15439
- await init_storage_host();
15492
+ await __promiseAll([
15493
+ init_forum_db(),
15494
+ init_storage_host()
15495
+ ]);
15440
15496
  registerStorageSchemaInitializer((database) => {
15441
15497
  database.exec(`
15442
15498
  CREATE TABLE IF NOT EXISTS api_topic_visuals (
@@ -15805,39 +15861,41 @@ async function deleteTopicCascadeImpl(topic, userId, options, deletingAncestorId
15805
15861
  }
15806
15862
  var DELETE_TURN_WAIT_MS = 5000, TopicArchiveRequiredError, TopicTurnStillActiveError, TopicCleanupRequiredError;
15807
15863
  var init_lifecycle = __esm(async () => {
15808
- await init_archiver();
15809
- await init_idle_archiver();
15810
- await init_idle_compact();
15811
- await init_spawn_subagent();
15812
- await init_topic_cleanup();
15813
- await init_bus();
15814
15864
  init_manager();
15815
15865
  init_config();
15816
15866
  init_constants();
15817
15867
  init_logger();
15818
- await init_manager2();
15819
- await init_active_rooms();
15820
- await init_session_inbox_cleanup();
15821
15868
  init_state();
15822
- await init_ask_callbacks();
15823
15869
  init_file_hooks();
15824
15870
  init_usage_alert();
15825
- await init_visual_store();
15826
- await init_api_messages();
15827
- await init_api_topic_brief();
15828
- await init_api_topic_config();
15829
- await init_api_topics();
15830
- await init_browser_profiles();
15831
- await init_runtime_leases();
15832
- await init_runtime_topic_state();
15833
- await init_runtime_turn_requests();
15834
- await init_self_schedules();
15835
- await init_session_asks();
15836
- await init_token_stats();
15837
- await init_topic_archive();
15838
- await init_topic_archive_state();
15839
- await init_topic_host_mcp_grants();
15840
- await init_topic_tool_capabilities();
15871
+ await __promiseAll([
15872
+ init_archiver(),
15873
+ init_idle_archiver(),
15874
+ init_idle_compact(),
15875
+ init_spawn_subagent(),
15876
+ init_topic_cleanup(),
15877
+ init_bus(),
15878
+ init_manager2(),
15879
+ init_active_rooms(),
15880
+ init_session_inbox_cleanup(),
15881
+ init_ask_callbacks(),
15882
+ init_visual_store(),
15883
+ init_api_messages(),
15884
+ init_api_topic_brief(),
15885
+ init_api_topic_config(),
15886
+ init_api_topics(),
15887
+ init_browser_profiles(),
15888
+ init_runtime_leases(),
15889
+ init_runtime_topic_state(),
15890
+ init_runtime_turn_requests(),
15891
+ init_self_schedules(),
15892
+ init_session_asks(),
15893
+ init_token_stats(),
15894
+ init_topic_archive(),
15895
+ init_topic_archive_state(),
15896
+ init_topic_host_mcp_grants(),
15897
+ init_topic_tool_capabilities()
15898
+ ]);
15841
15899
  TopicArchiveRequiredError = class TopicArchiveRequiredError extends Error {
15842
15900
  code = "TOPIC_ARCHIVE_FAILED";
15843
15901
  topicId;
@@ -16199,8 +16257,8 @@ function abortPlaywrightTurns(instanceKey, failure) {
16199
16257
  var turnsByInstance;
16200
16258
  var init_playwright_turn_abort = __esm(async () => {
16201
16259
  init_logger();
16202
- await init_manager2();
16203
16260
  init_types2();
16261
+ await init_manager2();
16204
16262
  turnsByInstance = new Map;
16205
16263
  onPlaywrightFailure(abortPlaywrightTurns);
16206
16264
  });
@@ -16277,8 +16335,10 @@ function upsertTaskPanelMessage(topicId, queryId, tasks, lastRenderedText) {
16277
16335
  return text2;
16278
16336
  }
16279
16337
  var init_tasks2 = __esm(async () => {
16280
- await init_bus();
16281
- await init_api_messages();
16338
+ await __promiseAll([
16339
+ init_bus(),
16340
+ init_api_messages()
16341
+ ]);
16282
16342
  });
16283
16343
 
16284
16344
  // ../../packages/core/src/runtime/visual-html.ts
@@ -16576,10 +16636,12 @@ var init_visuals = __esm(async () => {
16576
16636
  init_paths();
16577
16637
  init_attachments();
16578
16638
  init_file_hooks();
16579
- await init_visual_store();
16580
16639
  init_sensitive_path();
16581
- await init_api_messages();
16582
16640
  init_visual_html();
16641
+ await __promiseAll([
16642
+ init_visual_store(),
16643
+ init_api_messages()
16644
+ ]);
16583
16645
  });
16584
16646
 
16585
16647
  // ../../packages/core/src/runtime/turn-event-stream.ts
@@ -17199,31 +17261,33 @@ ${JSON.stringify(event.input ?? {})}`);
17199
17261
  return outcome;
17200
17262
  }
17201
17263
  var init_turn_event_stream = __esm(async () => {
17202
- await init_fork();
17203
- await init_idle_archiver();
17204
- await init_idle_compact();
17205
- await init_ask_user();
17206
- await init_spawn_subagent();
17207
17264
  init_model_catalog();
17208
- await init_registry();
17209
17265
  init_tool_format();
17210
- await init_bus();
17211
17266
  init_logger();
17212
- await init_active_rooms();
17213
17267
  init_state();
17214
17268
  init_types2();
17215
17269
  init_attachments();
17216
17270
  init_errors();
17217
- await init_tasks2();
17218
- await init_topic_config();
17219
17271
  init_usage_alert();
17220
- await init_visual_store();
17221
- await init_visuals();
17222
17272
  init_sensitive_path();
17223
- await init_api_messages();
17224
- await init_api_topics();
17225
- await init_runtime_turn_requests();
17226
- await init_token_stats();
17273
+ await __promiseAll([
17274
+ init_fork(),
17275
+ init_idle_archiver(),
17276
+ init_idle_compact(),
17277
+ init_ask_user(),
17278
+ init_spawn_subagent(),
17279
+ init_registry(),
17280
+ init_bus(),
17281
+ init_active_rooms(),
17282
+ init_tasks2(),
17283
+ init_topic_config(),
17284
+ init_visual_store(),
17285
+ init_visuals(),
17286
+ init_api_messages(),
17287
+ init_api_topics(),
17288
+ init_runtime_turn_requests(),
17289
+ init_token_stats()
17290
+ ]);
17227
17291
  });
17228
17292
 
17229
17293
  // ../../packages/core/src/runtime/turn-session.ts
@@ -17255,10 +17319,12 @@ function resolveInitialTurnSessionId(topicId, requestedSessionId, isolated) {
17255
17319
  }
17256
17320
  var init_turn_session = __esm(async () => {
17257
17321
  init_model_catalog();
17258
- await init_registry();
17259
17322
  init_config_helpers();
17260
- await init_topic_config();
17261
- await init_api_topics();
17323
+ await __promiseAll([
17324
+ init_registry(),
17325
+ init_topic_config(),
17326
+ init_api_topics()
17327
+ ]);
17262
17328
  });
17263
17329
 
17264
17330
  // ../../packages/core/src/storage/app-settings.ts
@@ -18703,51 +18769,53 @@ function triggerTopicAiTurn(topicId, userId, prompt, agentType, opts) {
18703
18769
  }
18704
18770
  var PLAYWRIGHT_UNAVAILABLE_NOTICE_COOLDOWN_MS, ASK_REPLY_INJECT_BATCH_MS = 500, playwrightUnavailableNoticeAt, askReplyInjectBatcher, remoteInjectWaiters, durableTurnWorker = null, durableTurnWorkerBusy = false;
18705
18771
  var init_turn_runner = __esm(async () => {
18706
- await init_fork();
18707
- await init_agents();
18708
- await init_spawn_subagent();
18709
- await init_registry();
18710
- await init_bus();
18711
18772
  init_manager();
18712
18773
  init_constants();
18713
18774
  init_logger();
18714
18775
  init_mcp_config();
18715
- await init_manager2();
18716
18776
  init_builders();
18717
- await init_active_rooms();
18718
18777
  init_state();
18719
18778
  init_types2();
18720
18779
  init_attachments();
18721
- await init_channel_context();
18722
18780
  init_errors();
18723
- await init_playwright_turn_abort();
18724
- await init_topic_config();
18725
- await init_turn_event_stream();
18726
- await init_turn_session();
18727
18781
  init_user_turn_envelope();
18728
- await init_visual_store();
18729
- await init_visuals();
18730
- await init_api_messages();
18731
- await init_api_topic_brief();
18732
- await init_api_topics();
18733
- await init_app_settings();
18734
- await init_browser_profiles();
18735
- await init_conversations();
18736
- await init_runtime_leases();
18737
- await init_runtime_topic_state();
18738
- await init_runtime_turn_requests();
18739
- await init_topic_host_mcp_grants();
18740
- await init_topic_tool_capabilities();
18741
- await init_wiki();
18742
18782
  init_wiki_summary_names();
18743
- await init_derive();
18783
+ init_user_turn_envelope();
18784
+ await __promiseAll([
18785
+ init_fork(),
18786
+ init_agents(),
18787
+ init_spawn_subagent(),
18788
+ init_registry(),
18789
+ init_bus(),
18790
+ init_manager2(),
18791
+ init_active_rooms(),
18792
+ init_channel_context(),
18793
+ init_playwright_turn_abort(),
18794
+ init_topic_config(),
18795
+ init_turn_event_stream(),
18796
+ init_turn_session(),
18797
+ init_visual_store(),
18798
+ init_visuals(),
18799
+ init_api_messages(),
18800
+ init_api_topic_brief(),
18801
+ init_api_topics(),
18802
+ init_app_settings(),
18803
+ init_browser_profiles(),
18804
+ init_conversations(),
18805
+ init_runtime_leases(),
18806
+ init_runtime_topic_state(),
18807
+ init_runtime_turn_requests(),
18808
+ init_topic_host_mcp_grants(),
18809
+ init_topic_tool_capabilities(),
18810
+ init_wiki(),
18811
+ init_derive()
18812
+ ]);
18744
18813
  init_model_catalog();
18745
18814
  init_attachments();
18746
18815
  init_channel_context();
18747
18816
  init_errors();
18748
18817
  init_tasks2();
18749
18818
  init_turn_session();
18750
- init_user_turn_envelope();
18751
18819
  init_visuals();
18752
18820
  PLAYWRIGHT_UNAVAILABLE_NOTICE_COOLDOWN_MS = 5 * 60000;
18753
18821
  playwrightUnavailableNoticeAt = new Map;
@@ -19197,10 +19265,11 @@ ${card.task}${reportInstruction}`;
19197
19265
  error: "Error: subagent management is only available in agent rooms."
19198
19266
  };
19199
19267
  }
19268
+ const rootOwnerId = parent.participants.find((participant) => participant.role === "owner")?.userId;
19200
19269
  return {
19201
19270
  ok: true,
19202
19271
  parent,
19203
- children: (() => {
19272
+ children: rootOwnerId ? (() => {
19204
19273
  const topics = host.storage.listTopics();
19205
19274
  const byParent = new Map;
19206
19275
  for (const topic of topics) {
@@ -19217,7 +19286,7 @@ ${card.task}${reportInstruction}`;
19217
19286
  if (visited.has(child.id))
19218
19287
  continue;
19219
19288
  visited.add(child.id);
19220
- if (!child.participants.some((participant) => participant.userId === ctx.userId && participant.role === "owner")) {
19289
+ if (!child.participants.some((participant) => participant.userId === rootOwnerId && participant.role === "owner")) {
19221
19290
  continue;
19222
19291
  }
19223
19292
  descendants.push(child);
@@ -19226,7 +19295,7 @@ ${card.task}${reportInstruction}`;
19226
19295
  };
19227
19296
  visit(ctx.topicId);
19228
19297
  return descendants;
19229
- })()
19298
+ })() : []
19230
19299
  };
19231
19300
  }
19232
19301
  function subagentStatus(parentTopicId, childTopicId) {
@@ -19451,14 +19520,16 @@ function processOwnerIsAlive(ownerId) {
19451
19520
  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;
19452
19521
  var init_spawn_subagent = __esm(async () => {
19453
19522
  init_common();
19454
- await init_bus();
19455
19523
  init_logger();
19456
- await init_api_messages();
19457
- await init_api_topics();
19458
- await init_runtime_leases();
19459
- await init_runtime_turn_requests();
19460
19524
  init_wiki_summary_names();
19461
19525
  init_types();
19526
+ await __promiseAll([
19527
+ init_bus(),
19528
+ init_api_messages(),
19529
+ init_api_topics(),
19530
+ init_runtime_leases(),
19531
+ init_runtime_turn_requests()
19532
+ ]);
19462
19533
  defaultSubagentLifecycleHost = {
19463
19534
  storage: {
19464
19535
  getTopic,
@@ -19593,12 +19664,14 @@ var init_spawn_subagent = __esm(async () => {
19593
19664
  });
19594
19665
 
19595
19666
  // ../../packages/core/src/agents/public-helpers.ts
19596
- await init_archiver();
19597
- await init_auth_check();
19598
19667
  init_codex_tree_kill();
19599
- await init_fork();
19600
- await init_idle_archiver();
19601
- await init_ask_user();
19668
+ await __promiseAll([
19669
+ init_archiver(),
19670
+ init_auth_check(),
19671
+ init_fork(),
19672
+ init_idle_archiver(),
19673
+ init_ask_user()
19674
+ ]);
19602
19675
 
19603
19676
  // ../../packages/core/src/agents/mcp-tools/publish-html.ts
19604
19677
  init_common();
@@ -19851,13 +19924,15 @@ init_common();
19851
19924
  import { z as z3 } from "zod";
19852
19925
 
19853
19926
  // ../../packages/core/src/agents/api-topic-agent-switch.ts
19854
- await init_auth_check();
19855
19927
  init_model_catalog();
19856
- await init_registry();
19857
19928
  init_logger();
19858
- await init_api_topic_config();
19859
- await init_api_topics();
19860
- await init_conversations();
19929
+ await __promiseAll([
19930
+ init_auth_check(),
19931
+ init_registry(),
19932
+ init_api_topic_config(),
19933
+ init_api_topics(),
19934
+ init_conversations()
19935
+ ]);
19861
19936
  import { unlinkSync as unlinkSync9 } from "fs";
19862
19937
  function commitApiTopicSwitch(opts, bridgedSessionId) {
19863
19938
  const registry = getRegistry(opts.agent);
@@ -19957,15 +20032,17 @@ function switchApiTopicAgent(opts) {
19957
20032
  }
19958
20033
 
19959
20034
  // ../../packages/core/src/agents/self-config-core.ts
19960
- await init_auth_check();
19961
20035
  init_model_catalog();
19962
- await init_registry();
19963
- await init_bus();
19964
20036
  init_config();
19965
20037
  init_config_helpers();
19966
- await init_api_topic_config();
19967
- await init_api_topics();
19968
- await init_self_schedules();
20038
+ await __promiseAll([
20039
+ init_auth_check(),
20040
+ init_registry(),
20041
+ init_bus(),
20042
+ init_api_topic_config(),
20043
+ init_api_topics(),
20044
+ init_self_schedules()
20045
+ ]);
19969
20046
 
19970
20047
  // ../../packages/core/src/topics/links.ts
19971
20048
  function topicAppLink(topicId) {
@@ -20620,20 +20697,24 @@ var otiumVisualToolDefinitions = [
20620
20697
  ];
20621
20698
 
20622
20699
  // ../../packages/core/src/agents/public-helpers.ts
20623
- await init_task_events();
20624
20700
  init_tool_format();
20625
- await init_topic_cleanup();
20701
+ await __promiseAll([
20702
+ init_task_events(),
20703
+ init_topic_cleanup()
20704
+ ]);
20626
20705
 
20627
20706
  // ../../packages/core/src/agents/topic-defaults.ts
20628
20707
  init_model_catalog();
20629
- await init_registry();
20630
20708
  init_config();
20631
20709
  init_logger();
20710
+ await init_registry();
20632
20711
 
20633
20712
  // ../../packages/core/src/storage/topic-default-assignments.ts
20634
- await init_forum_db();
20635
- await init_storage_host();
20636
20713
  init_wiki_summary_names();
20714
+ await __promiseAll([
20715
+ init_forum_db(),
20716
+ init_storage_host()
20717
+ ]);
20637
20718
  registerStorageSchemaInitializer((database) => {
20638
20719
  database.exec(`
20639
20720
  CREATE TABLE IF NOT EXISTS topic_default_assignments (
@@ -20804,4 +20885,4 @@ export {
20804
20885
  DEFAULT_SELF_CONFIG_PRODUCT
20805
20886
  };
20806
20887
 
20807
- //# debugId=DA785970F26205EF64756E2164756E21
20888
+ //# debugId=0C381456723AA9D364756E2164756E21