negotium 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-helpers.js +573 -593
- package/dist/agent-helpers.js.map +17 -17
- package/dist/background-bash.js +3 -2
- package/dist/background-bash.js.map +3 -3
- package/dist/browser-runtime.js +76 -36
- package/dist/browser-runtime.js.map +6 -6
- package/dist/canonical-mcp-bridge.js +1 -1
- package/dist/{chunk-fc58cqry.js → chunk-rhp26p2c.js} +171 -26
- package/dist/{chunk-fc58cqry.js.map → chunk-rhp26p2c.js.map} +6 -5
- package/dist/{chunk-r0xs3t81.js → chunk-s2gez3wg.js} +18 -3
- package/dist/{chunk-r0xs3t81.js.map → chunk-s2gez3wg.js.map} +2 -2
- package/dist/hosted-agent.js +185 -54
- package/dist/hosted-agent.js.map +7 -6
- package/dist/main.js +1209 -1114
- package/dist/main.js.map +25 -25
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +526 -540
- package/dist/mcp-factories.js.map +17 -17
- package/dist/outbox.js.map +1 -1
- package/dist/platform-runtime.js.map +1 -1
- package/dist/prompts.js +3 -2
- package/dist/prompts.js.map +3 -3
- package/dist/query-runtime.js +63 -26
- package/dist/query-runtime.js.map +4 -4
- package/dist/registry.js +4 -3
- package/dist/registry.js.map +3 -3
- package/dist/rollout.js +1 -1
- package/dist/runtime/src/agents/archiver.ts +3 -2
- package/dist/runtime/src/application/switch-topic-access-mode.ts +81 -8
- package/dist/runtime/src/bus.ts +19 -2
- package/dist/runtime/src/mcp/session-comm/runtime.ts +16 -0
- package/dist/runtime/src/platform/config.ts +13 -1
- package/dist/runtime/src/runtime/ask-callbacks.ts +19 -11
- package/dist/runtime/src/runtime/background-sessions.ts +9 -7
- package/dist/runtime/src/runtime/visual-store.ts +31 -23
- package/dist/runtime/src/storage/api-topics.ts +26 -0
- package/dist/runtime/src/storage/browser-profiles.ts +16 -8
- package/dist/runtime/src/storage/runtime-events.ts +30 -20
- package/dist/runtime/src/storage/runtime-gateway-submissions.ts +24 -16
- package/dist/runtime/src/storage/runtime-turn-requests.ts +9 -1
- package/dist/runtime/src/storage/self-schedules.ts +32 -24
- package/dist/runtime/src/storage/storage-host.ts +105 -43
- package/dist/runtime/src/storage/vault.ts +12 -3
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js +63 -26
- package/dist/runtime-helpers.js.map +4 -4
- package/dist/sqlite.js +17 -1
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +92 -46
- package/dist/storage.js.map +4 -4
- package/dist/types/packages/core/src/storage/api-topics.d.ts +15 -0
- package/dist/types/packages/core/src/storage/storage-host.d.ts +10 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +156 -10
- package/dist/vault.js.map +6 -5
- 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
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
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
|
|
@@ -152,7 +162,7 @@ function browserRsMeetsMinimumVersion(candidate) {
|
|
|
152
162
|
try {
|
|
153
163
|
const output = execFileSync(candidate, ["--version"], {
|
|
154
164
|
encoding: "utf8",
|
|
155
|
-
timeout:
|
|
165
|
+
timeout: BROWSER_RS_VERSION_PROBE_TIMEOUT_MS,
|
|
156
166
|
stdio: ["ignore", "pipe", "ignore"]
|
|
157
167
|
}).trim();
|
|
158
168
|
const match = output.match(/^browser-rs (\d+)\.(\d+)\.(\d+)$/);
|
|
@@ -263,7 +273,7 @@ function resolveDefaultModel(agent, registryDefaultModel) {
|
|
|
263
273
|
function codexAuthFilePath() {
|
|
264
274
|
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
|
|
265
275
|
}
|
|
266
|
-
var HOME, PROJECT_ROOT, STATE_DIR_ENV, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BROWSER_RS_VERSION = "v0.1.19", BROWSER_RS_MIN_SECURE_VERSION = "0.1.15", SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.5", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, BROWSER_MCP_SSE_PROXY_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5", FALLBACK_AGENT, SESSION_AGENT, GATEWAY_AGENT, FALLBACK_MODEL, SESSION_MODEL, GATEWAY_MODEL, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, _envMaxTellDepth, MAX_TELL_DEPTH;
|
|
276
|
+
var HOME, PROJECT_ROOT, STATE_DIR_ENV, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BROWSER_RS_VERSION = "v0.1.19", BROWSER_RS_MIN_SECURE_VERSION = "0.1.15", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.5", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, BROWSER_MCP_SSE_PROXY_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_FABLE = "claude-fable-5", FALLBACK_AGENT, SESSION_AGENT, GATEWAY_AGENT, FALLBACK_MODEL, SESSION_MODEL, GATEWAY_MODEL, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, _envMaxTellDepth, MAX_TELL_DEPTH;
|
|
267
277
|
var init_config = __esm(() => {
|
|
268
278
|
init_config_helpers();
|
|
269
279
|
init_logger();
|
|
@@ -421,6 +431,225 @@ var init_sqlite = __esm(async () => {
|
|
|
421
431
|
}
|
|
422
432
|
});
|
|
423
433
|
|
|
434
|
+
// ../../packages/core/src/storage/storage-host.ts
|
|
435
|
+
import { mkdirSync as mkdirSync2 } from "fs";
|
|
436
|
+
import { homedir as homedir2 } from "os";
|
|
437
|
+
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
438
|
+
function storageState() {
|
|
439
|
+
const holder = globalThis;
|
|
440
|
+
const existing = holder[STORAGE_HOST_STATE];
|
|
441
|
+
if (existing)
|
|
442
|
+
return existing;
|
|
443
|
+
const created = {
|
|
444
|
+
configuredHost: {},
|
|
445
|
+
fallbackDatabase: null,
|
|
446
|
+
fallbackDatabasePath: null,
|
|
447
|
+
frames: [],
|
|
448
|
+
schemaInitializers: [],
|
|
449
|
+
initializedSchemas: new WeakMap,
|
|
450
|
+
initializingDatabases: new WeakSet
|
|
451
|
+
};
|
|
452
|
+
Object.defineProperty(holder, STORAGE_HOST_STATE, {
|
|
453
|
+
value: created,
|
|
454
|
+
enumerable: false,
|
|
455
|
+
writable: false,
|
|
456
|
+
configurable: false
|
|
457
|
+
});
|
|
458
|
+
return created;
|
|
459
|
+
}
|
|
460
|
+
function envPath(name, fallback) {
|
|
461
|
+
const value = process.env[name]?.trim();
|
|
462
|
+
return resolve2(value || fallback);
|
|
463
|
+
}
|
|
464
|
+
function defaultStateDir() {
|
|
465
|
+
return envPath("NEGOTIUM_STATE_DIR", join2(homedir2(), ".negotium"));
|
|
466
|
+
}
|
|
467
|
+
function defaultDataDir() {
|
|
468
|
+
return envPath("NEGOTIUM_DATA_DIR", join2(defaultStateDir(), "data"));
|
|
469
|
+
}
|
|
470
|
+
function defaultLogDir() {
|
|
471
|
+
return envPath("NEGOTIUM_LOG_DIR", join2(defaultStateDir(), "logs"));
|
|
472
|
+
}
|
|
473
|
+
function defaultWorkspaceDir() {
|
|
474
|
+
return envPath("NEGOTIUM_WORKSPACE_DIR", join2(defaultStateDir(), "workspace"));
|
|
475
|
+
}
|
|
476
|
+
function defaultSessionAsksDir() {
|
|
477
|
+
const runDir = envPath("NEGOTIUM_RUN_DIR", join2(defaultStateDir(), "runtime"));
|
|
478
|
+
return join2(runDir, "session-asks");
|
|
479
|
+
}
|
|
480
|
+
function defaultSessionsDatabasePath() {
|
|
481
|
+
return envPath("SESSIONS_DB_PATH", join2(resolveStorageDataDir(), "sessions.db"));
|
|
482
|
+
}
|
|
483
|
+
function isSqliteBusy(error) {
|
|
484
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
485
|
+
return /database is (?:locked|busy)|SQLITE_(?:BUSY|LOCKED)/i.test(message);
|
|
486
|
+
}
|
|
487
|
+
function execWithBusyRetry(database, sql, timeoutMs = SQLITE_INIT_TIMEOUT_MS) {
|
|
488
|
+
const deadline = Date.now() + timeoutMs;
|
|
489
|
+
while (true) {
|
|
490
|
+
try {
|
|
491
|
+
database.exec(sql);
|
|
492
|
+
return;
|
|
493
|
+
} catch (error) {
|
|
494
|
+
if (!isSqliteBusy(error) || Date.now() >= deadline)
|
|
495
|
+
throw error;
|
|
496
|
+
Atomics.wait(SQLITE_INIT_SLEEP, 0, 0, Math.min(SQLITE_INIT_RETRY_MS, deadline - Date.now()));
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
function initializeDatabase(database) {
|
|
501
|
+
database.exec("PRAGMA busy_timeout = 5000");
|
|
502
|
+
execWithBusyRetry(database, "PRAGMA journal_mode = WAL");
|
|
503
|
+
database.exec("PRAGMA foreign_keys = ON");
|
|
504
|
+
database.exec("PRAGMA wal_autocheckpoint = 1000");
|
|
505
|
+
try {
|
|
506
|
+
database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
507
|
+
} catch {}
|
|
508
|
+
}
|
|
509
|
+
function defaultDatabase() {
|
|
510
|
+
const path = defaultSessionsDatabasePath();
|
|
511
|
+
const state = storageState();
|
|
512
|
+
if (state.fallbackDatabase && state.fallbackDatabasePath === path)
|
|
513
|
+
return state.fallbackDatabase;
|
|
514
|
+
if (state.fallbackDatabase)
|
|
515
|
+
state.fallbackDatabase.close();
|
|
516
|
+
mkdirSync2(dirname2(path), { recursive: true });
|
|
517
|
+
state.fallbackDatabase = new Database(path, { create: true });
|
|
518
|
+
state.fallbackDatabasePath = path;
|
|
519
|
+
initializeDatabase(state.fallbackDatabase);
|
|
520
|
+
return state.fallbackDatabase;
|
|
521
|
+
}
|
|
522
|
+
function resolveStorageDatabase() {
|
|
523
|
+
return storageState().configuredHost.database ?? defaultDatabase();
|
|
524
|
+
}
|
|
525
|
+
function resolveStorageDataDir() {
|
|
526
|
+
return storageState().configuredHost.dataDir ?? defaultDataDir();
|
|
527
|
+
}
|
|
528
|
+
function resolveStorageLogDir() {
|
|
529
|
+
return storageState().configuredHost.logDir ?? defaultLogDir();
|
|
530
|
+
}
|
|
531
|
+
function resolveStorageSessionAsksDir() {
|
|
532
|
+
return storageState().configuredHost.sessionAsksDir ?? defaultSessionAsksDir();
|
|
533
|
+
}
|
|
534
|
+
function resolveStorageWorkspaceDir() {
|
|
535
|
+
return storageState().configuredHost.workspaceDir ?? defaultWorkspaceDir();
|
|
536
|
+
}
|
|
537
|
+
function resolveStorageSharedWikiDir() {
|
|
538
|
+
return storageState().configuredHost.sharedWikiDir ?? join2(resolveStorageWorkspaceDir(), "wiki");
|
|
539
|
+
}
|
|
540
|
+
function resolveStorageUsersLogDir() {
|
|
541
|
+
return storageState().configuredHost.usersLogDir ?? join2(resolveStorageDataDir(), "users");
|
|
542
|
+
}
|
|
543
|
+
function normalizeStorageHostPatch(options) {
|
|
544
|
+
const patch = {};
|
|
545
|
+
if (options.database !== undefined) {
|
|
546
|
+
options.database.exec("PRAGMA foreign_keys = ON");
|
|
547
|
+
patch.database = options.database;
|
|
548
|
+
}
|
|
549
|
+
for (const key of STORAGE_PATH_KEYS) {
|
|
550
|
+
const value = options[key];
|
|
551
|
+
if (value === undefined)
|
|
552
|
+
continue;
|
|
553
|
+
if (!value.trim())
|
|
554
|
+
throw new TypeError(`${key} must not be empty`);
|
|
555
|
+
patch[key] = resolve2(value);
|
|
556
|
+
}
|
|
557
|
+
return Object.freeze(patch);
|
|
558
|
+
}
|
|
559
|
+
function refreshConfiguredHost() {
|
|
560
|
+
const state = storageState();
|
|
561
|
+
state.configuredHost = Object.freeze(Object.assign({}, ...state.frames.filter((frame) => frame.active).map((frame) => frame.patch)));
|
|
562
|
+
}
|
|
563
|
+
function configureStorageHost(options) {
|
|
564
|
+
const frame = { active: true, patch: normalizeStorageHostPatch(options) };
|
|
565
|
+
storageState().frames.push(frame);
|
|
566
|
+
refreshConfiguredHost();
|
|
567
|
+
return () => {
|
|
568
|
+
if (!frame.active)
|
|
569
|
+
return;
|
|
570
|
+
frame.active = false;
|
|
571
|
+
const frames = storageState().frames;
|
|
572
|
+
const index = frames.indexOf(frame);
|
|
573
|
+
if (index >= 0)
|
|
574
|
+
frames.splice(index, 1);
|
|
575
|
+
refreshConfiguredHost();
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function resetStorageHost() {
|
|
579
|
+
const frames = storageState().frames;
|
|
580
|
+
for (const frame of frames)
|
|
581
|
+
frame.active = false;
|
|
582
|
+
frames.length = 0;
|
|
583
|
+
refreshConfiguredHost();
|
|
584
|
+
}
|
|
585
|
+
function closeStorageDatabase() {
|
|
586
|
+
const state = storageState();
|
|
587
|
+
if (!state.fallbackDatabase)
|
|
588
|
+
return;
|
|
589
|
+
state.fallbackDatabase.close();
|
|
590
|
+
state.fallbackDatabase = null;
|
|
591
|
+
state.fallbackDatabasePath = null;
|
|
592
|
+
}
|
|
593
|
+
function registerStorageSchemaInitializer(initialize, priority = 100) {
|
|
594
|
+
const initializers = storageState().schemaInitializers;
|
|
595
|
+
initializers.push({ initialize, priority });
|
|
596
|
+
initializers.sort((a, b) => a.priority - b.priority);
|
|
597
|
+
}
|
|
598
|
+
function ensureStorageSchemas(database = resolveStorageDatabase()) {
|
|
599
|
+
const state = storageState();
|
|
600
|
+
if (state.initializingDatabases.has(database))
|
|
601
|
+
return;
|
|
602
|
+
let initialized = state.initializedSchemas.get(database);
|
|
603
|
+
if (!initialized) {
|
|
604
|
+
initialized = new Set;
|
|
605
|
+
state.initializedSchemas.set(database, initialized);
|
|
606
|
+
}
|
|
607
|
+
state.initializingDatabases.add(database);
|
|
608
|
+
try {
|
|
609
|
+
for (const entry of state.schemaInitializers) {
|
|
610
|
+
if (initialized.has(entry.initialize))
|
|
611
|
+
continue;
|
|
612
|
+
initialized.add(entry.initialize);
|
|
613
|
+
try {
|
|
614
|
+
entry.initialize(database);
|
|
615
|
+
} catch (error) {
|
|
616
|
+
initialized.delete(entry.initialize);
|
|
617
|
+
throw error;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
} finally {
|
|
621
|
+
state.initializingDatabases.delete(database);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
var STORAGE_HOST_STATE, SQLITE_INIT_RETRY_MS = 25, SQLITE_INIT_TIMEOUT_MS = 5000, SQLITE_INIT_SLEEP, STORAGE_PATH_KEYS, internalStorageDatabase, storageDatabase;
|
|
625
|
+
var init_storage_host = __esm(async () => {
|
|
626
|
+
await init_sqlite();
|
|
627
|
+
STORAGE_HOST_STATE = Symbol.for("negotium.storage-host.state.v1");
|
|
628
|
+
SQLITE_INIT_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
629
|
+
STORAGE_PATH_KEYS = [
|
|
630
|
+
"dataDir",
|
|
631
|
+
"logDir",
|
|
632
|
+
"sessionAsksDir",
|
|
633
|
+
"workspaceDir",
|
|
634
|
+
"sharedWikiDir",
|
|
635
|
+
"usersLogDir"
|
|
636
|
+
];
|
|
637
|
+
internalStorageDatabase = new Proxy({}, {
|
|
638
|
+
get(_target, property) {
|
|
639
|
+
const database = resolveStorageDatabase();
|
|
640
|
+
ensureStorageSchemas(database);
|
|
641
|
+
const value = Reflect.get(database, property, database);
|
|
642
|
+
return typeof value === "function" ? value.bind(database) : value;
|
|
643
|
+
},
|
|
644
|
+
set(_target, property, value) {
|
|
645
|
+
const database = resolveStorageDatabase();
|
|
646
|
+
ensureStorageSchemas(database);
|
|
647
|
+
return Reflect.set(database, property, value, database);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
storageDatabase = internalStorageDatabase;
|
|
651
|
+
});
|
|
652
|
+
|
|
424
653
|
// ../../packages/core/src/storage/vault-crypto-core.ts
|
|
425
654
|
import { createCipheriv, createDecipheriv, createHash, randomBytes as randomBytes2 } from "crypto";
|
|
426
655
|
function encryptionKey(masterKey) {
|
|
@@ -477,8 +706,8 @@ var init_vault_crypto = __esm(() => {
|
|
|
477
706
|
});
|
|
478
707
|
|
|
479
708
|
// ../../packages/core/src/storage/vault.ts
|
|
480
|
-
import { chmodSync as chmodSync2, mkdirSync as
|
|
481
|
-
import { join as
|
|
709
|
+
import { chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
710
|
+
import { join as join3 } from "path";
|
|
482
711
|
function initializeVaultDatabase(database) {
|
|
483
712
|
database.exec("PRAGMA journal_mode = WAL");
|
|
484
713
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -513,17 +742,18 @@ function initializeVaultDatabase(database) {
|
|
|
513
742
|
}
|
|
514
743
|
}
|
|
515
744
|
function openVaultDatabase(dataDir) {
|
|
516
|
-
const vaultDir =
|
|
517
|
-
const path =
|
|
518
|
-
|
|
745
|
+
const vaultDir = join3(dataDir, "vault");
|
|
746
|
+
const path = join3(vaultDir, "vault.db");
|
|
747
|
+
mkdirSync3(vaultDir, { recursive: true, mode: 448 });
|
|
519
748
|
const database = new Database(path, { create: true });
|
|
520
749
|
chmodSync2(path, 384);
|
|
521
750
|
initializeVaultDatabase(database);
|
|
522
751
|
return database;
|
|
523
752
|
}
|
|
524
753
|
function activeVaultDatabase() {
|
|
525
|
-
if (!vaultDb)
|
|
526
|
-
vaultDb = openVaultDatabase(
|
|
754
|
+
if (!vaultDb) {
|
|
755
|
+
vaultDb = openVaultDatabase(resolveStorageDataDir());
|
|
756
|
+
}
|
|
527
757
|
return vaultDb;
|
|
528
758
|
}
|
|
529
759
|
function configureVaultStorage(options) {
|
|
@@ -532,7 +762,7 @@ function configureVaultStorage(options) {
|
|
|
532
762
|
}
|
|
533
763
|
const previousDb = vaultDb;
|
|
534
764
|
const previousMasterKey = vaultMasterKey;
|
|
535
|
-
const configuredDb = options.database ?? openVaultDatabase(options.dataDir ??
|
|
765
|
+
const configuredDb = options.database ?? openVaultDatabase(options.dataDir ?? resolveStorageDataDir());
|
|
536
766
|
if (options.database)
|
|
537
767
|
initializeVaultDatabase(configuredDb);
|
|
538
768
|
vaultDb = configuredDb;
|
|
@@ -686,8 +916,9 @@ function redactVaultSecrets(userId, text) {
|
|
|
686
916
|
var vaultDb, vaultMasterKey, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
|
|
687
917
|
var init_vault = __esm(async () => {
|
|
688
918
|
init_config();
|
|
689
|
-
init_vault_crypto();
|
|
690
919
|
await init_sqlite();
|
|
920
|
+
await init_storage_host();
|
|
921
|
+
init_vault_crypto();
|
|
691
922
|
vaultMasterKey = VAULT_MASTER_KEY;
|
|
692
923
|
VAULT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/;
|
|
693
924
|
VAULT_VALUE_MAX_BYTES = 64 * 1024;
|
|
@@ -701,8 +932,8 @@ __export(exports_auth_check, {
|
|
|
701
932
|
});
|
|
702
933
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
703
934
|
import { existsSync as existsSync2 } from "fs";
|
|
704
|
-
import { homedir as
|
|
705
|
-
import { join as
|
|
935
|
+
import { homedir as homedir3, platform } from "os";
|
|
936
|
+
import { join as join4 } from "path";
|
|
706
937
|
function hasMaestroCredential(host, key, userId) {
|
|
707
938
|
if (userId && host.getVaultValue(userId, key)?.trim())
|
|
708
939
|
return true;
|
|
@@ -722,7 +953,7 @@ function checkAgentAuth(agent, host = defaultAgentAuthHost, userId) {
|
|
|
722
953
|
case "claude": {
|
|
723
954
|
if (host.environment.ANTHROPIC_API_KEY)
|
|
724
955
|
return { ok: true };
|
|
725
|
-
const path =
|
|
956
|
+
const path = join4(host.homeDirectory(), ".claude", ".credentials.json");
|
|
726
957
|
if (host.operatingSystem() === "darwin") {
|
|
727
958
|
if (host.hasMacOsCredential("Claude Code-credentials") || host.exists(path)) {
|
|
728
959
|
return { ok: true };
|
|
@@ -775,7 +1006,7 @@ var init_auth_check = __esm(async () => {
|
|
|
775
1006
|
codexAuthFilePath,
|
|
776
1007
|
exists: existsSync2,
|
|
777
1008
|
environment: process.env,
|
|
778
|
-
homeDirectory:
|
|
1009
|
+
homeDirectory: homedir3,
|
|
779
1010
|
operatingSystem: platform,
|
|
780
1011
|
hasMacOsCredential(service) {
|
|
781
1012
|
try {
|
|
@@ -842,12 +1073,12 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
842
1073
|
const previous = spawnChain;
|
|
843
1074
|
let release;
|
|
844
1075
|
let released = false;
|
|
845
|
-
spawnChain = new Promise((
|
|
1076
|
+
spawnChain = new Promise((resolve3) => {
|
|
846
1077
|
release = () => {
|
|
847
1078
|
if (released)
|
|
848
1079
|
return;
|
|
849
1080
|
released = true;
|
|
850
|
-
|
|
1081
|
+
resolve3();
|
|
851
1082
|
};
|
|
852
1083
|
});
|
|
853
1084
|
await previous;
|
|
@@ -954,7 +1185,7 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
954
1185
|
return;
|
|
955
1186
|
const deadline = Date.now() + Math.max(0, graceMs);
|
|
956
1187
|
while (Date.now() < deadline && hasSurvivors(plan.targets)) {
|
|
957
|
-
await new Promise((
|
|
1188
|
+
await new Promise((resolve3) => setTimeout(resolve3, Math.min(100, Math.max(1, deadline - Date.now()))));
|
|
958
1189
|
}
|
|
959
1190
|
killStragglers(plan);
|
|
960
1191
|
}
|
|
@@ -1102,8 +1333,8 @@ function renderUserTurnBatch(messages) {
|
|
|
1102
1333
|
}
|
|
1103
1334
|
|
|
1104
1335
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
1105
|
-
import { mkdirSync as
|
|
1106
|
-
import { resolve as
|
|
1336
|
+
import { mkdirSync as mkdirSync4 } from "fs";
|
|
1337
|
+
import { resolve as resolve3 } from "path";
|
|
1107
1338
|
function clone(obj) {
|
|
1108
1339
|
return structuredClone(obj);
|
|
1109
1340
|
}
|
|
@@ -1113,7 +1344,7 @@ function assertUuidLike(label, value) {
|
|
|
1113
1344
|
}
|
|
1114
1345
|
}
|
|
1115
1346
|
function assertCwdInWorkspace(cwd) {
|
|
1116
|
-
const abs =
|
|
1347
|
+
const abs = resolve3(cwd);
|
|
1117
1348
|
const ok = trustedWorkspaceRoots.some((root) => abs === root || abs.startsWith(`${root}/`));
|
|
1118
1349
|
if (!ok) {
|
|
1119
1350
|
throw new Error(`rollout: cwd outside trusted workspace roots: ${cwd} (resolved=${abs})`);
|
|
@@ -1122,7 +1353,7 @@ function assertCwdInWorkspace(cwd) {
|
|
|
1122
1353
|
function ensureCwdExists(cwd) {
|
|
1123
1354
|
assertCwdInWorkspace(cwd);
|
|
1124
1355
|
try {
|
|
1125
|
-
|
|
1356
|
+
mkdirSync4(cwd, { recursive: true });
|
|
1126
1357
|
} catch (err) {
|
|
1127
1358
|
logger.warn({ err, cwd }, "rollout: ensureCwdExists failed \u2014 caller should pre-create cwd");
|
|
1128
1359
|
}
|
|
@@ -1243,8 +1474,8 @@ var init_shared = __esm(() => {
|
|
|
1243
1474
|
DM_WORKSPACE_DIR,
|
|
1244
1475
|
SESSION_WORKSPACE_DIR,
|
|
1245
1476
|
TOPIC_WORKSPACE_DIR
|
|
1246
|
-
].map((root) =>
|
|
1247
|
-
FIXTURES_DIR =
|
|
1477
|
+
].map((root) => resolve3(root));
|
|
1478
|
+
FIXTURES_DIR = resolve3(PROJECT_ROOT, "src", "agents", "fixtures");
|
|
1248
1479
|
UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1249
1480
|
});
|
|
1250
1481
|
|
|
@@ -1279,7 +1510,7 @@ import {
|
|
|
1279
1510
|
appendFileSync,
|
|
1280
1511
|
closeSync,
|
|
1281
1512
|
fsyncSync,
|
|
1282
|
-
mkdirSync as
|
|
1513
|
+
mkdirSync as mkdirSync5,
|
|
1283
1514
|
openSync,
|
|
1284
1515
|
readFileSync as readFileSync2,
|
|
1285
1516
|
renameSync,
|
|
@@ -1287,7 +1518,7 @@ import {
|
|
|
1287
1518
|
unlinkSync as unlinkSync2,
|
|
1288
1519
|
writeFileSync as writeFileSync2
|
|
1289
1520
|
} from "fs";
|
|
1290
|
-
import { dirname as
|
|
1521
|
+
import { dirname as dirname3 } from "path";
|
|
1291
1522
|
function readJsonlLines(filePath) {
|
|
1292
1523
|
return readFileSync2(filePath, "utf-8").trim().split(`
|
|
1293
1524
|
`).filter(Boolean);
|
|
@@ -1335,7 +1566,7 @@ function appendJsonlEntry(filePath, entry) {
|
|
|
1335
1566
|
`);
|
|
1336
1567
|
}
|
|
1337
1568
|
function appendJsonlLine(filePath, line) {
|
|
1338
|
-
|
|
1569
|
+
mkdirSync5(dirname3(filePath), { recursive: true });
|
|
1339
1570
|
const lockPath = `${filePath}${LOCK_SUFFIX}`;
|
|
1340
1571
|
const payload = line.endsWith(`
|
|
1341
1572
|
`) ? line : `${line}
|
|
@@ -1366,8 +1597,8 @@ function appendJsonlLine(filePath, line) {
|
|
|
1366
1597
|
}
|
|
1367
1598
|
}
|
|
1368
1599
|
function writeJsonlFile(filePath, entries) {
|
|
1369
|
-
const dir =
|
|
1370
|
-
|
|
1600
|
+
const dir = dirname3(filePath);
|
|
1601
|
+
mkdirSync5(dir, { recursive: true });
|
|
1371
1602
|
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1372
1603
|
const payload = `${entries.map((e) => JSON.stringify(e)).join(`
|
|
1373
1604
|
`)}
|
|
@@ -1425,12 +1656,12 @@ var init_jsonl = __esm(() => {
|
|
|
1425
1656
|
// ../../packages/core/src/agents/rollout/claude.ts
|
|
1426
1657
|
import { randomUUID } from "crypto";
|
|
1427
1658
|
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
1428
|
-
import { homedir as
|
|
1429
|
-
import { join as
|
|
1659
|
+
import { homedir as homedir4 } from "os";
|
|
1660
|
+
import { join as join5 } from "path";
|
|
1430
1661
|
function loadClaudeAttachments() {
|
|
1431
1662
|
if (_attachmentsCache)
|
|
1432
1663
|
return _attachmentsCache;
|
|
1433
|
-
const raw = readFileSync3(
|
|
1664
|
+
const raw = readFileSync3(join5(FIXTURES_DIR, "claude-attachments.jsonl"), "utf8");
|
|
1434
1665
|
const lines = parseJsonlText(raw);
|
|
1435
1666
|
if (lines.length < 2) {
|
|
1436
1667
|
throw new Error(`loadClaudeAttachments: expected >=2 entries in claude-attachments.jsonl, got ${lines.length}`);
|
|
@@ -1531,8 +1762,8 @@ function writeClaudeRollout(opts) {
|
|
|
1531
1762
|
});
|
|
1532
1763
|
lastUuid = assistantUuid;
|
|
1533
1764
|
}
|
|
1534
|
-
const projectsDir =
|
|
1535
|
-
const path =
|
|
1765
|
+
const projectsDir = join5(homedir4(), ".claude", "projects", encodeClaudeCwd(opts.cwd));
|
|
1766
|
+
const path = join5(projectsDir, `${sessionId}.jsonl`);
|
|
1536
1767
|
writeJsonlFile(path, lines);
|
|
1537
1768
|
logger.info({ sessionId, path, pairs: pairs.length }, "writeClaudeRollout: synthetic rollout placed");
|
|
1538
1769
|
return { sessionId, rolloutPath: path };
|
|
@@ -1545,9 +1776,9 @@ var init_claude = __esm(() => {
|
|
|
1545
1776
|
});
|
|
1546
1777
|
|
|
1547
1778
|
// ../../packages/core/src/agents/claude-registry.ts
|
|
1548
|
-
import { existsSync as existsSync4, mkdirSync as
|
|
1549
|
-
import { homedir as
|
|
1550
|
-
import { join as
|
|
1779
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync6, readdirSync, renameSync as renameSync2, unlinkSync as unlinkSync3 } from "fs";
|
|
1780
|
+
import { homedir as homedir5 } from "os";
|
|
1781
|
+
import { join as join6 } from "path";
|
|
1551
1782
|
var ALIAS_MAP, VALID_ALIASES, VALID_EFFORTS, claudeRegistry, claudeRegistryOperations;
|
|
1552
1783
|
var init_claude_registry = __esm(() => {
|
|
1553
1784
|
init_claude();
|
|
@@ -1594,15 +1825,15 @@ var init_claude_registry = __esm(() => {
|
|
|
1594
1825
|
const result = await forkSession(parentSessionId, {
|
|
1595
1826
|
...title ? { title } : {}
|
|
1596
1827
|
});
|
|
1597
|
-
const projectsRoot =
|
|
1598
|
-
const destDir =
|
|
1599
|
-
const destPath =
|
|
1828
|
+
const projectsRoot = join6(homedir5(), ".claude", "projects");
|
|
1829
|
+
const destDir = join6(projectsRoot, encodeClaudeCwd(cwd));
|
|
1830
|
+
const destPath = join6(destDir, `${result.sessionId}.jsonl`);
|
|
1600
1831
|
if (!existsSync4(destPath)) {
|
|
1601
|
-
const sourcePath = readdirSync(projectsRoot).map((d) =>
|
|
1832
|
+
const sourcePath = readdirSync(projectsRoot).map((d) => join6(projectsRoot, d, `${result.sessionId}.jsonl`)).find((p) => existsSync4(p));
|
|
1602
1833
|
if (!sourcePath) {
|
|
1603
1834
|
throw new Error(`claude forkSession: fork rollout ${result.sessionId}.jsonl not found under ${projectsRoot}`);
|
|
1604
1835
|
}
|
|
1605
|
-
|
|
1836
|
+
mkdirSync6(destDir, { recursive: true });
|
|
1606
1837
|
renameSync2(sourcePath, destPath);
|
|
1607
1838
|
}
|
|
1608
1839
|
return {
|
|
@@ -1611,10 +1842,10 @@ var init_claude_registry = __esm(() => {
|
|
|
1611
1842
|
};
|
|
1612
1843
|
},
|
|
1613
1844
|
async cleanupRollouts({ cwd, sessionIds }) {
|
|
1614
|
-
const projectsDir =
|
|
1845
|
+
const projectsDir = join6(homedir5(), ".claude", "projects", encodeClaudeCwd(cwd));
|
|
1615
1846
|
const failures = [];
|
|
1616
1847
|
for (const sid of sessionIds) {
|
|
1617
|
-
const path =
|
|
1848
|
+
const path = join6(projectsDir, `${sid}.jsonl`);
|
|
1618
1849
|
try {
|
|
1619
1850
|
unlinkSync3(path);
|
|
1620
1851
|
} catch (e) {
|
|
@@ -1636,7 +1867,7 @@ var exports_version = {};
|
|
|
1636
1867
|
__export(exports_version, {
|
|
1637
1868
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
1638
1869
|
});
|
|
1639
|
-
var NEGOTIUM_VERSION = "0.2.
|
|
1870
|
+
var NEGOTIUM_VERSION = "0.2.21";
|
|
1640
1871
|
|
|
1641
1872
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
1642
1873
|
import { spawn } from "child_process";
|
|
@@ -1654,7 +1885,7 @@ import {
|
|
|
1654
1885
|
} from "fs";
|
|
1655
1886
|
import { createRequire as createRequire2 } from "module";
|
|
1656
1887
|
import { tmpdir } from "os";
|
|
1657
|
-
import { dirname as
|
|
1888
|
+
import { dirname as dirname4, join as join7 } from "path";
|
|
1658
1889
|
function readPackageVersion(packageJsonPath) {
|
|
1659
1890
|
const parsed = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
1660
1891
|
if (typeof parsed.version !== "string" || !parsed.version.trim()) {
|
|
@@ -1663,7 +1894,7 @@ function readPackageVersion(packageJsonPath) {
|
|
|
1663
1894
|
return parsed.version;
|
|
1664
1895
|
}
|
|
1665
1896
|
function codexCliScriptPath() {
|
|
1666
|
-
return
|
|
1897
|
+
return join7(dirname4(bundledCodexPackagePath), "bin", "codex.js");
|
|
1667
1898
|
}
|
|
1668
1899
|
function parseCodexModelCache(contents, sourcePath) {
|
|
1669
1900
|
let parsed;
|
|
@@ -1704,14 +1935,14 @@ function writePrivateFileAtomic(path, contents) {
|
|
|
1704
1935
|
}
|
|
1705
1936
|
}
|
|
1706
1937
|
function bundledCodexModelCachePath(authFilePath) {
|
|
1707
|
-
return
|
|
1938
|
+
return join7(dirname4(authFilePath), NEGOTIUM_MODEL_CACHE);
|
|
1708
1939
|
}
|
|
1709
1940
|
async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
1710
1941
|
const child = spawn(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
|
|
1711
1942
|
env: { ...process.env, CODEX_HOME: codexHome },
|
|
1712
1943
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1713
1944
|
});
|
|
1714
|
-
await new Promise((
|
|
1945
|
+
await new Promise((resolve4, reject) => {
|
|
1715
1946
|
let settled = false;
|
|
1716
1947
|
let stdoutBuffer = "";
|
|
1717
1948
|
let stderr = "";
|
|
@@ -1730,7 +1961,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
1730
1961
|
else if (!existsSync5(cachePath))
|
|
1731
1962
|
reject(new Error("Codex did not create its model cache"));
|
|
1732
1963
|
else
|
|
1733
|
-
|
|
1964
|
+
resolve4();
|
|
1734
1965
|
};
|
|
1735
1966
|
const send = (message) => {
|
|
1736
1967
|
child.stdin.write(`${JSON.stringify(message)}
|
|
@@ -1789,16 +2020,16 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
1789
2020
|
});
|
|
1790
2021
|
}
|
|
1791
2022
|
async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
1792
|
-
const sourceHome =
|
|
1793
|
-
const isolatedHome = mkdtempSync(
|
|
1794
|
-
const isolatedCachePath =
|
|
2023
|
+
const sourceHome = dirname4(authFilePath);
|
|
2024
|
+
const isolatedHome = mkdtempSync(join7(tmpdir(), "negotium-codex-models-"));
|
|
2025
|
+
const isolatedCachePath = join7(isolatedHome, "models_cache.json");
|
|
1795
2026
|
try {
|
|
1796
|
-
const isolatedAuthPath =
|
|
2027
|
+
const isolatedAuthPath = join7(isolatedHome, "auth.json");
|
|
1797
2028
|
copyFileSync(authFilePath, isolatedAuthPath);
|
|
1798
2029
|
chmodSync3(isolatedAuthPath, 384);
|
|
1799
|
-
const sourceConfigPath =
|
|
2030
|
+
const sourceConfigPath = join7(sourceHome, "config.toml");
|
|
1800
2031
|
if (existsSync5(sourceConfigPath)) {
|
|
1801
|
-
const isolatedConfigPath =
|
|
2032
|
+
const isolatedConfigPath = join7(isolatedHome, "config.toml");
|
|
1802
2033
|
copyFileSync(sourceConfigPath, isolatedConfigPath);
|
|
1803
2034
|
chmodSync3(isolatedConfigPath, 384);
|
|
1804
2035
|
}
|
|
@@ -1809,7 +2040,7 @@ async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
|
1809
2040
|
}
|
|
1810
2041
|
}
|
|
1811
2042
|
async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexModelCache) {
|
|
1812
|
-
const codexHome =
|
|
2043
|
+
const codexHome = dirname4(authFilePath);
|
|
1813
2044
|
const configuredCachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE;
|
|
1814
2045
|
if (configuredCachePath) {
|
|
1815
2046
|
if (!existsSync5(configuredCachePath)) {
|
|
@@ -1819,7 +2050,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
|
|
|
1819
2050
|
return configuredCachePath;
|
|
1820
2051
|
}
|
|
1821
2052
|
const bundledCachePath = bundledCodexModelCachePath(authFilePath);
|
|
1822
|
-
const sharedCachePath =
|
|
2053
|
+
const sharedCachePath = join7(codexHome, "models_cache.json");
|
|
1823
2054
|
if (existsSync5(sharedCachePath)) {
|
|
1824
2055
|
try {
|
|
1825
2056
|
const shared = readCompatibleCodexModelCache(sharedCachePath);
|
|
@@ -1838,8 +2069,8 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
|
|
|
1838
2069
|
return bundledCachePath;
|
|
1839
2070
|
}
|
|
1840
2071
|
function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
|
|
1841
|
-
const codexHome =
|
|
1842
|
-
const outputPath =
|
|
2072
|
+
const codexHome = dirname4(authFilePath);
|
|
2073
|
+
const outputPath = join7(codexHome, NEGOTIUM_MODEL_CATALOG);
|
|
1843
2074
|
const parsed = readCodexModelCache(sourcePath).parsed;
|
|
1844
2075
|
const models = parsed.models.map((model, index) => {
|
|
1845
2076
|
if (!model || typeof model !== "object" || Array.isArray(model)) {
|
|
@@ -1866,9 +2097,9 @@ var init_codex_native_multi_agent = __esm(() => {
|
|
|
1866
2097
|
|
|
1867
2098
|
// ../../packages/core/src/security/sensitive-path.ts
|
|
1868
2099
|
import { realpathSync } from "fs";
|
|
1869
|
-
import { resolve as
|
|
2100
|
+
import { resolve as resolve4 } from "path";
|
|
1870
2101
|
function isSensitivePath(filePath) {
|
|
1871
|
-
const normalized =
|
|
2102
|
+
const normalized = resolve4(filePath);
|
|
1872
2103
|
if (SENSITIVE_PATH_PATTERNS.some((p) => p.test(normalized)))
|
|
1873
2104
|
return true;
|
|
1874
2105
|
try {
|
|
@@ -2388,12 +2619,12 @@ function createBackgroundBashManager(options = {}) {
|
|
|
2388
2619
|
usedPorts.clear();
|
|
2389
2620
|
knownContexts.clear();
|
|
2390
2621
|
const deadline = now() + 3000;
|
|
2391
|
-
await Promise.all(entries.map((instance) => new Promise((
|
|
2622
|
+
await Promise.all(entries.map((instance) => new Promise((resolve5) => {
|
|
2392
2623
|
if (instance.process.exitCode !== null || instance.process.killed)
|
|
2393
|
-
return
|
|
2394
|
-
instance.process.once("exit",
|
|
2395
|
-
instance.process.once("error",
|
|
2396
|
-
const timer = setTimeout(
|
|
2624
|
+
return resolve5();
|
|
2625
|
+
instance.process.once("exit", resolve5);
|
|
2626
|
+
instance.process.once("error", resolve5);
|
|
2627
|
+
const timer = setTimeout(resolve5, Math.max(0, deadline - now()));
|
|
2397
2628
|
timer.unref?.();
|
|
2398
2629
|
})));
|
|
2399
2630
|
}
|
|
@@ -3006,7 +3237,7 @@ var init_mcp_config = __esm(() => {
|
|
|
3006
3237
|
|
|
3007
3238
|
// ../../packages/core/src/agents/execution-host.ts
|
|
3008
3239
|
import { AsyncLocalStorage } from "async_hooks";
|
|
3009
|
-
import { dirname as
|
|
3240
|
+
import { dirname as dirname5 } from "path";
|
|
3010
3241
|
function activeHost() {
|
|
3011
3242
|
const scoped = scopedHost.getStore();
|
|
3012
3243
|
if (scoped)
|
|
@@ -3041,7 +3272,7 @@ function hostedCodexAuthFilePath() {
|
|
|
3041
3272
|
return activeHost().codexAuthFilePath();
|
|
3042
3273
|
}
|
|
3043
3274
|
function hostedCodexHomePath() {
|
|
3044
|
-
return
|
|
3275
|
+
return dirname5(hostedCodexAuthFilePath());
|
|
3045
3276
|
}
|
|
3046
3277
|
var defaultHost, hostRegistrations, scopedHost;
|
|
3047
3278
|
var init_execution_host = __esm(async () => {
|
|
@@ -3065,14 +3296,14 @@ var init_execution_host = __esm(async () => {
|
|
|
3065
3296
|
// ../../packages/core/src/agents/rollout/codex.ts
|
|
3066
3297
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
3067
3298
|
import { existsSync as existsSync6, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync5 } from "fs";
|
|
3068
|
-
import { basename, dirname as
|
|
3299
|
+
import { basename, dirname as dirname6, join as join8, resolve as resolve5 } from "path";
|
|
3069
3300
|
function codexSessionsDir() {
|
|
3070
|
-
return
|
|
3301
|
+
return join8(hostedCodexHomePath(), "sessions");
|
|
3071
3302
|
}
|
|
3072
3303
|
function loadCodexShell() {
|
|
3073
3304
|
if (_shellCache)
|
|
3074
3305
|
return _shellCache;
|
|
3075
|
-
const raw = readFileSync5(
|
|
3306
|
+
const raw = readFileSync5(join8(FIXTURES_DIR, "codex-shell.jsonl"), "utf8");
|
|
3076
3307
|
const lines = parseJsonlText(raw);
|
|
3077
3308
|
if (lines.length < 5) {
|
|
3078
3309
|
throw new Error(`loadCodexShell: expected >=5 entries in codex-shell.jsonl, got ${lines.length}`);
|
|
@@ -3139,16 +3370,16 @@ function codexRolloutPath(threadId, fallback) {
|
|
|
3139
3370
|
const hh = String(createdAt.getHours()).padStart(2, "0");
|
|
3140
3371
|
const min = String(createdAt.getMinutes()).padStart(2, "0");
|
|
3141
3372
|
const ss = String(createdAt.getSeconds()).padStart(2, "0");
|
|
3142
|
-
const dir =
|
|
3143
|
-
return
|
|
3373
|
+
const dir = join8(codexSessionsDir(), yyyy, mm, dd);
|
|
3374
|
+
return join8(dir, `rollout-${yyyy}-${mm}-${dd}T${hh}-${min}-${ss}-${threadId}.jsonl`);
|
|
3144
3375
|
}
|
|
3145
3376
|
function canonicalFilePath(path) {
|
|
3146
|
-
const absolute =
|
|
3377
|
+
const absolute = resolve5(path);
|
|
3147
3378
|
try {
|
|
3148
3379
|
return realpathSync2(absolute);
|
|
3149
3380
|
} catch {
|
|
3150
3381
|
try {
|
|
3151
|
-
return
|
|
3382
|
+
return join8(realpathSync2(dirname6(absolute)), basename(absolute));
|
|
3152
3383
|
} catch {
|
|
3153
3384
|
return absolute;
|
|
3154
3385
|
}
|
|
@@ -3378,19 +3609,19 @@ function latestCodexRolloutPath(threadId) {
|
|
|
3378
3609
|
try {
|
|
3379
3610
|
if (buckets) {
|
|
3380
3611
|
for (const bucket of buckets) {
|
|
3381
|
-
const dir =
|
|
3612
|
+
const dir = join8(sessionsDir, bucket);
|
|
3382
3613
|
if (!existsSync6(dir))
|
|
3383
3614
|
continue;
|
|
3384
3615
|
const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
|
|
3385
3616
|
for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
|
|
3386
|
-
candidates.push(
|
|
3617
|
+
candidates.push(join8(dir, rel));
|
|
3387
3618
|
}
|
|
3388
3619
|
}
|
|
3389
3620
|
}
|
|
3390
3621
|
if (candidates.length === 0) {
|
|
3391
3622
|
const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
|
|
3392
3623
|
for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
|
|
3393
|
-
candidates.push(
|
|
3624
|
+
candidates.push(join8(sessionsDir, rel));
|
|
3394
3625
|
}
|
|
3395
3626
|
}
|
|
3396
3627
|
return candidates.sort((a, b) => statSync2(b).mtimeMs - statSync2(a).mtimeMs)[0];
|
|
@@ -3511,13 +3742,13 @@ function sweepPriorRolloutsForThread(threadId) {
|
|
|
3511
3742
|
return;
|
|
3512
3743
|
}
|
|
3513
3744
|
for (const bucket of buckets) {
|
|
3514
|
-
const dir =
|
|
3745
|
+
const dir = join8(sessionsDir, bucket);
|
|
3515
3746
|
if (!existsSync6(dir))
|
|
3516
3747
|
continue;
|
|
3517
3748
|
try {
|
|
3518
3749
|
const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
|
|
3519
3750
|
for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
|
|
3520
|
-
const fullPath =
|
|
3751
|
+
const fullPath = join8(dir, rel);
|
|
3521
3752
|
try {
|
|
3522
3753
|
unlinkSync5(fullPath);
|
|
3523
3754
|
} catch (e) {
|
|
@@ -3535,7 +3766,7 @@ function sweepPriorRolloutsFullTree(threadId, sessionsDir) {
|
|
|
3535
3766
|
try {
|
|
3536
3767
|
const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
|
|
3537
3768
|
for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
|
|
3538
|
-
const fullPath =
|
|
3769
|
+
const fullPath = join8(sessionsDir, rel);
|
|
3539
3770
|
try {
|
|
3540
3771
|
unlinkSync5(fullPath);
|
|
3541
3772
|
} catch (e) {
|
|
@@ -3590,10 +3821,10 @@ function formatDateBucket(d) {
|
|
|
3590
3821
|
}
|
|
3591
3822
|
var _shellCache = null, MAX_DAY_SPAN = 30, DAY_MS = 86400000, LOCAL_DATE_SKEW_DAYS = 1;
|
|
3592
3823
|
var init_codex = __esm(async () => {
|
|
3824
|
+
await init_execution_host();
|
|
3593
3825
|
init_shared();
|
|
3594
3826
|
init_jsonl();
|
|
3595
3827
|
init_logger();
|
|
3596
|
-
await init_execution_host();
|
|
3597
3828
|
});
|
|
3598
3829
|
|
|
3599
3830
|
// ../../packages/core/src/agents/codex-app-server.ts
|
|
@@ -3601,7 +3832,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
3601
3832
|
function createCodexAppServerForker(host) {
|
|
3602
3833
|
return async (parentThreadId) => {
|
|
3603
3834
|
const child = host.spawnServer();
|
|
3604
|
-
return await new Promise((
|
|
3835
|
+
return await new Promise((resolve6, reject) => {
|
|
3605
3836
|
let settled = false;
|
|
3606
3837
|
let stdoutBuffer = "";
|
|
3607
3838
|
let stderr = "";
|
|
@@ -3618,7 +3849,7 @@ function createCodexAppServerForker(host) {
|
|
|
3618
3849
|
if (error)
|
|
3619
3850
|
reject(error);
|
|
3620
3851
|
else if (result)
|
|
3621
|
-
|
|
3852
|
+
resolve6(result);
|
|
3622
3853
|
else
|
|
3623
3854
|
reject(new Error("Codex thread fork returned no result"));
|
|
3624
3855
|
};
|
|
@@ -3697,10 +3928,8 @@ async function forkCodexSession(parentThreadId) {
|
|
|
3697
3928
|
var forkCodexThread;
|
|
3698
3929
|
var init_codex_app_server = __esm(async () => {
|
|
3699
3930
|
init_codex_native_multi_agent();
|
|
3700
|
-
await
|
|
3701
|
-
|
|
3702
|
-
init_codex()
|
|
3703
|
-
]);
|
|
3931
|
+
await init_execution_host();
|
|
3932
|
+
await init_codex();
|
|
3704
3933
|
forkCodexThread = createCodexAppServerForker({
|
|
3705
3934
|
spawnServer() {
|
|
3706
3935
|
return spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
|
|
@@ -3715,16 +3944,14 @@ var init_codex_app_server = __esm(async () => {
|
|
|
3715
3944
|
|
|
3716
3945
|
// ../../packages/core/src/agents/codex-registry.ts
|
|
3717
3946
|
import { existsSync as existsSync7, unlinkSync as unlinkSync6 } from "fs";
|
|
3718
|
-
import { join as
|
|
3947
|
+
import { join as join9 } from "path";
|
|
3719
3948
|
var VALID_EFFORTS2, codexRegistry, codexRegistryOperations;
|
|
3720
3949
|
var init_codex_registry = __esm(async () => {
|
|
3950
|
+
await init_codex_app_server();
|
|
3951
|
+
await init_execution_host();
|
|
3952
|
+
await init_codex();
|
|
3721
3953
|
init_logger();
|
|
3722
3954
|
init_types();
|
|
3723
|
-
await __promiseAll([
|
|
3724
|
-
init_codex_app_server(),
|
|
3725
|
-
init_execution_host(),
|
|
3726
|
-
init_codex()
|
|
3727
|
-
]);
|
|
3728
3955
|
VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
|
|
3729
3956
|
codexRegistry = {
|
|
3730
3957
|
kind: "codex",
|
|
@@ -3760,7 +3987,7 @@ var init_codex_registry = __esm(async () => {
|
|
|
3760
3987
|
async cleanupRollouts({ sessionIds }) {
|
|
3761
3988
|
if (sessionIds.length === 0)
|
|
3762
3989
|
return;
|
|
3763
|
-
const sessionsDir =
|
|
3990
|
+
const sessionsDir = join9(hostedCodexHomePath(), "sessions");
|
|
3764
3991
|
if (!existsSync7(sessionsDir))
|
|
3765
3992
|
return;
|
|
3766
3993
|
const failures = [];
|
|
@@ -3768,7 +3995,7 @@ var init_codex_registry = __esm(async () => {
|
|
|
3768
3995
|
try {
|
|
3769
3996
|
const glob = new Bun.Glob(`**/rollout-*-${tid}.jsonl`);
|
|
3770
3997
|
for await (const rel of glob.scan({ cwd: sessionsDir, onlyFiles: true })) {
|
|
3771
|
-
const path =
|
|
3998
|
+
const path = join9(sessionsDir, rel);
|
|
3772
3999
|
try {
|
|
3773
4000
|
unlinkSync6(path);
|
|
3774
4001
|
} catch (e) {
|
|
@@ -3792,17 +4019,17 @@ var init_codex_registry = __esm(async () => {
|
|
|
3792
4019
|
|
|
3793
4020
|
// ../../packages/core/src/agents/maestro-registry.ts
|
|
3794
4021
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
3795
|
-
import { existsSync as existsSync8, mkdirSync as
|
|
3796
|
-
import { homedir as
|
|
3797
|
-
import { join as
|
|
4022
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
4023
|
+
import { homedir as homedir6 } from "os";
|
|
4024
|
+
import { join as join10, resolve as resolve6 } from "path";
|
|
3798
4025
|
function maestroSessionsDir() {
|
|
3799
|
-
return
|
|
4026
|
+
return join10(process.env.MAESTRO_DATA_DIR ? resolve6(process.env.MAESTRO_DATA_DIR) : join10(homedir6(), ".maestro"), "sessions");
|
|
3800
4027
|
}
|
|
3801
4028
|
function maestroSessionPath(sessionId) {
|
|
3802
|
-
return
|
|
4029
|
+
return join10(maestroSessionsDir(), `${sessionId}.jsonl`);
|
|
3803
4030
|
}
|
|
3804
4031
|
function maestroActiveSessionPath(sessionId) {
|
|
3805
|
-
return
|
|
4032
|
+
return join10(maestroSessionsDir(), `${sessionId}.active.jsonl`);
|
|
3806
4033
|
}
|
|
3807
4034
|
function existingCreatedAt(path) {
|
|
3808
4035
|
if (!existsSync8(path))
|
|
@@ -3824,7 +4051,7 @@ function writeRollout(options) {
|
|
|
3824
4051
|
assertUuidLike("sessionId", sessionId);
|
|
3825
4052
|
ensureCwdExists(options.cwd);
|
|
3826
4053
|
const path = maestroSessionPath(sessionId);
|
|
3827
|
-
|
|
4054
|
+
mkdirSync7(maestroSessionsDir(), { recursive: true });
|
|
3828
4055
|
const messages = extractChatPairs(options.entries).flatMap((pair) => [
|
|
3829
4056
|
{ role: "user", content: nonEmptyTurnText(pair.userText) },
|
|
3830
4057
|
{ role: "assistant", content: nonEmptyTurnText(pair.assistantText) }
|
|
@@ -3947,8 +4174,8 @@ function getRegistryOperations(agent) {
|
|
|
3947
4174
|
var REGISTRIES, OPERATIONS;
|
|
3948
4175
|
var init_registry = __esm(async () => {
|
|
3949
4176
|
init_claude_registry();
|
|
3950
|
-
init_maestro_registry();
|
|
3951
4177
|
await init_codex_registry();
|
|
4178
|
+
init_maestro_registry();
|
|
3952
4179
|
REGISTRIES = {
|
|
3953
4180
|
claude: claudeRegistry,
|
|
3954
4181
|
codex: codexRegistry,
|
|
@@ -4001,8 +4228,8 @@ function cleanupAgentFork(handle) {
|
|
|
4001
4228
|
}
|
|
4002
4229
|
var defaultForkHelpers;
|
|
4003
4230
|
var init_fork = __esm(async () => {
|
|
4004
|
-
init_logger();
|
|
4005
4231
|
await init_registry();
|
|
4232
|
+
init_logger();
|
|
4006
4233
|
defaultForkHelpers = createAgentForkHelpers({
|
|
4007
4234
|
forkSession: (agent, options) => getRegistryOperations(agent).forkSession(options),
|
|
4008
4235
|
exists: existsSync9,
|
|
@@ -4026,200 +4253,6 @@ function sanitizeId(id) {
|
|
|
4026
4253
|
return id.replace(/[^a-zA-Z0-9_-]/g, "_") || "_";
|
|
4027
4254
|
}
|
|
4028
4255
|
|
|
4029
|
-
// ../../packages/core/src/storage/storage-host.ts
|
|
4030
|
-
import { mkdirSync as mkdirSync7 } from "fs";
|
|
4031
|
-
import { homedir as homedir6 } from "os";
|
|
4032
|
-
import { dirname as dirname6, join as join10, resolve as resolve6 } from "path";
|
|
4033
|
-
function envPath(name, fallback) {
|
|
4034
|
-
const value = process.env[name]?.trim();
|
|
4035
|
-
return resolve6(value || fallback);
|
|
4036
|
-
}
|
|
4037
|
-
function defaultStateDir() {
|
|
4038
|
-
return envPath("NEGOTIUM_STATE_DIR", join10(homedir6(), ".negotium"));
|
|
4039
|
-
}
|
|
4040
|
-
function defaultDataDir() {
|
|
4041
|
-
return envPath("NEGOTIUM_DATA_DIR", join10(defaultStateDir(), "data"));
|
|
4042
|
-
}
|
|
4043
|
-
function defaultLogDir() {
|
|
4044
|
-
return envPath("NEGOTIUM_LOG_DIR", join10(defaultStateDir(), "logs"));
|
|
4045
|
-
}
|
|
4046
|
-
function defaultWorkspaceDir() {
|
|
4047
|
-
return envPath("NEGOTIUM_WORKSPACE_DIR", join10(defaultStateDir(), "workspace"));
|
|
4048
|
-
}
|
|
4049
|
-
function defaultSessionAsksDir() {
|
|
4050
|
-
const runDir = envPath("NEGOTIUM_RUN_DIR", join10(defaultStateDir(), "runtime"));
|
|
4051
|
-
return join10(runDir, "session-asks");
|
|
4052
|
-
}
|
|
4053
|
-
function defaultSessionsDatabasePath() {
|
|
4054
|
-
return envPath("SESSIONS_DB_PATH", join10(resolveStorageDataDir(), "sessions.db"));
|
|
4055
|
-
}
|
|
4056
|
-
function isSqliteBusy(error) {
|
|
4057
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
4058
|
-
return /database is (?:locked|busy)|SQLITE_(?:BUSY|LOCKED)/i.test(message);
|
|
4059
|
-
}
|
|
4060
|
-
function execWithBusyRetry(database, sql, timeoutMs = SQLITE_INIT_TIMEOUT_MS) {
|
|
4061
|
-
const deadline = Date.now() + timeoutMs;
|
|
4062
|
-
while (true) {
|
|
4063
|
-
try {
|
|
4064
|
-
database.exec(sql);
|
|
4065
|
-
return;
|
|
4066
|
-
} catch (error) {
|
|
4067
|
-
if (!isSqliteBusy(error) || Date.now() >= deadline)
|
|
4068
|
-
throw error;
|
|
4069
|
-
Atomics.wait(SQLITE_INIT_SLEEP, 0, 0, Math.min(SQLITE_INIT_RETRY_MS, deadline - Date.now()));
|
|
4070
|
-
}
|
|
4071
|
-
}
|
|
4072
|
-
}
|
|
4073
|
-
function initializeDatabase(database) {
|
|
4074
|
-
database.exec("PRAGMA busy_timeout = 5000");
|
|
4075
|
-
execWithBusyRetry(database, "PRAGMA journal_mode = WAL");
|
|
4076
|
-
database.exec("PRAGMA foreign_keys = ON");
|
|
4077
|
-
database.exec("PRAGMA wal_autocheckpoint = 1000");
|
|
4078
|
-
try {
|
|
4079
|
-
database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
4080
|
-
} catch {}
|
|
4081
|
-
}
|
|
4082
|
-
function defaultDatabase() {
|
|
4083
|
-
const path = defaultSessionsDatabasePath();
|
|
4084
|
-
if (fallbackDatabase && fallbackDatabasePath === path)
|
|
4085
|
-
return fallbackDatabase;
|
|
4086
|
-
if (fallbackDatabase)
|
|
4087
|
-
fallbackDatabase.close();
|
|
4088
|
-
mkdirSync7(dirname6(path), { recursive: true });
|
|
4089
|
-
fallbackDatabase = new Database(path, { create: true });
|
|
4090
|
-
fallbackDatabasePath = path;
|
|
4091
|
-
initializeDatabase(fallbackDatabase);
|
|
4092
|
-
return fallbackDatabase;
|
|
4093
|
-
}
|
|
4094
|
-
function resolveStorageDatabase() {
|
|
4095
|
-
return configuredHost.database ?? defaultDatabase();
|
|
4096
|
-
}
|
|
4097
|
-
function resolveStorageDataDir() {
|
|
4098
|
-
return configuredHost.dataDir ?? defaultDataDir();
|
|
4099
|
-
}
|
|
4100
|
-
function resolveStorageLogDir() {
|
|
4101
|
-
return configuredHost.logDir ?? defaultLogDir();
|
|
4102
|
-
}
|
|
4103
|
-
function resolveStorageSessionAsksDir() {
|
|
4104
|
-
return configuredHost.sessionAsksDir ?? defaultSessionAsksDir();
|
|
4105
|
-
}
|
|
4106
|
-
function resolveStorageWorkspaceDir() {
|
|
4107
|
-
return configuredHost.workspaceDir ?? defaultWorkspaceDir();
|
|
4108
|
-
}
|
|
4109
|
-
function resolveStorageSharedWikiDir() {
|
|
4110
|
-
return configuredHost.sharedWikiDir ?? join10(resolveStorageWorkspaceDir(), "wiki");
|
|
4111
|
-
}
|
|
4112
|
-
function resolveStorageUsersLogDir() {
|
|
4113
|
-
return configuredHost.usersLogDir ?? join10(resolveStorageDataDir(), "users");
|
|
4114
|
-
}
|
|
4115
|
-
function normalizeStorageHostPatch(options) {
|
|
4116
|
-
const patch = {};
|
|
4117
|
-
if (options.database !== undefined) {
|
|
4118
|
-
options.database.exec("PRAGMA foreign_keys = ON");
|
|
4119
|
-
patch.database = options.database;
|
|
4120
|
-
}
|
|
4121
|
-
for (const key of STORAGE_PATH_KEYS) {
|
|
4122
|
-
const value = options[key];
|
|
4123
|
-
if (value === undefined)
|
|
4124
|
-
continue;
|
|
4125
|
-
if (!value.trim())
|
|
4126
|
-
throw new TypeError(`${key} must not be empty`);
|
|
4127
|
-
patch[key] = resolve6(value);
|
|
4128
|
-
}
|
|
4129
|
-
return Object.freeze(patch);
|
|
4130
|
-
}
|
|
4131
|
-
function refreshConfiguredHost() {
|
|
4132
|
-
configuredHost = Object.freeze(Object.assign({}, ...storageHostFrames.filter((frame) => frame.active).map((frame) => frame.patch)));
|
|
4133
|
-
}
|
|
4134
|
-
function configureStorageHost(options) {
|
|
4135
|
-
const frame = { active: true, patch: normalizeStorageHostPatch(options) };
|
|
4136
|
-
storageHostFrames.push(frame);
|
|
4137
|
-
refreshConfiguredHost();
|
|
4138
|
-
return () => {
|
|
4139
|
-
if (!frame.active)
|
|
4140
|
-
return;
|
|
4141
|
-
frame.active = false;
|
|
4142
|
-
const index = storageHostFrames.indexOf(frame);
|
|
4143
|
-
if (index >= 0)
|
|
4144
|
-
storageHostFrames.splice(index, 1);
|
|
4145
|
-
refreshConfiguredHost();
|
|
4146
|
-
};
|
|
4147
|
-
}
|
|
4148
|
-
function resetStorageHost() {
|
|
4149
|
-
for (const frame of storageHostFrames)
|
|
4150
|
-
frame.active = false;
|
|
4151
|
-
storageHostFrames.length = 0;
|
|
4152
|
-
refreshConfiguredHost();
|
|
4153
|
-
}
|
|
4154
|
-
function closeStorageDatabase() {
|
|
4155
|
-
if (!fallbackDatabase)
|
|
4156
|
-
return;
|
|
4157
|
-
fallbackDatabase.close();
|
|
4158
|
-
fallbackDatabase = null;
|
|
4159
|
-
fallbackDatabasePath = null;
|
|
4160
|
-
}
|
|
4161
|
-
function registerStorageSchemaInitializer(initialize, priority = 100) {
|
|
4162
|
-
schemaInitializers.push({ initialize, priority });
|
|
4163
|
-
schemaInitializers.sort((a, b) => a.priority - b.priority);
|
|
4164
|
-
}
|
|
4165
|
-
function ensureStorageSchemas(database = resolveStorageDatabase()) {
|
|
4166
|
-
if (initializingDatabases.has(database))
|
|
4167
|
-
return;
|
|
4168
|
-
let initialized = initializedSchemas.get(database);
|
|
4169
|
-
if (!initialized) {
|
|
4170
|
-
initialized = new Set;
|
|
4171
|
-
initializedSchemas.set(database, initialized);
|
|
4172
|
-
}
|
|
4173
|
-
initializingDatabases.add(database);
|
|
4174
|
-
try {
|
|
4175
|
-
for (const entry of schemaInitializers) {
|
|
4176
|
-
if (initialized.has(entry.initialize))
|
|
4177
|
-
continue;
|
|
4178
|
-
initialized.add(entry.initialize);
|
|
4179
|
-
try {
|
|
4180
|
-
entry.initialize(database);
|
|
4181
|
-
} catch (error) {
|
|
4182
|
-
initialized.delete(entry.initialize);
|
|
4183
|
-
throw error;
|
|
4184
|
-
}
|
|
4185
|
-
}
|
|
4186
|
-
} finally {
|
|
4187
|
-
initializingDatabases.delete(database);
|
|
4188
|
-
}
|
|
4189
|
-
}
|
|
4190
|
-
var configuredHost, fallbackDatabase = null, fallbackDatabasePath = null, storageHostFrames, schemaInitializers, initializedSchemas, initializingDatabases, SQLITE_INIT_RETRY_MS = 25, SQLITE_INIT_TIMEOUT_MS = 5000, SQLITE_INIT_SLEEP, STORAGE_PATH_KEYS, internalStorageDatabase, storageDatabase;
|
|
4191
|
-
var init_storage_host = __esm(async () => {
|
|
4192
|
-
await init_sqlite();
|
|
4193
|
-
configuredHost = {};
|
|
4194
|
-
storageHostFrames = [];
|
|
4195
|
-
schemaInitializers = [];
|
|
4196
|
-
initializedSchemas = new WeakMap;
|
|
4197
|
-
initializingDatabases = new WeakSet;
|
|
4198
|
-
SQLITE_INIT_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
4199
|
-
STORAGE_PATH_KEYS = [
|
|
4200
|
-
"dataDir",
|
|
4201
|
-
"logDir",
|
|
4202
|
-
"sessionAsksDir",
|
|
4203
|
-
"workspaceDir",
|
|
4204
|
-
"sharedWikiDir",
|
|
4205
|
-
"usersLogDir"
|
|
4206
|
-
];
|
|
4207
|
-
internalStorageDatabase = new Proxy({}, {
|
|
4208
|
-
get(_target, property) {
|
|
4209
|
-
const database = resolveStorageDatabase();
|
|
4210
|
-
ensureStorageSchemas(database);
|
|
4211
|
-
const value = Reflect.get(database, property, database);
|
|
4212
|
-
return typeof value === "function" ? value.bind(database) : value;
|
|
4213
|
-
},
|
|
4214
|
-
set(_target, property, value) {
|
|
4215
|
-
const database = resolveStorageDatabase();
|
|
4216
|
-
ensureStorageSchemas(database);
|
|
4217
|
-
return Reflect.set(database, property, value, database);
|
|
4218
|
-
}
|
|
4219
|
-
});
|
|
4220
|
-
storageDatabase = internalStorageDatabase;
|
|
4221
|
-
});
|
|
4222
|
-
|
|
4223
4256
|
// ../../packages/core/src/storage/tasks.ts
|
|
4224
4257
|
var exports_tasks = {};
|
|
4225
4258
|
__export(exports_tasks, {
|
|
@@ -5164,10 +5197,10 @@ async function* claudeProvider(opts) {
|
|
|
5164
5197
|
var CLAUDE_DEFAULT_DISALLOWED_TOOLS, CLAUDE_NATIVE_AGENT_TOOLS, CLAUDE_IMAGE_MAX_BYTES, CLAUDE_IMAGE_MIME_TYPES, CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500;
|
|
5165
5198
|
var init_claude_provider = __esm(async () => {
|
|
5166
5199
|
init_claude_registry();
|
|
5200
|
+
await init_execution_host();
|
|
5167
5201
|
init_vault_tool_policy();
|
|
5168
5202
|
init_file_events();
|
|
5169
5203
|
init_logger();
|
|
5170
|
-
await init_execution_host();
|
|
5171
5204
|
CLAUDE_DEFAULT_DISALLOWED_TOOLS = [
|
|
5172
5205
|
"AskUserQuestion",
|
|
5173
5206
|
"Workflow",
|
|
@@ -6381,14 +6414,12 @@ var CODEX_MCP_SERVER_NAME_OVERRIDES, CODEX_DIFF_FILE_LIMIT, CODEX_DIFF_BASELINE_
|
|
|
6381
6414
|
var init_codex_provider = __esm(async () => {
|
|
6382
6415
|
init_codex_native_multi_agent();
|
|
6383
6416
|
init_codex_tree_kill();
|
|
6417
|
+
await init_execution_host();
|
|
6418
|
+
await init_codex();
|
|
6384
6419
|
init_tool_format();
|
|
6385
6420
|
init_file_events();
|
|
6386
6421
|
init_logger();
|
|
6387
6422
|
init_mcp_config();
|
|
6388
|
-
await __promiseAll([
|
|
6389
|
-
init_execution_host(),
|
|
6390
|
-
init_codex()
|
|
6391
|
-
]);
|
|
6392
6423
|
CODEX_MCP_SERVER_NAME_OVERRIDES = {
|
|
6393
6424
|
playwright: "otium_playwright"
|
|
6394
6425
|
};
|
|
@@ -6504,12 +6535,10 @@ function maestroProvider(opts) {
|
|
|
6504
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;
|
|
6505
6536
|
var init_maestro_provider = __esm(async () => {
|
|
6506
6537
|
init_maestro_bootstrap_env();
|
|
6538
|
+
await init_execution_host();
|
|
6507
6539
|
init_vault_tool_policy();
|
|
6508
6540
|
init_config();
|
|
6509
|
-
await
|
|
6510
|
-
init_execution_host(),
|
|
6511
|
-
init_vault()
|
|
6512
|
-
]);
|
|
6541
|
+
await init_vault();
|
|
6513
6542
|
MAESTRO_NATIVE_TASK_TOOLS = [
|
|
6514
6543
|
"TaskCreate",
|
|
6515
6544
|
"TaskUpdate",
|
|
@@ -6655,15 +6684,13 @@ async function* runAgent(opts) {
|
|
|
6655
6684
|
}
|
|
6656
6685
|
}
|
|
6657
6686
|
var init_agents = __esm(async () => {
|
|
6687
|
+
await init_execution_host();
|
|
6688
|
+
await init_registry();
|
|
6658
6689
|
init_claude();
|
|
6690
|
+
await init_task_events();
|
|
6659
6691
|
init_logger();
|
|
6692
|
+
await init_conversations();
|
|
6660
6693
|
init_types();
|
|
6661
|
-
await __promiseAll([
|
|
6662
|
-
init_execution_host(),
|
|
6663
|
-
init_registry(),
|
|
6664
|
-
init_task_events(),
|
|
6665
|
-
init_conversations()
|
|
6666
|
-
]);
|
|
6667
6694
|
});
|
|
6668
6695
|
|
|
6669
6696
|
// ../../packages/core/src/mcp/mcp-helpers.ts
|
|
@@ -6746,6 +6773,7 @@ function listRecentRuntimeEventsForTopic(topicId, limit = 300) {
|
|
|
6746
6773
|
var RUNTIME_EVENT_TYPES, types;
|
|
6747
6774
|
var init_runtime_events = __esm(async () => {
|
|
6748
6775
|
await init_forum_db();
|
|
6776
|
+
await init_storage_host();
|
|
6749
6777
|
RUNTIME_EVENT_TYPES = [
|
|
6750
6778
|
"message",
|
|
6751
6779
|
"message-updated",
|
|
@@ -6754,26 +6782,28 @@ var init_runtime_events = __esm(async () => {
|
|
|
6754
6782
|
"topic-updated",
|
|
6755
6783
|
"topic-deleted"
|
|
6756
6784
|
];
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
event_type
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6785
|
+
registerStorageSchemaInitializer((database) => {
|
|
6786
|
+
database.exec(`
|
|
6787
|
+
CREATE TABLE IF NOT EXISTS runtime_events (
|
|
6788
|
+
seq INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
6789
|
+
source_id TEXT NOT NULL,
|
|
6790
|
+
event_type TEXT NOT NULL CHECK (
|
|
6791
|
+
event_type IN (
|
|
6792
|
+
'message',
|
|
6793
|
+
'message-updated',
|
|
6794
|
+
'ai-status',
|
|
6795
|
+
'topic-created',
|
|
6796
|
+
'topic-updated',
|
|
6797
|
+
'topic-deleted'
|
|
6798
|
+
)
|
|
6799
|
+
),
|
|
6800
|
+
topic_id TEXT NOT NULL,
|
|
6801
|
+
payload_json TEXT NOT NULL,
|
|
6802
|
+
created_at TEXT NOT NULL
|
|
6803
|
+
)
|
|
6804
|
+
`);
|
|
6805
|
+
database.exec("CREATE INDEX IF NOT EXISTS idx_runtime_events_topic_seq ON runtime_events(topic_id, seq)");
|
|
6806
|
+
});
|
|
6777
6807
|
types = new Set(RUNTIME_EVENT_TYPES);
|
|
6778
6808
|
});
|
|
6779
6809
|
|
|
@@ -6934,18 +6964,19 @@ class SqliteRuntimeBus {
|
|
|
6934
6964
|
}
|
|
6935
6965
|
}
|
|
6936
6966
|
function runtimeBus() {
|
|
6967
|
+
if (!current)
|
|
6968
|
+
current = new SqliteRuntimeBus;
|
|
6937
6969
|
return current;
|
|
6938
6970
|
}
|
|
6939
6971
|
function setRuntimeBus(bus) {
|
|
6940
6972
|
current = bus;
|
|
6941
6973
|
}
|
|
6942
|
-
var current, WsHub;
|
|
6974
|
+
var current = null, WsHub;
|
|
6943
6975
|
var init_bus = __esm(async () => {
|
|
6944
6976
|
await init_runtime_events();
|
|
6945
|
-
current = new SqliteRuntimeBus;
|
|
6946
6977
|
WsHub = {
|
|
6947
6978
|
get() {
|
|
6948
|
-
return
|
|
6979
|
+
return runtimeBus();
|
|
6949
6980
|
}
|
|
6950
6981
|
};
|
|
6951
6982
|
});
|
|
@@ -7331,10 +7362,8 @@ function getMessagesForTopicAfterRowid(topicId, afterRowid) {
|
|
|
7331
7362
|
}
|
|
7332
7363
|
var appendHooks;
|
|
7333
7364
|
var init_api_messages = __esm(async () => {
|
|
7334
|
-
await
|
|
7335
|
-
|
|
7336
|
-
init_storage_host()
|
|
7337
|
-
]);
|
|
7365
|
+
await init_forum_db();
|
|
7366
|
+
await init_storage_host();
|
|
7338
7367
|
registerStorageSchemaInitializer(initializeApiMessagesSchema, 30);
|
|
7339
7368
|
appendHooks = new Set;
|
|
7340
7369
|
});
|
|
@@ -7457,10 +7486,8 @@ function deleteApiTopicConfig(topicId) {
|
|
|
7457
7486
|
db.query("DELETE FROM api_topic_config WHERE topic_id = ?").run(topicId);
|
|
7458
7487
|
}
|
|
7459
7488
|
var init_api_topic_config = __esm(async () => {
|
|
7460
|
-
await
|
|
7461
|
-
|
|
7462
|
-
init_storage_host()
|
|
7463
|
-
]);
|
|
7489
|
+
await init_forum_db();
|
|
7490
|
+
await init_storage_host();
|
|
7464
7491
|
registerStorageSchemaInitializer(initializeApiTopicConfigSchema, 40);
|
|
7465
7492
|
});
|
|
7466
7493
|
|
|
@@ -7479,6 +7506,7 @@ var exports_api_topics = {};
|
|
|
7479
7506
|
__export(exports_api_topics, {
|
|
7480
7507
|
upsertTopic: () => upsertTopic,
|
|
7481
7508
|
setTopicSessionId: () => setTopicSessionId,
|
|
7509
|
+
setTopicAccessModes: () => setTopicAccessModes,
|
|
7482
7510
|
setApiTopicAgent: () => setApiTopicAgent,
|
|
7483
7511
|
revokeSubagentTellTarget: () => revokeSubagentTellTarget,
|
|
7484
7512
|
reparentTopicChildren: () => reparentTopicChildren,
|
|
@@ -7945,6 +7973,16 @@ function upsertTopic(t) {
|
|
|
7945
7973
|
}
|
|
7946
7974
|
})();
|
|
7947
7975
|
}
|
|
7976
|
+
function setTopicAccessModes(topicIds, accessMode) {
|
|
7977
|
+
if (topicIds.length === 0)
|
|
7978
|
+
return;
|
|
7979
|
+
const normalized = normalizeTopicAccessMode(accessMode);
|
|
7980
|
+
db.transaction(() => {
|
|
7981
|
+
const update = db.query("UPDATE api_topics SET access_mode = ? WHERE id = ?");
|
|
7982
|
+
for (const topicId of topicIds)
|
|
7983
|
+
update.run(normalized, topicId);
|
|
7984
|
+
})();
|
|
7985
|
+
}
|
|
7948
7986
|
function listTopics() {
|
|
7949
7987
|
const rows = db.query("SELECT * FROM api_topics ORDER BY last_message_at DESC").all();
|
|
7950
7988
|
const participants = getAllTopicParticipants();
|
|
@@ -8120,10 +8158,8 @@ var DEFAULT_AGENT_ROOM_AGENT = "maestro";
|
|
|
8120
8158
|
var init_api_topics = __esm(async () => {
|
|
8121
8159
|
init_constants();
|
|
8122
8160
|
init_logger();
|
|
8123
|
-
await
|
|
8124
|
-
|
|
8125
|
-
init_storage_host()
|
|
8126
|
-
]);
|
|
8161
|
+
await init_forum_db();
|
|
8162
|
+
await init_storage_host();
|
|
8127
8163
|
registerStorageSchemaInitializer(initializeApiTopicsSchema, 20);
|
|
8128
8164
|
});
|
|
8129
8165
|
|
|
@@ -8324,10 +8360,8 @@ function cancelAskUserGate(topicId, messageId, ownerId, now = new Date().toISOSt
|
|
|
8324
8360
|
}).immediate();
|
|
8325
8361
|
}
|
|
8326
8362
|
var init_ask_user_gates = __esm(async () => {
|
|
8327
|
-
await
|
|
8328
|
-
|
|
8329
|
-
init_storage_host()
|
|
8330
|
-
]);
|
|
8363
|
+
await init_forum_db();
|
|
8364
|
+
await init_storage_host();
|
|
8331
8365
|
registerStorageSchemaInitializer(initializeAskUserGateSchema, 31);
|
|
8332
8366
|
});
|
|
8333
8367
|
|
|
@@ -8414,10 +8448,8 @@ function beginRuntimeTopicMaintenance(topicId, options = {}) {
|
|
|
8414
8448
|
}
|
|
8415
8449
|
var TOPIC_MAINTENANCE_STALE_MS = 30000, TOPIC_MAINTENANCE_HEARTBEAT_MS = 1000;
|
|
8416
8450
|
var init_runtime_topic_state = __esm(async () => {
|
|
8417
|
-
await
|
|
8418
|
-
|
|
8419
|
-
init_storage_host()
|
|
8420
|
-
]);
|
|
8451
|
+
await init_forum_db();
|
|
8452
|
+
await init_storage_host();
|
|
8421
8453
|
registerStorageSchemaInitializer((database) => {
|
|
8422
8454
|
database.exec(`
|
|
8423
8455
|
CREATE TABLE IF NOT EXISTS runtime_topic_state (
|
|
@@ -8514,11 +8546,9 @@ function releaseRuntimeTurnLease(topicId, queryId, ownerId = RUNTIME_INSTANCE_ID
|
|
|
8514
8546
|
}
|
|
8515
8547
|
var RUNTIME_INSTANCE_ID, TURN_LEASE_STALE_MS = 1e4;
|
|
8516
8548
|
var init_runtime_leases = __esm(async () => {
|
|
8517
|
-
await
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
init_storage_host()
|
|
8521
|
-
]);
|
|
8549
|
+
await init_forum_db();
|
|
8550
|
+
await init_runtime_topic_state();
|
|
8551
|
+
await init_storage_host();
|
|
8522
8552
|
RUNTIME_INSTANCE_ID = `${process.pid}-${randomUUID6()}`;
|
|
8523
8553
|
registerStorageSchemaInitializer((database) => {
|
|
8524
8554
|
database.exec(`
|
|
@@ -8692,11 +8722,9 @@ async function waitForRequiredRuntimeProcessLease(role, options = {}) {
|
|
|
8692
8722
|
}
|
|
8693
8723
|
var PROCESS_LEASE_STALE_MS = 5000, PROCESS_LEASE_HEARTBEAT_MS = 1000;
|
|
8694
8724
|
var init_runtime_process_leases = __esm(async () => {
|
|
8695
|
-
await
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
init_storage_host()
|
|
8699
|
-
]);
|
|
8725
|
+
await init_forum_db();
|
|
8726
|
+
await init_runtime_leases();
|
|
8727
|
+
await init_storage_host();
|
|
8700
8728
|
registerStorageSchemaInitializer((database) => {
|
|
8701
8729
|
database.exec(`
|
|
8702
8730
|
CREATE TABLE IF NOT EXISTS runtime_process_leases (
|
|
@@ -9029,14 +9057,12 @@ function createAskUserToolDefinition(ctx) {
|
|
|
9029
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;
|
|
9030
9058
|
var init_ask_user = __esm(async () => {
|
|
9031
9059
|
init_common();
|
|
9032
|
-
await
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
init_runtime_process_leases()
|
|
9039
|
-
]);
|
|
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();
|
|
9040
9066
|
ASK_GATE_OWNER_ID = `ask-user-${process.pid}-${randomUUID7()}`;
|
|
9041
9067
|
defaultAskUserDurabilityHost = {
|
|
9042
9068
|
gates: {
|
|
@@ -9383,15 +9409,13 @@ function switchApiTopicAgent(opts) {
|
|
|
9383
9409
|
};
|
|
9384
9410
|
}
|
|
9385
9411
|
var init_api_topic_agent_switch = __esm(async () => {
|
|
9412
|
+
await init_auth_check();
|
|
9386
9413
|
init_model_catalog();
|
|
9414
|
+
await init_registry();
|
|
9387
9415
|
init_logger();
|
|
9388
|
-
await
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
init_api_topic_config(),
|
|
9392
|
-
init_api_topics(),
|
|
9393
|
-
init_conversations()
|
|
9394
|
-
]);
|
|
9416
|
+
await init_api_topic_config();
|
|
9417
|
+
await init_api_topics();
|
|
9418
|
+
await init_conversations();
|
|
9395
9419
|
});
|
|
9396
9420
|
|
|
9397
9421
|
// ../../packages/core/src/storage/self-schedules.ts
|
|
@@ -9522,35 +9546,36 @@ function deleteSelfSchedulesForTopic(topicId) {
|
|
|
9522
9546
|
return Number(result.changes ?? 0);
|
|
9523
9547
|
}
|
|
9524
9548
|
var init_self_schedules = __esm(async () => {
|
|
9525
|
-
await
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
`);
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
`);
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
`);
|
|
9549
|
+
await init_forum_db();
|
|
9550
|
+
await init_runtime_leases();
|
|
9551
|
+
await init_runtime_topic_state();
|
|
9552
|
+
await init_storage_host();
|
|
9553
|
+
registerStorageSchemaInitializer((database) => {
|
|
9554
|
+
database.exec(`
|
|
9555
|
+
CREATE TABLE IF NOT EXISTS runtime_self_schedules (
|
|
9556
|
+
id TEXT PRIMARY KEY,
|
|
9557
|
+
topic_id TEXT NOT NULL,
|
|
9558
|
+
user_id TEXT NOT NULL,
|
|
9559
|
+
message TEXT NOT NULL,
|
|
9560
|
+
deliver_at INTEGER NOT NULL,
|
|
9561
|
+
created_at INTEGER NOT NULL,
|
|
9562
|
+
updated_at INTEGER NOT NULL,
|
|
9563
|
+
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'running')),
|
|
9564
|
+
claimed_by TEXT,
|
|
9565
|
+
claimed_at INTEGER,
|
|
9566
|
+
running_query_id TEXT
|
|
9567
|
+
)
|
|
9568
|
+
`);
|
|
9569
|
+
database.exec(`
|
|
9570
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_runtime_self_schedules_one_pending
|
|
9571
|
+
ON runtime_self_schedules(topic_id)
|
|
9572
|
+
WHERE status = 'pending'
|
|
9573
|
+
`);
|
|
9574
|
+
database.exec(`
|
|
9575
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_self_schedules_due
|
|
9576
|
+
ON runtime_self_schedules(status, deliver_at)
|
|
9577
|
+
`);
|
|
9578
|
+
});
|
|
9554
9579
|
});
|
|
9555
9580
|
|
|
9556
9581
|
// ../../packages/core/src/topics/links.ts
|
|
@@ -9904,8 +9929,8 @@ __export(exports_vault_public, {
|
|
|
9904
9929
|
VAULT_DESCRIPTION_MAX_LENGTH: () => VAULT_DESCRIPTION_MAX_LENGTH
|
|
9905
9930
|
});
|
|
9906
9931
|
var init_vault_public = __esm(async () => {
|
|
9907
|
-
init_vault_crypto();
|
|
9908
9932
|
await init_vault();
|
|
9933
|
+
init_vault_crypto();
|
|
9909
9934
|
});
|
|
9910
9935
|
|
|
9911
9936
|
// ../../packages/core/src/platform/playwright/vault-broker.ts
|
|
@@ -10241,14 +10266,17 @@ function deleteBrowserProfile(ownerId, rawName) {
|
|
|
10241
10266
|
var DEFAULT_BROWSER_PROFILE = "default";
|
|
10242
10267
|
var init_browser_profiles = __esm(async () => {
|
|
10243
10268
|
await init_forum_db();
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10269
|
+
await init_storage_host();
|
|
10270
|
+
registerStorageSchemaInitializer((database) => {
|
|
10271
|
+
database.exec(`
|
|
10272
|
+
CREATE TABLE IF NOT EXISTS browser_profiles (
|
|
10273
|
+
owner_id TEXT NOT NULL,
|
|
10274
|
+
name TEXT NOT NULL,
|
|
10275
|
+
created_at TEXT NOT NULL,
|
|
10276
|
+
PRIMARY KEY (owner_id, name)
|
|
10277
|
+
)
|
|
10278
|
+
`);
|
|
10279
|
+
});
|
|
10252
10280
|
});
|
|
10253
10281
|
|
|
10254
10282
|
// ../../packages/core/src/platform/playwright/manager.ts
|
|
@@ -10928,17 +10956,15 @@ var defaultManagerHost, managerHost, MAX_IDLE_MS, instances, usedPorts, spawning
|
|
|
10928
10956
|
var init_manager2 = __esm(async () => {
|
|
10929
10957
|
init_config();
|
|
10930
10958
|
init_logger();
|
|
10959
|
+
await init_browser_processes();
|
|
10931
10960
|
init_headed_launch();
|
|
10932
10961
|
init_transport_probe();
|
|
10962
|
+
await init_vault_broker();
|
|
10963
|
+
await init_browser_profiles();
|
|
10933
10964
|
init_manager_utils();
|
|
10965
|
+
await init_browser_processes();
|
|
10934
10966
|
init_transport_probe();
|
|
10935
10967
|
init_manager_utils();
|
|
10936
|
-
await __promiseAll([
|
|
10937
|
-
init_browser_processes(),
|
|
10938
|
-
init_vault_broker(),
|
|
10939
|
-
init_browser_profiles(),
|
|
10940
|
-
init_browser_processes()
|
|
10941
|
-
]);
|
|
10942
10968
|
defaultManagerHost = Object.freeze({
|
|
10943
10969
|
portsDir: PLAYWRIGHT_PORTS_DIR,
|
|
10944
10970
|
basePort: PLAYWRIGHT_BASE_PORT,
|
|
@@ -11330,8 +11356,8 @@ function wsAbortReason(reason) {
|
|
|
11330
11356
|
var roomQueryRegistry, interSessionQueue;
|
|
11331
11357
|
var init_active_rooms = __esm(async () => {
|
|
11332
11358
|
init_logger();
|
|
11333
|
-
init_types2();
|
|
11334
11359
|
await init_runtime_leases();
|
|
11360
|
+
init_types2();
|
|
11335
11361
|
roomQueryRegistry = createRoomQueryRegistry({
|
|
11336
11362
|
instanceId: RUNTIME_INSTANCE_ID,
|
|
11337
11363
|
internalAbortReason: "internal" /* Internal */,
|
|
@@ -11385,13 +11411,11 @@ function isLegacySharedGeneral(topicId) {
|
|
|
11385
11411
|
}
|
|
11386
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.";
|
|
11387
11413
|
var init_personal_general = __esm(async () => {
|
|
11414
|
+
await init_registry();
|
|
11388
11415
|
init_config();
|
|
11389
11416
|
init_constants();
|
|
11390
|
-
await
|
|
11391
|
-
|
|
11392
|
-
init_api_topic_config(),
|
|
11393
|
-
init_api_topics()
|
|
11394
|
-
]);
|
|
11417
|
+
await init_api_topic_config();
|
|
11418
|
+
await init_api_topics();
|
|
11395
11419
|
});
|
|
11396
11420
|
|
|
11397
11421
|
// ../../packages/core/src/prompts/builders.ts
|
|
@@ -11877,11 +11901,9 @@ function listTopicBriefs() {
|
|
|
11877
11901
|
return rows.map(rowToBrief);
|
|
11878
11902
|
}
|
|
11879
11903
|
var init_api_topic_brief = __esm(async () => {
|
|
11904
|
+
await init_forum_db();
|
|
11905
|
+
await init_storage_host();
|
|
11880
11906
|
init_wiki_summary_names();
|
|
11881
|
-
await __promiseAll([
|
|
11882
|
-
init_forum_db(),
|
|
11883
|
-
init_storage_host()
|
|
11884
|
-
]);
|
|
11885
11907
|
registerStorageSchemaInitializer((database) => {
|
|
11886
11908
|
database.exec(`
|
|
11887
11909
|
CREATE TABLE IF NOT EXISTS api_topic_brief (
|
|
@@ -11977,9 +11999,9 @@ function formatArchiverBytes(bytes) {
|
|
|
11977
11999
|
function formatArchiverTool(name, input) {
|
|
11978
12000
|
const params = Object.entries(input).map(([key, value]) => {
|
|
11979
12001
|
const rendered = typeof value === "string" ? value : JSON.stringify(value);
|
|
11980
|
-
return `${key}: ${sessionText(rendered ?? "")}`;
|
|
12002
|
+
return `${key}: ${summarizeDisplayText(sessionText(rendered ?? ""))}`;
|
|
11981
12003
|
}).join(", ");
|
|
11982
|
-
return `${name}${params ? `(${params})` : ""}
|
|
12004
|
+
return summarizeDisplayText(`${name}${params ? `(${params})` : ""}`);
|
|
11983
12005
|
}
|
|
11984
12006
|
function createArchiverRuntime(host) {
|
|
11985
12007
|
const activeSessions = new Map;
|
|
@@ -12289,19 +12311,18 @@ function listActiveMemoryArchiverSessions(userId) {
|
|
|
12289
12311
|
}
|
|
12290
12312
|
var MAX_BRIEF_ENTRIES = 8, defaultArchiverRuntime;
|
|
12291
12313
|
var init_archiver = __esm(async () => {
|
|
12314
|
+
await init_agents();
|
|
12315
|
+
init_tool_format();
|
|
12316
|
+
await init_bus();
|
|
12292
12317
|
init_config();
|
|
12293
12318
|
init_logger();
|
|
12294
12319
|
init_builders();
|
|
12295
12320
|
init_background_session_policy();
|
|
12321
|
+
await init_api_messages();
|
|
12322
|
+
await init_api_topic_brief();
|
|
12323
|
+
await init_wiki();
|
|
12296
12324
|
init_wiki_summary_names();
|
|
12297
|
-
await
|
|
12298
|
-
init_agents(),
|
|
12299
|
-
init_bus(),
|
|
12300
|
-
init_api_messages(),
|
|
12301
|
-
init_api_topic_brief(),
|
|
12302
|
-
init_wiki(),
|
|
12303
|
-
init_personal_general()
|
|
12304
|
-
]);
|
|
12325
|
+
await init_personal_general();
|
|
12305
12326
|
defaultArchiverRuntime = createArchiverRuntime({
|
|
12306
12327
|
storage: {
|
|
12307
12328
|
getWikiDir: getSharedWikiDir,
|
|
@@ -12543,11 +12564,9 @@ function archiveConversationEvents(topicId, topicTitle, userId, options = {}) {
|
|
|
12543
12564
|
}
|
|
12544
12565
|
var init_topic_archive = __esm(async () => {
|
|
12545
12566
|
init_logger();
|
|
12546
|
-
await
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
init_wiki()
|
|
12550
|
-
]);
|
|
12567
|
+
await init_api_messages();
|
|
12568
|
+
await init_conversations();
|
|
12569
|
+
await init_wiki();
|
|
12551
12570
|
});
|
|
12552
12571
|
|
|
12553
12572
|
// ../../packages/core/src/storage/topic-archive-state.ts
|
|
@@ -12668,10 +12687,8 @@ function deleteTopicArchiveState(topicId) {
|
|
|
12668
12687
|
}
|
|
12669
12688
|
var ARCHIVE_JOB_STALE_MS;
|
|
12670
12689
|
var init_topic_archive_state = __esm(async () => {
|
|
12671
|
-
await
|
|
12672
|
-
|
|
12673
|
-
init_storage_host()
|
|
12674
|
-
]);
|
|
12690
|
+
await init_forum_db();
|
|
12691
|
+
await init_storage_host();
|
|
12675
12692
|
registerStorageSchemaInitializer((database) => {
|
|
12676
12693
|
database.exec(`
|
|
12677
12694
|
CREATE TABLE IF NOT EXISTS api_topic_archive_state (
|
|
@@ -12847,15 +12864,13 @@ function archiveActiveTopicForMemory(topicId, userId, options) {
|
|
|
12847
12864
|
}
|
|
12848
12865
|
var DEFAULT_IDLE_DELAY_MS, DEFAULT_MIN_MESSAGES = 8, timers;
|
|
12849
12866
|
var init_idle_archiver = __esm(async () => {
|
|
12867
|
+
await init_archiver();
|
|
12850
12868
|
init_logger();
|
|
12851
|
-
await
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
init_topic_archive(),
|
|
12857
|
-
init_topic_archive_state()
|
|
12858
|
-
]);
|
|
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();
|
|
12859
12874
|
DEFAULT_IDLE_DELAY_MS = 6 * 60 * 60 * 1000;
|
|
12860
12875
|
timers = new Map;
|
|
12861
12876
|
});
|
|
@@ -12979,12 +12994,10 @@ function createTopicLogMaintenance(host) {
|
|
|
12979
12994
|
}
|
|
12980
12995
|
var defaultTopicLogMaintenance, cleanupTopicRollouts, cleanupTopicRolloutsFromEntries, rotateTopicLogs, purgeTopicLogs;
|
|
12981
12996
|
var init_topic_cleanup = __esm(async () => {
|
|
12997
|
+
await init_agents();
|
|
12998
|
+
await init_registry();
|
|
12982
12999
|
init_logger();
|
|
12983
|
-
await
|
|
12984
|
-
init_agents(),
|
|
12985
|
-
init_registry(),
|
|
12986
|
-
init_conversations()
|
|
12987
|
-
]);
|
|
13000
|
+
await init_conversations();
|
|
12988
13001
|
defaultTopicLogMaintenance = createTopicLogMaintenance({
|
|
12989
13002
|
agents: SUPPORTED_AGENTS,
|
|
12990
13003
|
readActiveConversation: readConversation,
|
|
@@ -13096,7 +13109,7 @@ function detailedToolStep(payload) {
|
|
|
13096
13109
|
const label = compactToolLabel(String(payload.label ?? name));
|
|
13097
13110
|
if (shortName === "ask_session" || shortName === "tell_session") {
|
|
13098
13111
|
const target = typeof input.to === "string" && input.to.trim() ? input.to.trim() : "session";
|
|
13099
|
-
const msg = typeof input.message === "string" ? text(input.message) : "";
|
|
13112
|
+
const msg = typeof input.message === "string" ? summarizeDisplayText(text(input.message)) : "";
|
|
13100
13113
|
const action = shortName === "ask_session" ? "Ask" : "Tell";
|
|
13101
13114
|
return `${action} ${target}${msg ? ` \u2014 ${msg}` : ""}`;
|
|
13102
13115
|
}
|
|
@@ -13122,22 +13135,22 @@ function detailedToolStep(payload) {
|
|
|
13122
13135
|
return `${action} file`;
|
|
13123
13136
|
}
|
|
13124
13137
|
if (shortName === "grep" || shortName === "glob") {
|
|
13125
|
-
const pattern = typeof input.pattern === "string" ? input.pattern : "";
|
|
13138
|
+
const pattern = typeof input.pattern === "string" ? summarizeDisplayText(text(input.pattern)) : "";
|
|
13126
13139
|
const action = shortName === "grep" ? "Grep" : "Glob";
|
|
13127
13140
|
if (pattern)
|
|
13128
|
-
return `${action} '${
|
|
13141
|
+
return `${action} '${pattern}'${path ? ` in ${path}` : ""}`;
|
|
13129
13142
|
if (path)
|
|
13130
13143
|
return `${action} ${path}`;
|
|
13131
13144
|
}
|
|
13132
13145
|
if (shortName === "bash") {
|
|
13133
|
-
const cmd = typeof input.command === "string" ? text(input.command) : "";
|
|
13146
|
+
const cmd = typeof input.command === "string" ? summarizeDisplayText(text(input.command)) : "";
|
|
13134
13147
|
return cmd ? `Bash: ${cmd}` : "Bash";
|
|
13135
13148
|
}
|
|
13136
13149
|
if (shortName === "webfetch" || shortName === "url_fetch") {
|
|
13137
|
-
const url = typeof input.url === "string" ? text(input.url) : "";
|
|
13150
|
+
const url = typeof input.url === "string" ? summarizeDisplayText(text(input.url)) : "";
|
|
13138
13151
|
return url ? `Fetch ${url}` : "WebFetch";
|
|
13139
13152
|
}
|
|
13140
|
-
return label;
|
|
13153
|
+
return summarizeDisplayText(label);
|
|
13141
13154
|
}
|
|
13142
13155
|
function backgroundSessionProgress(topicId, queryId) {
|
|
13143
13156
|
let status = "Running";
|
|
@@ -13165,7 +13178,7 @@ function backgroundSessionProgress(topicId, queryId) {
|
|
|
13165
13178
|
step = text(payload.content);
|
|
13166
13179
|
else if (kind === "tool_output") {
|
|
13167
13180
|
const toolName = toolNames.get(text(payload.toolUseId)) ?? "Tool";
|
|
13168
|
-
step = payload.isError ? `${toolName} failed: ${text(payload.content) || "unknown error"}` : `${toolName} result \xB7 ${byteSize(payload.content)}`;
|
|
13181
|
+
step = payload.isError ? `${toolName} failed: ${summarizeDisplayText(text(payload.content)) || "unknown error"}` : `${toolName} result \xB7 ${byteSize(payload.content)}`;
|
|
13169
13182
|
} else if (kind === "ai_done") {
|
|
13170
13183
|
const usage = payload.usage && typeof payload.usage === "object" ? payload.usage : undefined;
|
|
13171
13184
|
const input = typeof usage?.input === "number" ? usage.input.toLocaleString() : "";
|
|
@@ -13230,13 +13243,12 @@ function listBackgroundSessionsForUser(userId) {
|
|
|
13230
13243
|
}
|
|
13231
13244
|
var providers, transientSessions;
|
|
13232
13245
|
var init_background_sessions = __esm(async () => {
|
|
13246
|
+
await init_archiver();
|
|
13247
|
+
init_tool_format();
|
|
13248
|
+
await init_api_topics();
|
|
13249
|
+
await init_runtime_events();
|
|
13250
|
+
await init_runtime_leases();
|
|
13233
13251
|
init_background_session_policy();
|
|
13234
|
-
await __promiseAll([
|
|
13235
|
-
init_archiver(),
|
|
13236
|
-
init_api_topics(),
|
|
13237
|
-
init_runtime_events(),
|
|
13238
|
-
init_runtime_leases()
|
|
13239
|
-
]);
|
|
13240
13252
|
providers = new Set;
|
|
13241
13253
|
transientSessions = new Map;
|
|
13242
13254
|
});
|
|
@@ -13532,13 +13544,12 @@ function getRuntimeUserTurnRequest(topicId) {
|
|
|
13532
13544
|
}
|
|
13533
13545
|
var REQUEST_CLAIM_STALE_MS;
|
|
13534
13546
|
var init_runtime_turn_requests = __esm(async () => {
|
|
13535
|
-
await
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
]);
|
|
13547
|
+
await init_forum_db();
|
|
13548
|
+
await init_runtime_leases();
|
|
13549
|
+
await init_runtime_topic_state();
|
|
13550
|
+
await init_storage_host();
|
|
13540
13551
|
REQUEST_CLAIM_STALE_MS = TURN_LEASE_STALE_MS;
|
|
13541
|
-
ensureRuntimeUserTurnRequestsSchema(
|
|
13552
|
+
registerStorageSchemaInitializer((database) => ensureRuntimeUserTurnRequestsSchema(database));
|
|
13542
13553
|
});
|
|
13543
13554
|
|
|
13544
13555
|
// ../../packages/core/src/topics/session.ts
|
|
@@ -14184,31 +14195,29 @@ async function compactTopicSession(topicId, userId, reason = "topic-session-comp
|
|
|
14184
14195
|
}
|
|
14185
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;
|
|
14186
14197
|
var init_session = __esm(async () => {
|
|
14198
|
+
await init_idle_archiver();
|
|
14199
|
+
await init_agents();
|
|
14187
14200
|
init_model_catalog();
|
|
14201
|
+
await init_registry();
|
|
14188
14202
|
init_shared();
|
|
14203
|
+
await init_topic_cleanup();
|
|
14204
|
+
await init_bus();
|
|
14189
14205
|
init_config();
|
|
14190
14206
|
init_logger();
|
|
14191
14207
|
init_mcp_config();
|
|
14208
|
+
await init_active_rooms();
|
|
14209
|
+
await init_background_sessions();
|
|
14192
14210
|
init_usage_alert();
|
|
14193
|
-
await
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
init_api_topic_config(),
|
|
14204
|
-
init_api_topics(),
|
|
14205
|
-
init_conversations(),
|
|
14206
|
-
init_runtime_leases(),
|
|
14207
|
-
init_runtime_topic_state(),
|
|
14208
|
-
init_runtime_turn_requests(),
|
|
14209
|
-
init_topic_archive(),
|
|
14210
|
-
init_personal_general()
|
|
14211
|
-
]);
|
|
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();
|
|
14212
14221
|
RESET_MEMORY_ARCHIVE_WAIT_MS = 5 * 60 * 1000;
|
|
14213
14222
|
COMPACTION_SOURCE_CHARS = 512 * 1024;
|
|
14214
14223
|
COMPACTION_TIMEOUT_MS = 2 * 60000;
|
|
@@ -14539,24 +14548,22 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
|
|
|
14539
14548
|
}
|
|
14540
14549
|
var TopicTitleConflictError, TopicDeriveBusyError, TopicForkCompactionError;
|
|
14541
14550
|
var init_derive = __esm(async () => {
|
|
14551
|
+
await init_fork();
|
|
14542
14552
|
init_model_catalog();
|
|
14553
|
+
await init_registry();
|
|
14554
|
+
await init_bus();
|
|
14543
14555
|
init_config();
|
|
14544
14556
|
init_logger();
|
|
14545
|
-
await
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
init_forum_db(),
|
|
14556
|
-
init_runtime_topic_state(),
|
|
14557
|
-
init_personal_general(),
|
|
14558
|
-
init_session()
|
|
14559
|
-
]);
|
|
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();
|
|
14560
14567
|
TopicTitleConflictError = class TopicTitleConflictError extends Error {
|
|
14561
14568
|
title;
|
|
14562
14569
|
constructor(title) {
|
|
@@ -14915,17 +14922,15 @@ Link: ${host.derivedTopics.link(derived.id)}`);
|
|
|
14915
14922
|
}
|
|
14916
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;
|
|
14917
14924
|
var init_self_config_core = __esm(async () => {
|
|
14925
|
+
await init_api_topic_agent_switch();
|
|
14926
|
+
await init_auth_check();
|
|
14918
14927
|
init_model_catalog();
|
|
14928
|
+
await init_registry();
|
|
14929
|
+
await init_bus();
|
|
14919
14930
|
init_config();
|
|
14920
|
-
await
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
init_registry(),
|
|
14924
|
-
init_bus(),
|
|
14925
|
-
init_api_topic_config(),
|
|
14926
|
-
init_api_topics(),
|
|
14927
|
-
init_self_schedules()
|
|
14928
|
-
]);
|
|
14931
|
+
await init_api_topic_config();
|
|
14932
|
+
await init_api_topics();
|
|
14933
|
+
await init_self_schedules();
|
|
14929
14934
|
DEFAULT_SELF_CONFIG_PRODUCT = {
|
|
14930
14935
|
mcpKey: SELF_CONFIG_MCP_KEY,
|
|
14931
14936
|
scheduleMaxDelaySeconds: SELF_SCHEDULE_MAX_DELAY_SECONDS,
|
|
@@ -15140,8 +15145,8 @@ function createSelfConfigToolDefinitions(ctx) {
|
|
|
15140
15145
|
var AGENT_VALUES;
|
|
15141
15146
|
var init_self_config = __esm(async () => {
|
|
15142
15147
|
init_common();
|
|
15143
|
-
init_types();
|
|
15144
15148
|
await init_self_config_core();
|
|
15149
|
+
init_types();
|
|
15145
15150
|
AGENT_VALUES = SUPPORTED_AGENTS;
|
|
15146
15151
|
});
|
|
15147
15152
|
|
|
@@ -15798,21 +15803,22 @@ async function failInterruptedRemoteAskCallbacks() {
|
|
|
15798
15803
|
}
|
|
15799
15804
|
var pendingAsks, MAX_ASK_AGE_MS;
|
|
15800
15805
|
var init_ask_callbacks = __esm(async () => {
|
|
15801
|
-
await
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
`);
|
|
15806
|
+
await init_forum_db();
|
|
15807
|
+
await init_session_asks();
|
|
15808
|
+
await init_storage_host();
|
|
15809
|
+
registerStorageSchemaInitializer((database) => {
|
|
15810
|
+
database.exec(`
|
|
15811
|
+
CREATE TABLE IF NOT EXISTS remote_ask_callbacks (
|
|
15812
|
+
target_query_id TEXT PRIMARY KEY,
|
|
15813
|
+
request_id TEXT NOT NULL,
|
|
15814
|
+
node_name TEXT NOT NULL,
|
|
15815
|
+
node_cell_id TEXT NOT NULL,
|
|
15816
|
+
topic_id TEXT NOT NULL,
|
|
15817
|
+
user_id TEXT NOT NULL,
|
|
15818
|
+
created_at INTEGER NOT NULL
|
|
15819
|
+
)
|
|
15820
|
+
`);
|
|
15821
|
+
});
|
|
15816
15822
|
pendingAsks = new Map;
|
|
15817
15823
|
MAX_ASK_AGE_MS = PENDING_ASK_TTL_MS;
|
|
15818
15824
|
});
|
|
@@ -16035,29 +16041,32 @@ if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",
|
|
|
16035
16041
|
</script>`;
|
|
16036
16042
|
var init_visual_store = __esm(async () => {
|
|
16037
16043
|
await init_forum_db();
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16044
|
+
await init_storage_host();
|
|
16045
|
+
registerStorageSchemaInitializer((database) => {
|
|
16046
|
+
database.exec(`
|
|
16047
|
+
CREATE TABLE IF NOT EXISTS api_topic_visuals (
|
|
16048
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
16049
|
+
topic_id TEXT NOT NULL,
|
|
16050
|
+
html TEXT NOT NULL,
|
|
16051
|
+
title TEXT,
|
|
16052
|
+
created_at INTEGER NOT NULL,
|
|
16053
|
+
kind TEXT NOT NULL DEFAULT 'html',
|
|
16054
|
+
source TEXT,
|
|
16055
|
+
file_id TEXT,
|
|
16056
|
+
mime_type TEXT,
|
|
16057
|
+
media_token TEXT
|
|
16058
|
+
);
|
|
16059
|
+
CREATE INDEX IF NOT EXISTS idx_api_topic_visuals_topic
|
|
16060
|
+
ON api_topic_visuals(topic_id, created_at DESC);
|
|
16061
|
+
|
|
16062
|
+
CREATE TABLE IF NOT EXISTS api_topic_visual_views (
|
|
16063
|
+
topic_id TEXT NOT NULL,
|
|
16064
|
+
user_id TEXT NOT NULL,
|
|
16065
|
+
visual_id INTEGER NOT NULL,
|
|
16066
|
+
PRIMARY KEY (topic_id, user_id)
|
|
16067
|
+
);
|
|
16068
|
+
`);
|
|
16069
|
+
});
|
|
16061
16070
|
for (const statement of [
|
|
16062
16071
|
"ALTER TABLE api_topic_visuals ADD COLUMN kind TEXT NOT NULL DEFAULT 'html'",
|
|
16063
16072
|
"ALTER TABLE api_topic_visuals ADD COLUMN source TEXT",
|
|
@@ -16265,37 +16274,35 @@ async function deleteTopicCascadeImpl(topic, userId, options, deletingAncestorId
|
|
|
16265
16274
|
}
|
|
16266
16275
|
var DELETE_TURN_WAIT_MS = 5000, TopicArchiveRequiredError, TopicTurnStillActiveError, TopicCleanupRequiredError;
|
|
16267
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();
|
|
16268
16282
|
init_manager();
|
|
16269
16283
|
init_config();
|
|
16270
16284
|
init_constants();
|
|
16271
16285
|
init_logger();
|
|
16286
|
+
await init_manager2();
|
|
16287
|
+
await init_active_rooms();
|
|
16272
16288
|
init_session_inbox_cleanup();
|
|
16273
16289
|
init_state();
|
|
16290
|
+
await init_ask_callbacks();
|
|
16274
16291
|
init_file_hooks();
|
|
16275
16292
|
init_usage_alert();
|
|
16276
|
-
await
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
init_api_topics(),
|
|
16290
|
-
init_browser_profiles(),
|
|
16291
|
-
init_runtime_leases(),
|
|
16292
|
-
init_runtime_topic_state(),
|
|
16293
|
-
init_runtime_turn_requests(),
|
|
16294
|
-
init_self_schedules(),
|
|
16295
|
-
init_session_asks(),
|
|
16296
|
-
init_topic_archive(),
|
|
16297
|
-
init_topic_archive_state()
|
|
16298
|
-
]);
|
|
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();
|
|
16299
16306
|
TopicArchiveRequiredError = class TopicArchiveRequiredError extends Error {
|
|
16300
16307
|
code = "TOPIC_ARCHIVE_FAILED";
|
|
16301
16308
|
topicId;
|
|
@@ -16655,8 +16662,8 @@ function abortPlaywrightTurns(instanceKey, failure) {
|
|
|
16655
16662
|
var turnsByInstance;
|
|
16656
16663
|
var init_playwright_turn_abort = __esm(async () => {
|
|
16657
16664
|
init_logger();
|
|
16658
|
-
init_types2();
|
|
16659
16665
|
await init_manager2();
|
|
16666
|
+
init_types2();
|
|
16660
16667
|
turnsByInstance = new Map;
|
|
16661
16668
|
onPlaywrightFailure(abortPlaywrightTurns);
|
|
16662
16669
|
});
|
|
@@ -16749,10 +16756,8 @@ function upsertTaskPanelMessage(topicId, queryId, tasks, lastRenderedText) {
|
|
|
16749
16756
|
return text2;
|
|
16750
16757
|
}
|
|
16751
16758
|
var init_tasks2 = __esm(async () => {
|
|
16752
|
-
await
|
|
16753
|
-
|
|
16754
|
-
init_api_messages()
|
|
16755
|
-
]);
|
|
16759
|
+
await init_bus();
|
|
16760
|
+
await init_api_messages();
|
|
16756
16761
|
});
|
|
16757
16762
|
|
|
16758
16763
|
// ../../packages/core/src/runtime/visual-html.ts
|
|
@@ -16988,12 +16993,10 @@ var ACTIVE_VISUAL_PROMPT_MAX_CHARS = 24000, ACTIVE_VISUAL_PROMPT_TAIL_CHARS = 60
|
|
|
16988
16993
|
var init_visuals = __esm(async () => {
|
|
16989
16994
|
init_attachments();
|
|
16990
16995
|
init_file_hooks();
|
|
16996
|
+
await init_visual_store();
|
|
16991
16997
|
init_sensitive_path();
|
|
16998
|
+
await init_api_messages();
|
|
16992
16999
|
init_visual_html();
|
|
16993
|
-
await __promiseAll([
|
|
16994
|
-
init_visual_store(),
|
|
16995
|
-
init_api_messages()
|
|
16996
|
-
]);
|
|
16997
17000
|
});
|
|
16998
17001
|
|
|
16999
17002
|
// ../../packages/core/src/storage/token-stats.ts
|
|
@@ -17767,32 +17770,30 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
17767
17770
|
return outcome;
|
|
17768
17771
|
}
|
|
17769
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();
|
|
17770
17777
|
init_model_catalog();
|
|
17778
|
+
await init_registry();
|
|
17771
17779
|
init_tool_format();
|
|
17780
|
+
await init_bus();
|
|
17772
17781
|
init_logger();
|
|
17782
|
+
await init_active_rooms();
|
|
17773
17783
|
init_state();
|
|
17774
17784
|
init_types2();
|
|
17775
17785
|
init_attachments();
|
|
17776
17786
|
init_errors();
|
|
17787
|
+
await init_tasks2();
|
|
17788
|
+
await init_topic_config();
|
|
17777
17789
|
init_usage_alert();
|
|
17790
|
+
await init_visual_store();
|
|
17791
|
+
await init_visuals();
|
|
17778
17792
|
init_sensitive_path();
|
|
17779
|
-
await
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
init_spawn_subagent(),
|
|
17784
|
-
init_registry(),
|
|
17785
|
-
init_bus(),
|
|
17786
|
-
init_active_rooms(),
|
|
17787
|
-
init_tasks2(),
|
|
17788
|
-
init_topic_config(),
|
|
17789
|
-
init_visual_store(),
|
|
17790
|
-
init_visuals(),
|
|
17791
|
-
init_api_messages(),
|
|
17792
|
-
init_api_topics(),
|
|
17793
|
-
init_runtime_turn_requests(),
|
|
17794
|
-
init_token_stats()
|
|
17795
|
-
]);
|
|
17793
|
+
await init_api_messages();
|
|
17794
|
+
await init_api_topics();
|
|
17795
|
+
await init_runtime_turn_requests();
|
|
17796
|
+
await init_token_stats();
|
|
17796
17797
|
});
|
|
17797
17798
|
|
|
17798
17799
|
// ../../packages/core/src/runtime/turn-session.ts
|
|
@@ -17824,11 +17825,9 @@ function resolveInitialTurnSessionId(topicId, requestedSessionId, isolated) {
|
|
|
17824
17825
|
}
|
|
17825
17826
|
var init_turn_session = __esm(async () => {
|
|
17826
17827
|
init_model_catalog();
|
|
17827
|
-
await
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
init_api_topics()
|
|
17831
|
-
]);
|
|
17828
|
+
await init_registry();
|
|
17829
|
+
await init_topic_config();
|
|
17830
|
+
await init_api_topics();
|
|
17832
17831
|
});
|
|
17833
17832
|
|
|
17834
17833
|
// ../../packages/core/src/storage/app-settings.ts
|
|
@@ -19171,43 +19170,41 @@ function triggerTopicAiTurn(topicId, userId, prompt, agentType, opts) {
|
|
|
19171
19170
|
}
|
|
19172
19171
|
var PLAYWRIGHT_UNAVAILABLE_NOTICE_COOLDOWN_MS, ASK_REPLY_INJECT_BATCH_MS = 500, playwrightUnavailableNoticeAt, askReplyInjectBatcher, remoteInjectWaiters, durableTurnWorker = null, durableTurnWorkerBusy = false;
|
|
19173
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();
|
|
19174
19178
|
init_manager();
|
|
19175
19179
|
init_constants();
|
|
19176
19180
|
init_logger();
|
|
19177
19181
|
init_mcp_config();
|
|
19182
|
+
await init_manager2();
|
|
19178
19183
|
init_builders();
|
|
19184
|
+
await init_active_rooms();
|
|
19179
19185
|
init_state();
|
|
19180
19186
|
init_types2();
|
|
19181
19187
|
init_attachments();
|
|
19188
|
+
await init_channel_context();
|
|
19182
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();
|
|
19183
19206
|
init_wiki_summary_names();
|
|
19184
|
-
await
|
|
19185
|
-
init_fork(),
|
|
19186
|
-
init_agents(),
|
|
19187
|
-
init_spawn_subagent(),
|
|
19188
|
-
init_registry(),
|
|
19189
|
-
init_bus(),
|
|
19190
|
-
init_manager2(),
|
|
19191
|
-
init_active_rooms(),
|
|
19192
|
-
init_channel_context(),
|
|
19193
|
-
init_playwright_turn_abort(),
|
|
19194
|
-
init_topic_config(),
|
|
19195
|
-
init_turn_event_stream(),
|
|
19196
|
-
init_turn_session(),
|
|
19197
|
-
init_visual_store(),
|
|
19198
|
-
init_visuals(),
|
|
19199
|
-
init_api_messages(),
|
|
19200
|
-
init_api_topic_brief(),
|
|
19201
|
-
init_api_topics(),
|
|
19202
|
-
init_app_settings(),
|
|
19203
|
-
init_browser_profiles(),
|
|
19204
|
-
init_conversations(),
|
|
19205
|
-
init_runtime_leases(),
|
|
19206
|
-
init_runtime_topic_state(),
|
|
19207
|
-
init_runtime_turn_requests(),
|
|
19208
|
-
init_wiki(),
|
|
19209
|
-
init_derive()
|
|
19210
|
-
]);
|
|
19207
|
+
await init_derive();
|
|
19211
19208
|
init_model_catalog();
|
|
19212
19209
|
init_attachments();
|
|
19213
19210
|
init_channel_context();
|
|
@@ -19917,16 +19914,14 @@ function processOwnerIsAlive(ownerId) {
|
|
|
19917
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;
|
|
19918
19915
|
var init_spawn_subagent = __esm(async () => {
|
|
19919
19916
|
init_common();
|
|
19917
|
+
await init_bus();
|
|
19920
19918
|
init_logger();
|
|
19919
|
+
await init_api_messages();
|
|
19920
|
+
await init_api_topics();
|
|
19921
|
+
await init_runtime_leases();
|
|
19922
|
+
await init_runtime_turn_requests();
|
|
19921
19923
|
init_wiki_summary_names();
|
|
19922
19924
|
init_types();
|
|
19923
|
-
await __promiseAll([
|
|
19924
|
-
init_bus(),
|
|
19925
|
-
init_api_messages(),
|
|
19926
|
-
init_api_topics(),
|
|
19927
|
-
init_runtime_leases(),
|
|
19928
|
-
init_runtime_turn_requests()
|
|
19929
|
-
]);
|
|
19930
19925
|
defaultSubagentLifecycleHost = {
|
|
19931
19926
|
storage: {
|
|
19932
19927
|
getTopic,
|
|
@@ -20169,19 +20164,23 @@ function recordRuntimeGatewaySubmission(submission) {
|
|
|
20169
20164
|
}
|
|
20170
20165
|
var init_runtime_gateway_submissions = __esm(async () => {
|
|
20171
20166
|
await init_forum_db();
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20167
|
+
await init_storage_host();
|
|
20168
|
+
registerStorageSchemaInitializer((database) => {
|
|
20169
|
+
database.exec(`
|
|
20170
|
+
CREATE TABLE IF NOT EXISTS runtime_gateway_submissions (
|
|
20171
|
+
client_message_id TEXT PRIMARY KEY,
|
|
20172
|
+
request_id TEXT NOT NULL UNIQUE,
|
|
20173
|
+
topic_id TEXT NOT NULL,
|
|
20174
|
+
message_id TEXT NOT NULL,
|
|
20175
|
+
user_id TEXT NOT NULL,
|
|
20176
|
+
created_at TEXT NOT NULL,
|
|
20177
|
+
ack_cursor INTEGER NOT NULL DEFAULT 0,
|
|
20178
|
+
message_cursor INTEGER NOT NULL DEFAULT 0,
|
|
20179
|
+
payload_hash TEXT
|
|
20180
|
+
)
|
|
20181
|
+
`);
|
|
20182
|
+
database.exec("CREATE INDEX IF NOT EXISTS idx_runtime_gateway_submissions_topic ON runtime_gateway_submissions(topic_id)");
|
|
20183
|
+
});
|
|
20185
20184
|
try {
|
|
20186
20185
|
db.exec("ALTER TABLE runtime_gateway_submissions ADD COLUMN ack_cursor INTEGER NOT NULL DEFAULT 0");
|
|
20187
20186
|
} catch {}
|
|
@@ -20191,7 +20190,6 @@ var init_runtime_gateway_submissions = __esm(async () => {
|
|
|
20191
20190
|
try {
|
|
20192
20191
|
db.exec("ALTER TABLE runtime_gateway_submissions ADD COLUMN message_cursor INTEGER NOT NULL DEFAULT 0");
|
|
20193
20192
|
} catch {}
|
|
20194
|
-
db.exec("CREATE INDEX IF NOT EXISTS idx_runtime_gateway_submissions_topic ON runtime_gateway_submissions(topic_id)");
|
|
20195
20193
|
});
|
|
20196
20194
|
|
|
20197
20195
|
// ../../packages/core/src/application/submit-runtime-gateway-turn.ts
|
|
@@ -20313,16 +20311,14 @@ function submitRuntimeGatewayTurn(params) {
|
|
|
20313
20311
|
}
|
|
20314
20312
|
var RuntimeGatewayIdempotencyConflictError;
|
|
20315
20313
|
var init_submit_runtime_gateway_turn = __esm(async () => {
|
|
20316
|
-
await
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
init_runtime_turn_requests()
|
|
20325
|
-
]);
|
|
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();
|
|
20326
20322
|
RuntimeGatewayIdempotencyConflictError = class RuntimeGatewayIdempotencyConflictError extends Error {
|
|
20327
20323
|
constructor(message = "clientMessageId or requestId is already bound to another turn") {
|
|
20328
20324
|
super(message);
|
|
@@ -20356,14 +20352,39 @@ function submitUserMessage(params) {
|
|
|
20356
20352
|
return { message, queryId };
|
|
20357
20353
|
}
|
|
20358
20354
|
var init_submit_user_message = __esm(async () => {
|
|
20359
|
-
await
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
init_api_messages()
|
|
20363
|
-
]);
|
|
20355
|
+
await init_bus();
|
|
20356
|
+
await init_turn_runner();
|
|
20357
|
+
await init_api_messages();
|
|
20364
20358
|
});
|
|
20365
20359
|
|
|
20366
20360
|
// ../../packages/core/src/application/switch-topic-access-mode.ts
|
|
20361
|
+
function collectSubagentDescendants(rootTopicId) {
|
|
20362
|
+
const all = listTopics();
|
|
20363
|
+
const childrenByParent = new Map;
|
|
20364
|
+
for (const topic of all) {
|
|
20365
|
+
if (!topic.isSubagent || !topic.parentTopicId)
|
|
20366
|
+
continue;
|
|
20367
|
+
const siblings = childrenByParent.get(topic.parentTopicId);
|
|
20368
|
+
if (siblings)
|
|
20369
|
+
siblings.push(topic);
|
|
20370
|
+
else
|
|
20371
|
+
childrenByParent.set(topic.parentTopicId, [topic]);
|
|
20372
|
+
}
|
|
20373
|
+
const descendants = [];
|
|
20374
|
+
const seen = new Set([rootTopicId]);
|
|
20375
|
+
const queue = [rootTopicId];
|
|
20376
|
+
while (queue.length > 0) {
|
|
20377
|
+
const parentId = queue.shift();
|
|
20378
|
+
for (const child of childrenByParent.get(parentId) ?? []) {
|
|
20379
|
+
if (seen.has(child.id))
|
|
20380
|
+
continue;
|
|
20381
|
+
seen.add(child.id);
|
|
20382
|
+
descendants.push(child);
|
|
20383
|
+
queue.push(child.id);
|
|
20384
|
+
}
|
|
20385
|
+
}
|
|
20386
|
+
return descendants;
|
|
20387
|
+
}
|
|
20367
20388
|
function switchTopicAccessMode(params) {
|
|
20368
20389
|
const topic = getTopic(params.topicId);
|
|
20369
20390
|
if (!topic)
|
|
@@ -20371,20 +20392,37 @@ function switchTopicAccessMode(params) {
|
|
|
20371
20392
|
const owner = topic.participants.some((participant) => participant.userId === params.userId && participant.role === "owner");
|
|
20372
20393
|
if (!owner)
|
|
20373
20394
|
return { ok: false, error: "Only topic owners can change privacy" };
|
|
20374
|
-
topic.
|
|
20375
|
-
|
|
20376
|
-
|
|
20395
|
+
if (topic.isSubagent) {
|
|
20396
|
+
return {
|
|
20397
|
+
ok: false,
|
|
20398
|
+
error: "Subagent rooms inherit privacy from their parent topic"
|
|
20399
|
+
};
|
|
20400
|
+
}
|
|
20401
|
+
const descendants = collectSubagentDescendants(topic.id);
|
|
20402
|
+
const changed = [topic, ...descendants].filter((candidate) => (candidate.accessMode ?? "private") !== params.accessMode);
|
|
20403
|
+
if (changed.length === 0) {
|
|
20404
|
+
return {
|
|
20405
|
+
ok: true,
|
|
20406
|
+
accessMode: params.accessMode,
|
|
20407
|
+
text: params.accessMode === "shared" ? `"${topic.title}" is already public to the connected Otium Hub.` : `"${topic.title}" is already private to this worker.`,
|
|
20408
|
+
topicIds: []
|
|
20409
|
+
};
|
|
20410
|
+
}
|
|
20411
|
+
setTopicAccessModes(changed.map((candidate) => candidate.id), params.accessMode);
|
|
20412
|
+
for (const candidate of changed)
|
|
20413
|
+
WsHub.get().broadcastTopicUpdated(candidate.id);
|
|
20414
|
+
const subagentCount = changed.filter((candidate) => candidate.id !== topic.id).length;
|
|
20415
|
+
const suffix = subagentCount > 0 ? ` (${subagentCount} subagent room${subagentCount === 1 ? "" : "s"} updated)` : "";
|
|
20377
20416
|
return {
|
|
20378
20417
|
ok: true,
|
|
20379
20418
|
accessMode: params.accessMode,
|
|
20380
|
-
|
|
20419
|
+
topicIds: changed.map((candidate) => candidate.id),
|
|
20420
|
+
text: (params.accessMode === "shared" ? `"${topic.title}" is public to the connected Otium Hub.` : `"${topic.title}" is private to this worker.`) + suffix
|
|
20381
20421
|
};
|
|
20382
20422
|
}
|
|
20383
20423
|
var init_switch_topic_access_mode = __esm(async () => {
|
|
20384
|
-
await
|
|
20385
|
-
|
|
20386
|
-
init_api_topics()
|
|
20387
|
-
]);
|
|
20424
|
+
await init_bus();
|
|
20425
|
+
await init_api_topics();
|
|
20388
20426
|
});
|
|
20389
20427
|
|
|
20390
20428
|
// ../../packages/core/src/application/switch-topic-effort.ts
|
|
@@ -20419,12 +20457,10 @@ function switchTopicEffort(params) {
|
|
|
20419
20457
|
};
|
|
20420
20458
|
}
|
|
20421
20459
|
var init_switch_topic_effort = __esm(async () => {
|
|
20422
|
-
await
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20426
|
-
init_api_topics()
|
|
20427
|
-
]);
|
|
20460
|
+
await init_registry();
|
|
20461
|
+
await init_bus();
|
|
20462
|
+
await init_api_topic_config();
|
|
20463
|
+
await init_api_topics();
|
|
20428
20464
|
});
|
|
20429
20465
|
|
|
20430
20466
|
// ../../packages/core/src/application/switch-topic-model.ts
|
|
@@ -20479,15 +20515,13 @@ function switchTopicModel(params) {
|
|
|
20479
20515
|
};
|
|
20480
20516
|
}
|
|
20481
20517
|
var init_switch_topic_model = __esm(async () => {
|
|
20518
|
+
await init_api_topic_agent_switch();
|
|
20519
|
+
await init_auth_check();
|
|
20482
20520
|
init_model_catalog();
|
|
20521
|
+
await init_bus();
|
|
20483
20522
|
init_config();
|
|
20484
|
-
await
|
|
20485
|
-
|
|
20486
|
-
init_auth_check(),
|
|
20487
|
-
init_bus(),
|
|
20488
|
-
init_api_topic_config(),
|
|
20489
|
-
init_api_topics()
|
|
20490
|
-
]);
|
|
20523
|
+
await init_api_topic_config();
|
|
20524
|
+
await init_api_topics();
|
|
20491
20525
|
});
|
|
20492
20526
|
|
|
20493
20527
|
// ../../packages/core/src/topics/create.ts
|
|
@@ -20557,15 +20591,13 @@ function registerTopic(opts) {
|
|
|
20557
20591
|
var DEFAULT_AGENT_ROOM_AGENT2, TopicValidationError;
|
|
20558
20592
|
var init_create = __esm(async () => {
|
|
20559
20593
|
init_model_catalog();
|
|
20594
|
+
await init_registry();
|
|
20595
|
+
await init_bus();
|
|
20560
20596
|
init_config();
|
|
20561
20597
|
init_constants();
|
|
20562
20598
|
init_logger();
|
|
20599
|
+
await init_api_topics();
|
|
20563
20600
|
init_types();
|
|
20564
|
-
await __promiseAll([
|
|
20565
|
-
init_registry(),
|
|
20566
|
-
init_bus(),
|
|
20567
|
-
init_api_topics()
|
|
20568
|
-
]);
|
|
20569
20601
|
DEFAULT_AGENT_ROOM_AGENT2 = FALLBACK_AGENT;
|
|
20570
20602
|
TopicValidationError = class TopicValidationError extends Error {
|
|
20571
20603
|
constructor(message) {
|
|
@@ -20592,19 +20624,17 @@ function ownerTopic(topicId, userId) {
|
|
|
20592
20624
|
}
|
|
20593
20625
|
var TopicServiceError, topicService;
|
|
20594
20626
|
var init_topic_service = __esm(async () => {
|
|
20595
|
-
await
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
|
|
20606
|
-
init_session()
|
|
20607
|
-
]);
|
|
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();
|
|
20608
20638
|
TopicServiceError = class TopicServiceError extends Error {
|
|
20609
20639
|
code;
|
|
20610
20640
|
constructor(code, message) {
|
|
@@ -22345,6 +22375,7 @@ function startSessionInboxWorker() {
|
|
|
22345
22375
|
}
|
|
22346
22376
|
var topicWorkerBusy, watcher2 = null, fallbackTimer2 = null, debouncedTrigger2 = null, leadershipTimer2 = null, workerLease2 = null, workerStarted2 = false, SESSION_INBOX_PROCESS_ROLE = "worker:session-inbox";
|
|
22347
22377
|
var init_inbox = __esm(async () => {
|
|
22378
|
+
await init_bus();
|
|
22348
22379
|
init_file_ops();
|
|
22349
22380
|
init_utils();
|
|
22350
22381
|
init_config();
|
|
@@ -22353,14 +22384,11 @@ var init_inbox = __esm(async () => {
|
|
|
22353
22384
|
init_logger();
|
|
22354
22385
|
init_session_inbox_path();
|
|
22355
22386
|
init_types2();
|
|
22356
|
-
await
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
init_self_schedules(),
|
|
22362
|
-
init_session_asks()
|
|
22363
|
-
]);
|
|
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();
|
|
22364
22392
|
topicWorkerBusy = new Set;
|
|
22365
22393
|
});
|
|
22366
22394
|
|
|
@@ -22596,10 +22624,27 @@ __export(exports_src, {
|
|
|
22596
22624
|
});
|
|
22597
22625
|
var init_src = __esm(async () => {
|
|
22598
22626
|
init_maestro_bootstrap_env();
|
|
22627
|
+
await init_auth_check();
|
|
22599
22628
|
init_codex_tree_kill();
|
|
22629
|
+
await init_fork();
|
|
22630
|
+
await init_agents();
|
|
22631
|
+
await init_ask_user();
|
|
22600
22632
|
init_common();
|
|
22633
|
+
await init_self_config();
|
|
22634
|
+
await init_spawn_subagent();
|
|
22601
22635
|
init_visuals2();
|
|
22602
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();
|
|
22603
22648
|
init_runtime_spec();
|
|
22604
22649
|
init_file_events();
|
|
22605
22650
|
init_text_extractor();
|
|
@@ -22611,56 +22656,37 @@ var init_src = __esm(async () => {
|
|
|
22611
22656
|
init_log_rotation();
|
|
22612
22657
|
init_logger();
|
|
22613
22658
|
init_mcp_config();
|
|
22659
|
+
await init_modules();
|
|
22614
22660
|
init_node_plugins();
|
|
22661
|
+
await init_manager2();
|
|
22662
|
+
await init_active_rooms();
|
|
22615
22663
|
init_session_inbox_path();
|
|
22616
22664
|
init_types2();
|
|
22665
|
+
await init_ask_callbacks();
|
|
22617
22666
|
init_attachments();
|
|
22667
|
+
await init_background_sessions();
|
|
22668
|
+
await init_bashrs_completions();
|
|
22669
|
+
await init_delivery_ack();
|
|
22618
22670
|
init_file_hooks();
|
|
22671
|
+
await init_inbox();
|
|
22672
|
+
await init_turn_runner();
|
|
22619
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();
|
|
22620
22689
|
init_types();
|
|
22621
|
-
await __promiseAll([
|
|
22622
|
-
init_auth_check(),
|
|
22623
|
-
init_fork(),
|
|
22624
|
-
init_agents(),
|
|
22625
|
-
init_ask_user(),
|
|
22626
|
-
init_self_config(),
|
|
22627
|
-
init_spawn_subagent(),
|
|
22628
|
-
init_registry(),
|
|
22629
|
-
init_topic_cleanup(),
|
|
22630
|
-
init_execute_external_user_turn(),
|
|
22631
|
-
init_submit_runtime_gateway_turn(),
|
|
22632
|
-
init_submit_user_message(),
|
|
22633
|
-
init_switch_topic_access_mode(),
|
|
22634
|
-
init_switch_topic_effort(),
|
|
22635
|
-
init_switch_topic_model(),
|
|
22636
|
-
init_topic_service(),
|
|
22637
|
-
init_vault_command(),
|
|
22638
|
-
init_bus(),
|
|
22639
|
-
init_modules(),
|
|
22640
|
-
init_manager2(),
|
|
22641
|
-
init_active_rooms(),
|
|
22642
|
-
init_ask_callbacks(),
|
|
22643
|
-
init_background_sessions(),
|
|
22644
|
-
init_bashrs_completions(),
|
|
22645
|
-
init_delivery_ack(),
|
|
22646
|
-
init_inbox(),
|
|
22647
|
-
init_turn_runner(),
|
|
22648
|
-
init_api_messages(),
|
|
22649
|
-
init_api_topic_config(),
|
|
22650
|
-
init_api_topics(),
|
|
22651
|
-
init_app_settings(),
|
|
22652
|
-
init_forum_db(),
|
|
22653
|
-
init_runtime_events(),
|
|
22654
|
-
init_runtime_leases(),
|
|
22655
|
-
init_runtime_process_leases(),
|
|
22656
|
-
init_session_asks(),
|
|
22657
|
-
init_vault(),
|
|
22658
|
-
init_create(),
|
|
22659
|
-
init_derive(),
|
|
22660
|
-
init_lifecycle(),
|
|
22661
|
-
init_personal_general(),
|
|
22662
|
-
init_session()
|
|
22663
|
-
]);
|
|
22664
22690
|
init_types();
|
|
22665
22691
|
});
|
|
22666
22692
|
|
|
@@ -22769,13 +22795,11 @@ function migrateLegacyCompactedConversations() {
|
|
|
22769
22795
|
var COMPACT_CONTEXT_MARKER2 = "[Negotium compacted context]", MIGRATION_NAME = "raw-active-v1";
|
|
22770
22796
|
var init_conversation_migration = __esm(async () => {
|
|
22771
22797
|
init_logger();
|
|
22798
|
+
await init_api_messages();
|
|
22799
|
+
await init_api_topics();
|
|
22800
|
+
await init_conversations();
|
|
22801
|
+
await init_storage_host();
|
|
22772
22802
|
init_types();
|
|
22773
|
-
await __promiseAll([
|
|
22774
|
-
init_api_messages(),
|
|
22775
|
-
init_api_topics(),
|
|
22776
|
-
init_conversations(),
|
|
22777
|
-
init_storage_host()
|
|
22778
|
-
]);
|
|
22779
22803
|
});
|
|
22780
22804
|
|
|
22781
22805
|
// ../../packages/core/src/node-host.ts
|
|
@@ -22845,41 +22869,39 @@ __export(exports_node_host, {
|
|
|
22845
22869
|
});
|
|
22846
22870
|
var init_node_host = __esm(async () => {
|
|
22847
22871
|
init_codex_tree_kill();
|
|
22872
|
+
await init_ask_user();
|
|
22873
|
+
await init_spawn_subagent();
|
|
22874
|
+
await init_submit_runtime_gateway_turn();
|
|
22875
|
+
await init_submit_user_message();
|
|
22876
|
+
await init_switch_topic_access_mode();
|
|
22877
|
+
await init_switch_topic_effort();
|
|
22878
|
+
await init_switch_topic_model();
|
|
22879
|
+
await init_topic_service();
|
|
22880
|
+
await init_vault_command();
|
|
22881
|
+
await init_bus();
|
|
22848
22882
|
init_runtime_spec();
|
|
22849
22883
|
init_manager();
|
|
22850
22884
|
init_config();
|
|
22851
22885
|
init_lifecycle2();
|
|
22852
22886
|
init_logger();
|
|
22853
22887
|
init_mcp_config();
|
|
22888
|
+
await init_modules();
|
|
22854
22889
|
init_node_plugins();
|
|
22890
|
+
await init_manager2();
|
|
22891
|
+
await init_active_rooms();
|
|
22892
|
+
await init_background_sessions();
|
|
22893
|
+
await init_bashrs_completions();
|
|
22855
22894
|
init_file_hooks();
|
|
22856
|
-
await
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
init_bus(),
|
|
22867
|
-
init_modules(),
|
|
22868
|
-
init_manager2(),
|
|
22869
|
-
init_active_rooms(),
|
|
22870
|
-
init_background_sessions(),
|
|
22871
|
-
init_bashrs_completions(),
|
|
22872
|
-
init_inbox(),
|
|
22873
|
-
init_turn_runner(),
|
|
22874
|
-
init_api_messages(),
|
|
22875
|
-
init_api_topics(),
|
|
22876
|
-
init_runtime_events(),
|
|
22877
|
-
init_runtime_process_leases(),
|
|
22878
|
-
init_token_stats(),
|
|
22879
|
-
init_derive(),
|
|
22880
|
-
init_personal_general(),
|
|
22881
|
-
init_session()
|
|
22882
|
-
]);
|
|
22895
|
+
await init_inbox();
|
|
22896
|
+
await init_turn_runner();
|
|
22897
|
+
await init_api_messages();
|
|
22898
|
+
await init_api_topics();
|
|
22899
|
+
await init_runtime_events();
|
|
22900
|
+
await init_runtime_process_leases();
|
|
22901
|
+
await init_token_stats();
|
|
22902
|
+
await init_derive();
|
|
22903
|
+
await init_personal_general();
|
|
22904
|
+
await init_session();
|
|
22883
22905
|
});
|
|
22884
22906
|
|
|
22885
22907
|
// ../../packages/core/src/agents/mcp-tools/inline-assets.ts
|
|
@@ -23183,34 +23205,32 @@ __export(exports_mcp_runtime_host, {
|
|
|
23183
23205
|
EFFORT_VALUES: () => EFFORT_VALUES
|
|
23184
23206
|
});
|
|
23185
23207
|
var init_mcp_runtime_host = __esm(async () => {
|
|
23208
|
+
await init_ask_user();
|
|
23186
23209
|
init_common();
|
|
23187
23210
|
init_publish_html();
|
|
23211
|
+
await init_self_config();
|
|
23212
|
+
await init_spawn_subagent();
|
|
23188
23213
|
init_visuals2();
|
|
23214
|
+
await init_bus();
|
|
23189
23215
|
init_runtime_spec();
|
|
23190
23216
|
init_config();
|
|
23191
23217
|
init_constants();
|
|
23192
23218
|
init_jsonl();
|
|
23193
23219
|
init_logger();
|
|
23194
23220
|
init_mcp_config();
|
|
23221
|
+
await init_active_rooms();
|
|
23195
23222
|
init_session_inbox_path();
|
|
23223
|
+
await init_delivery_ack();
|
|
23196
23224
|
init_file_hooks();
|
|
23197
23225
|
init_sensitive_path();
|
|
23226
|
+
await init_api_messages();
|
|
23227
|
+
await init_api_topic_config();
|
|
23228
|
+
await init_api_topics();
|
|
23229
|
+
await init_create();
|
|
23230
|
+
await init_derive();
|
|
23231
|
+
await init_lifecycle();
|
|
23232
|
+
await init_session();
|
|
23198
23233
|
init_types();
|
|
23199
|
-
await __promiseAll([
|
|
23200
|
-
init_ask_user(),
|
|
23201
|
-
init_self_config(),
|
|
23202
|
-
init_spawn_subagent(),
|
|
23203
|
-
init_bus(),
|
|
23204
|
-
init_active_rooms(),
|
|
23205
|
-
init_delivery_ack(),
|
|
23206
|
-
init_api_messages(),
|
|
23207
|
-
init_api_topic_config(),
|
|
23208
|
-
init_api_topics(),
|
|
23209
|
-
init_create(),
|
|
23210
|
-
init_derive(),
|
|
23211
|
-
init_lifecycle(),
|
|
23212
|
-
init_session()
|
|
23213
|
-
]);
|
|
23214
23234
|
});
|
|
23215
23235
|
|
|
23216
23236
|
// ../../packages/mcp/src/node-tools.ts
|
|
@@ -23482,8 +23502,8 @@ ${renderTaskList(tasks2)}`);
|
|
|
23482
23502
|
}
|
|
23483
23503
|
var defaultTaskMcpHost;
|
|
23484
23504
|
var init_task = __esm(async () => {
|
|
23485
|
-
init_mcp_helpers();
|
|
23486
23505
|
await init_tasks();
|
|
23506
|
+
init_mcp_helpers();
|
|
23487
23507
|
defaultTaskMcpHost = {
|
|
23488
23508
|
readTasks,
|
|
23489
23509
|
writeTasks
|
|
@@ -24024,11 +24044,11 @@ ${lines.join(`
|
|
|
24024
24044
|
var AGENTS, MAX_CONCURRENT_CHECKS = 2, activeChecks = 0, checkWaiters, activeCheckAllUsers;
|
|
24025
24045
|
var init_agent_health = __esm(async () => {
|
|
24026
24046
|
init_claude_registry();
|
|
24047
|
+
await init_codex_registry();
|
|
24027
24048
|
init_maestro_registry();
|
|
24028
24049
|
init_config();
|
|
24029
24050
|
init_jsonl();
|
|
24030
24051
|
init_mcp_helpers();
|
|
24031
|
-
await init_codex_registry();
|
|
24032
24052
|
AGENTS = [
|
|
24033
24053
|
{ kind: "claude", registry: claudeRegistry, checker: checkClaude },
|
|
24034
24054
|
{ kind: "codex", registry: codexRegistry, checker: checkCodex },
|
|
@@ -24065,10 +24085,8 @@ function canSubagentTellTargetByName(identity, target) {
|
|
|
24065
24085
|
return canSubagentTellTarget(identity, resolved.id);
|
|
24066
24086
|
}
|
|
24067
24087
|
var init_tell_permissions = __esm(async () => {
|
|
24068
|
-
await
|
|
24069
|
-
|
|
24070
|
-
init_api_topics()
|
|
24071
|
-
]);
|
|
24088
|
+
await init_spawn_subagent();
|
|
24089
|
+
await init_api_topics();
|
|
24072
24090
|
});
|
|
24073
24091
|
|
|
24074
24092
|
// ../../packages/core/src/mcp/factories/session-comm.ts
|
|
@@ -24223,10 +24241,8 @@ async function deleteManagedBrowserProfile(ownerId, rawProfile) {
|
|
|
24223
24241
|
};
|
|
24224
24242
|
}
|
|
24225
24243
|
var init_profile_management = __esm(async () => {
|
|
24226
|
-
await
|
|
24227
|
-
|
|
24228
|
-
init_browser_profiles()
|
|
24229
|
-
]);
|
|
24244
|
+
await init_manager2();
|
|
24245
|
+
await init_browser_profiles();
|
|
24230
24246
|
});
|
|
24231
24247
|
|
|
24232
24248
|
// ../../packages/core/src/mcp/session-comm/default-host.ts
|
|
@@ -24556,20 +24572,18 @@ ${entries.join(`
|
|
|
24556
24572
|
}
|
|
24557
24573
|
var MAX_MESSAGE_LENGTH = 1e4;
|
|
24558
24574
|
var init_default_host = __esm(async () => {
|
|
24575
|
+
await init_tell_permissions();
|
|
24559
24576
|
init_config();
|
|
24560
24577
|
init_jsonl();
|
|
24561
24578
|
init_mcp_config();
|
|
24579
|
+
await init_manager2();
|
|
24580
|
+
await init_profile_management();
|
|
24562
24581
|
init_session_inbox_path();
|
|
24582
|
+
await init_api_topic_config();
|
|
24583
|
+
await init_api_topics();
|
|
24584
|
+
await init_browser_profiles();
|
|
24585
|
+
await init_session_asks();
|
|
24563
24586
|
init_types();
|
|
24564
|
-
await __promiseAll([
|
|
24565
|
-
init_tell_permissions(),
|
|
24566
|
-
init_manager2(),
|
|
24567
|
-
init_profile_management(),
|
|
24568
|
-
init_api_topic_config(),
|
|
24569
|
-
init_api_topics(),
|
|
24570
|
-
init_browser_profiles(),
|
|
24571
|
-
init_session_asks()
|
|
24572
|
-
]);
|
|
24573
24587
|
});
|
|
24574
24588
|
|
|
24575
24589
|
// ../../packages/core/src/mcp/vault-http.ts
|
|
@@ -26581,9 +26595,9 @@ function createWikiMcpServer(context, host2) {
|
|
|
26581
26595
|
}
|
|
26582
26596
|
var wikiRuntime, FILE_LOCK_WAIT_MS = 10, FILE_LOCK_TIMEOUT_MS = 5000, FILE_LOCK_STALE_MS = 30000, lockWaitArray, SEARCH_STOP_WORDS, SEARCH_MONTHS, SEARCH_RECENCY_TERMS, WIKI_SEARCH_INDEX_FILENAME = ".wiki-search-index.sqlite", WIKI_INDEX_FILENAMES, WIKI_INDEX_NAMESPACES, MAX_INDEX_DESCRIPTION_LENGTH = 400, SEARCH_CACHE_SKIPPED_NOTE = "Body-search cache was not updated; catalog retrieval still works. Run wiki_reindex to refill it.", WIKI_TOOLS, SKILL_TOOLS;
|
|
26583
26597
|
var init_wiki_server = __esm(async () => {
|
|
26598
|
+
await init_wiki_search_index();
|
|
26584
26599
|
init_config();
|
|
26585
26600
|
init_wiki_summary_names();
|
|
26586
|
-
await init_wiki_search_index();
|
|
26587
26601
|
wikiRuntime = new AsyncLocalStorage3;
|
|
26588
26602
|
lockWaitArray = new Int32Array(new SharedArrayBuffer(4));
|
|
26589
26603
|
SEARCH_STOP_WORDS = new Set([
|
|
@@ -27188,11 +27202,9 @@ function flushSessionCache() {
|
|
|
27188
27202
|
}
|
|
27189
27203
|
var init_schema = __esm(async () => {
|
|
27190
27204
|
init_logger();
|
|
27205
|
+
await init_forum_db();
|
|
27206
|
+
await init_storage_host();
|
|
27191
27207
|
init_types();
|
|
27192
|
-
await __promiseAll([
|
|
27193
|
-
init_forum_db(),
|
|
27194
|
-
init_storage_host()
|
|
27195
|
-
]);
|
|
27196
27208
|
registerStorageSchemaInitializer(initializeForumSchema, 10);
|
|
27197
27209
|
});
|
|
27198
27210
|
|
|
@@ -27409,9 +27421,9 @@ __export(exports_forum, {
|
|
|
27409
27421
|
addTopic: () => addTopic
|
|
27410
27422
|
});
|
|
27411
27423
|
var init_forum = __esm(async () => {
|
|
27412
|
-
await init_schema();
|
|
27413
27424
|
init_agent_settings();
|
|
27414
27425
|
init_repository();
|
|
27426
|
+
await init_schema();
|
|
27415
27427
|
});
|
|
27416
27428
|
|
|
27417
27429
|
// ../../packages/core/src/storage/storage-public-host.ts
|
|
@@ -27461,8 +27473,8 @@ function setTopicAgentAndClearSession(opts) {
|
|
|
27461
27473
|
return changed;
|
|
27462
27474
|
}
|
|
27463
27475
|
var init_topic_settings = __esm(async () => {
|
|
27464
|
-
init_types();
|
|
27465
27476
|
await init_forum_db();
|
|
27477
|
+
init_types();
|
|
27466
27478
|
});
|
|
27467
27479
|
|
|
27468
27480
|
// ../../packages/core/src/storage/storage-public.ts
|
|
@@ -27509,6 +27521,7 @@ __export(exports_storage_public, {
|
|
|
27509
27521
|
setTopicAgentAndSession: () => setTopicAgentAndSession,
|
|
27510
27522
|
setTopicAgentAndClearSession: () => setTopicAgentAndClearSession,
|
|
27511
27523
|
setTopicAgent: () => setTopicAgent,
|
|
27524
|
+
setTopicAccessModes: () => setTopicAccessModes,
|
|
27512
27525
|
setSessionForTopic: () => setSessionForTopic,
|
|
27513
27526
|
setLastShownConfig: () => setLastShownConfig,
|
|
27514
27527
|
setGlobalAiName: () => setGlobalAiName,
|
|
@@ -27664,45 +27677,43 @@ __export(exports_storage_public, {
|
|
|
27664
27677
|
ConversationLogDivergedError: () => ConversationLogDivergedError
|
|
27665
27678
|
});
|
|
27666
27679
|
var init_storage_public = __esm(async () => {
|
|
27667
|
-
|
|
27668
|
-
await __promiseAll([
|
|
27669
|
-
init_activity_log(),
|
|
27670
|
-
init_api_messages(),
|
|
27671
|
-
init_api_topic_brief(),
|
|
27672
|
-
init_api_topic_config(),
|
|
27673
|
-
init_api_topics(),
|
|
27674
|
-
init_app_settings(),
|
|
27675
|
-
init_ask_user_gates(),
|
|
27676
|
-
init_conversations(),
|
|
27677
|
-
init_forum(),
|
|
27678
|
-
init_forum(),
|
|
27679
|
-
init_runtime_process_leases(),
|
|
27680
|
-
init_session_asks(),
|
|
27681
|
-
init_storage_public_host(),
|
|
27682
|
-
init_tasks(),
|
|
27683
|
-
init_token_stats(),
|
|
27684
|
-
init_topic_archive(),
|
|
27685
|
-
init_topic_archive_state(),
|
|
27686
|
-
init_topic_settings(),
|
|
27687
|
-
init_wiki()
|
|
27688
|
-
]);
|
|
27680
|
+
await init_activity_log();
|
|
27689
27681
|
init_activity_log();
|
|
27682
|
+
await init_api_messages();
|
|
27690
27683
|
init_api_messages();
|
|
27684
|
+
await init_api_topic_brief();
|
|
27691
27685
|
init_api_topic_brief();
|
|
27686
|
+
await init_api_topic_config();
|
|
27692
27687
|
init_api_topic_config();
|
|
27688
|
+
await init_api_topics();
|
|
27693
27689
|
init_api_topics();
|
|
27690
|
+
await init_app_settings();
|
|
27694
27691
|
init_app_settings();
|
|
27692
|
+
await init_ask_user_gates();
|
|
27695
27693
|
init_ask_user_gates();
|
|
27694
|
+
await init_conversations();
|
|
27696
27695
|
init_conversations();
|
|
27696
|
+
await init_forum();
|
|
27697
|
+
await init_forum();
|
|
27698
|
+
await init_runtime_process_leases();
|
|
27697
27699
|
init_runtime_process_leases();
|
|
27700
|
+
await init_session_asks();
|
|
27698
27701
|
init_session_asks();
|
|
27702
|
+
await init_storage_public_host();
|
|
27703
|
+
await init_tasks();
|
|
27699
27704
|
init_tasks();
|
|
27705
|
+
await init_token_stats();
|
|
27700
27706
|
init_token_stats();
|
|
27707
|
+
await init_topic_archive();
|
|
27701
27708
|
init_topic_archive();
|
|
27709
|
+
await init_topic_archive_state();
|
|
27702
27710
|
init_topic_archive_state();
|
|
27711
|
+
await init_topic_settings();
|
|
27703
27712
|
init_topic_settings();
|
|
27713
|
+
await init_wiki();
|
|
27704
27714
|
init_wiki();
|
|
27705
27715
|
init_wiki_summary_names();
|
|
27716
|
+
init_wiki_summary_names();
|
|
27706
27717
|
});
|
|
27707
27718
|
|
|
27708
27719
|
// ../../packages/mcp/src/hosted-surfaces.ts
|
|
@@ -28406,12 +28417,10 @@ async function handleNegotiumMcpRequest(req) {
|
|
|
28406
28417
|
}
|
|
28407
28418
|
var SSE_PATH, SSE_MESSAGE_PATH, STREAMABLE_PATH, FILE_DELIVERY_ACK_TIMEOUT_MS = 30000, FILE_DELIVERY_CLAIM_TIMEOUT_MS = 500, MCP_SESSION_IDLE_MS, MCP_SESSION_MAX_LIFETIME_MS, MAX_MCP_SESSIONS = 256, sseSessions, streamableSessions, closingServers;
|
|
28408
28419
|
var init_server = __esm(async () => {
|
|
28420
|
+
await init_mcp_runtime_host();
|
|
28409
28421
|
init_hosted_surfaces();
|
|
28422
|
+
await init_node_tools();
|
|
28410
28423
|
init_sse_transport();
|
|
28411
|
-
await __promiseAll([
|
|
28412
|
-
init_mcp_runtime_host(),
|
|
28413
|
-
init_node_tools()
|
|
28414
|
-
]);
|
|
28415
28424
|
SSE_PATH = `${RUNTIME_MCP_BASE_PATH}/sse`;
|
|
28416
28425
|
SSE_MESSAGE_PATH = `${RUNTIME_MCP_BASE_PATH}/message`;
|
|
28417
28426
|
STREAMABLE_PATH = `${RUNTIME_MCP_BASE_PATH}/mcp`;
|
|
@@ -28424,12 +28433,10 @@ var init_server = __esm(async () => {
|
|
|
28424
28433
|
|
|
28425
28434
|
// ../../packages/mcp/src/index.ts
|
|
28426
28435
|
var init_src2 = __esm(async () => {
|
|
28436
|
+
await init_mcp_runtime_host();
|
|
28437
|
+
await init_node_tools();
|
|
28438
|
+
await init_server();
|
|
28427
28439
|
init_sse_transport();
|
|
28428
|
-
await __promiseAll([
|
|
28429
|
-
init_mcp_runtime_host(),
|
|
28430
|
-
init_node_tools(),
|
|
28431
|
-
init_server()
|
|
28432
|
-
]);
|
|
28433
28440
|
});
|
|
28434
28441
|
|
|
28435
28442
|
// ../../packages/mcp-host/src/paths.ts
|
|
@@ -29899,10 +29906,8 @@ async function stopNodeDaemon(timeoutMs = 3000) {
|
|
|
29899
29906
|
}
|
|
29900
29907
|
var NODE_CONTROL_PROTOCOL_VERSION = 1, NODE_CONTROL_BASE_PATH = "/api/v1/control", NODE_RUNTIME_CONTRACT_VERSION = 1, NODE_RUNTIME_CONTRACT_BASE_PATH, NODE_DAEMON_ROLE = "node-daemon", NODE_DAEMON_INFO_PATH, NODE_VERSION, ControlRequestError;
|
|
29901
29908
|
var init_control = __esm(async () => {
|
|
29902
|
-
await
|
|
29903
|
-
|
|
29904
|
-
init_files()
|
|
29905
|
-
]);
|
|
29909
|
+
await init_node_host();
|
|
29910
|
+
await init_files();
|
|
29906
29911
|
NODE_RUNTIME_CONTRACT_BASE_PATH = `${NODE_CONTROL_BASE_PATH}/runtime/v1`;
|
|
29907
29912
|
NODE_DAEMON_INFO_PATH = resolve21(RUN_DIR, "node-daemon.json");
|
|
29908
29913
|
NODE_VERSION = NEGOTIUM_VERSION;
|
|
@@ -29922,21 +29927,19 @@ function runSingletonStartupMaintenance(maintenance) {
|
|
|
29922
29927
|
|
|
29923
29928
|
// ../../packages/core/src/cron-host.ts
|
|
29924
29929
|
var init_cron_host = __esm(async () => {
|
|
29930
|
+
await init_topic_cleanup();
|
|
29931
|
+
await init_bus();
|
|
29925
29932
|
init_config();
|
|
29926
29933
|
init_logger();
|
|
29927
29934
|
init_mcp_config();
|
|
29928
|
-
await
|
|
29929
|
-
|
|
29930
|
-
|
|
29931
|
-
|
|
29932
|
-
|
|
29933
|
-
|
|
29934
|
-
|
|
29935
|
-
|
|
29936
|
-
init_forum_db(),
|
|
29937
|
-
init_runtime_leases(),
|
|
29938
|
-
init_derive()
|
|
29939
|
-
]);
|
|
29935
|
+
await init_active_rooms();
|
|
29936
|
+
await init_background_sessions();
|
|
29937
|
+
await init_turn_runner();
|
|
29938
|
+
await init_api_messages();
|
|
29939
|
+
await init_api_topics();
|
|
29940
|
+
await init_forum_db();
|
|
29941
|
+
await init_runtime_leases();
|
|
29942
|
+
await init_derive();
|
|
29940
29943
|
});
|
|
29941
29944
|
|
|
29942
29945
|
// ../../packages/module-cron/src/schedule.ts
|
|
@@ -30823,11 +30826,9 @@ function finalizeOrphanedCronRuns(now = new Date) {
|
|
|
30823
30826
|
}
|
|
30824
30827
|
var schemaReady = false, db3;
|
|
30825
30828
|
var init_store = __esm(async () => {
|
|
30829
|
+
await init_cron_host();
|
|
30826
30830
|
init_schedule();
|
|
30827
|
-
await
|
|
30828
|
-
init_cron_host(),
|
|
30829
|
-
init_scripts()
|
|
30830
|
-
]);
|
|
30831
|
+
await init_scripts();
|
|
30831
30832
|
db3 = db;
|
|
30832
30833
|
});
|
|
30833
30834
|
|
|
@@ -30899,10 +30900,8 @@ function listCronBackgroundSessions(userId) {
|
|
|
30899
30900
|
});
|
|
30900
30901
|
}
|
|
30901
30902
|
var init_background_sessions2 = __esm(async () => {
|
|
30902
|
-
await
|
|
30903
|
-
|
|
30904
|
-
init_store()
|
|
30905
|
-
]);
|
|
30903
|
+
await init_cron_host();
|
|
30904
|
+
await init_store();
|
|
30906
30905
|
});
|
|
30907
30906
|
|
|
30908
30907
|
// ../../packages/module-cron/src/host.ts
|
|
@@ -31014,11 +31013,9 @@ async function rotateCronTopicContext(topicId, retainTurns = CRON_CONTEXT_RETAIN
|
|
|
31014
31013
|
}
|
|
31015
31014
|
var CRON_CONTEXT_ROTATE_EVERY = 5, CRON_CONTEXT_RETAIN_TURNS = 5;
|
|
31016
31015
|
var init_context2 = __esm(async () => {
|
|
31017
|
-
await
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
init_store()
|
|
31021
|
-
]);
|
|
31016
|
+
await init_cron_host();
|
|
31017
|
+
await init_host();
|
|
31018
|
+
await init_store();
|
|
31022
31019
|
});
|
|
31023
31020
|
|
|
31024
31021
|
// ../../packages/module-cron/src/scheduler.ts
|
|
@@ -31353,12 +31350,10 @@ class CronScheduler {
|
|
|
31353
31350
|
}
|
|
31354
31351
|
var DEFAULT_POLL_INTERVAL_MS = 1000, DEFAULT_RUN_TIMEOUT_MS, DEFAULT_QUEUE_TIMEOUT_MS;
|
|
31355
31352
|
var init_scheduler = __esm(async () => {
|
|
31356
|
-
await
|
|
31357
|
-
|
|
31358
|
-
|
|
31359
|
-
|
|
31360
|
-
init_store()
|
|
31361
|
-
]);
|
|
31353
|
+
await init_cron_host();
|
|
31354
|
+
await init_context2();
|
|
31355
|
+
await init_host();
|
|
31356
|
+
await init_store();
|
|
31362
31357
|
DEFAULT_RUN_TIMEOUT_MS = 10 * 60000;
|
|
31363
31358
|
DEFAULT_QUEUE_TIMEOUT_MS = 5 * 60000;
|
|
31364
31359
|
});
|
|
@@ -31481,15 +31476,13 @@ function createCronModule(options = {}) {
|
|
|
31481
31476
|
}
|
|
31482
31477
|
var SOURCE_MCP_SERVER_FILE, PACKAGED_MCP_SERVER_FILE;
|
|
31483
31478
|
var init_module = __esm(async () => {
|
|
31484
|
-
await
|
|
31485
|
-
|
|
31486
|
-
|
|
31487
|
-
|
|
31488
|
-
|
|
31489
|
-
|
|
31490
|
-
|
|
31491
|
-
init_store()
|
|
31492
|
-
]);
|
|
31479
|
+
await init_cron_host();
|
|
31480
|
+
await init_background_sessions2();
|
|
31481
|
+
await init_context2();
|
|
31482
|
+
await init_host();
|
|
31483
|
+
await init_scheduler();
|
|
31484
|
+
await init_scripts();
|
|
31485
|
+
await init_store();
|
|
31493
31486
|
SOURCE_MCP_SERVER_FILE = fileURLToPath2(new URL("./mcp-server.ts", import.meta.url));
|
|
31494
31487
|
PACKAGED_MCP_SERVER_FILE = fileURLToPath2(new URL("./runtime/cron/mcp-server.ts", import.meta.url));
|
|
31495
31488
|
});
|
|
@@ -31577,10 +31570,8 @@ function queueCronPromptSummary(jobId, prompt, summarize = summarizeCronPrompt)
|
|
|
31577
31570
|
}
|
|
31578
31571
|
var DEFAULT_URL = "https://api.deepseek.com/v1/chat/completions", DEFAULT_MODEL = "deepseek-chat", MAX_SUMMARY_LENGTH = 60, MAX_CONCURRENT_SUMMARIES = 3, generations, pending, active = 0, nextGeneration = 0;
|
|
31579
31572
|
var init_summarize = __esm(async () => {
|
|
31580
|
-
await
|
|
31581
|
-
|
|
31582
|
-
init_store()
|
|
31583
|
-
]);
|
|
31573
|
+
await init_cron_host();
|
|
31574
|
+
await init_store();
|
|
31584
31575
|
generations = new Map;
|
|
31585
31576
|
pending = [];
|
|
31586
31577
|
});
|
|
@@ -31650,17 +31641,15 @@ __export(exports_src2, {
|
|
|
31650
31641
|
CRON_CONTEXT_RETAIN_TURNS: () => CRON_CONTEXT_RETAIN_TURNS
|
|
31651
31642
|
});
|
|
31652
31643
|
var init_src4 = __esm(async () => {
|
|
31644
|
+
await init_background_sessions2();
|
|
31645
|
+
await init_context2();
|
|
31646
|
+
await init_host();
|
|
31647
|
+
await init_module();
|
|
31653
31648
|
init_schedule();
|
|
31654
|
-
await
|
|
31655
|
-
|
|
31656
|
-
|
|
31657
|
-
|
|
31658
|
-
init_module(),
|
|
31659
|
-
init_scheduler(),
|
|
31660
|
-
init_scripts(),
|
|
31661
|
-
init_store(),
|
|
31662
|
-
init_summarize()
|
|
31663
|
-
]);
|
|
31649
|
+
await init_scheduler();
|
|
31650
|
+
await init_scripts();
|
|
31651
|
+
await init_store();
|
|
31652
|
+
await init_summarize();
|
|
31664
31653
|
});
|
|
31665
31654
|
|
|
31666
31655
|
// ../../packages/node/src/index.ts
|
|
@@ -31917,16 +31906,14 @@ async function runNodeDaemon(opts = {}) {
|
|
|
31917
31906
|
process.exit(0);
|
|
31918
31907
|
}
|
|
31919
31908
|
var init_src5 = __esm(async () => {
|
|
31909
|
+
await init_conversation_migration();
|
|
31910
|
+
await init_node_host();
|
|
31911
|
+
await init_src2();
|
|
31920
31912
|
init_src3();
|
|
31921
|
-
await
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
init_control(),
|
|
31926
|
-
init_files(),
|
|
31927
|
-
init_control(),
|
|
31928
|
-
init_files()
|
|
31929
|
-
]);
|
|
31913
|
+
await init_control();
|
|
31914
|
+
await init_files();
|
|
31915
|
+
await init_control();
|
|
31916
|
+
await init_files();
|
|
31930
31917
|
});
|
|
31931
31918
|
|
|
31932
31919
|
// ../../packages/adapter-sdk/src/index.ts
|
|
@@ -32474,7 +32461,7 @@ function setTopics(state, topics, preferredTitle) {
|
|
|
32474
32461
|
activeTopicId: nextActive,
|
|
32475
32462
|
scrollOffset: nextActive === state.activeTopicId ? state.scrollOffset : 0,
|
|
32476
32463
|
askChoiceIndex: nextActive === state.activeTopicId ? state.askChoiceIndex : 0,
|
|
32477
|
-
topicPickerIndex: state.overlay === "topics" ? pickedTopicIndex : Math.max(0, orderedTopics.findIndex((topic) => topic.id === nextActive)),
|
|
32464
|
+
topicPickerIndex: state.overlay === "topics" || state.overlay === "confirm-share" ? pickedTopicIndex : Math.max(0, orderedTopics.findIndex((topic) => topic.id === nextActive)),
|
|
32478
32465
|
topicPickerBackgroundId: state.topicPickerBackgroundId
|
|
32479
32466
|
});
|
|
32480
32467
|
}
|
|
@@ -32828,8 +32815,8 @@ function applyRuntimeEvent(state, event) {
|
|
|
32828
32815
|
}
|
|
32829
32816
|
var NO_TOPIC_PICKER_SELECTION = -1;
|
|
32830
32817
|
var init_state2 = __esm(async () => {
|
|
32831
|
-
init_subagent_graph();
|
|
32832
32818
|
await init_src();
|
|
32819
|
+
init_subagent_graph();
|
|
32833
32820
|
});
|
|
32834
32821
|
|
|
32835
32822
|
// ../../adapters/terminal/src/context-usage.ts
|
|
@@ -32885,10 +32872,8 @@ function activeContextBreakdown(state) {
|
|
|
32885
32872
|
};
|
|
32886
32873
|
}
|
|
32887
32874
|
var init_context_usage = __esm(async () => {
|
|
32888
|
-
await
|
|
32889
|
-
|
|
32890
|
-
init_state2()
|
|
32891
|
-
]);
|
|
32875
|
+
await init_src();
|
|
32876
|
+
await init_state2();
|
|
32892
32877
|
});
|
|
32893
32878
|
|
|
32894
32879
|
// ../../adapters/terminal/src/path-suggest.ts
|
|
@@ -34136,14 +34121,16 @@ function subagentTreePrefix(topic, topics, rootTopicId) {
|
|
|
34136
34121
|
function topicPickerHints(topicPickerRoot) {
|
|
34137
34122
|
const exit = topicPickerRoot ? "Esc/Ctrl-C exit" : "Esc close \xB7 Ctrl-C exit; work continues";
|
|
34138
34123
|
const shortExit = topicPickerRoot ? "Esc/Ctrl-C exit" : "Esc close";
|
|
34139
|
-
|
|
34124
|
+
const candidates = [
|
|
34125
|
+
`\u2191\u2193 select \xB7 Enter open \xB7 type to filter \xB7 Ctrl-N new \xB7 Ctrl-D delete \xB7 Ctrl-P public/private \xB7 ${exit}`,
|
|
34126
|
+
`\u2191\u2193 select \xB7 Enter open \xB7 type to filter \xB7 Ctrl-N new \xB7 Ctrl-D delete \xB7 Ctrl-P public/private \xB7 ${shortExit}`,
|
|
34140
34127
|
`\u2191\u2193 select \xB7 Enter open \xB7 type to filter \xB7 Ctrl-N new \xB7 Ctrl-D delete \xB7 ${exit}`,
|
|
34141
|
-
`\u2191\u2193 select \xB7 Enter open \xB7 type to filter \xB7 Ctrl-N
|
|
34142
|
-
|
|
34143
|
-
"
|
|
34144
|
-
"
|
|
34145
|
-
"Ctrl-N/D"
|
|
34128
|
+
`\u2191\u2193 select \xB7 Enter open \xB7 type to filter \xB7 Ctrl-N/D/P \xB7 ${shortExit}`,
|
|
34129
|
+
"\u2191\u2193 \xB7 Enter \xB7 type to filter \xB7 Ctrl-N/D/P",
|
|
34130
|
+
"type to filter \xB7 Ctrl-N/D/P",
|
|
34131
|
+
"Ctrl-N/D/P"
|
|
34146
34132
|
];
|
|
34133
|
+
return [...new Set(candidates)].sort((a, b) => displayWidth(b) - displayWidth(a));
|
|
34147
34134
|
}
|
|
34148
34135
|
function topicOverlayCursor(state, width, bodyHeight) {
|
|
34149
34136
|
if (state.overlay !== "topics")
|
|
@@ -34499,6 +34486,34 @@ function conversationLines(state, width, height, animationFrame = 0, nowMs = ter
|
|
|
34499
34486
|
line(" Press y to delete or n to cancel.", { fg: theme.amber })
|
|
34500
34487
|
].slice(0, height);
|
|
34501
34488
|
}
|
|
34489
|
+
if (state.overlay === "confirm-share") {
|
|
34490
|
+
const topic = state.topics.find((candidate) => candidate.id === state.pendingShareTopicId);
|
|
34491
|
+
const subagents = (() => {
|
|
34492
|
+
if (!topic)
|
|
34493
|
+
return 0;
|
|
34494
|
+
const reached = new Set([topic.id]);
|
|
34495
|
+
for (;; ) {
|
|
34496
|
+
const next = state.topics.filter((candidate) => candidate.isSubagent && !reached.has(candidate.id) && candidate.parentTopicId !== undefined && reached.has(candidate.parentTopicId));
|
|
34497
|
+
if (next.length === 0)
|
|
34498
|
+
break;
|
|
34499
|
+
for (const candidate of next)
|
|
34500
|
+
reached.add(candidate.id);
|
|
34501
|
+
}
|
|
34502
|
+
return reached.size - 1;
|
|
34503
|
+
})();
|
|
34504
|
+
const scope = subagents > 0 ? ` Its ${subagents} subagent room${subagents === 1 ? "" : "s"} become public too.` : " Subagent rooms spawned from it will be public too.";
|
|
34505
|
+
return [
|
|
34506
|
+
line(""),
|
|
34507
|
+
line(` Make \u201C${topic?.title ?? "this topic"}\u201D public?`, {
|
|
34508
|
+
fg: theme.amber,
|
|
34509
|
+
bold: true
|
|
34510
|
+
}),
|
|
34511
|
+
line(""),
|
|
34512
|
+
line(" The transcript becomes visible to the connected Otium Hub."),
|
|
34513
|
+
line(scope),
|
|
34514
|
+
line(" Press y to publish or n to cancel.", { fg: theme.amber })
|
|
34515
|
+
].slice(0, height);
|
|
34516
|
+
}
|
|
34502
34517
|
const all = conversationContentLines(state, width, animationFrame, nowMs, includeTasks);
|
|
34503
34518
|
const { contentHeight, maxOffset, offset } = conversationViewport(all.length, height, state.scrollOffset);
|
|
34504
34519
|
const end = all.length - offset;
|
|
@@ -34766,6 +34781,9 @@ function footerHintText(state) {
|
|
|
34766
34781
|
}
|
|
34767
34782
|
return state.topicPickerRoot ? ["Esc/Ctrl-C exit ", "Esc exit "] : ["Esc close \xB7 Ctrl-C exit; work continues ", "Esc close \xB7 Ctrl-C exit ", "Esc "];
|
|
34768
34783
|
}
|
|
34784
|
+
if (state.overlay === "confirm-share") {
|
|
34785
|
+
return ["Y make public \xB7 N cancel ", "Y/N "];
|
|
34786
|
+
}
|
|
34769
34787
|
if (state.overlay === "background-session") {
|
|
34770
34788
|
return [
|
|
34771
34789
|
"wheel/PgUp/PgDn scroll \xB7 Esc back \xB7 read-only ",
|
|
@@ -34931,16 +34949,14 @@ var theme, WORKING_FRAMES, CODE_COPY_MARKER = "\u29C9", WORKING_FRAME_INTERVAL_M
|
|
|
34931
34949
|
}
|
|
34932
34950
|
}, BARE_URL_PATTERN, URL_TRAILING_PUNCTUATION, isWrapSpace = (character) => character === " " || character === "\t", isWideBreak = (character) => runeWidth(character) === 2, NO_ROW_START, NO_ROW_END, WRAP_MIN_WIDTH = 2, FRAME_MIN_INNER_WIDTH = 4, FRAME_TITLE_MIN_INNER_WIDTH = 8, TABLE_MAX_WIDTH_FRACTION = 0.92, TABLE_MIN_COL_WIDTH = 4, FILE_PREVIEW_MAX_LINES = 12, messageLayoutCache, INLINE_TASK_LIMIT = 5, TASK_SIDEBAR_MIN_WIDTH = 110, TASK_SIDEBAR_WIDTH = 36, TASK_SIDEBAR_GAP = 1, TOPIC_FILTER_ROW_INDEX = 2, TOPIC_FILTER_LABEL = " Filter: ", COMPOSER_GUTTER = 4, COMPOSER_RIGHT_MARGIN = 1, COMPOSER_MIN_CONTENT_WIDTH = 4, NOTICE_STYLE;
|
|
34933
34951
|
var init_render = __esm(async () => {
|
|
34952
|
+
await init_src();
|
|
34934
34953
|
init_color_depth();
|
|
34935
34954
|
init_commands();
|
|
34955
|
+
await init_context_usage();
|
|
34936
34956
|
init_path_suggest();
|
|
34957
|
+
await init_state2();
|
|
34937
34958
|
init_terminal_width();
|
|
34938
34959
|
init_terminal_width();
|
|
34939
|
-
await __promiseAll([
|
|
34940
|
-
init_src(),
|
|
34941
|
-
init_context_usage(),
|
|
34942
|
-
init_state2()
|
|
34943
|
-
]);
|
|
34944
34960
|
theme = {
|
|
34945
34961
|
canvas: [10, 11, 15],
|
|
34946
34962
|
surface: [18, 20, 27],
|
|
@@ -35237,11 +35253,9 @@ function topicFilterPasteText(payload) {
|
|
|
35237
35253
|
}
|
|
35238
35254
|
var MESSAGE_MUTATING_AI_STATUS_KINDS, SGR_MOUSE_PATTERN, TERMINAL_VAULT_USAGE = "Usage: /vault, /vault list, /vault set KEY VALUE [description], or /vault del KEY", BRACKETED_PASTE_START = "\x1B[200~", BRACKETED_PASTE_END = "\x1B[201~", PASTED_TAB_WIDTH = 4, ESC2 = "\\u001b", ESC_CHAR = "\x1B", BEL = "\\u0007", OSC_PATTERN, STRING_COMMAND_PATTERN, CSI_PATTERN, SS3_PATTERN, LONE_ESCAPE_PATTERN, REMAINING_CONTROL_PATTERN, MAX_ESCAPE_CARRY = 32, SS3_CURSOR_PATTERN, MOD_SHIFT = 1, MOD_ALT = 2, MOD_CTRL = 4, MOD_LOCKS = 192, MOD_EXOTIC = 56, CTRL_BYTES, LEGACY_TEXT_KEYS, CSI_U_PATTERN, CSI_LETTER_PATTERN, CSI_TILDE_PATTERN, NEWLINE_KEY_CHUNKS, MODIFIED_ENTER_PATTERN;
|
|
35239
35255
|
var init_app_helpers = __esm(async () => {
|
|
35240
|
-
await
|
|
35241
|
-
|
|
35242
|
-
|
|
35243
|
-
init_state2()
|
|
35244
|
-
]);
|
|
35256
|
+
await init_src();
|
|
35257
|
+
await init_render();
|
|
35258
|
+
await init_state2();
|
|
35245
35259
|
MESSAGE_MUTATING_AI_STATUS_KINDS = new Set(["tool_call", "tool_output"]);
|
|
35246
35260
|
SGR_MOUSE_PATTERN = new RegExp("\\u001b\\[<(\\d{1,5});(\\d{1,5});(\\d{1,5})([mM])", "g");
|
|
35247
35261
|
OSC_PATTERN = new RegExp(`${ESC2}\\][^${BEL}${ESC2}]{0,1024}(?:${BEL}|${ESC2}\\\\)`, "g");
|
|
@@ -35838,12 +35852,10 @@ class RemoteNegotiumClient {
|
|
|
35838
35852
|
}
|
|
35839
35853
|
var MESSAGE_HISTORY_PAGE_SIZE = 50, INITIAL_MESSAGE_HISTORY_PAGE_COUNT = 3, INITIAL_MESSAGE_HISTORY_LIMIT;
|
|
35840
35854
|
var init_client = __esm(async () => {
|
|
35841
|
-
await
|
|
35842
|
-
|
|
35843
|
-
|
|
35844
|
-
|
|
35845
|
-
init_history_store()
|
|
35846
|
-
]);
|
|
35855
|
+
await init_src();
|
|
35856
|
+
await init_storage_public();
|
|
35857
|
+
await init_src5();
|
|
35858
|
+
await init_history_store();
|
|
35847
35859
|
INITIAL_MESSAGE_HISTORY_LIMIT = MESSAGE_HISTORY_PAGE_SIZE * INITIAL_MESSAGE_HISTORY_PAGE_COUNT;
|
|
35848
35860
|
});
|
|
35849
35861
|
|
|
@@ -36255,11 +36267,9 @@ async function runTerminalCommand(commandLine, context) {
|
|
|
36255
36267
|
context.queueRender();
|
|
36256
36268
|
}
|
|
36257
36269
|
var init_command_router = __esm(async () => {
|
|
36258
|
-
await
|
|
36259
|
-
|
|
36260
|
-
|
|
36261
|
-
init_state2()
|
|
36262
|
-
]);
|
|
36270
|
+
await init_src();
|
|
36271
|
+
await init_app_helpers();
|
|
36272
|
+
await init_state2();
|
|
36263
36273
|
});
|
|
36264
36274
|
|
|
36265
36275
|
// ../../adapters/terminal/src/screen-renderer.ts
|
|
@@ -37722,6 +37732,16 @@ class TerminalApp {
|
|
|
37722
37732
|
}
|
|
37723
37733
|
return;
|
|
37724
37734
|
}
|
|
37735
|
+
if (this.#state.overlay === "confirm-share") {
|
|
37736
|
+
const key = chunk.toLowerCase();
|
|
37737
|
+
if (CONFIRM_KEYS.has(key))
|
|
37738
|
+
this.#confirmTopicShare();
|
|
37739
|
+
else if (CANCEL_KEYS.has(key) || chunk === "\x1B") {
|
|
37740
|
+
this.#state = { ...this.#state, overlay: "topics", pendingShareTopicId: undefined };
|
|
37741
|
+
this.#queueRender();
|
|
37742
|
+
}
|
|
37743
|
+
return;
|
|
37744
|
+
}
|
|
37725
37745
|
if (this.#state.overlay === "background-session") {
|
|
37726
37746
|
if (chunk === "\x1B") {
|
|
37727
37747
|
this.#state = { ...this.#state, overlay: "topics" };
|
|
@@ -38030,6 +38050,22 @@ class TerminalApp {
|
|
|
38030
38050
|
this.#queueRender();
|
|
38031
38051
|
return;
|
|
38032
38052
|
}
|
|
38053
|
+
if (chunk === TOGGLE_ACCESS_MODE_KEY) {
|
|
38054
|
+
const topic = pickedTopic(this.#state);
|
|
38055
|
+
if (topic) {
|
|
38056
|
+
this.#requestAccessModeToggle(topic);
|
|
38057
|
+
return;
|
|
38058
|
+
}
|
|
38059
|
+
if (!this.#state.topicPickerBackgroundId)
|
|
38060
|
+
return;
|
|
38061
|
+
this.#state = {
|
|
38062
|
+
...this.#state,
|
|
38063
|
+
notice: "Background sessions are read-only",
|
|
38064
|
+
noticeLevel: "warn"
|
|
38065
|
+
};
|
|
38066
|
+
this.#queueRender();
|
|
38067
|
+
return;
|
|
38068
|
+
}
|
|
38033
38069
|
if (FILTER_BACKSPACE_KEYS.has(chunk)) {
|
|
38034
38070
|
if (this.#state.topicFilter.length === 0)
|
|
38035
38071
|
return;
|
|
@@ -38472,6 +38508,65 @@ class TerminalApp {
|
|
|
38472
38508
|
};
|
|
38473
38509
|
this.#queueRender();
|
|
38474
38510
|
}
|
|
38511
|
+
async#requestAccessModeToggle(topic) {
|
|
38512
|
+
if (topic.kind !== "agent") {
|
|
38513
|
+
this.#state = {
|
|
38514
|
+
...this.#state,
|
|
38515
|
+
notice: `${topic.kind === "manager" ? "Manager" : "Channel"} topics cannot be published`,
|
|
38516
|
+
noticeLevel: "warn"
|
|
38517
|
+
};
|
|
38518
|
+
this.#queueRender();
|
|
38519
|
+
return;
|
|
38520
|
+
}
|
|
38521
|
+
if (topic.isSubagent) {
|
|
38522
|
+
this.#state = {
|
|
38523
|
+
...this.#state,
|
|
38524
|
+
notice: "Subagent rooms inherit privacy from their parent topic",
|
|
38525
|
+
noticeLevel: "warn"
|
|
38526
|
+
};
|
|
38527
|
+
this.#queueRender();
|
|
38528
|
+
return;
|
|
38529
|
+
}
|
|
38530
|
+
if (topic.accessMode === "shared") {
|
|
38531
|
+
await this.#applyAccessMode(topic, "private");
|
|
38532
|
+
return;
|
|
38533
|
+
}
|
|
38534
|
+
this.#state = {
|
|
38535
|
+
...this.#state,
|
|
38536
|
+
overlay: "confirm-share",
|
|
38537
|
+
pendingShareTopicId: topic.id
|
|
38538
|
+
};
|
|
38539
|
+
this.#queueRender();
|
|
38540
|
+
}
|
|
38541
|
+
async#confirmTopicShare() {
|
|
38542
|
+
const topic = this.#state.topics.find((candidate) => candidate.id === this.#state.pendingShareTopicId);
|
|
38543
|
+
this.#state = { ...this.#state, overlay: "topics", pendingShareTopicId: undefined };
|
|
38544
|
+
if (!topic) {
|
|
38545
|
+
this.#state = {
|
|
38546
|
+
...this.#state,
|
|
38547
|
+
notice: "That topic no longer exists",
|
|
38548
|
+
noticeLevel: "warn"
|
|
38549
|
+
};
|
|
38550
|
+
this.#queueRender();
|
|
38551
|
+
return;
|
|
38552
|
+
}
|
|
38553
|
+
await this.#applyAccessMode(topic, "shared");
|
|
38554
|
+
}
|
|
38555
|
+
async#applyAccessMode(topic, accessMode) {
|
|
38556
|
+
this.#state = { ...this.#state, overlay: "topics" };
|
|
38557
|
+
try {
|
|
38558
|
+
const notice = await this.#client.setAccessMode(topic, accessMode);
|
|
38559
|
+
await this.#refreshTopics();
|
|
38560
|
+
this.#state = { ...this.#state, notice, noticeLevel: "success" };
|
|
38561
|
+
} catch (error2) {
|
|
38562
|
+
this.#state = {
|
|
38563
|
+
...this.#state,
|
|
38564
|
+
notice: error2 instanceof Error ? error2.message : String(error2),
|
|
38565
|
+
noticeLevel: "error"
|
|
38566
|
+
};
|
|
38567
|
+
}
|
|
38568
|
+
this.#queueRender();
|
|
38569
|
+
}
|
|
38475
38570
|
#requestTopicDelete(topic) {
|
|
38476
38571
|
if (!topic)
|
|
38477
38572
|
return;
|
|
@@ -38750,6 +38845,7 @@ class TerminalApp {
|
|
|
38750
38845
|
...this.#state,
|
|
38751
38846
|
overlay: null,
|
|
38752
38847
|
pendingDeleteTopicId: undefined,
|
|
38848
|
+
pendingShareTopicId: undefined,
|
|
38753
38849
|
creatingTopic: false,
|
|
38754
38850
|
notice: "Input cleared",
|
|
38755
38851
|
noticeLevel: "info"
|
|
@@ -38812,24 +38908,22 @@ class TerminalApp {
|
|
|
38812
38908
|
await this.#client.stop();
|
|
38813
38909
|
}
|
|
38814
38910
|
}
|
|
38815
|
-
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", FILTER_BACKSPACE_KEYS, CONFIRM_KEYS, CANCEL_KEYS, INPUT_CARRY_FLUSH_MS = 15;
|
|
38911
|
+
var KITTY_KEYBOARD_PUSH = "\x1B[>1u", KITTY_KEYBOARD_POP = "\x1B[<u", CANVAS_RGB, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, ABORT_ENTER_ALT_SCREEN, NEW_TOPIC_KEY = "\x0E", DELETE_TOPIC_KEY = "\x04", TOGGLE_ACCESS_MODE_KEY = "\x10", FILTER_BACKSPACE_KEYS, CONFIRM_KEYS, CANCEL_KEYS, INPUT_CARRY_FLUSH_MS = 15;
|
|
38816
38912
|
var init_app = __esm(async () => {
|
|
38913
|
+
await init_src();
|
|
38914
|
+
await init_app_helpers();
|
|
38915
|
+
await init_client();
|
|
38817
38916
|
init_color_depth();
|
|
38917
|
+
await init_command_router();
|
|
38818
38918
|
init_commands();
|
|
38819
38919
|
init_path_suggest();
|
|
38920
|
+
await init_render();
|
|
38820
38921
|
init_screen_renderer();
|
|
38821
38922
|
init_selection();
|
|
38923
|
+
await init_state2();
|
|
38822
38924
|
init_subagent_graph();
|
|
38823
38925
|
init_terminal_restore();
|
|
38824
|
-
await
|
|
38825
|
-
init_src(),
|
|
38826
|
-
init_app_helpers(),
|
|
38827
|
-
init_client(),
|
|
38828
|
-
init_command_router(),
|
|
38829
|
-
init_render(),
|
|
38830
|
-
init_state2(),
|
|
38831
|
-
init_app_helpers()
|
|
38832
|
-
]);
|
|
38926
|
+
await init_app_helpers();
|
|
38833
38927
|
CANVAS_RGB = [10, 11, 15];
|
|
38834
38928
|
ENTER_ALT_SCREEN = altScreenSequences().enter;
|
|
38835
38929
|
EXIT_ALT_SCREEN = altScreenSequences().exit;
|
|
@@ -38868,13 +38962,11 @@ function startTerminalAdapter(options) {
|
|
|
38868
38962
|
}
|
|
38869
38963
|
var terminalAdapter;
|
|
38870
38964
|
var init_src6 = __esm(async () => {
|
|
38871
|
-
await
|
|
38872
|
-
|
|
38873
|
-
|
|
38874
|
-
|
|
38875
|
-
|
|
38876
|
-
init_render()
|
|
38877
|
-
]);
|
|
38965
|
+
await init_app();
|
|
38966
|
+
await init_client();
|
|
38967
|
+
await init_app();
|
|
38968
|
+
await init_client();
|
|
38969
|
+
await init_render();
|
|
38878
38970
|
terminalAdapter = defineNegotiumAdapter({
|
|
38879
38971
|
name: "terminal",
|
|
38880
38972
|
capabilities: {
|
|
@@ -39412,8 +39504,8 @@ function createTelegramCommandRouter(context) {
|
|
|
39412
39504
|
};
|
|
39413
39505
|
}
|
|
39414
39506
|
var init_commands2 = __esm(async () => {
|
|
39415
|
-
init_telegram_api();
|
|
39416
39507
|
await init_src();
|
|
39508
|
+
init_telegram_api();
|
|
39417
39509
|
});
|
|
39418
39510
|
|
|
39419
39511
|
// ../../adapters/telegram/src/mapping-store.ts
|
|
@@ -41151,23 +41243,19 @@ Warning: enable the bot administrator permission "Manage Topics" before creating
|
|
|
41151
41243
|
}
|
|
41152
41244
|
var FORUM_TOPIC_NAME_MAX = 128, MAX_PARENT_HOPS = 5, DEFAULT_SEND_TIMEOUT_MS = 60000, PHOTO_EXTS;
|
|
41153
41245
|
var init_adapter = __esm(async () => {
|
|
41246
|
+
await init_src();
|
|
41247
|
+
await init_commands2();
|
|
41248
|
+
await init_mapping_store();
|
|
41249
|
+
await init_media_intake();
|
|
41154
41250
|
init_telegram_api();
|
|
41155
|
-
await __promiseAll([
|
|
41156
|
-
init_src(),
|
|
41157
|
-
init_commands2(),
|
|
41158
|
-
init_mapping_store(),
|
|
41159
|
-
init_media_intake()
|
|
41160
|
-
]);
|
|
41161
41251
|
PHOTO_EXTS = new Set(["png", "jpg", "jpeg", "gif", "webp"]);
|
|
41162
41252
|
});
|
|
41163
41253
|
|
|
41164
41254
|
// ../../adapters/telegram/src/index.ts
|
|
41165
41255
|
var telegramAdapter;
|
|
41166
41256
|
var init_src7 = __esm(async () => {
|
|
41167
|
-
await
|
|
41168
|
-
|
|
41169
|
-
init_mapping_store()
|
|
41170
|
-
]);
|
|
41257
|
+
await init_adapter();
|
|
41258
|
+
await init_mapping_store();
|
|
41171
41259
|
telegramAdapter = defineNegotiumAdapter({
|
|
41172
41260
|
name: "telegram",
|
|
41173
41261
|
capabilities: {
|
|
@@ -41329,12 +41417,10 @@ async function runTelegramCli(args = process.argv.slice(2)) {
|
|
|
41329
41417
|
await completed;
|
|
41330
41418
|
}
|
|
41331
41419
|
var init_cli2 = __esm(async () => {
|
|
41420
|
+
await init_src();
|
|
41421
|
+
await init_src5();
|
|
41332
41422
|
init_env_auth();
|
|
41333
|
-
await
|
|
41334
|
-
init_src(),
|
|
41335
|
-
init_src5(),
|
|
41336
|
-
init_src7()
|
|
41337
|
-
]);
|
|
41423
|
+
await init_src7();
|
|
41338
41424
|
if (false) {}
|
|
41339
41425
|
});
|
|
41340
41426
|
|
|
@@ -42041,8 +42127,8 @@ function startCanonicalMcpBridge(options = {}) {
|
|
|
42041
42127
|
var MAX_BODY_BYTES, BODY_READ_TIMEOUT_MS = 1e4, MAX_INFLIGHT = 32, CAPABILITY_TTL_MS, MAX_CAPABILITIES = 2048, FORWARD_TIMEOUT_MS = 25000, TOOL_ALLOWLIST;
|
|
42042
42128
|
var init_canonical_mcp_bridge = __esm(async () => {
|
|
42043
42129
|
init_canonical_bridge_config();
|
|
42044
|
-
init_protocol();
|
|
42045
42130
|
await init_central();
|
|
42131
|
+
init_protocol();
|
|
42046
42132
|
MAX_BODY_BYTES = 1024 * 1024;
|
|
42047
42133
|
CAPABILITY_TTL_MS = 60 * 60 * 1000;
|
|
42048
42134
|
TOOL_ALLOWLIST = {
|
|
@@ -42184,6 +42270,27 @@ function cleanupPeerStateForLocalTopic(localTopicId) {
|
|
|
42184
42270
|
return { sessions, turns, terminalOutbox, inboxRequests, remoteAsks };
|
|
42185
42271
|
})();
|
|
42186
42272
|
}
|
|
42273
|
+
function sweepStalePeerBindings(topicExists) {
|
|
42274
|
+
const stale = [
|
|
42275
|
+
...new Set(listPeerSessions().map((row) => row.local_topic_id).filter((localTopicId) => localTopicId && !topicExists(localTopicId)))
|
|
42276
|
+
];
|
|
42277
|
+
const removed = {
|
|
42278
|
+
sessions: 0,
|
|
42279
|
+
turns: 0,
|
|
42280
|
+
terminalOutbox: 0,
|
|
42281
|
+
inboxRequests: 0,
|
|
42282
|
+
remoteAsks: 0
|
|
42283
|
+
};
|
|
42284
|
+
for (const localTopicId of stale) {
|
|
42285
|
+
const result = cleanupPeerStateForLocalTopic(localTopicId);
|
|
42286
|
+
removed.sessions += result.sessions;
|
|
42287
|
+
removed.turns += result.turns;
|
|
42288
|
+
removed.terminalOutbox += result.terminalOutbox;
|
|
42289
|
+
removed.inboxRequests += result.inboxRequests;
|
|
42290
|
+
removed.remoteAsks += result.remoteAsks;
|
|
42291
|
+
}
|
|
42292
|
+
return { topicIds: stale, removed };
|
|
42293
|
+
}
|
|
42187
42294
|
function failInterruptedPeerTurnRequestsOnStartup() {
|
|
42188
42295
|
return db.run(`UPDATE otium_peer_turn_requests
|
|
42189
42296
|
SET status = 'failed', error = 'worker restarted during turn', updated_at = ?
|
|
@@ -42748,12 +42855,10 @@ function stopEventBackflow() {
|
|
|
42748
42855
|
}
|
|
42749
42856
|
var FORWARDED_TYPES, TERMINAL_TYPES, PEER_EVENT_MAX_ATTEMPTS = 5, PEER_EVENT_RETRY_BASE_MS = 100, PEER_EVENT_TIMEOUT_MS = 15000, PEER_EVENT_MAX_PENDING = 256, activeForwarders, unsubscribe = null, terminalOutboxTimer = null, terminalOutboxFlushInFlight = false;
|
|
42750
42857
|
var init_event_backflow = __esm(async () => {
|
|
42858
|
+
await init_src();
|
|
42859
|
+
await init_central();
|
|
42751
42860
|
init_protocol();
|
|
42752
|
-
await
|
|
42753
|
-
init_src(),
|
|
42754
|
-
init_central(),
|
|
42755
|
-
init_store2()
|
|
42756
|
-
]);
|
|
42861
|
+
await init_store2();
|
|
42757
42862
|
FORWARDED_TYPES = new Set([
|
|
42758
42863
|
"message",
|
|
42759
42864
|
"message_updated",
|
|
@@ -42930,11 +43035,9 @@ function isMcpToolResult(value) {
|
|
|
42930
43035
|
}
|
|
42931
43036
|
var PEER_BRIDGE_TIMEOUT_MS2 = 15000, otiumPeerRuntimeBridge;
|
|
42932
43037
|
var init_runtime_bridge = __esm(async () => {
|
|
42933
|
-
await
|
|
42934
|
-
|
|
42935
|
-
|
|
42936
|
-
init_event_backflow()
|
|
42937
|
-
]);
|
|
43038
|
+
await init_src();
|
|
43039
|
+
await init_central();
|
|
43040
|
+
await init_event_backflow();
|
|
42938
43041
|
otiumPeerRuntimeBridge = {
|
|
42939
43042
|
async flushEvents(localTopicId) {
|
|
42940
43043
|
const forwarder = getActiveForwarder(localTopicId);
|
|
@@ -43429,12 +43532,10 @@ async function acceptRemoteAskReplyResult(args) {
|
|
|
43429
43532
|
}
|
|
43430
43533
|
var PEER_TIMEOUT_MS = 15000, PENDING_ASK_TTL_MS2, peerReplyFlush = null, otiumPeerSessionBridge;
|
|
43431
43534
|
var init_session_bridge = __esm(async () => {
|
|
43535
|
+
await init_src();
|
|
43536
|
+
await init_central();
|
|
43432
43537
|
init_protocol();
|
|
43433
|
-
await
|
|
43434
|
-
init_src(),
|
|
43435
|
-
init_central(),
|
|
43436
|
-
init_store2()
|
|
43437
|
-
]);
|
|
43538
|
+
await init_store2();
|
|
43438
43539
|
PENDING_ASK_TTL_MS2 = 15 * 60 * 1000;
|
|
43439
43540
|
otiumPeerSessionBridge = { forward, sessions, reply };
|
|
43440
43541
|
});
|
|
@@ -43829,13 +43930,11 @@ function acceptSharedTopicMessages(messages, localTopicId, sourceNode) {
|
|
|
43829
43930
|
}
|
|
43830
43931
|
var RETRY_MS = 1000;
|
|
43831
43932
|
var init_shared_topic_sync = __esm(async () => {
|
|
43933
|
+
await init_src();
|
|
43934
|
+
await init_central();
|
|
43935
|
+
await init_event_backflow();
|
|
43832
43936
|
init_protocol();
|
|
43833
|
-
await
|
|
43834
|
-
init_src(),
|
|
43835
|
-
init_central(),
|
|
43836
|
-
init_event_backflow(),
|
|
43837
|
-
init_store2()
|
|
43838
|
-
]);
|
|
43937
|
+
await init_store2();
|
|
43839
43938
|
});
|
|
43840
43939
|
|
|
43841
43940
|
// ../../adapters/otium/src/relay-protocol.ts
|
|
@@ -44460,8 +44559,13 @@ function shareOtiumTopic(options) {
|
|
|
44460
44559
|
if (!owned.ok)
|
|
44461
44560
|
return owned;
|
|
44462
44561
|
if (!isTopicShared(owned.topic)) {
|
|
44463
|
-
|
|
44464
|
-
|
|
44562
|
+
const switched = switchTopicAccessMode({
|
|
44563
|
+
topicId: options.localTopicId,
|
|
44564
|
+
userId: options.userId,
|
|
44565
|
+
accessMode: "shared"
|
|
44566
|
+
});
|
|
44567
|
+
if (!switched.ok)
|
|
44568
|
+
return { ok: false, error: switched.error, status: 409 };
|
|
44465
44569
|
}
|
|
44466
44570
|
return bindOtiumTopic(options);
|
|
44467
44571
|
}
|
|
@@ -44471,8 +44575,13 @@ function setOtiumTopicPrivate(options) {
|
|
|
44471
44575
|
return owned;
|
|
44472
44576
|
const removedBindings = unbindSharedPeerSessionsForLocalTopic(options.localTopicId);
|
|
44473
44577
|
if (isTopicShared(owned.topic)) {
|
|
44474
|
-
|
|
44475
|
-
|
|
44578
|
+
const switched = switchTopicAccessMode({
|
|
44579
|
+
topicId: options.localTopicId,
|
|
44580
|
+
userId: options.userId,
|
|
44581
|
+
accessMode: "private"
|
|
44582
|
+
});
|
|
44583
|
+
if (!switched.ok)
|
|
44584
|
+
return { ok: false, error: switched.error, status: 409 };
|
|
44476
44585
|
}
|
|
44477
44586
|
return { ok: true, localTopicId: options.localTopicId, removedBindings };
|
|
44478
44587
|
}
|
|
@@ -44495,10 +44604,8 @@ function listOtiumTopicBindings() {
|
|
|
44495
44604
|
});
|
|
44496
44605
|
}
|
|
44497
44606
|
var init_bindings = __esm(async () => {
|
|
44498
|
-
await
|
|
44499
|
-
|
|
44500
|
-
init_store2()
|
|
44501
|
-
]);
|
|
44607
|
+
await init_src();
|
|
44608
|
+
await init_store2();
|
|
44502
44609
|
});
|
|
44503
44610
|
|
|
44504
44611
|
// ../../adapters/otium/src/enrollment.ts
|
|
@@ -44738,10 +44845,8 @@ function commitEnrollment(join43, options = {}) {
|
|
|
44738
44845
|
}
|
|
44739
44846
|
var INFO;
|
|
44740
44847
|
var init_enrollment = __esm(async () => {
|
|
44741
|
-
await
|
|
44742
|
-
|
|
44743
|
-
init_join()
|
|
44744
|
-
]);
|
|
44848
|
+
await init_src();
|
|
44849
|
+
await init_join();
|
|
44745
44850
|
INFO = Buffer.from("otium-node-enrollment-v1", "utf8");
|
|
44746
44851
|
});
|
|
44747
44852
|
|
|
@@ -44937,12 +45042,10 @@ function abortHostedPeerTurn(hostNodeId, requestId, userId, topicTitle) {
|
|
|
44937
45042
|
}
|
|
44938
45043
|
var EFFORT_LEVELS, turnTrigger;
|
|
44939
45044
|
var init_turn_bridge = __esm(async () => {
|
|
44940
|
-
await
|
|
44941
|
-
|
|
44942
|
-
|
|
44943
|
-
|
|
44944
|
-
init_store2()
|
|
44945
|
-
]);
|
|
45045
|
+
await init_src();
|
|
45046
|
+
await init_event_backflow();
|
|
45047
|
+
await init_peer_files();
|
|
45048
|
+
await init_store2();
|
|
44946
45049
|
EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
44947
45050
|
});
|
|
44948
45051
|
|
|
@@ -45596,17 +45699,15 @@ async function handleOtiumPeerRequest(req) {
|
|
|
45596
45699
|
}
|
|
45597
45700
|
var RUNTIME_VERSION;
|
|
45598
45701
|
var init_peer_server = __esm(async () => {
|
|
45702
|
+
await init_src();
|
|
45703
|
+
await init_bindings();
|
|
45704
|
+
await init_central();
|
|
45705
|
+
await init_peer_files();
|
|
45599
45706
|
init_protocol();
|
|
45600
|
-
await
|
|
45601
|
-
|
|
45602
|
-
|
|
45603
|
-
|
|
45604
|
-
init_peer_files(),
|
|
45605
|
-
init_session_bridge(),
|
|
45606
|
-
init_shared_topic_sync(),
|
|
45607
|
-
init_store2(),
|
|
45608
|
-
init_turn_bridge()
|
|
45609
|
-
]);
|
|
45707
|
+
await init_session_bridge();
|
|
45708
|
+
await init_shared_topic_sync();
|
|
45709
|
+
await init_store2();
|
|
45710
|
+
await init_turn_bridge();
|
|
45610
45711
|
RUNTIME_VERSION = NEGOTIUM_VERSION;
|
|
45611
45712
|
});
|
|
45612
45713
|
|
|
@@ -45618,6 +45719,10 @@ function startOtiumNodeRuntime(options) {
|
|
|
45618
45719
|
if (failed > 0) {
|
|
45619
45720
|
logger.warn({ failed }, "otium: failed interrupted peer turns from previous process");
|
|
45620
45721
|
}
|
|
45722
|
+
const staleBindings = sweepStalePeerBindings((localTopicId) => getTopic(localTopicId) !== null);
|
|
45723
|
+
if (staleBindings.topicIds.length > 0) {
|
|
45724
|
+
logger.info({ topicIds: staleBindings.topicIds, ...staleBindings.removed }, "otium: removed peer state for local topics deleted while this node was offline");
|
|
45725
|
+
}
|
|
45621
45726
|
const stopBackflow = startEventBackflow();
|
|
45622
45727
|
const stopSharedTopicSync = startSharedTopicSync(join43);
|
|
45623
45728
|
const unregisterRuntimeBridge = registerPeerRuntimeBridge(otiumPeerRuntimeBridge);
|
|
@@ -45704,33 +45809,31 @@ function startOtiumAdapter(options) {
|
|
|
45704
45809
|
}
|
|
45705
45810
|
var otiumAdapter;
|
|
45706
45811
|
var init_src8 = __esm(async () => {
|
|
45812
|
+
await init_src();
|
|
45813
|
+
await init_canonical_mcp_bridge();
|
|
45814
|
+
await init_central();
|
|
45815
|
+
await init_event_backflow();
|
|
45816
|
+
await init_join();
|
|
45817
|
+
await init_peer_files();
|
|
45818
|
+
await init_runtime_bridge();
|
|
45819
|
+
await init_session_bridge();
|
|
45707
45820
|
init_session_bridge_ipc();
|
|
45821
|
+
await init_shared_topic_sync();
|
|
45822
|
+
await init_store2();
|
|
45708
45823
|
init_tunnel_client();
|
|
45824
|
+
await init_bindings();
|
|
45825
|
+
await init_central();
|
|
45826
|
+
await init_enrollment();
|
|
45827
|
+
await init_event_backflow();
|
|
45828
|
+
await init_join();
|
|
45829
|
+
await init_peer_server();
|
|
45709
45830
|
init_protocol();
|
|
45710
45831
|
init_relay_protocol();
|
|
45832
|
+
await init_runtime_bridge();
|
|
45833
|
+
await init_shared_topic_sync();
|
|
45834
|
+
await init_store2();
|
|
45711
45835
|
init_tunnel_client();
|
|
45712
|
-
await
|
|
45713
|
-
init_src(),
|
|
45714
|
-
init_canonical_mcp_bridge(),
|
|
45715
|
-
init_central(),
|
|
45716
|
-
init_event_backflow(),
|
|
45717
|
-
init_join(),
|
|
45718
|
-
init_peer_files(),
|
|
45719
|
-
init_runtime_bridge(),
|
|
45720
|
-
init_session_bridge(),
|
|
45721
|
-
init_shared_topic_sync(),
|
|
45722
|
-
init_store2(),
|
|
45723
|
-
init_bindings(),
|
|
45724
|
-
init_central(),
|
|
45725
|
-
init_enrollment(),
|
|
45726
|
-
init_event_backflow(),
|
|
45727
|
-
init_join(),
|
|
45728
|
-
init_peer_server(),
|
|
45729
|
-
init_runtime_bridge(),
|
|
45730
|
-
init_shared_topic_sync(),
|
|
45731
|
-
init_store2(),
|
|
45732
|
-
init_turn_bridge()
|
|
45733
|
-
]);
|
|
45836
|
+
await init_turn_bridge();
|
|
45734
45837
|
otiumAdapter = defineNegotiumAdapter({
|
|
45735
45838
|
name: "otium",
|
|
45736
45839
|
capabilities: {
|
|
@@ -45790,13 +45893,11 @@ function mountConfiguredOtiumNodeRuntime() {
|
|
|
45790
45893
|
};
|
|
45791
45894
|
}
|
|
45792
45895
|
var init_node_runtime = __esm(async () => {
|
|
45896
|
+
await init_src();
|
|
45897
|
+
await init_src8();
|
|
45898
|
+
await init_join();
|
|
45899
|
+
await init_peer_server();
|
|
45793
45900
|
init_protocol();
|
|
45794
|
-
await __promiseAll([
|
|
45795
|
-
init_src(),
|
|
45796
|
-
init_src8(),
|
|
45797
|
-
init_join(),
|
|
45798
|
-
init_peer_server()
|
|
45799
|
-
]);
|
|
45800
45901
|
});
|
|
45801
45902
|
|
|
45802
45903
|
// ../../adapters/otium/src/join-cli.ts
|
|
@@ -45893,11 +45994,9 @@ async function joinCommand(args) {
|
|
|
45893
45994
|
console.log("\nnext: `negotium-otium serve` (mounts the otium peer routes automatically)");
|
|
45894
45995
|
}
|
|
45895
45996
|
var init_join_cli = __esm(async () => {
|
|
45896
|
-
await
|
|
45897
|
-
|
|
45898
|
-
|
|
45899
|
-
init_join()
|
|
45900
|
-
]);
|
|
45997
|
+
await init_central();
|
|
45998
|
+
await init_enrollment();
|
|
45999
|
+
await init_join();
|
|
45901
46000
|
});
|
|
45902
46001
|
|
|
45903
46002
|
// ../../adapters/otium/src/sidecar.ts
|
|
@@ -45987,13 +46086,11 @@ async function runOtiumSidecar(options) {
|
|
|
45987
46086
|
await completed;
|
|
45988
46087
|
}
|
|
45989
46088
|
var init_sidecar = __esm(async () => {
|
|
46089
|
+
await init_src();
|
|
46090
|
+
await init_src5();
|
|
46091
|
+
await init_join();
|
|
45990
46092
|
init_protocol();
|
|
45991
46093
|
init_tunnel_client();
|
|
45992
|
-
await __promiseAll([
|
|
45993
|
-
init_src(),
|
|
45994
|
-
init_src5(),
|
|
45995
|
-
init_join()
|
|
45996
|
-
]);
|
|
45997
46094
|
});
|
|
45998
46095
|
|
|
45999
46096
|
// ../../adapters/otium/src/cli.ts
|
|
@@ -46649,10 +46746,8 @@ async function cronCommand(args) {
|
|
|
46649
46746
|
}
|
|
46650
46747
|
var USER_ID = "local";
|
|
46651
46748
|
var init_cron = __esm(async () => {
|
|
46652
|
-
await
|
|
46653
|
-
|
|
46654
|
-
init_src4()
|
|
46655
|
-
]);
|
|
46749
|
+
await init_src();
|
|
46750
|
+
await init_src4();
|
|
46656
46751
|
});
|
|
46657
46752
|
|
|
46658
46753
|
// ../cli/src/adapter-loader.ts
|
|
@@ -46915,4 +47010,4 @@ switch (command) {
|
|
|
46915
47010
|
}
|
|
46916
47011
|
}
|
|
46917
47012
|
|
|
46918
|
-
//# debugId=
|
|
47013
|
+
//# debugId=5D43DAEFFAA3D35464756E2164756E21
|