gossipcat 0.6.7 → 0.6.8

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.
@@ -6967,11 +6967,14 @@ var init_mcp_context = __esm({
6967
6967
  // packages/orchestrator/src/log.ts
6968
6968
  function ts() {
6969
6969
  const d = /* @__PURE__ */ new Date();
6970
+ const yyyy = d.getUTCFullYear();
6971
+ const mo = String(d.getUTCMonth() + 1).padStart(2, "0");
6972
+ const dd = String(d.getUTCDate()).padStart(2, "0");
6970
6973
  const hh = String(d.getUTCHours()).padStart(2, "0");
6971
6974
  const mm = String(d.getUTCMinutes()).padStart(2, "0");
6972
6975
  const ss = String(d.getUTCSeconds()).padStart(2, "0");
6973
6976
  const ms = String(d.getUTCMilliseconds()).padStart(3, "0");
6974
- return `${hh}:${mm}:${ss}.${ms}`;
6977
+ return `${yyyy}-${mo}-${dd} ${hh}:${mm}:${ss}.${ms}Z`;
6975
6978
  }
6976
6979
  function emojiFor(tag) {
6977
6980
  if (TAG_EMOJI[tag]) return TAG_EMOJI[tag];
@@ -14617,13 +14620,17 @@ ${context}` : ""}
14617
14620
  });
14618
14621
 
14619
14622
  // packages/tools/src/file-tools.ts
14620
- var import_promises, import_path6, import_fs7, FileTools;
14623
+ var import_promises, import_path6, import_fs7, import_re2, MAX_GREP_FILE_BYTES, MAX_GREP_MATCHES, MAX_GREP_FILES, FileTools;
14621
14624
  var init_file_tools = __esm({
14622
14625
  "packages/tools/src/file-tools.ts"() {
14623
14626
  "use strict";
14624
14627
  import_promises = require("fs/promises");
14625
14628
  import_path6 = require("path");
14626
14629
  import_fs7 = require("fs");
14630
+ import_re2 = __toESM(require("re2"));
14631
+ MAX_GREP_FILE_BYTES = 2 * 1024 * 1024;
14632
+ MAX_GREP_MATCHES = 2e3;
14633
+ MAX_GREP_FILES = 5e3;
14627
14634
  FileTools = class {
14628
14635
  constructor(sandbox) {
14629
14636
  this.sandbox = sandbox;
@@ -14709,13 +14716,17 @@ var init_file_tools = __esm({
14709
14716
  const searchRoot = args.path ? this.sandbox.validatePath(args.path, allowed) : agentRoot || this.sandbox.projectRoot;
14710
14717
  let regex;
14711
14718
  try {
14712
- regex = new RegExp(args.pattern);
14719
+ regex = new import_re2.default(args.pattern);
14713
14720
  } catch (error51) {
14714
14721
  return `Invalid regex pattern: ${error51 instanceof Error ? error51.message : "Unknown error"}`;
14715
14722
  }
14716
- const results = [];
14717
- await this.grepDir(searchRoot, regex, results, 0, 10);
14718
- return results.join("\n") || "No matches found";
14723
+ const state = { matches: [], filesScanned: 0, truncated: false };
14724
+ await this.grepDir(searchRoot, regex, state, 0, 10);
14725
+ let output = state.matches.join("\n") || "No matches found";
14726
+ if (state.truncated) {
14727
+ output += "\n... (truncated \u2014 result or scan limit reached; narrow your pattern/path)";
14728
+ }
14729
+ return output;
14719
14730
  }
14720
14731
  async fileTree(args, agentRoot) {
14721
14732
  const allowed = agentRoot ? [agentRoot] : [];
@@ -14735,7 +14746,7 @@ var init_file_tools = __esm({
14735
14746
  return;
14736
14747
  }
14737
14748
  const regexStr = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
14738
- const regex = new RegExp(regexStr);
14749
+ const regex = new import_re2.default(regexStr);
14739
14750
  for (const entry of entries) {
14740
14751
  if (entry === "node_modules" || entry === ".git") continue;
14741
14752
  const fullPath = (0, import_path6.join)(dir, entry);
@@ -14755,8 +14766,9 @@ var init_file_tools = __esm({
14755
14766
  }
14756
14767
  }
14757
14768
  }
14758
- async grepDir(dir, regex, results, depth = 0, maxDepth = 10) {
14769
+ async grepDir(dir, regex, state, depth = 0, maxDepth = 10) {
14759
14770
  if (depth >= maxDepth) return;
14771
+ if (state.truncated) return;
14760
14772
  let entries;
14761
14773
  try {
14762
14774
  entries = await (0, import_promises.readdir)(dir);
@@ -14764,6 +14776,7 @@ var init_file_tools = __esm({
14764
14776
  return;
14765
14777
  }
14766
14778
  for (const entry of entries) {
14779
+ if (state.truncated) return;
14767
14780
  if (entry === "node_modules" || entry === ".git") continue;
14768
14781
  const fullPath = (0, import_path6.join)(dir, entry);
14769
14782
  let info;
@@ -14773,17 +14786,29 @@ var init_file_tools = __esm({
14773
14786
  continue;
14774
14787
  }
14775
14788
  if (info.isDirectory()) {
14776
- await this.grepDir(fullPath, regex, results, depth + 1, maxDepth);
14789
+ await this.grepDir(fullPath, regex, state, depth + 1, maxDepth);
14777
14790
  } else {
14791
+ if (info.size > MAX_GREP_FILE_BYTES) {
14792
+ continue;
14793
+ }
14794
+ state.filesScanned++;
14795
+ if (state.filesScanned > MAX_GREP_FILES) {
14796
+ state.truncated = true;
14797
+ return;
14798
+ }
14778
14799
  try {
14779
14800
  const content = await (0, import_promises.readFile)(fullPath, "utf-8");
14780
14801
  const lines = content.split("\n");
14781
14802
  const relPath = (0, import_path6.relative)(this.sandbox.projectRoot, fullPath);
14782
- lines.forEach((line, idx) => {
14783
- if (regex.test(line)) {
14784
- results.push(`${relPath}:${idx + 1}: ${line}`);
14803
+ for (let idx = 0; idx < lines.length; idx++) {
14804
+ if (state.matches.length >= MAX_GREP_MATCHES) {
14805
+ state.truncated = true;
14806
+ break;
14785
14807
  }
14786
- });
14808
+ if (regex.test(lines[idx])) {
14809
+ state.matches.push(`${relPath}:${idx + 1}: ${lines[idx]}`);
14810
+ }
14811
+ }
14787
14812
  } catch {
14788
14813
  }
14789
14814
  }
@@ -20216,6 +20241,9 @@ __export(src_exports2, {
20216
20241
  GIT_TOOLS: () => GIT_TOOLS,
20217
20242
  GitTools: () => GitTools,
20218
20243
  IDENTITY_TOOLS: () => IDENTITY_TOOLS,
20244
+ MAX_GREP_FILES: () => MAX_GREP_FILES,
20245
+ MAX_GREP_FILE_BYTES: () => MAX_GREP_FILE_BYTES,
20246
+ MAX_GREP_MATCHES: () => MAX_GREP_MATCHES,
20219
20247
  MAX_MEMORY_QUERY_LOG_BYTES: () => MAX_MEMORY_QUERY_LOG_BYTES,
20220
20248
  MEMORY_QUERY_LOG: () => MEMORY_QUERY_LOG,
20221
20249
  MEMORY_TOOLS: () => MEMORY_TOOLS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gossipcat",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Multi-agent orchestration for Claude Code — parallel review, consensus, adaptive dispatch",
5
5
  "mcpName": "io.github.ataberk-xyz/gossipcat",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "test": "jest --config jest.config.base.js",
35
35
  "clean": "rm -rf packages/*/dist apps/*/dist dist-mcp/ dist-dashboard/",
36
36
  "postinstall": "node scripts/postinstall.js",
37
- "build:mcp": "rm -rf dist-mcp && npx esbuild apps/cli/src/mcp-server-sdk.ts --bundle --platform=node --target=node22 --outfile=dist-mcp/mcp-server.js --external:bufferutil --external:utf-8-validate --tsconfig=tsconfig.json && cp -r packages/orchestrator/src/default-skills dist-mcp/default-skills && cp -r packages/orchestrator/src/default-rules dist-mcp/default-rules && cp -r assets dist-mcp/assets && mkdir -p dist-mcp/data && cp data/archetypes.json dist-mcp/data/archetypes.json && chmod +x dist-mcp/mcp-server.js && chmod +x dist-mcp/assets/hooks/worktree-sandbox.sh && chmod +x dist-mcp/assets/hooks/discipline/*.sh",
37
+ "build:mcp": "rm -rf dist-mcp && npx esbuild apps/cli/src/mcp-server-sdk.ts --bundle --platform=node --target=node22 --outfile=dist-mcp/mcp-server.js --external:bufferutil --external:utf-8-validate --external:re2 --tsconfig=tsconfig.json && cp -r packages/orchestrator/src/default-skills dist-mcp/default-skills && cp -r packages/orchestrator/src/default-rules dist-mcp/default-rules && cp -r assets dist-mcp/assets && mkdir -p dist-mcp/data && cp data/archetypes.json dist-mcp/data/archetypes.json && chmod +x dist-mcp/mcp-server.js && chmod +x dist-mcp/assets/hooks/worktree-sandbox.sh && chmod +x dist-mcp/assets/hooks/discipline/*.sh",
38
38
  "build:dashboard": "cd packages/dashboard-v2 && npx vite build --outDir ../../dist-dashboard --emptyOutDir",
39
39
  "prepublishOnly": "npm run build:all && npm run build:mcp && npm run build:dashboard",
40
40
  "gossipcat": "npx ts-node -r tsconfig-paths/register -P tsconfig.json apps/cli/src/index.ts",
@@ -55,6 +55,7 @@
55
55
  "dependencies": {
56
56
  "@clack/prompts": "^1.1.0",
57
57
  "@modelcontextprotocol/sdk": "^1.27.1",
58
+ "re2": "^1.25.0",
58
59
  "tsconfig-paths": "^4.2.0",
59
60
  "ws": "^8.20.1"
60
61
  },