@defai.digital/ax-cli 3.15.10 → 3.15.12

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 (63) hide show
  1. package/README.md +27 -2
  2. package/dist/agent/llm-agent.js +15 -2
  3. package/dist/agent/llm-agent.js.map +1 -1
  4. package/dist/analyzers/git/git-analyzer.js +17 -9
  5. package/dist/analyzers/git/git-analyzer.js.map +1 -1
  6. package/dist/commands/custom-commands.js +4 -2
  7. package/dist/commands/custom-commands.js.map +1 -1
  8. package/dist/commands/design.js +15 -4
  9. package/dist/commands/design.js.map +1 -1
  10. package/dist/commands/mcp.js +2 -2
  11. package/dist/commands/mcp.js.map +1 -1
  12. package/dist/commands/memory.js +6 -4
  13. package/dist/commands/memory.js.map +1 -1
  14. package/dist/design/figma-tokens.js +3 -1
  15. package/dist/design/figma-tokens.js.map +1 -1
  16. package/dist/mcp/client-v2.js +14 -10
  17. package/dist/mcp/client-v2.js.map +1 -1
  18. package/dist/mcp/config-migrator.js +2 -2
  19. package/dist/mcp/config-migrator.js.map +1 -1
  20. package/dist/mcp/constants.d.ts +66 -0
  21. package/dist/mcp/constants.js +85 -0
  22. package/dist/mcp/constants.js.map +1 -0
  23. package/dist/mcp/content-length-transport.d.ts +2 -0
  24. package/dist/mcp/content-length-transport.js +18 -1
  25. package/dist/mcp/content-length-transport.js.map +1 -1
  26. package/dist/mcp/error-formatter.js +15 -218
  27. package/dist/mcp/error-formatter.js.map +1 -1
  28. package/dist/mcp/error-remediation.d.ts +45 -0
  29. package/dist/mcp/error-remediation.js +254 -0
  30. package/dist/mcp/error-remediation.js.map +1 -0
  31. package/dist/mcp/index.d.ts +16 -5
  32. package/dist/mcp/index.js +48 -17
  33. package/dist/mcp/index.js.map +1 -1
  34. package/dist/mcp/resources.js +2 -2
  35. package/dist/mcp/resources.js.map +1 -1
  36. package/dist/mcp/ssrf-protection.js +1 -1
  37. package/dist/mcp/ssrf-protection.js.map +1 -1
  38. package/dist/mcp/templates.js +2 -2
  39. package/dist/mcp/templates.js.map +1 -1
  40. package/dist/mcp/type-safety.d.ts +5 -0
  41. package/dist/mcp/type-safety.js +8 -1
  42. package/dist/mcp/type-safety.js.map +1 -1
  43. package/dist/schemas/settings-schemas.d.ts +2 -2
  44. package/dist/sdk/testing.js +14 -4
  45. package/dist/sdk/testing.js.map +1 -1
  46. package/dist/tools/design-tool.js +7 -3
  47. package/dist/tools/design-tool.js.map +1 -1
  48. package/dist/ui/components/chat-interface.js +29 -1
  49. package/dist/ui/components/chat-interface.js.map +1 -1
  50. package/dist/ui/components/status-bar.d.ts +2 -0
  51. package/dist/ui/components/status-bar.js +25 -15
  52. package/dist/ui/components/status-bar.js.map +1 -1
  53. package/dist/ui/hooks/use-enhanced-input.js +5 -5
  54. package/dist/ui/hooks/use-enhanced-input.js.map +1 -1
  55. package/dist/utils/audit-logger.js +1 -1
  56. package/dist/utils/audit-logger.js.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/mcp/client-mutex-patch.d.ts +0 -36
  59. package/dist/mcp/client-mutex-patch.js +0 -75
  60. package/dist/mcp/client-mutex-patch.js.map +0 -1
  61. package/dist/mcp/mutex.d.ts +0 -71
  62. package/dist/mcp/mutex.js +0 -137
  63. package/dist/mcp/mutex.js.map +0 -1
@@ -1,36 +0,0 @@
1
- /**
2
- * Mutex-Protected MCP Client Patch
3
- *
4
- * This file contains the mutex-protected version of addServer() method
5
- * to be integrated into MCPManager class in client.ts
6
- *
7
- * INTEGRATION INSTRUCTIONS:
8
- * 1. Add import: import { KeyedMutex } from "./mutex.js";
9
- * 2. Add field: private connectionMutex = new KeyedMutex();
10
- * 3. Replace addServer() method with the version below
11
- * 4. Add mutex cleanup to dispose() method
12
- */
13
- /**
14
- * Benefits of Mutex Protection:
15
- *
16
- * 1. Race Condition Prevention:
17
- * - Multiple concurrent addServer() calls for same server
18
- * - Multi-agent AutomatosX setups calling ensureServersInitialized()
19
- * - Duplicate connections from parallel initialization
20
- *
21
- * 2. Resource Protection:
22
- * - Prevents duplicate client instances
23
- * - Avoids wasted file descriptors/memory
24
- * - Ensures clean state transitions
25
- *
26
- * 3. Thread Safety:
27
- * - Atomic check-and-set operations
28
- * - No TOCTOU (Time-Of-Check-Time-Of-Use) bugs
29
- * - Guaranteed sequential execution per server
30
- *
31
- * Performance Impact: Negligible
32
- * - Mutex only blocks same-server connections
33
- * - Different servers connect in parallel
34
- * - Minimal overhead (~microseconds per acquire/release)
35
- */
36
- export declare const MUTEX_INTEGRATION_COMPLETE = false;
@@ -1,75 +0,0 @@
1
- /**
2
- * Mutex-Protected MCP Client Patch
3
- *
4
- * This file contains the mutex-protected version of addServer() method
5
- * to be integrated into MCPManager class in client.ts
6
- *
7
- * INTEGRATION INSTRUCTIONS:
8
- * 1. Add import: import { KeyedMutex } from "./mutex.js";
9
- * 2. Add field: private connectionMutex = new KeyedMutex();
10
- * 3. Replace addServer() method with the version below
11
- * 4. Add mutex cleanup to dispose() method
12
- */
13
- // STEP 1: Add to imports (line 8)
14
- // import { KeyedMutex } from "./mutex.js";
15
- // STEP 2: Add to MCPManager class fields (after line 26)
16
- // private connectionMutex = new KeyedMutex(); // Mutex for thread-safe connections
17
- // STEP 3: Replace addServer() method (lines 28-50)
18
- /*
19
- async addServer(config: MCPServerConfig): Promise<void> {
20
- // Use mutex to ensure atomic check-and-connect operation
21
- // This prevents race conditions when multiple parts of the system
22
- // try to connect to the same server simultaneously
23
- return await this.connectionMutex.runExclusive(config.name, async () => {
24
- // Check if already connected (now protected by mutex)
25
- if (this.clients.has(config.name)) {
26
- return; // Already connected, nothing to do
27
- }
28
-
29
- // Check if already connecting (now protected by mutex)
30
- const pending = this.pendingConnections.get(config.name);
31
- if (pending) {
32
- await pending; // Wait for the connection to complete
33
- return;
34
- }
35
-
36
- // Create a promise for this connection attempt
37
- const connectionPromise = this._addServerInternal(config);
38
- this.pendingConnections.set(config.name, connectionPromise);
39
-
40
- try {
41
- await connectionPromise;
42
- } finally {
43
- this.pendingConnections.delete(config.name);
44
- }
45
- });
46
- }
47
- */
48
- // STEP 4: Add to dispose() method (before removeAllListeners())
49
- // // Cleanup mutex state
50
- // this.connectionMutex.clearAll();
51
- /**
52
- * Benefits of Mutex Protection:
53
- *
54
- * 1. Race Condition Prevention:
55
- * - Multiple concurrent addServer() calls for same server
56
- * - Multi-agent AutomatosX setups calling ensureServersInitialized()
57
- * - Duplicate connections from parallel initialization
58
- *
59
- * 2. Resource Protection:
60
- * - Prevents duplicate client instances
61
- * - Avoids wasted file descriptors/memory
62
- * - Ensures clean state transitions
63
- *
64
- * 3. Thread Safety:
65
- * - Atomic check-and-set operations
66
- * - No TOCTOU (Time-Of-Check-Time-Of-Use) bugs
67
- * - Guaranteed sequential execution per server
68
- *
69
- * Performance Impact: Negligible
70
- * - Mutex only blocks same-server connections
71
- * - Different servers connect in parallel
72
- * - Minimal overhead (~microseconds per acquire/release)
73
- */
74
- export const MUTEX_INTEGRATION_COMPLETE = false; // Set to true after integration
75
- //# sourceMappingURL=client-mutex-patch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-mutex-patch.js","sourceRoot":"","sources":["../../src/mcp/client-mutex-patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,kCAAkC;AAClC,2CAA2C;AAE3C,yDAAyD;AACzD,mFAAmF;AAEnF,mDAAmD;AACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE;AAEF,gEAAgE;AAChE,yBAAyB;AACzB,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,CAAC,gCAAgC"}
@@ -1,71 +0,0 @@
1
- /**
2
- * Simple Mutex Implementation
3
- *
4
- * Provides mutual exclusion for async operations without external dependencies.
5
- * Prevents race conditions in concurrent operations.
6
- */
7
- /**
8
- * Simple mutex for protecting critical sections
9
- */
10
- export declare class Mutex {
11
- private locked;
12
- private queue;
13
- /**
14
- * Acquire the mutex lock
15
- * Returns a release function that must be called when done
16
- */
17
- acquire(): Promise<() => void>;
18
- /**
19
- * Release the mutex lock
20
- */
21
- private release;
22
- /**
23
- * Execute a function with mutex protection
24
- */
25
- runExclusive<T>(fn: () => Promise<T>): Promise<T>;
26
- /**
27
- * Check if mutex is currently locked
28
- */
29
- isLocked(): boolean;
30
- /**
31
- * Get number of operations waiting for mutex
32
- */
33
- getQueueLength(): number;
34
- }
35
- /**
36
- * Per-key mutex manager
37
- * Allows separate mutexes for different keys (e.g., different server names)
38
- */
39
- export declare class KeyedMutex {
40
- private mutexes;
41
- /** Get or create mutex for a key */
42
- private getMutex;
43
- /**
44
- * Acquire mutex for a specific key
45
- */
46
- acquire(key: string): Promise<() => void>;
47
- /**
48
- * Execute function with mutex protection for a specific key
49
- */
50
- runExclusive<T>(key: string, fn: () => Promise<T>): Promise<T>;
51
- /**
52
- * Check if a key is currently locked
53
- */
54
- isLocked(key: string): boolean;
55
- /**
56
- * Get number of operations waiting for a key
57
- */
58
- getQueueLength(key: string): number;
59
- /**
60
- * Clear mutex for a key (cleanup)
61
- */
62
- clear(key: string): void;
63
- /**
64
- * Clear all mutexes (cleanup)
65
- */
66
- clearAll(): void;
67
- /**
68
- * Get all active keys
69
- */
70
- getKeys(): string[];
71
- }
package/dist/mcp/mutex.js DELETED
@@ -1,137 +0,0 @@
1
- /**
2
- * Simple Mutex Implementation
3
- *
4
- * Provides mutual exclusion for async operations without external dependencies.
5
- * Prevents race conditions in concurrent operations.
6
- */
7
- /**
8
- * Simple mutex for protecting critical sections
9
- */
10
- export class Mutex {
11
- locked = false;
12
- queue = [];
13
- /**
14
- * Acquire the mutex lock
15
- * Returns a release function that must be called when done
16
- */
17
- async acquire() {
18
- // BUG FIX: Use a loop to handle the race condition where another caller
19
- // could acquire the lock between our queue notification and lock acquisition.
20
- // This implements a proper "test-and-set" pattern for async mutexes.
21
- while (this.locked) {
22
- await new Promise(resolve => {
23
- this.queue.push(resolve);
24
- });
25
- // After being notified, re-check if lock is available
26
- // Another waiter might have been notified simultaneously
27
- }
28
- // Acquire lock
29
- this.locked = true;
30
- // Return release function
31
- return () => {
32
- this.release();
33
- };
34
- }
35
- /**
36
- * Release the mutex lock
37
- */
38
- release() {
39
- // BUG FIX: Release lock AFTER notifying next waiter to prevent
40
- // new callers from sneaking in before queued waiters.
41
- // Get next waiter first while still holding the lock.
42
- const next = this.queue.shift();
43
- // Now release the lock
44
- this.locked = false;
45
- // Notify next waiting operation (they will re-acquire in their loop)
46
- if (next) {
47
- next();
48
- }
49
- }
50
- /**
51
- * Execute a function with mutex protection
52
- */
53
- async runExclusive(fn) {
54
- const release = await this.acquire();
55
- try {
56
- return await fn();
57
- }
58
- finally {
59
- release();
60
- }
61
- }
62
- /**
63
- * Check if mutex is currently locked
64
- */
65
- isLocked() {
66
- return this.locked;
67
- }
68
- /**
69
- * Get number of operations waiting for mutex
70
- */
71
- getQueueLength() {
72
- return this.queue.length;
73
- }
74
- }
75
- /**
76
- * Per-key mutex manager
77
- * Allows separate mutexes for different keys (e.g., different server names)
78
- */
79
- export class KeyedMutex {
80
- mutexes = new Map();
81
- /** Get or create mutex for a key */
82
- getMutex(key) {
83
- const existing = this.mutexes.get(key);
84
- if (existing)
85
- return existing;
86
- const mutex = new Mutex();
87
- this.mutexes.set(key, mutex);
88
- return mutex;
89
- }
90
- /**
91
- * Acquire mutex for a specific key
92
- */
93
- async acquire(key) {
94
- const mutex = this.getMutex(key);
95
- return await mutex.acquire();
96
- }
97
- /**
98
- * Execute function with mutex protection for a specific key
99
- */
100
- async runExclusive(key, fn) {
101
- const mutex = this.getMutex(key);
102
- return await mutex.runExclusive(fn);
103
- }
104
- /**
105
- * Check if a key is currently locked
106
- */
107
- isLocked(key) {
108
- const mutex = this.mutexes.get(key);
109
- return mutex ? mutex.isLocked() : false;
110
- }
111
- /**
112
- * Get number of operations waiting for a key
113
- */
114
- getQueueLength(key) {
115
- const mutex = this.mutexes.get(key);
116
- return mutex ? mutex.getQueueLength() : 0;
117
- }
118
- /**
119
- * Clear mutex for a key (cleanup)
120
- */
121
- clear(key) {
122
- this.mutexes.delete(key);
123
- }
124
- /**
125
- * Clear all mutexes (cleanup)
126
- */
127
- clearAll() {
128
- this.mutexes.clear();
129
- }
130
- /**
131
- * Get all active keys
132
- */
133
- getKeys() {
134
- return Array.from(this.mutexes.keys());
135
- }
136
- }
137
- //# sourceMappingURL=mutex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutex.js","sourceRoot":"","sources":["../../src/mcp/mutex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,OAAO,KAAK;IACR,MAAM,GAAG,KAAK,CAAC;IACf,KAAK,GAAsB,EAAE,CAAC;IAEtC;;;OAGG;IACH,KAAK,CAAC,OAAO;QACX,wEAAwE;QACxE,8EAA8E;QAC9E,qEAAqE;QACrE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;gBAChC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YACH,sDAAsD;YACtD,yDAAyD;QAC3D,CAAC;QAED,eAAe;QACf,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,0BAA0B;QAC1B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,OAAO;QACb,+DAA+D;QAC/D,sDAAsD;QACtD,sDAAsD;QACtD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAEhC,uBAAuB;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,qEAAqE;QACrE,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;QACT,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CA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