@otium-team/negotium 0.24.1 → 0.24.3
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/bin/negotium.mjs +0 -0
- package/dist/agent-helpers.js +43 -23
- 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 +6 -6
- 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-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-kfckfff2.js → chunk-rpymxwjr.js} +3 -3
- package/dist/{chunk-kfckfff2.js.map → chunk-rpymxwjr.js.map} +2 -2
- 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 +107 -44
- package/dist/main.js.map +14 -14
- package/dist/mcp-factories.js +43 -23
- 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/application/submit-runtime-gateway-turn.ts +15 -0
- package/dist/runtime/src/application/topic-service.ts +11 -1
- package/dist/runtime/src/mcp/session-history-server.ts +0 -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/browser-profiles.ts +16 -0
- package/dist/runtime/src/storage/vault-public.ts +1 -0
- package/dist/runtime/src/storage/vault.ts +36 -4
- package/dist/runtime/src/topics/update.ts +22 -1
- 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/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/browser-profiles.d.ts +7 -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/main.js
CHANGED
|
@@ -4502,7 +4502,7 @@ function resolveWhisperBackend() {
|
|
|
4502
4502
|
function codexAuthFilePath() {
|
|
4503
4503
|
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join5(process.env.CODEX_HOME || join5(homedir3(), ".codex"), "auth.json");
|
|
4504
4504
|
}
|
|
4505
|
-
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.
|
|
4505
|
+
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;
|
|
4506
4506
|
var init_config = __esm(() => {
|
|
4507
4507
|
init_browser_backend();
|
|
4508
4508
|
init_config_helpers();
|
|
@@ -4551,6 +4551,7 @@ var init_config = __esm(() => {
|
|
|
4551
4551
|
NODE_ID = loadOrCreateLocalSecret("NEGOTIUM_NODE_ID", "node-id");
|
|
4552
4552
|
VAULT_MASTER_KEY = loadOrCreateLocalSecret("NEGOTIUM_VAULT_MASTER_KEY", "vault-master-key", { persistEnvValue: true });
|
|
4553
4553
|
delete process.env.NEGOTIUM_VAULT_MASTER_KEY;
|
|
4554
|
+
VAULT_SHARED_USER_ID = process.env.NEGOTIUM_VAULT_SHARED_USER?.trim() || undefined;
|
|
4554
4555
|
NEGOTIUM_PORT = parseInt(process.env.NEGOTIUM_PORT || "7777", 10);
|
|
4555
4556
|
hostname = process.env.HOSTNAME || "127.0.0.1";
|
|
4556
4557
|
DATA_DIR = resolveLocalStateDir("NEGOTIUM_DATA_DIR", "data");
|
|
@@ -4675,6 +4676,9 @@ var init_vault_crypto = __esm(() => {
|
|
|
4675
4676
|
// ../../packages/core/src/storage/vault.ts
|
|
4676
4677
|
import { chmodSync as chmodSync2, mkdirSync as mkdirSync6 } from "fs";
|
|
4677
4678
|
import { join as join6 } from "path";
|
|
4679
|
+
function sharedOwnerFor(userId) {
|
|
4680
|
+
return vaultSharedUserId && vaultSharedUserId !== userId ? vaultSharedUserId : undefined;
|
|
4681
|
+
}
|
|
4678
4682
|
function initializeVaultDatabase(database) {
|
|
4679
4683
|
database.exec("PRAGMA journal_mode = WAL");
|
|
4680
4684
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -4781,13 +4785,20 @@ function vaultGetValue(userId, key) {
|
|
|
4781
4785
|
const row = activeVaultDatabase().prepare("SELECT key, value FROM vault WHERE user_id = ? AND key = ?").get(userId, normalizedKey);
|
|
4782
4786
|
return row ? decryptRow(userId, row.key, row.value) : undefined;
|
|
4783
4787
|
}
|
|
4788
|
+
function vaultResolveValue(userId, key) {
|
|
4789
|
+
const own = vaultGetValue(userId, key);
|
|
4790
|
+
if (own !== undefined)
|
|
4791
|
+
return own;
|
|
4792
|
+
const shared = sharedOwnerFor(userId);
|
|
4793
|
+
return shared ? vaultGetValue(shared, key) : undefined;
|
|
4794
|
+
}
|
|
4784
4795
|
function vaultSubstituteDetailed(userId, text) {
|
|
4785
4796
|
const entries = new Map;
|
|
4786
4797
|
const usedKeys = new Set;
|
|
4787
4798
|
const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
|
|
4788
4799
|
const key = normalizeVaultKey(rawKey);
|
|
4789
4800
|
if (!entries.has(key))
|
|
4790
|
-
entries.set(key,
|
|
4801
|
+
entries.set(key, vaultResolveValue(userId, key));
|
|
4791
4802
|
const value = entries.get(key);
|
|
4792
4803
|
if (value === undefined)
|
|
4793
4804
|
return match;
|
|
@@ -4808,7 +4819,11 @@ function encodedSecretForms(value) {
|
|
|
4808
4819
|
return [...forms].sort((a, b) => b.length - a.length);
|
|
4809
4820
|
}
|
|
4810
4821
|
function redactVaultSecrets(userId, text) {
|
|
4811
|
-
const
|
|
4822
|
+
const shared = sharedOwnerFor(userId);
|
|
4823
|
+
const candidates = [
|
|
4824
|
+
...vaultListDecryptableValues(userId),
|
|
4825
|
+
...shared ? vaultListDecryptableValues(shared) : []
|
|
4826
|
+
].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));
|
|
4812
4827
|
if (candidates.length === 0)
|
|
4813
4828
|
return text;
|
|
4814
4829
|
const candidatesByFirstCharacter = new Map;
|
|
@@ -4834,7 +4849,7 @@ function redactVaultSecrets(userId, text) {
|
|
|
4834
4849
|
}
|
|
4835
4850
|
return redacted;
|
|
4836
4851
|
}
|
|
4837
|
-
var vaultDb, vaultMasterKey, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
|
|
4852
|
+
var vaultDb, vaultMasterKey, vaultSharedUserId, VAULT_KEY_PATTERN, VAULT_VALUE_MIN_BYTES = 4, VAULT_VALUE_MAX_BYTES, VAULT_DESCRIPTION_MAX_LENGTH = 500;
|
|
4838
4853
|
var init_vault = __esm(async () => {
|
|
4839
4854
|
init_config();
|
|
4840
4855
|
init_vault_crypto();
|
|
@@ -4843,6 +4858,7 @@ var init_vault = __esm(async () => {
|
|
|
4843
4858
|
init_storage_host()
|
|
4844
4859
|
]);
|
|
4845
4860
|
vaultMasterKey = VAULT_MASTER_KEY;
|
|
4861
|
+
vaultSharedUserId = VAULT_SHARED_USER_ID;
|
|
4846
4862
|
VAULT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/;
|
|
4847
4863
|
VAULT_VALUE_MAX_BYTES = 64 * 1024;
|
|
4848
4864
|
});
|
|
@@ -8918,7 +8934,7 @@ var init_codex = __esm(async () => {
|
|
|
8918
8934
|
});
|
|
8919
8935
|
|
|
8920
8936
|
// ../../packages/core/src/version.ts
|
|
8921
|
-
var NEGOTIUM_VERSION = "0.24.
|
|
8937
|
+
var NEGOTIUM_VERSION = "0.24.3";
|
|
8922
8938
|
|
|
8923
8939
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
8924
8940
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -10336,7 +10352,7 @@ async function createBrowserVaultBroker(userId) {
|
|
|
10336
10352
|
const substituted = deepMapStrings(request.value, (text) => {
|
|
10337
10353
|
const result = vaultSubstituteDetailed(userId, text);
|
|
10338
10354
|
for (const key of result.usedKeys) {
|
|
10339
|
-
const secret =
|
|
10355
|
+
const secret = vaultResolveValue(userId, key);
|
|
10340
10356
|
if (secret === undefined)
|
|
10341
10357
|
continue;
|
|
10342
10358
|
for (const form of encodedSecretForms2(secret))
|
|
@@ -10482,6 +10498,16 @@ function createBrowserProfile(ownerId, rawName) {
|
|
|
10482
10498
|
db.query("INSERT OR IGNORE INTO browser_profiles (owner_id, name, created_at) VALUES (?, ?, ?)").run("local", name, new Date().toISOString());
|
|
10483
10499
|
return name;
|
|
10484
10500
|
}
|
|
10501
|
+
function setTopicBrowserProfile(topicId, profile) {
|
|
10502
|
+
const owner = getBrowserProfileOwner(topicId, "");
|
|
10503
|
+
if (!owner)
|
|
10504
|
+
throw new Error(`Topic "${topicId}" not found or has no owner.`);
|
|
10505
|
+
assignTopicBrowserProfile({
|
|
10506
|
+
topicId,
|
|
10507
|
+
actorUserId: owner,
|
|
10508
|
+
profile: profile ?? DEFAULT_BROWSER_PROFILE
|
|
10509
|
+
});
|
|
10510
|
+
}
|
|
10485
10511
|
function assignTopicBrowserProfile(opts) {
|
|
10486
10512
|
const actualOwner = getBrowserProfileOwner(opts.topicId, "");
|
|
10487
10513
|
if (!actualOwner)
|
|
@@ -22619,6 +22645,7 @@ var init_plugin_turn = __esm(async () => {
|
|
|
22619
22645
|
var exports_turn_runner = {};
|
|
22620
22646
|
__export(exports_turn_runner, {
|
|
22621
22647
|
deliverAskCallbackToCaller: () => deliverAskCallbackToCaller,
|
|
22648
|
+
preemptSessionInjectForUserTurn: () => preemptSessionInjectForUserTurn,
|
|
22622
22649
|
resolveInitialTurnSessionId: () => resolveInitialTurnSessionId,
|
|
22623
22650
|
resolveTopicTurnExecution: () => resolveTopicTurnExecution,
|
|
22624
22651
|
resolveTopicTurnSession: () => resolveTopicTurnSession,
|
|
@@ -23371,22 +23398,7 @@ function startAiTurn(params) {
|
|
|
23371
23398
|
];
|
|
23372
23399
|
}
|
|
23373
23400
|
}
|
|
23374
|
-
|
|
23375
|
-
const runningInject = running.injectParams;
|
|
23376
|
-
const requeuedInject = prepareInjectReplayAfterUserPreemption(runningInject);
|
|
23377
|
-
const queued = deferInject(requeuedInject);
|
|
23378
|
-
running.injectRequeued = queued;
|
|
23379
|
-
if (queued && runningInject.prepareSession) {
|
|
23380
|
-
running.injectParams = { ...runningInject, requestId: undefined };
|
|
23381
|
-
} else if (!queued && runningInject.forkHandle) {
|
|
23382
|
-
cleanupAgentFork(runningInject.forkHandle);
|
|
23383
|
-
running.injectParams = {
|
|
23384
|
-
...runningInject,
|
|
23385
|
-
forkHandle: undefined,
|
|
23386
|
-
sessionId: undefined
|
|
23387
|
-
};
|
|
23388
|
-
}
|
|
23389
|
-
}
|
|
23401
|
+
requeueSessionInjectForUserPreemption(running);
|
|
23390
23402
|
running.abortReason = "internal" /* Internal */;
|
|
23391
23403
|
running.abortController.abort();
|
|
23392
23404
|
logger.info({ topicId, supersededQueryId: running.queryId, supersededOrigin: running.origin }, "ai: new user message superseded running turn");
|
|
@@ -24015,6 +24027,38 @@ To use another registered model, switch with /model <model> and send again.`, th
|
|
|
24015
24027
|
});
|
|
24016
24028
|
return queryId;
|
|
24017
24029
|
}
|
|
24030
|
+
function requeueSessionInjectForUserPreemption(running) {
|
|
24031
|
+
const runningInject = running.injectParams;
|
|
24032
|
+
if (!runningInject)
|
|
24033
|
+
return false;
|
|
24034
|
+
const requeuedInject = prepareInjectReplayAfterUserPreemption(runningInject);
|
|
24035
|
+
const queued = deferInject(requeuedInject);
|
|
24036
|
+
running.injectRequeued = queued;
|
|
24037
|
+
if (queued && runningInject.prepareSession) {
|
|
24038
|
+
running.injectParams = { ...runningInject, requestId: undefined };
|
|
24039
|
+
} else if (!queued && runningInject.forkHandle) {
|
|
24040
|
+
cleanupAgentFork(runningInject.forkHandle);
|
|
24041
|
+
running.injectParams = {
|
|
24042
|
+
...runningInject,
|
|
24043
|
+
forkHandle: undefined,
|
|
24044
|
+
sessionId: undefined
|
|
24045
|
+
};
|
|
24046
|
+
}
|
|
24047
|
+
return queued;
|
|
24048
|
+
}
|
|
24049
|
+
function preemptSessionInjectForUserTurn(topicId) {
|
|
24050
|
+
const running = getRoomQuery(topicId);
|
|
24051
|
+
if (!running || isUserOrigin(running.origin) || !running.injectParams)
|
|
24052
|
+
return false;
|
|
24053
|
+
if (running.abortController.signal.aborted)
|
|
24054
|
+
return false;
|
|
24055
|
+
if (!requeueSessionInjectForUserPreemption(running))
|
|
24056
|
+
return false;
|
|
24057
|
+
running.abortReason = "internal" /* Internal */;
|
|
24058
|
+
running.abortController.abort();
|
|
24059
|
+
logger.info({ topicId, supersededQueryId: running.queryId, supersededOrigin: running.origin }, "ai: user steer preempted running session-inject");
|
|
24060
|
+
return true;
|
|
24061
|
+
}
|
|
24018
24062
|
function wasLocallyRequeuedAfterUserPreemption(outcomeKind, control) {
|
|
24019
24063
|
return outcomeKind === "aborted" && control.abortReason === "internal" /* Internal */ && Boolean(control.injectParams) && control.injectRequeued === true;
|
|
24020
24064
|
}
|
|
@@ -26632,6 +26676,7 @@ function submitRuntimeGatewayTurn(params) {
|
|
|
26632
26676
|
payloadHash
|
|
26633
26677
|
};
|
|
26634
26678
|
let steersActiveTurn = false;
|
|
26679
|
+
let preemptsSessionInject = false;
|
|
26635
26680
|
let delivery;
|
|
26636
26681
|
try {
|
|
26637
26682
|
db.transaction(() => {
|
|
@@ -26693,6 +26738,7 @@ function submitRuntimeGatewayTurn(params) {
|
|
|
26693
26738
|
...(params.steer === false || params.inject === true) && active ? { keepRequestIds: [active.requestId] } : {}
|
|
26694
26739
|
});
|
|
26695
26740
|
steersActiveTurn = active !== null && merged.supersededRequestIds.includes(active.requestId);
|
|
26741
|
+
preemptsSessionInject = active === null && params.steer !== false && params.inject !== true && params.silent !== true;
|
|
26696
26742
|
delivery = steersActiveTurn ? "steered" : active ? "queued" : "started";
|
|
26697
26743
|
}
|
|
26698
26744
|
}
|
|
@@ -26729,6 +26775,8 @@ function submitRuntimeGatewayTurn(params) {
|
|
|
26729
26775
|
}
|
|
26730
26776
|
if (steersActiveTurn)
|
|
26731
26777
|
abortRoom(params.topic.id, "internal" /* Internal */);
|
|
26778
|
+
else if (preemptsSessionInject)
|
|
26779
|
+
preemptSessionInjectForUserTurn(params.topic.id);
|
|
26732
26780
|
return { ...submission, message, deduplicated: false };
|
|
26733
26781
|
}
|
|
26734
26782
|
var RuntimeGatewayIdempotencyConflictError, RuntimeGatewayTopicUnavailableError;
|
|
@@ -26742,6 +26790,7 @@ var init_submit_runtime_gateway_turn = __esm(async () => {
|
|
|
26742
26790
|
init_ask_user(),
|
|
26743
26791
|
init_mcp_config(),
|
|
26744
26792
|
init_active_rooms(),
|
|
26793
|
+
init_turn_runner(),
|
|
26745
26794
|
init_api_messages(),
|
|
26746
26795
|
init_api_topics(),
|
|
26747
26796
|
init_forum_db(),
|
|
@@ -27151,6 +27200,7 @@ var init_topic_service = __esm(async () => {
|
|
|
27151
27200
|
init_request_vault(),
|
|
27152
27201
|
init_bus(),
|
|
27153
27202
|
init_active_rooms(),
|
|
27203
|
+
init_turn_runner(),
|
|
27154
27204
|
init_api_topics(),
|
|
27155
27205
|
init_runtime_leases(),
|
|
27156
27206
|
init_runtime_topic_state(),
|
|
@@ -27212,8 +27262,12 @@ var init_topic_service = __esm(async () => {
|
|
|
27212
27262
|
steerQueuedTurn(topicId, userId) {
|
|
27213
27263
|
participantTopic(topicId, userId);
|
|
27214
27264
|
const folded = foldQueuedIntoActiveRuntimeUserTurnRequest(topicId, randomUUID26());
|
|
27215
|
-
if (!folded)
|
|
27216
|
-
|
|
27265
|
+
if (!folded) {
|
|
27266
|
+
const queued = getRuntimeUserTurnRequest(topicId);
|
|
27267
|
+
if (queued?.status !== "pending")
|
|
27268
|
+
return false;
|
|
27269
|
+
return preemptSessionInjectForUserTurn(topicId);
|
|
27270
|
+
}
|
|
27217
27271
|
abortRoom(topicId, "internal" /* Internal */);
|
|
27218
27272
|
return true;
|
|
27219
27273
|
},
|
|
@@ -29461,6 +29515,13 @@ function updateTopicSettings(opts) {
|
|
|
29461
29515
|
if (opts.browserConnectPort !== undefined && opts.browserConnectPort !== null && !isBrowserConnectPort(opts.browserConnectPort)) {
|
|
29462
29516
|
throw new TopicValidationError("browserConnectPort must be an integer from 1024 to 65535");
|
|
29463
29517
|
}
|
|
29518
|
+
if (opts.browserProfile !== undefined && opts.browserProfile !== null) {
|
|
29519
|
+
try {
|
|
29520
|
+
normalizeBrowserProfileName(opts.browserProfile);
|
|
29521
|
+
} catch (err) {
|
|
29522
|
+
throw new TopicValidationError(`browserProfile: ${err instanceof Error ? err.message : String(err)}`);
|
|
29523
|
+
}
|
|
29524
|
+
}
|
|
29464
29525
|
if (opts.plugins)
|
|
29465
29526
|
checkTopicPlugins(current, opts.plugins);
|
|
29466
29527
|
if (opts.agent !== undefined && opts.agent !== null && !isAgentKind(opts.agent)) {
|
|
@@ -29517,6 +29578,8 @@ function updateTopicSettings(opts) {
|
|
|
29517
29578
|
if (opts.browserConnectPort !== undefined) {
|
|
29518
29579
|
setTopicBrowserConnectPort(next.id, opts.browserConnectPort);
|
|
29519
29580
|
}
|
|
29581
|
+
if (opts.browserProfile !== undefined)
|
|
29582
|
+
setTopicBrowserProfile(next.id, opts.browserProfile);
|
|
29520
29583
|
if (opts.plugins !== undefined)
|
|
29521
29584
|
setTopicPlugins(next.id, opts.plugins);
|
|
29522
29585
|
const config = getApiTopicConfig(next.id);
|
|
@@ -39150,6 +39213,7 @@ function createNodeControlHandler(options) {
|
|
|
39150
39213
|
"canonical-topic-update",
|
|
39151
39214
|
"canonical-topic-description",
|
|
39152
39215
|
"canonical-topic-browser-connect",
|
|
39216
|
+
"canonical-topic-browser-profile",
|
|
39153
39217
|
"topic-plugins",
|
|
39154
39218
|
"canonical-topic-delete",
|
|
39155
39219
|
"turn-submit-silent",
|
|
@@ -40275,6 +40339,9 @@ function createNodeControlHandler(options) {
|
|
|
40275
40339
|
if (body.browserConnectPort !== undefined && body.browserConnectPort !== null && typeof body.browserConnectPort !== "number") {
|
|
40276
40340
|
return jsonError(400, "browserConnectPort must be a number or null");
|
|
40277
40341
|
}
|
|
40342
|
+
if (body.browserProfile !== undefined && body.browserProfile !== null && typeof body.browserProfile !== "string") {
|
|
40343
|
+
return jsonError(400, "browserProfile must be a string or null");
|
|
40344
|
+
}
|
|
40278
40345
|
if (body.plugins !== undefined && body.plugins !== null && !(Array.isArray(body.plugins) && body.plugins.every((dir) => typeof dir === "string"))) {
|
|
40279
40346
|
return jsonError(400, "plugins must be a list of folder paths or null");
|
|
40280
40347
|
}
|
|
@@ -40288,6 +40355,7 @@ function createNodeControlHandler(options) {
|
|
|
40288
40355
|
...body.aiMode !== undefined ? { aiMode: body.aiMode } : {},
|
|
40289
40356
|
...body.description !== undefined ? { description: body.description } : {},
|
|
40290
40357
|
...body.browserConnectPort !== undefined ? { browserConnectPort: body.browserConnectPort } : {},
|
|
40358
|
+
...body.browserProfile !== undefined ? { browserProfile: body.browserProfile } : {},
|
|
40291
40359
|
...body.plugins !== undefined ? { plugins: body.plugins } : {}
|
|
40292
40360
|
});
|
|
40293
40361
|
return Response.json({ ok: true, v: NODE_RUNTIME_CONTRACT_VERSION, topic });
|
|
@@ -50035,11 +50103,22 @@ class TerminalApp {
|
|
|
50035
50103
|
}
|
|
50036
50104
|
this.#queueRender();
|
|
50037
50105
|
}
|
|
50106
|
+
#restoreActivity(topicId, optimisticQueryId, previous) {
|
|
50107
|
+
if (this.#state.activity[topicId]?.queryId !== optimisticQueryId)
|
|
50108
|
+
return;
|
|
50109
|
+
const activity = { ...this.#state.activity };
|
|
50110
|
+
if (previous)
|
|
50111
|
+
activity[topicId] = previous;
|
|
50112
|
+
else
|
|
50113
|
+
delete activity[topicId];
|
|
50114
|
+
this.#state = { ...this.#state, activity };
|
|
50115
|
+
}
|
|
50038
50116
|
async#steerQueued() {
|
|
50039
50117
|
const topic = activeTopic(this.#state);
|
|
50040
50118
|
if (!topic || (this.#state.queued[topic.id] ?? []).length === 0)
|
|
50041
50119
|
return;
|
|
50042
50120
|
const optimisticQueryId = `terminal-pending-${Date.now()}`;
|
|
50121
|
+
const previousActivity = this.#state.activity[topic.id];
|
|
50043
50122
|
this.#state = applyRuntimeEvent({ ...this.#state, scrollOffset: 0 }, {
|
|
50044
50123
|
type: "ai-status",
|
|
50045
50124
|
topicId: topic.id,
|
|
@@ -50057,31 +50136,15 @@ class TerminalApp {
|
|
|
50057
50136
|
this.#state = drainQueuedMessages(this.#state, topic.id, new Date().toISOString());
|
|
50058
50137
|
}
|
|
50059
50138
|
if (steered === false) {
|
|
50060
|
-
|
|
50061
|
-
this.#state = applyRuntimeEvent(this.#state, {
|
|
50062
|
-
type: "ai-status",
|
|
50063
|
-
topicId: topic.id,
|
|
50064
|
-
payload: { kind: "ai_aborted", queryId: optimisticQueryId }
|
|
50065
|
-
});
|
|
50066
|
-
}
|
|
50139
|
+
this.#restoreActivity(topic.id, optimisticQueryId, previousActivity);
|
|
50067
50140
|
this.#state = {
|
|
50068
50141
|
...this.#state,
|
|
50069
|
-
notice: "Nothing to steer
|
|
50142
|
+
notice: "Nothing to steer.",
|
|
50070
50143
|
noticeLevel: "info"
|
|
50071
50144
|
};
|
|
50072
50145
|
}
|
|
50073
50146
|
} catch (error) {
|
|
50074
|
-
|
|
50075
|
-
this.#state = applyRuntimeEvent(this.#state, {
|
|
50076
|
-
type: "ai-status",
|
|
50077
|
-
topicId: topic.id,
|
|
50078
|
-
payload: {
|
|
50079
|
-
kind: "ai_error",
|
|
50080
|
-
queryId: optimisticQueryId,
|
|
50081
|
-
error: "Steer failed"
|
|
50082
|
-
}
|
|
50083
|
-
});
|
|
50084
|
-
}
|
|
50147
|
+
this.#restoreActivity(topic.id, optimisticQueryId, previousActivity);
|
|
50085
50148
|
this.#state = {
|
|
50086
50149
|
...this.#state,
|
|
50087
50150
|
notice: error instanceof Error ? error.message : String(error),
|
|
@@ -61298,4 +61361,4 @@ switch (command) {
|
|
|
61298
61361
|
}
|
|
61299
61362
|
}
|
|
61300
61363
|
|
|
61301
|
-
//# debugId=
|
|
61364
|
+
//# debugId=256C1E80D30E10ED64756E2164756E21
|