@symerian/symi 2.6.38 → 2.6.39
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/{accounts-BRw8yhIW.js → accounts-D1r2dq1t.js} +21 -21
- package/dist/{accounts-3dCrO3oZ.js → accounts-dRUMQQrB.js} +1 -1
- package/dist/{accounts-BuZxOb3B.js → accounts-wSphH5gv.js} +1 -1
- package/dist/{active-listener-Br2FcRv7.js → active-listener-C3pfJhdC.js} +1 -1
- package/dist/{agent-scope-CpEJ0B88.js → agent-scope-D68_xfTL.js} +3 -3
- package/dist/{audio-preflight-DBMz5TQp.js → audio-preflight-DZ_2w4B5.js} +4 -4
- package/dist/{audio-preflight-Cz1htqcz.js → audio-preflight-UXg8r6a7.js} +29 -29
- package/dist/{auth-profiles-q3HjbboY.js → auth-profiles-CZZjOpX8.js} +17 -17
- package/dist/{bindings-BsHoBLIE.js → bindings-Bat2RnAR.js} +2 -2
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +54 -54
- package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
- package/dist/bundled/command-logger/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +54 -54
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-D-kw83R0.js → channel-activity-Cm1OJRbv.js} +1 -1
- package/dist/{chrome-34eOyt_6.js → chrome-CXbfCc20.js} +5 -5
- package/dist/{chrome-CovpMGdO.js → chrome-D0sqCqXY.js} +16 -16
- package/dist/{chunk-BHW8Yu5A.js → chunk-B9x_1qSr.js} +1 -1
- package/dist/{command-registry-Dk55OGO6.js → command-registry-DSV-4T7A.js} +4 -4
- package/dist/{commands-registry-BSvi46KZ.js → commands-registry-DPf4J7nj.js} +4 -4
- package/dist/{completion-cli-1HmgP7tY.js → completion-cli-DjQVuJdD.js} +2 -2
- package/dist/{completion-cli-DrDwlbAX.js → completion-cli-dlL2VvFw.js} +1 -1
- package/dist/{config-4Iu6iHCA.js → config-giEDOxub.js} +12 -12
- package/dist/control-ui/js/app.js +16 -5
- package/dist/control-ui/js/render.js +24 -35
- package/dist/{deliver-DtM4u1u_.js → deliver-BY58QnO8.js} +20 -20
- package/dist/{deliver-BCYGr-CD.js → deliver-DepjYu87.js} +1 -1
- package/dist/{diagnostic-CQiU0O8b.js → diagnostic-DIKKFHpP.js} +1 -1
- package/dist/{doctor-completion-B8IZFxo9.js → doctor-completion-Cm7WG43a.js} +1 -1
- package/dist/{doctor-completion-D6tzA47C.js → doctor-completion-Z_RXu40-.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/{env-BDXYbTKj.js → env-xmBFQPBP.js} +1 -1
- package/dist/extensionAPI.js +6 -6
- package/dist/{frontmatter-CTR5f_Ez.js → frontmatter-CV0YkjoY.js} +2 -2
- package/dist/{gateway-cli-DdjXGMTo.js → gateway-cli-DliBYmLu.js} +2 -2
- package/dist/{gateway-cli-DCTt5acx.js → gateway-cli-Fnxgv97F.js} +2 -2
- package/dist/{gemini-auth-BkLFtndu.js → gemini-auth-C39f2zRe.js} +1 -1
- package/dist/{github-copilot-token-cCYzSU9h.js → github-copilot-token-B8B2pmph.js} +7 -7
- package/dist/{glass-ui-ws-C_DzMNsd.js → glass-ui-ws-B0sH6QQi.js} +18 -2
- package/dist/{glass-ui-ws-DBlQ-hk7.js → glass-ui-ws-CfNTIb_g.js} +18 -2
- package/dist/{image-mx18hbyY.js → image-CKMw_vhe.js} +4 -4
- package/dist/{image-DKudhySz.js → image-CjuJpc3E.js} +1 -1
- package/dist/{image-ops-C7CauEK8.js → image-ops-M5agStZn.js} +16 -16
- package/dist/index.js +1 -1
- package/dist/{ir-JAy_3A3B.js → ir-Z9axTYHx.js} +4 -4
- package/dist/llm-slug-generator.js +54 -54
- package/dist/{local-roots-Se92wAN5.js → local-roots-Bh5xx9IO.js} +5 -5
- package/dist/{login-IpOTJtyn.js → login-2w0Q7Btb.js} +7 -7
- package/dist/{login-qr-DRepVMvu.js → login-qr-BJMvic1s.js} +12 -12
- package/dist/{manager-CJ3M1Uxq.js → manager-BoLUtbg2.js} +22 -22
- package/dist/{manifest-registry-yb7sAlu4.js → manifest-registry-0J48biqr.js} +19 -19
- package/dist/{markdown-tables-Dnj2LQUc.js → markdown-tables-DuRhvVpP.js} +1 -1
- package/dist/{message-channel-OlFBYAw8.js → message-channel-DwDSKGn4.js} +1 -1
- package/dist/{onboard-CEE38rOh.js → onboard-A5dfwOyL.js} +1 -1
- package/dist/{onboard-Dxf43Kz5.js → onboard-BSlbkbv-.js} +1 -1
- package/dist/{onboarding-B1VwuUX5.js → onboarding-BTNiewJj.js} +1 -1
- package/dist/{onboarding-BxHFNg2y.js → onboarding-COqa6a28.js} +1 -1
- package/dist/{onboarding.finalize-dP5Igu4h.js → onboarding.finalize-CAax5IdL.js} +4 -4
- package/dist/{onboarding.finalize-DQm4Tey0.js → onboarding.finalize-CDsTN9zD.js} +3 -3
- package/dist/{outbound-UwQEXYXv.js → outbound-B_wliV26.js} +7 -7
- package/dist/{outbound-attachment-BzwVH4Pn.js → outbound-attachment-BOy-OY4-.js} +2 -2
- package/dist/paths-CYmyCDsE.js +212 -0
- package/dist/{paths-CbQV9WEg.js → paths-DEuVuViW.js} +1 -1
- package/dist/{pi-auth-json-CCaxCywz.js → pi-auth-json-BQcKJvH0.js} +1 -1
- package/dist/{pi-embedded-DKaDXfFG.js → pi-embedded-R_JHJFwq.js} +16 -16
- package/dist/{pi-embedded-helpers-CepVOR4e.js → pi-embedded-helpers-BJrRH97f.js} +4 -4
- package/dist/{pi-embedded-helpers-DASLSiel.js → pi-embedded-helpers-Cr1X3W9i.js} +73 -73
- package/dist/{plugins-BzmbgY7s.js → plugins-Bkr5ZdYs.js} +9 -9
- package/dist/{program-DGLuU2_H.js → program-C4k7oBuC.js} +2 -2
- package/dist/{program-context-B2BcluHm.js → program-context-CiGMAzyC.js} +6 -6
- package/dist/{prompt-select-styled-CAKiYm_X.js → prompt-select-styled-CYiMonwj.js} +1 -1
- package/dist/{prompt-select-styled-C9RTEKcx.js → prompt-select-styled-CoWkFI4l.js} +1 -1
- package/dist/{pw-ai-Cfeeyp0u.js → pw-ai-CS2tDZd2.js} +1 -1
- package/dist/{pw-ai-CPelTpWz.js → pw-ai-Ch_WUbQZ.js} +11 -11
- package/dist/{qmd-manager-lBS9mT9w.js → qmd-manager-8-Z3Cdpt.js} +7 -7
- package/dist/{register.maintenance-BKB_D_Py.js → register.maintenance-DAwf6cHN.js} +5 -5
- package/dist/{register.maintenance-BgWyvLo5.js → register.maintenance-DVv8ljal.js} +4 -4
- package/dist/{register.onboard-DT1We9u2.js → register.onboard-DJEZcUm5.js} +2 -2
- package/dist/{register.onboard-CSmfgDU5.js → register.onboard-DWrxbBr5.js} +2 -2
- package/dist/{register.setup-CEW5ApHJ.js → register.setup-Ah9E7LHA.js} +2 -2
- package/dist/{register.setup-mJzihfMO.js → register.setup-BDqhSgCz.js} +2 -2
- package/dist/{register.subclis-Bi4jmYW6.js → register.subclis-Bb0yWevQ.js} +3 -3
- package/dist/{registry-DYq1AYOv.js → registry-UkL38jvt.js} +17 -17
- package/dist/{replies-DA4YTv9G.js → replies-CbeMv5WZ.js} +3 -3
- package/dist/{reply-prefix-CvEIl6_d.js → reply-prefix-ZnX2V-k9.js} +1 -1
- package/dist/{resolve-route-DX7xcMsD.js → resolve-route-gl0ZOOKR.js} +4 -4
- package/dist/{retry-B-y5suGA.js → retry-D25Z8MVS.js} +1 -1
- package/dist/{run-main-Ugk40lFF.js → run-main-CZI2Ne08.js} +3 -3
- package/dist/{runner-DKq2NJqT.js → runner-B2Y_5crX.js} +22 -22
- package/dist/{runner-qeYibveF.js → runner-DKkSu9cc.js} +1 -1
- package/dist/{send-Cq1L-2Ik.js → send-CCNIWI2Z.js} +10 -10
- package/dist/{send-C4Bqsa_r.js → send-CPSKimCF.js} +6 -6
- package/dist/{send-DX0p0ym_.js → send-Dy8tsHUE.js} +6 -6
- package/dist/{send-vtz9ZwUj.js → send-iUSZIdml.js} +7 -7
- package/dist/{send-DVt9RLDh.js → send-sgxdFZNy.js} +18 -18
- package/dist/{session-BQWef058.js → session-BTpKgzso.js} +8 -8
- package/dist/{skill-commands-BiPrghRt.js → skill-commands-HBkNllDU.js} +16 -16
- package/dist/{skills-Bs0AW1g3.js → skills-CGHRETGF.js} +24 -24
- package/dist/{sqlite-BHWvOATS.js → sqlite-JHY-uOmS.js} +16 -16
- package/dist/{store-01F_JM7O.js → store-Ea3zM6xK.js} +6 -6
- package/dist/{subsystem-BjyjJF-d.js → subsystem-DN75fnEF.js} +1 -1
- package/dist/{tables-BuM4FKR3.js → tables-Dkg9O8rv.js} +1 -1
- package/dist/{target-errors-BEugWC4F.js → target-errors-Pr77jao5.js} +2 -2
- package/dist/{thinking-BprCy23Z.js → thinking-C9-JAUzD.js} +5 -5
- package/dist/{tokens-W0JzCJJM.js → tokens-CCZl4YHT.js} +1 -1
- package/dist/{tool-images-SqqWIT22.js → tool-images-B1qVCntj.js} +2 -2
- package/dist/{tool-loop-detection-D5mBY7AC.js → tool-loop-detection-C33wf43N.js} +3 -3
- package/dist/{unified-runner-CMgTwCmG.js → unified-runner-hulABWDL.js} +225 -225
- package/dist/{update-cli-Dup4Xi6b.js → update-cli-CnN_k3P1.js} +4 -4
- package/dist/{update-cli-DiH9ccFa.js → update-cli-DwGmFbPH.js} +5 -5
- package/dist/{web-BrGvZQ21.js → web-C0ZdaR6w.js} +6 -6
- package/dist/{web-BIo1QcLd.js → web-DpQ5RaFz.js} +58 -58
- package/dist/{whatsapp-actions-DZfLLQ0Y.js → whatsapp-actions-D_w4AfW9.js} +23 -23
- package/dist/{workspace-DscDraUb.js → workspace-DqJ5h-ZB.js} +27 -27
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/learning-loop/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +6 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +6 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/outlook/package.json +1 -1
- package/extensions/pipeline/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { s as resolveStateDir } from "./paths-
|
|
3
|
-
import { I as resolveUserPath, T as clampNumber, U as truncateUtf16Safe, w as clampInt } from "./registry-
|
|
4
|
-
import { n as resolveAgentConfig, r as resolveAgentDir, s as resolveAgentWorkspaceDir } from "./agent-scope-
|
|
5
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
6
|
-
import { o as resolveSessionTranscriptsDirForAgent } from "./paths-
|
|
7
|
-
import { B as resolveApiKeyForProvider, z as requireApiKey } from "./auth-profiles-
|
|
8
|
-
import { t as isTruthyEnvValue } from "./env-
|
|
2
|
+
import { s as resolveStateDir } from "./paths-CYmyCDsE.js";
|
|
3
|
+
import { I as resolveUserPath, T as clampNumber, U as truncateUtf16Safe, w as clampInt } from "./registry-UkL38jvt.js";
|
|
4
|
+
import { n as resolveAgentConfig, r as resolveAgentDir, s as resolveAgentWorkspaceDir } from "./agent-scope-D68_xfTL.js";
|
|
5
|
+
import { t as createSubsystemLogger } from "./subsystem-DN75fnEF.js";
|
|
6
|
+
import { o as resolveSessionTranscriptsDirForAgent } from "./paths-DEuVuViW.js";
|
|
7
|
+
import { B as resolveApiKeyForProvider, z as requireApiKey } from "./auth-profiles-CZZjOpX8.js";
|
|
8
|
+
import { t as isTruthyEnvValue } from "./env-xmBFQPBP.js";
|
|
9
9
|
import { n as formatErrorMessage } from "./errors-XIsvXeC-.js";
|
|
10
10
|
import { n as onSessionTranscriptUpdate } from "./transcript-events-BBh3Gsrx.js";
|
|
11
|
-
import { n as collectProviderApiKeysForExecution, r as executeWithApiKeyRotation, t as parseGeminiAuth } from "./gemini-auth-
|
|
12
|
-
import { _ as isFileMissingError, a as buildFileEntry, c as ensureDir, d as listMemoryFiles, f as normalizeExtraMemoryPaths, h as runWithConcurrency, i as sessionPathForFile, l as hashText, m as remapChunkLines, n as buildSessionEntry, o as chunkMarkdown, p as parseEmbedding, r as listSessionFilesForAgent, s as cosineSimilarity, t as requireNodeSqlite, u as isMemoryPath, v as statRegularFile } from "./sqlite-
|
|
13
|
-
import { n as retryAsync } from "./retry-
|
|
11
|
+
import { n as collectProviderApiKeysForExecution, r as executeWithApiKeyRotation, t as parseGeminiAuth } from "./gemini-auth-C39f2zRe.js";
|
|
12
|
+
import { _ as isFileMissingError, a as buildFileEntry, c as ensureDir, d as listMemoryFiles, f as normalizeExtraMemoryPaths, h as runWithConcurrency, i as sessionPathForFile, l as hashText, m as remapChunkLines, n as buildSessionEntry, o as chunkMarkdown, p as parseEmbedding, r as listSessionFilesForAgent, s as cosineSimilarity, t as requireNodeSqlite, u as isMemoryPath, v as statRegularFile } from "./sqlite-JHY-uOmS.js";
|
|
13
|
+
import { n as retryAsync } from "./retry-D25Z8MVS.js";
|
|
14
14
|
import path from "node:path";
|
|
15
|
-
import
|
|
15
|
+
import fsSync from "node:fs";
|
|
16
16
|
import os from "node:os";
|
|
17
|
-
import fs
|
|
17
|
+
import fs from "node:fs/promises";
|
|
18
18
|
import { randomUUID } from "node:crypto";
|
|
19
19
|
import { createInterface } from "node:readline";
|
|
20
20
|
import { Readable } from "node:stream";
|
|
@@ -614,7 +614,7 @@ function canAutoSelectLocal(options) {
|
|
|
614
614
|
if (/^(hf:|https?:)/i.test(modelPath)) return false;
|
|
615
615
|
const resolved = resolveUserPath(modelPath);
|
|
616
616
|
try {
|
|
617
|
-
return
|
|
617
|
+
return fsSync.statSync(resolved).isFile();
|
|
618
618
|
} catch {
|
|
619
619
|
return false;
|
|
620
620
|
}
|
|
@@ -936,7 +936,7 @@ async function extractTimestamp(params) {
|
|
|
936
936
|
if (!params.workspaceDir) return null;
|
|
937
937
|
const absolutePath = path.isAbsolute(params.filePath) ? params.filePath : path.resolve(params.workspaceDir, params.filePath);
|
|
938
938
|
try {
|
|
939
|
-
const stat = await fs
|
|
939
|
+
const stat = await fs.stat(absolutePath);
|
|
940
940
|
if (!Number.isFinite(stat.mtimeMs)) return null;
|
|
941
941
|
return new Date(stat.mtimeMs);
|
|
942
942
|
} catch {
|
|
@@ -2038,7 +2038,7 @@ var MemoryManagerSyncOps = class {
|
|
|
2038
2038
|
const source = `${sourceBase}${suffix}`;
|
|
2039
2039
|
const target = `${targetBase}${suffix}`;
|
|
2040
2040
|
try {
|
|
2041
|
-
await fs
|
|
2041
|
+
await fs.rename(source, target);
|
|
2042
2042
|
} catch (err) {
|
|
2043
2043
|
if (err.code !== "ENOENT") throw err;
|
|
2044
2044
|
}
|
|
@@ -2049,7 +2049,7 @@ var MemoryManagerSyncOps = class {
|
|
|
2049
2049
|
"",
|
|
2050
2050
|
"-wal",
|
|
2051
2051
|
"-shm"
|
|
2052
|
-
].map((suffix) => fs
|
|
2052
|
+
].map((suffix) => fs.rm(`${basePath}${suffix}`, { force: true })));
|
|
2053
2053
|
}
|
|
2054
2054
|
ensureSchema() {
|
|
2055
2055
|
const result = ensureMemoryIndexSchema({
|
|
@@ -2073,7 +2073,7 @@ var MemoryManagerSyncOps = class {
|
|
|
2073
2073
|
]);
|
|
2074
2074
|
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
2075
2075
|
for (const entry of additionalPaths) try {
|
|
2076
|
-
const stat =
|
|
2076
|
+
const stat = fsSync.lstatSync(entry);
|
|
2077
2077
|
if (stat.isSymbolicLink()) continue;
|
|
2078
2078
|
if (stat.isDirectory()) {
|
|
2079
2079
|
watchPaths.add(path.join(entry, "**", "*.md"));
|
|
@@ -2144,7 +2144,7 @@ var MemoryManagerSyncOps = class {
|
|
|
2144
2144
|
if (!thresholds) return null;
|
|
2145
2145
|
let stat;
|
|
2146
2146
|
try {
|
|
2147
|
-
stat = await fs
|
|
2147
|
+
stat = await fs.stat(sessionFile);
|
|
2148
2148
|
} catch {
|
|
2149
2149
|
return null;
|
|
2150
2150
|
}
|
|
@@ -2186,7 +2186,7 @@ var MemoryManagerSyncOps = class {
|
|
|
2186
2186
|
if (end <= start) return 0;
|
|
2187
2187
|
let handle;
|
|
2188
2188
|
try {
|
|
2189
|
-
handle = await fs
|
|
2189
|
+
handle = await fs.open(absPath, "r");
|
|
2190
2190
|
} catch (err) {
|
|
2191
2191
|
if (isFileMissingError(err)) return 0;
|
|
2192
2192
|
throw err;
|
|
@@ -3118,7 +3118,7 @@ var MemoryManagerEmbeddingOps = class extends MemoryManagerSyncOps {
|
|
|
3118
3118
|
});
|
|
3119
3119
|
return;
|
|
3120
3120
|
}
|
|
3121
|
-
const content = options.content ?? await fs
|
|
3121
|
+
const content = options.content ?? await fs.readFile(entry.absPath, "utf-8");
|
|
3122
3122
|
const chunks = enforceEmbeddingMaxInputTokens(this.provider, chunkMarkdown(content, this.settings.chunking).filter((chunk) => chunk.text.trim().length > 0));
|
|
3123
3123
|
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
3124
3124
|
const embeddings = this.batch.enabled ? await this.embedChunksWithBatch(chunks, entry, options.source) : await this.embedChunksInBatches(chunks);
|
|
@@ -3732,7 +3732,7 @@ var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbedding
|
|
|
3732
3732
|
if (!allowedWorkspace && this.settings.extraPaths.length > 0) {
|
|
3733
3733
|
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
3734
3734
|
for (const additionalPath of additionalPaths) try {
|
|
3735
|
-
const stat = await fs
|
|
3735
|
+
const stat = await fs.lstat(additionalPath);
|
|
3736
3736
|
if (stat.isSymbolicLink()) continue;
|
|
3737
3737
|
if (stat.isDirectory()) {
|
|
3738
3738
|
if (absPath === additionalPath || absPath.startsWith(`${additionalPath}${path.sep}`)) {
|
|
@@ -3757,7 +3757,7 @@ var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbedding
|
|
|
3757
3757
|
};
|
|
3758
3758
|
let content;
|
|
3759
3759
|
try {
|
|
3760
|
-
content = await fs
|
|
3760
|
+
content = await fs.readFile(absPath, "utf-8");
|
|
3761
3761
|
} catch (err) {
|
|
3762
3762
|
if (isFileMissingError(err)) return {
|
|
3763
3763
|
text: "",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as resolveUserPath, P as resolveConfigDir, k as isRecord } from "./registry-
|
|
1
|
+
import { I as resolveUserPath, P as resolveConfigDir, k as isRecord } from "./registry-UkL38jvt.js";
|
|
2
2
|
import { n as MANIFEST_KEY } from "./legacy-names-CePMUvus.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import fsSync from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
//#region src/infra/host-env-security-policy.json
|
|
@@ -59,7 +59,7 @@ function isPathInside$1(basePath, candidatePath) {
|
|
|
59
59
|
}
|
|
60
60
|
function safeRealpathSync$1(filePath) {
|
|
61
61
|
try {
|
|
62
|
-
return
|
|
62
|
+
return fsSync.realpathSync(filePath);
|
|
63
63
|
} catch {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
@@ -226,13 +226,13 @@ function resolveBundledPluginsDir() {
|
|
|
226
226
|
try {
|
|
227
227
|
const execDir = path.dirname(process.execPath);
|
|
228
228
|
const sibling = path.join(execDir, "extensions");
|
|
229
|
-
if (
|
|
229
|
+
if (fsSync.existsSync(sibling)) return sibling;
|
|
230
230
|
} catch {}
|
|
231
231
|
try {
|
|
232
232
|
let cursor = path.dirname(fileURLToPath(import.meta.url));
|
|
233
233
|
for (let i = 0; i < 6; i += 1) {
|
|
234
234
|
const candidate = path.join(cursor, "extensions");
|
|
235
|
-
if (
|
|
235
|
+
if (fsSync.existsSync(candidate)) return candidate;
|
|
236
236
|
const parent = path.dirname(cursor);
|
|
237
237
|
if (parent === cursor) break;
|
|
238
238
|
cursor = parent;
|
|
@@ -251,20 +251,20 @@ function normalizeStringList(value) {
|
|
|
251
251
|
function resolvePluginManifestPath(rootDir) {
|
|
252
252
|
for (const filename of PLUGIN_MANIFEST_FILENAMES) {
|
|
253
253
|
const candidate = path.join(rootDir, filename);
|
|
254
|
-
if (
|
|
254
|
+
if (fsSync.existsSync(candidate)) return candidate;
|
|
255
255
|
}
|
|
256
256
|
return path.join(rootDir, PLUGIN_MANIFEST_FILENAME);
|
|
257
257
|
}
|
|
258
258
|
function loadPluginManifest(rootDir) {
|
|
259
259
|
const manifestPath = resolvePluginManifestPath(rootDir);
|
|
260
|
-
if (!
|
|
260
|
+
if (!fsSync.existsSync(manifestPath)) return {
|
|
261
261
|
ok: false,
|
|
262
262
|
error: `plugin manifest not found: ${manifestPath}`,
|
|
263
263
|
manifestPath
|
|
264
264
|
};
|
|
265
265
|
let raw;
|
|
266
266
|
try {
|
|
267
|
-
raw = JSON.parse(
|
|
267
|
+
raw = JSON.parse(fsSync.readFileSync(manifestPath, "utf-8"));
|
|
268
268
|
} catch (err) {
|
|
269
269
|
return {
|
|
270
270
|
ok: false,
|
|
@@ -331,7 +331,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
331
331
|
const cached = cache?.get(targetPath);
|
|
332
332
|
if (cached) return cached;
|
|
333
333
|
try {
|
|
334
|
-
const resolved =
|
|
334
|
+
const resolved = fsSync.realpathSync(targetPath);
|
|
335
335
|
cache?.set(targetPath, resolved);
|
|
336
336
|
return resolved;
|
|
337
337
|
} catch {
|
|
@@ -340,7 +340,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
340
340
|
}
|
|
341
341
|
function safeStatSync(targetPath) {
|
|
342
342
|
try {
|
|
343
|
-
return
|
|
343
|
+
return fsSync.statSync(targetPath);
|
|
344
344
|
} catch {
|
|
345
345
|
return null;
|
|
346
346
|
}
|
|
@@ -454,9 +454,9 @@ function isExtensionFile(filePath) {
|
|
|
454
454
|
}
|
|
455
455
|
function readPackageManifest(dir) {
|
|
456
456
|
const manifestPath = path.join(dir, "package.json");
|
|
457
|
-
if (!
|
|
457
|
+
if (!fsSync.existsSync(manifestPath)) return null;
|
|
458
458
|
try {
|
|
459
|
-
const raw =
|
|
459
|
+
const raw = fsSync.readFileSync(manifestPath, "utf-8");
|
|
460
460
|
return JSON.parse(raw);
|
|
461
461
|
} catch {
|
|
462
462
|
return null;
|
|
@@ -514,10 +514,10 @@ function resolvePackageEntrySource(params) {
|
|
|
514
514
|
return source;
|
|
515
515
|
}
|
|
516
516
|
function discoverInDirectory(params) {
|
|
517
|
-
if (!
|
|
517
|
+
if (!fsSync.existsSync(params.dir)) return;
|
|
518
518
|
let entries = [];
|
|
519
519
|
try {
|
|
520
|
-
entries =
|
|
520
|
+
entries = fsSync.readdirSync(params.dir, { withFileTypes: true });
|
|
521
521
|
} catch (err) {
|
|
522
522
|
params.diagnostics.push({
|
|
523
523
|
level: "warn",
|
|
@@ -579,7 +579,7 @@ function discoverInDirectory(params) {
|
|
|
579
579
|
"index.js",
|
|
580
580
|
"index.mjs",
|
|
581
581
|
"index.cjs"
|
|
582
|
-
].map((candidate) => path.join(fullPath, candidate)).find((candidate) =>
|
|
582
|
+
].map((candidate) => path.join(fullPath, candidate)).find((candidate) => fsSync.existsSync(candidate));
|
|
583
583
|
if (indexFile && isExtensionFile(indexFile)) addCandidate({
|
|
584
584
|
candidates: params.candidates,
|
|
585
585
|
diagnostics: params.diagnostics,
|
|
@@ -597,7 +597,7 @@ function discoverInDirectory(params) {
|
|
|
597
597
|
}
|
|
598
598
|
function discoverFromPath(params) {
|
|
599
599
|
const resolved = resolveUserPath(params.rawPath);
|
|
600
|
-
if (!
|
|
600
|
+
if (!fsSync.existsSync(resolved)) {
|
|
601
601
|
params.diagnostics.push({
|
|
602
602
|
level: "error",
|
|
603
603
|
message: `plugin path not found: ${resolved}`,
|
|
@@ -605,7 +605,7 @@ function discoverFromPath(params) {
|
|
|
605
605
|
});
|
|
606
606
|
return;
|
|
607
607
|
}
|
|
608
|
-
const stat =
|
|
608
|
+
const stat = fsSync.statSync(resolved);
|
|
609
609
|
if (stat.isFile()) {
|
|
610
610
|
if (!isExtensionFile(resolved)) {
|
|
611
611
|
params.diagnostics.push({
|
|
@@ -665,7 +665,7 @@ function discoverFromPath(params) {
|
|
|
665
665
|
"index.js",
|
|
666
666
|
"index.mjs",
|
|
667
667
|
"index.cjs"
|
|
668
|
-
].map((candidate) => path.join(resolved, candidate)).find((candidate) =>
|
|
668
|
+
].map((candidate) => path.join(resolved, candidate)).find((candidate) => fsSync.existsSync(candidate));
|
|
669
669
|
if (indexFile && isExtensionFile(indexFile)) {
|
|
670
670
|
addCandidate({
|
|
671
671
|
candidates: params.candidates,
|
|
@@ -779,7 +779,7 @@ function buildCacheKey(params) {
|
|
|
779
779
|
}
|
|
780
780
|
function safeStatMtimeMs(filePath) {
|
|
781
781
|
try {
|
|
782
|
-
return
|
|
782
|
+
return fsSync.statSync(filePath).mtimeMs;
|
|
783
783
|
} catch {
|
|
784
784
|
return null;
|
|
785
785
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
2
|
import { p as normalizeAccountId } from "./session-key-BCzIW1Y2.js";
|
|
3
|
-
import { r as normalizeChannelId } from "./plugins-
|
|
3
|
+
import { r as normalizeChannelId } from "./plugins-Bkr5ZdYs.js";
|
|
4
4
|
|
|
5
5
|
//#region src/config/markdown-tables.ts
|
|
6
6
|
var markdown_tables_exports = /* @__PURE__ */ __exportAll({ resolveMarkdownTableMode: () => resolveMarkdownTableMode });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as getActivePluginRegistry, s as normalizeChatChannelId, t as CHANNEL_IDS } from "./registry-
|
|
1
|
+
import { c as getActivePluginRegistry, s as normalizeChatChannelId, t as CHANNEL_IDS } from "./registry-UkL38jvt.js";
|
|
2
2
|
|
|
3
3
|
//#region src/gateway/protocol/client-info.ts
|
|
4
4
|
const GATEWAY_CLIENT_IDS = {
|
|
@@ -12,7 +12,7 @@ import { a as gatewayInstallErrorHint, i as buildGatewayInstallPlan, r as isGate
|
|
|
12
12
|
import { r as isSystemdUserServiceAvailable } from "./systemd-DT6SbCim.js";
|
|
13
13
|
import { t as resolveGatewayService } from "./service-osK70kTZ.js";
|
|
14
14
|
import { r as healthCommand } from "./health-9z0Hpkuc.js";
|
|
15
|
-
import { t as runOnboardingWizard } from "./onboarding-
|
|
15
|
+
import { t as runOnboardingWizard } from "./onboarding-BTNiewJj.js";
|
|
16
16
|
import { $ as setHuggingfaceApiKey, A as applyXaiConfig, B as applyVercelAiGatewayConfig, E as applyTogetherConfig, I as applyLitellmConfig, M as applyXiaomiConfig, O as applyVeniceConfig, P as applyZaiConfig, Q as setGeminiApiKey, R as applyCloudflareAiGatewayConfig, S as applyQianfanConfig, X as setAnthropicApiKey, Z as setCloudflareAiGatewayConfig, _ as applyMoonshotConfigCn, a as applyMinimaxApiConfig, at as setOpenrouterApiKey, b as applyOpenrouterConfig, ct as setTogetherApiKey, d as applyAuthProfileConfig, dt as setXaiApiKey, et as setKimiCodingApiKey, f as applyHuggingfaceConfig, ft as setXiaomiApiKey, g as applyMoonshotConfig, it as setOpencodeZenApiKey, l as applyMinimaxConfig, lt as setVeniceApiKey, m as applyKimiCodeConfig, n as validateAnthropicSetupToken, nt as setMinimaxApiKey, o as applyMinimaxApiConfigCn, ot as setQianfanApiKey, pt as setZaiApiKey, r as applyOpencodeZenConfig, rt as setMoonshotApiKey, st as setSyntheticApiKey, t as buildTokenProfileId, tt as setLitellmApiKey, ut as setVercelAiGatewayApiKey, w as applySyntheticConfig } from "./auth-token-Cay2jwzn.js";
|
|
17
17
|
import { n as logConfigUpdated } from "./logging-KpicI3yD.js";
|
|
18
18
|
import { n as isDeprecatedAuthChoice, r as normalizeLegacyOnboardAuthChoice } from "./auth-choice-legacy-aJ8D6F_s.js";
|
|
@@ -10,7 +10,7 @@ import { t as assertSupportedRuntime } from "./runtime-guard-D7waq_Ho.js";
|
|
|
10
10
|
import { r as isSystemdUserServiceAvailable } from "./systemd-DlMdyFDY.js";
|
|
11
11
|
import { t as resolveGatewayService } from "./service-Cm9j9WzQ.js";
|
|
12
12
|
import { r as healthCommand } from "./health-NTpZ8ssG.js";
|
|
13
|
-
import { t as runOnboardingWizard } from "./onboarding-
|
|
13
|
+
import { t as runOnboardingWizard } from "./onboarding-COqa6a28.js";
|
|
14
14
|
import { $ as setHuggingfaceApiKey, A as applyXaiConfig, B as applyVercelAiGatewayConfig, E as applyTogetherConfig, I as applyLitellmConfig, M as applyXiaomiConfig, O as applyVeniceConfig, P as applyZaiConfig, Q as setGeminiApiKey, R as applyCloudflareAiGatewayConfig, S as applyQianfanConfig, X as setAnthropicApiKey, Z as setCloudflareAiGatewayConfig, _ as applyMoonshotConfigCn, a as applyMinimaxApiConfig, at as setOpenrouterApiKey, b as applyOpenrouterConfig, ct as setTogetherApiKey, d as applyAuthProfileConfig, dt as setXaiApiKey, et as setKimiCodingApiKey, f as applyHuggingfaceConfig, ft as setXiaomiApiKey, g as applyMoonshotConfig, it as setOpencodeZenApiKey, l as applyMinimaxConfig, lt as setVeniceApiKey, m as applyKimiCodeConfig, n as validateAnthropicSetupToken, nt as setMinimaxApiKey, o as applyMinimaxApiConfigCn, ot as setQianfanApiKey, pt as setZaiApiKey, r as applyOpencodeZenConfig, rt as setMoonshotApiKey, st as setSyntheticApiKey, t as buildTokenProfileId, tt as setLitellmApiKey, ut as setVercelAiGatewayApiKey, w as applySyntheticConfig } from "./auth-token-Cmrk2TPo.js";
|
|
15
15
|
import { n as logConfigUpdated } from "./logging-BGewRZy0.js";
|
|
16
16
|
import { n as isDeprecatedAuthChoice, r as normalizeLegacyOnboardAuthChoice } from "./auth-choice-legacy-BKXTgyr4.js";
|
|
@@ -304,7 +304,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
304
304
|
mode
|
|
305
305
|
});
|
|
306
306
|
await writeConfigFile(nextConfig);
|
|
307
|
-
const { finalizeOnboardingWizard } = await import("./onboarding.finalize-
|
|
307
|
+
const { finalizeOnboardingWizard } = await import("./onboarding.finalize-CDsTN9zD.js");
|
|
308
308
|
const { launchedTui } = await finalizeOnboardingWizard({
|
|
309
309
|
flow,
|
|
310
310
|
opts,
|
|
@@ -302,7 +302,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
302
302
|
mode
|
|
303
303
|
});
|
|
304
304
|
await writeConfigFile(nextConfig);
|
|
305
|
-
const { finalizeOnboardingWizard } = await import("./onboarding.finalize-
|
|
305
|
+
const { finalizeOnboardingWizard } = await import("./onboarding.finalize-CAax5IdL.js");
|
|
306
306
|
const { launchedTui } = await finalizeOnboardingWizard({
|
|
307
307
|
flow,
|
|
308
308
|
opts,
|
|
@@ -100,10 +100,10 @@ import "./prompt-style-DwCXob2h.js";
|
|
|
100
100
|
import "./pairing-labels-D1HDboV2.js";
|
|
101
101
|
import "./pi-tools.policy-De00gPXt.js";
|
|
102
102
|
import "./note-DDecZomM.js";
|
|
103
|
-
import "./register.subclis-
|
|
104
|
-
import "./command-registry-
|
|
103
|
+
import "./register.subclis-Bb0yWevQ.js";
|
|
104
|
+
import "./command-registry-DSV-4T7A.js";
|
|
105
105
|
import "./program-context-CqzR_m-7.js";
|
|
106
|
-
import { r as installCompletion } from "./completion-cli-
|
|
106
|
+
import { r as installCompletion } from "./completion-cli-DjQVuJdD.js";
|
|
107
107
|
import { a as gatewayInstallErrorHint, i as buildGatewayInstallPlan, n as GATEWAY_DAEMON_RUNTIME_OPTIONS, t as DEFAULT_GATEWAY_DAEMON_RUNTIME } from "./daemon-runtime-CfRwa6qh.js";
|
|
108
108
|
import "./runtime-guard-D7waq_Ho.js";
|
|
109
109
|
import { r as isSystemdUserServiceAvailable } from "./systemd-DlMdyFDY.js";
|
|
@@ -111,7 +111,7 @@ import { t as resolveGatewayService } from "./service-Cm9j9WzQ.js";
|
|
|
111
111
|
import { r as healthCommand } from "./health-NTpZ8ssG.js";
|
|
112
112
|
import { t as ensureControlUiAssetsBuilt } from "./control-ui-assets-BseSWee1.js";
|
|
113
113
|
import { t as formatHealthCheckFailure } from "./health-format-CzgUHmmX.js";
|
|
114
|
-
import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-
|
|
114
|
+
import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-Z_RXu40-.js";
|
|
115
115
|
import { t as runTui } from "./tui-2nWOvxxE.js";
|
|
116
116
|
import os from "node:os";
|
|
117
117
|
import path from "node:path";
|
|
@@ -104,16 +104,16 @@ import "./control-service-Dtn-qw2s.js";
|
|
|
104
104
|
import "./stagger-CvFURHzt.js";
|
|
105
105
|
import "./channel-selection-V2xDgw16.js";
|
|
106
106
|
import "./runtime-guard-Dik20CVM.js";
|
|
107
|
-
import "./program-context-
|
|
107
|
+
import "./program-context-CiGMAzyC.js";
|
|
108
108
|
import "./note-DQ9BvHF2.js";
|
|
109
|
-
import { r as installCompletion } from "./completion-cli-
|
|
109
|
+
import { r as installCompletion } from "./completion-cli-dlL2VvFw.js";
|
|
110
110
|
import { a as gatewayInstallErrorHint, i as buildGatewayInstallPlan, n as GATEWAY_DAEMON_RUNTIME_OPTIONS, t as DEFAULT_GATEWAY_DAEMON_RUNTIME } from "./daemon-runtime-COZ4usfy.js";
|
|
111
111
|
import { r as isSystemdUserServiceAvailable } from "./systemd-DT6SbCim.js";
|
|
112
112
|
import { t as resolveGatewayService } from "./service-osK70kTZ.js";
|
|
113
113
|
import { r as healthCommand } from "./health-9z0Hpkuc.js";
|
|
114
114
|
import { t as ensureControlUiAssetsBuilt } from "./control-ui-assets-B7moDVHX.js";
|
|
115
115
|
import { t as formatHealthCheckFailure } from "./health-format-DRCaak6L.js";
|
|
116
|
-
import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-
|
|
116
|
+
import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-Cm7WG43a.js";
|
|
117
117
|
import { t as runTui } from "./tui-DLaU7tTx.js";
|
|
118
118
|
import os from "node:os";
|
|
119
119
|
import path from "node:path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { D as escapeRegExp, H as toWhatsappJid, rt as getChildLogger } from "./registry-
|
|
3
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
4
|
-
import { n as loadConfig } from "./config-
|
|
5
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
6
|
-
import { a as loadWebMedia } from "./ir-
|
|
2
|
+
import { D as escapeRegExp, H as toWhatsappJid, rt as getChildLogger } from "./registry-UkL38jvt.js";
|
|
3
|
+
import { t as createSubsystemLogger } from "./subsystem-DN75fnEF.js";
|
|
4
|
+
import { n as loadConfig } from "./config-giEDOxub.js";
|
|
5
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-DuRhvVpP.js";
|
|
6
|
+
import { a as loadWebMedia } from "./ir-Z9axTYHx.js";
|
|
7
7
|
import { n as normalizePollInput } from "./polls-BKbIUHj7.js";
|
|
8
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
9
|
-
import { n as requireActiveWebListener } from "./active-listener-
|
|
8
|
+
import { t as convertMarkdownTables } from "./tables-Dkg9O8rv.js";
|
|
9
|
+
import { n as requireActiveWebListener } from "./active-listener-C3pfJhdC.js";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
|
|
12
12
|
//#region src/markdown/whatsapp.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as saveMediaBuffer } from "./store-
|
|
2
|
-
import { a as loadWebMedia } from "./ir-
|
|
1
|
+
import { r as saveMediaBuffer } from "./store-Ea3zM6xK.js";
|
|
2
|
+
import { a as loadWebMedia } from "./ir-Z9axTYHx.js";
|
|
3
3
|
|
|
4
4
|
//#region src/media/outbound-attachment.ts
|
|
5
5
|
async function resolveOutboundAttachmentFromUrl(mediaUrl, maxBytes, options) {
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fsSync from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
|
|
5
|
+
//#region src/infra/home-dir.ts
|
|
6
|
+
function normalize(value) {
|
|
7
|
+
const trimmed = value?.trim();
|
|
8
|
+
return trimmed ? trimmed : void 0;
|
|
9
|
+
}
|
|
10
|
+
function resolveEffectiveHomeDir(env = process.env, homedir = os.homedir) {
|
|
11
|
+
const raw = resolveRawHomeDir(env, homedir);
|
|
12
|
+
return raw ? path.resolve(raw) : void 0;
|
|
13
|
+
}
|
|
14
|
+
function resolveRawHomeDir(env, homedir) {
|
|
15
|
+
const explicitHome = normalize(env.SYMI_HOME);
|
|
16
|
+
if (explicitHome) {
|
|
17
|
+
if (explicitHome === "~" || explicitHome.startsWith("~/") || explicitHome.startsWith("~\\")) {
|
|
18
|
+
const fallbackHome = normalize(env.HOME) ?? normalize(env.USERPROFILE) ?? normalizeSafe(homedir);
|
|
19
|
+
if (fallbackHome) return explicitHome.replace(/^~(?=$|[\\/])/, fallbackHome);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return explicitHome;
|
|
23
|
+
}
|
|
24
|
+
const envHome = normalize(env.HOME);
|
|
25
|
+
if (envHome) return envHome;
|
|
26
|
+
const userProfile = normalize(env.USERPROFILE);
|
|
27
|
+
if (userProfile) return userProfile;
|
|
28
|
+
return normalizeSafe(homedir);
|
|
29
|
+
}
|
|
30
|
+
function normalizeSafe(homedir) {
|
|
31
|
+
try {
|
|
32
|
+
return normalize(homedir());
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function resolveRequiredHomeDir(env = process.env, homedir = os.homedir) {
|
|
38
|
+
return resolveEffectiveHomeDir(env, homedir) ?? path.resolve(process.cwd());
|
|
39
|
+
}
|
|
40
|
+
function expandHomePrefix(input, opts) {
|
|
41
|
+
if (!input.startsWith("~")) return input;
|
|
42
|
+
const home = normalize(opts?.home) ?? resolveEffectiveHomeDir(opts?.env ?? process.env, opts?.homedir ?? os.homedir);
|
|
43
|
+
if (!home) return input;
|
|
44
|
+
return input.replace(/^~(?=$|[\\/])/, home);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/config/paths.ts
|
|
49
|
+
/**
|
|
50
|
+
* Nix mode detection: When SYMI_NIX_MODE=1, the gateway is running under Nix.
|
|
51
|
+
* In this mode:
|
|
52
|
+
* - No auto-install flows should be attempted
|
|
53
|
+
* - Missing dependencies should produce actionable Nix-specific error messages
|
|
54
|
+
* - Config is managed externally (read-only from Nix perspective)
|
|
55
|
+
*/
|
|
56
|
+
function resolveIsNixMode(env = process.env) {
|
|
57
|
+
return env.SYMI_NIX_MODE === "1";
|
|
58
|
+
}
|
|
59
|
+
const isNixMode = resolveIsNixMode();
|
|
60
|
+
const LEGACY_STATE_DIRNAMES = [];
|
|
61
|
+
const NEW_STATE_DIRNAME = ".symi";
|
|
62
|
+
const CONFIG_FILENAME = "symi.json";
|
|
63
|
+
const LEGACY_CONFIG_FILENAMES = [];
|
|
64
|
+
function resolveDefaultHomeDir() {
|
|
65
|
+
return resolveRequiredHomeDir(process.env, os.homedir);
|
|
66
|
+
}
|
|
67
|
+
/** Build a homedir thunk that respects SYMI_HOME for the given env. */
|
|
68
|
+
function envHomedir(env) {
|
|
69
|
+
return () => resolveRequiredHomeDir(env, os.homedir);
|
|
70
|
+
}
|
|
71
|
+
function legacyStateDirs(homedir = resolveDefaultHomeDir) {
|
|
72
|
+
return LEGACY_STATE_DIRNAMES.map((dir) => path.join(homedir(), dir));
|
|
73
|
+
}
|
|
74
|
+
function newStateDir(homedir = resolveDefaultHomeDir) {
|
|
75
|
+
return path.join(homedir(), NEW_STATE_DIRNAME);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* State directory for mutable data (sessions, logs, caches).
|
|
79
|
+
* Can be overridden via SYMI_STATE_DIR.
|
|
80
|
+
* Default: ~/.symi
|
|
81
|
+
*/
|
|
82
|
+
function resolveStateDir(env = process.env, homedir = envHomedir(env)) {
|
|
83
|
+
const effectiveHomedir = () => resolveRequiredHomeDir(env, homedir);
|
|
84
|
+
const override = env.SYMI_STATE_DIR?.trim();
|
|
85
|
+
if (override) return resolveUserPath(override, env, effectiveHomedir);
|
|
86
|
+
const newDir = newStateDir(effectiveHomedir);
|
|
87
|
+
const legacyDirs = legacyStateDirs(effectiveHomedir);
|
|
88
|
+
if (fsSync.existsSync(newDir)) return newDir;
|
|
89
|
+
const existingLegacy = legacyDirs.find((dir) => {
|
|
90
|
+
try {
|
|
91
|
+
return fsSync.existsSync(dir);
|
|
92
|
+
} catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (existingLegacy) return existingLegacy;
|
|
97
|
+
return newDir;
|
|
98
|
+
}
|
|
99
|
+
function resolveUserPath(input, env = process.env, homedir = envHomedir(env)) {
|
|
100
|
+
const trimmed = input.trim();
|
|
101
|
+
if (!trimmed) return trimmed;
|
|
102
|
+
if (trimmed.startsWith("~")) {
|
|
103
|
+
const expanded = expandHomePrefix(trimmed, {
|
|
104
|
+
home: resolveRequiredHomeDir(env, homedir),
|
|
105
|
+
env,
|
|
106
|
+
homedir
|
|
107
|
+
});
|
|
108
|
+
return path.resolve(expanded);
|
|
109
|
+
}
|
|
110
|
+
return path.resolve(trimmed);
|
|
111
|
+
}
|
|
112
|
+
const STATE_DIR = resolveStateDir();
|
|
113
|
+
/**
|
|
114
|
+
* Config file path (JSON5).
|
|
115
|
+
* Can be overridden via SYMI_CONFIG_PATH.
|
|
116
|
+
* Default: ~/.symi/symi.json (or $SYMI_STATE_DIR/symi.json)
|
|
117
|
+
*/
|
|
118
|
+
function resolveCanonicalConfigPath(env = process.env, stateDir = resolveStateDir(env, envHomedir(env))) {
|
|
119
|
+
const override = env.SYMI_CONFIG_PATH?.trim();
|
|
120
|
+
if (override) return resolveUserPath(override, env, envHomedir(env));
|
|
121
|
+
return path.join(stateDir, CONFIG_FILENAME);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolve the active config path by preferring existing config candidates
|
|
125
|
+
* before falling back to the canonical path.
|
|
126
|
+
*/
|
|
127
|
+
function resolveConfigPathCandidate(env = process.env, homedir = envHomedir(env)) {
|
|
128
|
+
const existing = resolveDefaultConfigCandidates(env, homedir).find((candidate) => {
|
|
129
|
+
try {
|
|
130
|
+
return fsSync.existsSync(candidate);
|
|
131
|
+
} catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (existing) return existing;
|
|
136
|
+
return resolveCanonicalConfigPath(env, resolveStateDir(env, homedir));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Active config path (prefers existing config files).
|
|
140
|
+
*/
|
|
141
|
+
function resolveConfigPath(env = process.env, stateDir = resolveStateDir(env, envHomedir(env)), homedir = envHomedir(env)) {
|
|
142
|
+
const override = env.SYMI_CONFIG_PATH?.trim();
|
|
143
|
+
if (override) return resolveUserPath(override, env, homedir);
|
|
144
|
+
const stateOverride = env.SYMI_STATE_DIR?.trim();
|
|
145
|
+
const existing = [path.join(stateDir, CONFIG_FILENAME), ...LEGACY_CONFIG_FILENAMES.map((name) => path.join(stateDir, name))].find((candidate) => {
|
|
146
|
+
try {
|
|
147
|
+
return fsSync.existsSync(candidate);
|
|
148
|
+
} catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
if (existing) return existing;
|
|
153
|
+
if (stateOverride) return path.join(stateDir, CONFIG_FILENAME);
|
|
154
|
+
const defaultStateDir = resolveStateDir(env, homedir);
|
|
155
|
+
if (path.resolve(stateDir) === path.resolve(defaultStateDir)) return resolveConfigPathCandidate(env, homedir);
|
|
156
|
+
return path.join(stateDir, CONFIG_FILENAME);
|
|
157
|
+
}
|
|
158
|
+
const CONFIG_PATH = resolveConfigPathCandidate();
|
|
159
|
+
/**
|
|
160
|
+
* Resolve default config path candidates across default locations.
|
|
161
|
+
* Order: explicit config path → state-dir-derived paths → new default.
|
|
162
|
+
*/
|
|
163
|
+
function resolveDefaultConfigCandidates(env = process.env, homedir = envHomedir(env)) {
|
|
164
|
+
const effectiveHomedir = () => resolveRequiredHomeDir(env, homedir);
|
|
165
|
+
const explicit = env.SYMI_CONFIG_PATH?.trim();
|
|
166
|
+
if (explicit) return [resolveUserPath(explicit, env, effectiveHomedir)];
|
|
167
|
+
const candidates = [];
|
|
168
|
+
const symiStateDir = env.SYMI_STATE_DIR?.trim();
|
|
169
|
+
if (symiStateDir) {
|
|
170
|
+
const resolved = resolveUserPath(symiStateDir, env, effectiveHomedir);
|
|
171
|
+
candidates.push(path.join(resolved, CONFIG_FILENAME));
|
|
172
|
+
candidates.push(...LEGACY_CONFIG_FILENAMES.map((name) => path.join(resolved, name)));
|
|
173
|
+
}
|
|
174
|
+
const defaultDirs = [newStateDir(effectiveHomedir), ...legacyStateDirs(effectiveHomedir)];
|
|
175
|
+
for (const dir of defaultDirs) {
|
|
176
|
+
candidates.push(path.join(dir, CONFIG_FILENAME));
|
|
177
|
+
candidates.push(...LEGACY_CONFIG_FILENAMES.map((name) => path.join(dir, name)));
|
|
178
|
+
}
|
|
179
|
+
return candidates;
|
|
180
|
+
}
|
|
181
|
+
const DEFAULT_GATEWAY_PORT = 18789;
|
|
182
|
+
const OAUTH_FILENAME = "oauth.json";
|
|
183
|
+
/**
|
|
184
|
+
* OAuth credentials storage directory.
|
|
185
|
+
*
|
|
186
|
+
* Precedence:
|
|
187
|
+
* - `SYMI_OAUTH_DIR` (explicit override)
|
|
188
|
+
* - `$*_STATE_DIR/credentials` (canonical server/default)
|
|
189
|
+
*/
|
|
190
|
+
function resolveOAuthDir(env = process.env, stateDir = resolveStateDir(env, envHomedir(env))) {
|
|
191
|
+
const override = env.SYMI_OAUTH_DIR?.trim();
|
|
192
|
+
if (override) return resolveUserPath(override, env, envHomedir(env));
|
|
193
|
+
return path.join(stateDir, "credentials");
|
|
194
|
+
}
|
|
195
|
+
function resolveOAuthPath(env = process.env, stateDir = resolveStateDir(env, envHomedir(env))) {
|
|
196
|
+
return path.join(resolveOAuthDir(env, stateDir), OAUTH_FILENAME);
|
|
197
|
+
}
|
|
198
|
+
function resolveGatewayPort(cfg, env = process.env) {
|
|
199
|
+
const envRaw = env.SYMI_GATEWAY_PORT?.trim();
|
|
200
|
+
if (envRaw) {
|
|
201
|
+
const parsed = Number.parseInt(envRaw, 10);
|
|
202
|
+
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
203
|
+
}
|
|
204
|
+
const configPort = cfg?.gateway?.port;
|
|
205
|
+
if (typeof configPort === "number" && Number.isFinite(configPort)) {
|
|
206
|
+
if (configPort > 0) return configPort;
|
|
207
|
+
}
|
|
208
|
+
return DEFAULT_GATEWAY_PORT;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
export { resolveOAuthDir as a, expandHomePrefix as c, resolveGatewayPort as i, resolveEffectiveHomeDir as l, resolveConfigPath as n, resolveOAuthPath as o, resolveDefaultConfigCandidates as r, resolveStateDir as s, STATE_DIR as t, resolveRequiredHomeDir as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as expandHomePrefix, s as resolveStateDir, u as resolveRequiredHomeDir } from "./paths-
|
|
1
|
+
import { c as expandHomePrefix, s as resolveStateDir, u as resolveRequiredHomeDir } from "./paths-CYmyCDsE.js";
|
|
2
2
|
import { s as normalizeAgentId, t as DEFAULT_AGENT_ID } from "./session-key-BCzIW1Y2.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import os from "node:os";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { C as normalizeProviderId, U as normalizeOptionalSecretInput, d as ensureAuthProfileStore } from "./auth-profiles-
|
|
2
|
+
import { C as normalizeProviderId, U as normalizeOptionalSecretInput, d as ensureAuthProfileStore } from "./auth-profiles-CZZjOpX8.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
|