negotium 0.19.0 → 0.19.2
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 +142 -77
- package/dist/agent-helpers.js.map +10 -10
- package/dist/background-bash.js.map +1 -1
- package/dist/browser-runtime.js.map +1 -1
- package/dist/{chunk-y8rtedjb.js → chunk-55dd0xw7.js} +2 -2
- package/dist/{chunk-y8rtedjb.js.map → chunk-55dd0xw7.js.map} +2 -2
- package/dist/{chunk-q2s5f70x.js → chunk-aqqmzmft.js} +1 -1
- package/dist/{chunk-3d1pjgfw.js → chunk-cv7vdsrn.js} +2 -2
- package/dist/{chunk-3d1pjgfw.js.map → chunk-cv7vdsrn.js.map} +2 -2
- package/dist/{chunk-4bzehg8t.js → chunk-exqz8bez.js} +3 -3
- package/dist/{chunk-4bzehg8t.js.map → chunk-exqz8bez.js.map} +2 -2
- package/dist/{chunk-22mtr8np.js → chunk-kkftbxh2.js} +1 -1
- package/dist/hosted-agent.js +4 -4
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +140 -82
- package/dist/main.js.map +11 -11
- package/dist/mcp-factories.js +214 -165
- package/dist/mcp-factories.js.map +9 -9
- package/dist/media.js.map +1 -1
- package/dist/prompts.js +23 -3
- package/dist/prompts.js.map +4 -4
- package/dist/query-runtime.js +56 -6
- package/dist/query-runtime.js.map +7 -5
- package/dist/registry.js +3 -3
- package/dist/rollout.js +2 -2
- package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +24 -4
- package/dist/runtime/src/agents/model-catalog.ts +27 -2
- package/dist/runtime/src/agents/self-config-core.ts +10 -1
- package/dist/runtime/src/platform/config.ts +1 -1
- package/dist/runtime/src/query/state.ts +19 -1
- package/dist/runtime/src/storage/token-stats.ts +4 -1
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js.map +1 -1
- package/dist/storage.js +5 -2
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/platform/config.d.ts +1 -1
- package/dist/types/packages/core/src/query/state.d.ts +8 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-q2s5f70x.js.map → chunk-aqqmzmft.js.map} +0 -0
- /package/dist/{chunk-22mtr8np.js.map → chunk-kkftbxh2.js.map} +0 -0
package/dist/mcp-factories.js
CHANGED
|
@@ -439,7 +439,7 @@ function resolveWhisperBackend() {
|
|
|
439
439
|
function codexAuthFilePath() {
|
|
440
440
|
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
|
|
441
441
|
}
|
|
442
|
-
var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BINARY_EXTENSION, BROWSER_RS_VERSION = "v0.6.0", BROWSER_RS_MIN_SECURE_VERSION = "0.2.1", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.10", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER_PATH, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, RUNTIME_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, ABSOLUTE_PATH_PREFIX, FILE_EXTENSIONS_REGEX, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5", MODEL_HAIKU = "claude-haiku-4-5-20251001", MODEL_FABLE = "claude-fable-5-1", MODEL_DEEPSEEK_V4_PRO = "deepseek-v4-pro", MODEL_DEEPSEEK_V4_FLASH = "deepseek-v4-flash", FALLBACK_AGENT, FALLBACK_MODEL, DEFAULT_TOPIC_EFFORT, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, WHISPER_BACKEND, MLX_WHISPER_BIN, WHISPER_MODEL_MLX, _envMaxTellDepth, MAX_TELL_DEPTH;
|
|
442
|
+
var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_PROFILES_DIR, BINARIES_DIR, SECRETS_DIR, DM_WORKSPACE_DIR, SESSION_WORKSPACE_DIR, CLAUDE_EXECUTABLE_ENV, CLAUDE_EXECUTABLE, DEFAULT_OUTPUT_LANGUAGE = "English", BINARY_EXTENSION, BROWSER_RS_VERSION = "v0.6.0", BROWSER_RS_MIN_SECURE_VERSION = "0.2.1", BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000, SNIPPETS_API_URL, BROWSER_RS_BIN, BASH_RS_VERSION = "v0.1.10", BASH_RS_BIN, PLAYWRIGHT_MCP_BIN, TSX_BIN, TSX_LOADER_PATH, TSX_LOADER, TSCONFIG_PATH, SESSION_COMM_SERVER, TASK_SERVER, DECISION_SERVER, CANONICAL_MCP_PROXY_SERVER, WIKI_SERVER, TOKEN_STATS_SERVER, COMPACTION_LOG_SERVER, SYSTEM_HEALTH_SERVER, AGENT_HEALTH_SERVER, VAULT_SERVER, BG_BASH_BASE_PORT, BG_BASH_MAX_PORT, RUNTIME_MCP_SECRET, NODE_CONTROL_TOKEN, NODE_ID, VAULT_MASTER_KEY, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, RUNTIME_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, ABSOLUTE_PATH_PREFIX, FILE_EXTENSIONS_REGEX, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5-5", MODEL_HAIKU = "claude-haiku-4-5-20251001", MODEL_FABLE = "claude-fable-5-1", MODEL_DEEPSEEK_V4_PRO = "deepseek-v4-pro", MODEL_DEEPSEEK_V4_FLASH = "deepseek-v4-flash", FALLBACK_AGENT, FALLBACK_MODEL, DEFAULT_TOPIC_EFFORT, FFMPEG_BIN, FFPROBE_BIN, PYTHON_BIN, FASTER_WHISPER_WRAPPER, WHISPER_MODEL, TESSERACT_BIN, PDFTOTEXT_BIN, WHISPER_BACKEND, MLX_WHISPER_BIN, WHISPER_MODEL_MLX, _envMaxTellDepth, MAX_TELL_DEPTH;
|
|
443
443
|
var init_config = __esm(() => {
|
|
444
444
|
init_config_helpers();
|
|
445
445
|
init_logger();
|
|
@@ -4005,7 +4005,7 @@ var init_codex = __esm(async () => {
|
|
|
4005
4005
|
});
|
|
4006
4006
|
|
|
4007
4007
|
// ../../packages/core/src/version.ts
|
|
4008
|
-
var NEGOTIUM_VERSION = "0.19.
|
|
4008
|
+
var NEGOTIUM_VERSION = "0.19.2";
|
|
4009
4009
|
|
|
4010
4010
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
4011
4011
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -4698,6 +4698,8 @@ var init_model_catalog = __esm(() => {
|
|
|
4698
4698
|
haiku: "claude",
|
|
4699
4699
|
fable: "claude",
|
|
4700
4700
|
"gpt-6-astra": "codex",
|
|
4701
|
+
"gpt-6-sol": "codex",
|
|
4702
|
+
"gpt-6-luna": "codex",
|
|
4701
4703
|
"gpt-5.6-luna": "codex",
|
|
4702
4704
|
"gpt-5.6-terra": "codex",
|
|
4703
4705
|
"gpt-5.6-sol": "codex",
|
|
@@ -4727,6 +4729,26 @@ var init_model_catalog = __esm(() => {
|
|
|
4727
4729
|
marginalTokenCost: "Codex credits (OpenAI API rate): $10/M uncached input, $1/M cached input, $12.50/M cache write, $50/M output",
|
|
4728
4730
|
estimatedUsage: `Released 2026-09-03; became Codex CLI's bundled default in v0.153.4 (2026-09-05). Local message-count/quota-weight ranges not yet published as of the last catalog check \u2014 expect a quota weight above gpt-5.6-sol given the higher per-token cost. ${CODEX_COMMUNITY_WEEKLY}`
|
|
4729
4731
|
},
|
|
4732
|
+
{
|
|
4733
|
+
model: "gpt-6-sol",
|
|
4734
|
+
agent: "codex",
|
|
4735
|
+
description: "GPT-6 generation Sol route (2026-09-22) for demanding coding and agentic work.",
|
|
4736
|
+
intelligenceTier: "opus",
|
|
4737
|
+
routingSummary: "demanding coding work; about half as many mistakes as gpt-5.6-sol at half the price",
|
|
4738
|
+
accessCost: CODEX_PRO_20X_COST,
|
|
4739
|
+
marginalTokenCost: "Codex credits (OpenAI API rate): $2/M uncached input, $0.20/M cached input (assumed), $10/M output",
|
|
4740
|
+
estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
|
|
4741
|
+
},
|
|
4742
|
+
{
|
|
4743
|
+
model: "gpt-6-luna",
|
|
4744
|
+
agent: "codex",
|
|
4745
|
+
description: "GPT-6 generation Luna route (2026-09-22): fast, high-volume, lowest cost.",
|
|
4746
|
+
intelligenceTier: "sonnet",
|
|
4747
|
+
routingSummary: "fast high-volume work; cheapest Codex route",
|
|
4748
|
+
accessCost: CODEX_PRO_20X_COST,
|
|
4749
|
+
marginalTokenCost: "Codex credits (OpenAI API rate): $0.10/M uncached input, $0.01/M cached input (assumed), $0.50/M output",
|
|
4750
|
+
estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
|
|
4751
|
+
},
|
|
4730
4752
|
{
|
|
4731
4753
|
model: "gpt-5.6-sol",
|
|
4732
4754
|
agent: "codex",
|
|
@@ -4772,9 +4794,9 @@ var init_model_catalog = __esm(() => {
|
|
|
4772
4794
|
agent: "claude",
|
|
4773
4795
|
description: "High-capability Claude route for complex reasoning and tool-heavy work.",
|
|
4774
4796
|
intelligenceTier: "opus",
|
|
4775
|
-
routingSummary: "complex reasoning and tool-heavy work; about
|
|
4797
|
+
routingSummary: "complex reasoning and tool-heavy work; about 2x Sonnet marginal cost",
|
|
4776
4798
|
accessCost: CLAUDE_MAX_20X_COST,
|
|
4777
|
-
marginalTokenCost: "Claude API/extra usage: $
|
|
4799
|
+
marginalTokenCost: "Claude API/extra usage (Opus 5.5, 2026-09-22): $4/M input, $5/M cache write (assumed), $0.40/M cache read (assumed), $20/M output",
|
|
4778
4800
|
estimatedUsage: `${CLAUDE_COMMUNITY_SESSION}; Opus uses the shared all-model weekly pool more quickly than Sonnet. No stable per-model token cap is published.`
|
|
4779
4801
|
},
|
|
4780
4802
|
{
|
|
@@ -5184,6 +5206,75 @@ var init_bus = __esm(async () => {
|
|
|
5184
5206
|
};
|
|
5185
5207
|
});
|
|
5186
5208
|
|
|
5209
|
+
// ../../packages/core/src/query/state.ts
|
|
5210
|
+
import { mkdirSync as mkdirSync10, renameSync as renameSync6, unlinkSync as unlinkSync9, writeFileSync as writeFileSync8 } from "fs";
|
|
5211
|
+
import { basename as basename3, join as join13 } from "path";
|
|
5212
|
+
function createQueryStateStore(options) {
|
|
5213
|
+
const sanitize = options.sanitizeTopicId ?? sanitizeId;
|
|
5214
|
+
const queryStateDirPath = (userId) => join13(options.usersLogDir, String(userId), "active-queries");
|
|
5215
|
+
const queryStateFile = (userId, topicId) => join13(queryStateDirPath(userId), `${sanitize(topicId)}.json`);
|
|
5216
|
+
const legacyQueryStateFile = (userId, topicName) => {
|
|
5217
|
+
if (!topicName || topicName === "." || topicName === ".." || basename3(topicName) !== topicName) {
|
|
5218
|
+
return null;
|
|
5219
|
+
}
|
|
5220
|
+
return join13(queryStateDirPath(userId), `${topicName}.json`);
|
|
5221
|
+
};
|
|
5222
|
+
return {
|
|
5223
|
+
write(userId, topicId, topicName, task) {
|
|
5224
|
+
const dir = queryStateDirPath(userId);
|
|
5225
|
+
mkdirSync10(dir, { recursive: true });
|
|
5226
|
+
const state = { topicId, topicName, since: new Date().toISOString() };
|
|
5227
|
+
if (task)
|
|
5228
|
+
state.task = [...task.replace(/\n+/g, " ").trim()].slice(0, 100).join("");
|
|
5229
|
+
const target = queryStateFile(userId, topicId);
|
|
5230
|
+
const tmp = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
5231
|
+
writeFileSync8(tmp, JSON.stringify(state));
|
|
5232
|
+
renameSync6(tmp, target);
|
|
5233
|
+
},
|
|
5234
|
+
clear(userId, topicId, legacyTopicName) {
|
|
5235
|
+
const paths = [
|
|
5236
|
+
queryStateFile(userId, topicId),
|
|
5237
|
+
legacyQueryStateFile(userId, legacyTopicName)
|
|
5238
|
+
].filter((path) => Boolean(path));
|
|
5239
|
+
for (const path of new Set(paths)) {
|
|
5240
|
+
try {
|
|
5241
|
+
unlinkSync9(path);
|
|
5242
|
+
} catch (error) {
|
|
5243
|
+
if (error?.code !== "ENOENT") {
|
|
5244
|
+
options.logger?.warn({ err: error, userId, topicId, path }, "Failed to clear query state file");
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
},
|
|
5249
|
+
hasActive(userId, topicId) {
|
|
5250
|
+
const state = readJsonFile(queryStateFile(userId, topicId));
|
|
5251
|
+
if (!state)
|
|
5252
|
+
return false;
|
|
5253
|
+
const sinceMs = new Date(state.since).getTime();
|
|
5254
|
+
return Date.now() - sinceMs <= ACTIVE_QUERY_STALE_MS;
|
|
5255
|
+
}
|
|
5256
|
+
};
|
|
5257
|
+
}
|
|
5258
|
+
function writeQueryState(userId, topicId, topicName, task) {
|
|
5259
|
+
defaultQueryStateStore.write(userId, topicId, topicName, task);
|
|
5260
|
+
}
|
|
5261
|
+
function clearQueryState(userId, topicId, legacyTopicName) {
|
|
5262
|
+
defaultQueryStateStore.clear(userId, topicId, legacyTopicName);
|
|
5263
|
+
}
|
|
5264
|
+
function hasActiveQuery(userId, topicId) {
|
|
5265
|
+
return defaultQueryStateStore.hasActive(userId, topicId);
|
|
5266
|
+
}
|
|
5267
|
+
var defaultQueryStateStore;
|
|
5268
|
+
var init_state = __esm(() => {
|
|
5269
|
+
init_config();
|
|
5270
|
+
init_jsonl();
|
|
5271
|
+
init_logger();
|
|
5272
|
+
defaultQueryStateStore = createQueryStateStore({
|
|
5273
|
+
usersLogDir: USERS_LOG_DIR,
|
|
5274
|
+
logger
|
|
5275
|
+
});
|
|
5276
|
+
});
|
|
5277
|
+
|
|
5187
5278
|
// ../../packages/core/src/storage/api-messages.ts
|
|
5188
5279
|
function initializeApiMessagesSchema() {
|
|
5189
5280
|
db.exec(`
|
|
@@ -5965,7 +6056,7 @@ var init_registry = __esm(async () => {
|
|
|
5965
6056
|
});
|
|
5966
6057
|
|
|
5967
6058
|
// ../../packages/core/src/agents/fork.ts
|
|
5968
|
-
import { existsSync as existsSync13, unlinkSync as
|
|
6059
|
+
import { existsSync as existsSync13, unlinkSync as unlinkSync10 } from "fs";
|
|
5969
6060
|
function createAgentForkHelpers(host) {
|
|
5970
6061
|
return {
|
|
5971
6062
|
async forkAgentSession(options) {
|
|
@@ -6003,7 +6094,7 @@ var init_fork = __esm(async () => {
|
|
|
6003
6094
|
defaultForkHelpers = createAgentForkHelpers({
|
|
6004
6095
|
forkSession: (agent, options) => getRegistryOperations(agent).forkSession(options),
|
|
6005
6096
|
exists: existsSync13,
|
|
6006
|
-
unlink:
|
|
6097
|
+
unlink: unlinkSync10,
|
|
6007
6098
|
warn: (details, message) => logger.warn(details, message)
|
|
6008
6099
|
});
|
|
6009
6100
|
});
|
|
@@ -6207,7 +6298,7 @@ var init_runtime_process_leases = __esm(async () => {
|
|
|
6207
6298
|
|
|
6208
6299
|
// ../../packages/core/src/platform/playwright/browser-processes.ts
|
|
6209
6300
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
6210
|
-
import { readdirSync as readdirSync4, unlinkSync as
|
|
6301
|
+
import { readdirSync as readdirSync4, unlinkSync as unlinkSync11 } from "fs";
|
|
6211
6302
|
import { createServer } from "net";
|
|
6212
6303
|
import { resolve as resolve9, sep as sep2 } from "path";
|
|
6213
6304
|
function isPortInUse(port) {
|
|
@@ -6336,7 +6427,7 @@ function cleanSingletonFiles(userDataDir) {
|
|
|
6336
6427
|
for (const f of files) {
|
|
6337
6428
|
if (f.startsWith("Singleton")) {
|
|
6338
6429
|
try {
|
|
6339
|
-
|
|
6430
|
+
unlinkSync11(resolve9(userDataDir, f));
|
|
6340
6431
|
logger.info({ file: f, userDataDir }, "Removed stale Singleton file");
|
|
6341
6432
|
} catch (e) {
|
|
6342
6433
|
logger.warn({ err: e, file: f }, "Failed to remove stale Chrome Singleton file");
|
|
@@ -6472,11 +6563,11 @@ var init_transport_probe = __esm(() => {
|
|
|
6472
6563
|
// ../../packages/core/src/platform/ipc.ts
|
|
6473
6564
|
import { createHash as createHash3 } from "crypto";
|
|
6474
6565
|
import { chmodSync as chmodSync5 } from "fs";
|
|
6475
|
-
import { basename as
|
|
6566
|
+
import { basename as basename4 } from "path";
|
|
6476
6567
|
function ipcEndpoint(posixSocketPath) {
|
|
6477
6568
|
if (!IS_WINDOWS)
|
|
6478
6569
|
return posixSocketPath;
|
|
6479
|
-
const label =
|
|
6570
|
+
const label = basename4(posixSocketPath).replace(/\.sock$/, "").replace(/[^A-Za-z0-9._-]/g, "-").slice(0, 48) || "endpoint";
|
|
6480
6571
|
const digest = createHash3("sha256").update(posixSocketPath).digest("hex").slice(0, 16);
|
|
6481
6572
|
return `\\\\.\\pipe\\negotium-${label}-${digest}`;
|
|
6482
6573
|
}
|
|
@@ -6500,7 +6591,7 @@ var init_vault_public = __esm(async () => {
|
|
|
6500
6591
|
import { randomBytes as randomBytes5, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
6501
6592
|
import { createServer as createServer2 } from "net";
|
|
6502
6593
|
import { tmpdir as tmpdir2 } from "os";
|
|
6503
|
-
import { join as
|
|
6594
|
+
import { join as join14 } from "path";
|
|
6504
6595
|
function deepMapStrings(value2, transform) {
|
|
6505
6596
|
if (typeof value2 === "string")
|
|
6506
6597
|
return transform(value2);
|
|
@@ -6587,7 +6678,7 @@ function authorized(actual, expected) {
|
|
|
6587
6678
|
}
|
|
6588
6679
|
async function createBrowserVaultBroker(userId) {
|
|
6589
6680
|
const token = randomBytes5(32).toString("hex");
|
|
6590
|
-
const socketPath = ipcEndpoint(
|
|
6681
|
+
const socketPath = ipcEndpoint(join14(process.platform === "win32" ? tmpdir2() : "/tmp", `negotium-browser-vault-${process.pid}-${randomBytes5(8).toString("hex")}.sock`));
|
|
6591
6682
|
const retainedForms = new Map;
|
|
6592
6683
|
const leases = new Map;
|
|
6593
6684
|
const sockets = new Set;
|
|
@@ -6793,13 +6884,13 @@ import { createHash as createHash4, randomBytes as randomBytes6, timingSafeEqual
|
|
|
6793
6884
|
import {
|
|
6794
6885
|
cpSync,
|
|
6795
6886
|
existsSync as existsSync14,
|
|
6796
|
-
mkdirSync as
|
|
6887
|
+
mkdirSync as mkdirSync11,
|
|
6797
6888
|
readFileSync as readFileSync11,
|
|
6798
6889
|
rmSync as rmSync2,
|
|
6799
|
-
unlinkSync as
|
|
6800
|
-
writeFileSync as
|
|
6890
|
+
unlinkSync as unlinkSync12,
|
|
6891
|
+
writeFileSync as writeFileSync9
|
|
6801
6892
|
} from "fs";
|
|
6802
|
-
import { dirname as dirname10, join as
|
|
6893
|
+
import { dirname as dirname10, join as join15, resolve as resolve11 } from "path";
|
|
6803
6894
|
function removeDefaultProfileDataDir(userDataDir) {
|
|
6804
6895
|
const root = resolve11(BROWSER_PROFILES_DIR);
|
|
6805
6896
|
const target = resolve11(userDataDir);
|
|
@@ -6868,15 +6959,15 @@ function portFileName(instanceKey) {
|
|
|
6868
6959
|
}
|
|
6869
6960
|
function writePortFile(instanceKey, port) {
|
|
6870
6961
|
try {
|
|
6871
|
-
|
|
6872
|
-
|
|
6962
|
+
mkdirSync11(managerHost.portsDir, { recursive: true });
|
|
6963
|
+
writeFileSync9(join15(managerHost.portsDir, portFileName(instanceKey)), String(port));
|
|
6873
6964
|
} catch (e) {
|
|
6874
6965
|
logger.warn({ err: e, instanceKey, port }, "Failed to save playwright port file");
|
|
6875
6966
|
}
|
|
6876
6967
|
}
|
|
6877
6968
|
function deletePortFile(instanceKey) {
|
|
6878
6969
|
try {
|
|
6879
|
-
|
|
6970
|
+
unlinkSync12(join15(managerHost.portsDir, portFileName(instanceKey)));
|
|
6880
6971
|
} catch (e) {
|
|
6881
6972
|
if (e.code === "ENOENT")
|
|
6882
6973
|
return;
|
|
@@ -7077,7 +7168,7 @@ async function spawnPlaywright(instanceKey, ownerId, reservedPort, browserBin =
|
|
|
7077
7168
|
}
|
|
7078
7169
|
const userDataDir = resolveUserDataDir(instanceKey);
|
|
7079
7170
|
const port = reservedPort ?? await allocatePort();
|
|
7080
|
-
|
|
7171
|
+
mkdirSync11(userDataDir, { recursive: true });
|
|
7081
7172
|
const mcpArgs = [
|
|
7082
7173
|
"--port",
|
|
7083
7174
|
String(port),
|
|
@@ -7383,7 +7474,7 @@ async function cloneProfileForChild(opts) {
|
|
|
7383
7474
|
if (existsSync14(dstDir)) {
|
|
7384
7475
|
rmSync2(dstDir, { recursive: true, force: true });
|
|
7385
7476
|
}
|
|
7386
|
-
|
|
7477
|
+
mkdirSync11(dirname10(dstDir), { recursive: true });
|
|
7387
7478
|
if (process.platform === "darwin") {
|
|
7388
7479
|
try {
|
|
7389
7480
|
execFileSync4("cp", ["-cR", srcDir, dstDir], { stdio: "pipe" });
|
|
@@ -7401,7 +7492,7 @@ async function cloneProfileForChild(opts) {
|
|
|
7401
7492
|
cleanSingletonFiles(dstDir);
|
|
7402
7493
|
for (const f of ["DevToolsActivePort", "LOCK"]) {
|
|
7403
7494
|
try {
|
|
7404
|
-
|
|
7495
|
+
unlinkSync12(resolve11(dstDir, f));
|
|
7405
7496
|
} catch {}
|
|
7406
7497
|
}
|
|
7407
7498
|
logger.info({ srcKey, dstKey, srcDir, dstDir }, "Cloned Playwright profile for child topic");
|
|
@@ -7999,15 +8090,15 @@ var init_api_topic_config = __esm(async () => {
|
|
|
7999
8090
|
// ../../packages/core/src/storage/conversations.ts
|
|
8000
8091
|
import {
|
|
8001
8092
|
existsSync as existsSync15,
|
|
8002
|
-
mkdirSync as
|
|
8093
|
+
mkdirSync as mkdirSync12,
|
|
8003
8094
|
readFileSync as readFileSync12,
|
|
8004
|
-
renameSync as
|
|
8005
|
-
unlinkSync as
|
|
8006
|
-
writeFileSync as
|
|
8095
|
+
renameSync as renameSync7,
|
|
8096
|
+
unlinkSync as unlinkSync13,
|
|
8097
|
+
writeFileSync as writeFileSync10
|
|
8007
8098
|
} from "fs";
|
|
8008
|
-
import { dirname as dirname11, join as
|
|
8099
|
+
import { dirname as dirname11, join as join16 } from "path";
|
|
8009
8100
|
function conversationDir(_userId) {
|
|
8010
|
-
return
|
|
8101
|
+
return join16(resolveStorageDataDir(), "conversations");
|
|
8011
8102
|
}
|
|
8012
8103
|
function topicFilename(userId, topicName) {
|
|
8013
8104
|
const t = sanitizeTopicName(topicName, true);
|
|
@@ -8017,7 +8108,7 @@ function topicFilename(userId, topicName) {
|
|
|
8017
8108
|
return `${t}.${sanitizeId(owner)}.jsonl`;
|
|
8018
8109
|
}
|
|
8019
8110
|
function getConversationPath(userId, topicName) {
|
|
8020
|
-
return
|
|
8111
|
+
return join16(conversationDir(userId), topicFilename(userId, topicName));
|
|
8021
8112
|
}
|
|
8022
8113
|
function getActiveConversationPath(userId, topicName) {
|
|
8023
8114
|
const rawPath = getConversationPath(userId, topicName);
|
|
@@ -8043,7 +8134,7 @@ function appendConversationEventStrict(userId, topicName, agent, event) {
|
|
|
8043
8134
|
event
|
|
8044
8135
|
};
|
|
8045
8136
|
const line = JSON.stringify(entry);
|
|
8046
|
-
|
|
8137
|
+
mkdirSync12(dirname11(path), { recursive: true });
|
|
8047
8138
|
appendJsonlLine(path, line);
|
|
8048
8139
|
const activePath = getActiveConversationPath(userId, topicName);
|
|
8049
8140
|
if (existsSync15(activePath)) {
|
|
@@ -8061,7 +8152,7 @@ function appendRawConversationEventStrict(userId, topicName, agent, event) {
|
|
|
8061
8152
|
agent,
|
|
8062
8153
|
event
|
|
8063
8154
|
};
|
|
8064
|
-
|
|
8155
|
+
mkdirSync12(dirname11(path), { recursive: true });
|
|
8065
8156
|
appendJsonlLine(path, JSON.stringify(entry));
|
|
8066
8157
|
}
|
|
8067
8158
|
function readConversationPath(path) {
|
|
@@ -8102,15 +8193,15 @@ function replaceRawConversationStrict(userId, topicName, entries) {
|
|
|
8102
8193
|
}
|
|
8103
8194
|
function replaceConversationPathStrict(path, entries) {
|
|
8104
8195
|
const tempPath = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
8105
|
-
|
|
8196
|
+
mkdirSync12(dirname11(path), { recursive: true });
|
|
8106
8197
|
try {
|
|
8107
|
-
|
|
8198
|
+
writeFileSync10(tempPath, entries.length > 0 ? `${entries.map((entry) => JSON.stringify(entry)).join(`
|
|
8108
8199
|
`)}
|
|
8109
8200
|
` : "", { flag: "wx" });
|
|
8110
|
-
|
|
8201
|
+
renameSync7(tempPath, path);
|
|
8111
8202
|
} catch (error) {
|
|
8112
8203
|
try {
|
|
8113
|
-
|
|
8204
|
+
unlinkSync13(tempPath);
|
|
8114
8205
|
} catch {}
|
|
8115
8206
|
throw error;
|
|
8116
8207
|
}
|
|
@@ -8362,8 +8453,8 @@ var init_compaction_tool_projection = __esm(() => {
|
|
|
8362
8453
|
});
|
|
8363
8454
|
|
|
8364
8455
|
// ../../packages/core/src/storage/tasks.ts
|
|
8365
|
-
import { existsSync as existsSync16, mkdirSync as
|
|
8366
|
-
import { dirname as dirname12, join as
|
|
8456
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync13, readFileSync as readFileSync13, renameSync as renameSync8, statSync as statSync4, writeFileSync as writeFileSync11 } from "fs";
|
|
8457
|
+
import { dirname as dirname12, join as join17 } from "path";
|
|
8367
8458
|
function safeTaskScopeKey(scopeKey) {
|
|
8368
8459
|
const safe = sanitizeFileName(scopeKey);
|
|
8369
8460
|
if (!safe || safe === "." || safe === "..") {
|
|
@@ -8375,7 +8466,7 @@ function taskScopeKey(opts) {
|
|
|
8375
8466
|
return opts.topicId?.trim() || opts.session || "default";
|
|
8376
8467
|
}
|
|
8377
8468
|
function getTaskFilePath(userId, scopeKey) {
|
|
8378
|
-
return
|
|
8469
|
+
return join17(resolveStorageDataDir(), "tasks", `${safeTaskScopeKey(scopeKey)}.json`);
|
|
8379
8470
|
}
|
|
8380
8471
|
function readTasks(userId, scopeKey) {
|
|
8381
8472
|
const path = getTaskFilePath(userId, scopeKey);
|
|
@@ -8391,11 +8482,11 @@ function readTasks(userId, scopeKey) {
|
|
|
8391
8482
|
}
|
|
8392
8483
|
function writeTasks(userId, scopeKey, tasks) {
|
|
8393
8484
|
const path = getTaskFilePath(userId, scopeKey);
|
|
8394
|
-
|
|
8485
|
+
mkdirSync13(dirname12(path), { recursive: true });
|
|
8395
8486
|
const payload = { version: 1, tasks };
|
|
8396
8487
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
8397
|
-
|
|
8398
|
-
|
|
8488
|
+
writeFileSync11(tmp, JSON.stringify(payload, null, 2), "utf-8");
|
|
8489
|
+
renameSync8(tmp, path);
|
|
8399
8490
|
}
|
|
8400
8491
|
function taskFileMtimeNs(userId, scopeKey) {
|
|
8401
8492
|
try {
|
|
@@ -9429,12 +9520,12 @@ import { execFile } from "child_process";
|
|
|
9429
9520
|
import { createHash as createHash6, randomUUID as randomUUID9 } from "crypto";
|
|
9430
9521
|
import { existsSync as existsSync18 } from "fs";
|
|
9431
9522
|
import { mkdir, rename, rm, writeFile } from "fs/promises";
|
|
9432
|
-
import { join as
|
|
9523
|
+
import { join as join18 } from "path";
|
|
9433
9524
|
import { promisify } from "util";
|
|
9434
9525
|
function cscPath() {
|
|
9435
9526
|
const windir = process.env.WINDIR ?? process.env.SystemRoot ?? "C:\\Windows";
|
|
9436
9527
|
for (const framework of ["Framework64", "Framework"]) {
|
|
9437
|
-
const candidate =
|
|
9528
|
+
const candidate = join18(windir, "Microsoft.NET", framework, "v4.0.30319", "csc.exe");
|
|
9438
9529
|
if (existsSync18(candidate))
|
|
9439
9530
|
return candidate;
|
|
9440
9531
|
}
|
|
@@ -9442,13 +9533,13 @@ function cscPath() {
|
|
|
9442
9533
|
}
|
|
9443
9534
|
async function ensureCodexWindowsWrapperExe(cacheDir) {
|
|
9444
9535
|
const digest2 = createHash6("sha256").update(CODEX_WINDOWS_WRAPPER_SOURCE).digest("hex").slice(0, 12);
|
|
9445
|
-
const exePath =
|
|
9536
|
+
const exePath = join18(cacheDir, `codex-hook-wrapper-${digest2}.exe`);
|
|
9446
9537
|
if (existsSync18(exePath))
|
|
9447
9538
|
return exePath;
|
|
9448
9539
|
await mkdir(cacheDir, { recursive: true });
|
|
9449
9540
|
const stamp = randomUUID9();
|
|
9450
|
-
const sourcePath =
|
|
9451
|
-
const tempExe =
|
|
9541
|
+
const sourcePath = join18(cacheDir, `wrapper-${stamp}.cs`);
|
|
9542
|
+
const tempExe = join18(cacheDir, `wrapper-${stamp}.exe`);
|
|
9452
9543
|
try {
|
|
9453
9544
|
await writeFile(sourcePath, CODEX_WINDOWS_WRAPPER_SOURCE, "utf8");
|
|
9454
9545
|
await execFileAsync(cscPath(), ["/nologo", "/target:exe", "/optimize+", `/out:${tempExe}`, sourcePath], { windowsHide: true, timeout: 60000 });
|
|
@@ -9565,7 +9656,7 @@ import { existsSync as existsSync19 } from "fs";
|
|
|
9565
9656
|
import { chmod, copyFile, mkdtemp, rm as rm2, writeFile as writeFile2 } from "fs/promises";
|
|
9566
9657
|
import { createServer as createServer3 } from "net";
|
|
9567
9658
|
import { tmpdir as tmpdir3 } from "os";
|
|
9568
|
-
import { dirname as dirname13, join as
|
|
9659
|
+
import { dirname as dirname13, join as join19, resolve as resolve12 } from "path";
|
|
9569
9660
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
9570
9661
|
function evaluateCodexVaultPreToolUse(input, userId, operations) {
|
|
9571
9662
|
if (operations.referencesSensitiveStorage(input.tool_input)) {
|
|
@@ -9621,10 +9712,10 @@ function windowsQuote(value2) {
|
|
|
9621
9712
|
return `"${value2.replaceAll('"', "\\\"")}"`;
|
|
9622
9713
|
}
|
|
9623
9714
|
async function createCodexVaultHookBridge(userId) {
|
|
9624
|
-
const root = await mkdtemp(
|
|
9715
|
+
const root = await mkdtemp(join19(tmpdir3(), "negotium-codex-vault-"));
|
|
9625
9716
|
await chmod(root, 448);
|
|
9626
|
-
const socketPath = ipcEndpoint(
|
|
9627
|
-
const wrapperPath =
|
|
9717
|
+
const socketPath = ipcEndpoint(join19(root, "hook.sock"));
|
|
9718
|
+
const wrapperPath = join19(root, IS_WINDOWS2 ? "codex-with-hooks.exe" : "codex-with-hooks");
|
|
9628
9719
|
const token = randomBytes7(32).toString("hex");
|
|
9629
9720
|
const connections = new Set;
|
|
9630
9721
|
const server = createServer3((socket) => {
|
|
@@ -9675,9 +9766,9 @@ async function createCodexVaultHookBridge(userId) {
|
|
|
9675
9766
|
restrictIpcEndpoint(socketPath);
|
|
9676
9767
|
if (IS_WINDOWS2) {
|
|
9677
9768
|
const { BINARIES_DIR: BINARIES_DIR2 } = await Promise.resolve().then(() => (init_config(), exports_config));
|
|
9678
|
-
const cached = await ensureCodexWindowsWrapperExe(
|
|
9769
|
+
const cached = await ensureCodexWindowsWrapperExe(join19(BINARIES_DIR2, "codex-hook-wrapper"));
|
|
9679
9770
|
await copyFile(cached, wrapperPath);
|
|
9680
|
-
await writeFile2(
|
|
9771
|
+
await writeFile2(join19(root, "codex-with-hooks.cfg"), [process.execPath, codexCliScriptPath(), socketPath, token].join(`
|
|
9681
9772
|
`), { encoding: "utf8", mode: 384 });
|
|
9682
9773
|
} else {
|
|
9683
9774
|
await writeFile2(wrapperPath, privateCodexWrapper(codexCliScriptPath(), socketPath, token), {
|
|
@@ -10254,7 +10345,7 @@ __export(exports_codex_provider, {
|
|
|
10254
10345
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
10255
10346
|
import { existsSync as existsSync20, readFileSync as readFileSync16, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
|
|
10256
10347
|
import { homedir as homedir6 } from "os";
|
|
10257
|
-
import { dirname as dirname14, isAbsolute as isAbsolute4, join as
|
|
10348
|
+
import { dirname as dirname14, isAbsolute as isAbsolute4, join as join20, relative as relative3, resolve as resolve14 } from "path";
|
|
10258
10349
|
import { Codex } from "@openai/codex-sdk";
|
|
10259
10350
|
function sameCodexUsage(usage, total) {
|
|
10260
10351
|
return usage.input_tokens === total.inputTokens && usage.output_tokens === total.outputTokens && (usage.cached_input_tokens ?? 0) === total.cachedInputTokens && (usage.cache_write_input_tokens ?? 0) === total.cacheWriteInputTokens;
|
|
@@ -10282,7 +10373,7 @@ function codexMcpServerName(name) {
|
|
|
10282
10373
|
return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
|
|
10283
10374
|
}
|
|
10284
10375
|
function globalCodexMcpServerNames(authFilePath) {
|
|
10285
|
-
const configPath =
|
|
10376
|
+
const configPath = join20(dirname14(authFilePath), "config.toml");
|
|
10286
10377
|
if (!existsSync20(configPath))
|
|
10287
10378
|
return [];
|
|
10288
10379
|
try {
|
|
@@ -10645,7 +10736,7 @@ async function* codexProvider(opts) {
|
|
|
10645
10736
|
mcpServerCount: Object.keys(codexMcpServers).length
|
|
10646
10737
|
}, "codexProvider: starting turn");
|
|
10647
10738
|
const hostedCodexHome = hostedCodexHomePath();
|
|
10648
|
-
const inheritedCodexHome = process.env.CODEX_HOME ||
|
|
10739
|
+
const inheritedCodexHome = process.env.CODEX_HOME || join20(homedir6(), ".codex");
|
|
10649
10740
|
const codexEnvironment = scopedBrowserCapability || resolve14(hostedCodexHome) !== resolve14(inheritedCodexHome) ? {
|
|
10650
10741
|
...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
|
|
10651
10742
|
CODEX_HOME: hostedCodexHome,
|
|
@@ -11097,7 +11188,7 @@ var init_maestro_provider = __esm(async () => {
|
|
|
11097
11188
|
// ../../packages/core/src/agents/index.ts
|
|
11098
11189
|
import { existsSync as existsSync21 } from "fs";
|
|
11099
11190
|
import { homedir as homedir7 } from "os";
|
|
11100
|
-
import { join as
|
|
11191
|
+
import { join as join21 } from "path";
|
|
11101
11192
|
async function* dispatchAgent(opts) {
|
|
11102
11193
|
switch (opts.agent) {
|
|
11103
11194
|
case "claude": {
|
|
@@ -11131,11 +11222,11 @@ async function resolveSessionFileMissing(agent, sessionId, cwd) {
|
|
|
11131
11222
|
switch (agent) {
|
|
11132
11223
|
case "claude": {
|
|
11133
11224
|
const encodedCwd = encodeClaudeCwd(cwd);
|
|
11134
|
-
const path =
|
|
11225
|
+
const path = join21(homedir7(), ".claude", "projects", encodedCwd, `${sessionId}.jsonl`);
|
|
11135
11226
|
return !existsSync21(path);
|
|
11136
11227
|
}
|
|
11137
11228
|
case "codex": {
|
|
11138
|
-
const sessionsDir =
|
|
11229
|
+
const sessionsDir = join21(hostedCodexHomePath(), "sessions");
|
|
11139
11230
|
const glob = new Bun.Glob(`**/rollout-*-${sessionId}.jsonl`);
|
|
11140
11231
|
for await (const _rel of glob.scan({ cwd: sessionsDir, onlyFiles: true })) {
|
|
11141
11232
|
return false;
|
|
@@ -11705,9 +11796,9 @@ var init_api_topic_brief = __esm(async () => {
|
|
|
11705
11796
|
});
|
|
11706
11797
|
|
|
11707
11798
|
// ../../packages/core/src/storage/wiki.ts
|
|
11708
|
-
import { basename as
|
|
11799
|
+
import { basename as basename5, dirname as dirname15, join as join22 } from "path";
|
|
11709
11800
|
function getSharedWikiDir(workspaceDir = resolveStorageWorkspaceDir()) {
|
|
11710
|
-
return workspaceDir === resolveStorageWorkspaceDir() ? resolveStorageSharedWikiDir() :
|
|
11801
|
+
return workspaceDir === resolveStorageWorkspaceDir() ? resolveStorageSharedWikiDir() : join22(workspaceDir, "wiki");
|
|
11711
11802
|
}
|
|
11712
11803
|
var init_wiki = __esm(async () => {
|
|
11713
11804
|
await init_storage_host();
|
|
@@ -11716,7 +11807,7 @@ var init_wiki = __esm(async () => {
|
|
|
11716
11807
|
// ../../packages/core/src/agents/archiver.ts
|
|
11717
11808
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
11718
11809
|
import { existsSync as existsSync22, readdirSync as readdirSync5, readFileSync as readFileSync18, statSync as statSync7 } from "fs";
|
|
11719
|
-
import { join as
|
|
11810
|
+
import { join as join23 } from "path";
|
|
11720
11811
|
function resolveMemoryLanguage() {
|
|
11721
11812
|
const override = process.env.NEGOTIUM_MEMORY_LANG?.trim();
|
|
11722
11813
|
return override && override.length > 0 ? override : resolveOutputLanguage();
|
|
@@ -11970,10 +12061,10 @@ function distillOneLine(summaryMd) {
|
|
|
11970
12061
|
return "";
|
|
11971
12062
|
}
|
|
11972
12063
|
function findSummaryFile(storage, topicTitle, date, sinceMs, topicId) {
|
|
11973
|
-
const dir =
|
|
12064
|
+
const dir = join23(storage.getWikiDir(), "summaries");
|
|
11974
12065
|
if (!storage.fileExists(dir))
|
|
11975
12066
|
return null;
|
|
11976
|
-
const predicted =
|
|
12067
|
+
const predicted = join23(dir, wikiSummaryFilename(date, topicTitle, topicId));
|
|
11977
12068
|
if (storage.fileExists(predicted) && storage.fileModifiedAt(predicted) >= sinceMs)
|
|
11978
12069
|
return predicted;
|
|
11979
12070
|
let best = null;
|
|
@@ -11981,7 +12072,7 @@ function findSummaryFile(storage, topicTitle, date, sinceMs, topicId) {
|
|
|
11981
12072
|
if (!f.startsWith(`${date}-`) || !isTopicSummaryFile(f, topicId ?? "", topicTitle)) {
|
|
11982
12073
|
continue;
|
|
11983
12074
|
}
|
|
11984
|
-
const p =
|
|
12075
|
+
const p = join23(dir, f);
|
|
11985
12076
|
try {
|
|
11986
12077
|
const m = storage.fileModifiedAt(p);
|
|
11987
12078
|
if (m >= sinceMs && (!best || m > best.mtime))
|
|
@@ -12194,15 +12285,15 @@ function formatTopicArchiveTranscriptRecord(row, topicTitle, index) {
|
|
|
12194
12285
|
}
|
|
12195
12286
|
|
|
12196
12287
|
// ../../packages/core/src/storage/topic-archive.ts
|
|
12197
|
-
import { mkdirSync as
|
|
12198
|
-
import { join as
|
|
12288
|
+
import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync12 } from "fs";
|
|
12289
|
+
import { join as join24 } from "path";
|
|
12199
12290
|
function archiveTopicMessages(topicId, topicTitle, options = {}) {
|
|
12200
12291
|
const rows = options.afterRowid !== undefined ? getMessagesForTopicAfterRowid(topicId, options.afterRowid) : getAllMessagesForTopic(topicId);
|
|
12201
12292
|
if (rows.length === 0)
|
|
12202
12293
|
return null;
|
|
12203
12294
|
const safeTopic = sanitizeTopicName(topicTitle, true);
|
|
12204
|
-
const archiveDir =
|
|
12205
|
-
|
|
12295
|
+
const archiveDir = join24(getSharedWikiDir(), "archive");
|
|
12296
|
+
mkdirSync14(archiveDir, { recursive: true });
|
|
12206
12297
|
const date = new Date().toISOString().slice(0, 10);
|
|
12207
12298
|
const reasonSuffix = options.reason && options.reason !== "delete" ? `_${options.reason}` : "";
|
|
12208
12299
|
let filename;
|
|
@@ -12214,9 +12305,9 @@ function archiveTopicMessages(topicId, topicTitle, options = {}) {
|
|
|
12214
12305
|
let path;
|
|
12215
12306
|
while (true) {
|
|
12216
12307
|
filename = `${safeTopic}_${date}${reasonSuffix}${counter === 1 ? "" : `_${counter}`}.jsonl`;
|
|
12217
|
-
path =
|
|
12308
|
+
path = join24(archiveDir, filename);
|
|
12218
12309
|
try {
|
|
12219
|
-
|
|
12310
|
+
writeFileSync12(path, body, { flag: "wx" });
|
|
12220
12311
|
break;
|
|
12221
12312
|
} catch (err) {
|
|
12222
12313
|
if (err.code !== "EEXIST")
|
|
@@ -12259,8 +12350,8 @@ function archiveConversationEvents(topicId, topicTitle, userId, options = {}) {
|
|
|
12259
12350
|
const entries = readRawConversation(userId, topicTitle);
|
|
12260
12351
|
if (entries.length === 0)
|
|
12261
12352
|
return null;
|
|
12262
|
-
const archiveDir =
|
|
12263
|
-
|
|
12353
|
+
const archiveDir = join24(getSharedWikiDir(), "archive");
|
|
12354
|
+
mkdirSync14(archiveDir, { recursive: true });
|
|
12264
12355
|
const safeTopic = sanitizeTopicName(topicTitle, true);
|
|
12265
12356
|
const date = new Date().toISOString().slice(0, 10);
|
|
12266
12357
|
const reasonSuffix = options.reason && options.reason !== "delete" ? `_${options.reason}` : "";
|
|
@@ -12287,9 +12378,9 @@ function archiveConversationEvents(topicId, topicTitle, userId, options = {}) {
|
|
|
12287
12378
|
let counter = 1;
|
|
12288
12379
|
while (true) {
|
|
12289
12380
|
const suffix = counter === 1 ? "" : `_${counter}`;
|
|
12290
|
-
const path =
|
|
12381
|
+
const path = join24(archiveDir, `${safeTopic}_${date}${reasonSuffix}_events${suffix}.jsonl`);
|
|
12291
12382
|
try {
|
|
12292
|
-
|
|
12383
|
+
writeFileSync12(path, body, { flag: "wx" });
|
|
12293
12384
|
logger.info({ topicId, topicTitle, archive: path, eventCount: entries.length }, "archiveConversationEvents: archived raw conversation events");
|
|
12294
12385
|
return { path, eventCount: entries.length };
|
|
12295
12386
|
} catch (error) {
|
|
@@ -12613,8 +12704,8 @@ var init_idle_archiver = __esm(async () => {
|
|
|
12613
12704
|
|
|
12614
12705
|
// ../../packages/core/src/storage/token-stats.ts
|
|
12615
12706
|
import { createHash as createHash7 } from "crypto";
|
|
12616
|
-
import { mkdirSync as
|
|
12617
|
-
import { join as
|
|
12707
|
+
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync13 } from "fs";
|
|
12708
|
+
import { join as join25 } from "path";
|
|
12618
12709
|
function emptyBucket() {
|
|
12619
12710
|
return {
|
|
12620
12711
|
inputTokens: 0,
|
|
@@ -12632,8 +12723,8 @@ function tokenStatsFileId(userId) {
|
|
|
12632
12723
|
function queriesPath(userId) {
|
|
12633
12724
|
const fileId = tokenStatsFileId(userId);
|
|
12634
12725
|
const logDir = resolveStorageLogDir();
|
|
12635
|
-
|
|
12636
|
-
return
|
|
12726
|
+
mkdirSync15(logDir, { recursive: true });
|
|
12727
|
+
return join25(logDir, `token-queries-${fileId}.jsonl`);
|
|
12637
12728
|
}
|
|
12638
12729
|
function loadRecords(userId) {
|
|
12639
12730
|
try {
|
|
@@ -12702,7 +12793,7 @@ function deleteTopicStats(userId, topicId) {
|
|
|
12702
12793
|
return true;
|
|
12703
12794
|
}
|
|
12704
12795
|
});
|
|
12705
|
-
|
|
12796
|
+
writeFileSync13(path, kept.length > 0 ? `${kept.join(`
|
|
12706
12797
|
`)}
|
|
12707
12798
|
` : "", "utf-8");
|
|
12708
12799
|
} catch (e) {
|
|
@@ -12812,11 +12903,14 @@ var init_token_stats = __esm(async () => {
|
|
|
12812
12903
|
]);
|
|
12813
12904
|
TOKEN_PRICES = {
|
|
12814
12905
|
"codex:gpt-6-astra": { input: 10, cacheWrite: 12.5, cacheRead: 1, output: 50 },
|
|
12906
|
+
"codex:gpt-6-sol": { input: 2, cacheRead: 0.2, output: 10 },
|
|
12907
|
+
"codex:gpt-6-luna": { input: 0.1, cacheRead: 0.01, output: 0.5 },
|
|
12815
12908
|
"codex:gpt-5.6-sol": { input: 5, cacheRead: 0.5, output: 30 },
|
|
12816
12909
|
"codex:gpt-5.6-terra": { input: 2.5, cacheRead: 0.25, output: 15 },
|
|
12817
12910
|
"codex:gpt-5.6-luna": { input: 1, cacheRead: 0.1, output: 6 },
|
|
12818
12911
|
"claude:fable": { input: 10, cacheWrite: 12.5, cacheRead: 0.25, output: 50 },
|
|
12819
|
-
"claude:opus": { input:
|
|
12912
|
+
"claude:opus": { input: 4, cacheWrite: 5, cacheRead: 0.4, output: 20 },
|
|
12913
|
+
"claude:claude-opus-5-5": { input: 4, cacheWrite: 5, cacheRead: 0.4, output: 20 },
|
|
12820
12914
|
"claude:sonnet": { input: 2, cacheWrite: 2.5, cacheRead: 0.2, output: 10 },
|
|
12821
12915
|
"maestro:kimi-k3": { input: 3, cacheRead: 0.3, output: 15 },
|
|
12822
12916
|
"maestro:kimi-k2.7-code": { input: 0.95, cacheRead: 0.19, output: 4 },
|
|
@@ -12985,7 +13079,7 @@ var init_idle_compact = __esm(async () => {
|
|
|
12985
13079
|
});
|
|
12986
13080
|
|
|
12987
13081
|
// ../../packages/core/src/agents/topic-cleanup.ts
|
|
12988
|
-
import { mkdirSync as
|
|
13082
|
+
import { mkdirSync as mkdirSync16, renameSync as renameSync9, unlinkSync as unlinkSync14, writeFileSync as writeFileSync14 } from "fs";
|
|
12989
13083
|
import { dirname as dirname16 } from "path";
|
|
12990
13084
|
function collectSessionIdsByAgent(entries, extraSessions = []) {
|
|
12991
13085
|
const out = new Map;
|
|
@@ -13052,14 +13146,14 @@ function createTopicLogMaintenance(host) {
|
|
|
13052
13146
|
const path = runtimeHost.activeConversationPath(opts.userId, opts.topicName);
|
|
13053
13147
|
const tempPath = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
13054
13148
|
try {
|
|
13055
|
-
|
|
13056
|
-
|
|
13149
|
+
mkdirSync16(dirname16(path), { recursive: true });
|
|
13150
|
+
writeFileSync14(tempPath, retained.length > 0 ? `${retained.map((entry) => JSON.stringify(entry)).join(`
|
|
13057
13151
|
`)}
|
|
13058
13152
|
` : "", { flag: "wx" });
|
|
13059
|
-
|
|
13153
|
+
renameSync9(tempPath, path);
|
|
13060
13154
|
} catch (e) {
|
|
13061
13155
|
try {
|
|
13062
|
-
|
|
13156
|
+
unlinkSync14(tempPath);
|
|
13063
13157
|
} catch {}
|
|
13064
13158
|
runtimeHost.warn({ err: e, path }, "rotateTopicLogs: conversation replacement failed");
|
|
13065
13159
|
return {
|
|
@@ -13089,7 +13183,7 @@ function createTopicLogMaintenance(host) {
|
|
|
13089
13183
|
runtimeHost.rawConversationPath(userId, topicName)
|
|
13090
13184
|
]) {
|
|
13091
13185
|
try {
|
|
13092
|
-
|
|
13186
|
+
unlinkSync14(path);
|
|
13093
13187
|
} catch (e) {
|
|
13094
13188
|
if (e?.code !== "ENOENT") {
|
|
13095
13189
|
runtimeHost.warn({ err: e, path }, "purgeTopicLogs: conversation log unlink failed");
|
|
@@ -13229,9 +13323,9 @@ __export(exports_session, {
|
|
|
13229
13323
|
AUTO_FORK_COMPACTION_TOKENS: () => AUTO_FORK_COMPACTION_TOKENS
|
|
13230
13324
|
});
|
|
13231
13325
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
13232
|
-
import { mkdtempSync as mkdtempSync2, rmSync as rmSync4, writeFileSync as
|
|
13326
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
13233
13327
|
import { tmpdir as tmpdir4 } from "os";
|
|
13234
|
-
import { join as
|
|
13328
|
+
import { join as join26 } from "path";
|
|
13235
13329
|
async function waitForMemoryArchive(settled, timeoutMs) {
|
|
13236
13330
|
let timer;
|
|
13237
13331
|
try {
|
|
@@ -13546,7 +13640,7 @@ function formatCompactElapsed(startedAt) {
|
|
|
13546
13640
|
async function summarizeTopicContext(request) {
|
|
13547
13641
|
const startedAt = Date.now();
|
|
13548
13642
|
const sessionIds = [];
|
|
13549
|
-
const compactCwd = mkdtempSync2(
|
|
13643
|
+
const compactCwd = mkdtempSync2(join26(tmpdir4(), "negotium-compact-"));
|
|
13550
13644
|
const abortController = new AbortController;
|
|
13551
13645
|
const relayAbort = () => abortController.abort(request.signal?.reason);
|
|
13552
13646
|
if (request.signal?.aborted)
|
|
@@ -13573,7 +13667,7 @@ async function summarizeTopicContext(request) {
|
|
|
13573
13667
|
let error = "";
|
|
13574
13668
|
let toolViolation = false;
|
|
13575
13669
|
let compactionLogCalls = 0;
|
|
13576
|
-
const compactionLogPath =
|
|
13670
|
+
const compactionLogPath = join26(compactCwd, "conversation.log");
|
|
13577
13671
|
try {
|
|
13578
13672
|
const compactionMcp = useCompactionLog ? {
|
|
13579
13673
|
compact_log: {
|
|
@@ -13587,7 +13681,7 @@ async function summarizeTopicContext(request) {
|
|
|
13587
13681
|
}
|
|
13588
13682
|
} : undefined;
|
|
13589
13683
|
if (useCompactionLog)
|
|
13590
|
-
|
|
13684
|
+
writeFileSync15(compactionLogPath, request.source, { mode: 384 });
|
|
13591
13685
|
for await (const event of runAgent({
|
|
13592
13686
|
agent: request.agent,
|
|
13593
13687
|
prompt: useCompactionLog ? [
|
|
@@ -14001,7 +14095,7 @@ __export(exports_derive, {
|
|
|
14001
14095
|
TopicDeriveBusyError: () => TopicDeriveBusyError
|
|
14002
14096
|
});
|
|
14003
14097
|
import { createHash as createHash8, randomUUID as randomUUID12 } from "crypto";
|
|
14004
|
-
import { mkdirSync as
|
|
14098
|
+
import { mkdirSync as mkdirSync17, rmSync as rmSync5, unlinkSync as unlinkSync15 } from "fs";
|
|
14005
14099
|
function getTopics(opts = {}) {
|
|
14006
14100
|
return listTopics(opts).filter((topic) => !isLegacySharedGeneral(topic.id));
|
|
14007
14101
|
}
|
|
@@ -14131,7 +14225,7 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
|
|
|
14131
14225
|
try {
|
|
14132
14226
|
if (agent) {
|
|
14133
14227
|
const cwd = derivedWorkspace;
|
|
14134
|
-
|
|
14228
|
+
mkdirSync17(cwd, { recursive: true });
|
|
14135
14229
|
const registry = getRegistry(agent);
|
|
14136
14230
|
const requestedRolloutModel = subagentModel ?? (subagent?.agent ? undefined : sourceConfig?.model) ?? derived.defaultModel;
|
|
14137
14231
|
const rolloutModel = resolveModelForAgent(agent, requestedRolloutModel, registry);
|
|
@@ -14299,7 +14393,7 @@ async function createDerivedTopicImpl(topic, sourceTopicId, userId, copyHistory,
|
|
|
14299
14393
|
getConversationPath(userId, derived.title)
|
|
14300
14394
|
]) {
|
|
14301
14395
|
try {
|
|
14302
|
-
|
|
14396
|
+
unlinkSync15(path);
|
|
14303
14397
|
} catch {}
|
|
14304
14398
|
}
|
|
14305
14399
|
}
|
|
@@ -14356,14 +14450,14 @@ var init_derive = __esm(async () => {
|
|
|
14356
14450
|
});
|
|
14357
14451
|
|
|
14358
14452
|
// ../../packages/core/src/query/session-inbox-path.ts
|
|
14359
|
-
import { join as
|
|
14453
|
+
import { join as join27 } from "path";
|
|
14360
14454
|
function sessionInboxPath(userId, topicId) {
|
|
14361
14455
|
const key = Buffer.from(topicId, "utf8").toString("base64url");
|
|
14362
|
-
return
|
|
14456
|
+
return join27(SESSION_INBOX_DIR, userId, `${TOPIC_ID_FILE_PREFIX}${key}${JSONL_SUFFIX}`);
|
|
14363
14457
|
}
|
|
14364
14458
|
function scheduledSessionInboxPath(userId, topicId) {
|
|
14365
14459
|
const key = Buffer.from(topicId, "utf8").toString("base64url");
|
|
14366
|
-
return
|
|
14460
|
+
return join27(SESSION_INBOX_DIR, userId, `${TOPIC_ID_FILE_PREFIX}${key}${SCHEDULE_SUFFIX}`);
|
|
14367
14461
|
}
|
|
14368
14462
|
var TOPIC_ID_FILE_PREFIX = "topic-id-", JSONL_SUFFIX = ".jsonl", SCHEDULE_SUFFIX = ".schedule";
|
|
14369
14463
|
var init_session_inbox_path = __esm(() => {
|
|
@@ -14371,12 +14465,12 @@ var init_session_inbox_path = __esm(() => {
|
|
|
14371
14465
|
});
|
|
14372
14466
|
|
|
14373
14467
|
// ../../packages/core/src/storage/session-inbox-signal.ts
|
|
14374
|
-
import { join as
|
|
14468
|
+
import { join as join28 } from "path";
|
|
14375
14469
|
var SESSION_INBOX_WAKE_FILE, listeners;
|
|
14376
14470
|
var init_session_inbox_signal = __esm(() => {
|
|
14377
14471
|
init_config();
|
|
14378
14472
|
init_logger();
|
|
14379
|
-
SESSION_INBOX_WAKE_FILE =
|
|
14473
|
+
SESSION_INBOX_WAKE_FILE = join28(SESSION_INBOX_DIR, ".wake");
|
|
14380
14474
|
listeners = new Set;
|
|
14381
14475
|
});
|
|
14382
14476
|
|
|
@@ -14413,14 +14507,14 @@ var init_session_inbox = __esm(async () => {
|
|
|
14413
14507
|
});
|
|
14414
14508
|
|
|
14415
14509
|
// ../../packages/core/src/query/session-inbox-cleanup.ts
|
|
14416
|
-
import { unlinkSync as
|
|
14417
|
-
import { basename as
|
|
14510
|
+
import { unlinkSync as unlinkSync16 } from "fs";
|
|
14511
|
+
import { basename as basename6, join as join29 } from "path";
|
|
14418
14512
|
function cleanupSessionInboxFiles(userId, topicId, legacyTopicTitle) {
|
|
14419
14513
|
const live = sessionInboxPath(userId, topicId);
|
|
14420
14514
|
const scheduled = scheduledSessionInboxPath(userId, topicId);
|
|
14421
14515
|
const candidates = new Set([live, `${live}.processing`, scheduled, `${scheduled}.processing`]);
|
|
14422
|
-
if (legacyTopicTitle && legacyTopicTitle !== "." && legacyTopicTitle !== ".." &&
|
|
14423
|
-
const legacyBase =
|
|
14516
|
+
if (legacyTopicTitle && legacyTopicTitle !== "." && legacyTopicTitle !== ".." && basename6(legacyTopicTitle) === legacyTopicTitle) {
|
|
14517
|
+
const legacyBase = join29(SESSION_INBOX_DIR, userId, legacyTopicTitle);
|
|
14424
14518
|
for (const suffix of [".jsonl", ".jsonl.processing", ".schedule", ".schedule.processing"]) {
|
|
14425
14519
|
candidates.add(`${legacyBase}${suffix}`);
|
|
14426
14520
|
}
|
|
@@ -14428,7 +14522,7 @@ function cleanupSessionInboxFiles(userId, topicId, legacyTopicTitle) {
|
|
|
14428
14522
|
let deleted = deleteSessionInboxForTopic(topicId);
|
|
14429
14523
|
for (const path of candidates) {
|
|
14430
14524
|
try {
|
|
14431
|
-
|
|
14525
|
+
unlinkSync16(path);
|
|
14432
14526
|
deleted++;
|
|
14433
14527
|
} catch (err) {
|
|
14434
14528
|
if (err?.code !== "ENOENT") {
|
|
@@ -14445,64 +14539,6 @@ var init_session_inbox_cleanup = __esm(async () => {
|
|
|
14445
14539
|
await init_session_inbox();
|
|
14446
14540
|
});
|
|
14447
14541
|
|
|
14448
|
-
// ../../packages/core/src/query/state.ts
|
|
14449
|
-
import { mkdirSync as mkdirSync17, renameSync as renameSync9, unlinkSync as unlinkSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
14450
|
-
import { basename as basename6, join as join29 } from "path";
|
|
14451
|
-
function createQueryStateStore(options) {
|
|
14452
|
-
const sanitize = options.sanitizeTopicId ?? sanitizeId;
|
|
14453
|
-
const queryStateDirPath = (userId) => join29(options.usersLogDir, String(userId), "active-queries");
|
|
14454
|
-
const queryStateFile = (userId, topicId) => join29(queryStateDirPath(userId), `${sanitize(topicId)}.json`);
|
|
14455
|
-
const legacyQueryStateFile = (userId, topicName) => {
|
|
14456
|
-
if (!topicName || topicName === "." || topicName === ".." || basename6(topicName) !== topicName) {
|
|
14457
|
-
return null;
|
|
14458
|
-
}
|
|
14459
|
-
return join29(queryStateDirPath(userId), `${topicName}.json`);
|
|
14460
|
-
};
|
|
14461
|
-
return {
|
|
14462
|
-
write(userId, topicId, topicName, task) {
|
|
14463
|
-
const dir = queryStateDirPath(userId);
|
|
14464
|
-
mkdirSync17(dir, { recursive: true });
|
|
14465
|
-
const state = { topicId, topicName, since: new Date().toISOString() };
|
|
14466
|
-
if (task)
|
|
14467
|
-
state.task = [...task.replace(/\n+/g, " ").trim()].slice(0, 100).join("");
|
|
14468
|
-
const target = queryStateFile(userId, topicId);
|
|
14469
|
-
const tmp = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
14470
|
-
writeFileSync15(tmp, JSON.stringify(state));
|
|
14471
|
-
renameSync9(tmp, target);
|
|
14472
|
-
},
|
|
14473
|
-
clear(userId, topicId, legacyTopicName) {
|
|
14474
|
-
const paths = [
|
|
14475
|
-
queryStateFile(userId, topicId),
|
|
14476
|
-
legacyQueryStateFile(userId, legacyTopicName)
|
|
14477
|
-
].filter((path) => Boolean(path));
|
|
14478
|
-
for (const path of new Set(paths)) {
|
|
14479
|
-
try {
|
|
14480
|
-
unlinkSync16(path);
|
|
14481
|
-
} catch (error) {
|
|
14482
|
-
if (error?.code !== "ENOENT") {
|
|
14483
|
-
options.logger?.warn({ err: error, userId, topicId, path }, "Failed to clear query state file");
|
|
14484
|
-
}
|
|
14485
|
-
}
|
|
14486
|
-
}
|
|
14487
|
-
}
|
|
14488
|
-
};
|
|
14489
|
-
}
|
|
14490
|
-
function writeQueryState(userId, topicId, topicName, task) {
|
|
14491
|
-
defaultQueryStateStore.write(userId, topicId, topicName, task);
|
|
14492
|
-
}
|
|
14493
|
-
function clearQueryState(userId, topicId, legacyTopicName) {
|
|
14494
|
-
defaultQueryStateStore.clear(userId, topicId, legacyTopicName);
|
|
14495
|
-
}
|
|
14496
|
-
var defaultQueryStateStore;
|
|
14497
|
-
var init_state = __esm(() => {
|
|
14498
|
-
init_config();
|
|
14499
|
-
init_logger();
|
|
14500
|
-
defaultQueryStateStore = createQueryStateStore({
|
|
14501
|
-
usersLogDir: USERS_LOG_DIR,
|
|
14502
|
-
logger
|
|
14503
|
-
});
|
|
14504
|
-
});
|
|
14505
|
-
|
|
14506
14542
|
// ../../packages/core/src/mcp/session-comm/peer-forward.ts
|
|
14507
14543
|
var exports_peer_forward = {};
|
|
14508
14544
|
__export(exports_peer_forward, {
|
|
@@ -19298,6 +19334,12 @@ var init_auth_check = __esm(async () => {
|
|
|
19298
19334
|
|
|
19299
19335
|
// ../../packages/core/src/agents/mcp-tools/spawn-subagent.ts
|
|
19300
19336
|
import { z as z5 } from "zod";
|
|
19337
|
+
function activeQueryUserId(topic) {
|
|
19338
|
+
return topic?.participants.find((participant) => hasActiveQuery(participant.userId, topic.id))?.userId;
|
|
19339
|
+
}
|
|
19340
|
+
function persistedWatchUserId(topic) {
|
|
19341
|
+
return activeQueryUserId(topic) ?? topic?.participants.find((participant) => participant.role === "owner")?.userId ?? topic?.participants[0]?.userId;
|
|
19342
|
+
}
|
|
19301
19343
|
function createSubagentLifecycle(host) {
|
|
19302
19344
|
const runtimeOwnerId = host.runtime.ownerId;
|
|
19303
19345
|
const limits = Object.freeze({
|
|
@@ -19412,7 +19454,7 @@ function createSubagentLifecycle(host) {
|
|
|
19412
19454
|
}
|
|
19413
19455
|
function watchFromPersistedCard(message, card, queryId) {
|
|
19414
19456
|
const child = host.storage.getTopic(card.subagentTopicId);
|
|
19415
|
-
const userId = child
|
|
19457
|
+
const userId = persistedWatchUserId(child);
|
|
19416
19458
|
if (!userId)
|
|
19417
19459
|
return null;
|
|
19418
19460
|
return {
|
|
@@ -19771,6 +19813,10 @@ ${card.task}${reportInstruction}`;
|
|
|
19771
19813
|
if (watch?.running)
|
|
19772
19814
|
return "running";
|
|
19773
19815
|
const card = host.storage.listSubagentMessages().filter((message) => message.topicId === parentTopicId && message.subagentCard?.subagentTopicId === childTopicId).at(-1)?.subagentCard;
|
|
19816
|
+
if (!card || card.status === "failed") {
|
|
19817
|
+
if (activeQueryUserId(host.storage.getTopic(childTopicId)))
|
|
19818
|
+
return "running";
|
|
19819
|
+
}
|
|
19774
19820
|
return card?.status ?? "unknown";
|
|
19775
19821
|
}
|
|
19776
19822
|
function listMemoryTopicNames(ctx) {
|
|
@@ -19994,6 +20040,7 @@ var MAX_TASK_CHARS = 8000, MAX_NAME_CHARS = 80, MAX_LIVE_CHILDREN_PER_PARENT = 5
|
|
|
19994
20040
|
var init_spawn_subagent = __esm(async () => {
|
|
19995
20041
|
init_common();
|
|
19996
20042
|
init_logger();
|
|
20043
|
+
init_state();
|
|
19997
20044
|
init_wiki_summary_names();
|
|
19998
20045
|
init_types();
|
|
19999
20046
|
await __promiseAll([
|
|
@@ -20090,7 +20137,9 @@ var init_spawn_subagent = __esm(async () => {
|
|
|
20090
20137
|
if (getRuntimeUserTurnRequest(childTopicId))
|
|
20091
20138
|
return true;
|
|
20092
20139
|
const lease = getRuntimeTurnLease(childTopicId);
|
|
20093
|
-
|
|
20140
|
+
if (lease && processOwnerIsAlive(lease.ownerId))
|
|
20141
|
+
return true;
|
|
20142
|
+
return Boolean(activeQueryUserId(getTopic(childTopicId)));
|
|
20094
20143
|
}
|
|
20095
20144
|
},
|
|
20096
20145
|
config: {
|
|
@@ -23383,4 +23432,4 @@ export {
|
|
|
23383
23432
|
createAgentHealthMcpServer
|
|
23384
23433
|
};
|
|
23385
23434
|
|
|
23386
|
-
//# debugId=
|
|
23435
|
+
//# debugId=8058FA42EBEC001764756E2164756E21
|