@cydm/pie 1.0.19 → 1.0.20

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.
@@ -4657,6 +4657,31 @@ var FileSystemGateway = class {
4657
4657
  const fs = nodeRequire("fs");
4658
4658
  return fs.readFileSync(path, encoding);
4659
4659
  }
4660
+ /**
4661
+ * Read at most the first maxBytes of a file.
4662
+ */
4663
+ readFileHead(path, maxBytes, encoding = "utf-8") {
4664
+ this.validatePath(path, "read");
4665
+ const byteLimit = Math.max(0, Math.floor(maxBytes));
4666
+ if (byteLimit === 0) return "";
4667
+ const platform = detectPlatform();
4668
+ if (platform === "puerts" && typeof CS !== "undefined") {
4669
+ if (!CS.System.IO.File.Exists(path)) {
4670
+ throw new Error(`File not found: ${path}`);
4671
+ }
4672
+ return CS.System.IO.File.ReadAllText(path).slice(0, byteLimit);
4673
+ }
4674
+ const fs = nodeRequire("fs");
4675
+ const fileSize = fs.existsSync(path) ? fs.statSync(path).size : 0;
4676
+ const buffer = Buffer.alloc(Math.min(byteLimit, fileSize));
4677
+ const fd = fs.openSync(path, "r");
4678
+ try {
4679
+ const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0);
4680
+ return buffer.subarray(0, bytesRead).toString(encoding);
4681
+ } finally {
4682
+ fs.closeSync(fd);
4683
+ }
4684
+ }
4660
4685
  /**
4661
4686
  * Write file content
4662
4687
  */
@@ -4825,6 +4850,21 @@ var FileSystemGateway = class {
4825
4850
  if (!fs.existsSync(path)) return 0;
4826
4851
  return fs.statSync(path).size;
4827
4852
  }
4853
+ /**
4854
+ * Get file modified time in milliseconds since epoch.
4855
+ */
4856
+ getModifiedTime(path) {
4857
+ this.validatePath(path, "getModifiedTime");
4858
+ const platform = detectPlatform();
4859
+ if (platform === "puerts" && typeof CS !== "undefined") {
4860
+ if (!CS.System.IO.File.Exists(path)) return 0;
4861
+ const ticks = Number(CS.System.IO.File.GetLastWriteTimeUtc(path).Ticks);
4862
+ return Number.isFinite(ticks) ? ticks / 1e4 - 621355968e5 : 0;
4863
+ }
4864
+ const fs = nodeRequire("fs");
4865
+ if (!fs.existsSync(path)) return 0;
4866
+ return fs.statSync(path).mtimeMs;
4867
+ }
4828
4868
  /**
4829
4869
  * Get config
4830
4870
  */
@@ -8,10 +8,10 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-GZVSE44O.js";
11
+ } from "./chunk-NHR6EBM2.js";
12
12
  import {
13
13
  Type
14
- } from "./chunk-Q2N6B5JN.js";
14
+ } from "./chunk-VESPMEDG.js";
15
15
 
16
16
  // src/config.ts
17
17
  import { existsSync, mkdirSync, readFileSync, renameSync } from "fs";
@@ -978,6 +978,7 @@ export {
978
978
  getPackageDir,
979
979
  getThemesDir,
980
980
  getBuiltinDir,
981
+ VERSION,
981
982
  getConfigDir,
982
983
  getAgentDir,
983
984
  getCustomThemesDir,
@@ -3,8 +3,8 @@ import {
3
3
  Agent,
4
4
  agentLoop,
5
5
  agentLoopContinue
6
- } from "./chunk-2R3XTLE2.js";
7
- import "./chunk-Q2N6B5JN.js";
6
+ } from "./chunk-L5BJNCNG.js";
7
+ import "./chunk-VESPMEDG.js";
8
8
  import "./chunk-TG2EQLX2.js";
9
9
  export {
10
10
  Agent,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  EventStream
4
- } from "./chunk-Q2N6B5JN.js";
4
+ } from "./chunk-VESPMEDG.js";
5
5
  import "./chunk-TG2EQLX2.js";
6
6
 
7
7
  // src/app/test-stream.ts