@cydm/pie 2.7.18 → 2.7.19

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.
@@ -297,13 +297,15 @@ function resolveIpcConfig(configLayers) {
297
297
  invalidConfig = true;
298
298
  }
299
299
  if (invalidConfig || merged.enabled === false) return { config: null, problems };
300
- const config = { enabled: true };
300
+ const config = { enabled: true, allowPeers: ["*"], autoInject: true };
301
301
  if (typeof merged.displayName === "string" && merged.displayName.trim()) {
302
302
  config.displayName = merged.displayName.replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, 60);
303
303
  }
304
304
  if (Array.isArray(merged.allowPeers)) {
305
- const ids = merged.allowPeers.filter((id) => typeof id === "string" && (id === "*" || isValidInstanceId(id))).slice(0, 1e3);
306
- if (ids.length) config.allowPeers = ids;
305
+ config.allowPeers = merged.allowPeers.filter((id) => typeof id === "string" && (id === "*" || isValidInstanceId(id))).slice(0, 1e3);
306
+ } else if (merged.allowPeers !== void 0) {
307
+ config.allowPeers = [];
308
+ problems.push("pie-ipc: allowPeers must be an array");
307
309
  }
308
310
  if (merged.autoInject !== void 0) config.autoInject = merged.autoInject === true;
309
311
  if (typeof merged.maxBodyChars === "number" && Number.isFinite(merged.maxBodyChars)) {
@@ -1528,7 +1530,7 @@ var Runtime = class {
1528
1530
  this.config = config;
1529
1531
  this.discoveryDir = discoveryDir;
1530
1532
  this.displayName = config.displayName ?? peerLabel(this.instanceId);
1531
- this.allowPolicy = new AllowPolicy(config.allowPeers ? [...config.allowPeers] : []);
1533
+ this.allowPolicy = new AllowPolicy(config.allowPeers ? [...config.allowPeers] : ["*"]);
1532
1534
  this.projection = new StatusProjection({ getMessages: () => ctx.getMessages() });
1533
1535
  }
1534
1536
  ctx;
@@ -1975,17 +1977,28 @@ ${message.text}`).join("\n---\n");
1975
1977
  }
1976
1978
  };
1977
1979
  function loadConfig(ctx, configDir) {
1978
- const layers = [
1979
- { file: path4.join(configDir, "ipc.json"), content: safeRead(path4.join(configDir, "ipc.json")) },
1980
- { file: path4.join(ctx.cwd, ".pie", "ipc.json"), content: safeRead(path4.join(ctx.cwd, ".pie", "ipc.json")) }
1981
- ];
1982
- return resolveIpcConfig(layers);
1980
+ try {
1981
+ const layers = [
1982
+ { file: path4.join(configDir, "ipc.json"), content: safeRead(path4.join(configDir, "ipc.json")) },
1983
+ { file: path4.join(ctx.cwd, ".pie", "ipc.json"), content: safeRead(path4.join(ctx.cwd, ".pie", "ipc.json")) }
1984
+ ];
1985
+ return resolveIpcConfig(layers);
1986
+ } catch (error) {
1987
+ return { config: null, problems: [`configuration read failed: ${error instanceof Error ? error.message : String(error)}`] };
1988
+ }
1983
1989
  }
1984
1990
  function safeRead(file) {
1985
1991
  try {
1986
1992
  return fs3.readFileSync(file, "utf8");
1987
- } catch {
1988
- return void 0;
1993
+ } catch (error) {
1994
+ if (error.code === "ENOENT") {
1995
+ try {
1996
+ fs3.lstatSync(file);
1997
+ } catch (statError) {
1998
+ if (statError.code === "ENOENT") return void 0;
1999
+ }
2000
+ }
2001
+ throw error;
1989
2002
  }
1990
2003
  }
1991
2004
  function pieIpcExtension(ctx) {
@@ -2023,7 +2036,7 @@ function pieIpcExtension(ctx) {
2023
2036
  getMessages: () => ctx.getMessages(),
2024
2037
  log: (message) => ctx.log(message)
2025
2038
  },
2026
- { autoInject: config.autoInject ?? false, allowPolicy: runtime.allowPolicy, onConsumed: (id) => runtime.markConsumed(id) }
2039
+ { autoInject: config.autoInject ?? true, allowPolicy: runtime.allowPolicy, onConsumed: (id) => runtime.markConsumed(id) }
2027
2040
  );
2028
2041
  void runtime.startServer().catch((error) => {
2029
2042
  ctx.log(`pie-ipc: server start failed: ${error instanceof Error ? error.message : String(error)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "2.7.18",
3
+ "version": "2.7.19",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {