@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.
Files changed (268) hide show
  1. package/dist/acp/client.js +2 -2
  2. package/dist/acp/secret-file.js +2 -2
  3. package/dist/agents/agent-scope.js +2 -2
  4. package/dist/agents/apply-patch.js +8 -8
  5. package/dist/agents/auth-profiles/paths.js +2 -2
  6. package/dist/agents/auth-profiles/store.js +2 -2
  7. package/dist/agents/bash-tools.shared.js +2 -2
  8. package/dist/agents/cli-credentials.js +4 -4
  9. package/dist/agents/docs-path.js +3 -3
  10. package/dist/agents/embedded-pi-mcp.js +4 -4
  11. package/dist/agents/identity-avatar.js +3 -3
  12. package/dist/agents/identity-file.js +2 -2
  13. package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
  14. package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
  15. package/dist/agents/pi-model-discovery.js +6 -6
  16. package/dist/agents/pi-project-settings.js +3 -3
  17. package/dist/agents/sandbox/fs-bridge.js +2 -2
  18. package/dist/agents/session-dirs.js +4 -4
  19. package/dist/agents/session-write-lock.js +13 -13
  20. package/dist/agents/shell-utils.js +5 -5
  21. package/dist/agents/skills/bundled-dir.js +4 -4
  22. package/dist/agents/skills/local-loader.js +6 -6
  23. package/dist/agents/skills/plugin-skills.js +2 -2
  24. package/dist/agents/skills/workspace.js +13 -13
  25. package/dist/agents/skills-install-download.js +7 -7
  26. package/dist/agents/skills-install-plan.js +2 -2
  27. package/dist/agents/skills-install.js +2 -2
  28. package/dist/agents/skills-status.js +2 -2
  29. package/dist/agents/subagent-depth.js +2 -2
  30. package/dist/agents/system-prompt-params.js +2 -2
  31. package/dist/agents/workspace.js +22 -22
  32. package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
  33. package/dist/auto-reply/reply/agent-runner.js +2 -2
  34. package/dist/auto-reply/reply/commands-export-session.js +7 -7
  35. package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
  36. package/dist/auto-reply/reply/post-compaction-context.js +3 -3
  37. package/dist/auto-reply/reply/session.js +3 -3
  38. package/dist/auto-reply/skill-commands.js +3 -3
  39. package/dist/auto-reply/status.js +6 -6
  40. package/dist/brand.js +1 -1
  41. package/dist/browser/chrome.executables.js +3 -3
  42. package/dist/browser/chrome.js +3 -3
  43. package/dist/browser/chrome.profile-decoration.js +6 -6
  44. package/dist/browser/profiles-service.js +2 -2
  45. package/dist/browser/server-context.js +2 -2
  46. package/dist/browser/trash.js +4 -4
  47. package/dist/build-info.json +3 -3
  48. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  49. package/dist/canvas-host/server.js +4 -4
  50. package/dist/capabilities/catalog.js +3 -3
  51. package/dist/channels/plugins/catalog.js +3 -3
  52. package/dist/cli/browser-cli-extension.js +6 -6
  53. package/dist/cli/command-format.js +2 -2
  54. package/dist/cli/cron-cli/register.cron-simple.js +2 -2
  55. package/dist/cli/daemon-cli/restart-health.js +49 -13
  56. package/dist/cli/dns-cli.js +9 -9
  57. package/dist/cli/gateway-cli/dev.js +5 -5
  58. package/dist/cli/gateway-cli/run.js +2 -2
  59. package/dist/cli/hooks-cli.js +5 -5
  60. package/dist/cli/memory-cli.js +7 -7
  61. package/dist/cli/nodes-media-utils.js +2 -2
  62. package/dist/cli/plugins-cli.js +2 -2
  63. package/dist/cli/secrets-cli.js +3 -3
  64. package/dist/cli/update-cli/shared.js +1 -29
  65. package/dist/cli/update-cli/update-command.js +12 -15
  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/cron/service/store.js +2 -2
  93. package/dist/cron/store.js +6 -6
  94. package/dist/daemon/systemd-system.js +5 -5
  95. package/dist/discord/monitor/thread-bindings.state.js +2 -2
  96. package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
  97. package/dist/gateway/control-ui-boot-check.js +6 -6
  98. package/dist/gateway/control-ui-login.js +7 -7
  99. package/dist/gateway/control-ui.js +9 -9
  100. package/dist/gateway/hooks-mapping.js +4 -4
  101. package/dist/gateway/server-discovery.js +2 -2
  102. package/dist/gateway/server-http.js +4 -4
  103. package/dist/gateway/server-methods/chat.js +6 -6
  104. package/dist/gateway/server-methods/sessions.js +6 -6
  105. package/dist/gateway/server-methods/usage.js +2 -2
  106. package/dist/gateway/server.impl.js +3 -3
  107. package/dist/gateway/session-compaction-checkpoints.js +4 -4
  108. package/dist/gateway/session-utils.fs.js +24 -24
  109. package/dist/gateway/session-utils.js +6 -6
  110. package/dist/hooks/bundled-dir.js +4 -4
  111. package/dist/hooks/gmail-setup-utils.js +6 -6
  112. package/dist/hooks/import-url.js +2 -2
  113. package/dist/hooks/loader.js +4 -4
  114. package/dist/hooks/workspace.js +7 -7
  115. package/dist/infra/archive.js +17 -17
  116. package/dist/infra/boundary-file-read.js +2 -2
  117. package/dist/infra/boundary-path.js +15 -15
  118. package/dist/infra/brew.js +2 -2
  119. package/dist/infra/control-ui-assets.js +14 -14
  120. package/dist/infra/device-auth-store.js +8 -8
  121. package/dist/infra/device-identity.js +8 -8
  122. package/dist/infra/dotenv.js +2 -2
  123. package/dist/infra/exec-approvals.js +8 -8
  124. package/dist/infra/exec-command-resolution.js +4 -4
  125. package/dist/infra/exec-safe-bin-trust.js +2 -2
  126. package/dist/infra/fased-root.js +5 -5
  127. package/dist/infra/fs-safe.js +14 -14
  128. package/dist/infra/gateway-lock.js +11 -11
  129. package/dist/infra/git-commit.js +5 -5
  130. package/dist/infra/git-root.js +4 -4
  131. package/dist/infra/hosted-runtime-artifact.js +3 -3
  132. package/dist/infra/is-main.js +2 -2
  133. package/dist/infra/json-file.js +7 -7
  134. package/dist/infra/outbound/delivery-queue.js +16 -16
  135. package/dist/infra/path-env.js +3 -3
  136. package/dist/infra/ports-lsof.js +4 -4
  137. package/dist/infra/provider-usage.auth.js +3 -3
  138. package/dist/infra/safe-open-sync.js +2 -2
  139. package/dist/infra/session-cost-usage.js +9 -9
  140. package/dist/infra/shell-env.js +2 -2
  141. package/dist/infra/state-migrations.fs.js +6 -6
  142. package/dist/infra/state-migrations.js +23 -23
  143. package/dist/infra/tmp-fased-dir.js +6 -6
  144. package/dist/infra/update-global.js +1 -0
  145. package/dist/infra/update-runner.js +111 -64
  146. package/dist/infra/widearea-dns.js +3 -3
  147. package/dist/infra/wsl.js +2 -2
  148. package/dist/light-update-status.js +1 -1
  149. package/dist/line/accounts.js +2 -2
  150. package/dist/line/download.js +2 -2
  151. package/dist/logging/config.js +3 -3
  152. package/dist/logging/logger.js +7 -7
  153. package/dist/managed/federation.js +3 -3
  154. package/dist/managed/tunnel.js +3 -3
  155. package/dist/media/store.js +13 -13
  156. package/dist/media-understanding/runner.js +3 -3
  157. package/dist/memory/embeddings.js +2 -2
  158. package/dist/memory/internal.js +10 -10
  159. package/dist/memory/manager-sync-ops.js +7 -7
  160. package/dist/memory/repair-executor.js +17 -17
  161. package/dist/node-host/invoke-system-run-plan.js +8 -8
  162. package/dist/node-host/invoke.js +2 -2
  163. package/dist/node-host/runner.js +3 -3
  164. package/dist/pairing/pairing-store.js +3 -3
  165. package/dist/plugin-sdk/{audio-preflight-XJNZUuhw.js → audio-preflight-DEoblcsk.js} +1 -1
  166. package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
  167. package/dist/plugin-sdk/{chunk-items-me0j1xjK.js → chunk-items-ClDXjhOb.js} +1 -1
  168. package/dist/plugin-sdk/command-status.js +1 -1
  169. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  170. package/dist/plugin-sdk/discord.d.ts +3 -3
  171. package/dist/plugin-sdk/index.d.ts +5 -5
  172. package/dist/plugin-sdk/index.js +2 -1
  173. package/dist/plugin-sdk/json-store.js +6 -6
  174. package/dist/plugin-sdk/{monitor-DUyt6cCK.js → monitor-CZ490e2-.js} +3 -3
  175. package/dist/plugin-sdk/{monitor-C7si_bKw.js → monitor-_2NRVtaY.js} +3 -3
  176. package/dist/plugin-sdk/{openresponses-http-sYsdEjGP.js → openresponses-http-BEYlPTy3.js} +1 -1
  177. package/dist/plugin-sdk/{pairing-message-C5m-8Evp.d.ts → pairing-message-6XVXW554.d.ts} +1 -1
  178. package/dist/plugin-sdk/{pi-embedded-runner-C6HkZJ5E.js → pi-embedded-runner-SkBGtJFB.js} +7 -7
  179. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
  180. package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
  181. package/dist/plugin-sdk/{slack-CEoLScM7.js → slack--DAH0bKU.js} +3 -3
  182. package/dist/plugin-sdk/slack.d.ts +3 -3
  183. package/dist/plugin-sdk/{sticker-cache-PRfvBRnv.js → sticker-cache-CUnBcKME.js} +2 -2
  184. package/dist/plugin-sdk/{telegram-actions-D4PNLPEZ.js → telegram-actions-L7LDJqla.js} +2 -2
  185. package/dist/plugin-sdk/telegram.d.ts +3 -3
  186. package/dist/plugin-sdk/{tmp-fased-dir-B-AAdaCr.d.ts → tmp-fased-dir-BpMLNd4L.d.ts} +1 -1
  187. package/dist/plugin-sdk/{types-ZT0DGnls.d.ts → types-0CsXVmg8.d.ts} +2 -2
  188. package/dist/plugin-sdk/{types-56R2vXgt.d.ts → types-DMLEeE52.d.ts} +1 -1
  189. package/dist/plugin-sdk/{web-CSpyzE3P.js → web-DMRFrK11.js} +1 -1
  190. package/dist/plugin-sdk/whatsapp.d.ts +3 -3
  191. package/dist/plugins/bundled-dir.js +3 -3
  192. package/dist/plugins/discovery.js +11 -11
  193. package/dist/plugins/loader.js +13 -13
  194. package/dist/plugins/manifest-registry.js +2 -2
  195. package/dist/plugins/manifest.js +4 -4
  196. package/dist/plugins/path-safety.js +3 -3
  197. package/dist/plugins/status-cache.js +9 -9
  198. package/dist/plugins/update.js +3 -3
  199. package/dist/plugins/web-search-install-catalog.js +3 -3
  200. package/dist/secrets/apply.js +16 -16
  201. package/dist/secrets/audit.js +11 -11
  202. package/dist/secrets/shared.js +9 -9
  203. package/dist/security/scan-paths.js +2 -2
  204. package/dist/shared/config-eval.js +2 -2
  205. package/dist/shared/pid-alive.js +2 -2
  206. package/dist/tasks/standing-orders.js +5 -5
  207. package/dist/tasks/task-flow-registry.js +5 -5
  208. package/dist/tasks/task-registry.js +5 -5
  209. package/dist/tasks/workflow-definitions.js +6 -6
  210. package/dist/telegram/token.js +5 -5
  211. package/dist/utils.js +5 -5
  212. package/dist/wallet/local-socket-signer-broker.js +16 -16
  213. package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
  214. package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
  215. package/dist/wallet/wallet-approval-auth.js +5 -5
  216. package/dist/wallet/wallet-audit-log.js +5 -5
  217. package/dist/wallet/wallet-custody.js +21 -21
  218. package/dist/wallet/wallet-inbound-events.js +5 -5
  219. package/dist/wallet/wallet-observability.js +5 -5
  220. package/dist/wallet/wallet-policy.js +9 -9
  221. package/dist/wallet/wallet-provider-registry.js +7 -7
  222. package/dist/wallet/wallet-runtime-config.js +3 -3
  223. package/dist/wallet/wallet-secrets-store.js +22 -22
  224. package/dist/wallet/wallet-send-approvals.js +5 -5
  225. package/dist/wallet/wallet-settlement-links.js +5 -5
  226. package/dist/web/accounts.js +3 -3
  227. package/dist/web/auth-store.js +18 -18
  228. package/dist/web/session.js +4 -4
  229. package/dist/wizard/host-security-capability.js +2 -2
  230. package/dist/wizard/onboarding.host-security.js +7 -7
  231. package/dist/wizard/onboarding.js +7 -7
  232. package/dist/wizard/onboarding.wallet.js +44 -44
  233. package/extensions/acpx/package.json +1 -1
  234. package/extensions/bluebubbles/package.json +1 -1
  235. package/extensions/copilot-proxy/package.json +1 -1
  236. package/extensions/diagnostics-otel/package.json +1 -1
  237. package/extensions/fased-federation/package.json +1 -1
  238. package/extensions/google-gemini-cli-auth/package.json +1 -1
  239. package/extensions/imessage/package.json +1 -1
  240. package/extensions/irc/package.json +1 -1
  241. package/extensions/line/package.json +1 -1
  242. package/extensions/llm-task/package.json +1 -1
  243. package/extensions/lobster/package.json +1 -1
  244. package/extensions/matrix/CHANGELOG.md +12 -0
  245. package/extensions/matrix/package.json +1 -1
  246. package/extensions/mattermost/package.json +1 -1
  247. package/extensions/memory-core/package.json +2 -2
  248. package/extensions/memory-lancedb/package.json +1 -1
  249. package/extensions/minimax-portal-auth/package.json +1 -1
  250. package/extensions/msteams/CHANGELOG.md +12 -0
  251. package/extensions/msteams/package.json +1 -1
  252. package/extensions/nextcloud-talk/package.json +1 -1
  253. package/extensions/nostr/CHANGELOG.md +12 -0
  254. package/extensions/nostr/package.json +1 -1
  255. package/extensions/open-prose/package.json +1 -1
  256. package/extensions/sat-mining/package.json +1 -1
  257. package/extensions/signal/package.json +1 -1
  258. package/extensions/synology-chat/package.json +1 -1
  259. package/extensions/tlon/package.json +1 -1
  260. package/extensions/twitch/CHANGELOG.md +12 -0
  261. package/extensions/twitch/package.json +1 -1
  262. package/extensions/voice-call/CHANGELOG.md +12 -0
  263. package/extensions/voice-call/package.json +1 -1
  264. package/extensions/zalo/CHANGELOG.md +12 -0
  265. package/extensions/zalo/package.json +1 -1
  266. package/extensions/zalouser/CHANGELOG.md +12 -0
  267. package/extensions/zalouser/package.json +1 -1
  268. package/package.json +1 -1
@@ -10,7 +10,7 @@ import { archiveSessionTranscripts, cleanupArchivedSessionTranscripts } from "..
10
10
  import { deliveryContextFromSession, mergeDeliveryContext, normalizeDeliveryContext, normalizeSessionDeliveryFields } from "../../utils/delivery-context.js";
11
11
  import { getFileMtimeMs, isCacheEnabled, resolveCacheTtlMs } from "../cache-utils.js";
12
12
  import { enforceSessionDiskBudget } from "./disk-budget.js";
13
- import syncFs from "node:fs";
13
+ import fs from "node:fs";
14
14
  import path from "node:path";
15
15
  import crypto from "node:crypto";
16
16
 
@@ -155,7 +155,7 @@ function loadSessionStore(storePath, opts = {}) {
155
155
  const retryBuf = maxReadAttempts > 1 ? new Int32Array(new SharedArrayBuffer(4)) : undefined;
156
156
  for (let attempt = 0; attempt < maxReadAttempts; attempt++) {
157
157
  try {
158
- const raw = syncFs.readFileSync(storePath, "utf-8");
158
+ const raw = fs.readFileSync(storePath, "utf-8");
159
159
  if (raw.length === 0 && attempt < maxReadAttempts - 1) {
160
160
  Atomics.wait(retryBuf, 0, 0, 50);
161
161
  continue;
@@ -406,7 +406,7 @@ function capEntryCount(store, overrideMax, opts = {}) {
406
406
  }
407
407
  async function getSessionFileSize(storePath) {
408
408
  try {
409
- const stat = await syncFs.promises.stat(storePath);
409
+ const stat = await fs.promises.stat(storePath);
410
410
  return stat.size;
411
411
  } catch {
412
412
  return null;
@@ -428,7 +428,7 @@ async function rotateSessionFile(storePath, overrideBytes) {
428
428
  }
429
429
  const backupPath = `${storePath}.bak.${Date.now()}`;
430
430
  try {
431
- await syncFs.promises.rename(storePath, backupPath);
431
+ await fs.promises.rename(storePath, backupPath);
432
432
  log.info("rotated session store file", {
433
433
  backupPath: path.basename(backupPath),
434
434
  sizeBytes: fileSize
@@ -439,13 +439,13 @@ async function rotateSessionFile(storePath, overrideBytes) {
439
439
  try {
440
440
  const dir = path.dirname(storePath);
441
441
  const baseName = path.basename(storePath);
442
- const files = await syncFs.promises.readdir(dir);
442
+ const files = await fs.promises.readdir(dir);
443
443
  const backups = files.filter((f) => f.startsWith(`${baseName}.bak.`)).toSorted().toReversed();
444
444
  const maxBackups = 3;
445
445
  if (backups.length > maxBackups) {
446
446
  const toDelete = backups.slice(maxBackups);
447
447
  for (const old of toDelete) {
448
- await syncFs.promises.unlink(path.join(dir, old)).catch(() => undefined);
448
+ await fs.promises.unlink(path.join(dir, old)).catch(() => undefined);
449
449
  }
450
450
  log.info("cleaned up old session store backups", { deleted: toDelete.length });
451
451
  }
@@ -561,15 +561,15 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
561
561
  });
562
562
  }
563
563
  }
564
- await syncFs.promises.mkdir(path.dirname(storePath), { recursive: true });
564
+ await fs.promises.mkdir(path.dirname(storePath), { recursive: true });
565
565
  const json = JSON.stringify(store, null, 2);
566
566
  if (process.platform === "win32") {
567
567
  const tmp = `${storePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
568
568
  try {
569
- await syncFs.promises.writeFile(tmp, json, "utf-8");
569
+ await fs.promises.writeFile(tmp, json, "utf-8");
570
570
  for (let i = 0; i < 5; i++) {
571
571
  try {
572
- await syncFs.promises.rename(tmp, storePath);
572
+ await fs.promises.rename(tmp, storePath);
573
573
  break;
574
574
  } catch {
575
575
  if (i < 4) {
@@ -587,28 +587,28 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
587
587
  }
588
588
  throw err;
589
589
  } finally {
590
- await syncFs.promises.rm(tmp, { force: true }).catch(() => undefined);
590
+ await fs.promises.rm(tmp, { force: true }).catch(() => undefined);
591
591
  }
592
592
  return;
593
593
  }
594
594
  const tmp = `${storePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
595
595
  try {
596
- await syncFs.promises.writeFile(tmp, json, {
596
+ await fs.promises.writeFile(tmp, json, {
597
597
  mode: 384,
598
598
  encoding: "utf-8"
599
599
  });
600
- await syncFs.promises.rename(tmp, storePath);
601
- await syncFs.promises.chmod(storePath, 384);
600
+ await fs.promises.rename(tmp, storePath);
601
+ await fs.promises.chmod(storePath, 384);
602
602
  } catch (err) {
603
603
  const code = err && typeof err === "object" && "code" in err ? String(err.code) : null;
604
604
  if (code === "ENOENT") {
605
605
  try {
606
- await syncFs.promises.mkdir(path.dirname(storePath), { recursive: true });
607
- await syncFs.promises.writeFile(storePath, json, {
606
+ await fs.promises.mkdir(path.dirname(storePath), { recursive: true });
607
+ await fs.promises.writeFile(storePath, json, {
608
608
  mode: 384,
609
609
  encoding: "utf-8"
610
610
  });
611
- await syncFs.promises.chmod(storePath, 384);
611
+ await fs.promises.chmod(storePath, 384);
612
612
  } catch (err2) {
613
613
  const code2 = err2 && typeof err2 === "object" && "code" in err2 ? String(err2.code) : null;
614
614
  if (code2 === "ENOENT") {
@@ -620,7 +620,7 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
620
620
  }
621
621
  throw err;
622
622
  } finally {
623
- await syncFs.promises.rm(tmp, { force: true });
623
+ await fs.promises.rm(tmp, { force: true });
624
624
  }
625
625
  }
626
626
  async function saveSessionStore(storePath, store, opts) {
@@ -2,7 +2,7 @@ import { resolveDefaultSessionStorePath, resolveSessionTranscriptPathInDir } fro
2
2
  import { loadSessionStore } from "./store.js";
3
3
  import { emitSessionTranscriptUpdate } from "../../sessions/transcript-events.js";
4
4
  import { resolveAndPersistSessionFile } from "./session-file.js";
5
- import syncFs from "node:fs";
5
+ import fs from "node:fs";
6
6
  import path from "node:path";
7
7
  import { CURRENT_SESSION_VERSION, SessionManager } from "@mariozechner/pi-coding-agent";
8
8
 
@@ -65,10 +65,10 @@ async function resolveSessionTranscriptFile(params) {
65
65
  });
66
66
  }
67
67
  async function ensureSessionHeader(params) {
68
- if (syncFs.existsSync(params.sessionFile)) {
68
+ if (fs.existsSync(params.sessionFile)) {
69
69
  return;
70
70
  }
71
- await syncFs.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
71
+ await fs.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
72
72
  const header = {
73
73
  type: "session",
74
74
  version: CURRENT_SESSION_VERSION,
@@ -76,7 +76,7 @@ async function ensureSessionHeader(params) {
76
76
  timestamp: new Date().toISOString(),
77
77
  cwd: process.cwd()
78
78
  };
79
- await syncFs.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
79
+ await fs.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
80
80
  encoding: "utf-8",
81
81
  mode: 384
82
82
  });
@@ -1,5 +1,5 @@
1
1
  import { coerceSecretRef } from "./types.secrets.js";
2
- import syncFs from "node:fs";
2
+ import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
 
@@ -254,7 +254,7 @@ function buildTalkConfigResponse(value) {
254
254
  return Object.keys(payload).length > 0 ? payload : undefined;
255
255
  }
256
256
  function readTalkApiKeyFromProfile(deps = {}) {
257
- const fsImpl = deps.fs ?? syncFs;
257
+ const fsImpl = deps.fs ?? fs;
258
258
  const osImpl = deps.os ?? os;
259
259
  const pathImpl = deps.path ?? path;
260
260
  const home = osImpl.homedir();
@@ -5,7 +5,7 @@ import { inferLegacyName, normalizeOptionalText } from "./normalize.js";
5
5
  import { normalizeCronStaggerMs, resolveDefaultCronStaggerMs } from "../stagger.js";
6
6
  import { loadCronStore, saveCronStore } from "../store.js";
7
7
  import { recomputeNextRuns } from "./jobs.js";
8
- import syncFs from "node:fs";
8
+ import fs from "node:fs";
9
9
 
10
10
  //#region src/cron/service/store.ts
11
11
  function buildDeliveryPatchFromLegacyPayload(payload) {
@@ -179,7 +179,7 @@ function stripLegacyTopLevelFields(raw) {
179
179
  }
180
180
  async function getFileMtimeMs(path) {
181
181
  try {
182
- const stats = await syncFs.promises.stat(path);
182
+ const stats = await fs.promises.stat(path);
183
183
  return stats.mtimeMs;
184
184
  } catch {
185
185
  return null;
@@ -1,6 +1,6 @@
1
1
  import { expandHomePrefix } from "../infra/home-dir.js";
2
2
  import { CONFIG_DIR } from "../utils.js";
3
- import syncFs from "node:fs";
3
+ import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import JSON5 from "json5";
6
6
 
@@ -19,7 +19,7 @@ function resolveCronStorePath(storePath) {
19
19
  }
20
20
  async function loadCronStore(storePath) {
21
21
  try {
22
- const raw = await syncFs.promises.readFile(storePath, "utf-8");
22
+ const raw = await fs.promises.readFile(storePath, "utf-8");
23
23
  let parsed;
24
24
  try {
25
25
  parsed = JSON5.parse(raw);
@@ -45,14 +45,14 @@ async function loadCronStore(storePath) {
45
45
  }
46
46
  }
47
47
  async function saveCronStore(storePath, store) {
48
- await syncFs.promises.mkdir(path.dirname(storePath), { recursive: true });
48
+ await fs.promises.mkdir(path.dirname(storePath), { recursive: true });
49
49
  const { randomBytes } = await import("node:crypto");
50
50
  const tmp = `${storePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
51
51
  const json = JSON.stringify(store, null, 2);
52
- await syncFs.promises.writeFile(tmp, json, "utf-8");
53
- await syncFs.promises.rename(tmp, storePath);
52
+ await fs.promises.writeFile(tmp, json, "utf-8");
53
+ await fs.promises.rename(tmp, storePath);
54
54
  try {
55
- await syncFs.promises.copyFile(storePath, `${storePath}.bak`);
55
+ await fs.promises.copyFile(storePath, `${storePath}.bak`);
56
56
  } catch {}
57
57
  }
58
58
 
@@ -4,7 +4,7 @@ import { parseSystemdShow } from "./systemd.js";
4
4
  import { existsSync } from "node:fs";
5
5
  import os from "node:os";
6
6
  import path from "node:path";
7
- import fs from "node:fs/promises";
7
+ import fs$1 from "node:fs/promises";
8
8
  import { spawn } from "node:child_process";
9
9
 
10
10
  //#region src/daemon/systemd-system.ts
@@ -23,7 +23,7 @@ function findHostedSystemdUnitPath(candidates = SYSTEM_UNIT_CANDIDATES) {
23
23
  }
24
24
  async function readHostedSystemdCommand(unitPath) {
25
25
  try {
26
- const content = await fs.readFile(unitPath, "utf8");
26
+ const content = await fs$1.readFile(unitPath, "utf8");
27
27
  let workingDirectory = "";
28
28
  let execStart = "";
29
29
  const environment = {};
@@ -151,7 +151,7 @@ function buildHostedSystemdUnit(params) {
151
151
  return lines.join("\n");
152
152
  }
153
153
  async function runHelper(unit, runAsUser) {
154
- await fs.access(INSTALL_HELPER);
154
+ await fs$1.access(INSTALL_HELPER);
155
155
  await new Promise((resolve, reject) => {
156
156
  const child = spawn("sudo", [
157
157
  "-n",
@@ -206,8 +206,8 @@ async function installHostedSystemdService(params) {
206
206
  `${SERVICE_NAME}.service`
207
207
  ]).catch(() => undefined);
208
208
  const userUnit = path.join(os.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`);
209
- await fs.rm(userUnit, { force: true }).catch(() => undefined);
210
- await fs.rm(`${userUnit}.d`, {
209
+ await fs$1.rm(userUnit, { force: true }).catch(() => undefined);
210
+ await fs$1.rm(`${userUnit}.d`, {
211
211
  recursive: true,
212
212
  force: true
213
213
  }).catch(() => undefined);
@@ -3,7 +3,7 @@ import { normalizeAccountId } from "../../routing/account-id.js";
3
3
  import { resolveAgentIdFromSessionKey } from "../../routing/session-key.js";
4
4
  import { loadJsonFile, saveJsonFile } from "../../infra/json-file.js";
5
5
  import { DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS, DEFAULT_THREAD_BINDING_MAX_AGE_MS, RECENT_UNBOUND_WEBHOOK_ECHO_WINDOW_MS, THREAD_BINDINGS_VERSION } from "./thread-bindings.types.js";
6
- import syncFs from "node:fs";
6
+ import fs from "node:fs";
7
7
  import path from "node:path";
8
8
 
9
9
  //#region src/discord/monitor/thread-bindings.state.ts
@@ -320,7 +320,7 @@ function shouldPersistBindingMutations() {
320
320
  if (shouldPersistAnyBindingState()) {
321
321
  return true;
322
322
  }
323
- return syncFs.existsSync(resolveThreadBindingsPath());
323
+ return fs.existsSync(resolveThreadBindingsPath());
324
324
  }
325
325
  function saveBindingsToDisk(params = {}) {
326
326
  if (!params.force && !shouldPersistAnyBindingState()) {
@@ -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 syncFs from "node:fs";
3
+ import fs 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 && syncFs.existsSync(candidate)) {
165
+ if (candidate && fs.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 && syncFs.existsSync(candidate)) {
181
+ if (candidate && fs.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 && syncFs.existsSync(candidate)) {
197
+ if (candidate && fs.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 && syncFs.existsSync(candidate)) {
213
+ if (candidate && fs.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(syncFs.readFileSync(layoutPath, "utf-8"));
227
+ const loaded = JSON.parse(fs.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(syncFs.readFileSync(layoutPath, "utf-8"));
247
+ cachedPolicyLayout = JSON.parse(fs.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(syncFs.readFileSync(layoutPath, "utf-8"));
260
+ cachedStakingDistributorLayout = JSON.parse(fs.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(syncFs.readFileSync(layoutPath, "utf-8"));
273
+ cachedStakingPositionLayout = JSON.parse(fs.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 { resolveControlUiRootSync } from "../infra/control-ui-assets.js";
4
4
  import { normalizeControlUiBasePath } from "./control-ui-shared.js";
5
- import syncFs from "node:fs";
5
+ import fs 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 = syncFs.readFileSync(safeFile.fd);
192
+ const body = fs.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
- syncFs.closeSync(safeFile.fd);
203
+ fs.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: syncFs.realpathSync(root)
234
+ rootReal: fs.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 = syncFs.readFileSync(safeIndex.fd, "utf8");
271
+ html = fs.readFileSync(safeIndex.fd, "utf8");
272
272
  } finally {
273
- syncFs.closeSync(safeIndex.fd);
273
+ fs.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 syncFs from "node:fs";
4
+ import fs 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 (!syncFs.existsSync(this.statePath)) {
515
+ if (!fs.existsSync(this.statePath)) {
516
516
  return buildEmptyState();
517
517
  }
518
- const raw = syncFs.readFileSync(this.statePath, "utf8");
518
+ const raw = fs.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
- syncFs.mkdirSync(path.dirname(this.statePath), { recursive: true });
528
+ fs.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
- syncFs.writeFileSync(tmpPath, body, { mode: 384 });
532
- syncFs.renameSync(tmpPath, this.statePath);
531
+ fs.writeFileSync(tmpPath, body, { mode: 384 });
532
+ fs.renameSync(tmpPath, this.statePath);
533
533
  try {
534
- syncFs.chmodSync(this.statePath, 384);
534
+ fs.chmodSync(this.statePath, 384);
535
535
  } catch {}
536
536
  }
537
537
  };
@@ -7,7 +7,7 @@ import { CONTROL_UI_AVATAR_PREFIX, buildControlUiAvatarUrl, normalizeControlUiBa
7
7
  import { DEFAULT_ASSISTANT_IDENTITY, resolveAssistantIdentity } from "./assistant-identity.js";
8
8
  import { CONTROL_UI_BOOTSTRAP_CONFIG_PATH } from "./control-ui-contract.js";
9
9
  import { buildControlUiCspHeader } from "./control-ui-csp.js";
10
- import syncFs from "node:fs";
10
+ import fs from "node:fs";
11
11
  import path from "node:path";
12
12
 
13
13
  //#region src/gateway/control-ui.ts
@@ -151,10 +151,10 @@ function handleControlUiAvatarRequest(req, res, opts) {
151
151
  res.end();
152
152
  return true;
153
153
  }
154
- serveResolvedFile(res, safeAvatar.path, syncFs.readFileSync(safeAvatar.fd));
154
+ serveResolvedFile(res, safeAvatar.path, fs.readFileSync(safeAvatar.fd));
155
155
  return true;
156
156
  } finally {
157
- syncFs.closeSync(safeAvatar.fd);
157
+ fs.closeSync(safeAvatar.fd);
158
158
  }
159
159
  }
160
160
  function respondNotFound(res) {
@@ -316,7 +316,7 @@ function handleControlUiHttpRequest(req, res, opts) {
316
316
  }
317
317
  const rootReal = (() => {
318
318
  try {
319
- return syncFs.realpathSync(root);
319
+ return fs.realpathSync(root);
320
320
  } catch (error) {
321
321
  if (isExpectedSafePathError(error)) {
322
322
  return null;
@@ -362,13 +362,13 @@ function handleControlUiHttpRequest(req, res, opts) {
362
362
  return true;
363
363
  }
364
364
  if (path.basename(safeFile.path) === "index.html") {
365
- serveResolvedIndexHtml(res, syncFs.readFileSync(safeFile.fd, "utf8"));
365
+ serveResolvedIndexHtml(res, fs.readFileSync(safeFile.fd, "utf8"));
366
366
  return true;
367
367
  }
368
- serveResolvedFile(res, safeFile.path, syncFs.readFileSync(safeFile.fd));
368
+ serveResolvedFile(res, safeFile.path, fs.readFileSync(safeFile.fd));
369
369
  return true;
370
370
  } finally {
371
- syncFs.closeSync(safeFile.fd);
371
+ fs.closeSync(safeFile.fd);
372
372
  }
373
373
  }
374
374
  if (STATIC_ASSET_EXTENSIONS.has(path.extname(fileRel).toLowerCase())) {
@@ -385,10 +385,10 @@ function handleControlUiHttpRequest(req, res, opts) {
385
385
  res.end();
386
386
  return true;
387
387
  }
388
- serveResolvedIndexHtml(res, syncFs.readFileSync(safeIndex.fd, "utf8"));
388
+ serveResolvedIndexHtml(res, fs.readFileSync(safeIndex.fd, "utf8"));
389
389
  return true;
390
390
  } finally {
391
- syncFs.closeSync(safeIndex.fd);
391
+ fs.closeSync(safeIndex.fd);
392
392
  }
393
393
  }
394
394
  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 syncFs from "node:fs";
4
+ import fs 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 = syncFs.realpathSync.native;
305
- return nativeRealpath ? nativeRealpath(candidate) : syncFs.realpathSync(candidate);
304
+ const nativeRealpath = fs.realpathSync.native;
305
+ return nativeRealpath ? nativeRealpath(candidate) : fs.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 (syncFs.existsSync(current)) {
313
+ if (fs.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 syncFs from "node:fs";
3
+ import fs 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 ?? syncFs.statSync;
23
+ const statSync = opts.statSync ?? fs.statSync;
24
24
  const isFile = (candidate) => {
25
25
  try {
26
26
  return statSync(candidate).isFile();
@@ -50,7 +50,7 @@ import { handleOpenAiHttpRequest } from "./openai-http.js";
50
50
  import { canonicalizePathVariant } from "./security-path.js";
51
51
  import { handleToolsInvokeHttpRequest } from "./tools-invoke-http.js";
52
52
  import { authorizeGatewayConnect, isLocalDirectRequest } from "./auth.js";
53
- import syncFs from "node:fs";
53
+ import fs from "node:fs";
54
54
  import path from "node:path";
55
55
  import { createServer } from "node:http";
56
56
  import { createServer as createServer$1 } from "node:https";
@@ -2101,7 +2101,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2101
2101
  const sourcePath = path.join(resolveStateDir(env), "federation", "access-token.json");
2102
2102
  const managed = (env.FASED_GATEWAY_MODE ?? "").trim().toLowerCase() === "managed";
2103
2103
  const configured = resolveConfiguredFederationStatus(env);
2104
- if (!syncFs.existsSync(sourcePath)) {
2104
+ if (!fs.existsSync(sourcePath)) {
2105
2105
  return {
2106
2106
  managed,
2107
2107
  sourcePath,
@@ -2113,7 +2113,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2113
2113
  }
2114
2114
  let rawText = "";
2115
2115
  try {
2116
- rawText = syncFs.readFileSync(sourcePath, "utf-8");
2116
+ rawText = fs.readFileSync(sourcePath, "utf-8");
2117
2117
  } catch {
2118
2118
  return {
2119
2119
  managed,
@@ -2162,7 +2162,7 @@ async function readLocalFederationStatus(env = process.env, fetchImpl = fetch) {
2162
2162
  const lifecycle = Number.isFinite(expiresAtMs) ? expiresAtMs > Date.now() ? "active" : "expired" : "invalid";
2163
2163
  let fileUpdatedAt;
2164
2164
  try {
2165
- fileUpdatedAt = syncFs.statSync(sourcePath).mtime.toISOString();
2165
+ fileUpdatedAt = fs.statSync(sourcePath).mtime.toISOString();
2166
2166
  } catch {
2167
2167
  fileUpdatedAt = undefined;
2168
2168
  }
@@ -29,7 +29,7 @@ import { parseMessageWithAttachments } from "../chat-attachments.js";
29
29
  import { injectTimestamp, timestampOptsFromConfig } from "./agent-timestamp.js";
30
30
  import { normalizeRpcAttachmentsToChatAttachments } from "./attachment-normalize.js";
31
31
  import { appendInjectedAssistantMessageToTranscript } from "./chat-transcript-inject.js";
32
- import syncFs from "node:fs";
32
+ import fs from "node:fs";
33
33
  import path from "node:path";
34
34
  import { CURRENT_SESSION_VERSION } from "@mariozechner/pi-coding-agent";
35
35
 
@@ -320,11 +320,11 @@ function resolveTranscriptPath(params) {
320
320
  }
321
321
  }
322
322
  function ensureTranscriptFile(params) {
323
- if (syncFs.existsSync(params.transcriptPath)) {
323
+ if (fs.existsSync(params.transcriptPath)) {
324
324
  return { ok: true };
325
325
  }
326
326
  try {
327
- syncFs.mkdirSync(path.dirname(params.transcriptPath), { recursive: true });
327
+ fs.mkdirSync(path.dirname(params.transcriptPath), { recursive: true });
328
328
  const header = {
329
329
  type: "session",
330
330
  version: CURRENT_SESSION_VERSION,
@@ -332,7 +332,7 @@ function ensureTranscriptFile(params) {
332
332
  timestamp: new Date().toISOString(),
333
333
  cwd: process.cwd()
334
334
  };
335
- syncFs.writeFileSync(params.transcriptPath, `${JSON.stringify(header)}\n`, {
335
+ fs.writeFileSync(params.transcriptPath, `${JSON.stringify(header)}\n`, {
336
336
  encoding: "utf-8",
337
337
  mode: 384
338
338
  });
@@ -346,7 +346,7 @@ function ensureTranscriptFile(params) {
346
346
  }
347
347
  function transcriptHasIdempotencyKey(transcriptPath, idempotencyKey) {
348
348
  try {
349
- const lines = syncFs.readFileSync(transcriptPath, "utf-8").split(/\r?\n/);
349
+ const lines = fs.readFileSync(transcriptPath, "utf-8").split(/\r?\n/);
350
350
  for (const line of lines) {
351
351
  if (!line.trim()) {
352
352
  continue;
@@ -374,7 +374,7 @@ function appendAssistantTranscriptMessage(params) {
374
374
  error: "transcript path not resolved"
375
375
  };
376
376
  }
377
- if (!syncFs.existsSync(transcriptPath)) {
377
+ if (!fs.existsSync(transcriptPath)) {
378
378
  if (!params.createIfMissing) {
379
379
  return {
380
380
  ok: false,