@c4a/daemon 0.4.12-alpha.1 → 0.4.12-alpha.3

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 (2) hide show
  1. package/index.js +24 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13288,6 +13288,24 @@ var ERROR_CODE_HTTP_STATUS = {
13288
13288
  var import_yaml = __toESM(require_dist(), 1);
13289
13289
  // ../core/src/constants.ts
13290
13290
  var DAEMON_HEARTBEAT_INTERVAL = 30000;
13291
+ // ../core/src/fileTypes.ts
13292
+ var INDEXABLE_CODE_EXTENSIONS = new Set([".ts", ".tsx"]);
13293
+ var INDEXABLE_DOC_EXTENSIONS = new Set([".md"]);
13294
+ var INDEXABLE_EXTENSIONS = new Set([
13295
+ ...INDEXABLE_CODE_EXTENSIONS,
13296
+ ...INDEXABLE_DOC_EXTENSIONS
13297
+ ]);
13298
+ var UPLOAD_ALLOWED_EXTENSIONS = new Set([
13299
+ ".md",
13300
+ ".doc",
13301
+ ".docx",
13302
+ ".pdf",
13303
+ ".ppt",
13304
+ ".pptx",
13305
+ ".txt"
13306
+ ]);
13307
+ var TEXT_EXTENSIONS = new Set([".md", ".txt"]);
13308
+ var UPLOAD_MAX_FILE_SIZE = 5 * 1024 * 1024;
13291
13309
  // src/handlers/utils.ts
13292
13310
  import path2 from "node:path";
13293
13311
 
@@ -13357,7 +13375,7 @@ var assertAllowedPath = (targetPath, allowedPaths) => {
13357
13375
  };
13358
13376
 
13359
13377
  // src/config.ts
13360
- var DEFAULT_SERVER_HOST = "localhost:5100";
13378
+ var DEFAULT_SERVER_HOST = "127.0.0.1:5100";
13361
13379
  var WS_DAEMON_PATH = "/ws/daemon";
13362
13380
  function resolveServerUrl(input) {
13363
13381
  const host = input?.trim() || DEFAULT_SERVER_HOST;
@@ -13367,7 +13385,7 @@ function resolveServerUrl(input) {
13367
13385
  }
13368
13386
  const isLocal = host.startsWith("localhost") || host.startsWith("127.0.0.1") || host.startsWith("0.0.0.0");
13369
13387
  const protocol = isLocal ? "ws" : "wss";
13370
- const base2 = host.replace(/\/+$/, "");
13388
+ const base2 = host.replace(/^localhost/, "127.0.0.1").replace(/\/+$/, "");
13371
13389
  return `${protocol}://${base2}${WS_DAEMON_PATH}`;
13372
13390
  }
13373
13391
  var parseAllowedPaths = (input) => {
@@ -13499,7 +13517,8 @@ var matchesFilter = (filePath, include) => {
13499
13517
  if (CODE_PACKAGE_FILES.has(lower))
13500
13518
  return true;
13501
13519
  } else if (filter === "docs") {
13502
- if (filePath.toLowerCase().endsWith(".md"))
13520
+ const ext = filePath.toLowerCase().slice(filePath.lastIndexOf("."));
13521
+ if (INDEXABLE_DOC_EXTENSIONS.has(ext))
13503
13522
  return true;
13504
13523
  } else if (filter.startsWith(".")) {
13505
13524
  if (filePath.toLowerCase().endsWith(filter.toLowerCase()))
@@ -13747,7 +13766,8 @@ var matchesFilter2 = (filePath, include) => {
13747
13766
  if (CODE_PACKAGE_FILES.has(lower))
13748
13767
  return true;
13749
13768
  } else if (filter === "docs") {
13750
- if (filePath.toLowerCase().endsWith(".md"))
13769
+ const ext = filePath.toLowerCase().slice(filePath.lastIndexOf("."));
13770
+ if (INDEXABLE_DOC_EXTENSIONS.has(ext))
13751
13771
  return true;
13752
13772
  } else if (filter.startsWith(".")) {
13753
13773
  if (filePath.toLowerCase().endsWith(filter.toLowerCase()))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/daemon",
3
- "version": "0.4.12-alpha.1",
3
+ "version": "0.4.12-alpha.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "c4a-daemon": "./index.js"