@fased/fased 0.1.61 → 0.1.62

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.
Files changed (273) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/acp/client.js +2 -2
  3. package/dist/acp/secret-file.js +2 -2
  4. package/dist/agents/agent-scope.js +2 -2
  5. package/dist/agents/apply-patch.js +8 -8
  6. package/dist/agents/auth-profiles/paths.js +2 -2
  7. package/dist/agents/auth-profiles/store.js +2 -2
  8. package/dist/agents/bash-tools.shared.js +2 -2
  9. package/dist/agents/cli-credentials.js +4 -4
  10. package/dist/agents/docs-path.js +3 -3
  11. package/dist/agents/embedded-pi-mcp.js +4 -4
  12. package/dist/agents/identity-avatar.js +3 -3
  13. package/dist/agents/identity-file.js +2 -2
  14. package/dist/agents/openai-codex-app-server.js +5 -5
  15. package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
  16. package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
  17. package/dist/agents/pi-model-discovery.js +6 -6
  18. package/dist/agents/pi-project-settings.js +3 -3
  19. package/dist/agents/sandbox/fs-bridge.js +2 -2
  20. package/dist/agents/session-dirs.js +4 -4
  21. package/dist/agents/session-write-lock.js +13 -13
  22. package/dist/agents/shell-utils.js +5 -5
  23. package/dist/agents/skills/bundled-dir.js +4 -4
  24. package/dist/agents/skills/local-loader.js +6 -6
  25. package/dist/agents/skills/plugin-skills.js +2 -2
  26. package/dist/agents/skills/workspace.js +13 -13
  27. package/dist/agents/skills-install-download.js +7 -7
  28. package/dist/agents/skills-install-plan.js +2 -2
  29. package/dist/agents/skills-install.js +2 -2
  30. package/dist/agents/skills-status.js +2 -2
  31. package/dist/agents/subagent-depth.js +2 -2
  32. package/dist/agents/system-prompt-params.js +2 -2
  33. package/dist/agents/workspace.js +22 -22
  34. package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
  35. package/dist/auto-reply/reply/agent-runner.js +2 -2
  36. package/dist/auto-reply/reply/commands-export-session.js +7 -7
  37. package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
  38. package/dist/auto-reply/reply/post-compaction-context.js +3 -3
  39. package/dist/auto-reply/reply/session.js +3 -3
  40. package/dist/auto-reply/skill-commands.js +3 -3
  41. package/dist/auto-reply/status.js +6 -6
  42. package/dist/brand.js +1 -1
  43. package/dist/browser/chrome.executables.js +3 -3
  44. package/dist/browser/chrome.js +3 -3
  45. package/dist/browser/chrome.profile-decoration.js +6 -6
  46. package/dist/browser/profiles-service.js +2 -2
  47. package/dist/browser/server-context.js +2 -2
  48. package/dist/browser/trash.js +4 -4
  49. package/dist/build-info.json +3 -3
  50. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  51. package/dist/canvas-host/server.js +4 -4
  52. package/dist/capabilities/catalog.js +3 -3
  53. package/dist/channels/plugins/catalog.js +3 -3
  54. package/dist/cli/browser-cli-extension.js +6 -6
  55. package/dist/cli/command-format.js +2 -2
  56. package/dist/cli/cron-cli/register.cron-simple.js +2 -2
  57. package/dist/cli/dns-cli.js +9 -9
  58. package/dist/cli/gateway-cli/dev.js +5 -5
  59. package/dist/cli/gateway-cli/run.js +2 -2
  60. package/dist/cli/hooks-cli.js +5 -5
  61. package/dist/cli/lightweight/gateway-runtime-probe.js +2 -2
  62. package/dist/cli/memory-cli.js +7 -7
  63. package/dist/cli/nodes-media-utils.js +2 -2
  64. package/dist/cli/plugins-cli.js +2 -2
  65. package/dist/cli/secrets-cli.js +3 -3
  66. package/dist/cli/windows-argv.js +2 -2
  67. package/dist/commands/dashboard-link.js +3 -3
  68. package/dist/commands/doctor-install.js +5 -5
  69. package/dist/commands/doctor-memory-search.js +2 -2
  70. package/dist/commands/doctor-platform-notes.js +2 -2
  71. package/dist/commands/doctor-sandbox.js +2 -2
  72. package/dist/commands/doctor-state-integrity.js +23 -23
  73. package/dist/commands/doctor-workspace.js +3 -3
  74. package/dist/commands/doctor.js +3 -3
  75. package/dist/commands/managed-up.js +2 -2
  76. package/dist/commands/onboard-auth.credentials.js +3 -3
  77. package/dist/commands/onboarding/plugin-install.js +2 -2
  78. package/dist/commands/sessions-cleanup.js +2 -2
  79. package/dist/commands/signal-install.js +6 -6
  80. package/dist/commands/status-all/channels.js +2 -2
  81. package/dist/commands/wallet.js +47 -47
  82. package/dist/config/cache-utils.js +2 -2
  83. package/dist/config/includes.js +5 -5
  84. package/dist/config/io.js +2 -2
  85. package/dist/config/paths.js +3 -3
  86. package/dist/config/sat-runtime-ids.js +3 -3
  87. package/dist/config/sessions/disk-budget.js +6 -6
  88. package/dist/config/sessions/paths.js +2 -2
  89. package/dist/config/sessions/store.js +17 -17
  90. package/dist/config/sessions/transcript.js +4 -4
  91. package/dist/config/talk.js +2 -2
  92. package/dist/control-ui/assets/{app-BXA4gPvN.js → app-DLil9VO1.js} +3 -3
  93. package/dist/control-ui/assets/{index-D2QbJhVg.js → index-DdE_NIXo.js} +3 -3
  94. package/dist/control-ui/index.html +1 -1
  95. package/dist/control-ui/version.json +1 -1
  96. package/dist/cron/service/store.js +2 -2
  97. package/dist/cron/store.js +6 -6
  98. package/dist/daemon/systemd-system.js +5 -5
  99. package/dist/discord/monitor/thread-bindings.state.js +2 -2
  100. package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
  101. package/dist/gateway/control-ui-boot-check.js +6 -6
  102. package/dist/gateway/control-ui-login.js +7 -7
  103. package/dist/gateway/control-ui.js +9 -9
  104. package/dist/gateway/hooks-mapping.js +4 -4
  105. package/dist/gateway/server-discovery.js +2 -2
  106. package/dist/gateway/server-http.js +4 -4
  107. package/dist/gateway/server-methods/chat.js +3 -3
  108. package/dist/gateway/server-methods/sessions.js +6 -6
  109. package/dist/gateway/server-methods/usage.js +2 -2
  110. package/dist/gateway/server.impl.js +3 -3
  111. package/dist/gateway/session-compaction-checkpoints.js +4 -4
  112. package/dist/gateway/session-utils.fs.js +24 -24
  113. package/dist/gateway/session-utils.js +6 -6
  114. package/dist/hooks/bundled-dir.js +4 -4
  115. package/dist/hooks/gmail-setup-utils.js +6 -6
  116. package/dist/hooks/import-url.js +2 -2
  117. package/dist/hooks/loader.js +4 -4
  118. package/dist/hooks/workspace.js +7 -7
  119. package/dist/infra/archive.js +17 -17
  120. package/dist/infra/boundary-file-read.js +2 -2
  121. package/dist/infra/boundary-path.js +15 -15
  122. package/dist/infra/brew.js +2 -2
  123. package/dist/infra/control-ui-assets.js +14 -14
  124. package/dist/infra/device-auth-store.js +8 -8
  125. package/dist/infra/device-identity.js +8 -8
  126. package/dist/infra/dotenv.js +2 -2
  127. package/dist/infra/exec-approvals.js +8 -8
  128. package/dist/infra/exec-command-resolution.js +4 -4
  129. package/dist/infra/exec-safe-bin-trust.js +2 -2
  130. package/dist/infra/fased-root.js +5 -5
  131. package/dist/infra/fs-safe.js +14 -14
  132. package/dist/infra/gateway-lock.js +11 -11
  133. package/dist/infra/git-commit.js +5 -5
  134. package/dist/infra/git-root.js +4 -4
  135. package/dist/infra/hosted-runtime-artifact.js +3 -3
  136. package/dist/infra/is-main.js +2 -2
  137. package/dist/infra/json-file.js +7 -7
  138. package/dist/infra/managed-runtime-bootstrap.js +6 -6
  139. package/dist/infra/outbound/delivery-queue.js +16 -16
  140. package/dist/infra/path-env.js +3 -3
  141. package/dist/infra/ports-lsof.js +4 -4
  142. package/dist/infra/provider-usage.auth.js +3 -3
  143. package/dist/infra/safe-open-sync.js +2 -2
  144. package/dist/infra/session-cost-usage.js +9 -9
  145. package/dist/infra/shell-env.js +2 -2
  146. package/dist/infra/state-migrations.fs.js +6 -6
  147. package/dist/infra/state-migrations.js +23 -23
  148. package/dist/infra/tmp-fased-dir.js +6 -6
  149. package/dist/infra/widearea-dns.js +3 -3
  150. package/dist/infra/wsl.js +2 -2
  151. package/dist/line/accounts.js +2 -2
  152. package/dist/line/download.js +2 -2
  153. package/dist/logging/config.js +3 -3
  154. package/dist/logging/logger.js +7 -7
  155. package/dist/managed/federation.js +3 -3
  156. package/dist/managed/tunnel.js +3 -3
  157. package/dist/media/store.js +13 -13
  158. package/dist/media-understanding/runner.js +3 -3
  159. package/dist/memory/embeddings.js +2 -2
  160. package/dist/memory/internal.js +10 -10
  161. package/dist/memory/manager-sync-ops.js +7 -7
  162. package/dist/memory/repair-executor.js +17 -17
  163. package/dist/node-host/invoke-system-run-plan.js +8 -8
  164. package/dist/node-host/invoke.js +2 -2
  165. package/dist/node-host/runner.js +3 -3
  166. package/dist/pairing/pairing-store.js +3 -3
  167. package/dist/plugin-sdk/{audio-preflight-Bv0hUOWL.js → audio-preflight-Bwi2Oq03.js} +1 -1
  168. package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
  169. package/dist/plugin-sdk/{chunk-items-Bk--NU3E.js → chunk-items-DzT4L4Ty.js} +1 -1
  170. package/dist/plugin-sdk/command-status.js +1 -1
  171. package/dist/plugin-sdk/{config-schema-CGW6J3Pv.js → config-schema-BrkmtFxB.js} +7 -7
  172. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  173. package/dist/plugin-sdk/discord.d.ts +4 -4
  174. package/dist/plugin-sdk/index.d.ts +17 -17
  175. package/dist/plugin-sdk/index.js +1 -1
  176. package/dist/plugin-sdk/json-store.js +6 -6
  177. package/dist/plugin-sdk/{monitor-B9Cmt_Je.js → monitor-M_ta2lMc.js} +3 -3
  178. package/dist/plugin-sdk/{monitor-B71iwAgC.js → monitor-wYVncM9w.js} +3 -3
  179. package/dist/plugin-sdk/{openresponses-http-Du4GMmwo.js → openresponses-http-B2GmeSt4.js} +1 -1
  180. package/dist/plugin-sdk/{pairing-message-BMkkS038.d.ts → pairing-message-B3bHYGaw.d.ts} +1 -1
  181. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
  182. package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
  183. package/dist/plugin-sdk/sat-runtime.js +1 -1
  184. package/dist/plugin-sdk/{slack-D_bbE6Yd.js → slack-CxE1mfzj.js} +3 -3
  185. package/dist/plugin-sdk/slack.d.ts +4 -4
  186. package/dist/plugin-sdk/{sticker-cache-Dqo9nRhi.js → sticker-cache-CGzGWu00.js} +2 -2
  187. package/dist/plugin-sdk/{telegram-actions-Cnag7JTH.js → telegram-actions-DaEcYQ8r.js} +2 -2
  188. package/dist/plugin-sdk/telegram.d.ts +4 -4
  189. package/dist/plugin-sdk/{tmp-fased-dir-BdFQvrvw.d.ts → tmp-fased-dir-CS6zsYEE.d.ts} +1 -1
  190. package/dist/plugin-sdk/{types-BYDL6dQj.d.ts → types-DFAW-n1J.d.ts} +1 -1
  191. package/dist/plugin-sdk/{types-CLIvQaVg.d.ts → types-vcJrC_uv.d.ts} +1 -1
  192. package/dist/plugin-sdk/{web-BInKQkc4.js → web-CInY-lCv.js} +1 -1
  193. package/dist/plugin-sdk/whatsapp.d.ts +11 -11
  194. package/dist/plugin-sdk/{zod-schema.providers-core-CIzCjXH9.d.ts → zod-schema.providers-core-BEbNizPe.d.ts} +61 -61
  195. package/dist/plugins/bundled-dir.js +3 -3
  196. package/dist/plugins/discovery.js +11 -11
  197. package/dist/plugins/loader.js +13 -13
  198. package/dist/plugins/manifest-registry.js +2 -2
  199. package/dist/plugins/manifest.js +4 -4
  200. package/dist/plugins/path-safety.js +3 -3
  201. package/dist/plugins/status-cache.js +9 -9
  202. package/dist/plugins/update.js +3 -3
  203. package/dist/plugins/web-search-install-catalog.js +3 -3
  204. package/dist/secrets/apply.js +16 -16
  205. package/dist/secrets/audit.js +11 -11
  206. package/dist/secrets/shared.js +9 -9
  207. package/dist/security/scan-paths.js +2 -2
  208. package/dist/shared/config-eval.js +2 -2
  209. package/dist/shared/pid-alive.js +2 -2
  210. package/dist/tasks/standing-orders.js +5 -5
  211. package/dist/tasks/task-flow-registry.js +5 -5
  212. package/dist/tasks/task-registry.js +5 -5
  213. package/dist/tasks/workflow-definitions.js +6 -6
  214. package/dist/telegram/token.js +5 -5
  215. package/dist/utils.js +5 -5
  216. package/dist/wallet/local-socket-signer-broker.js +16 -16
  217. package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
  218. package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
  219. package/dist/wallet/wallet-approval-auth.js +5 -5
  220. package/dist/wallet/wallet-audit-log.js +5 -5
  221. package/dist/wallet/wallet-custody.js +21 -21
  222. package/dist/wallet/wallet-inbound-events.js +5 -5
  223. package/dist/wallet/wallet-observability.js +5 -5
  224. package/dist/wallet/wallet-policy.js +9 -9
  225. package/dist/wallet/wallet-provider-registry.js +7 -7
  226. package/dist/wallet/wallet-runtime-config.js +3 -3
  227. package/dist/wallet/wallet-secrets-store.js +22 -22
  228. package/dist/wallet/wallet-send-approvals.js +5 -5
  229. package/dist/wallet/wallet-settlement-links.js +5 -5
  230. package/dist/web/accounts.js +3 -3
  231. package/dist/web/auth-store.js +18 -18
  232. package/dist/web/session.js +4 -4
  233. package/dist/wizard/host-security-capability.js +2 -2
  234. package/dist/wizard/onboarding.host-security.js +7 -7
  235. package/dist/wizard/onboarding.js +11 -28
  236. package/dist/wizard/onboarding.wallet.js +132 -85
  237. package/extensions/acpx/package.json +1 -1
  238. package/extensions/bluebubbles/package.json +1 -1
  239. package/extensions/copilot-proxy/package.json +1 -1
  240. package/extensions/diagnostics-otel/package.json +1 -1
  241. package/extensions/fased-federation/package.json +1 -1
  242. package/extensions/google-gemini-cli-auth/package.json +1 -1
  243. package/extensions/imessage/package.json +1 -1
  244. package/extensions/irc/package.json +1 -1
  245. package/extensions/line/package.json +1 -1
  246. package/extensions/llm-task/package.json +1 -1
  247. package/extensions/lobster/package.json +1 -1
  248. package/extensions/matrix/CHANGELOG.md +6 -0
  249. package/extensions/matrix/package.json +1 -1
  250. package/extensions/mattermost/package.json +1 -1
  251. package/extensions/memory-core/package.json +2 -2
  252. package/extensions/memory-lancedb/package.json +1 -1
  253. package/extensions/minimax-portal-auth/package.json +1 -1
  254. package/extensions/msteams/CHANGELOG.md +6 -0
  255. package/extensions/msteams/package.json +1 -1
  256. package/extensions/nextcloud-talk/package.json +1 -1
  257. package/extensions/nostr/CHANGELOG.md +6 -0
  258. package/extensions/nostr/package.json +1 -1
  259. package/extensions/open-prose/package.json +1 -1
  260. package/extensions/sat-mining/package.json +1 -1
  261. package/extensions/signal/package.json +1 -1
  262. package/extensions/synology-chat/package.json +1 -1
  263. package/extensions/tlon/package.json +1 -1
  264. package/extensions/twitch/CHANGELOG.md +6 -0
  265. package/extensions/twitch/package.json +1 -1
  266. package/extensions/voice-call/CHANGELOG.md +6 -0
  267. package/extensions/voice-call/package.json +1 -1
  268. package/extensions/zalo/CHANGELOG.md +6 -0
  269. package/extensions/zalo/package.json +1 -1
  270. package/extensions/zalouser/CHANGELOG.md +6 -0
  271. package/extensions/zalouser/package.json +1 -1
  272. package/package.json +2 -1
  273. package/scripts/install-fased-signerd.sh +142 -0
@@ -1,6 +1,6 @@
1
1
  import { SAT_RUNTIME_DEFAULTS } from "../../../config/sat-runtime-ids.js";
2
2
  import "../../../plugin-sdk/sat-runtime.js";
3
- import fs from "node:fs";
3
+ import syncFs from "node:fs";
4
4
  import path from "node:path";
5
5
 
6
6
  //#region extensions/sat-mining/src/sat-bond-layout.ts
@@ -162,7 +162,7 @@ function resolveLayoutPath(env = process.env) {
162
162
  path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-position-layout.json")
163
163
  ];
164
164
  for (const candidate of candidates) {
165
- if (candidate && fs.existsSync(candidate)) {
165
+ if (candidate && syncFs.existsSync(candidate)) {
166
166
  return candidate;
167
167
  }
168
168
  }
@@ -178,7 +178,7 @@ function resolvePolicyLayoutPath(env = process.env) {
178
178
  path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-tier-policy-layout.json")
179
179
  ];
180
180
  for (const candidate of candidates) {
181
- if (candidate && fs.existsSync(candidate)) {
181
+ if (candidate && syncFs.existsSync(candidate)) {
182
182
  return candidate;
183
183
  }
184
184
  }
@@ -194,7 +194,7 @@ function resolveStakingDistributorLayoutPath(env = process.env) {
194
194
  path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-staking-distributor-layout.json")
195
195
  ];
196
196
  for (const candidate of candidates) {
197
- if (candidate && fs.existsSync(candidate)) {
197
+ if (candidate && syncFs.existsSync(candidate)) {
198
198
  return candidate;
199
199
  }
200
200
  }
@@ -210,7 +210,7 @@ function resolveStakingPositionLayoutPath(env = process.env) {
210
210
  path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-staking-position-layout.json")
211
211
  ];
212
212
  for (const candidate of candidates) {
213
- if (candidate && fs.existsSync(candidate)) {
213
+ if (candidate && syncFs.existsSync(candidate)) {
214
214
  return candidate;
215
215
  }
216
216
  }
@@ -224,7 +224,7 @@ function loadSatBondLayout(env = process.env) {
224
224
  }
225
225
  const layoutPath = resolveLayoutPath(env);
226
226
  if (layoutPath) {
227
- const loaded = JSON.parse(fs.readFileSync(layoutPath, "utf-8"));
227
+ const loaded = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
228
228
  cachedLayout = {
229
229
  mode,
230
230
  value: loaded
@@ -244,7 +244,7 @@ function loadSatBondPolicyLayout(env = process.env) {
244
244
  }
245
245
  const layoutPath = resolvePolicyLayoutPath(env);
246
246
  if (layoutPath) {
247
- cachedPolicyLayout = JSON.parse(fs.readFileSync(layoutPath, "utf-8"));
247
+ cachedPolicyLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
248
248
  return cachedPolicyLayout;
249
249
  }
250
250
  cachedPolicyLayout = DEDICATED_FALLBACK_POLICY_LAYOUT;
@@ -257,7 +257,7 @@ function loadSatBondStakingDistributorLayout(env = process.env) {
257
257
  }
258
258
  const layoutPath = resolveStakingDistributorLayoutPath(env);
259
259
  if (layoutPath) {
260
- cachedStakingDistributorLayout = JSON.parse(fs.readFileSync(layoutPath, "utf-8"));
260
+ cachedStakingDistributorLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
261
261
  return cachedStakingDistributorLayout;
262
262
  }
263
263
  cachedStakingDistributorLayout ??= DEDICATED_FALLBACK_STAKING_DISTRIBUTOR_LAYOUT;
@@ -270,7 +270,7 @@ function loadSatBondStakingPositionLayout(env = process.env) {
270
270
  }
271
271
  const layoutPath = resolveStakingPositionLayoutPath(env);
272
272
  if (layoutPath) {
273
- cachedStakingPositionLayout = JSON.parse(fs.readFileSync(layoutPath, "utf-8"));
273
+ cachedStakingPositionLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
274
274
  return cachedStakingPositionLayout;
275
275
  }
276
276
  cachedStakingPositionLayout ??= DEDICATED_FALLBACK_STAKING_POSITION_LAYOUT;
@@ -2,7 +2,7 @@ import { openBoundaryFileSync } from "../infra/boundary-file-read.js";
2
2
  import { isWithinDir } from "../infra/path-safety.js";
3
3
  import { normalizeControlUiBasePath } from "./control-ui-shared.js";
4
4
  import { resolveControlUiRootSync } from "../infra/control-ui-assets.js";
5
- import fs from "node:fs";
5
+ import syncFs from "node:fs";
6
6
  import path from "node:path";
7
7
 
8
8
  //#region src/gateway/control-ui-boot-check.ts
@@ -189,7 +189,7 @@ function readControlUiBootAsset(params) {
189
189
  };
190
190
  }
191
191
  try {
192
- const body = fs.readFileSync(safeFile.fd);
192
+ const body = syncFs.readFileSync(safeFile.fd);
193
193
  return {
194
194
  check: {
195
195
  url: params.url,
@@ -200,7 +200,7 @@ function readControlUiBootAsset(params) {
200
200
  text: body.toString("utf8")
201
201
  };
202
202
  } finally {
203
- fs.closeSync(safeFile.fd);
203
+ syncFs.closeSync(safeFile.fd);
204
204
  }
205
205
  }
206
206
  function resolveBootCheckRoot(rootState) {
@@ -231,7 +231,7 @@ function resolveBootCheckRoot(rootState) {
231
231
  return {
232
232
  ok: true,
233
233
  root,
234
- rootReal: fs.realpathSync(root)
234
+ rootReal: syncFs.realpathSync(root)
235
235
  };
236
236
  } catch (error) {
237
237
  if (isExpectedSafePathError(error)) {
@@ -268,9 +268,9 @@ function resolveControlUiBootCheck(params) {
268
268
  }
269
269
  let html = "";
270
270
  try {
271
- html = fs.readFileSync(safeIndex.fd, "utf8");
271
+ html = syncFs.readFileSync(safeIndex.fd, "utf8");
272
272
  } finally {
273
- fs.closeSync(safeIndex.fd);
273
+ syncFs.closeSync(safeIndex.fd);
274
274
  }
275
275
  const entryJsUrl = extractHtmlScriptAssetUrls(html, indexUrl)[0] ?? null;
276
276
  const entry = entryJsUrl == null ? {
@@ -1,7 +1,7 @@
1
1
  import { resolveStateDir } from "../config/paths.js";
2
2
  import { safeEqualSecret } from "../security/secret-equal.js";
3
3
  import { isTrustedProxyAddress } from "./net.js";
4
- import fs from "node:fs";
4
+ import syncFs from "node:fs";
5
5
  import path from "node:path";
6
6
  import { createHash, createHmac, randomBytes } from "node:crypto";
7
7
 
@@ -512,10 +512,10 @@ var ControlUiLoginService = class {
512
512
  }
513
513
  readState() {
514
514
  try {
515
- if (!fs.existsSync(this.statePath)) {
515
+ if (!syncFs.existsSync(this.statePath)) {
516
516
  return buildEmptyState();
517
517
  }
518
- const raw = fs.readFileSync(this.statePath, "utf8");
518
+ const raw = syncFs.readFileSync(this.statePath, "utf8");
519
519
  return normalizeState(safeJsonParse(raw));
520
520
  } catch {
521
521
  return buildEmptyState();
@@ -525,13 +525,13 @@ var ControlUiLoginService = class {
525
525
  if (!this.state) {
526
526
  return;
527
527
  }
528
- fs.mkdirSync(path.dirname(this.statePath), { recursive: true });
528
+ syncFs.mkdirSync(path.dirname(this.statePath), { recursive: true });
529
529
  const tmpPath = `${this.statePath}.${process.pid}.${Date.now()}.tmp`;
530
530
  const body = `${JSON.stringify(this.state, null, 2)}\n`;
531
- fs.writeFileSync(tmpPath, body, { mode: 384 });
532
- fs.renameSync(tmpPath, this.statePath);
531
+ syncFs.writeFileSync(tmpPath, body, { mode: 384 });
532
+ syncFs.renameSync(tmpPath, this.statePath);
533
533
  try {
534
- fs.chmodSync(this.statePath, 384);
534
+ syncFs.chmodSync(this.statePath, 384);
535
535
  } catch {}
536
536
  }
537
537
  };
@@ -8,7 +8,7 @@ import { resolveControlUiRootSync } from "../infra/control-ui-assets.js";
8
8
  import { DEFAULT_ASSISTANT_IDENTITY, resolveAssistantIdentity } from "./assistant-identity.js";
9
9
  import { CONTROL_UI_BOOTSTRAP_CONFIG_PATH } from "./control-ui-contract.js";
10
10
  import { buildControlUiCspHeader } from "./control-ui-csp.js";
11
- import fs from "node:fs";
11
+ import syncFs from "node:fs";
12
12
  import path from "node:path";
13
13
 
14
14
  //#region src/gateway/control-ui.ts
@@ -152,10 +152,10 @@ function handleControlUiAvatarRequest(req, res, opts) {
152
152
  res.end();
153
153
  return true;
154
154
  }
155
- serveResolvedFile(res, safeAvatar.path, fs.readFileSync(safeAvatar.fd));
155
+ serveResolvedFile(res, safeAvatar.path, syncFs.readFileSync(safeAvatar.fd));
156
156
  return true;
157
157
  } finally {
158
- fs.closeSync(safeAvatar.fd);
158
+ syncFs.closeSync(safeAvatar.fd);
159
159
  }
160
160
  }
161
161
  function respondNotFound(res) {
@@ -318,7 +318,7 @@ function handleControlUiHttpRequest(req, res, opts) {
318
318
  }
319
319
  const rootReal = (() => {
320
320
  try {
321
- return fs.realpathSync(root);
321
+ return syncFs.realpathSync(root);
322
322
  } catch (error) {
323
323
  if (isExpectedSafePathError(error)) {
324
324
  return null;
@@ -364,13 +364,13 @@ function handleControlUiHttpRequest(req, res, opts) {
364
364
  return true;
365
365
  }
366
366
  if (path.basename(safeFile.path) === "index.html") {
367
- serveResolvedIndexHtml(res, fs.readFileSync(safeFile.fd, "utf8"));
367
+ serveResolvedIndexHtml(res, syncFs.readFileSync(safeFile.fd, "utf8"));
368
368
  return true;
369
369
  }
370
- serveResolvedFile(res, safeFile.path, fs.readFileSync(safeFile.fd));
370
+ serveResolvedFile(res, safeFile.path, syncFs.readFileSync(safeFile.fd));
371
371
  return true;
372
372
  } finally {
373
- fs.closeSync(safeFile.fd);
373
+ syncFs.closeSync(safeFile.fd);
374
374
  }
375
375
  }
376
376
  if (STATIC_ASSET_EXTENSIONS.has(path.extname(fileRel).toLowerCase())) {
@@ -387,10 +387,10 @@ function handleControlUiHttpRequest(req, res, opts) {
387
387
  res.end();
388
388
  return true;
389
389
  }
390
- serveResolvedIndexHtml(res, fs.readFileSync(safeIndex.fd, "utf8"));
390
+ serveResolvedIndexHtml(res, syncFs.readFileSync(safeIndex.fd, "utf8"));
391
391
  return true;
392
392
  } finally {
393
- fs.closeSync(safeIndex.fd);
393
+ syncFs.closeSync(safeIndex.fd);
394
394
  }
395
395
  }
396
396
  respondNotFound(res);
@@ -1,7 +1,7 @@
1
1
  import { CONFIG_PATH } from "../config/paths.js";
2
2
  import "../config/config.js";
3
3
  import { importFileModule, resolveFunctionModuleExport } from "../hooks/module-loader.js";
4
- import fs from "node:fs";
4
+ import syncFs from "node:fs";
5
5
  import path from "node:path";
6
6
 
7
7
  //#region src/gateway/hooks-mapping.ts
@@ -301,8 +301,8 @@ function escapesBase(baseDir, candidate) {
301
301
  }
302
302
  function safeRealpathSync(candidate) {
303
303
  try {
304
- const nativeRealpath = fs.realpathSync.native;
305
- return nativeRealpath ? nativeRealpath(candidate) : fs.realpathSync(candidate);
304
+ const nativeRealpath = syncFs.realpathSync.native;
305
+ return nativeRealpath ? nativeRealpath(candidate) : syncFs.realpathSync(candidate);
306
306
  } catch {
307
307
  return null;
308
308
  }
@@ -310,7 +310,7 @@ function safeRealpathSync(candidate) {
310
310
  function resolveExistingAncestor(candidate) {
311
311
  let current = path.resolve(candidate);
312
312
  while (true) {
313
- if (fs.existsSync(current)) {
313
+ if (syncFs.existsSync(current)) {
314
314
  return current;
315
315
  }
316
316
  const parent = path.dirname(current);
@@ -1,6 +1,6 @@
1
1
  import { runExec } from "../process/exec.js";
2
2
  import { getTailnetHostname } from "../infra/tailscale.js";
3
- import fs from "node:fs";
3
+ import syncFs from "node:fs";
4
4
  import path from "node:path";
5
5
 
6
6
  //#region src/gateway/server-discovery.ts
@@ -20,7 +20,7 @@ function resolveBonjourCliPath(opts = {}) {
20
20
  if (envPath) {
21
21
  return envPath;
22
22
  }
23
- const statSync = opts.statSync ?? fs.statSync;
23
+ const statSync = opts.statSync ?? syncFs.statSync;
24
24
  const isFile = (candidate) => {
25
25
  try {
26
26
  return statSync(candidate).isFile();
@@ -51,7 +51,7 @@ import { buildGatewayProbePayload } from "./probe-payload.js";
51
51
  import { canonicalizePathVariant } from "./security-path.js";
52
52
  import { handleToolsInvokeHttpRequest } from "./tools-invoke-http.js";
53
53
  import { authorizeGatewayConnect, isLocalDirectRequest } from "./auth.js";
54
- import fs from "node:fs";
54
+ import syncFs from "node:fs";
55
55
  import path from "node:path";
56
56
  import { createServer } from "node:http";
57
57
  import { createServer as createServer$1 } from "node:https";
@@ -2102,7 +2102,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2102
2102
  const sourcePath = path.join(resolveStateDir(env), "federation", "access-token.json");
2103
2103
  const managed = (env.FASED_GATEWAY_MODE ?? "").trim().toLowerCase() === "managed";
2104
2104
  const configured = resolveConfiguredFederationStatus(env);
2105
- if (!fs.existsSync(sourcePath)) {
2105
+ if (!syncFs.existsSync(sourcePath)) {
2106
2106
  return {
2107
2107
  managed,
2108
2108
  sourcePath,
@@ -2114,7 +2114,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2114
2114
  }
2115
2115
  let rawText = "";
2116
2116
  try {
2117
- rawText = fs.readFileSync(sourcePath, "utf-8");
2117
+ rawText = syncFs.readFileSync(sourcePath, "utf-8");
2118
2118
  } catch {
2119
2119
  return {
2120
2120
  managed,
@@ -2163,7 +2163,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2163
2163
  const lifecycle = Number.isFinite(expiresAtMs) ? expiresAtMs > Date.now() ? "active" : "expired" : "invalid";
2164
2164
  let fileUpdatedAt;
2165
2165
  try {
2166
- fileUpdatedAt = fs.statSync(sourcePath).mtime.toISOString();
2166
+ fileUpdatedAt = syncFs.statSync(sourcePath).mtime.toISOString();
2167
2167
  } catch {
2168
2168
  fileUpdatedAt = undefined;
2169
2169
  }
@@ -30,7 +30,7 @@ import { parseMessageWithAttachments } from "../chat-attachments.js";
30
30
  import { injectTimestamp, timestampOptsFromConfig } from "./agent-timestamp.js";
31
31
  import { normalizeRpcAttachmentsToChatAttachments } from "./attachment-normalize.js";
32
32
  import { appendInjectedAssistantMessageToTranscript } from "./chat-transcript-inject.js";
33
- import fs from "node:fs";
33
+ import syncFs from "node:fs";
34
34
  import path from "node:path";
35
35
 
36
36
  //#region src/gateway/server-methods/chat.ts
@@ -328,7 +328,7 @@ function resolveTranscriptPath(params) {
328
328
  }
329
329
  function transcriptHasIdempotencyKey(transcriptPath, idempotencyKey) {
330
330
  try {
331
- const lines = fs.readFileSync(transcriptPath, "utf-8").split(/\r?\n/);
331
+ const lines = syncFs.readFileSync(transcriptPath, "utf-8").split(/\r?\n/);
332
332
  for (const line of lines) {
333
333
  if (!line.trim()) {
334
334
  continue;
@@ -356,7 +356,7 @@ function appendAssistantTranscriptMessage(params) {
356
356
  error: "transcript path not resolved"
357
357
  };
358
358
  }
359
- if (!fs.existsSync(transcriptPath)) {
359
+ if (!syncFs.existsSync(transcriptPath)) {
360
360
  if (!params.createIfMissing) {
361
361
  return {
362
362
  ok: false,
@@ -30,7 +30,7 @@ import { clearCheckpointBranchIsolationFields } from "../session-compaction-isol
30
30
  import { applySessionsPatchToStore } from "../sessions-patch.js";
31
31
  import { resolveSessionKeyFromResolveParams } from "../sessions-resolve.js";
32
32
  import { assertValidParams } from "./validation.js";
33
- import fs from "node:fs";
33
+ import syncFs from "node:fs";
34
34
  import path from "node:path";
35
35
  import { randomUUID } from "node:crypto";
36
36
  import { SessionManager } from "@mariozechner/pi-coding-agent";
@@ -196,7 +196,7 @@ function resolveCheckpointSnapshotFile(params) {
196
196
  return null;
197
197
  }
198
198
  try {
199
- if (!fs.statSync(filePath).isFile()) {
199
+ if (!syncFs.statSync(filePath).isFile()) {
200
200
  return null;
201
201
  }
202
202
  } catch {
@@ -543,7 +543,7 @@ const sessionsHandlers = {
543
543
  }
544
544
  const cleanupRestoredFile = () => {
545
545
  try {
546
- fs.rmSync(sessionFile, { force: true });
546
+ syncFs.rmSync(sessionFile, { force: true });
547
547
  } catch {}
548
548
  };
549
549
  const cleanupError = await ensureSessionRuntimeCleanup({
@@ -1068,7 +1068,7 @@ const sessionsHandlers = {
1068
1068
  }, undefined);
1069
1069
  return;
1070
1070
  }
1071
- const filePath = resolveSessionTranscriptCandidates(sessionId, storePath, entry?.sessionFile, target.agentId).find((candidate) => fs.existsSync(candidate));
1071
+ const filePath = resolveSessionTranscriptCandidates(sessionId, storePath, entry?.sessionFile, target.agentId).find((candidate) => syncFs.existsSync(candidate));
1072
1072
  if (!filePath) {
1073
1073
  respond(true, {
1074
1074
  ok: true,
@@ -1078,7 +1078,7 @@ const sessionsHandlers = {
1078
1078
  }, undefined);
1079
1079
  return;
1080
1080
  }
1081
- const raw = fs.readFileSync(filePath, "utf-8");
1081
+ const raw = syncFs.readFileSync(filePath, "utf-8");
1082
1082
  const lines = raw.split(/\r?\n/).filter((l) => l.trim().length > 0);
1083
1083
  if (lines.length <= maxLines) {
1084
1084
  respond(true, {
@@ -1096,7 +1096,7 @@ const sessionsHandlers = {
1096
1096
  const archived = archiveFileOnDisk(filePath, "bak");
1097
1097
  const keptLines = lines.slice(-maxLines);
1098
1098
  try {
1099
- fs.writeFileSync(filePath, `${keptLines.join("\n")}\n`, "utf-8");
1099
+ syncFs.writeFileSync(filePath, `${keptLines.join("\n")}\n`, "utf-8");
1100
1100
  } catch (error) {
1101
1101
  if (preCompactionSnapshot) {
1102
1102
  cleanupSessionCompactionSnapshot(preCompactionSnapshot);
@@ -12,7 +12,7 @@ import { readCronRunLogEntriesPageAll } from "../../cron/run-log.js";
12
12
  import { loadCronStore, resolveCronStorePath } from "../../cron/store.js";
13
13
  import { discoverAllSessions, loadCostUsageSummary, loadSessionCostSummary, loadSessionUsageTimeSeries } from "../../infra/session-cost-usage.js";
14
14
  import { buildUsageAggregateTail } from "../../shared/usage-aggregates.js";
15
- import fs from "node:fs";
15
+ import syncFs from "node:fs";
16
16
 
17
17
  //#region src/gateway/server-methods/usage.ts
18
18
  const COST_USAGE_CACHE_TTL_MS = 3e4;
@@ -662,7 +662,7 @@ const usageHandlers = {
662
662
  return;
663
663
  }
664
664
  try {
665
- const stats = fs.statSync(sessionFile);
665
+ const stats = syncFs.statSync(sessionFile);
666
666
  if (stats.isFile()) {
667
667
  mergedEntries.push({
668
668
  key: resolvedStoreKey,
@@ -68,7 +68,7 @@ import { createWizardSessionTracker } from "./server-wizard-sessions.js";
68
68
  import { attachGatewayWsHandlers } from "./server-ws-runtime.js";
69
69
  import { loadGatewayTlsRuntime } from "./server/tls.js";
70
70
  import { createSessionEventSubscriberRegistry, createSessionMessageSubscriberRegistry } from "./session-event-subscribers.js";
71
- import fs from "node:fs";
71
+ import syncFs from "node:fs";
72
72
  import path from "node:path";
73
73
 
74
74
  //#region src/gateway/server.impl.ts
@@ -99,10 +99,10 @@ function hasConfiguredLocalSignerKeystoreMaterial(env) {
99
99
  }
100
100
  try {
101
101
  const materialDir = resolveLocalSignerMaterialRootDir(env);
102
- if (!fs.existsSync(materialDir)) {
102
+ if (!syncFs.existsSync(materialDir)) {
103
103
  return false;
104
104
  }
105
- return fs.readdirSync(materialDir, { withFileTypes: true }).some((entry) => entry.isFile() && /^keystore-solana(?:-.+)?\.v1\.enc$/i.test(entry.name));
105
+ return syncFs.readdirSync(materialDir, { withFileTypes: true }).some((entry) => entry.isFile() && /^keystore-solana(?:-.+)?\.v1\.enc$/i.test(entry.name));
106
106
  } catch {
107
107
  return false;
108
108
  }
@@ -1,6 +1,6 @@
1
1
  import { isSessionCompactionCheckpointArtifactName } from "../config/sessions/artifacts.js";
2
2
  import "../config/sessions.js";
3
- import fs from "node:fs";
3
+ import syncFs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { randomUUID } from "node:crypto";
6
6
 
@@ -88,7 +88,7 @@ function deleteCheckpointSnapshotIfSafe(filePath, expectedDir) {
88
88
  return;
89
89
  }
90
90
  try {
91
- fs.unlinkSync(resolved);
91
+ syncFs.unlinkSync(resolved);
92
92
  } catch {}
93
93
  }
94
94
  function cleanupSessionCompactionSnapshot(reference) {
@@ -105,7 +105,7 @@ function captureSessionCompactionSnapshot(params) {
105
105
  const resolved = path.resolve(sessionFile);
106
106
  let stat;
107
107
  try {
108
- stat = fs.statSync(resolved);
108
+ stat = syncFs.statSync(resolved);
109
109
  } catch {
110
110
  return null;
111
111
  }
@@ -123,7 +123,7 @@ function captureSessionCompactionSnapshot(params) {
123
123
  const base = path.basename(resolved, ".jsonl");
124
124
  const snapshotFile = path.join(dir, `${base}.checkpoint.${randomUUID()}.jsonl`);
125
125
  try {
126
- fs.copyFileSync(resolved, snapshotFile);
126
+ syncFs.copyFileSync(resolved, snapshotFile);
127
127
  } catch {
128
128
  return null;
129
129
  }
@@ -7,7 +7,7 @@ import { extractToolCallNames, hasToolCall } from "../utils/transcript-tools.js"
7
7
  import { stripEnvelope } from "../shared/chat-envelope.js";
8
8
  import "./chat-sanitize.js";
9
9
  import "../config/sessions.js";
10
- import fs from "node:fs";
10
+ import syncFs from "node:fs";
11
11
  import os from "node:os";
12
12
  import path from "node:path";
13
13
 
@@ -50,11 +50,11 @@ function setCachedSessionTitleFields(cacheKey, stat, value) {
50
50
  }
51
51
  function readSessionMessages(sessionId, storePath, sessionFile) {
52
52
  const candidates = resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile);
53
- const filePath = candidates.find((p) => fs.existsSync(p));
53
+ const filePath = candidates.find((p) => syncFs.existsSync(p));
54
54
  if (!filePath) {
55
55
  return [];
56
56
  }
57
- const lines = fs.readFileSync(filePath, "utf-8").split(/\r?\n/);
57
+ const lines = syncFs.readFileSync(filePath, "utf-8").split(/\r?\n/);
58
58
  const messages = [];
59
59
  for (const line of lines) {
60
60
  if (!line.trim()) {
@@ -123,7 +123,7 @@ function resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, a
123
123
  function canonicalizePathForComparison(filePath) {
124
124
  const resolved = path.resolve(filePath);
125
125
  try {
126
- return fs.realpathSync(resolved);
126
+ return syncFs.realpathSync(resolved);
127
127
  } catch {
128
128
  return resolved;
129
129
  }
@@ -131,7 +131,7 @@ function canonicalizePathForComparison(filePath) {
131
131
  function archiveFileOnDisk(filePath, reason) {
132
132
  const ts = formatSessionArchiveTimestamp();
133
133
  const archived = `${filePath}.${reason}.${ts}`;
134
- fs.renameSync(filePath, archived);
134
+ syncFs.renameSync(filePath, archived);
135
135
  return archived;
136
136
  }
137
137
  /**
@@ -149,7 +149,7 @@ function archiveSessionTranscripts(opts) {
149
149
  continue;
150
150
  }
151
151
  }
152
- if (!fs.existsSync(candidatePath)) {
152
+ if (!syncFs.existsSync(candidatePath)) {
153
153
  continue;
154
154
  }
155
155
  try {
@@ -171,7 +171,7 @@ async function cleanupArchivedSessionTranscripts(opts) {
171
171
  let removed = 0;
172
172
  let scanned = 0;
173
173
  for (const dir of directories) {
174
- const entries = await fs.promises.readdir(dir).catch(() => []);
174
+ const entries = await syncFs.promises.readdir(dir).catch(() => []);
175
175
  for (const entry of entries) {
176
176
  const timestamp = parseSessionArchiveTimestamp(entry, reason);
177
177
  if (timestamp == null) {
@@ -182,11 +182,11 @@ async function cleanupArchivedSessionTranscripts(opts) {
182
182
  continue;
183
183
  }
184
184
  const fullPath = path.join(dir, entry);
185
- const stat = await fs.promises.stat(fullPath).catch(() => null);
185
+ const stat = await syncFs.promises.stat(fullPath).catch(() => null);
186
186
  if (!stat?.isFile()) {
187
187
  continue;
188
188
  }
189
- await fs.promises.rm(fullPath).catch(() => undefined);
189
+ await syncFs.promises.rm(fullPath).catch(() => undefined);
190
190
  removed += 1;
191
191
  }
192
192
  }
@@ -225,7 +225,7 @@ function capArrayByJsonBytes(items, maxBytes) {
225
225
  const MAX_LINES_TO_SCAN = 10;
226
226
  function readSessionTitleFieldsFromTranscript(sessionId, storePath, sessionFile, agentId, opts) {
227
227
  const candidates = resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, agentId);
228
- const filePath = candidates.find((p) => fs.existsSync(p));
228
+ const filePath = candidates.find((p) => syncFs.existsSync(p));
229
229
  if (!filePath) {
230
230
  return {
231
231
  firstUserMessage: null,
@@ -234,7 +234,7 @@ function readSessionTitleFieldsFromTranscript(sessionId, storePath, sessionFile,
234
234
  }
235
235
  let stat;
236
236
  try {
237
- stat = fs.statSync(filePath);
237
+ stat = syncFs.statSync(filePath);
238
238
  } catch {
239
239
  return {
240
240
  firstUserMessage: null,
@@ -256,7 +256,7 @@ function readSessionTitleFieldsFromTranscript(sessionId, storePath, sessionFile,
256
256
  }
257
257
  let fd = null;
258
258
  try {
259
- fd = fs.openSync(filePath, "r");
259
+ fd = syncFs.openSync(filePath, "r");
260
260
  const size = stat.size;
261
261
  let firstUserMessage = null;
262
262
  try {
@@ -286,7 +286,7 @@ function readSessionTitleFieldsFromTranscript(sessionId, storePath, sessionFile,
286
286
  } finally {
287
287
  if (fd !== null) {
288
288
  try {
289
- fs.closeSync(fd);
289
+ syncFs.closeSync(fd);
290
290
  } catch {}
291
291
  }
292
292
  }
@@ -314,7 +314,7 @@ function extractTextFromContent(content) {
314
314
  }
315
315
  function readTranscriptHeadChunk(fd, maxBytes = 8192) {
316
316
  const buf = Buffer.alloc(maxBytes);
317
- const bytesRead = fs.readSync(fd, buf, 0, buf.length, 0);
317
+ const bytesRead = syncFs.readSync(fd, buf, 0, buf.length, 0);
318
318
  if (bytesRead <= 0) {
319
319
  return null;
320
320
  }
@@ -345,16 +345,16 @@ function extractFirstUserMessageFromTranscriptChunk(chunk, opts) {
345
345
  }
346
346
  function findExistingTranscriptPath(sessionId, storePath, sessionFile, agentId) {
347
347
  const candidates = resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, agentId);
348
- return candidates.find((p) => fs.existsSync(p)) ?? null;
348
+ return candidates.find((p) => syncFs.existsSync(p)) ?? null;
349
349
  }
350
350
  function withOpenTranscriptFd(filePath, read) {
351
351
  let fd = null;
352
352
  try {
353
- fd = fs.openSync(filePath, "r");
353
+ fd = syncFs.openSync(filePath, "r");
354
354
  return read(fd);
355
355
  } catch {} finally {
356
356
  if (fd !== null) {
357
- fs.closeSync(fd);
357
+ syncFs.closeSync(fd);
358
358
  }
359
359
  }
360
360
  return null;
@@ -378,7 +378,7 @@ function readLastMessagePreviewFromOpenTranscript(params) {
378
378
  const readStart = Math.max(0, params.size - LAST_MSG_MAX_BYTES);
379
379
  const readLen = Math.min(params.size, LAST_MSG_MAX_BYTES);
380
380
  const buf = Buffer.alloc(readLen);
381
- fs.readSync(params.fd, buf, 0, readLen, readStart);
381
+ syncFs.readSync(params.fd, buf, 0, readLen, readStart);
382
382
  const chunk = buf.toString("utf-8");
383
383
  const lines = chunk.split(/\r?\n/).filter((l) => l.trim());
384
384
  const tailLines = lines.slice(-LAST_MSG_MAX_LINES);
@@ -404,7 +404,7 @@ function readLastMessagePreviewFromTranscript(sessionId, storePath, sessionFile,
404
404
  return null;
405
405
  }
406
406
  return withOpenTranscriptFd(filePath, (fd) => {
407
- const stat = fs.fstatSync(fd);
407
+ const stat = syncFs.fstatSync(fd);
408
408
  const size = stat.size;
409
409
  if (size === 0) {
410
410
  return null;
@@ -522,8 +522,8 @@ function buildPreviewItems(messages, maxItems, maxChars) {
522
522
  function readRecentMessagesFromTranscript(filePath, maxMessages, readBytes) {
523
523
  let fd = null;
524
524
  try {
525
- fd = fs.openSync(filePath, "r");
526
- const stat = fs.fstatSync(fd);
525
+ fd = syncFs.openSync(filePath, "r");
526
+ const stat = syncFs.fstatSync(fd);
527
527
  const size = stat.size;
528
528
  if (size === 0) {
529
529
  return [];
@@ -531,7 +531,7 @@ function readRecentMessagesFromTranscript(filePath, maxMessages, readBytes) {
531
531
  const readStart = Math.max(0, size - readBytes);
532
532
  const readLen = Math.min(size, readBytes);
533
533
  const buf = Buffer.alloc(readLen);
534
- fs.readSync(fd, buf, 0, readLen, readStart);
534
+ syncFs.readSync(fd, buf, 0, readLen, readStart);
535
535
  const chunk = buf.toString("utf-8");
536
536
  const lines = chunk.split(/\r?\n/).filter((l) => l.trim());
537
537
  const tailLines = lines.slice(-PREVIEW_MAX_LINES);
@@ -554,13 +554,13 @@ function readRecentMessagesFromTranscript(filePath, maxMessages, readBytes) {
554
554
  return [];
555
555
  } finally {
556
556
  if (fd !== null) {
557
- fs.closeSync(fd);
557
+ syncFs.closeSync(fd);
558
558
  }
559
559
  }
560
560
  }
561
561
  function readSessionPreviewItemsFromTranscript(sessionId, storePath, sessionFile, agentId, maxItems, maxChars) {
562
562
  const candidates = resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, agentId);
563
- const filePath = candidates.find((p) => fs.existsSync(p));
563
+ const filePath = candidates.find((p) => syncFs.existsSync(p));
564
564
  if (!filePath) {
565
565
  return [];
566
566
  }