@massa-ai/mcp-client 1.18.0 → 1.20.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.
@@ -50358,6 +50358,9 @@ async function _checkJsonSchemaSupport() {
50358
50358
  return false;
50359
50359
  }
50360
50360
  }
50361
+ function _setJsonSchemaSupportedForTesting(flag) {
50362
+ _jsonSchemaSupported = flag;
50363
+ }
50361
50364
  function isLlmEnabled() {
50362
50365
  if (testEnabledOverride !== null)
50363
50366
  return testEnabledOverride;
@@ -50367,6 +50370,9 @@ function isLlmEnabled() {
50367
50370
  return false;
50368
50371
  }
50369
50372
  }
50373
+ function _setLlmEnabledForTesting(flag) {
50374
+ testEnabledOverride = flag;
50375
+ }
50370
50376
  function getLlmConfig(opts) {
50371
50377
  const cfg = config.get("llm");
50372
50378
  const role = opts?.modelRole ?? "instruct";
@@ -151388,6 +151394,7 @@ var init_services = __esm(() => {
151388
151394
  init_index_manager();
151389
151395
  init_search_diagnostics();
151390
151396
  init_memory_controller();
151397
+ init_llm_client();
151391
151398
  init_search_controller();
151392
151399
  init_context_controller();
151393
151400
  init_executor_controller();
package/dist/index.js CHANGED
@@ -56917,6 +56917,9 @@ async function _checkJsonSchemaSupport() {
56917
56917
  return false;
56918
56918
  }
56919
56919
  }
56920
+ function _setJsonSchemaSupportedForTesting(flag) {
56921
+ _jsonSchemaSupported = flag;
56922
+ }
56920
56923
  function isLlmEnabled() {
56921
56924
  if (testEnabledOverride !== null)
56922
56925
  return testEnabledOverride;
@@ -56926,6 +56929,9 @@ function isLlmEnabled() {
56926
56929
  return false;
56927
56930
  }
56928
56931
  }
56932
+ function _setLlmEnabledForTesting(flag) {
56933
+ testEnabledOverride = flag;
56934
+ }
56929
56935
  function getLlmConfig(opts) {
56930
56936
  const cfg = config2.get("llm");
56931
56937
  const role = opts?.modelRole ?? "instruct";
@@ -136508,6 +136514,72 @@ var init_attribution_resolver = __esm(() => {
136508
136514
  init_session_pin_store();
136509
136515
  });
136510
136516
 
136517
+ // ../../packages/core/dist/kernel/sanitize/credential-scrub.js
136518
+ function markerFor(id) {
136519
+ return `[REDACTED:${id}]`;
136520
+ }
136521
+ function fullMatchRule(id, pattern) {
136522
+ const marker26 = markerFor(id);
136523
+ return {
136524
+ id,
136525
+ replace(text3) {
136526
+ let count = 0;
136527
+ const replaced = text3.replace(pattern, () => {
136528
+ count++;
136529
+ return marker26;
136530
+ });
136531
+ return { text: replaced, count };
136532
+ }
136533
+ };
136534
+ }
136535
+ function scrubCredentials(payloadJson) {
136536
+ const redactions = {};
136537
+ for (const id of RULE_IDS)
136538
+ redactions[id] = 0;
136539
+ let text3 = payloadJson;
136540
+ for (const rule of RULES) {
136541
+ const { text: next, count } = rule.replace(text3);
136542
+ text3 = next;
136543
+ redactions[rule.id] += count;
136544
+ }
136545
+ const total = Object.values(redactions).reduce((sum, n) => sum + n, 0);
136546
+ return {
136547
+ sanitized: text3,
136548
+ redactions,
136549
+ total
136550
+ };
136551
+ }
136552
+ var PEM_PATTERN, JWT_PATTERN, AWS_KEY_PATTERN, SK_KEY_PATTERN, GITHUB_TOKEN_PATTERN, SLACK_TOKEN_PATTERN, BEARER_PATTERN, RULES, RULE_IDS;
136553
+ var init_credential_scrub = __esm(() => {
136554
+ PEM_PATTERN = /-----BEGIN [A-Z ]{0,32}PRIVATE KEY-----[\s\S]{0,8192}?-----END [A-Z ]{0,32}PRIVATE KEY-----/g;
136555
+ JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
136556
+ AWS_KEY_PATTERN = /\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}\b/g;
136557
+ SK_KEY_PATTERN = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
136558
+ GITHUB_TOKEN_PATTERN = /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g;
136559
+ SLACK_TOKEN_PATTERN = /\bxox[baprs]-[A-Za-z0-9-]{18,}\b/g;
136560
+ BEARER_PATTERN = /(Bearer\s+)([A-Za-z0-9._~+/=-]{20,})/g;
136561
+ RULES = [
136562
+ fullMatchRule("pem", PEM_PATTERN),
136563
+ fullMatchRule("jwt", JWT_PATTERN),
136564
+ fullMatchRule("aws-key", AWS_KEY_PATTERN),
136565
+ fullMatchRule("sk-key", SK_KEY_PATTERN),
136566
+ fullMatchRule("github-token", GITHUB_TOKEN_PATTERN),
136567
+ fullMatchRule("slack-token", SLACK_TOKEN_PATTERN),
136568
+ {
136569
+ id: "bearer",
136570
+ replace(text3) {
136571
+ let count = 0;
136572
+ const replaced = text3.replace(BEARER_PATTERN, (_m, prefix) => {
136573
+ count++;
136574
+ return `${prefix}${markerFor("bearer")}`;
136575
+ });
136576
+ return { text: replaced, count };
136577
+ }
136578
+ }
136579
+ ];
136580
+ RULE_IDS = RULES.map((r) => r.id);
136581
+ });
136582
+
136511
136583
  // ../../packages/core/dist/tools/compact_snapshot.js
136512
136584
  class CompactSnapshotTool {
136513
136585
  name = "compact_snapshot";
@@ -136559,19 +136631,26 @@ class CompactSnapshotTool {
136559
136631
  persistedId = newObservationId();
136560
136632
  try {
136561
136633
  const attribution = await (this.resolverOverride ?? getAttributionResolver()).resolve({ callerProjectId: projectId, sessionId, cwd });
136634
+ const scrub = scrubCredentials(JSON.stringify({
136635
+ snapshot: snapshot.xml,
136636
+ eventCount: snapshot.eventCount,
136637
+ compactCount: snapshot.compactCount,
136638
+ generatedAt: snapshot.generatedAt,
136639
+ sectionCount: snapshot.sections.length
136640
+ }));
136641
+ if (scrub.total > 0) {
136642
+ logger.debug("compact_snapshot payload redacted before persist", {
136643
+ redactions: scrub.redactions,
136644
+ total: scrub.total
136645
+ });
136646
+ }
136562
136647
  store4.insert({
136563
136648
  id: persistedId,
136564
136649
  projectId: attribution.projectId,
136565
136650
  sessionId,
136566
136651
  source: "pre-compact",
136567
136652
  category: "compaction-snapshots",
136568
- payloadJson: JSON.stringify({
136569
- snapshot: snapshot.xml,
136570
- eventCount: snapshot.eventCount,
136571
- compactCount: snapshot.compactCount,
136572
- generatedAt: snapshot.generatedAt,
136573
- sectionCount: snapshot.sections.length
136574
- }),
136653
+ payloadJson: scrub.sanitized,
136575
136654
  importance: 0.8,
136576
136655
  createdAt: Date.now(),
136577
136656
  attributionSource: attribution.source
@@ -136623,6 +136702,7 @@ var init_compact_snapshot = __esm(() => {
136623
136702
  init_observation_repository();
136624
136703
  init_compaction_snapshot_service();
136625
136704
  init_attribution_resolver();
136705
+ init_credential_scrub();
136626
136706
  });
136627
136707
 
136628
136708
  // ../../packages/core/dist/tools/list_projects.js
@@ -161922,6 +162002,7 @@ var init_services = __esm(() => {
161922
162002
  init_index_manager();
161923
162003
  init_search_diagnostics();
161924
162004
  init_memory_controller();
162005
+ init_llm_client();
161925
162006
  init_search_controller();
161926
162007
  init_context_controller();
161927
162008
  init_executor_controller();
@@ -162259,13 +162340,20 @@ class HookService {
162259
162340
  });
162260
162341
  const id = this.idFactory();
162261
162342
  this.queue.enqueue(async () => {
162343
+ const scrub = scrubCredentials(JSON.stringify(ev.payload));
162344
+ if (scrub.total > 0) {
162345
+ logger.debug("hook payload redacted before persist", {
162346
+ redactions: scrub.redactions,
162347
+ total: scrub.total
162348
+ });
162349
+ }
162262
162350
  const obs = {
162263
162351
  id,
162264
162352
  projectId: attribution.projectId,
162265
162353
  sessionId: ev.sessionId,
162266
162354
  source: ev.event,
162267
162355
  category: extractCategory(ev.event, ev.payload),
162268
- payloadJson: JSON.stringify(ev.payload),
162356
+ payloadJson: scrub.sanitized,
162269
162357
  importance: ev.importance,
162270
162358
  createdAt: ev.ts,
162271
162359
  agentId: ev.agentId,
@@ -162326,6 +162414,7 @@ var init_hook_service = __esm(() => {
162326
162414
  init_observation_extractor();
162327
162415
  init_observation_consolidation_job();
162328
162416
  init_attribution_resolver();
162417
+ init_credential_scrub();
162329
162418
  ValidationError = class ValidationError extends Error {
162330
162419
  code;
162331
162420
  constructor(code, message) {
@@ -163455,6 +163544,8 @@ __export(exports_dist, {
163455
163544
  applyChainInhibition: () => applyChainInhibition,
163456
163545
  applyAttentionScore: () => applyAttentionScore,
163457
163546
  analyzeSpectrum: () => analyzeSpectrum,
163547
+ _setLlmEnabledForTesting: () => _setLlmEnabledForTesting,
163548
+ _setJsonSchemaSupportedForTesting: () => _setJsonSchemaSupportedForTesting,
163458
163549
  ZIG_QUERY_PACK: () => ZIG_QUERY_PACK,
163459
163550
  WriterQueue: () => WriterQueue,
163460
163551
  WorkspaceManager: () => WorkspaceManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/mcp-client",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "massa-ai MCP server - Semantic code search, memory, and context compression via Model Context Protocol",
5
5
  "author": "luizgmassa",
6
6
  "type": "module",
@@ -20,8 +20,8 @@
20
20
  "type-check": "tsc --noEmit"
21
21
  },
22
22
  "dependencies": {
23
- "@massa-ai/core": "^1.18.0",
24
- "@massa-ai/shared": "^1.18.0",
23
+ "@massa-ai/core": "^1.20.0",
24
+ "@massa-ai/shared": "^1.20.0",
25
25
  "@modelcontextprotocol/sdk": "^1.0.0"
26
26
  },
27
27
  "devDependencies": {