negotium 0.20.0 → 0.20.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 +14 -32
- package/dist/agent-helpers.js.map +7 -7
- package/dist/background-bash.js +2 -2
- package/dist/background-bash.js.map +2 -2
- package/dist/browser-runtime.js +2 -2
- package/dist/browser-runtime.js.map +2 -2
- package/dist/{chunk-nm59q3em.js → chunk-143j4nxd.js} +1 -1
- package/dist/{chunk-hh3f0yr7.js → chunk-j2wgr465.js} +3 -3
- package/dist/{chunk-hh3f0yr7.js.map → chunk-j2wgr465.js.map} +2 -2
- package/dist/{chunk-ad6xqvqy.js → chunk-myhmb8tn.js} +2 -2
- package/dist/{chunk-ad6xqvqy.js.map → chunk-myhmb8tn.js.map} +2 -2
- package/dist/{chunk-w3c6fc0p.js → chunk-t7vs5k9t.js} +2 -2
- package/dist/{chunk-w3c6fc0p.js.map → chunk-t7vs5k9t.js.map} +2 -2
- package/dist/{chunk-7he9nzfa.js → chunk-zkyp090x.js} +1 -1
- package/dist/hosted-agent.js +4 -4
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +86 -94
- package/dist/main.js.map +8 -8
- package/dist/mcp-factories.js +14 -32
- package/dist/mcp-factories.js.map +7 -7
- package/dist/media.js +2 -2
- package/dist/media.js.map +2 -2
- package/dist/prompts.js +8 -28
- package/dist/prompts.js.map +4 -4
- package/dist/query-runtime.js +2 -2
- package/dist/query-runtime.js.map +2 -2
- package/dist/registry.js +5 -5
- package/dist/registry.js.map +3 -3
- package/dist/rollout.js +2 -2
- package/dist/runtime/src/agents/codex-registry.ts +7 -5
- package/dist/runtime/src/agents/model-catalog.ts +15 -34
- package/dist/runtime/src/platform/config.ts +1 -1
- package/dist/runtime/src/runtime/bashrs-completions.ts +19 -1
- package/dist/runtime/src/storage/token-stats.ts +2 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js +13 -3
- package/dist/runtime-helpers.js.map +4 -4
- package/dist/storage.js.map +2 -2
- package/dist/types/packages/core/src/agents/model-catalog.d.ts +1 -1
- package/dist/types/packages/core/src/platform/config.d.ts +1 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +2 -2
- package/dist/vault.js.map +2 -2
- package/install-browser-rs.mjs +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-nm59q3em.js.map → chunk-143j4nxd.js.map} +0 -0
- /package/dist/{chunk-7he9nzfa.js.map → chunk-zkyp090x.js.map} +0 -0
package/dist/main.js
CHANGED
|
@@ -383,7 +383,7 @@ function resolveWhisperBackend() {
|
|
|
383
383
|
function codexAuthFilePath() {
|
|
384
384
|
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
|
|
385
385
|
}
|
|
386
|
-
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.
|
|
386
|
+
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.7.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;
|
|
387
387
|
var init_config = __esm(() => {
|
|
388
388
|
init_config_helpers();
|
|
389
389
|
init_logger();
|
|
@@ -5261,7 +5261,7 @@ var exports_version = {};
|
|
|
5261
5261
|
__export(exports_version, {
|
|
5262
5262
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
5263
5263
|
});
|
|
5264
|
-
var NEGOTIUM_VERSION = "0.20.
|
|
5264
|
+
var NEGOTIUM_VERSION = "0.20.2";
|
|
5265
5265
|
|
|
5266
5266
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
5267
5267
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -5653,7 +5653,7 @@ var init_codex_registry = __esm(async () => {
|
|
|
5653
5653
|
VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
|
|
5654
5654
|
codexRegistry = {
|
|
5655
5655
|
kind: "codex",
|
|
5656
|
-
defaultModel: "gpt-
|
|
5656
|
+
defaultModel: "gpt-6-luna",
|
|
5657
5657
|
expandModelAlias(s) {
|
|
5658
5658
|
return s;
|
|
5659
5659
|
},
|
|
@@ -10781,19 +10781,19 @@ var init_model_catalog = __esm(() => {
|
|
|
10781
10781
|
{
|
|
10782
10782
|
model: "gpt-6-astra",
|
|
10783
10783
|
agent: "codex",
|
|
10784
|
-
description: "Newest OpenAI flagship;
|
|
10784
|
+
description: "Newest OpenAI flagship; Codex's highest-capability route.",
|
|
10785
10785
|
intelligenceTier: "fable",
|
|
10786
|
-
routingSummary: "flagship reasoning;
|
|
10786
|
+
routingSummary: "flagship reasoning; 5x gpt-6-sol's token cost; matches Fable 5.1 pricing",
|
|
10787
10787
|
accessCost: CODEX_PRO_20X_COST,
|
|
10788
10788
|
marginalTokenCost: "Codex credits (OpenAI API rate): $10/M uncached input, $1/M cached input, $12.50/M cache write, $50/M output",
|
|
10789
|
-
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-
|
|
10789
|
+
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-6-sol given the higher per-token cost. ${CODEX_COMMUNITY_WEEKLY}`
|
|
10790
10790
|
},
|
|
10791
10791
|
{
|
|
10792
10792
|
model: "gpt-6-sol",
|
|
10793
10793
|
agent: "codex",
|
|
10794
10794
|
description: "GPT-6 generation Sol route (2026-09-22) for demanding coding and agentic work.",
|
|
10795
10795
|
intelligenceTier: "opus",
|
|
10796
|
-
routingSummary: "demanding coding work;
|
|
10796
|
+
routingSummary: "demanding coding work; replaces the retired gpt-5.6-sol at half the price",
|
|
10797
10797
|
accessCost: CODEX_PRO_20X_COST,
|
|
10798
10798
|
marginalTokenCost: "Codex credits (OpenAI API rate): $2/M uncached input, $0.20/M cached input (assumed), $10/M output",
|
|
10799
10799
|
estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
|
|
@@ -10801,23 +10801,13 @@ var init_model_catalog = __esm(() => {
|
|
|
10801
10801
|
{
|
|
10802
10802
|
model: "gpt-6-luna",
|
|
10803
10803
|
agent: "codex",
|
|
10804
|
-
description: "GPT-6
|
|
10804
|
+
description: "Default Codex route (GPT-6 Luna, 2026-09-22): fast, high-volume, lowest cost.",
|
|
10805
10805
|
intelligenceTier: "sonnet",
|
|
10806
10806
|
routingSummary: "fast high-volume work; cheapest Codex route",
|
|
10807
10807
|
accessCost: CODEX_PRO_20X_COST,
|
|
10808
10808
|
marginalTokenCost: "Codex credits (OpenAI API rate): $0.10/M uncached input, $0.01/M cached input (assumed), $0.50/M output",
|
|
10809
10809
|
estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
|
|
10810
10810
|
},
|
|
10811
|
-
{
|
|
10812
|
-
model: "gpt-5.6-sol",
|
|
10813
|
-
agent: "codex",
|
|
10814
|
-
description: "High-capability Codex route for demanding agentic coding work; demoted below gpt-6-astra.",
|
|
10815
|
-
intelligenceTier: "opus",
|
|
10816
|
-
routingSummary: "demanding coding work; 5x Codex quota cost; now second-tier behind gpt-6-astra",
|
|
10817
|
-
accessCost: CODEX_PRO_20X_COST,
|
|
10818
|
-
marginalTokenCost: "Codex credits: $5/M uncached input, $0.50/M cached input, $30/M output",
|
|
10819
|
-
estimatedUsage: `Official Pro 20x range: 300\u20131,800 local messages per 5 hours; quota weight 5x Luna. ${CODEX_COMMUNITY_WEEKLY}`
|
|
10820
|
-
},
|
|
10821
10811
|
{
|
|
10822
10812
|
model: "gpt-5.6-terra",
|
|
10823
10813
|
agent: "codex",
|
|
@@ -10826,17 +10816,7 @@ var init_model_catalog = __esm(() => {
|
|
|
10826
10816
|
routingSummary: "complex coding and reasoning; 2.5x Codex quota cost",
|
|
10827
10817
|
accessCost: CODEX_PRO_20X_COST,
|
|
10828
10818
|
marginalTokenCost: "Codex credits: $2.50/M uncached input, $0.25/M cached input, $15/M output",
|
|
10829
|
-
estimatedUsage: `Official Pro 20x range: 400\u20132,200 local messages per 5 hours; quota weight 2.5x Luna. ${CODEX_COMMUNITY_WEEKLY}`
|
|
10830
|
-
},
|
|
10831
|
-
{
|
|
10832
|
-
model: "gpt-5.6-luna",
|
|
10833
|
-
agent: "codex",
|
|
10834
|
-
description: "Default Codex route with strong everyday coding intelligence.",
|
|
10835
|
-
intelligenceTier: "sonnet",
|
|
10836
|
-
routingSummary: "everyday coding default; lowest Codex quota cost (1x)",
|
|
10837
|
-
accessCost: CODEX_PRO_20X_COST,
|
|
10838
|
-
marginalTokenCost: "Codex credits: $1/M uncached input, $0.10/M cached input, $6/M output",
|
|
10839
|
-
estimatedUsage: `Official Pro 20x range: 1,000\u20135,600 local messages per 5 hours; lowest Codex quota weight (1x). ${CODEX_COMMUNITY_WEEKLY}`
|
|
10819
|
+
estimatedUsage: `Official Pro 20x range: 400\u20132,200 local messages per 5 hours; quota weight 2.5x the retired GPT-5.6 Luna. ${CODEX_COMMUNITY_WEEKLY}`
|
|
10840
10820
|
},
|
|
10841
10821
|
{
|
|
10842
10822
|
model: "fable",
|
|
@@ -10930,6 +10910,8 @@ var init_model_catalog = __esm(() => {
|
|
|
10930
10910
|
}
|
|
10931
10911
|
];
|
|
10932
10912
|
SELECTABLE_MODEL_ALIASES = {
|
|
10913
|
+
"gpt-5.6-sol": "gpt-6-sol",
|
|
10914
|
+
"gpt-5.6-luna": "gpt-6-luna",
|
|
10933
10915
|
kimi: "kimi-k3",
|
|
10934
10916
|
"kimi-pro": "kimi-k3",
|
|
10935
10917
|
"kimi-code": "kimi-k2.7-code",
|
|
@@ -10941,14 +10923,14 @@ var init_model_catalog = __esm(() => {
|
|
|
10941
10923
|
FALLBACK_ORDER = {
|
|
10942
10924
|
claude: [
|
|
10943
10925
|
{ agent: "maestro", model: "deepseek-pro" },
|
|
10944
|
-
{ agent: "codex", model: "gpt-
|
|
10926
|
+
{ agent: "codex", model: "gpt-6-luna" }
|
|
10945
10927
|
],
|
|
10946
10928
|
codex: [
|
|
10947
10929
|
{ agent: "maestro", model: "deepseek-pro" },
|
|
10948
10930
|
{ agent: "claude", model: "sonnet" }
|
|
10949
10931
|
],
|
|
10950
10932
|
maestro: [
|
|
10951
|
-
{ agent: "codex", model: "gpt-
|
|
10933
|
+
{ agent: "codex", model: "gpt-6-luna" },
|
|
10952
10934
|
{ agent: "claude", model: "sonnet" }
|
|
10953
10935
|
]
|
|
10954
10936
|
};
|
|
@@ -25692,6 +25674,7 @@ var init_utils = __esm(() => {
|
|
|
25692
25674
|
// ../../packages/core/src/runtime/bashrs-completions.ts
|
|
25693
25675
|
import {
|
|
25694
25676
|
closeSync as closeSync3,
|
|
25677
|
+
existsSync as existsSync25,
|
|
25695
25678
|
openSync as openSync3,
|
|
25696
25679
|
readdirSync as readdirSync7,
|
|
25697
25680
|
readFileSync as readFileSync18,
|
|
@@ -25811,6 +25794,8 @@ async function flushBashrsCompletions() {
|
|
|
25811
25794
|
if (!parsed) {
|
|
25812
25795
|
continue;
|
|
25813
25796
|
}
|
|
25797
|
+
if (!existsSync25(resultPath))
|
|
25798
|
+
continue;
|
|
25814
25799
|
try {
|
|
25815
25800
|
completionSink({
|
|
25816
25801
|
userId: parsed.userId,
|
|
@@ -25818,7 +25803,14 @@ async function flushBashrsCompletions() {
|
|
|
25818
25803
|
bashId: result.bash_id,
|
|
25819
25804
|
message: buildMessage(dir, result)
|
|
25820
25805
|
});
|
|
25821
|
-
|
|
25806
|
+
try {
|
|
25807
|
+
renameSync9(resultPath, marker);
|
|
25808
|
+
} catch (renameErr) {
|
|
25809
|
+
if (renameErr.code !== "ENOENT")
|
|
25810
|
+
throw renameErr;
|
|
25811
|
+
logger.debug({ bashId: result.bash_id }, "bashrs-completions: already delivered by another consumer");
|
|
25812
|
+
continue;
|
|
25813
|
+
}
|
|
25822
25814
|
logger.info({ bashId: result.bash_id, userId: parsed.userId, topicId: parsed.topicId }, "bashrs-completions: delivered");
|
|
25823
25815
|
} catch (err2) {
|
|
25824
25816
|
logger.warn({ err: err2, dir }, "bashrs-completions: delivery failed, will retry");
|
|
@@ -26098,7 +26090,7 @@ var init_coalescing_runner = __esm(() => {
|
|
|
26098
26090
|
|
|
26099
26091
|
// ../../packages/core/src/outbox/file-ops.ts
|
|
26100
26092
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
26101
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
26093
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync26, readFileSync as readFileSync19, renameSync as renameSync10, unlinkSync as unlinkSync17 } from "fs";
|
|
26102
26094
|
function host() {
|
|
26103
26095
|
return hostContext.getStore() ?? defaultHost2;
|
|
26104
26096
|
}
|
|
@@ -26115,8 +26107,8 @@ function tryUnlink(path, label, reason) {
|
|
|
26115
26107
|
}
|
|
26116
26108
|
function drainOutboxFile(filePath, label) {
|
|
26117
26109
|
const processingPath = filePath + PROCESSING_SUFFIX;
|
|
26118
|
-
const hasPending =
|
|
26119
|
-
const hasLeftover =
|
|
26110
|
+
const hasPending = existsSync26(filePath);
|
|
26111
|
+
const hasLeftover = existsSync26(processingPath);
|
|
26120
26112
|
if (hasLeftover) {
|
|
26121
26113
|
const logMsg = `${label}: merging leftover .processing before claim`;
|
|
26122
26114
|
const logCtx = { filePath, processingPath, hadPending: hasPending };
|
|
@@ -26136,7 +26128,7 @@ function drainOutboxFile(filePath, label) {
|
|
|
26136
26128
|
tryUnlink(processingPath, label, "failed to clean up leftover after merge error");
|
|
26137
26129
|
}
|
|
26138
26130
|
}
|
|
26139
|
-
if (!
|
|
26131
|
+
if (!existsSync26(filePath))
|
|
26140
26132
|
return null;
|
|
26141
26133
|
try {
|
|
26142
26134
|
renameSync10(filePath, processingPath);
|
|
@@ -27554,7 +27546,7 @@ var init_src = __esm(async () => {
|
|
|
27554
27546
|
});
|
|
27555
27547
|
|
|
27556
27548
|
// ../../packages/core/src/storage/conversation-migration.ts
|
|
27557
|
-
import { copyFileSync as copyFileSync3, existsSync as
|
|
27549
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync27, mkdirSync as mkdirSync24, readFileSync as readFileSync20 } from "fs";
|
|
27558
27550
|
import { dirname as dirname17, join as join37 } from "path";
|
|
27559
27551
|
function readEntries(path) {
|
|
27560
27552
|
const entries = [];
|
|
@@ -27618,19 +27610,19 @@ function migrateLegacyCompactedConversations() {
|
|
|
27618
27610
|
const userId = participant.userId;
|
|
27619
27611
|
const rawPath = getConversationPath(userId, topic.title);
|
|
27620
27612
|
const activePath = getActiveConversationPath(userId, topic.title);
|
|
27621
|
-
if (!
|
|
27613
|
+
if (!existsSync27(rawPath) || existsSync27(activePath)) {
|
|
27622
27614
|
result.skipped++;
|
|
27623
27615
|
continue;
|
|
27624
27616
|
}
|
|
27625
27617
|
const backupPath = join37(resolveStorageDataDir(), "conversation-migration-backups", MIGRATION_NAME, userId, `${sanitizeTopicName(topic.title, true)}.jsonl`);
|
|
27626
|
-
const sourcePath =
|
|
27618
|
+
const sourcePath = existsSync27(backupPath) ? backupPath : rawPath;
|
|
27627
27619
|
const legacyEntries = readEntries(sourcePath);
|
|
27628
27620
|
const compactIndex = compactionEntryIndex(legacyEntries);
|
|
27629
27621
|
if (compactIndex < 0) {
|
|
27630
27622
|
result.skipped++;
|
|
27631
27623
|
continue;
|
|
27632
27624
|
}
|
|
27633
|
-
if (!
|
|
27625
|
+
if (!existsSync27(backupPath)) {
|
|
27634
27626
|
mkdirSync24(dirname17(backupPath), { recursive: true });
|
|
27635
27627
|
copyFileSync3(rawPath, backupPath);
|
|
27636
27628
|
}
|
|
@@ -27684,7 +27676,7 @@ __export(exports_decisions, {
|
|
|
27684
27676
|
createDecisions: () => createDecisions,
|
|
27685
27677
|
DECISION_STATUS_VALUES: () => DECISION_STATUS_VALUES
|
|
27686
27678
|
});
|
|
27687
|
-
import { existsSync as
|
|
27679
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync25, readFileSync as readFileSync21, renameSync as renameSync11, writeFileSync as writeFileSync19 } from "fs";
|
|
27688
27680
|
import { dirname as dirname18, join as join38 } from "path";
|
|
27689
27681
|
function safeDecisionScopeKey(scopeKey) {
|
|
27690
27682
|
const safe = sanitizeFileName(scopeKey);
|
|
@@ -27712,7 +27704,7 @@ function writeDecisionGraphSvg(userId, scopeKey, svg) {
|
|
|
27712
27704
|
}
|
|
27713
27705
|
function readDecisions(userId, scopeKey) {
|
|
27714
27706
|
const path = getDecisionFilePath(userId, scopeKey);
|
|
27715
|
-
if (!
|
|
27707
|
+
if (!existsSync28(path))
|
|
27716
27708
|
return [];
|
|
27717
27709
|
try {
|
|
27718
27710
|
const parsed = JSON.parse(readFileSync21(path, "utf-8"));
|
|
@@ -28033,7 +28025,7 @@ var init_node_host = __esm(async () => {
|
|
|
28033
28025
|
});
|
|
28034
28026
|
|
|
28035
28027
|
// ../../packages/core/src/agents/mcp-tools/inline-assets.ts
|
|
28036
|
-
import { existsSync as
|
|
28028
|
+
import { existsSync as existsSync29, readFileSync as readFileSync22, statSync as statSync14 } from "fs";
|
|
28037
28029
|
import { extname as extname2, isAbsolute as isAbsolute7, resolve as resolve18 } from "path";
|
|
28038
28030
|
function isNonLocal(ref) {
|
|
28039
28031
|
const trimmed = ref.trim();
|
|
@@ -28064,7 +28056,7 @@ function inlineLocalAssets(html, options) {
|
|
|
28064
28056
|
const abs = isAbsolute7(relPath) ? relPath : resolve18(baseDir, relPath);
|
|
28065
28057
|
let bytes;
|
|
28066
28058
|
try {
|
|
28067
|
-
if (!
|
|
28059
|
+
if (!existsSync29(abs) || !statSync14(abs).isFile()) {
|
|
28068
28060
|
unresolved.push(ref);
|
|
28069
28061
|
cache.set(ref, null);
|
|
28070
28062
|
return null;
|
|
@@ -29210,7 +29202,7 @@ __export(exports_agent_health, {
|
|
|
29210
29202
|
createAgentHealthMcpServer: () => createAgentHealthMcpServer
|
|
29211
29203
|
});
|
|
29212
29204
|
import { spawn as spawn6 } from "child_process";
|
|
29213
|
-
import { existsSync as
|
|
29205
|
+
import { existsSync as existsSync30, readdirSync as readdirSync9 } from "fs";
|
|
29214
29206
|
import { join as join39 } from "path";
|
|
29215
29207
|
import { McpServer as McpServer5 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
29216
29208
|
import { z as z10 } from "zod";
|
|
@@ -29457,7 +29449,7 @@ ${results.every((result) => result.ok) ? "All agents healthy" : "Some agents fai
|
|
|
29457
29449
|
if (!context.userId)
|
|
29458
29450
|
return mcpOk("\uC2E4\uD589 \uC911\uC778 \uCFFC\uB9AC \uC870\uD68C \uBD88\uAC00 (user context \uC5C6\uC74C)");
|
|
29459
29451
|
const stateDir = join39(USERS_LOG_DIR, context.userId, "active-queries");
|
|
29460
|
-
if (!
|
|
29452
|
+
if (!existsSync30(stateDir))
|
|
29461
29453
|
return mcpOk("\uC2E4\uD589 \uC911\uC778 \uCFFC\uB9AC \uC5C6\uC74C");
|
|
29462
29454
|
let files;
|
|
29463
29455
|
try {
|
|
@@ -30298,7 +30290,7 @@ var init_vault2 = __esm(() => {
|
|
|
30298
30290
|
});
|
|
30299
30291
|
|
|
30300
30292
|
// ../../packages/core/src/mcp/wiki-search-index.ts
|
|
30301
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
30293
|
+
import { chmodSync as chmodSync5, existsSync as existsSync31, readFileSync as readFileSync23, unlinkSync as unlinkSync18 } from "fs";
|
|
30302
30294
|
function documentId(source) {
|
|
30303
30295
|
return `${source.kind}:${source.key}`;
|
|
30304
30296
|
}
|
|
@@ -30500,7 +30492,7 @@ class WikiSearchIndex {
|
|
|
30500
30492
|
}
|
|
30501
30493
|
function resetCorruptWikiSearchIndex(path) {
|
|
30502
30494
|
for (const candidate of [path, `${path}-journal`, `${path}-wal`, `${path}-shm`]) {
|
|
30503
|
-
if (!
|
|
30495
|
+
if (!existsSync31(candidate))
|
|
30504
30496
|
continue;
|
|
30505
30497
|
unlinkSync18(candidate);
|
|
30506
30498
|
}
|
|
@@ -30520,7 +30512,7 @@ import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
|
30520
30512
|
import { randomUUID as randomUUID23 } from "crypto";
|
|
30521
30513
|
import {
|
|
30522
30514
|
closeSync as closeSync4,
|
|
30523
|
-
existsSync as
|
|
30515
|
+
existsSync as existsSync32,
|
|
30524
30516
|
mkdirSync as mkdirSync26,
|
|
30525
30517
|
openSync as openSync4,
|
|
30526
30518
|
readdirSync as readdirSync10,
|
|
@@ -31365,16 +31357,16 @@ function wikiLastConversation(args) {
|
|
|
31365
31357
|
const name = slugify(topicNameFrom(rawTopic));
|
|
31366
31358
|
const archiveDir = resolve19(runtime().archiveDir, name);
|
|
31367
31359
|
try {
|
|
31368
|
-
let files =
|
|
31360
|
+
let files = existsSync32(archiveDir) ? readdirSync10(archiveDir).filter((f) => f.endsWith(".jsonl")).sort().reverse() : [];
|
|
31369
31361
|
if (files.length === 0) {
|
|
31370
|
-
files =
|
|
31362
|
+
files = existsSync32(runtime().archiveDir) ? readdirSync10(runtime().archiveDir).filter((f) => f.startsWith(name) && f.endsWith(".jsonl")).sort().reverse() : [];
|
|
31371
31363
|
}
|
|
31372
31364
|
if (files.length === 0) {
|
|
31373
31365
|
return {
|
|
31374
31366
|
content: [{ type: "text", text: `No archive found for topic: ${rawTopic}` }]
|
|
31375
31367
|
};
|
|
31376
31368
|
}
|
|
31377
|
-
const actualPath = files[0].includes("/") ? files[0] : resolve19(
|
|
31369
|
+
const actualPath = files[0].includes("/") ? files[0] : resolve19(existsSync32(archiveDir) && readdirSync10(archiveDir).includes(files[0]) ? archiveDir : runtime().archiveDir, files[0]);
|
|
31378
31370
|
try {
|
|
31379
31371
|
const raw = readFileSync24(actualPath, "utf-8");
|
|
31380
31372
|
const lines = raw.trim().split(`
|
|
@@ -31560,7 +31552,7 @@ function writeSummaryDocument(rawTopic, content, dateStr) {
|
|
|
31560
31552
|
if (topicId && setTopicBrief2) {
|
|
31561
31553
|
try {
|
|
31562
31554
|
const briefPath = resolve19(runtime().topicsDir, `${fileSlug}.md`);
|
|
31563
|
-
let briefMd =
|
|
31555
|
+
let briefMd = existsSync32(briefPath) ? readFileSync24(briefPath, "utf-8") : undefined;
|
|
31564
31556
|
if (briefMd === undefined && getTopicBrief2 && !getTopicBrief2(fileSlug)?.briefMd) {
|
|
31565
31557
|
const legacy = getTopicBrief2(topicId)?.briefMd;
|
|
31566
31558
|
if (legacy)
|
|
@@ -31581,7 +31573,7 @@ function writeTopicDocument(rawTopic, content) {
|
|
|
31581
31573
|
const fileSlug = wikiBriefStorageKey(rawTopic, topicId);
|
|
31582
31574
|
const briefPath = resolve19(runtime().topicsDir, `${fileSlug}.md`);
|
|
31583
31575
|
ensureDir(dirname19(briefPath));
|
|
31584
|
-
const existed =
|
|
31576
|
+
const existed = existsSync32(briefPath);
|
|
31585
31577
|
writeFileSync20(briefPath, content, "utf-8");
|
|
31586
31578
|
const setTopicBrief2 = runtime().host.setTopicBrief;
|
|
31587
31579
|
let sqliteUpdated = false;
|
|
@@ -31596,7 +31588,7 @@ function writeTopicDocument(rawTopic, content) {
|
|
|
31596
31588
|
function writeArticleDocument(slug, content) {
|
|
31597
31589
|
const articlePath = resolve19(runtime().articlesDir, `${slug}.md`);
|
|
31598
31590
|
ensureDir(dirname19(articlePath));
|
|
31599
|
-
const existed =
|
|
31591
|
+
const existed = existsSync32(articlePath);
|
|
31600
31592
|
atomicWriteFile(articlePath, content);
|
|
31601
31593
|
return { existed };
|
|
31602
31594
|
}
|
|
@@ -32244,7 +32236,7 @@ __export(exports_activity_log, {
|
|
|
32244
32236
|
readSentFilesForTopic: () => readSentFilesForTopic
|
|
32245
32237
|
});
|
|
32246
32238
|
import {
|
|
32247
|
-
existsSync as
|
|
32239
|
+
existsSync as existsSync33,
|
|
32248
32240
|
mkdirSync as mkdirSync27,
|
|
32249
32241
|
readdirSync as readdirSync11,
|
|
32250
32242
|
renameSync as renameSync13,
|
|
@@ -32328,7 +32320,7 @@ function entryMatchesTopic(e, topicName) {
|
|
|
32328
32320
|
}
|
|
32329
32321
|
function readSentFilesForTopic(userId, topicName) {
|
|
32330
32322
|
const file = join42(resolveStorageUsersLogDir(), String(userId), "sent-files.jsonl");
|
|
32331
|
-
if (!
|
|
32323
|
+
if (!existsSync33(file))
|
|
32332
32324
|
return [];
|
|
32333
32325
|
try {
|
|
32334
32326
|
return readJsonlLines(file).map((line) => JSON.parse(line)).filter((e) => entryMatchesTopic(e, topicName));
|
|
@@ -32339,7 +32331,7 @@ function readSentFilesForTopic(userId, topicName) {
|
|
|
32339
32331
|
}
|
|
32340
32332
|
function removeSentFilesForTopic(userId, topicName) {
|
|
32341
32333
|
const file = join42(resolveStorageUsersLogDir(), String(userId), "sent-files.jsonl");
|
|
32342
|
-
if (!
|
|
32334
|
+
if (!existsSync33(file))
|
|
32343
32335
|
return;
|
|
32344
32336
|
try {
|
|
32345
32337
|
const remaining = readJsonlLines(file).filter((line) => {
|
|
@@ -33897,7 +33889,7 @@ var init_spec = __esm(() => {
|
|
|
33897
33889
|
});
|
|
33898
33890
|
|
|
33899
33891
|
// ../../packages/mcp-host/src/manifest.ts
|
|
33900
|
-
import { existsSync as
|
|
33892
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync28, readFileSync as readFileSync25, renameSync as renameSync14, writeFileSync as writeFileSync22 } from "fs";
|
|
33901
33893
|
import { dirname as dirname20 } from "path";
|
|
33902
33894
|
import { z as z14 } from "zod";
|
|
33903
33895
|
|
|
@@ -33949,7 +33941,7 @@ class McpManifest {
|
|
|
33949
33941
|
}
|
|
33950
33942
|
read() {
|
|
33951
33943
|
const entries = new Map;
|
|
33952
|
-
if (!
|
|
33944
|
+
if (!existsSync34(this.file))
|
|
33953
33945
|
return entries;
|
|
33954
33946
|
let parsed;
|
|
33955
33947
|
try {
|
|
@@ -34636,7 +34628,7 @@ var init_schedule = __esm(() => {
|
|
|
34636
34628
|
|
|
34637
34629
|
// ../../packages/module-cron/src/scripts.ts
|
|
34638
34630
|
import { spawn as spawn8 } from "child_process";
|
|
34639
|
-
import { existsSync as
|
|
34631
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync30, readdirSync as readdirSync13 } from "fs";
|
|
34640
34632
|
import { resolve as resolve23, sep as sep3 } from "path";
|
|
34641
34633
|
function validateCronScriptName(script) {
|
|
34642
34634
|
if (!/^[A-Za-z0-9_][A-Za-z0-9_.-]*\.py$/.test(script) || script.includes("..") || script.includes("/") || script.includes("\\")) {
|
|
@@ -34679,7 +34671,7 @@ function listCronScriptsForScope(surfaceScope) {
|
|
|
34679
34671
|
}
|
|
34680
34672
|
function cronScriptExists(script) {
|
|
34681
34673
|
try {
|
|
34682
|
-
return
|
|
34674
|
+
return existsSync35(resolveCronScriptPath(script));
|
|
34683
34675
|
} catch {
|
|
34684
34676
|
return false;
|
|
34685
34677
|
}
|
|
@@ -34711,7 +34703,7 @@ async function runCronPromptScript(options) {
|
|
|
34711
34703
|
if (options.signal?.aborted)
|
|
34712
34704
|
throw new CronScriptError("script run aborted");
|
|
34713
34705
|
const scriptPath = resolveCronScriptPath(options.script);
|
|
34714
|
-
if (!
|
|
34706
|
+
if (!existsSync35(scriptPath))
|
|
34715
34707
|
throw new CronScriptError(`cron script not found: ${options.script}`);
|
|
34716
34708
|
const timeoutMs = Math.max(5000, options.timeoutMs ?? DEFAULT_SCRIPT_TIMEOUT_MS);
|
|
34717
34709
|
const outputLimitBytes = Math.max(1024, options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES);
|
|
@@ -35959,7 +35951,7 @@ var init_scheduler = __esm(async () => {
|
|
|
35959
35951
|
});
|
|
35960
35952
|
|
|
35961
35953
|
// ../../packages/module-cron/src/module.ts
|
|
35962
|
-
import { existsSync as
|
|
35954
|
+
import { existsSync as existsSync36 } from "fs";
|
|
35963
35955
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
35964
35956
|
function envMs(name, fallback) {
|
|
35965
35957
|
const parsed = Number.parseInt(process.env[name] ?? "", 10);
|
|
@@ -35990,7 +35982,7 @@ function createCronModule(options = {}) {
|
|
|
35990
35982
|
if (event.type === "topic-deleted")
|
|
35991
35983
|
trackCleanup(resetCronTopicContext(event.topicId));
|
|
35992
35984
|
});
|
|
35993
|
-
const mcpServerFile = options.mcpServerFile ?? (
|
|
35985
|
+
const mcpServerFile = options.mcpServerFile ?? (existsSync36(SOURCE_MCP_SERVER_FILE) ? SOURCE_MCP_SERVER_FILE : PACKAGED_MCP_SERVER_FILE);
|
|
35994
35986
|
const unregisterMcp = host2.registerRuntimeMcpServer("cron-manager", {
|
|
35995
35987
|
scopes: ["forum", "manager"],
|
|
35996
35988
|
forumRequired: true,
|
|
@@ -36269,7 +36261,7 @@ var init_src4 = __esm(async () => {
|
|
|
36269
36261
|
import { randomUUID as randomUUID27 } from "crypto";
|
|
36270
36262
|
import {
|
|
36271
36263
|
copyFileSync as copyFileSync4,
|
|
36272
|
-
existsSync as
|
|
36264
|
+
existsSync as existsSync37,
|
|
36273
36265
|
mkdirSync as mkdirSync31,
|
|
36274
36266
|
readFileSync as readFileSync27,
|
|
36275
36267
|
rmSync as rmSync9,
|
|
@@ -36330,7 +36322,7 @@ class NodeFileStore {
|
|
|
36330
36322
|
hooks = {
|
|
36331
36323
|
resolveAttachmentByFileId: (fileId) => {
|
|
36332
36324
|
const metadata = this.#metadata(fileId);
|
|
36333
|
-
if (!metadata || !
|
|
36325
|
+
if (!metadata || !existsSync37(join44(this.uploadDir, metadata.savedName)))
|
|
36334
36326
|
return null;
|
|
36335
36327
|
return this.#attachment(fileId, metadata);
|
|
36336
36328
|
},
|
|
@@ -36339,7 +36331,7 @@ class NodeFileStore {
|
|
|
36339
36331
|
if (!metadata)
|
|
36340
36332
|
return null;
|
|
36341
36333
|
const path = join44(this.uploadDir, metadata.savedName);
|
|
36342
|
-
return
|
|
36334
|
+
return existsSync37(path) ? path : null;
|
|
36343
36335
|
},
|
|
36344
36336
|
storeLocalFileAsUpload: (absPath, access = {}) => this.store(absPath, access),
|
|
36345
36337
|
deleteFilesForTopic: (topicId) => this.deleteForTopic(topicId)
|
|
@@ -36353,7 +36345,7 @@ class NodeFileStore {
|
|
|
36353
36345
|
const mimeType = file.type || MIME_BY_EXT2[extension] || "application/octet-stream";
|
|
36354
36346
|
const existing = this.#metadata(fileId);
|
|
36355
36347
|
if (existing) {
|
|
36356
|
-
const matches = existing.filename === filename && existing.mimeType === mimeType && existing.sizeBytes === file.size && existing.ownerUserId === access.ownerUserId && existing.topicId === access.topicId &&
|
|
36348
|
+
const matches = existing.filename === filename && existing.mimeType === mimeType && existing.sizeBytes === file.size && existing.ownerUserId === access.ownerUserId && existing.topicId === access.topicId && existsSync37(join44(this.uploadDir, existing.savedName));
|
|
36357
36349
|
return matches ? this.#attachment(fileId, existing) : null;
|
|
36358
36350
|
}
|
|
36359
36351
|
const savedName = `${fileId}${extension}`;
|
|
@@ -36382,11 +36374,11 @@ class NodeFileStore {
|
|
|
36382
36374
|
}
|
|
36383
36375
|
allows(fileId, access) {
|
|
36384
36376
|
const metadata = this.#metadata(fileId);
|
|
36385
|
-
return Boolean(metadata && metadata.ownerUserId === access.ownerUserId && metadata.topicId === access.topicId &&
|
|
36377
|
+
return Boolean(metadata && metadata.ownerUserId === access.ownerUserId && metadata.topicId === access.topicId && existsSync37(join44(this.uploadDir, metadata.savedName)));
|
|
36386
36378
|
}
|
|
36387
36379
|
belongsToTopic(fileId, topicId) {
|
|
36388
36380
|
const metadata = this.#metadata(fileId);
|
|
36389
|
-
return Boolean(metadata && metadata.topicId === topicId &&
|
|
36381
|
+
return Boolean(metadata && metadata.topicId === topicId && existsSync37(join44(this.uploadDir, metadata.savedName)));
|
|
36390
36382
|
}
|
|
36391
36383
|
store(absPath, access = {}) {
|
|
36392
36384
|
this.#ensureDir();
|
|
@@ -36426,7 +36418,7 @@ class NodeFileStore {
|
|
|
36426
36418
|
if (!allowed)
|
|
36427
36419
|
return null;
|
|
36428
36420
|
const path = join44(this.uploadDir, metadata.savedName);
|
|
36429
|
-
if (!
|
|
36421
|
+
if (!existsSync37(path))
|
|
36430
36422
|
return null;
|
|
36431
36423
|
return new Response(Bun.file(path), {
|
|
36432
36424
|
headers: {
|
|
@@ -36598,7 +36590,7 @@ function createPollingSseStream(req, options) {
|
|
|
36598
36590
|
import { randomUUID as randomUUID28, timingSafeEqual as timingSafeEqual4 } from "crypto";
|
|
36599
36591
|
import {
|
|
36600
36592
|
chmodSync as chmodSync6,
|
|
36601
|
-
existsSync as
|
|
36593
|
+
existsSync as existsSync38,
|
|
36602
36594
|
mkdirSync as mkdirSync32,
|
|
36603
36595
|
readFileSync as readFileSync28,
|
|
36604
36596
|
renameSync as renameSync16,
|
|
@@ -38164,7 +38156,7 @@ function writeNodeDaemonInfo(port, startedAt) {
|
|
|
38164
38156
|
return info;
|
|
38165
38157
|
}
|
|
38166
38158
|
function readNodeDaemonInfo() {
|
|
38167
|
-
if (!
|
|
38159
|
+
if (!existsSync38(NODE_DAEMON_INFO_PATH))
|
|
38168
38160
|
return null;
|
|
38169
38161
|
try {
|
|
38170
38162
|
const value = JSON.parse(readFileSync28(NODE_DAEMON_INFO_PATH, "utf8"));
|
|
@@ -39831,7 +39823,7 @@ var init_context_usage = __esm(async () => {
|
|
|
39831
39823
|
|
|
39832
39824
|
// ../../adapters/terminal/src/path-suggest.ts
|
|
39833
39825
|
import { execFile as execFile4 } from "child_process";
|
|
39834
|
-
import { existsSync as
|
|
39826
|
+
import { existsSync as existsSync39, readdirSync as readdirSync14, statSync as statSync19 } from "fs";
|
|
39835
39827
|
import { homedir as homedir12 } from "os";
|
|
39836
39828
|
import { basename as basename12, dirname as dirname22, isAbsolute as isAbsolute8, join as join47, relative as relative4, sep as sep4 } from "path";
|
|
39837
39829
|
import { promisify as promisify4 } from "util";
|
|
@@ -40090,7 +40082,7 @@ function fragmentToAbsolutePath(frag) {
|
|
|
40090
40082
|
}
|
|
40091
40083
|
function fragmentResolves(frag) {
|
|
40092
40084
|
try {
|
|
40093
|
-
return
|
|
40085
|
+
return existsSync39(fragmentToAbsolutePath(frag));
|
|
40094
40086
|
} catch {
|
|
40095
40087
|
return false;
|
|
40096
40088
|
}
|
|
@@ -47247,7 +47239,7 @@ function renderOutbound(text3, maxLen = 4096) {
|
|
|
47247
47239
|
|
|
47248
47240
|
// ../../adapters/telegram/src/adapter.ts
|
|
47249
47241
|
import { randomUUID as randomUUID30 } from "crypto";
|
|
47250
|
-
import { existsSync as
|
|
47242
|
+
import { existsSync as existsSync40 } from "fs";
|
|
47251
47243
|
import { basename as basename14, extname as extname6 } from "path";
|
|
47252
47244
|
function telegramGroupScope(chatId) {
|
|
47253
47245
|
return `tg:${chatId}`;
|
|
@@ -47873,7 +47865,7 @@ function startTelegramAdapter(opts) {
|
|
|
47873
47865
|
logger.warn({ path, chatId }, "telegram adapter: blocked sensitive file path");
|
|
47874
47866
|
return { ref: null, delivered: false, error: "path matches the sensitive-file blacklist" };
|
|
47875
47867
|
}
|
|
47876
|
-
if (!
|
|
47868
|
+
if (!existsSync40(path)) {
|
|
47877
47869
|
const sent = await client.sendMessage(chatId, `File: ${path}`, base).catch(() => null);
|
|
47878
47870
|
const messageId = sentMessageId(sent);
|
|
47879
47871
|
return {
|
|
@@ -49093,11 +49085,11 @@ var exports_join_status = {};
|
|
|
49093
49085
|
__export(exports_join_status, {
|
|
49094
49086
|
hasConfiguredOtiumJoin: () => hasConfiguredOtiumJoin
|
|
49095
49087
|
});
|
|
49096
|
-
import { existsSync as
|
|
49088
|
+
import { existsSync as existsSync41 } from "fs";
|
|
49097
49089
|
import { resolve as resolve25 } from "path";
|
|
49098
49090
|
function hasConfiguredOtiumJoin() {
|
|
49099
49091
|
const envJoin = Boolean(process.env.OTIUM_CENTRAL_URL?.trim() && process.env.OTIUM_CELL_ID?.trim() && process.env.OTIUM_CELL_SECRET?.trim());
|
|
49100
|
-
return envJoin ||
|
|
49092
|
+
return envJoin || existsSync41(resolve25(DATA_DIR, "otium-join.json"));
|
|
49101
49093
|
}
|
|
49102
49094
|
var init_join_status = __esm(() => {
|
|
49103
49095
|
init_config_public();
|
|
@@ -49546,7 +49538,7 @@ import { createHash as createHash15, randomUUID as randomUUID32 } from "crypto";
|
|
|
49546
49538
|
import {
|
|
49547
49539
|
chmodSync as chmodSync7,
|
|
49548
49540
|
closeSync as closeSync5,
|
|
49549
|
-
existsSync as
|
|
49541
|
+
existsSync as existsSync42,
|
|
49550
49542
|
fsyncSync as fsyncSync2,
|
|
49551
49543
|
linkSync,
|
|
49552
49544
|
lstatSync,
|
|
@@ -49709,7 +49701,7 @@ function joinCredentialDigest(join49) {
|
|
|
49709
49701
|
return createHash15("sha256").update(JSON.stringify(normalizedJoin(join49))).digest("base64url");
|
|
49710
49702
|
}
|
|
49711
49703
|
function readPersistedJoins(path = joinFilePath()) {
|
|
49712
|
-
if (!
|
|
49704
|
+
if (!existsSync42(path))
|
|
49713
49705
|
return [];
|
|
49714
49706
|
const parsed = JSON.parse(readFileSync31(path, "utf-8"));
|
|
49715
49707
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
@@ -49770,7 +49762,7 @@ function writeJoins(joins, allowOverwrite) {
|
|
|
49770
49762
|
} catch (error2) {
|
|
49771
49763
|
if (fd !== undefined)
|
|
49772
49764
|
closeSync5(fd);
|
|
49773
|
-
if (
|
|
49765
|
+
if (existsSync42(temporaryPath))
|
|
49774
49766
|
unlinkSync23(temporaryPath);
|
|
49775
49767
|
throw error2;
|
|
49776
49768
|
}
|
|
@@ -49781,7 +49773,7 @@ function saveJoinWhileLocked(join49, options = {}) {
|
|
|
49781
49773
|
const directory = dirname24(path);
|
|
49782
49774
|
const normalized = normalizedJoin(join49);
|
|
49783
49775
|
mkdirSync34(directory, { recursive: true });
|
|
49784
|
-
if (!
|
|
49776
|
+
if (!existsSync42(path))
|
|
49785
49777
|
return writeJoins([normalized], false);
|
|
49786
49778
|
if (lstatSync(path).isSymbolicLink()) {
|
|
49787
49779
|
throw new Error(`refusing to replace symlinked Otium join file at ${path}`);
|
|
@@ -49815,7 +49807,7 @@ function saveJoin(join49, options = {}) {
|
|
|
49815
49807
|
function removeJoin(cellId) {
|
|
49816
49808
|
return withJoinCredentialLock(() => {
|
|
49817
49809
|
const path = joinFilePath();
|
|
49818
|
-
if (!
|
|
49810
|
+
if (!existsSync42(path))
|
|
49819
49811
|
return false;
|
|
49820
49812
|
if (lstatSync(path).isSymbolicLink()) {
|
|
49821
49813
|
throw new Error(`refusing to remove symlinked Otium join file at ${path}`);
|
|
@@ -49856,7 +49848,7 @@ function loadJoins() {
|
|
|
49856
49848
|
logger.warn("otium: OTIUM_CENTRAL_URL, OTIUM_CELL_ID, OTIUM_CELL_SECRET must be set together \u2014 ignoring partial env");
|
|
49857
49849
|
}
|
|
49858
49850
|
const path = joinFilePath();
|
|
49859
|
-
if (!
|
|
49851
|
+
if (!existsSync42(path))
|
|
49860
49852
|
return [];
|
|
49861
49853
|
try {
|
|
49862
49854
|
return readPersistedJoins(path);
|
|
@@ -51568,7 +51560,7 @@ import {
|
|
|
51568
51560
|
import {
|
|
51569
51561
|
chmodSync as chmodSync8,
|
|
51570
51562
|
closeSync as closeSync6,
|
|
51571
|
-
existsSync as
|
|
51563
|
+
existsSync as existsSync43,
|
|
51572
51564
|
fsyncSync as fsyncSync3,
|
|
51573
51565
|
linkSync as linkSync2,
|
|
51574
51566
|
mkdirSync as mkdirSync37,
|
|
@@ -51616,7 +51608,7 @@ function pendingEnrollmentPath() {
|
|
|
51616
51608
|
}
|
|
51617
51609
|
function isEnrollmentPending(invite) {
|
|
51618
51610
|
const path = pendingEnrollmentPath();
|
|
51619
|
-
if (!
|
|
51611
|
+
if (!existsSync43(path))
|
|
51620
51612
|
return false;
|
|
51621
51613
|
try {
|
|
51622
51614
|
const saved = JSON.parse(readFileSync33(path, "utf8"));
|
|
@@ -51627,7 +51619,7 @@ function isEnrollmentPending(invite) {
|
|
|
51627
51619
|
}
|
|
51628
51620
|
function loadOrCreatePending(invite, nodeName) {
|
|
51629
51621
|
const path = pendingEnrollmentPath();
|
|
51630
|
-
if (
|
|
51622
|
+
if (existsSync43(path)) {
|
|
51631
51623
|
const saved = JSON.parse(readFileSync33(path, "utf8"));
|
|
51632
51624
|
if (saved.central === invite.central && saved.token === invite.token)
|
|
51633
51625
|
return saved;
|
|
@@ -51658,9 +51650,9 @@ function loadOrCreatePending(invite, nodeName) {
|
|
|
51658
51650
|
} catch (error2) {
|
|
51659
51651
|
if (fd !== undefined)
|
|
51660
51652
|
closeSync6(fd);
|
|
51661
|
-
if (
|
|
51653
|
+
if (existsSync43(temporaryPath))
|
|
51662
51654
|
unlinkSync24(temporaryPath);
|
|
51663
|
-
if (error2.code === "EEXIST" &&
|
|
51655
|
+
if (error2.code === "EEXIST" && existsSync43(path)) {
|
|
51664
51656
|
const saved = JSON.parse(readFileSync33(path, "utf8"));
|
|
51665
51657
|
if (saved.central === invite.central && saved.token === invite.token)
|
|
51666
51658
|
return saved;
|
|
@@ -51686,7 +51678,7 @@ function replacePendingEnrollment(pending2) {
|
|
|
51686
51678
|
} catch (error2) {
|
|
51687
51679
|
if (fd !== undefined)
|
|
51688
51680
|
closeSync6(fd);
|
|
51689
|
-
if (
|
|
51681
|
+
if (existsSync43(temporaryPath))
|
|
51690
51682
|
unlinkSync24(temporaryPath);
|
|
51691
51683
|
throw error2;
|
|
51692
51684
|
}
|
|
@@ -51772,7 +51764,7 @@ async function claimEnrollment(invite, nodeName) {
|
|
|
51772
51764
|
function commitEnrollment(join50, options = {}) {
|
|
51773
51765
|
return withJoinCredentialLock(() => {
|
|
51774
51766
|
const pendingPath = pendingEnrollmentPath();
|
|
51775
|
-
const pending2 =
|
|
51767
|
+
const pending2 = existsSync43(pendingPath) ? JSON.parse(readFileSync33(pendingPath, "utf8")) : null;
|
|
51776
51768
|
const digest2 = joinCredentialDigest(join50);
|
|
51777
51769
|
if (pending2 && (!pending2.claimed || pending2.claimed.digest !== digest2 || pending2.claimed.cellId !== join50.cellId)) {
|
|
51778
51770
|
throw new Error(`pending Otium enrollment at ${pendingPath} does not match these credentials`);
|
|
@@ -53935,4 +53927,4 @@ switch (command) {
|
|
|
53935
53927
|
}
|
|
53936
53928
|
}
|
|
53937
53929
|
|
|
53938
|
-
//# debugId=
|
|
53930
|
+
//# debugId=315AC1CE6E87329C64756E2164756E21
|