bazilion 0.23.0 → 0.24.0

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 (95) hide show
  1. package/README.md +18 -7
  2. package/dist/cli-main.js +30 -13
  3. package/dist/cli-main.js.map +1 -1
  4. package/dist/daemon-main.js +325 -113
  5. package/dist/daemon-main.js.map +1 -1
  6. package/dist/web/client/assets/{AgentTabs-ZozvE4RV.js → AgentTabs-0mMqUuts.js} +1 -1
  7. package/dist/web/client/assets/{ChatPane-nv9xOKnM.js → ChatPane-C4ZAMSqQ.js} +2 -2
  8. package/dist/web/client/assets/{ConfigPage-D_3AsSG4.js → ConfigPage-CbALCsl0.js} +1 -1
  9. package/dist/web/client/assets/{ConfirmDialog-CH2zTXuo.js → ConfirmDialog-CB1a-szq.js} +1 -1
  10. package/dist/web/client/assets/{FieldRow-CcrDV3An.js → FieldRow-BHGq10hz.js} +1 -1
  11. package/dist/web/client/assets/{ProductionTeamPolicyEditor-DNJsrcW8.js → ProductionTeamPolicyEditor-B4Ysob7y.js} +1 -1
  12. package/dist/web/client/assets/{ProfileCommunicationEditor-B2SthMNH.js → ProfileCommunicationEditor-Bi1SwX0T.js} +1 -1
  13. package/dist/web/client/assets/{RecoveryState-DlaJiGZs.js → RecoveryState-CDWhoT3x.js} +1 -1
  14. package/dist/web/client/assets/{ResultCard-CF7a0iFy.js → ResultCard-Crmt8j95.js} +1 -1
  15. package/dist/web/client/assets/{ResultSourceConversation-X5SuheW6.js → ResultSourceConversation-CqwZKlKb.js} +1 -1
  16. package/dist/web/client/assets/{SectionTabs-CCHDsNpe.js → SectionTabs-mghnc98b.js} +1 -1
  17. package/dist/web/client/assets/{TeamTabs-BplbR2LB.js → TeamTabs-BuZ3DvCw.js} +1 -1
  18. package/dist/web/client/assets/{TemplatesTabs-DsnlhO7j.js → TemplatesTabs-D71oTTXM.js} +1 -1
  19. package/dist/web/client/assets/{UnsavedChangesGuard-BFGfvKOY.js → UnsavedChangesGuard-CiCtGDIH.js} +1 -1
  20. package/dist/web/client/assets/{_id-CHE9wjEm.js → _id-B-8ssJLW.js} +1 -1
  21. package/dist/web/client/assets/{_id-HgkOZjnh.js → _id-BVY0iUYM.js} +1 -1
  22. package/dist/web/client/assets/{_id-I4COPqTO.js → _id-C7A_A3eM.js} +1 -1
  23. package/dist/web/client/assets/{_id-W8yP8QHB.js → _id-CQlUNjzV.js} +1 -1
  24. package/dist/web/client/assets/{_id-CM4HcwqG.js → _id-CeALz6bj.js} +1 -1
  25. package/dist/web/client/assets/{_id-fxbpjlEa.js → _id-DQqcn57I.js} +1 -1
  26. package/dist/web/client/assets/{_id-eKsjDym9.js → _id-DRiwwqZL.js} +1 -1
  27. package/dist/web/client/assets/{_id-C75PSTfh.js → _id-DaqX-WEB.js} +1 -1
  28. package/dist/web/client/assets/{activity-BCYUctkB.js → activity-C5aaqPEN.js} +1 -1
  29. package/dist/web/client/assets/{activity-jvvmbNos.js → activity-D4Nt8GQM.js} +1 -1
  30. package/dist/web/client/assets/{agents-C6mJyZUx.js → agents-BPLszpKx.js} +1 -1
  31. package/dist/web/client/assets/{agents-CpusMfSn.js → agents-BUqq1VBQ.js} +1 -1
  32. package/dist/web/client/assets/{agents-CvLzI7m_.js → agents-DFOLPsgX.js} +1 -1
  33. package/dist/web/client/assets/{approvals-Cd2np6JM.js → approvals-8PPXdZxV.js} +1 -1
  34. package/dist/web/client/assets/{approvals-C2R4qUbS.js → approvals-MVCITL8Q.js} +1 -1
  35. package/dist/web/client/assets/{attention-Q_sRUULz.js → attention-DiyHVOcZ.js} +1 -1
  36. package/dist/web/client/assets/{attention-CFwT25yC.js → attention-e273gZ8d.js} +1 -1
  37. package/dist/web/client/assets/chevron-right-DgJy0QeF.js +1 -0
  38. package/dist/web/client/assets/{config-B7UhhXW6.js → config-Dm6OgnLh.js} +3 -3
  39. package/dist/web/client/assets/{context-Cjb1-4nB.js → context-DhgSlMk5.js} +1 -1
  40. package/dist/web/client/assets/{inbox-QoBXXR8s.js → inbox-B3To3KpL.js} +1 -1
  41. package/dist/web/client/assets/{inbox-CX0alCy_.js → inbox-C1_vHPb8.js} +1 -1
  42. package/dist/web/client/assets/{index-Du-fy_6d.js → index-DtEE9JX2.js} +2 -2
  43. package/dist/web/client/assets/{learning-C1n4NTM1.js → learning-B7wX_mkT.js} +1 -1
  44. package/dist/web/client/assets/{learning-VwXsV_lU.js → learning-DDwUAKmq.js} +1 -1
  45. package/dist/web/client/assets/{login-CqnOW-JM.js → login-CWaSGdgc.js} +1 -1
  46. package/dist/web/client/assets/{mcp-B02-ofb9.js → mcp-CO5iBKHD.js} +1 -1
  47. package/dist/web/client/assets/{mcp-DMpVmmfU.js → mcp-DO8sSn5c.js} +1 -1
  48. package/dist/web/client/assets/{members-va8WzU_O.js → members-Bd3z1Mbb.js} +1 -1
  49. package/dist/web/client/assets/{members-CEkRCNto.js → members-Dx9OcdY1.js} +1 -1
  50. package/dist/web/client/assets/{memory-DiGxdDEp.js → memory-BIZi6bBM.js} +1 -1
  51. package/dist/web/client/assets/{memory-DejWBeGz.js → memory-DrYbH0we.js} +1 -1
  52. package/dist/web/client/assets/{policy-DgIcquCb.js → policy-CcnTn0qG.js} +1 -1
  53. package/dist/web/client/assets/{policy-CEiX5AXJ.js → policy-Dsj-SWqE.js} +1 -1
  54. package/dist/web/client/assets/{results-DsK9IvTu.js → results-GeOLM5Cw.js} +1 -1
  55. package/dist/web/client/assets/{results-BBBBjgd1.js → results-t7jAchgU.js} +1 -1
  56. package/dist/web/client/assets/{review-X2RHaLwW.js → review-CQaZNlyx.js} +1 -1
  57. package/dist/web/client/assets/{review-BGbU_GAW.js → review-CYvx-3K2.js} +1 -1
  58. package/dist/web/client/assets/{routes-CNz-oflx.js → routes-DoK4DMdi.js} +1 -1
  59. package/dist/web/client/assets/{services-dcsfVgOY.js → services-BI7iyTHh.js} +1 -1
  60. package/dist/web/client/assets/{services-D7TEP2JX.js → services-c9HkxKEP.js} +1 -1
  61. package/dist/web/client/assets/{skills-CnI7SkP2.js → skills-B0O0zwg1.js} +1 -1
  62. package/dist/web/client/assets/{skills-NDtAsHyl.js → skills-Ddf5PBNn.js} +1 -1
  63. package/dist/web/client/assets/{styles-CjCML-UX.css → styles-e_ADuRbs.css} +1 -1
  64. package/dist/web/client/assets/{teams-DPgdJBly.js → teams-BDbkurIa.js} +1 -1
  65. package/dist/web/client/assets/{teams-DErd3Weq.js → teams-BNQ4z_k3.js} +1 -1
  66. package/dist/web/client/assets/{teams-DETtQypB.js → teams-Wvr8-LhE.js} +1 -1
  67. package/dist/web/client/assets/{teams-Dyll0JrQ.js → teams-kRB5hV3h.js} +1 -1
  68. package/dist/web/client/assets/{telegram-CAGu-kLc.js → telegram-Dx9tzt9d.js} +1 -1
  69. package/dist/web/client/assets/{templates-CgOQU6RS.js → templates-CGQ93r-m.js} +1 -1
  70. package/dist/web/client/assets/{tokens-BYVE1y6V.js → tokens-CsOJULk9.js} +1 -1
  71. package/dist/web/client/assets/{tokens-CvjME9aI.js → tokens-zqJy3CQD.js} +1 -1
  72. package/dist/web/client/assets/{triggers-Dmli752j.js → triggers-9UUKTR6l.js} +1 -1
  73. package/dist/web/client/assets/{triggers-BeZ7olEG.js → triggers-BiXb1VFy.js} +1 -1
  74. package/dist/web/client/assets/{verifications-CnLEVFoZ.js → verifications-BKoHhRqF.js} +1 -1
  75. package/dist/web/client/assets/{verifications-qQz5-X-o.js → verifications-CElk4UQp.js} +1 -1
  76. package/dist/web/client/assets/{welcome-BF3pg5U5.js → welcome-BdcpBETx.js} +1 -1
  77. package/dist/web/client/assets/{x-B-Fk6DuU.js → x-DtPVZP1O.js} +1 -1
  78. package/dist/web/server/assets/{ChatPane-DsDa1E0a.js → ChatPane-3CIVTz7o.js} +1 -0
  79. package/dist/web/server/assets/{ResultSourceConversation-NKiRGO6_.js → ResultSourceConversation-DwuGuTa-.js} +1 -1
  80. package/dist/web/server/assets/{_id-CrOJD02W.js → _id-C1-ygfez.js} +3 -3
  81. package/dist/web/server/assets/{_id-C1TCGcHL.js → _id-CWlZT9kI.js} +1 -1
  82. package/dist/web/server/assets/{_tanstack-start-manifest_v-CPSd5WEy.js → _tanstack-start-manifest_v-LR-ldomm.js} +134 -134
  83. package/dist/web/server/assets/{config-DX3c4Co0.js → config-CMxeC2Bd.js} +94 -2
  84. package/dist/web/server/assets/{config-DM2DIzMT.js → config-CbioK6nX.js} +1 -1
  85. package/dist/web/server/assets/{config-DTI4EPbU.js → config-CpHD812q.js} +6 -1
  86. package/dist/web/server/assets/{results-BYU6Bfzt.js → results-C6edENBF.js} +2 -2
  87. package/dist/web/server/assets/{results-Cr1B3XoP.js → results-DjTerNLY.js} +1 -1
  88. package/dist/web/server/assets/{router-B2R22qdF.js → router-Doy5hj6V.js} +5 -5
  89. package/dist/web/server/assets/{routes-BGMHt0b0.js → routes-ByEYvEFv.js} +2 -2
  90. package/dist/web/server/assets/{routes-kSjMHwrg.js → routes-Bz-Gprcp.js} +1 -1
  91. package/dist/web/server/server.js +3 -3
  92. package/dist/worker.js +157 -43
  93. package/dist/worker.js.map +1 -1
  94. package/package.json +8 -7
  95. package/dist/web/client/assets/chevron-right-BfSr7R_L.js +0 -1
@@ -5,10 +5,10 @@ import { n as Button } from "./utils-ySbqTi3g.js";
5
5
  import { r as PageShell } from "./Page-DJNoI4Gn.js";
6
6
  import { i as BaziuLogo, n as ThemeToggle, r as PawIcon, t as Route$5 } from "./login-rDox7PRD.js";
7
7
  import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
8
- import { t as Route$6 } from "./routes-kSjMHwrg.js";
8
+ import { t as Route$6 } from "./routes-Bz-Gprcp.js";
9
9
  import { t as Route$7 } from "./teams-DuhXk1M5.js";
10
10
  import { t as Route$8 } from "./skills-D1oy3JAH.js";
11
- import { t as Route$9 } from "./config-DM2DIzMT.js";
11
+ import { t as Route$9 } from "./config-CbioK6nX.js";
12
12
  import { t as Route$10 } from "./attention-Cy3Xu-Su.js";
13
13
  import { t as Route$11 } from "./approvals-CpDs6ASO.js";
14
14
  import { t as Route$12 } from "./agents-DmmuOHw8.js";
@@ -19,10 +19,10 @@ import { t as Route$16 } from "./mcp-CLWr5_0I.js";
19
19
  import { t as Route$17 } from "./teams-BW2ARIvk.js";
20
20
  import { t as Route$18 } from "./agents-BitDk_C5.js";
21
21
  import { t as Route$19 } from "./_id-BS4MnPa3.js";
22
- import { t as Route$20 } from "./_id-C1TCGcHL.js";
22
+ import { t as Route$20 } from "./_id-CWlZT9kI.js";
23
23
  import { t as Route$21 } from "./verifications-EIw3Xh61.js";
24
24
  import { t as Route$22 } from "./review-Bs6AbrSn.js";
25
- import { t as Route$23 } from "./results-Cr1B3XoP.js";
25
+ import { t as Route$23 } from "./results-DjTerNLY.js";
26
26
  import { t as Route$24 } from "./policy-DDi8AjcD.js";
27
27
  import { t as Route$25 } from "./memory-Bq0s1fr7.js";
28
28
  import { t as Route$26 } from "./members-Cjpysp35.js";
@@ -401,7 +401,7 @@ function installCsrfFetch() {
401
401
  }
402
402
  //#endregion
403
403
  //#region src/styles.css?url
404
- var styles_default = "/assets/styles-CjCML-UX.css";
404
+ var styles_default = "/assets/styles-e_ADuRbs.css";
405
405
  //#endregion
406
406
  //#region src/routes/__root.tsx
407
407
  var THEME_INIT_SCRIPT = `(function(){try{var t=localStorage.getItem('baziu-theme');var sd=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;var d=t==='dark'||((t===null||t==='system')&&sd);document.documentElement.classList.toggle('dark',d);}catch(e){}})();`;
@@ -1,5 +1,5 @@
1
- import { t as Route } from "./routes-kSjMHwrg.js";
2
- import { t as ChatPane } from "./ChatPane-DsDa1E0a.js";
1
+ import { t as Route } from "./routes-Bz-Gprcp.js";
2
+ import { t as ChatPane } from "./ChatPane-3CIVTz7o.js";
3
3
  import { n as Sidebar } from "./Sidebar-Dk9bErQV.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/routes/index.tsx?tsr-split=component
@@ -2,7 +2,7 @@ import { n as createServerFn } from "../server.js";
2
2
  import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
3
3
  import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
4
  //#region src/routes/index.tsx
5
- var $$splitComponentImporter = () => import("./routes-BGMHt0b0.js");
5
+ var $$splitComponentImporter = () => import("./routes-ByEYvEFv.js");
6
6
  var fetchHomeData = createServerFn({ method: "POST" }).validator((d) => d).handler(createSsrRpc("26dbbcbe40063e8aedfd343cf1dfd4dfe5589f24591c0ba35e80c611d7c57c7c"));
7
7
  var Route = createFileRoute("/")({
8
8
  validateSearch: (s) => ({ agent: typeof s.agent === "string" ? s.agent : void 0 }),
@@ -3558,7 +3558,7 @@ var defaultSerovalPlugins = [
3558
3558
  * the dev styles URL for route-scoped CSS collection.
3559
3559
  */
3560
3560
  async function getStartManifest(matchedRoutes) {
3561
- const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-CPSd5WEy.js");
3561
+ const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-LR-ldomm.js");
3562
3562
  const startManifest = tsrStartManifest();
3563
3563
  let routes = startManifest.routes;
3564
3564
  routes[rootRouteId];
@@ -3746,7 +3746,7 @@ var manifest = {
3746
3746
  },
3747
3747
  "b18a227687dba45b99ea5a2ac7a5bf8efcd9bc54387bc279cd87510fd2f83f7e": {
3748
3748
  functionName: "fetchProvidersData_createServerFn_handler",
3749
- importer: () => import("./assets/config-DTI4EPbU.js")
3749
+ importer: () => import("./assets/config-CpHD812q.js")
3750
3750
  },
3751
3751
  "b1a0d8cd1d1c772c68f94d2a759efea18e7504626cb572fb90e6ebced65035e2": {
3752
3752
  functionName: "fetchReviewPacket_createServerFn_handler",
@@ -5672,7 +5672,7 @@ var getBaseManifest = getProdBaseManifest;
5672
5672
  var createEarlyHintsForRequest = createEarlyHintsCollector;
5673
5673
  async function loadEntries() {
5674
5674
  const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
5675
- import("./assets/router-B2R22qdF.js"),
5675
+ import("./assets/router-Doy5hj6V.js"),
5676
5676
  import("./assets/start-D4Wq9iTa.js"),
5677
5677
  import("./assets/empty-plugin-adapters-Cq4--YW-.js")
5678
5678
  ]);
package/dist/worker.js CHANGED
@@ -1102,8 +1102,8 @@ function ensureSafeParentDirectories(root, path) {
1102
1102
  assertContained(root, parent);
1103
1103
  const rel = relative(root, parent);
1104
1104
  let current = root;
1105
- for (const component of rel.split(sep2).filter(Boolean)) {
1106
- current = join12(current, component);
1105
+ for (const component2 of rel.split(sep2).filter(Boolean)) {
1106
+ current = join12(current, component2);
1107
1107
  let info = lstatIfPresent(current);
1108
1108
  if (!info) {
1109
1109
  mkdirSync4(current);
@@ -1757,10 +1757,15 @@ import {
1757
1757
  lstatSync as lstatSync3,
1758
1758
  opendirSync,
1759
1759
  openSync as openSync3,
1760
- readSync as readSync2,
1761
1760
  realpathSync as realpathSync4
1762
1761
  } from "fs";
1763
1762
  import { isAbsolute as isAbsolute2, join as join14 } from "path";
1763
+ import {
1764
+ assertDirectoryIdentitySync,
1765
+ openRootFileSync,
1766
+ readFileDescriptorBoundedSync
1767
+ } from "@openclaw/fs-safe/advanced";
1768
+ import { FsSafeError } from "@openclaw/fs-safe/errors";
1764
1769
  var hash = (value) => createHash7("sha256").update(value).digest("hex");
1765
1770
  var ContextReadError = class extends Error {
1766
1771
  code;
@@ -1773,7 +1778,7 @@ function identity(stat2) {
1773
1778
  return `${stat2.dev}:${stat2.ino}`;
1774
1779
  }
1775
1780
  function stamp(stat2) {
1776
- return `${identity(stat2)}:${stat2.size}:${stat2.mtimeMs}:${stat2.ctimeMs}`;
1781
+ return `${identity(stat2)}:${stat2.size}:${stat2.mtimeNs}:${stat2.ctimeNs}`;
1777
1782
  }
1778
1783
  function relativeParts(target) {
1779
1784
  if (target.length > 4096 || isAbsolute2(target) || [...target].some(
@@ -1784,31 +1789,93 @@ function relativeParts(target) {
1784
1789
  if (parts.length > 17) throw new ContextReadError("depth_limit");
1785
1790
  return parts;
1786
1791
  }
1792
+ function component(name) {
1793
+ if (!name || name === "." || name === ".." || /[/\\\0]/.test(name))
1794
+ throw new ContextReadError("unsafe_target");
1795
+ }
1787
1796
  var ContextDirectory = class _ContextDirectory {
1788
1797
  fd;
1789
1798
  identity;
1790
- originalStamp;
1791
- children = [];
1792
- listing;
1793
- observedFiles = /* @__PURE__ */ new Map();
1794
1799
  registeredPath;
1795
1800
  label;
1796
1801
  parent;
1802
+ platform;
1803
+ canonicalPath;
1804
+ originalIdentity;
1805
+ children = [];
1806
+ listing;
1807
+ observedFiles = /* @__PURE__ */ new Map();
1808
+ closed = false;
1797
1809
  constructor(registeredPath, label = ".", parent) {
1810
+ const platform = parent?.platform ?? process.platform;
1811
+ if (platform !== "linux" && platform !== "darwin")
1812
+ throw new ContextReadError("safe_reads_unavailable");
1813
+ this.platform = platform;
1798
1814
  this.registeredPath = registeredPath;
1799
1815
  this.label = label;
1800
1816
  this.parent = parent;
1801
- if (process.platform !== "linux") throw new ContextReadError("safe_reads_unavailable");
1802
- const path = parent ? join14(parent.path, registeredPath) : realpathSync4(registeredPath);
1803
- this.fd = openSync3(path, constants3.O_RDONLY | constants3.O_DIRECTORY | constants3.O_NOFOLLOW);
1804
- const stat2 = fstatSync3(this.fd);
1805
- this.identity = hash(identity(stat2));
1806
- this.originalStamp = identity(stat2);
1817
+ if (parent) component(registeredPath);
1818
+ parent?.assertCurrent();
1819
+ const canonicalPath = parent ? join14(parent.canonicalPath, registeredPath) : realpathSync4(registeredPath);
1820
+ let fd;
1821
+ try {
1822
+ if (platform === "linux") {
1823
+ this.canonicalPath = canonicalPath;
1824
+ fd = openSync3(
1825
+ parent ? join14(parent.path, registeredPath) : canonicalPath,
1826
+ constants3.O_RDONLY | constants3.O_DIRECTORY | constants3.O_NOFOLLOW
1827
+ );
1828
+ } else {
1829
+ const opened = openRootFileSync({
1830
+ rootPath: parent?.canonicalPath ?? canonicalPath,
1831
+ absolutePath: canonicalPath,
1832
+ boundaryLabel: "registered repository",
1833
+ allowedType: "directory",
1834
+ symlinks: "reject"
1835
+ });
1836
+ if (!opened.ok) throw new ContextReadError("root_changed");
1837
+ this.canonicalPath = opened.path;
1838
+ fd = opened.fd;
1839
+ }
1840
+ const stat2 = fstatSync3(fd, { bigint: true });
1841
+ if (!stat2.isDirectory() || stat2.ino <= 0n) throw new ContextReadError("root_changed");
1842
+ this.fd = fd;
1843
+ this.originalIdentity = { dev: stat2.dev, ino: stat2.ino };
1844
+ this.identity = hash(identity(stat2));
1845
+ if (platform === "darwin") this.assertCurrent();
1846
+ fd = void 0;
1847
+ } finally {
1848
+ if (fd !== void 0) closeSync3(fd);
1849
+ }
1807
1850
  }
1808
1851
  get path() {
1809
- return `/proc/self/fd/${this.fd}`;
1852
+ return this.platform === "linux" ? `/proc/self/fd/${this.fd}` : this.canonicalPath;
1853
+ }
1854
+ /** Only the existing Linux backend admits a descriptor-pinned external Git worktree. */
1855
+ get gitWorktreePath() {
1856
+ return this.platform === "linux" ? `/proc/${process.pid}/fd/${this.fd}` : null;
1857
+ }
1858
+ assertCurrent() {
1859
+ if (this.closed) throw new ContextReadError("unreadable");
1860
+ if (this.platform === "linux") return;
1861
+ this.parent?.assertCurrent();
1862
+ try {
1863
+ const registered = this.parent ? join14(this.parent.canonicalPath, this.registeredPath) : realpathSync4(this.registeredPath);
1864
+ if (!this.parent && registered !== this.canonicalPath)
1865
+ throw new ContextReadError("root_changed");
1866
+ assertDirectoryIdentitySync(registered, {
1867
+ ...this.originalIdentity,
1868
+ realPath: this.canonicalPath
1869
+ });
1870
+ const retained = fstatSync3(this.fd, { bigint: true });
1871
+ if (!retained.isDirectory() || identity(retained) !== identity(this.originalIdentity))
1872
+ throw new ContextReadError("root_changed");
1873
+ } catch {
1874
+ throw new ContextReadError("root_changed");
1875
+ }
1810
1876
  }
1811
1877
  directory(name) {
1878
+ component(name);
1812
1879
  const child = new _ContextDirectory(
1813
1880
  name,
1814
1881
  this.label === "." ? name : `${this.label}/${name}`,
@@ -1818,10 +1885,29 @@ var ContextDirectory = class _ContextDirectory {
1818
1885
  return child;
1819
1886
  }
1820
1887
  entry(name) {
1888
+ component(name);
1889
+ this.assertCurrent();
1821
1890
  try {
1822
- return lstatSync3(join14(this.path, name));
1891
+ const stat2 = lstatSync3(join14(this.path, name));
1892
+ this.assertCurrent();
1893
+ return stat2;
1823
1894
  } catch (error) {
1895
+ this.assertCurrent();
1824
1896
  if (error.code === "ENOENT") return null;
1897
+ if (error instanceof ContextReadError) throw error;
1898
+ throw new ContextReadError("unreadable");
1899
+ }
1900
+ }
1901
+ observe(name) {
1902
+ this.assertCurrent();
1903
+ try {
1904
+ const stat2 = lstatSync3(join14(this.path, name), { bigint: true });
1905
+ this.assertCurrent();
1906
+ return stat2;
1907
+ } catch (error) {
1908
+ this.assertCurrent();
1909
+ if (error.code === "ENOENT") return null;
1910
+ if (error instanceof ContextReadError) throw error;
1825
1911
  throw new ContextReadError("unreadable");
1826
1912
  }
1827
1913
  }
@@ -1831,6 +1917,7 @@ var ContextDirectory = class _ContextDirectory {
1831
1917
  return names;
1832
1918
  }
1833
1919
  listNames() {
1920
+ this.assertCurrent();
1834
1921
  const handle = opendirSync(this.path);
1835
1922
  const names = [];
1836
1923
  try {
@@ -1840,58 +1927,71 @@ var ContextDirectory = class _ContextDirectory {
1840
1927
  names.push(entry.name);
1841
1928
  entry = handle.readSync();
1842
1929
  }
1930
+ this.assertCurrent();
1843
1931
  return names.sort();
1844
1932
  } finally {
1845
1933
  handle.closeSync();
1846
1934
  }
1847
1935
  }
1848
1936
  read(name, maxBytes) {
1849
- const entry = this.entry(name);
1937
+ component(name);
1938
+ const entry = this.observe(name);
1850
1939
  if (!entry) {
1851
1940
  this.observedFiles.set(name, null);
1852
1941
  return null;
1853
1942
  }
1854
1943
  if (!entry.isFile() || entry.isSymbolicLink()) throw new ContextReadError("unsafe_file");
1944
+ if (entry.ino <= 0n) throw new ContextReadError("unreadable");
1855
1945
  if (entry.size > maxBytes) throw new ContextReadError("byte_limit");
1856
1946
  let fd;
1857
1947
  try {
1858
- fd = openSync3(
1859
- join14(this.path, name),
1860
- constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK
1861
- );
1862
- const before = fstatSync3(fd);
1948
+ if (this.platform === "linux") {
1949
+ fd = openSync3(
1950
+ join14(this.path, name),
1951
+ constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK
1952
+ );
1953
+ } else {
1954
+ this.assertCurrent();
1955
+ const opened = openRootFileSync({
1956
+ rootPath: this.canonicalPath,
1957
+ absolutePath: join14(this.canonicalPath, name),
1958
+ boundaryLabel: "captured repository directory",
1959
+ symlinks: "reject",
1960
+ maxBytes
1961
+ });
1962
+ if (!opened.ok) throw new ContextReadError("source_changed");
1963
+ fd = opened.fd;
1964
+ this.assertCurrent();
1965
+ }
1966
+ const before = fstatSync3(fd, { bigint: true });
1863
1967
  if (!before.isFile() || stamp(entry) !== stamp(before))
1864
1968
  throw new ContextReadError("source_changed");
1865
- const buffer = Buffer.alloc(Math.min(maxBytes + 1, before.size + 1));
1866
- let size = 0;
1867
- while (size < buffer.length) {
1868
- const count2 = readSync2(fd, buffer, size, buffer.length - size, null);
1869
- if (!count2) break;
1870
- size += count2;
1871
- }
1872
- if (size > maxBytes || size !== before.size || stamp(fstatSync3(fd)) !== stamp(before)) {
1969
+ const buffer = readFileDescriptorBoundedSync(fd, maxBytes);
1970
+ if (BigInt(buffer.length) !== before.size || stamp(fstatSync3(fd, { bigint: true })) !== stamp(before))
1873
1971
  throw new ContextReadError("source_changed");
1874
- }
1972
+ this.assertCurrent();
1875
1973
  this.observedFiles.set(name, stamp(before));
1876
- return buffer.subarray(0, size);
1974
+ return buffer;
1877
1975
  } catch (error) {
1878
1976
  if (error instanceof ContextReadError) throw error;
1977
+ if (error instanceof FsSafeError && error.code === "too-large")
1978
+ throw new ContextReadError("source_changed");
1879
1979
  throw new ContextReadError("unreadable");
1880
1980
  } finally {
1881
1981
  if (fd !== void 0) closeSync3(fd);
1882
1982
  }
1883
1983
  }
1884
1984
  validate(skipGit = false, names) {
1985
+ this.assertCurrent();
1885
1986
  const currentPath = this.parent ? join14(this.parent.path, this.registeredPath) : realpathSync4(this.registeredPath);
1886
- const stat2 = lstatSync3(currentPath);
1887
- if (!stat2.isDirectory() || identity(stat2) !== this.originalStamp)
1987
+ const stat2 = lstatSync3(currentPath, { bigint: true });
1988
+ if (!stat2.isDirectory() || identity(stat2) !== identity(this.originalIdentity))
1888
1989
  throw new ContextReadError("root_changed");
1889
- if (this.listing !== void 0 && JSON.stringify(this.listNames()) !== this.listing) {
1990
+ if (this.listing !== void 0 && JSON.stringify(this.listNames()) !== this.listing)
1890
1991
  throw new ContextReadError("source_changed");
1891
- }
1892
1992
  for (const [name, previous] of this.observedFiles) {
1893
1993
  if (names && !names.has(name)) continue;
1894
- const current = this.entry(name);
1994
+ const current = this.observe(name);
1895
1995
  if ((current ? stamp(current) : null) !== previous)
1896
1996
  throw new ContextReadError("source_changed");
1897
1997
  }
@@ -1900,8 +2000,22 @@ var ContextDirectory = class _ContextDirectory {
1900
2000
  }
1901
2001
  }
1902
2002
  close() {
1903
- for (const child of this.children) child.close();
1904
- closeSync3(this.fd);
2003
+ if (this.closed) return;
2004
+ this.closed = true;
2005
+ let failure;
2006
+ for (const child of this.children) {
2007
+ try {
2008
+ child.close();
2009
+ } catch (error) {
2010
+ failure ??= error;
2011
+ }
2012
+ }
2013
+ try {
2014
+ closeSync3(this.fd);
2015
+ } catch (error) {
2016
+ failure ??= error;
2017
+ }
2018
+ if (failure) throw failure;
1905
2019
  }
1906
2020
  };
1907
2021
 
@@ -3578,7 +3692,7 @@ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
3578
3692
  import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3579
3693
  var PROVIDER_ALIASES = {
3580
3694
  bedrock: "amazon-bedrock",
3581
- "azure-openai": "azure-openai-responses"
3695
+ "azure-openai": "azure"
3582
3696
  };
3583
3697
  var PROTECTED_PROVIDER_NAMES = [
3584
3698
  "anthropic",
@@ -5222,7 +5336,7 @@ import {
5222
5336
  constants as constants7,
5223
5337
  fstatSync as fstatSync5,
5224
5338
  openSync as openSync6,
5225
- readSync as readSync3,
5339
+ readSync as readSync2,
5226
5340
  realpathSync as realpathSync9,
5227
5341
  statSync as statSync4
5228
5342
  } from "fs";
@@ -5325,7 +5439,7 @@ function deliverFileTool(cwd, sink, sessionId = "") {
5325
5439
  const buffer = Buffer.alloc(MAX_DELIVER_BYTES + 1);
5326
5440
  let length = 0;
5327
5441
  while (length < buffer.length) {
5328
- const count2 = readSync3(fd, buffer, length, buffer.length - length, null);
5442
+ const count2 = readSync2(fd, buffer, length, buffer.length - length, null);
5329
5443
  if (count2 === 0) break;
5330
5444
  length += count2;
5331
5445
  }
@@ -7572,7 +7686,7 @@ function installProtectedCredentialBoundary(session, providerName, activeTokens,
7572
7686
  };
7573
7687
  };
7574
7688
  session.agent.getApiKey = async (requestedProvider) => {
7575
- if (requestedProvider !== providerName) return void 0;
7689
+ if (requestedProvider !== piProviderName(providerName)) return void 0;
7576
7690
  try {
7577
7691
  const token = await refreshApiKey(providerName);
7578
7692
  if (token && !activeTokens.includes(token)) activeTokens.push(token);