@lanonasis/cli 3.6.5 → 3.6.7

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 (40) hide show
  1. package/dist/commands/api-keys.d.ts +2 -1
  2. package/dist/commands/api-keys.js +73 -78
  3. package/dist/commands/auth.js +160 -167
  4. package/dist/commands/completion.js +31 -39
  5. package/dist/commands/config.js +162 -201
  6. package/dist/commands/enhanced-memory.js +11 -17
  7. package/dist/commands/guide.js +79 -88
  8. package/dist/commands/init.js +14 -20
  9. package/dist/commands/mcp.d.ts +10 -0
  10. package/dist/commands/mcp.js +167 -156
  11. package/dist/commands/memory.js +77 -83
  12. package/dist/commands/organization.js +15 -21
  13. package/dist/commands/topics.js +52 -58
  14. package/dist/core/achievements.js +19 -26
  15. package/dist/core/architecture.js +42 -59
  16. package/dist/core/dashboard.js +71 -81
  17. package/dist/core/error-handler.js +30 -39
  18. package/dist/core/power-mode.js +46 -53
  19. package/dist/core/progress.js +35 -44
  20. package/dist/core/welcome.js +56 -64
  21. package/dist/enhanced-cli.js +49 -58
  22. package/dist/index-simple.js +75 -113
  23. package/dist/index.js +64 -69
  24. package/dist/mcp/access-control.js +13 -17
  25. package/dist/mcp/client/enhanced-client.js +16 -23
  26. package/dist/mcp/enhanced-server.js +10 -14
  27. package/dist/mcp/logger.js +3 -7
  28. package/dist/mcp/memory-state.js +13 -17
  29. package/dist/mcp/schemas/tool-schemas.d.ts +16 -16
  30. package/dist/mcp/schemas/tool-schemas.js +122 -126
  31. package/dist/mcp/server/lanonasis-server.js +66 -57
  32. package/dist/mcp/transports/transport-manager.js +18 -25
  33. package/dist/mcp/vector-store.js +6 -10
  34. package/dist/mcp-server.js +23 -27
  35. package/dist/utils/api.js +19 -26
  36. package/dist/utils/config.d.ts +2 -1
  37. package/dist/utils/config.js +65 -78
  38. package/dist/utils/formatting.js +6 -14
  39. package/dist/utils/mcp-client.js +76 -117
  40. package/package.json +36 -5
@@ -1,275 +1,272 @@
1
- "use strict";
2
1
  /**
3
2
  * MCP Tool Schema Definitions
4
3
  * Provides Zod-based validation for all MCP tools
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MCPSchemas = exports.SchemaValidator = exports.ErrorResponseSchema = exports.SuccessResponseSchema = exports.ToolExecutionSchema = exports.ImportExportSchema = exports.BulkOperationSchema = exports.SystemConfigSchema = exports.SystemHealthSchema = exports.ApiKeyRevokeSchema = exports.ApiKeyCreateSchema = exports.TopicListSchema = exports.TopicUpdateSchema = exports.TopicCreateSchema = exports.MemoryListSchema = exports.MemoryDeleteSchema = exports.MemoryUpdateSchema = exports.MemorySearchSchema = exports.MemoryCreateSchema = void 0;
8
- const zod_1 = require("zod");
5
+ import { z } from 'zod';
9
6
  // Memory schemas
10
- exports.MemoryCreateSchema = zod_1.z.object({
11
- title: zod_1.z.string()
7
+ export const MemoryCreateSchema = z.object({
8
+ title: z.string()
12
9
  .min(1, 'Title is required')
13
10
  .max(200, 'Title must be less than 200 characters')
14
11
  .describe("Memory title"),
15
- content: zod_1.z.string()
12
+ content: z.string()
16
13
  .min(1, 'Content is required')
17
14
  .describe("Memory content"),
18
- memory_type: zod_1.z.enum(["context", "reference", "note"])
15
+ memory_type: z.enum(["context", "reference", "note"])
19
16
  .default("context")
20
17
  .describe("Type of memory"),
21
- tags: zod_1.z.array(zod_1.z.string())
18
+ tags: z.array(z.string())
22
19
  .optional()
23
20
  .describe("Optional tags for categorization"),
24
- topic_id: zod_1.z.string()
21
+ topic_id: z.string()
25
22
  .uuid()
26
23
  .optional()
27
24
  .describe("Optional topic ID for organization"),
28
- metadata: zod_1.z.record(zod_1.z.any())
25
+ metadata: z.record(z.any())
29
26
  .optional()
30
27
  .describe("Additional metadata")
31
28
  });
32
- exports.MemorySearchSchema = zod_1.z.object({
33
- query: zod_1.z.string()
29
+ export const MemorySearchSchema = z.object({
30
+ query: z.string()
34
31
  .min(1, 'Search query is required')
35
32
  .describe("Search query for semantic search"),
36
- limit: zod_1.z.number()
33
+ limit: z.number()
37
34
  .int()
38
35
  .positive()
39
36
  .max(100)
40
37
  .default(10)
41
38
  .describe("Maximum number of results"),
42
- threshold: zod_1.z.number()
39
+ threshold: z.number()
43
40
  .min(0)
44
41
  .max(1)
45
42
  .default(0.7)
46
43
  .describe("Similarity threshold (0-1)"),
47
- topic_id: zod_1.z.string()
44
+ topic_id: z.string()
48
45
  .uuid()
49
46
  .optional()
50
47
  .describe("Filter by topic ID"),
51
- tags: zod_1.z.array(zod_1.z.string())
48
+ tags: z.array(z.string())
52
49
  .optional()
53
50
  .describe("Filter by tags"),
54
- memory_type: zod_1.z.enum(["context", "reference", "note"])
51
+ memory_type: z.enum(["context", "reference", "note"])
55
52
  .optional()
56
53
  .describe("Filter by memory type")
57
54
  });
58
- exports.MemoryUpdateSchema = zod_1.z.object({
59
- memory_id: zod_1.z.string()
55
+ export const MemoryUpdateSchema = z.object({
56
+ memory_id: z.string()
60
57
  .uuid()
61
58
  .describe("Memory ID to update"),
62
- title: zod_1.z.string()
59
+ title: z.string()
63
60
  .min(1)
64
61
  .max(200)
65
62
  .optional()
66
63
  .describe("New title"),
67
- content: zod_1.z.string()
64
+ content: z.string()
68
65
  .min(1)
69
66
  .optional()
70
67
  .describe("New content"),
71
- memory_type: zod_1.z.enum(["context", "reference", "note"])
68
+ memory_type: z.enum(["context", "reference", "note"])
72
69
  .optional()
73
70
  .describe("New memory type"),
74
- tags: zod_1.z.array(zod_1.z.string())
71
+ tags: z.array(z.string())
75
72
  .optional()
76
73
  .describe("New tags (replaces existing)"),
77
- metadata: zod_1.z.record(zod_1.z.any())
74
+ metadata: z.record(z.any())
78
75
  .optional()
79
76
  .describe("New metadata (merges with existing)")
80
77
  });
81
- exports.MemoryDeleteSchema = zod_1.z.object({
82
- memory_id: zod_1.z.string()
78
+ export const MemoryDeleteSchema = z.object({
79
+ memory_id: z.string()
83
80
  .uuid()
84
81
  .describe("Memory ID to delete"),
85
- confirm: zod_1.z.boolean()
82
+ confirm: z.boolean()
86
83
  .default(false)
87
84
  .describe("Confirmation flag for deletion")
88
85
  });
89
- exports.MemoryListSchema = zod_1.z.object({
90
- limit: zod_1.z.number()
86
+ export const MemoryListSchema = z.object({
87
+ limit: z.number()
91
88
  .int()
92
89
  .positive()
93
90
  .max(100)
94
91
  .default(20)
95
92
  .describe("Maximum number of results"),
96
- offset: zod_1.z.number()
93
+ offset: z.number()
97
94
  .int()
98
95
  .min(0)
99
96
  .default(0)
100
97
  .describe("Pagination offset"),
101
- topic_id: zod_1.z.string()
98
+ topic_id: z.string()
102
99
  .uuid()
103
100
  .optional()
104
101
  .describe("Filter by topic ID"),
105
- tags: zod_1.z.array(zod_1.z.string())
102
+ tags: z.array(z.string())
106
103
  .optional()
107
104
  .describe("Filter by tags"),
108
- memory_type: zod_1.z.enum(["context", "reference", "note"])
105
+ memory_type: z.enum(["context", "reference", "note"])
109
106
  .optional()
110
107
  .describe("Filter by memory type"),
111
- sort_by: zod_1.z.enum(["created_at", "updated_at", "title"])
108
+ sort_by: z.enum(["created_at", "updated_at", "title"])
112
109
  .default("created_at")
113
110
  .describe("Sort field"),
114
- order: zod_1.z.enum(["asc", "desc"])
111
+ order: z.enum(["asc", "desc"])
115
112
  .default("desc")
116
113
  .describe("Sort order")
117
114
  });
118
115
  // Topic schemas
119
- exports.TopicCreateSchema = zod_1.z.object({
120
- name: zod_1.z.string()
116
+ export const TopicCreateSchema = z.object({
117
+ name: z.string()
121
118
  .min(1, 'Topic name is required')
122
119
  .max(100, 'Topic name must be less than 100 characters')
123
120
  .describe("Topic name"),
124
- description: zod_1.z.string()
121
+ description: z.string()
125
122
  .max(500)
126
123
  .optional()
127
124
  .describe("Topic description"),
128
- parent_id: zod_1.z.string()
125
+ parent_id: z.string()
129
126
  .uuid()
130
127
  .optional()
131
128
  .describe("Parent topic ID for nesting"),
132
- color: zod_1.z.string()
129
+ color: z.string()
133
130
  .regex(/^#[0-9A-Fa-f]{6}$/)
134
131
  .optional()
135
132
  .describe("Topic color in hex format"),
136
- icon: zod_1.z.string()
133
+ icon: z.string()
137
134
  .optional()
138
135
  .describe("Topic icon identifier")
139
136
  });
140
- exports.TopicUpdateSchema = zod_1.z.object({
141
- topic_id: zod_1.z.string()
137
+ export const TopicUpdateSchema = z.object({
138
+ topic_id: z.string()
142
139
  .uuid()
143
140
  .describe("Topic ID to update"),
144
- name: zod_1.z.string()
141
+ name: z.string()
145
142
  .min(1)
146
143
  .max(100)
147
144
  .optional()
148
145
  .describe("New name"),
149
- description: zod_1.z.string()
146
+ description: z.string()
150
147
  .max(500)
151
148
  .optional()
152
149
  .describe("New description"),
153
- parent_id: zod_1.z.string()
150
+ parent_id: z.string()
154
151
  .uuid()
155
152
  .nullable()
156
153
  .optional()
157
154
  .describe("New parent topic ID"),
158
- color: zod_1.z.string()
155
+ color: z.string()
159
156
  .regex(/^#[0-9A-Fa-f]{6}$/)
160
157
  .optional()
161
158
  .describe("New color"),
162
- icon: zod_1.z.string()
159
+ icon: z.string()
163
160
  .optional()
164
161
  .describe("New icon")
165
162
  });
166
- exports.TopicListSchema = zod_1.z.object({
167
- limit: zod_1.z.number()
163
+ export const TopicListSchema = z.object({
164
+ limit: z.number()
168
165
  .int()
169
166
  .positive()
170
167
  .max(100)
171
168
  .default(20)
172
169
  .describe("Maximum number of results"),
173
- parent_id: zod_1.z.string()
170
+ parent_id: z.string()
174
171
  .uuid()
175
172
  .nullable()
176
173
  .optional()
177
174
  .describe("Filter by parent topic (null for root topics)"),
178
- include_children: zod_1.z.boolean()
175
+ include_children: z.boolean()
179
176
  .default(false)
180
177
  .describe("Include child topics in results")
181
178
  });
182
179
  // API Key schemas
183
- exports.ApiKeyCreateSchema = zod_1.z.object({
184
- name: zod_1.z.string()
180
+ export const ApiKeyCreateSchema = z.object({
181
+ name: z.string()
185
182
  .min(1, 'API key name is required')
186
183
  .max(100, 'Name must be less than 100 characters')
187
184
  .describe("API key name for identification"),
188
- permissions: zod_1.z.array(zod_1.z.enum(["read", "write", "delete", "admin"]))
185
+ permissions: z.array(z.enum(["read", "write", "delete", "admin"]))
189
186
  .default(["read"])
190
187
  .describe("Permissions for the API key"),
191
- expires_at: zod_1.z.string()
188
+ expires_at: z.string()
192
189
  .datetime()
193
190
  .optional()
194
191
  .describe("Optional expiration date (ISO 8601)")
195
192
  });
196
- exports.ApiKeyRevokeSchema = zod_1.z.object({
197
- key_id: zod_1.z.string()
193
+ export const ApiKeyRevokeSchema = z.object({
194
+ key_id: z.string()
198
195
  .describe("API key ID to revoke"),
199
- reason: zod_1.z.string()
196
+ reason: z.string()
200
197
  .optional()
201
198
  .describe("Reason for revocation")
202
199
  });
203
200
  // System schemas
204
- exports.SystemHealthSchema = zod_1.z.object({
205
- verbose: zod_1.z.boolean()
201
+ export const SystemHealthSchema = z.object({
202
+ verbose: z.boolean()
206
203
  .default(false)
207
204
  .describe("Include detailed diagnostics"),
208
- include_dependencies: zod_1.z.boolean()
205
+ include_dependencies: z.boolean()
209
206
  .default(true)
210
207
  .describe("Check dependency health"),
211
- timeout: zod_1.z.number()
208
+ timeout: z.number()
212
209
  .positive()
213
210
  .default(5000)
214
211
  .describe("Health check timeout in milliseconds")
215
212
  });
216
- exports.SystemConfigSchema = zod_1.z.object({
217
- action: zod_1.z.enum(["get", "set", "reset"])
213
+ export const SystemConfigSchema = z.object({
214
+ action: z.enum(["get", "set", "reset"])
218
215
  .describe("Configuration action"),
219
- key: zod_1.z.string()
216
+ key: z.string()
220
217
  .optional()
221
218
  .describe("Configuration key (required for set/get specific)"),
222
- value: zod_1.z.any()
219
+ value: z.any()
223
220
  .optional()
224
221
  .describe("Configuration value (required for set)"),
225
- scope: zod_1.z.enum(["user", "global"])
222
+ scope: z.enum(["user", "global"])
226
223
  .default("user")
227
224
  .describe("Configuration scope")
228
225
  });
229
226
  // Advanced operation schemas
230
- exports.BulkOperationSchema = zod_1.z.object({
231
- operation: zod_1.z.enum(["create", "update", "delete"])
227
+ export const BulkOperationSchema = z.object({
228
+ operation: z.enum(["create", "update", "delete"])
232
229
  .describe("Bulk operation type"),
233
- entity_type: zod_1.z.enum(["memory", "topic", "apikey"])
230
+ entity_type: z.enum(["memory", "topic", "apikey"])
234
231
  .describe("Entity type for bulk operation"),
235
- items: zod_1.z.array(zod_1.z.record(zod_1.z.any()))
232
+ items: z.array(z.record(z.any()))
236
233
  .min(1)
237
234
  .max(100)
238
235
  .describe("Items for bulk operation"),
239
- transaction: zod_1.z.boolean()
236
+ transaction: z.boolean()
240
237
  .default(true)
241
238
  .describe("Execute as transaction (all or nothing)")
242
239
  });
243
- exports.ImportExportSchema = zod_1.z.object({
244
- action: zod_1.z.enum(["import", "export"])
240
+ export const ImportExportSchema = z.object({
241
+ action: z.enum(["import", "export"])
245
242
  .describe("Import or export action"),
246
- format: zod_1.z.enum(["json", "csv", "markdown"])
243
+ format: z.enum(["json", "csv", "markdown"])
247
244
  .default("json")
248
245
  .describe("Data format"),
249
- entity_type: zod_1.z.enum(["memory", "topic", "all"])
246
+ entity_type: z.enum(["memory", "topic", "all"])
250
247
  .default("all")
251
248
  .describe("Entity type to import/export"),
252
- file_path: zod_1.z.string()
249
+ file_path: z.string()
253
250
  .optional()
254
251
  .describe("File path for import/export"),
255
- filters: zod_1.z.record(zod_1.z.any())
252
+ filters: z.record(z.any())
256
253
  .optional()
257
254
  .describe("Filters for export")
258
255
  });
259
256
  // Tool execution schema
260
- exports.ToolExecutionSchema = zod_1.z.object({
261
- tool_name: zod_1.z.string()
257
+ export const ToolExecutionSchema = z.object({
258
+ tool_name: z.string()
262
259
  .describe("Name of the tool to execute"),
263
- arguments: zod_1.z.record(zod_1.z.any())
260
+ arguments: z.record(z.any())
264
261
  .describe("Tool arguments"),
265
- timeout: zod_1.z.number()
262
+ timeout: z.number()
266
263
  .positive()
267
264
  .default(30000)
268
265
  .describe("Execution timeout in milliseconds"),
269
- retry_on_failure: zod_1.z.boolean()
266
+ retry_on_failure: z.boolean()
270
267
  .default(false)
271
268
  .describe("Retry on failure"),
272
- max_retries: zod_1.z.number()
269
+ max_retries: z.number()
273
270
  .int()
274
271
  .min(0)
275
272
  .max(5)
@@ -277,31 +274,31 @@ exports.ToolExecutionSchema = zod_1.z.object({
277
274
  .describe("Maximum retry attempts")
278
275
  });
279
276
  // Response schemas
280
- exports.SuccessResponseSchema = zod_1.z.object({
281
- success: zod_1.z.boolean().default(true),
282
- data: zod_1.z.any(),
283
- message: zod_1.z.string().optional(),
284
- metadata: zod_1.z.object({
285
- timestamp: zod_1.z.string().datetime(),
286
- duration_ms: zod_1.z.number().optional(),
287
- request_id: zod_1.z.string().optional()
277
+ export const SuccessResponseSchema = z.object({
278
+ success: z.boolean().default(true),
279
+ data: z.any(),
280
+ message: z.string().optional(),
281
+ metadata: z.object({
282
+ timestamp: z.string().datetime(),
283
+ duration_ms: z.number().optional(),
284
+ request_id: z.string().optional()
288
285
  }).optional()
289
286
  });
290
- exports.ErrorResponseSchema = zod_1.z.object({
291
- success: zod_1.z.boolean().default(false),
292
- error: zod_1.z.object({
293
- code: zod_1.z.string(),
294
- message: zod_1.z.string(),
295
- details: zod_1.z.any().optional(),
296
- stack: zod_1.z.string().optional()
287
+ export const ErrorResponseSchema = z.object({
288
+ success: z.boolean().default(false),
289
+ error: z.object({
290
+ code: z.string(),
291
+ message: z.string(),
292
+ details: z.any().optional(),
293
+ stack: z.string().optional()
297
294
  }),
298
- metadata: zod_1.z.object({
299
- timestamp: zod_1.z.string().datetime(),
300
- request_id: zod_1.z.string().optional()
295
+ metadata: z.object({
296
+ timestamp: z.string().datetime(),
297
+ request_id: z.string().optional()
301
298
  }).optional()
302
299
  });
303
300
  // Validation helper
304
- class SchemaValidator {
301
+ export class SchemaValidator {
305
302
  /**
306
303
  * Validate data against a schema
307
304
  */
@@ -310,7 +307,7 @@ class SchemaValidator {
310
307
  return schema.parse(data);
311
308
  }
312
309
  catch (error) {
313
- if (error instanceof zod_1.z.ZodError) {
310
+ if (error instanceof z.ZodError) {
314
311
  throw new Error(`Validation error: ${error.errors
315
312
  .map(e => `${e.path.join('.')}: ${e.message}`)
316
313
  .join(', ')}`);
@@ -346,37 +343,36 @@ class SchemaValidator {
346
343
  };
347
344
  }
348
345
  }
349
- exports.SchemaValidator = SchemaValidator;
350
346
  // Export all schemas as a collection
351
- exports.MCPSchemas = {
347
+ export const MCPSchemas = {
352
348
  memory: {
353
- create: exports.MemoryCreateSchema,
354
- search: exports.MemorySearchSchema,
355
- update: exports.MemoryUpdateSchema,
356
- delete: exports.MemoryDeleteSchema,
357
- list: exports.MemoryListSchema
349
+ create: MemoryCreateSchema,
350
+ search: MemorySearchSchema,
351
+ update: MemoryUpdateSchema,
352
+ delete: MemoryDeleteSchema,
353
+ list: MemoryListSchema
358
354
  },
359
355
  topic: {
360
- create: exports.TopicCreateSchema,
361
- update: exports.TopicUpdateSchema,
362
- list: exports.TopicListSchema
356
+ create: TopicCreateSchema,
357
+ update: TopicUpdateSchema,
358
+ list: TopicListSchema
363
359
  },
364
360
  apikey: {
365
- create: exports.ApiKeyCreateSchema,
366
- revoke: exports.ApiKeyRevokeSchema
361
+ create: ApiKeyCreateSchema,
362
+ revoke: ApiKeyRevokeSchema
367
363
  },
368
364
  system: {
369
- health: exports.SystemHealthSchema,
370
- config: exports.SystemConfigSchema
365
+ health: SystemHealthSchema,
366
+ config: SystemConfigSchema
371
367
  },
372
368
  operations: {
373
- bulk: exports.BulkOperationSchema,
374
- importExport: exports.ImportExportSchema,
375
- toolExecution: exports.ToolExecutionSchema
369
+ bulk: BulkOperationSchema,
370
+ importExport: ImportExportSchema,
371
+ toolExecution: ToolExecutionSchema
376
372
  },
377
373
  responses: {
378
- success: exports.SuccessResponseSchema,
379
- error: exports.ErrorResponseSchema
374
+ success: SuccessResponseSchema,
375
+ error: ErrorResponseSchema
380
376
  }
381
377
  };
382
- exports.default = exports.MCPSchemas;
378
+ export default MCPSchemas;