@nxuss/lemma 1.7.0 → 1.7.2

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 (158) hide show
  1. package/dist/cjs/mcp/tools.d.ts.map +1 -1
  2. package/dist/cjs/mcp/tools.js +115 -15
  3. package/dist/cjs/mcp/tools.js.map +1 -1
  4. package/dist/cjs/proxy/ComplexityRouter.d.ts +7 -0
  5. package/dist/cjs/proxy/ComplexityRouter.d.ts.map +1 -1
  6. package/dist/cjs/proxy/ComplexityRouter.js +18 -5
  7. package/dist/cjs/proxy/ComplexityRouter.js.map +1 -1
  8. package/dist/cjs/utils/TokenReceipt.d.ts +6 -0
  9. package/dist/cjs/utils/TokenReceipt.d.ts.map +1 -1
  10. package/dist/cjs/utils/TokenReceipt.js +9 -0
  11. package/dist/cjs/utils/TokenReceipt.js.map +1 -1
  12. package/dist/esm/api/dashboardRoutes.d.ts +3 -3
  13. package/dist/esm/api/dashboardRoutes.js +1 -1
  14. package/dist/esm/api/server.d.ts +4 -4
  15. package/dist/esm/api/server.js +3 -3
  16. package/dist/esm/autopilot/AutopilotWatcher.js +3 -3
  17. package/dist/esm/autopilot/Notifier.d.ts +1 -1
  18. package/dist/esm/cli/lemma-proxy.js +14 -14
  19. package/dist/esm/cli/stack.d.ts +4 -4
  20. package/dist/esm/cli/stack.js +5 -5
  21. package/dist/esm/cloud/KeyManager.d.ts +1 -1
  22. package/dist/esm/cloud/KeyManager.js +1 -1
  23. package/dist/esm/cloud/TenantCache.d.ts +1 -1
  24. package/dist/esm/cloud/TenantCache.js +1 -1
  25. package/dist/esm/cloud/index.d.ts +3 -3
  26. package/dist/esm/cloud/index.js +3 -3
  27. package/dist/esm/cloud/server.d.ts +3 -3
  28. package/dist/esm/cloud/server.js +5 -5
  29. package/dist/esm/config/index.d.ts +1 -1
  30. package/dist/esm/config/index.js +1 -1
  31. package/dist/esm/consensus/index.d.ts +2 -2
  32. package/dist/esm/consensus/index.js +2 -2
  33. package/dist/esm/core/AgentRegistry.d.ts +1 -1
  34. package/dist/esm/core/AgentRegistry.js +1 -1
  35. package/dist/esm/core/DashboardBroadcaster.d.ts +3 -3
  36. package/dist/esm/core/DashboardBroadcaster.js +2 -2
  37. package/dist/esm/core/DashboardWebSocketServer.d.ts +1 -1
  38. package/dist/esm/core/DashboardWebSocketServer.js +1 -1
  39. package/dist/esm/core/GhostAlchemist.js +1 -1
  40. package/dist/esm/core/GhostListener.js +2 -2
  41. package/dist/esm/core/OrchestrationEngine.d.ts +3 -3
  42. package/dist/esm/core/OrchestrationEngine.js +2 -2
  43. package/dist/esm/core/SubconsciousEngine.d.ts +1 -1
  44. package/dist/esm/core/SubconsciousEngine.js +2 -2
  45. package/dist/esm/core/WebSocketServer.d.ts +2 -2
  46. package/dist/esm/core/WebSocketServer.js +1 -1
  47. package/dist/esm/core/index.d.ts +6 -6
  48. package/dist/esm/core/index.js +6 -6
  49. package/dist/esm/core/router.d.ts +3 -3
  50. package/dist/esm/core/router.js +1 -1
  51. package/dist/esm/db/database.js +1 -1
  52. package/dist/esm/embed.d.ts +2 -2
  53. package/dist/esm/embed.js +2 -2
  54. package/dist/esm/examples/basic-usage.js +1 -1
  55. package/dist/esm/index.d.ts +14 -14
  56. package/dist/esm/index.js +14 -14
  57. package/dist/esm/infra/analyzers/DriftDetector.d.ts +1 -1
  58. package/dist/esm/infra/analyzers/InfraAnalyzer.d.ts +1 -1
  59. package/dist/esm/infra/analyzers/MonolithAnalyzer.d.ts +1 -1
  60. package/dist/esm/infra/analyzers/index.d.ts +3 -3
  61. package/dist/esm/infra/analyzers/index.js +3 -3
  62. package/dist/esm/infra/cli.js +2 -2
  63. package/dist/esm/infra/config.d.ts +1 -1
  64. package/dist/esm/infra/index.d.ts +5 -5
  65. package/dist/esm/infra/index.js +5 -5
  66. package/dist/esm/infra/mcp-tools.js +5 -5
  67. package/dist/esm/infra/providers/InfraProvider.d.ts +1 -1
  68. package/dist/esm/infra/providers/JenkinsProvider.d.ts +2 -2
  69. package/dist/esm/infra/providers/OKDProvider.d.ts +2 -2
  70. package/dist/esm/infra/providers/TerraformProvider.d.ts +2 -2
  71. package/dist/esm/infra/providers/index.d.ts +5 -5
  72. package/dist/esm/infra/providers/index.js +3 -3
  73. package/dist/esm/mcp/index.js +5 -5
  74. package/dist/esm/mcp/resources.js +2 -2
  75. package/dist/esm/mcp/tools.d.ts.map +1 -1
  76. package/dist/esm/mcp/tools.js +153 -53
  77. package/dist/esm/mcp/tools.js.map +1 -1
  78. package/dist/esm/observability/IdeContextSync.d.ts +1 -1
  79. package/dist/esm/observability/IdeContextSync.js +5 -5
  80. package/dist/esm/pr-review/PRReviewEngine.d.ts +1 -1
  81. package/dist/esm/pr-review/PRReviewEngine.js +4 -4
  82. package/dist/esm/pr-review/ReviewStore.d.ts +1 -1
  83. package/dist/esm/pr-review/adapters/AzureDevOpsAdapter.d.ts +2 -2
  84. package/dist/esm/pr-review/adapters/AzureDevOpsAdapter.js +1 -1
  85. package/dist/esm/pr-review/adapters/GitHubAdapter.d.ts +2 -2
  86. package/dist/esm/pr-review/adapters/GitHubAdapter.js +1 -1
  87. package/dist/esm/pr-review/adapters/GitLabAdapter.d.ts +2 -2
  88. package/dist/esm/pr-review/adapters/GitLabAdapter.js +1 -1
  89. package/dist/esm/pr-review/adapters/GitPlatformAdapter.d.ts +1 -1
  90. package/dist/esm/pr-review/adapters/index.d.ts +4 -4
  91. package/dist/esm/pr-review/adapters/index.js +3 -3
  92. package/dist/esm/pr-review/analyzers/QualityGrader.d.ts +1 -1
  93. package/dist/esm/pr-review/analyzers/RegressionDetector.d.ts +1 -1
  94. package/dist/esm/pr-review/analyzers/SecurityScanner.d.ts +1 -1
  95. package/dist/esm/pr-review/analyzers/StaticAnalyzer.d.ts +1 -1
  96. package/dist/esm/pr-review/analyzers/index.d.ts +8 -8
  97. package/dist/esm/pr-review/analyzers/index.js +4 -4
  98. package/dist/esm/pr-review/bridge/BrainBridge.d.ts +1 -1
  99. package/dist/esm/pr-review/bridge/BrainBridge.js +1 -1
  100. package/dist/esm/pr-review/bridge/index.d.ts +1 -1
  101. package/dist/esm/pr-review/bridge/index.js +1 -1
  102. package/dist/esm/pr-review/index.d.ts +4 -4
  103. package/dist/esm/pr-review/index.js +2 -2
  104. package/dist/esm/pr-review/reviewRunner.d.ts +2 -2
  105. package/dist/esm/pr-review/reviewRunner.js +6 -6
  106. package/dist/esm/pr-review/webhook/WebhookServer.js +1 -1
  107. package/dist/esm/pr-review/webhook/index.d.ts +1 -1
  108. package/dist/esm/pr-review/webhook/index.js +1 -1
  109. package/dist/esm/protocol/flows.d.ts +1 -1
  110. package/dist/esm/protocol/flows.js +1 -1
  111. package/dist/esm/protocol/index.d.ts +4 -4
  112. package/dist/esm/protocol/index.js +4 -4
  113. package/dist/esm/protocol/utils.d.ts +1 -1
  114. package/dist/esm/protocol/utils.js +2 -2
  115. package/dist/esm/protocol/validators.d.ts +1 -1
  116. package/dist/esm/protocol/validators.js +1 -1
  117. package/dist/esm/proxy/ComplexityRouter.d.ts +7 -0
  118. package/dist/esm/proxy/ComplexityRouter.d.ts.map +1 -1
  119. package/dist/esm/proxy/ComplexityRouter.js +18 -5
  120. package/dist/esm/proxy/ComplexityRouter.js.map +1 -1
  121. package/dist/esm/proxy/ContextInjector.d.ts +1 -1
  122. package/dist/esm/proxy/Gatekeeper.d.ts +1 -1
  123. package/dist/esm/security/SecurityMiddleware.d.ts +1 -1
  124. package/dist/esm/security/SecurityMiddleware.js +3 -3
  125. package/dist/esm/security/index.d.ts +4 -4
  126. package/dist/esm/security/index.js +4 -4
  127. package/dist/esm/speculative/SpeculativeCache.d.ts +2 -2
  128. package/dist/esm/speculative/SpeculativeEngine.d.ts +2 -2
  129. package/dist/esm/speculative/SpeculativeEngine.js +3 -3
  130. package/dist/esm/speculative/WorkerPool.d.ts +1 -1
  131. package/dist/esm/speculative/index.d.ts +4 -4
  132. package/dist/esm/speculative/index.js +4 -4
  133. package/dist/esm/subconscious/SemanticCache.d.ts +2 -2
  134. package/dist/esm/subconscious/SemanticCache.js +2 -2
  135. package/dist/esm/subconscious/SubconsciousEngine.d.ts +1 -1
  136. package/dist/esm/subconscious/SubconsciousEngine.js +3 -3
  137. package/dist/esm/subconscious/index.d.ts +4 -4
  138. package/dist/esm/subconscious/index.js +4 -4
  139. package/dist/esm/utils/AutoContextBundle.d.ts +1 -1
  140. package/dist/esm/utils/AutoContextBundle.js +4 -4
  141. package/dist/esm/utils/BulkFileDigest.js +2 -2
  142. package/dist/esm/utils/ClipboardWatcher.js +2 -2
  143. package/dist/esm/utils/ContextCollapser.js +1 -1
  144. package/dist/esm/utils/ExecutiveReport.js +1 -1
  145. package/dist/esm/utils/StructuralSearch.d.ts +1 -1
  146. package/dist/esm/utils/SurgicalASTInsert.js +1 -1
  147. package/dist/esm/utils/SymbolSurgicalContext.js +1 -1
  148. package/dist/esm/utils/TestAutofixInterceptor.js +1 -1
  149. package/dist/esm/utils/TokenReceipt.d.ts +6 -0
  150. package/dist/esm/utils/TokenReceipt.d.ts.map +1 -1
  151. package/dist/esm/utils/TokenReceipt.js +8 -0
  152. package/dist/esm/utils/TokenReceipt.js.map +1 -1
  153. package/dist/esm/utils/WorkspaceSearch.js +0 -0
  154. package/dist/esm/utils/logger.js +1 -1
  155. package/package.json +6 -9
  156. package/sdks/crewai/README.md +178 -0
  157. package/sdks/crewai/dist/index.d.ts +130 -0
  158. package/sdks/crewai/dist/index.js +308 -0
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Exports all speculative execution components for Phase 3.
5
5
  */
6
- export { PredictionEngine } from './PredictionEngine';
7
- export { WorkerPool } from './WorkerPool';
8
- export { SpeculativeCache } from './SpeculativeCache';
9
- export { SpeculativeEngine } from './SpeculativeEngine';
6
+ export { PredictionEngine } from './PredictionEngine.js';
7
+ export { WorkerPool } from './WorkerPool.js';
8
+ export { SpeculativeCache } from './SpeculativeCache.js';
9
+ export { SpeculativeEngine } from './SpeculativeEngine.js';
10
10
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { VectorStore } from './VectorStore';
2
- import { EmbeddingService } from './EmbeddingService';
1
+ import { VectorStore } from './VectorStore.js';
2
+ import { EmbeddingService } from './EmbeddingService.js';
3
3
  /**
4
4
  * Result of a cache lookup operation.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { EmbeddingService } from './EmbeddingService';
2
- import { createLogger } from '../utils/logger';
1
+ import { EmbeddingService } from './EmbeddingService.js';
2
+ import { createLogger } from '../utils/logger.js';
3
3
  const logger = createLogger('SemanticCache');
4
4
  /**
5
5
  * SemanticCache implements the "short-circuit" logic for semantic caching.
@@ -1,4 +1,4 @@
1
- import { CacheResult } from './SemanticCache';
1
+ import { CacheResult } from './SemanticCache.js';
2
2
  import { EventEmitter } from 'events';
3
3
  /**
4
4
  * Configuration options for SubconsciousEngine.
@@ -1,6 +1,6 @@
1
- import { VectorStore } from './VectorStore';
2
- import { EmbeddingService } from './EmbeddingService';
3
- import { SemanticCache } from './SemanticCache';
1
+ import { VectorStore } from './VectorStore.js';
2
+ import { EmbeddingService } from './EmbeddingService.js';
3
+ import { SemanticCache } from './SemanticCache.js';
4
4
  import { EventEmitter } from 'events';
5
5
  /**
6
6
  * SubconsciousEngine is the main orchestrator for semantic caching.
@@ -5,8 +5,8 @@
5
5
  * Provides "short-circuit" logic to return cached results for similar tasks,
6
6
  * reducing latency from seconds to milliseconds.
7
7
  */
8
- export { VectorStore } from './VectorStore';
9
- export { EmbeddingService } from './EmbeddingService';
10
- export { SemanticCache, CacheResult } from './SemanticCache';
11
- export { SubconsciousEngine, SubconsciousConfig, Task, TaskResult, EngineMetrics, } from './SubconsciousEngine';
8
+ export { VectorStore } from './VectorStore.js';
9
+ export { EmbeddingService } from './EmbeddingService.js';
10
+ export { SemanticCache, CacheResult } from './SemanticCache.js';
11
+ export { SubconsciousEngine, SubconsciousConfig, Task, TaskResult, EngineMetrics, } from './SubconsciousEngine.js';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -5,8 +5,8 @@
5
5
  * Provides "short-circuit" logic to return cached results for similar tasks,
6
6
  * reducing latency from seconds to milliseconds.
7
7
  */
8
- export { VectorStore } from './VectorStore';
9
- export { EmbeddingService } from './EmbeddingService';
10
- export { SemanticCache } from './SemanticCache';
11
- export { SubconsciousEngine, } from './SubconsciousEngine';
8
+ export { VectorStore } from './VectorStore.js';
9
+ export { EmbeddingService } from './EmbeddingService.js';
10
+ export { SemanticCache } from './SemanticCache.js';
11
+ export { SubconsciousEngine, } from './SubconsciousEngine.js';
12
12
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { ImportEntry } from './ImportTreeContext';
1
+ import { ImportEntry } from './ImportTreeContext.js';
2
2
  export interface TelepathicHint {
3
3
  query: string;
4
4
  response: string;
@@ -1,9 +1,9 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { computeFingerprint } from './FileFingerprint';
4
- import { squeezeCode } from './ContextSqueezer';
5
- import { buildImportTree } from './ImportTreeContext';
6
- import { getBrain, deriveProjectId } from '../subconscious/TheBrainV2';
3
+ import { computeFingerprint } from './FileFingerprint.js';
4
+ import { squeezeCode } from './ContextSqueezer.js';
5
+ import { buildImportTree } from './ImportTreeContext.js';
6
+ import { getBrain, deriveProjectId } from '../subconscious/TheBrainV2.js';
7
7
  import * as ts from 'typescript';
8
8
  function estimateTokens(text) {
9
9
  return Math.ceil(text.length / 4);
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { computeFingerprint } from './FileFingerprint';
4
- import { squeezeCode } from './ContextSqueezer';
3
+ import { computeFingerprint } from './FileFingerprint.js';
4
+ import { squeezeCode } from './ContextSqueezer.js';
5
5
  function estimateTokens(text) {
6
6
  return Math.ceil(text.length / 4);
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { execSync, spawn } from 'child_process';
2
- import { squeezeCode } from './ContextSqueezer';
3
- import { savingsLedger } from './SavingsLedger';
2
+ import { squeezeCode } from './ContextSqueezer.js';
3
+ import { savingsLedger } from './SavingsLedger.js';
4
4
  /**
5
5
  * Reads text content from the macOS system clipboard using native pbpaste
6
6
  */
@@ -5,7 +5,7 @@
5
5
  * Algorithm: Query-Focused TF-IDF Centroid sentence extraction + Jaccard dedup.
6
6
  * Latency: <15ms for 100k characters.
7
7
  */
8
- import { tokenize } from '../subconscious/TheBrainV2';
8
+ import { tokenize } from '../subconscious/TheBrainV2.js';
9
9
  /**
10
10
  * Split text into logical blocks (sentences or log chunks).
11
11
  */
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import fs from 'fs';
9
9
  import path from 'path';
10
- import { savingsLedger } from './SavingsLedger';
10
+ import { savingsLedger } from './SavingsLedger.js';
11
11
  /**
12
12
  * Calculates metrics and writes a highly structured Markdown corporate report.
13
13
  */
@@ -1,4 +1,4 @@
1
- import type { SearchMatch } from "./WorkspaceSearch";
1
+ import type { SearchMatch } from "./WorkspaceSearch.js";
2
2
  export interface DeclaredSymbol {
3
3
  kind: "function" | "class" | "method" | "interface" | "type" | "enum" | "arrow";
4
4
  name: string;
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import fs from 'fs';
11
11
  import * as ts from 'typescript';
12
- import { safeResolvePath } from '../mcp/utils';
12
+ import { safeResolvePath } from '../mcp/utils.js';
13
13
  /**
14
14
  * Finds a class or interface node by name.
15
15
  */
@@ -10,7 +10,7 @@
10
10
  import fs from 'fs';
11
11
  import path from 'path';
12
12
  import * as ts from 'typescript';
13
- import { safeResolvePath } from '../mcp/utils';
13
+ import { safeResolvePath } from '../mcp/utils.js';
14
14
  /**
15
15
  * Traverses AST to find the node defining the specified symbol name.
16
16
  */
@@ -1,5 +1,5 @@
1
1
  import { execSync } from 'child_process';
2
- import { getBrain, deriveProjectId } from '../subconscious/TheBrainV2';
2
+ import { getBrain, deriveProjectId } from '../subconscious/TheBrainV2.js';
3
3
  function extractFailures(output) {
4
4
  const failures = [];
5
5
  // Jest/Vitest failure pattern
@@ -14,6 +14,12 @@ export interface ReceiptEvent {
14
14
  meta?: Record<string, unknown>;
15
15
  }
16
16
  export declare function recordReceiptEvent(type: ReceiptEventType, label: string, meta?: Record<string, unknown>): void;
17
+ /**
18
+ * Number of events recorded so far. The dispatcher samples this around a handler to
19
+ * tell whether the handler already logged something specific (a cache hit, a miss)
20
+ * before falling back to a generic tool_call entry.
21
+ */
22
+ export declare function getLedgerLength(): number;
17
23
  export interface ReceiptSummary {
18
24
  totalEvents: number;
19
25
  byType: Record<ReceiptEventType, number>;
@@ -1 +1 @@
1
- {"version":3,"file":"TokenReceipt.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenReceipt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,oBAAoB,GACpB,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAK9G;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,SAAK,GAAG,cAAc,CAc5D;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
1
+ {"version":3,"file":"TokenReceipt.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenReceipt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,oBAAoB,GACpB,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAK9G;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,SAAK,GAAG,cAAc,CAc5D;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -14,6 +14,14 @@ export function recordReceiptEvent(type, label, meta) {
14
14
  sessionLedger.splice(0, sessionLedger.length - MAX_EVENTS);
15
15
  }
16
16
  }
17
+ /**
18
+ * Number of events recorded so far. The dispatcher samples this around a handler to
19
+ * tell whether the handler already logged something specific (a cache hit, a miss)
20
+ * before falling back to a generic tool_call entry.
21
+ */
22
+ export function getLedgerLength() {
23
+ return sessionLedger.length;
24
+ }
17
25
  export function getReceiptSummary(limit = 20) {
18
26
  const byType = {
19
27
  exact_cache_hit: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"TokenReceipt.js","sourceRoot":"","sources":["../../../src/utils/TokenReceipt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,UAAU,GAAG,IAAI,CAAC;AAgBxB,MAAM,aAAa,GAAmB,EAAE,CAAC;AAEzC,MAAM,UAAU,kBAAkB,CAAC,IAAsB,EAAE,KAAa,EAAE,IAA8B;IACtG,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;QACtC,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAQD,MAAM,UAAU,iBAAiB,CAAC,KAAK,GAAG,EAAE;IAC1C,MAAM,MAAM,GAAqC;QAC/C,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,CAAC;QACrB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;KACb,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,aAAa;QAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAChD,OAAO;QACL,WAAW,EAAE,aAAa,CAAC,MAAM;QACjC,MAAM;QACN,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"TokenReceipt.js","sourceRoot":"","sources":["../../../src/utils/TokenReceipt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,UAAU,GAAG,IAAI,CAAC;AAgBxB,MAAM,aAAa,GAAmB,EAAE,CAAC;AAEzC,MAAM,UAAU,kBAAkB,CAAC,IAAsB,EAAE,KAAa,EAAE,IAA8B;IACtG,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;QACtC,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,CAAC,MAAM,CAAC;AAC9B,CAAC;AAQD,MAAM,UAAU,iBAAiB,CAAC,KAAK,GAAG,EAAE;IAC1C,MAAM,MAAM,GAAqC;QAC/C,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,CAAC;QACrB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;KACb,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,aAAa;QAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAChD,OAAO;QACL,WAAW,EAAE,aAAa,CAAC,MAAM;QACjC,MAAM;QACN,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC"}
Binary file
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { config } from '../config';
3
+ import { config } from '../config/index.js';
4
4
  /**
5
5
  * Log levels
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxuss/lemma",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Intelligent AI Gateway for IDEs & Agents — Semantic cache, Privacy Firewall, Infrastructure Command Center, and Autonomous Cost-Optimization.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -71,10 +71,6 @@
71
71
  "default": "./dist/cjs/protocol/index.js"
72
72
  }
73
73
  },
74
- "./langchain": {
75
- "types": "./sdks/langchain/dist/index.d.ts",
76
- "default": "./sdks/langchain/dist/index.js"
77
- },
78
74
  "./crewai": {
79
75
  "types": "./sdks/crewai/dist/index.d.ts",
80
76
  "default": "./sdks/crewai/dist/index.js"
@@ -91,6 +87,7 @@
91
87
  "bin/cli.js",
92
88
  "bin/checkpoint.js",
93
89
  "dashboard/dist/**/*",
90
+ "sdks/crewai/dist/**/*",
94
91
  "!dist/examples/**",
95
92
  "README.md",
96
93
  "LICENSE"
@@ -100,12 +97,12 @@
100
97
  "proxy:stop": "node lemma-proxy.cjs stop",
101
98
  "proxy:stats": "node lemma-proxy.cjs stats",
102
99
  "proxy:status": "node lemma-proxy.cjs status",
103
- "build": "npm run build:esm && npm run build:cjs && npm run postbuild",
104
- "build:full": "npm run build && npm run build:sdks",
100
+ "build": "npm run build:esm && npm run build:cjs && npm run build:sdks",
101
+ "build:full": "npm run build",
105
102
  "build:esm": "tsc --outDir ./dist/esm",
106
103
  "build:cjs": "tsc --project tsconfig.cjs.json",
107
104
  "build:sdks": "npm run sdk:build",
108
- "postbuild": "node scripts/post-build.js",
105
+ "postbuild": "node scripts/post-build.js && node scripts/fix-esm-extensions.js",
109
106
  "dev": "npx tsx start-dev.ts",
110
107
  "start": "node dist/cjs/index.js",
111
108
  "test": "jest",
@@ -139,7 +136,7 @@
139
136
  "stack:all": "bash scripts/launch-all.sh",
140
137
  "sdk:langchain:build": "cd sdks/langchain && npm run build",
141
138
  "sdk:crewai:build": "cd sdks/crewai && npm run build",
142
- "sdk:build": "npm run sdk:langchain:build && npm run sdk:crewai:build",
139
+ "sdk:build": "npm run sdk:crewai:build",
143
140
  "keys:generate": "npx tsx scripts/manage-keys.ts generate",
144
141
  "keys:list": "npx tsx scripts/manage-keys.ts list",
145
142
  "keys:revoke": "npx tsx scripts/manage-keys.ts revoke"
@@ -0,0 +1,178 @@
1
+ # @lemma/crewai
2
+
3
+ CrewAI integration for Lemma agent orchestration hub.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @lemma/crewai
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { LemmaCrewAgent } from '@lemma/crewai';
15
+
16
+ // Create an agent connected to Lemma
17
+ const agent = new LemmaCrewAgent({
18
+ routerUrl: 'ws://localhost:8080',
19
+ agentId: 'research-agent',
20
+ role: 'Researcher',
21
+ goal: 'Find and analyze information',
22
+ backstory: 'Expert researcher with deep analytical skills',
23
+ capabilities: ['research', 'analysis', 'web-search'],
24
+ });
25
+
26
+ // Connect to the hub
27
+ await agent.connect();
28
+
29
+ // Execute a task
30
+ const result = await agent.execute({
31
+ description: 'Research the latest trends in AI',
32
+ expectedOutput: 'A comprehensive report on AI trends',
33
+ });
34
+
35
+ console.log(result);
36
+
37
+ // Disconnect when done
38
+ agent.disconnect();
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - **Semantic Caching**: Automatic caching of similar tasks
44
+ - **Agent Collaboration**: Discover and delegate to other agents
45
+ - **Task Routing**: Receive tasks from the orchestration hub
46
+ - **Real-time Monitoring**: Track performance through Lemma dashboard
47
+ - **CrewAI Compatible**: Works with existing CrewAI patterns
48
+
49
+ ## Configuration
50
+
51
+ ```typescript
52
+ interface LemmaCrewConfig {
53
+ routerUrl: string; // WebSocket URL of Lemma router
54
+ agentId: string; // Unique agent identifier
55
+ role: string; // Agent role (CrewAI concept)
56
+ goal: string; // Agent goal
57
+ backstory?: string; // Agent backstory
58
+ capabilities?: string[]; // Agent capabilities
59
+ verbose?: boolean; // Enable verbose logging
60
+ allowDelegation?: boolean; // Allow task delegation
61
+ }
62
+ ```
63
+
64
+ ## Advanced Usage
65
+
66
+ ### Multi-Agent Crew
67
+
68
+ ```typescript
69
+ import { EngramCrew } from '@engram/crewai';
70
+
71
+ const crew = new EngramCrew({
72
+ routerUrl: 'ws://localhost:8080',
73
+ agents: [
74
+ {
75
+ agentId: 'researcher',
76
+ role: 'Researcher',
77
+ goal: 'Research information',
78
+ capabilities: ['research', 'web-search'],
79
+ },
80
+ {
81
+ agentId: 'writer',
82
+ role: 'Writer',
83
+ goal: 'Write compelling content',
84
+ capabilities: ['writing', 'editing'],
85
+ },
86
+ {
87
+ agentId: 'reviewer',
88
+ role: 'Reviewer',
89
+ goal: 'Review and improve content',
90
+ capabilities: ['review', 'quality-assurance'],
91
+ },
92
+ ],
93
+ });
94
+
95
+ await crew.connect();
96
+
97
+ // Execute a multi-step workflow
98
+ const result = await crew.kickoff({
99
+ task: 'Create a blog post about quantum computing',
100
+ process: 'sequential', // or 'hierarchical'
101
+ });
102
+
103
+ console.log(result);
104
+ ```
105
+
106
+ ### Task Delegation
107
+
108
+ ```typescript
109
+ const agent = new EngramCrewAgent({
110
+ routerUrl: 'ws://localhost:8080',
111
+ agentId: 'manager-agent',
112
+ role: 'Manager',
113
+ goal: 'Coordinate team tasks',
114
+ allowDelegation: true,
115
+ capabilities: ['management', 'coordination'],
116
+ });
117
+
118
+ await agent.connect();
119
+
120
+ // Agent can delegate subtasks to other agents
121
+ const result = await agent.execute({
122
+ description: 'Create a marketing campaign',
123
+ allowDelegation: true,
124
+ });
125
+ ```
126
+
127
+ ## Benefits
128
+
129
+ 1. **60-80% Cost Reduction**: Semantic caching eliminates redundant LLM calls
130
+ 2. **Sub-50ms Responses**: Cached results return instantly
131
+ 3. **Agent Discovery**: Automatically find capable agents for tasks
132
+ 4. **Centralized Monitoring**: Real-time visibility through dashboard
133
+ 5. **Fault Tolerance**: Auto-reconnection and error handling
134
+
135
+ ## Examples
136
+
137
+ ### Research Agent
138
+
139
+ ```typescript
140
+ const researcher = new EngramCrewAgent({
141
+ routerUrl: 'ws://localhost:8080',
142
+ agentId: 'researcher-001',
143
+ role: 'Senior Researcher',
144
+ goal: 'Conduct thorough research on any topic',
145
+ backstory: 'PhD in Computer Science with 10 years of research experience',
146
+ capabilities: ['research', 'analysis', 'fact-checking'],
147
+ });
148
+
149
+ await researcher.connect();
150
+
151
+ const findings = await researcher.execute({
152
+ description: 'Research the impact of AI on healthcare',
153
+ expectedOutput: 'Detailed research report with citations',
154
+ });
155
+ ```
156
+
157
+ ### Code Review Agent
158
+
159
+ ```typescript
160
+ const reviewer = new EngramCrewAgent({
161
+ routerUrl: 'ws://localhost:8080',
162
+ agentId: 'code-reviewer',
163
+ role: 'Senior Code Reviewer',
164
+ goal: 'Review code for quality and security',
165
+ capabilities: ['code-review', 'security-audit', 'best-practices'],
166
+ });
167
+
168
+ await reviewer.connect();
169
+
170
+ const review = await reviewer.execute({
171
+ description: 'Review this TypeScript code for issues',
172
+ context: { code: '...' },
173
+ });
174
+ ```
175
+
176
+ ## License
177
+
178
+ MIT
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Lemma Crew Configuration
3
+ */
4
+ export interface LemmaCrewConfig {
5
+ /** WebSocket URL of the Lemma router */
6
+ routerUrl: string;
7
+ /** Agent ID */
8
+ agentId: string;
9
+ /** Agent role (CrewAI concept) */
10
+ role: string;
11
+ /** Agent goal */
12
+ goal: string;
13
+ /** Agent backstory */
14
+ backstory?: string;
15
+ /** Capabilities this agent provides */
16
+ capabilities?: string[];
17
+ /** Enable verbose logging */
18
+ verbose?: boolean;
19
+ /** Allow task delegation */
20
+ allowDelegation?: boolean;
21
+ }
22
+ /**
23
+ * Task execution request
24
+ */
25
+ export interface TaskRequest {
26
+ description: string;
27
+ expectedOutput?: string;
28
+ context?: any;
29
+ allowDelegation?: boolean;
30
+ }
31
+ /**
32
+ * Task execution result
33
+ */
34
+ export interface TaskResult {
35
+ success: boolean;
36
+ output?: string;
37
+ error?: string;
38
+ executionTime: number;
39
+ cached?: boolean;
40
+ similarity?: number;
41
+ }
42
+ /**
43
+ * CrewAI Agent integrated with Lemma Router
44
+ */
45
+ export declare class LemmaCrewAgent {
46
+ private ws;
47
+ private config;
48
+ private connected;
49
+ private pendingTasks;
50
+ constructor(config: LemmaCrewConfig);
51
+ /**
52
+ * Connect to Lemma router
53
+ */
54
+ connect(): Promise<void>;
55
+ /**
56
+ * Disconnect from router
57
+ */
58
+ disconnect(): void;
59
+ /**
60
+ * Execute a task
61
+ */
62
+ execute(task: TaskRequest): Promise<TaskResult>;
63
+ /**
64
+ * Handle incoming message from router
65
+ */
66
+ private handleMessage;
67
+ /**
68
+ * Handle task assignment from router
69
+ */
70
+ private handleTaskAssign;
71
+ /**
72
+ * Handle task response from router
73
+ */
74
+ private handleTaskResponse;
75
+ /**
76
+ * Perform task (override in subclasses)
77
+ */
78
+ protected performTask(description: string, parameters: any): Promise<string>;
79
+ /**
80
+ * Send message to router
81
+ */
82
+ private send;
83
+ /**
84
+ * Log message if verbose
85
+ */
86
+ private log;
87
+ /**
88
+ * Get agent info
89
+ */
90
+ getInfo(): {
91
+ agentId: string;
92
+ role: string;
93
+ goal: string;
94
+ backstory: string;
95
+ capabilities: string[];
96
+ };
97
+ }
98
+ /**
99
+ * Lemma Crew - Multi-agent orchestration
100
+ */
101
+ export interface LemmaCrewOptions {
102
+ routerUrl: string;
103
+ agents: Omit<LemmaCrewConfig, 'routerUrl'>[];
104
+ verbose?: boolean;
105
+ }
106
+ export declare class LemmaCrew {
107
+ private agents;
108
+ private config;
109
+ constructor(config: LemmaCrewOptions);
110
+ /**
111
+ * Connect all agents
112
+ */
113
+ connect(): Promise<void>;
114
+ /**
115
+ * Disconnect all agents
116
+ */
117
+ disconnect(): void;
118
+ /**
119
+ * Execute a multi-agent workflow
120
+ */
121
+ kickoff(options: {
122
+ task: string;
123
+ process?: 'sequential' | 'hierarchical';
124
+ }): Promise<any>;
125
+ /**
126
+ * Get all agents
127
+ */
128
+ getAgents(): LemmaCrewAgent[];
129
+ }
130
+ export default LemmaCrewAgent;