@lanonasis/cli 3.6.5 → 3.7.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.
- package/README.md +19 -2
- package/dist/commands/api-keys.d.ts +2 -1
- package/dist/commands/api-keys.js +73 -78
- package/dist/commands/auth.js +244 -177
- package/dist/commands/completion.js +31 -39
- package/dist/commands/config.js +162 -201
- package/dist/commands/enhanced-memory.js +11 -17
- package/dist/commands/guide.js +79 -88
- package/dist/commands/init.js +14 -20
- package/dist/commands/mcp.d.ts +10 -0
- package/dist/commands/mcp.js +215 -156
- package/dist/commands/memory.js +77 -83
- package/dist/commands/organization.js +15 -21
- package/dist/commands/topics.js +52 -58
- package/dist/core/achievements.js +19 -26
- package/dist/core/architecture.js +42 -59
- package/dist/core/dashboard.js +71 -81
- package/dist/core/error-handler.js +30 -39
- package/dist/core/power-mode.js +46 -53
- package/dist/core/progress.js +35 -44
- package/dist/core/welcome.js +56 -64
- package/dist/enhanced-cli.js +49 -58
- package/dist/index-simple.js +75 -113
- package/dist/index.js +64 -69
- package/dist/mcp/access-control.js +13 -17
- package/dist/mcp/client/enhanced-client.js +17 -28
- package/dist/mcp/enhanced-server.js +10 -14
- package/dist/mcp/logger.js +3 -7
- package/dist/mcp/memory-state.js +13 -17
- package/dist/mcp/schemas/tool-schemas.d.ts +16 -16
- package/dist/mcp/schemas/tool-schemas.js +122 -126
- package/dist/mcp/server/lanonasis-server.js +66 -57
- package/dist/mcp/transports/transport-manager.js +18 -25
- package/dist/mcp/vector-store.js +6 -10
- package/dist/mcp-server.js +23 -27
- package/dist/utils/api.js +21 -27
- package/dist/utils/config.d.ts +2 -1
- package/dist/utils/config.js +65 -78
- package/dist/utils/formatting.js +6 -14
- package/dist/utils/hash-utils.d.ts +23 -0
- package/dist/utils/hash-utils.js +37 -0
- package/dist/utils/mcp-client.js +76 -117
- package/package.json +36 -5
package/dist/mcp/memory-state.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Memory State Management System
|
|
4
3
|
* Implements comprehensive memory lifecycle management inspired by mem0's state system
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const logger_js_1 = require("./logger.js");
|
|
10
|
-
var MemoryState;
|
|
5
|
+
import { CLIConfig } from '../utils/config.js';
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
export var MemoryState;
|
|
11
8
|
(function (MemoryState) {
|
|
12
9
|
MemoryState["ACTIVE"] = "active";
|
|
13
10
|
MemoryState["PAUSED"] = "paused";
|
|
14
11
|
MemoryState["ARCHIVED"] = "archived";
|
|
15
12
|
MemoryState["DELETED"] = "deleted";
|
|
16
|
-
})(MemoryState || (
|
|
17
|
-
class MemoryStateManager {
|
|
13
|
+
})(MemoryState || (MemoryState = {}));
|
|
14
|
+
export class MemoryStateManager {
|
|
18
15
|
config;
|
|
19
16
|
stateTransitions = [];
|
|
20
17
|
constructor() {
|
|
21
|
-
this.config = new
|
|
18
|
+
this.config = new CLIConfig();
|
|
22
19
|
}
|
|
23
20
|
async initialize() {
|
|
24
|
-
|
|
21
|
+
logger.info('Memory State Manager initialized');
|
|
25
22
|
}
|
|
26
23
|
/**
|
|
27
24
|
* Update memory state with validation and history tracking
|
|
@@ -62,7 +59,7 @@ class MemoryStateManager {
|
|
|
62
59
|
});
|
|
63
60
|
// Record transition
|
|
64
61
|
this.stateTransitions.push(transition);
|
|
65
|
-
|
|
62
|
+
logger.info('Memory state updated', {
|
|
66
63
|
memoryId,
|
|
67
64
|
fromState: currentState,
|
|
68
65
|
toState: newState,
|
|
@@ -71,7 +68,7 @@ class MemoryStateManager {
|
|
|
71
68
|
return transition;
|
|
72
69
|
}
|
|
73
70
|
catch (error) {
|
|
74
|
-
|
|
71
|
+
logger.error('Failed to update memory state', { error, memoryId, newState });
|
|
75
72
|
throw error;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
@@ -124,7 +121,7 @@ class MemoryStateManager {
|
|
|
124
121
|
});
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
|
-
|
|
124
|
+
logger.info('Bulk state update completed', {
|
|
128
125
|
operation,
|
|
129
126
|
totalMemories: memoryIds.length,
|
|
130
127
|
successful: results.filter(r => r.success).length,
|
|
@@ -155,7 +152,7 @@ class MemoryStateManager {
|
|
|
155
152
|
return memories.memories || [];
|
|
156
153
|
}
|
|
157
154
|
catch (error) {
|
|
158
|
-
|
|
155
|
+
logger.error('Failed to get memories by state', { error, state, userId, appId });
|
|
159
156
|
return [];
|
|
160
157
|
}
|
|
161
158
|
}
|
|
@@ -179,7 +176,7 @@ class MemoryStateManager {
|
|
|
179
176
|
return await this.bulkUpdateState(memoryIds, 'archive');
|
|
180
177
|
}
|
|
181
178
|
catch (error) {
|
|
182
|
-
|
|
179
|
+
logger.error('Failed to archive old memories', { error, beforeDate, userId, appId });
|
|
183
180
|
return [];
|
|
184
181
|
}
|
|
185
182
|
}
|
|
@@ -263,7 +260,7 @@ class MemoryStateManager {
|
|
|
263
260
|
return response;
|
|
264
261
|
}
|
|
265
262
|
catch (error) {
|
|
266
|
-
|
|
263
|
+
logger.error('Failed to get memory', { error, memoryId });
|
|
267
264
|
return null;
|
|
268
265
|
}
|
|
269
266
|
}
|
|
@@ -302,4 +299,3 @@ class MemoryStateManager {
|
|
|
302
299
|
return `transition_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
303
300
|
}
|
|
304
301
|
}
|
|
305
|
-
exports.MemoryStateManager = MemoryStateManager;
|
|
@@ -112,14 +112,14 @@ export declare const TopicCreateSchema: z.ZodObject<{
|
|
|
112
112
|
icon: z.ZodOptional<z.ZodString>;
|
|
113
113
|
}, "strip", z.ZodTypeAny, {
|
|
114
114
|
name?: string;
|
|
115
|
-
description?: string;
|
|
116
115
|
color?: string;
|
|
116
|
+
description?: string;
|
|
117
117
|
icon?: string;
|
|
118
118
|
parent_id?: string;
|
|
119
119
|
}, {
|
|
120
120
|
name?: string;
|
|
121
|
-
description?: string;
|
|
122
121
|
color?: string;
|
|
122
|
+
description?: string;
|
|
123
123
|
icon?: string;
|
|
124
124
|
parent_id?: string;
|
|
125
125
|
}>;
|
|
@@ -132,16 +132,16 @@ export declare const TopicUpdateSchema: z.ZodObject<{
|
|
|
132
132
|
icon: z.ZodOptional<z.ZodString>;
|
|
133
133
|
}, "strip", z.ZodTypeAny, {
|
|
134
134
|
name?: string;
|
|
135
|
+
color?: string;
|
|
135
136
|
topic_id?: string;
|
|
136
137
|
description?: string;
|
|
137
|
-
color?: string;
|
|
138
138
|
icon?: string;
|
|
139
139
|
parent_id?: string;
|
|
140
140
|
}, {
|
|
141
141
|
name?: string;
|
|
142
|
+
color?: string;
|
|
142
143
|
topic_id?: string;
|
|
143
144
|
description?: string;
|
|
144
|
-
color?: string;
|
|
145
145
|
icon?: string;
|
|
146
146
|
parent_id?: string;
|
|
147
147
|
}>;
|
|
@@ -201,12 +201,12 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
201
201
|
scope: z.ZodDefault<z.ZodEnum<["user", "global"]>>;
|
|
202
202
|
}, "strip", z.ZodTypeAny, {
|
|
203
203
|
value?: any;
|
|
204
|
-
action?: "get" | "
|
|
204
|
+
action?: "get" | "set" | "reset";
|
|
205
205
|
scope?: "user" | "global";
|
|
206
206
|
key?: string;
|
|
207
207
|
}, {
|
|
208
208
|
value?: any;
|
|
209
|
-
action?: "get" | "
|
|
209
|
+
action?: "get" | "set" | "reset";
|
|
210
210
|
scope?: "user" | "global";
|
|
211
211
|
key?: string;
|
|
212
212
|
}>;
|
|
@@ -253,14 +253,14 @@ export declare const ToolExecutionSchema: z.ZodObject<{
|
|
|
253
253
|
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
254
254
|
}, "strip", z.ZodTypeAny, {
|
|
255
255
|
timeout?: number;
|
|
256
|
-
tool_name?: string;
|
|
257
256
|
arguments?: Record<string, any>;
|
|
257
|
+
tool_name?: string;
|
|
258
258
|
retry_on_failure?: boolean;
|
|
259
259
|
max_retries?: number;
|
|
260
260
|
}, {
|
|
261
261
|
timeout?: number;
|
|
262
|
-
tool_name?: string;
|
|
263
262
|
arguments?: Record<string, any>;
|
|
263
|
+
tool_name?: string;
|
|
264
264
|
retry_on_failure?: boolean;
|
|
265
265
|
max_retries?: number;
|
|
266
266
|
}>;
|
|
@@ -486,14 +486,14 @@ export declare const MCPSchemas: {
|
|
|
486
486
|
icon: z.ZodOptional<z.ZodString>;
|
|
487
487
|
}, "strip", z.ZodTypeAny, {
|
|
488
488
|
name?: string;
|
|
489
|
-
description?: string;
|
|
490
489
|
color?: string;
|
|
490
|
+
description?: string;
|
|
491
491
|
icon?: string;
|
|
492
492
|
parent_id?: string;
|
|
493
493
|
}, {
|
|
494
494
|
name?: string;
|
|
495
|
-
description?: string;
|
|
496
495
|
color?: string;
|
|
496
|
+
description?: string;
|
|
497
497
|
icon?: string;
|
|
498
498
|
parent_id?: string;
|
|
499
499
|
}>;
|
|
@@ -506,16 +506,16 @@ export declare const MCPSchemas: {
|
|
|
506
506
|
icon: z.ZodOptional<z.ZodString>;
|
|
507
507
|
}, "strip", z.ZodTypeAny, {
|
|
508
508
|
name?: string;
|
|
509
|
+
color?: string;
|
|
509
510
|
topic_id?: string;
|
|
510
511
|
description?: string;
|
|
511
|
-
color?: string;
|
|
512
512
|
icon?: string;
|
|
513
513
|
parent_id?: string;
|
|
514
514
|
}, {
|
|
515
515
|
name?: string;
|
|
516
|
+
color?: string;
|
|
516
517
|
topic_id?: string;
|
|
517
518
|
description?: string;
|
|
518
|
-
color?: string;
|
|
519
519
|
icon?: string;
|
|
520
520
|
parent_id?: string;
|
|
521
521
|
}>;
|
|
@@ -579,12 +579,12 @@ export declare const MCPSchemas: {
|
|
|
579
579
|
scope: z.ZodDefault<z.ZodEnum<["user", "global"]>>;
|
|
580
580
|
}, "strip", z.ZodTypeAny, {
|
|
581
581
|
value?: any;
|
|
582
|
-
action?: "get" | "
|
|
582
|
+
action?: "get" | "set" | "reset";
|
|
583
583
|
scope?: "user" | "global";
|
|
584
584
|
key?: string;
|
|
585
585
|
}, {
|
|
586
586
|
value?: any;
|
|
587
|
-
action?: "get" | "
|
|
587
|
+
action?: "get" | "set" | "reset";
|
|
588
588
|
scope?: "user" | "global";
|
|
589
589
|
key?: string;
|
|
590
590
|
}>;
|
|
@@ -633,14 +633,14 @@ export declare const MCPSchemas: {
|
|
|
633
633
|
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
634
634
|
}, "strip", z.ZodTypeAny, {
|
|
635
635
|
timeout?: number;
|
|
636
|
-
tool_name?: string;
|
|
637
636
|
arguments?: Record<string, any>;
|
|
637
|
+
tool_name?: string;
|
|
638
638
|
retry_on_failure?: boolean;
|
|
639
639
|
max_retries?: number;
|
|
640
640
|
}, {
|
|
641
641
|
timeout?: number;
|
|
642
|
-
tool_name?: string;
|
|
643
642
|
arguments?: Record<string, any>;
|
|
643
|
+
tool_name?: string;
|
|
644
644
|
retry_on_failure?: boolean;
|
|
645
645
|
max_retries?: number;
|
|
646
646
|
}>;
|