@otium-team/negotium 0.24.0 → 0.24.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 +61 -25
- package/dist/agent-helpers.js.map +9 -9
- package/dist/background-bash.js +3 -2
- package/dist/background-bash.js.map +3 -3
- package/dist/browser-runtime.js +21 -5
- package/dist/browser-runtime.js.map +5 -5
- package/dist/{chunk-fzfzskjq.js → chunk-7jdavm0e.js} +20 -4
- package/dist/{chunk-fzfzskjq.js.map → chunk-7jdavm0e.js.map} +4 -4
- package/dist/{chunk-3r4xfhkx.js → chunk-8nr3h475.js} +3 -3
- package/dist/{chunk-3r4xfhkx.js.map → chunk-8nr3h475.js.map} +2 -2
- package/dist/{chunk-hn2cqdd0.js → chunk-q701c7k3.js} +1 -1
- package/dist/{chunk-pesnv5zv.js → chunk-r3q0kjed.js} +4 -3
- package/dist/{chunk-pesnv5zv.js.map → chunk-r3q0kjed.js.map} +3 -3
- package/dist/{chunk-d1c2wt8q.js → chunk-wcs8ztpt.js} +4 -2
- package/dist/{chunk-d1c2wt8q.js.map → chunk-wcs8ztpt.js.map} +1 -1
- package/dist/hosted-agent.js +22 -6
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +161 -46
- package/dist/main.js.map +13 -13
- package/dist/mcp-factories.js +61 -25
- package/dist/mcp-factories.js.map +9 -9
- package/dist/media.js +3 -2
- package/dist/media.js.map +3 -3
- package/dist/prompts.js +3 -2
- package/dist/prompts.js.map +3 -3
- package/dist/query-runtime.js +3 -2
- package/dist/query-runtime.js.map +3 -3
- package/dist/registry.js +3 -3
- package/dist/rollout.js +2 -2
- package/dist/runtime/src/agents/mcp-tools/ask-user.ts +56 -1
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +86 -0
- package/dist/runtime/src/application/topic-service.ts +11 -1
- package/dist/runtime/src/application/turn-follow-ups.ts +7 -0
- package/dist/runtime/src/platform/config.ts +9 -1
- package/dist/runtime/src/platform/playwright/vault-broker.ts +6 -2
- package/dist/runtime/src/runtime/turn-runner.ts +58 -23
- package/dist/runtime/src/storage/vault-public.ts +1 -0
- package/dist/runtime/src/storage/vault.ts +36 -4
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js +3 -2
- package/dist/runtime-helpers.js.map +3 -3
- package/dist/types/packages/core/src/agents/mcp-tools/ask-user.d.ts +14 -0
- package/dist/types/packages/core/src/platform/config.d.ts +9 -1
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +12 -0
- package/dist/types/packages/core/src/storage/vault-public.d.ts +1 -1
- package/dist/types/packages/core/src/storage/vault.d.ts +10 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +27 -5
- package/dist/vault.js.map +4 -4
- package/install-browser-rs.mjs +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-hn2cqdd0.js.map → chunk-q701c7k3.js.map} +0 -0
package/dist/mcp-factories.js
CHANGED
|
@@ -662,7 +662,7 @@ function resolveWhisperBackend() {
|
|
|
662
662
|
function codexAuthFilePath() {
|
|
663
663
|
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join2(process.env.CODEX_HOME || join2(homedir2(), ".codex"), "auth.json");
|
|
664
664
|
}
|
|
665
|
-
var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_BACKEND, 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.
|
|
665
|
+
var HOME, PROJECT_ROOT, STATE_DIR, WORKSPACE_DIR, TOPIC_WORKSPACE_DIR, SHARED_WIKI_DIR, CRON_WORKSPACE_DIR, BROWSER_DIR, BROWSER_BACKEND, 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.8.1", 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, SESSION_HISTORY_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, VAULT_SHARED_USER_ID, NEGOTIUM_PORT, hostname, DATA_DIR, LOG_DIR, UPLOADS_DIR, VAULT_DIR, SESSIONS_DB, DEBUG_FILE, USERS_LOG_DIR, RUN_DIR, PROGRESS_DIR, DM_CMD_DIR, DM_RESP_DIR, SESSION_INBOX_DIR, SESSION_ASKS_DIR, BASHRS_SPILL_ROOT, PLAYWRIGHT_BASE_PORT, PLAYWRIGHT_MAX_PORT, PLAYWRIGHT_PORTS_DIR, ACTIVE_QUERY_STALE_MS, AGENTS_PROMPTS_DIR, RESOURCES_DIR, ABSOLUTE_PATH_PREFIX, FILE_EXTENSIONS_REGEX, FILE_TAG_REGEX, MODEL_SONNET = "claude-sonnet-5", MODEL_OPUS = "claude-opus-5-5", MODEL_FABLE = "claude-fable-5-1", MODEL_FABLE_5_2 = "claude-fable-5-2", 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;
|
|
666
666
|
var init_config = __esm(() => {
|
|
667
667
|
init_browser_backend();
|
|
668
668
|
init_config_helpers();
|
|
@@ -711,6 +711,7 @@ var init_config = __esm(() => {
|
|
|
711
711
|
NODE_ID = loadOrCreateLocalSecret("NEGOTIUM_NODE_ID", "node-id");
|
|
712
712
|
VAULT_MASTER_KEY = loadOrCreateLocalSecret("NEGOTIUM_VAULT_MASTER_KEY", "vault-master-key", { persistEnvValue: true });
|
|
713
713
|
delete process.env.NEGOTIUM_VAULT_MASTER_KEY;
|
|
714
|
+
VAULT_SHARED_USER_ID = process.env.NEGOTIUM_VAULT_SHARED_USER?.trim() || undefined;
|
|
714
715
|
NEGOTIUM_PORT = parseInt(process.env.NEGOTIUM_PORT || "7777", 10);
|
|
715
716
|
hostname = process.env.HOSTNAME || "127.0.0.1";
|
|
716
717
|
DATA_DIR = resolveLocalStateDir("NEGOTIUM_DATA_DIR", "data");
|
|
@@ -4534,6 +4535,9 @@ var init_vault_crypto = __esm(() => {
|
|
|
4534
4535
|
// ../../packages/core/src/storage/vault.ts
|
|
4535
4536
|
import { chmodSync as chmodSync3, mkdirSync as mkdirSync7 } from "fs";
|
|
4536
4537
|
import { join as join7 } from "path";
|
|
4538
|
+
function sharedOwnerFor(userId) {
|
|
4539
|
+
return vaultSharedUserId && vaultSharedUserId !== userId ? vaultSharedUserId : undefined;
|
|
4540
|
+
}
|
|
4537
4541
|
function initializeVaultDatabase(database) {
|
|
4538
4542
|
database.exec("PRAGMA journal_mode = WAL");
|
|
4539
4543
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -4626,13 +4630,20 @@ function vaultGetValue(userId, key) {
|
|
|
4626
4630
|
const row = activeVaultDatabase().prepare("SELECT key, value FROM vault WHERE user_id = ? AND key = ?").get(userId, normalizedKey);
|
|
4627
4631
|
return row ? decryptRow(userId, row.key, row.value) : undefined;
|
|
4628
4632
|
}
|
|
4633
|
+
function vaultResolveValue(userId, key) {
|
|
4634
|
+
const own = vaultGetValue(userId, key);
|
|
4635
|
+
if (own !== undefined)
|
|
4636
|
+
return own;
|
|
4637
|
+
const shared = sharedOwnerFor(userId);
|
|
4638
|
+
return shared ? vaultGetValue(shared, key) : undefined;
|
|
4639
|
+
}
|
|
4629
4640
|
function vaultSubstituteDetailed(userId, text) {
|
|
4630
4641
|
const entries = new Map;
|
|
4631
4642
|
const usedKeys = new Set;
|
|
4632
4643
|
const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
|
|
4633
4644
|
const key = normalizeVaultKey(rawKey);
|
|
4634
4645
|
if (!entries.has(key))
|
|
4635
|
-
entries.set(key,
|
|
4646
|
+
entries.set(key, vaultResolveValue(userId, key));
|
|
4636
4647
|
const value = entries.get(key);
|
|
4637
4648
|
if (value === undefined)
|
|
4638
4649
|
return match;
|
|
@@ -4653,7 +4664,11 @@ function encodedSecretForms(value) {
|
|
|
4653
4664
|
return [...forms].sort((a, b) => b.length - a.length);
|
|
4654
4665
|
}
|
|
4655
4666
|
function redactVaultSecrets(userId, text) {
|
|
4656
|
-
const
|
|
4667
|
+
const shared = sharedOwnerFor(userId);
|
|
4668
|
+
const candidates = [
|
|
4669
|
+
...vaultListDecryptableValues(userId),
|
|
4670
|
+
...shared ? vaultListDecryptableValues(shared) : []
|
|
4671
|
+
].flatMap((entry) => encodedSecretForms(entry.value).map((form) => ({ form, key: entry.key }))).sort((a, b) => b.form.length - a.form.length || a.key.localeCompare(b.key));
|
|
4657
4672
|
if (candidates.length === 0)
|
|
4658
4673
|
return text;
|
|
4659
4674
|
const candidatesByFirstCharacter = new Map;
|
|
@@ -4679,7 +4694,7 @@ function redactVaultSecrets(userId, text) {
|
|
|
4679
4694
|
}
|
|
4680
4695
|
return redacted;
|
|
4681
4696
|
}
|
|
4682
|
-
var vaultDb, vaultMasterKey, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
|
|
4697
|
+
var vaultDb, vaultMasterKey, vaultSharedUserId, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
|
|
4683
4698
|
var init_vault = __esm(async () => {
|
|
4684
4699
|
init_config();
|
|
4685
4700
|
init_vault_crypto();
|
|
@@ -4688,6 +4703,7 @@ var init_vault = __esm(async () => {
|
|
|
4688
4703
|
init_storage_host()
|
|
4689
4704
|
]);
|
|
4690
4705
|
vaultMasterKey = VAULT_MASTER_KEY;
|
|
4706
|
+
vaultSharedUserId = VAULT_SHARED_USER_ID;
|
|
4691
4707
|
VAULT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/;
|
|
4692
4708
|
VAULT_VALUE_MAX_BYTES = 64 * 1024;
|
|
4693
4709
|
});
|
|
@@ -5348,7 +5364,7 @@ var init_codex = __esm(async () => {
|
|
|
5348
5364
|
});
|
|
5349
5365
|
|
|
5350
5366
|
// ../../packages/core/src/version.ts
|
|
5351
|
-
var NEGOTIUM_VERSION = "0.24.
|
|
5367
|
+
var NEGOTIUM_VERSION = "0.24.2";
|
|
5352
5368
|
|
|
5353
5369
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
5354
5370
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -7744,7 +7760,7 @@ async function createBrowserVaultBroker(userId) {
|
|
|
7744
7760
|
const substituted = deepMapStrings(request.value, (text) => {
|
|
7745
7761
|
const result = vaultSubstituteDetailed(userId, text);
|
|
7746
7762
|
for (const key of result.usedKeys) {
|
|
7747
|
-
const secret =
|
|
7763
|
+
const secret = vaultResolveValue(userId, key);
|
|
7748
7764
|
if (secret === undefined)
|
|
7749
7765
|
continue;
|
|
7750
7766
|
for (const form of encodedSecretForms2(secret))
|
|
@@ -18299,8 +18315,8 @@ function answerToolResult(answer) {
|
|
|
18299
18315
|
return textResult("The user skipped this question. Continue using your best judgment and finish the current turn.");
|
|
18300
18316
|
}
|
|
18301
18317
|
if (answer.kind === "custom") {
|
|
18302
|
-
return textResult(`
|
|
18303
|
-
Continue from this answer and finish the current turn.`);
|
|
18318
|
+
return textResult(`The user did not pick a listed option. They typed this reply in the chat instead: "${answer.label}"
|
|
18319
|
+
Treat it as their free-text answer to your question and read it for what it says. If it hands the decision back to you (for example "decide yourself" or "you handle it"), choose the best option yourself and go on. Continue from this answer and finish the current turn.`);
|
|
18304
18320
|
}
|
|
18305
18321
|
const description = answer.description ? `
|
|
18306
18322
|
Description: ${answer.description}` : "";
|
|
@@ -18392,6 +18408,7 @@ function createAskUserRuntime(host) {
|
|
|
18392
18408
|
id: createId(),
|
|
18393
18409
|
topicId,
|
|
18394
18410
|
authorId: userId,
|
|
18411
|
+
...options.answerMessage,
|
|
18395
18412
|
text: label,
|
|
18396
18413
|
parentId: messageId,
|
|
18397
18414
|
...existing.threadRootId ? { threadRootId: existing.threadRootId } : {},
|
|
@@ -18410,6 +18427,20 @@ function createAskUserRuntime(host) {
|
|
|
18410
18427
|
pending.resolve({ ...choice, userId, ...kind ? { kind } : {} });
|
|
18411
18428
|
return { ok: true, queryId: pending.queryId, answerMessage };
|
|
18412
18429
|
}
|
|
18430
|
+
function answerOpenQuestionWithText(topicId, text, userId, options = {}) {
|
|
18431
|
+
for (const [messageId, pending] of pendingAsks) {
|
|
18432
|
+
if (pending.topicId !== topicId)
|
|
18433
|
+
continue;
|
|
18434
|
+
const card = host.messaging.persistence.getMessage(topicId, messageId);
|
|
18435
|
+
if ((card?.threadRootId ?? undefined) !== (options.threadRootId ?? undefined))
|
|
18436
|
+
continue;
|
|
18437
|
+
return answerPendingQuestion(topicId, messageId, text, userId, {
|
|
18438
|
+
kind: "custom",
|
|
18439
|
+
...options.answerMessage ? { answerMessage: options.answerMessage } : {}
|
|
18440
|
+
});
|
|
18441
|
+
}
|
|
18442
|
+
return null;
|
|
18443
|
+
}
|
|
18413
18444
|
function cancelPendingQuestions(topicId, queryId) {
|
|
18414
18445
|
for (const [messageId, pending] of pendingAsks) {
|
|
18415
18446
|
if (pending.topicId === topicId && pending.queryId === queryId) {
|
|
@@ -18565,6 +18596,7 @@ function createAskUserRuntime(host) {
|
|
|
18565
18596
|
reconcilePendingGates,
|
|
18566
18597
|
hasPendingQuestion,
|
|
18567
18598
|
answerPendingQuestion,
|
|
18599
|
+
answerOpenQuestionWithText,
|
|
18568
18600
|
cancelPendingQuestions,
|
|
18569
18601
|
createToolDefinition
|
|
18570
18602
|
};
|
|
@@ -21190,22 +21222,7 @@ function startAiTurn(params) {
|
|
|
21190
21222
|
];
|
|
21191
21223
|
}
|
|
21192
21224
|
}
|
|
21193
|
-
|
|
21194
|
-
const runningInject = running.injectParams;
|
|
21195
|
-
const requeuedInject = prepareInjectReplayAfterUserPreemption(runningInject);
|
|
21196
|
-
const queued = deferInject(requeuedInject);
|
|
21197
|
-
running.injectRequeued = queued;
|
|
21198
|
-
if (queued && runningInject.prepareSession) {
|
|
21199
|
-
running.injectParams = { ...runningInject, requestId: undefined };
|
|
21200
|
-
} else if (!queued && runningInject.forkHandle) {
|
|
21201
|
-
cleanupAgentFork(runningInject.forkHandle);
|
|
21202
|
-
running.injectParams = {
|
|
21203
|
-
...runningInject,
|
|
21204
|
-
forkHandle: undefined,
|
|
21205
|
-
sessionId: undefined
|
|
21206
|
-
};
|
|
21207
|
-
}
|
|
21208
|
-
}
|
|
21225
|
+
requeueSessionInjectForUserPreemption(running);
|
|
21209
21226
|
running.abortReason = "internal" /* Internal */;
|
|
21210
21227
|
running.abortController.abort();
|
|
21211
21228
|
logger.info({ topicId, supersededQueryId: running.queryId, supersededOrigin: running.origin }, "ai: new user message superseded running turn");
|
|
@@ -21834,6 +21851,25 @@ To use another registered model, switch with /model <model> and send again.`, th
|
|
|
21834
21851
|
});
|
|
21835
21852
|
return queryId;
|
|
21836
21853
|
}
|
|
21854
|
+
function requeueSessionInjectForUserPreemption(running) {
|
|
21855
|
+
const runningInject = running.injectParams;
|
|
21856
|
+
if (!runningInject)
|
|
21857
|
+
return false;
|
|
21858
|
+
const requeuedInject = prepareInjectReplayAfterUserPreemption(runningInject);
|
|
21859
|
+
const queued = deferInject(requeuedInject);
|
|
21860
|
+
running.injectRequeued = queued;
|
|
21861
|
+
if (queued && runningInject.prepareSession) {
|
|
21862
|
+
running.injectParams = { ...runningInject, requestId: undefined };
|
|
21863
|
+
} else if (!queued && runningInject.forkHandle) {
|
|
21864
|
+
cleanupAgentFork(runningInject.forkHandle);
|
|
21865
|
+
running.injectParams = {
|
|
21866
|
+
...runningInject,
|
|
21867
|
+
forkHandle: undefined,
|
|
21868
|
+
sessionId: undefined
|
|
21869
|
+
};
|
|
21870
|
+
}
|
|
21871
|
+
return queued;
|
|
21872
|
+
}
|
|
21837
21873
|
function wasLocallyRequeuedAfterUserPreemption(outcomeKind, control) {
|
|
21838
21874
|
return outcomeKind === "aborted" && control.abortReason === "internal" /* Internal */ && Boolean(control.injectParams) && control.injectRequeued === true;
|
|
21839
21875
|
}
|
|
@@ -26601,4 +26637,4 @@ export {
|
|
|
26601
26637
|
protectMcpStdio
|
|
26602
26638
|
};
|
|
26603
26639
|
|
|
26604
|
-
//# debugId=
|
|
26640
|
+
//# debugId=5CD5CC0F77B53CCA64756E2164756E21
|