@fased/fased 0.1.42 → 0.1.44
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/acp/client.js +2 -2
- package/dist/acp/secret-file.js +2 -2
- package/dist/agents/agent-scope.js +2 -2
- package/dist/agents/apply-patch.js +8 -8
- package/dist/agents/auth-profiles/paths.js +2 -2
- package/dist/agents/auth-profiles/store.js +2 -2
- package/dist/agents/bash-tools.shared.js +2 -2
- package/dist/agents/cli-credentials.js +4 -4
- package/dist/agents/docs-path.js +3 -3
- package/dist/agents/embedded-pi-mcp.js +4 -4
- package/dist/agents/identity-avatar.js +3 -3
- package/dist/agents/identity-file.js +2 -2
- package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
- package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
- package/dist/agents/pi-model-discovery.js +6 -6
- package/dist/agents/pi-project-settings.js +3 -3
- package/dist/agents/sandbox/fs-bridge.js +2 -2
- package/dist/agents/session-dirs.js +4 -4
- package/dist/agents/session-write-lock.js +13 -13
- package/dist/agents/shell-utils.js +5 -5
- package/dist/agents/skills/bundled-dir.js +4 -4
- package/dist/agents/skills/local-loader.js +6 -6
- package/dist/agents/skills/plugin-skills.js +2 -2
- package/dist/agents/skills/workspace.js +13 -13
- package/dist/agents/skills-install-download.js +7 -7
- package/dist/agents/skills-install-plan.js +2 -2
- package/dist/agents/skills-install.js +2 -2
- package/dist/agents/skills-status.js +2 -2
- package/dist/agents/subagent-depth.js +2 -2
- package/dist/agents/system-prompt-params.js +2 -2
- package/dist/agents/workspace.js +22 -22
- package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
- package/dist/auto-reply/reply/agent-runner.js +2 -2
- package/dist/auto-reply/reply/commands-export-session.js +7 -7
- package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
- package/dist/auto-reply/reply/post-compaction-context.js +3 -3
- package/dist/auto-reply/reply/session.js +3 -3
- package/dist/auto-reply/skill-commands.js +3 -3
- package/dist/auto-reply/status.js +6 -6
- package/dist/brand.js +1 -1
- package/dist/browser/chrome.executables.js +3 -3
- package/dist/browser/chrome.js +3 -3
- package/dist/browser/chrome.profile-decoration.js +6 -6
- package/dist/browser/profiles-service.js +2 -2
- package/dist/browser/server-context.js +2 -2
- package/dist/browser/trash.js +4 -4
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/server.js +4 -4
- package/dist/capabilities/catalog.js +3 -3
- package/dist/channels/plugins/catalog.js +3 -3
- package/dist/cli/browser-cli-extension.js +6 -6
- package/dist/cli/command-format.js +2 -2
- package/dist/cli/cron-cli/register.cron-simple.js +2 -2
- package/dist/cli/daemon-cli/restart-health.js +49 -13
- package/dist/cli/dns-cli.js +9 -9
- package/dist/cli/gateway-cli/dev.js +5 -5
- package/dist/cli/gateway-cli/run.js +2 -2
- package/dist/cli/hooks-cli.js +5 -5
- package/dist/cli/memory-cli.js +7 -7
- package/dist/cli/nodes-media-utils.js +2 -2
- package/dist/cli/plugins-cli.js +2 -2
- package/dist/cli/secrets-cli.js +3 -3
- package/dist/cli/update-cli/shared.js +1 -29
- package/dist/cli/update-cli/update-command.js +12 -15
- package/dist/cli/windows-argv.js +2 -2
- package/dist/commands/dashboard-link.js +3 -3
- package/dist/commands/doctor-install.js +5 -5
- package/dist/commands/doctor-memory-search.js +2 -2
- package/dist/commands/doctor-platform-notes.js +2 -2
- package/dist/commands/doctor-sandbox.js +2 -2
- package/dist/commands/doctor-state-integrity.js +23 -23
- package/dist/commands/doctor-workspace.js +3 -3
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/managed-up.js +2 -2
- package/dist/commands/onboard-auth.credentials.js +3 -3
- package/dist/commands/onboarding/plugin-install.js +2 -2
- package/dist/commands/sessions-cleanup.js +2 -2
- package/dist/commands/signal-install.js +6 -6
- package/dist/commands/status-all/channels.js +2 -2
- package/dist/commands/wallet.js +47 -47
- package/dist/config/cache-utils.js +2 -2
- package/dist/config/includes.js +5 -5
- package/dist/config/io.js +2 -2
- package/dist/config/paths.js +3 -3
- package/dist/config/sat-runtime-ids.js +3 -3
- package/dist/config/sessions/disk-budget.js +6 -6
- package/dist/config/sessions/paths.js +2 -2
- package/dist/config/sessions/store.js +17 -17
- package/dist/config/sessions/transcript.js +4 -4
- package/dist/config/talk.js +2 -2
- package/dist/cron/service/store.js +2 -2
- package/dist/cron/store.js +6 -6
- package/dist/daemon/systemd-system.js +5 -5
- package/dist/discord/monitor/thread-bindings.state.js +2 -2
- package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
- package/dist/gateway/control-ui-boot-check.js +6 -6
- package/dist/gateway/control-ui-login.js +7 -7
- package/dist/gateway/control-ui.js +9 -9
- package/dist/gateway/hooks-mapping.js +4 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +4 -4
- package/dist/gateway/server-methods/chat.js +6 -6
- package/dist/gateway/server-methods/sessions.js +6 -6
- package/dist/gateway/server-methods/usage.js +2 -2
- package/dist/gateway/server.impl.js +3 -3
- package/dist/gateway/session-compaction-checkpoints.js +4 -4
- package/dist/gateway/session-utils.fs.js +24 -24
- package/dist/gateway/session-utils.js +6 -6
- package/dist/hooks/bundled-dir.js +4 -4
- package/dist/hooks/gmail-setup-utils.js +6 -6
- package/dist/hooks/import-url.js +2 -2
- package/dist/hooks/loader.js +4 -4
- package/dist/hooks/workspace.js +7 -7
- package/dist/infra/archive.js +17 -17
- package/dist/infra/boundary-file-read.js +2 -2
- package/dist/infra/boundary-path.js +15 -15
- package/dist/infra/brew.js +2 -2
- package/dist/infra/control-ui-assets.js +14 -14
- package/dist/infra/device-auth-store.js +8 -8
- package/dist/infra/device-identity.js +8 -8
- package/dist/infra/dotenv.js +2 -2
- package/dist/infra/exec-approvals.js +8 -8
- package/dist/infra/exec-command-resolution.js +4 -4
- package/dist/infra/exec-safe-bin-trust.js +2 -2
- package/dist/infra/fased-root.js +5 -5
- package/dist/infra/fs-safe.js +14 -14
- package/dist/infra/gateway-lock.js +11 -11
- package/dist/infra/git-commit.js +5 -5
- package/dist/infra/git-root.js +4 -4
- package/dist/infra/hosted-runtime-artifact.js +3 -3
- package/dist/infra/is-main.js +2 -2
- package/dist/infra/json-file.js +7 -7
- package/dist/infra/outbound/delivery-queue.js +16 -16
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/ports-lsof.js +4 -4
- package/dist/infra/provider-usage.auth.js +3 -3
- package/dist/infra/safe-open-sync.js +2 -2
- package/dist/infra/session-cost-usage.js +9 -9
- package/dist/infra/shell-env.js +2 -2
- package/dist/infra/state-migrations.fs.js +6 -6
- package/dist/infra/state-migrations.js +23 -23
- package/dist/infra/tmp-fased-dir.js +6 -6
- package/dist/infra/update-global.js +1 -0
- package/dist/infra/update-runner.js +111 -64
- package/dist/infra/widearea-dns.js +3 -3
- package/dist/infra/wsl.js +2 -2
- package/dist/light-update-status.js +1 -1
- package/dist/line/accounts.js +2 -2
- package/dist/line/download.js +2 -2
- package/dist/logging/config.js +3 -3
- package/dist/logging/logger.js +7 -7
- package/dist/managed/federation.js +3 -3
- package/dist/managed/tunnel.js +3 -3
- package/dist/media/store.js +13 -13
- package/dist/media-understanding/runner.js +3 -3
- package/dist/memory/embeddings.js +2 -2
- package/dist/memory/internal.js +10 -10
- package/dist/memory/manager-sync-ops.js +7 -7
- package/dist/memory/repair-executor.js +17 -17
- package/dist/node-host/invoke-system-run-plan.js +8 -8
- package/dist/node-host/invoke.js +2 -2
- package/dist/node-host/runner.js +3 -3
- package/dist/pairing/pairing-store.js +3 -3
- package/dist/plugin-sdk/{audio-preflight-XJNZUuhw.js → audio-preflight-DEoblcsk.js} +1 -1
- package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
- package/dist/plugin-sdk/{chunk-items-me0j1xjK.js → chunk-items-ClDXjhOb.js} +1 -1
- package/dist/plugin-sdk/command-status.js +1 -1
- package/dist/plugin-sdk/device-pair.d.ts +1 -1
- package/dist/plugin-sdk/discord.d.ts +3 -3
- package/dist/plugin-sdk/index.d.ts +5 -5
- package/dist/plugin-sdk/index.js +2 -1
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/{monitor-DUyt6cCK.js → monitor-CZ490e2-.js} +3 -3
- package/dist/plugin-sdk/{monitor-C7si_bKw.js → monitor-_2NRVtaY.js} +3 -3
- package/dist/plugin-sdk/{openresponses-http-sYsdEjGP.js → openresponses-http-BEYlPTy3.js} +1 -1
- package/dist/plugin-sdk/{pairing-message-C5m-8Evp.d.ts → pairing-message-6XVXW554.d.ts} +1 -1
- package/dist/plugin-sdk/{pi-embedded-runner-C6HkZJ5E.js → pi-embedded-runner-SkBGtJFB.js} +7 -7
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
- package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
- package/dist/plugin-sdk/{slack-CEoLScM7.js → slack--DAH0bKU.js} +3 -3
- package/dist/plugin-sdk/slack.d.ts +3 -3
- package/dist/plugin-sdk/{sticker-cache-PRfvBRnv.js → sticker-cache-CUnBcKME.js} +2 -2
- package/dist/plugin-sdk/{telegram-actions-D4PNLPEZ.js → telegram-actions-L7LDJqla.js} +2 -2
- package/dist/plugin-sdk/telegram.d.ts +3 -3
- package/dist/plugin-sdk/{tmp-fased-dir-B-AAdaCr.d.ts → tmp-fased-dir-BpMLNd4L.d.ts} +1 -1
- package/dist/plugin-sdk/{types-ZT0DGnls.d.ts → types-0CsXVmg8.d.ts} +2 -2
- package/dist/plugin-sdk/{types-56R2vXgt.d.ts → types-DMLEeE52.d.ts} +1 -1
- package/dist/plugin-sdk/{web-CSpyzE3P.js → web-DMRFrK11.js} +1 -1
- package/dist/plugin-sdk/whatsapp.d.ts +3 -3
- package/dist/plugins/bundled-dir.js +3 -3
- package/dist/plugins/discovery.js +11 -11
- package/dist/plugins/loader.js +13 -13
- package/dist/plugins/manifest-registry.js +2 -2
- package/dist/plugins/manifest.js +4 -4
- package/dist/plugins/path-safety.js +3 -3
- package/dist/plugins/status-cache.js +9 -9
- package/dist/plugins/update.js +3 -3
- package/dist/plugins/web-search-install-catalog.js +3 -3
- package/dist/secrets/apply.js +16 -16
- package/dist/secrets/audit.js +11 -11
- package/dist/secrets/shared.js +9 -9
- package/dist/security/scan-paths.js +2 -2
- package/dist/shared/config-eval.js +2 -2
- package/dist/shared/pid-alive.js +2 -2
- package/dist/tasks/standing-orders.js +5 -5
- package/dist/tasks/task-flow-registry.js +5 -5
- package/dist/tasks/task-registry.js +5 -5
- package/dist/tasks/workflow-definitions.js +6 -6
- package/dist/telegram/token.js +5 -5
- package/dist/utils.js +5 -5
- package/dist/wallet/local-socket-signer-broker.js +16 -16
- package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
- package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
- package/dist/wallet/wallet-approval-auth.js +5 -5
- package/dist/wallet/wallet-audit-log.js +5 -5
- package/dist/wallet/wallet-custody.js +21 -21
- package/dist/wallet/wallet-inbound-events.js +5 -5
- package/dist/wallet/wallet-observability.js +5 -5
- package/dist/wallet/wallet-policy.js +9 -9
- package/dist/wallet/wallet-provider-registry.js +7 -7
- package/dist/wallet/wallet-runtime-config.js +3 -3
- package/dist/wallet/wallet-secrets-store.js +22 -22
- package/dist/wallet/wallet-send-approvals.js +5 -5
- package/dist/wallet/wallet-settlement-links.js +5 -5
- package/dist/web/accounts.js +3 -3
- package/dist/web/auth-store.js +18 -18
- package/dist/web/session.js +4 -4
- package/dist/wizard/host-security-capability.js +2 -2
- package/dist/wizard/onboarding.host-security.js +7 -7
- package/dist/wizard/onboarding.js +7 -7
- package/dist/wizard/onboarding.wallet.js +44 -44
- package/extensions/acpx/package.json +1 -1
- 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/fased-federation/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +12 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +2 -2
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +12 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +12 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +12 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +12 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +12 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +12 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { capEntryCount, loadSessionStore, pruneStaleEntries, resolveMaintenanceC
|
|
|
7
7
|
import "../config/sessions.js";
|
|
8
8
|
import { resolveSessionStoreTargets } from "./session-store-targets.js";
|
|
9
9
|
import { SESSION_AGE_PAD, SESSION_KEY_PAD, SESSION_MODEL_PAD, formatSessionAgeCell, formatSessionFlagsCell, formatSessionKeyCell, formatSessionModelCell, resolveSessionDisplayDefaults, resolveSessionDisplayModel, toSessionDisplayRows } from "./sessions-table.js";
|
|
10
|
-
import
|
|
10
|
+
import fs from "node:fs";
|
|
11
11
|
|
|
12
12
|
//#region src/commands/sessions-cleanup.ts
|
|
13
13
|
const ACTION_PAD = 12;
|
|
@@ -65,7 +65,7 @@ function pruneMissingTranscriptEntries(params) {
|
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
const transcriptPath = resolveSessionFilePath(entry.sessionId, entry, sessionPathOpts);
|
|
68
|
-
if (!
|
|
68
|
+
if (!fs.existsSync(transcriptPath)) {
|
|
69
69
|
delete params.store[key];
|
|
70
70
|
removed += 1;
|
|
71
71
|
params.onPruned?.(key);
|
|
@@ -5,7 +5,7 @@ import { resolveBrewExecutable } from "../infra/brew.js";
|
|
|
5
5
|
import { createWriteStream } from "node:fs";
|
|
6
6
|
import os from "node:os";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import fs from "node:fs/promises";
|
|
8
|
+
import fs$1 from "node:fs/promises";
|
|
9
9
|
import { pipeline } from "node:stream/promises";
|
|
10
10
|
import { request } from "node:https";
|
|
11
11
|
|
|
@@ -79,7 +79,7 @@ async function findSignalCliBinary(root) {
|
|
|
79
79
|
if (depth > 3) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
const entries = await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
82
|
+
const entries = await fs$1.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
83
83
|
for (const entry of entries) {
|
|
84
84
|
const full = path.join(dir, entry.name);
|
|
85
85
|
if (entry.isDirectory()) {
|
|
@@ -103,7 +103,7 @@ async function resolveBrewSignalCliPath(brewExe) {
|
|
|
103
103
|
const prefix = result.stdout.trim();
|
|
104
104
|
const candidate = path.join(prefix, "bin", "signal-cli");
|
|
105
105
|
try {
|
|
106
|
-
await fs.access(candidate);
|
|
106
|
+
await fs$1.access(candidate);
|
|
107
107
|
return candidate;
|
|
108
108
|
} catch {
|
|
109
109
|
return findSignalCliBinary(prefix);
|
|
@@ -172,12 +172,12 @@ async function installSignalCliFromRelease(runtime) {
|
|
|
172
172
|
error: "No compatible release asset found for this platform."
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "fased-signal-"));
|
|
175
|
+
const tmpDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "fased-signal-"));
|
|
176
176
|
const archivePath = path.join(tmpDir, asset.name);
|
|
177
177
|
runtime.log(`Downloading signal-cli ${version} (${asset.name})…`);
|
|
178
178
|
await downloadToFile(asset.browser_download_url, archivePath);
|
|
179
179
|
const installRoot = path.join(CONFIG_DIR, "tools", "signal-cli", version);
|
|
180
|
-
await fs.mkdir(installRoot, { recursive: true });
|
|
180
|
+
await fs$1.mkdir(installRoot, { recursive: true });
|
|
181
181
|
if (!looksLikeArchive(asset.name.toLowerCase())) {
|
|
182
182
|
return {
|
|
183
183
|
ok: false,
|
|
@@ -200,7 +200,7 @@ async function installSignalCliFromRelease(runtime) {
|
|
|
200
200
|
error: `signal-cli binary not found after extracting ${asset.name}`
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
await fs.chmod(cliPath, 493).catch(() => {});
|
|
203
|
+
await fs$1.chmod(cliPath, 493).catch(() => {});
|
|
204
204
|
return {
|
|
205
205
|
ok: true,
|
|
206
206
|
cliPath,
|
|
@@ -4,7 +4,7 @@ import { formatTimeAgo } from "../../infra/format-time/format-relative.js";
|
|
|
4
4
|
import { buildChannelAccountSnapshot, formatChannelAllowFrom } from "../../channels/account-summary.js";
|
|
5
5
|
import { resolveChannelDefaultAccountId } from "../../channels/plugins/helpers.js";
|
|
6
6
|
import "./format.js";
|
|
7
|
-
import
|
|
7
|
+
import fs from "node:fs";
|
|
8
8
|
|
|
9
9
|
//#region src/commands/status-all/channels.ts
|
|
10
10
|
const asRecord = (value) => value && typeof value === "object" ? value : {};
|
|
@@ -27,7 +27,7 @@ function existsSyncMaybe(p) {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
return
|
|
30
|
+
return fs.existsSync(path);
|
|
31
31
|
} catch {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
package/dist/commands/wallet.js
CHANGED
|
@@ -14,7 +14,7 @@ import { startLocalSocketSignerBroker } from "../wallet/local-socket-signer-brok
|
|
|
14
14
|
import { listWalletInboundEvents, pollWalletInboundEvents, reconcileWalletInboundEvents } from "../wallet/wallet-inbound-events.js";
|
|
15
15
|
import { buildWalletCanaryReport, runWalletProviderCanaryReport } from "../wallet/wallet-canary.js";
|
|
16
16
|
import { resolveSignerdBinaryPath, restartLocalSocketSigner } from "../wizard/onboarding.wallet.js";
|
|
17
|
-
import
|
|
17
|
+
import fs from "node:fs";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { createCipheriv, createDecipheriv, createPrivateKey, createPublicKey, randomBytes, scryptSync } from "node:crypto";
|
|
20
20
|
import { createInterface } from "node:readline/promises";
|
|
@@ -675,12 +675,12 @@ function resolveKeystorePassphrase(optionsPassphrase, env) {
|
|
|
675
675
|
return optionsPassphrase.trim();
|
|
676
676
|
}
|
|
677
677
|
const file = String(env.FASED_WALLET_PASSPHRASE_FILE ?? "").trim();
|
|
678
|
-
if (file &&
|
|
679
|
-
return
|
|
678
|
+
if (file && fs.existsSync(file)) {
|
|
679
|
+
return fs.readFileSync(file, "utf8").trim();
|
|
680
680
|
}
|
|
681
681
|
const managedFile = path.join(resolveLocalSignerMaterialRootDir(env), "passphrase");
|
|
682
|
-
if (
|
|
683
|
-
return
|
|
682
|
+
if (fs.existsSync(managedFile)) {
|
|
683
|
+
return fs.readFileSync(managedFile, "utf8").trim();
|
|
684
684
|
}
|
|
685
685
|
return String(env.FASED_WALLET_PASSPHRASE ?? "").trim();
|
|
686
686
|
}
|
|
@@ -696,7 +696,7 @@ function resolveLocalSignerPassphraseSource(env) {
|
|
|
696
696
|
const candidates = [configuredFile ? path.resolve(configuredFile) : "", path.join(resolveLocalSignerMaterialRootDir(env), "passphrase")].filter(Boolean);
|
|
697
697
|
for (const candidate of candidates) {
|
|
698
698
|
try {
|
|
699
|
-
const value =
|
|
699
|
+
const value = fs.readFileSync(candidate, "utf8").trim();
|
|
700
700
|
if (value) {
|
|
701
701
|
return {
|
|
702
702
|
kind: "file",
|
|
@@ -774,16 +774,16 @@ function ensureLocalSignerPassphraseFileForCustodyDisable(params) {
|
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
776
|
function writePassphraseFile(filePath, passphrase) {
|
|
777
|
-
|
|
777
|
+
fs.mkdirSync(path.dirname(filePath), {
|
|
778
778
|
recursive: true,
|
|
779
779
|
mode: 448
|
|
780
780
|
});
|
|
781
|
-
|
|
781
|
+
fs.writeFileSync(filePath, `${passphrase}\n`, {
|
|
782
782
|
encoding: "utf8",
|
|
783
783
|
mode: 384
|
|
784
784
|
});
|
|
785
785
|
try {
|
|
786
|
-
|
|
786
|
+
fs.chmodSync(filePath, 384);
|
|
787
787
|
} catch {}
|
|
788
788
|
}
|
|
789
789
|
function walletIdsMatchForEnvSuffix(left, right) {
|
|
@@ -823,7 +823,7 @@ function collectLocalSignerKeystoreTargets(cfg, env) {
|
|
|
823
823
|
return;
|
|
824
824
|
}
|
|
825
825
|
const resolved = path.resolve(candidate);
|
|
826
|
-
if (!
|
|
826
|
+
if (!fs.existsSync(resolved)) {
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
829
|
const existing = targets.get(resolved);
|
|
@@ -850,8 +850,8 @@ function collectLocalSignerKeystoreTargets(cfg, env) {
|
|
|
850
850
|
addTarget("solana", value, key.slice("FASED_WALLET_SOLANA_KEYSTORE_PATH__".length).toLowerCase());
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
if (
|
|
854
|
-
for (const entry of
|
|
853
|
+
if (fs.existsSync(materialRoot)) {
|
|
854
|
+
for (const entry of fs.readdirSync(materialRoot, { withFileTypes: true })) {
|
|
855
855
|
if (!entry.isFile()) {
|
|
856
856
|
continue;
|
|
857
857
|
}
|
|
@@ -871,7 +871,7 @@ function collectLocalSignerKeystoreTargets(cfg, env) {
|
|
|
871
871
|
return [...targets.values()].toSorted((left, right) => left.label.localeCompare(right.label));
|
|
872
872
|
}
|
|
873
873
|
async function reencryptLocalSignerKeystore(params) {
|
|
874
|
-
const raw =
|
|
874
|
+
const raw = fs.readFileSync(params.target.path, "utf8");
|
|
875
875
|
const detected = detectEmbeddedKeystoreType(raw);
|
|
876
876
|
if (detected === "solana-envelope") {
|
|
877
877
|
const envelope = parseSolanaKeystoreEnvelope(raw);
|
|
@@ -884,7 +884,7 @@ async function reencryptLocalSignerKeystore(params) {
|
|
|
884
884
|
passphrase: params.newPassphrase,
|
|
885
885
|
publicKey: envelope.publicKey
|
|
886
886
|
});
|
|
887
|
-
|
|
887
|
+
fs.writeFileSync(params.target.path, `${JSON.stringify(nextEnvelope, null, 2)}\n`, {
|
|
888
888
|
encoding: "utf8",
|
|
889
889
|
mode: 384
|
|
890
890
|
});
|
|
@@ -905,13 +905,13 @@ function removeLocalSignerPassphraseFileIfManaged(env) {
|
|
|
905
905
|
const resolved = path.resolve(configured);
|
|
906
906
|
const materialRoot = resolveLocalSignerMaterialRootDir(env);
|
|
907
907
|
const withinMaterialRoot = resolved === materialRoot || resolved.startsWith(`${materialRoot}${path.sep}`);
|
|
908
|
-
if (!withinMaterialRoot || !
|
|
908
|
+
if (!withinMaterialRoot || !fs.existsSync(resolved)) {
|
|
909
909
|
return {
|
|
910
910
|
removed: false,
|
|
911
911
|
path: resolved
|
|
912
912
|
};
|
|
913
913
|
}
|
|
914
|
-
|
|
914
|
+
fs.rmSync(resolved, { force: true });
|
|
915
915
|
return {
|
|
916
916
|
removed: true,
|
|
917
917
|
path: resolved
|
|
@@ -949,11 +949,11 @@ function writeLocalSignerEnvFile(cfg, env) {
|
|
|
949
949
|
"",
|
|
950
950
|
`"${signerBinPath}" --socket "\${FASED_WALLET_LOCAL_SIGNER_BACKEND_SOCKET:-$FASED_WALLET_LOCAL_SIGNER_SOCKET}"`
|
|
951
951
|
];
|
|
952
|
-
|
|
952
|
+
fs.mkdirSync(path.dirname(signerEnvPath), {
|
|
953
953
|
recursive: true,
|
|
954
954
|
mode: 448
|
|
955
955
|
});
|
|
956
|
-
|
|
956
|
+
fs.writeFileSync(signerEnvPath, `${signerEnvLines.join("\n")}\n`, {
|
|
957
957
|
encoding: "utf8",
|
|
958
958
|
mode: 384
|
|
959
959
|
});
|
|
@@ -1051,11 +1051,11 @@ async function configureLocalSignerMode(runtime, options, env) {
|
|
|
1051
1051
|
"",
|
|
1052
1052
|
`"${signerBinPath}" --socket "\${FASED_WALLET_LOCAL_SIGNER_BACKEND_SOCKET:-$FASED_WALLET_LOCAL_SIGNER_SOCKET}"`
|
|
1053
1053
|
];
|
|
1054
|
-
|
|
1054
|
+
fs.mkdirSync(path.dirname(signerEnvPath), {
|
|
1055
1055
|
recursive: true,
|
|
1056
1056
|
mode: 448
|
|
1057
1057
|
});
|
|
1058
|
-
|
|
1058
|
+
fs.writeFileSync(signerEnvPath, `${signerEnvLines.join("\n")}\n`, {
|
|
1059
1059
|
encoding: "utf8",
|
|
1060
1060
|
mode: 384
|
|
1061
1061
|
});
|
|
@@ -1499,10 +1499,10 @@ async function walletKeystoreInitCommand(runtime = defaultRuntime, options = {})
|
|
|
1499
1499
|
}
|
|
1500
1500
|
const chain = options.chain ?? "solana";
|
|
1501
1501
|
const outPath = resolveEmbeddedKeystorePathForChain(env, chain, options.out, options.walletId);
|
|
1502
|
-
if (
|
|
1502
|
+
if (fs.existsSync(outPath) && !options.force) {
|
|
1503
1503
|
throw new Error(`Keystore already exists: ${outPath}`);
|
|
1504
1504
|
}
|
|
1505
|
-
|
|
1505
|
+
fs.mkdirSync(path.dirname(outPath), {
|
|
1506
1506
|
recursive: true,
|
|
1507
1507
|
mode: 448
|
|
1508
1508
|
});
|
|
@@ -1517,14 +1517,14 @@ async function walletKeystoreInitCommand(runtime = defaultRuntime, options = {})
|
|
|
1517
1517
|
passphrase,
|
|
1518
1518
|
publicKey
|
|
1519
1519
|
});
|
|
1520
|
-
|
|
1520
|
+
fs.writeFileSync(outPath, `${JSON.stringify(envelope, null, 2)}\n`, {
|
|
1521
1521
|
encoding: "utf8",
|
|
1522
1522
|
mode: 384
|
|
1523
1523
|
});
|
|
1524
1524
|
addressOut = publicKey;
|
|
1525
1525
|
privateKeyOut = Buffer.from(secretKey).toString("base64");
|
|
1526
1526
|
try {
|
|
1527
|
-
|
|
1527
|
+
fs.chmodSync(outPath, 384);
|
|
1528
1528
|
} catch {}
|
|
1529
1529
|
const cfg = options.skipProviderConfig ? ensureWalletMaterialConfig(loadConfig(), {
|
|
1530
1530
|
keystorePath: outPath,
|
|
@@ -1599,10 +1599,10 @@ async function walletKeystoreImportCommand(runtime = defaultRuntime, options = {
|
|
|
1599
1599
|
throw new Error("Missing private key. Pass --private-key or set FASED_WALLET_PRIVATE_KEY.");
|
|
1600
1600
|
}
|
|
1601
1601
|
const outPath = resolveEmbeddedKeystorePathForChain(env, chain, options.out, options.walletId);
|
|
1602
|
-
if (
|
|
1602
|
+
if (fs.existsSync(outPath) && !options.force) {
|
|
1603
1603
|
throw new Error(`Keystore already exists: ${outPath}`);
|
|
1604
1604
|
}
|
|
1605
|
-
|
|
1605
|
+
fs.mkdirSync(path.dirname(outPath), {
|
|
1606
1606
|
recursive: true,
|
|
1607
1607
|
mode: 448
|
|
1608
1608
|
});
|
|
@@ -1614,13 +1614,13 @@ async function walletKeystoreImportCommand(runtime = defaultRuntime, options = {
|
|
|
1614
1614
|
passphrase,
|
|
1615
1615
|
publicKey
|
|
1616
1616
|
});
|
|
1617
|
-
|
|
1617
|
+
fs.writeFileSync(outPath, `${JSON.stringify(envelope, null, 2)}\n`, {
|
|
1618
1618
|
encoding: "utf8",
|
|
1619
1619
|
mode: 384
|
|
1620
1620
|
});
|
|
1621
1621
|
addressOut = publicKey;
|
|
1622
1622
|
try {
|
|
1623
|
-
|
|
1623
|
+
fs.chmodSync(outPath, 384);
|
|
1624
1624
|
} catch {}
|
|
1625
1625
|
const cfg = options.skipProviderConfig ? ensureWalletMaterialConfig(loadConfig(), {
|
|
1626
1626
|
keystorePath: outPath,
|
|
@@ -1682,7 +1682,7 @@ async function walletKeystoreStatusCommand(runtime = defaultRuntime, options = {
|
|
|
1682
1682
|
const cfg = loadConfig();
|
|
1683
1683
|
const chain = options.chain ?? "solana";
|
|
1684
1684
|
const keystorePath = resolveEmbeddedKeystorePathForChain(env, chain, cfg.wallet?.keystore?.path, options.walletId);
|
|
1685
|
-
const exists =
|
|
1685
|
+
const exists = fs.existsSync(keystorePath);
|
|
1686
1686
|
const providerId = cfg.wallet?.provider?.id;
|
|
1687
1687
|
let address;
|
|
1688
1688
|
let unlocked = false;
|
|
@@ -1690,7 +1690,7 @@ async function walletKeystoreStatusCommand(runtime = defaultRuntime, options = {
|
|
|
1690
1690
|
let detectedType = "missing";
|
|
1691
1691
|
if (exists) {
|
|
1692
1692
|
const passphrase = resolveKeystorePassphrase(undefined, env);
|
|
1693
|
-
const raw =
|
|
1693
|
+
const raw = fs.readFileSync(keystorePath, "utf8");
|
|
1694
1694
|
detectedType = detectEmbeddedKeystoreType(raw);
|
|
1695
1695
|
if (passphrase) {
|
|
1696
1696
|
try {
|
|
@@ -1755,14 +1755,14 @@ async function walletKeystoreValidateCommand(runtime = defaultRuntime, options =
|
|
|
1755
1755
|
};
|
|
1756
1756
|
let raw = "";
|
|
1757
1757
|
let detectedType = "missing";
|
|
1758
|
-
if (!
|
|
1758
|
+
if (!fs.existsSync(keystorePath)) {
|
|
1759
1759
|
result.checks.push({
|
|
1760
1760
|
id: "keystore.exists",
|
|
1761
1761
|
ok: false,
|
|
1762
1762
|
message: `missing: ${keystorePath}`
|
|
1763
1763
|
});
|
|
1764
1764
|
} else {
|
|
1765
|
-
raw =
|
|
1765
|
+
raw = fs.readFileSync(keystorePath, "utf8");
|
|
1766
1766
|
detectedType = detectEmbeddedKeystoreType(raw);
|
|
1767
1767
|
result.checks.push({
|
|
1768
1768
|
id: "keystore.exists",
|
|
@@ -1864,7 +1864,7 @@ async function walletKeystoreValidateCommand(runtime = defaultRuntime, options =
|
|
|
1864
1864
|
async function walletKeystorePassphraseInitCommand(runtime = defaultRuntime, options = {}) {
|
|
1865
1865
|
const env = process.env ?? process.env;
|
|
1866
1866
|
const outPath = resolvePassphraseFilePath(env, options.out);
|
|
1867
|
-
if (
|
|
1867
|
+
if (fs.existsSync(outPath) && !options.force) {
|
|
1868
1868
|
throw new Error(`Passphrase file already exists: ${outPath} (use --force to overwrite)`);
|
|
1869
1869
|
}
|
|
1870
1870
|
const bytes = typeof options.length === "number" && Number.isFinite(options.length) && options.length >= 16 ? Math.floor(options.length) : 24;
|
|
@@ -1886,15 +1886,15 @@ async function walletKeystorePassphraseRotateCommand(runtime = defaultRuntime, o
|
|
|
1886
1886
|
const cfg = loadConfig();
|
|
1887
1887
|
const keystorePath = resolveEmbeddedKeystorePath(env, cfg.wallet?.keystore?.path);
|
|
1888
1888
|
const passphraseFile = resolvePassphraseFilePath(env, options.file);
|
|
1889
|
-
if (!
|
|
1889
|
+
if (!fs.existsSync(keystorePath)) {
|
|
1890
1890
|
throw new Error(`Keystore missing: ${keystorePath}`);
|
|
1891
1891
|
}
|
|
1892
|
-
const oldPassphrase = (options.oldPassphrase ?? (
|
|
1892
|
+
const oldPassphrase = (options.oldPassphrase ?? (fs.existsSync(passphraseFile) ? fs.readFileSync(passphraseFile, "utf8") : "")).trim() || String(env.FASED_WALLET_PASSPHRASE ?? "").trim();
|
|
1893
1893
|
if (!oldPassphrase) {
|
|
1894
1894
|
throw new Error("Missing old passphrase. Provide --old-passphrase or configure passphrase file/env.");
|
|
1895
1895
|
}
|
|
1896
1896
|
const newPassphrase = (options.newPassphrase ?? "").trim() || randomBytes(24).toString("base64url");
|
|
1897
|
-
const raw =
|
|
1897
|
+
const raw = fs.readFileSync(keystorePath, "utf8");
|
|
1898
1898
|
const detected = detectEmbeddedKeystoreType(raw);
|
|
1899
1899
|
if (detected === "solana-envelope") {
|
|
1900
1900
|
const envelope = parseSolanaKeystoreEnvelope(raw);
|
|
@@ -1907,7 +1907,7 @@ async function walletKeystorePassphraseRotateCommand(runtime = defaultRuntime, o
|
|
|
1907
1907
|
passphrase: newPassphrase,
|
|
1908
1908
|
publicKey: envelope.publicKey
|
|
1909
1909
|
});
|
|
1910
|
-
|
|
1910
|
+
fs.writeFileSync(keystorePath, `${JSON.stringify(nextEnvelope, null, 2)}\n`, {
|
|
1911
1911
|
encoding: "utf8",
|
|
1912
1912
|
mode: 384
|
|
1913
1913
|
});
|
|
@@ -1932,10 +1932,10 @@ async function walletKeystoreExportCommand(runtime = defaultRuntime, options = {
|
|
|
1932
1932
|
const env = process.env ?? process.env;
|
|
1933
1933
|
const cfg = loadConfig();
|
|
1934
1934
|
const keystorePath = resolveEmbeddedKeystorePath(env, cfg.wallet?.keystore?.path);
|
|
1935
|
-
if (!
|
|
1935
|
+
if (!fs.existsSync(keystorePath)) {
|
|
1936
1936
|
throw new Error(`Keystore missing: ${keystorePath}`);
|
|
1937
1937
|
}
|
|
1938
|
-
const raw =
|
|
1938
|
+
const raw = fs.readFileSync(keystorePath, "utf8");
|
|
1939
1939
|
const detected = detectEmbeddedKeystoreType(raw);
|
|
1940
1940
|
const outPath = options.out?.trim() ? path.resolve(options.out.trim()) : undefined;
|
|
1941
1941
|
const payload = {
|
|
@@ -1948,11 +1948,11 @@ async function walletKeystoreExportCommand(runtime = defaultRuntime, options = {
|
|
|
1948
1948
|
payload.keystore = raw;
|
|
1949
1949
|
}
|
|
1950
1950
|
if (outPath) {
|
|
1951
|
-
|
|
1951
|
+
fs.mkdirSync(path.dirname(outPath), {
|
|
1952
1952
|
recursive: true,
|
|
1953
1953
|
mode: 448
|
|
1954
1954
|
});
|
|
1955
|
-
|
|
1955
|
+
fs.writeFileSync(outPath, raw, {
|
|
1956
1956
|
encoding: "utf8",
|
|
1957
1957
|
mode: 384
|
|
1958
1958
|
});
|
|
@@ -2138,7 +2138,7 @@ async function collectWalletSignerDoctorReport(env = process.env, options = {})
|
|
|
2138
2138
|
const isNotFoundError = (err) => err?.code === "ENOENT";
|
|
2139
2139
|
if (isLocalSigner) {
|
|
2140
2140
|
try {
|
|
2141
|
-
const st =
|
|
2141
|
+
const st = fs.statSync(socketPath);
|
|
2142
2142
|
push("socket.exists", st.isSocket?.() ?? true, socketPath);
|
|
2143
2143
|
try {
|
|
2144
2144
|
const mode = st.mode & 511;
|
|
@@ -2148,7 +2148,7 @@ async function collectWalletSignerDoctorReport(env = process.env, options = {})
|
|
|
2148
2148
|
push("socket.exists", localSignerSetupPending && isNotFoundError(err), localSignerSetupPending && isNotFoundError(err) ? "Configure" : String(err));
|
|
2149
2149
|
}
|
|
2150
2150
|
try {
|
|
2151
|
-
const pidRaw =
|
|
2151
|
+
const pidRaw = fs.readFileSync(pidPath, "utf8").trim();
|
|
2152
2152
|
const pid = Number.parseInt(pidRaw, 10);
|
|
2153
2153
|
if (Number.isFinite(pid) && pid > 1) {
|
|
2154
2154
|
try {
|
|
@@ -2164,7 +2164,7 @@ async function collectWalletSignerDoctorReport(env = process.env, options = {})
|
|
|
2164
2164
|
push("pid.alive", localSignerSetupPending && isNotFoundError(err), localSignerSetupPending && isNotFoundError(err) ? "Configure" : String(err));
|
|
2165
2165
|
}
|
|
2166
2166
|
try {
|
|
2167
|
-
const st =
|
|
2167
|
+
const st = fs.statSync(auditPath);
|
|
2168
2168
|
push("audit.exists", true, `bytes=${st.size}`);
|
|
2169
2169
|
} catch (err) {
|
|
2170
2170
|
push("audit.exists", localSignerSetupPending && isNotFoundError(err), localSignerSetupPending && isNotFoundError(err) ? "Configure" : String(err));
|
|
@@ -2192,14 +2192,14 @@ async function collectWalletSignerDoctorReport(env = process.env, options = {})
|
|
|
2192
2192
|
return "";
|
|
2193
2193
|
}
|
|
2194
2194
|
try {
|
|
2195
|
-
return
|
|
2195
|
+
return fs.readFileSync(p, "utf8").trim();
|
|
2196
2196
|
} catch {
|
|
2197
2197
|
return "";
|
|
2198
2198
|
}
|
|
2199
2199
|
})();
|
|
2200
2200
|
const inspectKeystore = (label, keystorePath) => {
|
|
2201
2201
|
try {
|
|
2202
|
-
const raw =
|
|
2202
|
+
const raw = fs.readFileSync(keystorePath, "utf8");
|
|
2203
2203
|
const kind = detectEmbeddedKeystoreType(raw);
|
|
2204
2204
|
if (kind === "unknown") {
|
|
2205
2205
|
push(`keystore.file.${label}`, false, `${keystorePath} type=unknown (expected fased-solana-keypair envelope)`);
|
|
@@ -2256,7 +2256,7 @@ async function collectWalletSignerDoctorReport(env = process.env, options = {})
|
|
|
2256
2256
|
return true;
|
|
2257
2257
|
}
|
|
2258
2258
|
const defaultPath = resolveEmbeddedKeystorePathForChain(effectiveEnv, "solana");
|
|
2259
|
-
if (
|
|
2259
|
+
if (fs.existsSync(defaultPath)) {
|
|
2260
2260
|
return true;
|
|
2261
2261
|
}
|
|
2262
2262
|
if (providerDefaultWallet?.addresses?.solana) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "node:fs";
|
|
2
2
|
|
|
3
3
|
//#region src/config/cache-utils.ts
|
|
4
4
|
function resolveCacheTtlMs(params) {
|
|
@@ -16,7 +16,7 @@ function isCacheEnabled(ttlMs) {
|
|
|
16
16
|
}
|
|
17
17
|
function getFileMtimeMs(filePath) {
|
|
18
18
|
try {
|
|
19
|
-
return
|
|
19
|
+
return fs.statSync(filePath).mtimeMs;
|
|
20
20
|
} catch {
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
package/dist/config/includes.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isBlockedObjectKey } from "../infra/prototype-keys.js";
|
|
|
4
4
|
import { canUseBoundaryFileOpen, openBoundaryFileSync } from "../infra/boundary-file-read.js";
|
|
5
5
|
import { isPathInside } from "../security/scan-paths.js";
|
|
6
6
|
import "./prototype-keys.js";
|
|
7
|
-
import
|
|
7
|
+
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import JSON5 from "json5";
|
|
10
10
|
|
|
@@ -130,7 +130,7 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
130
130
|
throw new ConfigIncludeError(`Include path escapes config directory: ${includePath} (root: ${this.rootDir})`, includePath);
|
|
131
131
|
}
|
|
132
132
|
try {
|
|
133
|
-
const real =
|
|
133
|
+
const real = fs.realpathSync(normalized);
|
|
134
134
|
if (!isPathInside(this.rootRealDir, real)) {
|
|
135
135
|
throw new ConfigIncludeError(`Include path resolves outside config directory (symlink): ${includePath} (root: ${this.rootDir})`, includePath);
|
|
136
136
|
}
|
|
@@ -184,13 +184,13 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
184
184
|
};
|
|
185
185
|
function safeRealpath(target) {
|
|
186
186
|
try {
|
|
187
|
-
return
|
|
187
|
+
return fs.realpathSync(target);
|
|
188
188
|
} catch {
|
|
189
189
|
return target;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
function readConfigIncludeFileWithGuards(params) {
|
|
193
|
-
const ioFs = params.ioFs ??
|
|
193
|
+
const ioFs = params.ioFs ?? fs;
|
|
194
194
|
const maxBytes = params.maxBytes ?? MAX_INCLUDE_FILE_BYTES;
|
|
195
195
|
if (!canUseBoundaryFileOpen(ioFs)) {
|
|
196
196
|
return ioFs.readFileSync(params.resolvedPath, "utf-8");
|
|
@@ -217,7 +217,7 @@ function readConfigIncludeFileWithGuards(params) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
const defaultResolver = {
|
|
220
|
-
readFile: (p) =>
|
|
220
|
+
readFile: (p) => fs.readFileSync(p, "utf-8"),
|
|
221
221
|
readFileWithGuards: ({ includePath, resolvedPath, rootRealDir }) => readConfigIncludeFileWithGuards({
|
|
222
222
|
includePath,
|
|
223
223
|
resolvedPath,
|
package/dist/config/io.js
CHANGED
|
@@ -22,7 +22,7 @@ import { repairInstalledPluginAllowlist } from "./plugins-allowlist.js";
|
|
|
22
22
|
import { applyConfigOverrides } from "./runtime-overrides.js";
|
|
23
23
|
import { validateConfigObjectRawWithPlugins, validateConfigObjectWithPlugins } from "./validation.js";
|
|
24
24
|
import { compareFasedAgentVersions } from "./version.js";
|
|
25
|
-
import
|
|
25
|
+
import fs from "node:fs";
|
|
26
26
|
import os from "node:os";
|
|
27
27
|
import path from "node:path";
|
|
28
28
|
import JSON5 from "json5";
|
|
@@ -477,7 +477,7 @@ function resolveConfigPathForDeps(deps) {
|
|
|
477
477
|
}
|
|
478
478
|
function normalizeDeps(overrides = {}) {
|
|
479
479
|
return {
|
|
480
|
-
fs: overrides.fs ??
|
|
480
|
+
fs: overrides.fs ?? fs,
|
|
481
481
|
json5: overrides.json5 ?? JSON5,
|
|
482
482
|
env: overrides.env ?? process.env,
|
|
483
483
|
homedir: overrides.homedir ?? (() => resolveRequiredHomeDir(overrides.env ?? process.env, os.homedir)),
|
package/dist/config/paths.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expandHomePrefix, resolveRequiredHomeDir } from "../infra/home-dir.js";
|
|
2
|
-
import
|
|
2
|
+
import fs from "node:fs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
@@ -86,7 +86,7 @@ function resolveConfigPathCandidate(env = process.env, homedir = envHomedir(env)
|
|
|
86
86
|
const candidates = resolveDefaultConfigCandidates(env, homedir);
|
|
87
87
|
const existing = candidates.find((candidate) => {
|
|
88
88
|
try {
|
|
89
|
-
return
|
|
89
|
+
return fs.existsSync(candidate);
|
|
90
90
|
} catch {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
@@ -108,7 +108,7 @@ function resolveConfigPath(env = process.env, stateDir = resolveStateDir(env, en
|
|
|
108
108
|
const candidates = [path.join(stateDir, CONFIG_FILENAME)];
|
|
109
109
|
const existing = candidates.find((candidate) => {
|
|
110
110
|
try {
|
|
111
|
-
return
|
|
111
|
+
return fs.existsSync(candidate);
|
|
112
112
|
} catch {
|
|
113
113
|
return false;
|
|
114
114
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
//#region src/config/sat-runtime-ids.ts
|
|
@@ -63,7 +63,7 @@ function resolveSatRuntimeDefaultsFile(env = process.env) {
|
|
|
63
63
|
path.resolve(import.meta.dirname, "..", "..", "..", "config", "sat-runtime.env")
|
|
64
64
|
];
|
|
65
65
|
for (const candidate of candidates) {
|
|
66
|
-
if (candidate &&
|
|
66
|
+
if (candidate && fs.existsSync(candidate)) {
|
|
67
67
|
return candidate;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -82,7 +82,7 @@ function loadSatRuntimeDefaults(env = process.env) {
|
|
|
82
82
|
if (!file) {
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
85
|
-
const parsed = parseEnvFile(
|
|
85
|
+
const parsed = parseEnvFile(fs.readFileSync(file, "utf8"));
|
|
86
86
|
if (!parsed.programId || !parsed.bondProgramId || !parsed.mintAddress || !parsed.mintProgramId) {
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPrimarySessionTranscriptFileName, isSessionArchiveArtifactName } from "./artifacts.js";
|
|
2
2
|
import { resolveSessionFilePath } from "./paths.js";
|
|
3
|
-
import
|
|
3
|
+
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
//#region src/config/sessions/disk-budget.ts
|
|
@@ -11,7 +11,7 @@ const NOOP_LOGGER = {
|
|
|
11
11
|
function canonicalizePathForComparison(filePath) {
|
|
12
12
|
const resolved = path.resolve(filePath);
|
|
13
13
|
try {
|
|
14
|
-
return
|
|
14
|
+
return fs.realpathSync(resolved);
|
|
15
15
|
} catch {
|
|
16
16
|
return resolved;
|
|
17
17
|
}
|
|
@@ -83,14 +83,14 @@ function resolveReferencedSessionTranscriptPaths(params) {
|
|
|
83
83
|
return referenced;
|
|
84
84
|
}
|
|
85
85
|
async function readSessionsDirFiles(sessionsDir) {
|
|
86
|
-
const dirEntries = await
|
|
86
|
+
const dirEntries = await fs.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
|
|
87
87
|
const files = [];
|
|
88
88
|
for (const dirent of dirEntries) {
|
|
89
89
|
if (!dirent.isFile()) {
|
|
90
90
|
continue;
|
|
91
91
|
}
|
|
92
92
|
const filePath = path.join(sessionsDir, dirent.name);
|
|
93
|
-
const stat = await
|
|
93
|
+
const stat = await fs.promises.stat(filePath).catch(() => null);
|
|
94
94
|
if (!stat?.isFile()) {
|
|
95
95
|
continue;
|
|
96
96
|
}
|
|
@@ -105,11 +105,11 @@ async function readSessionsDirFiles(sessionsDir) {
|
|
|
105
105
|
return files;
|
|
106
106
|
}
|
|
107
107
|
async function removeFileIfExists(filePath) {
|
|
108
|
-
const stat = await
|
|
108
|
+
const stat = await fs.promises.stat(filePath).catch(() => null);
|
|
109
109
|
if (!stat?.isFile()) {
|
|
110
110
|
return 0;
|
|
111
111
|
}
|
|
112
|
-
await
|
|
112
|
+
await fs.promises.rm(filePath, { force: true }).catch(() => undefined);
|
|
113
113
|
return stat.size;
|
|
114
114
|
}
|
|
115
115
|
async function removeFileForBudget(params) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expandHomePrefix, resolveRequiredHomeDir } from "../../infra/home-dir.js";
|
|
2
2
|
import { resolveStateDir } from "../paths.js";
|
|
3
3
|
import { DEFAULT_AGENT_ID, normalizeAgentId } from "../../routing/session-key.js";
|
|
4
|
-
import
|
|
4
|
+
import fs from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
@@ -112,7 +112,7 @@ function resolveStructuralSessionFallbackPath(candidateAbsPath, expectedAgentId)
|
|
|
112
112
|
}
|
|
113
113
|
function safeRealpathSync(filePath) {
|
|
114
114
|
try {
|
|
115
|
-
return
|
|
115
|
+
return fs.realpathSync(filePath);
|
|
116
116
|
} catch {
|
|
117
117
|
return undefined;
|
|
118
118
|
}
|