@magic-ingredients/tiny-brain-local 0.3.10

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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -0
  3. package/dist/core/console-logger.d.ts +30 -0
  4. package/dist/core/console-logger.d.ts.map +1 -0
  5. package/dist/core/console-logger.js +101 -0
  6. package/dist/core/console-logger.js.map +1 -0
  7. package/dist/core/file-logger.d.ts +40 -0
  8. package/dist/core/file-logger.d.ts.map +1 -0
  9. package/dist/core/file-logger.js +223 -0
  10. package/dist/core/file-logger.js.map +1 -0
  11. package/dist/core/mcp-server.d.ts +54 -0
  12. package/dist/core/mcp-server.d.ts.map +1 -0
  13. package/dist/core/mcp-server.js +295 -0
  14. package/dist/core/mcp-server.js.map +1 -0
  15. package/dist/index.d.ts +8 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +37 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/prompts/index.d.ts +39 -0
  20. package/dist/prompts/index.d.ts.map +1 -0
  21. package/dist/prompts/index.js +5 -0
  22. package/dist/prompts/index.js.map +1 -0
  23. package/dist/prompts/memory/memory.prompt.d.ts +32 -0
  24. package/dist/prompts/memory/memory.prompt.d.ts.map +1 -0
  25. package/dist/prompts/memory/memory.prompt.js +204 -0
  26. package/dist/prompts/memory/memory.prompt.js.map +1 -0
  27. package/dist/prompts/persona/persona.prompt.d.ts +27 -0
  28. package/dist/prompts/persona/persona.prompt.d.ts.map +1 -0
  29. package/dist/prompts/persona/persona.prompt.js +592 -0
  30. package/dist/prompts/persona/persona.prompt.js.map +1 -0
  31. package/dist/prompts/planning/planning.prompt.d.ts +56 -0
  32. package/dist/prompts/planning/planning.prompt.d.ts.map +1 -0
  33. package/dist/prompts/planning/planning.prompt.js +1016 -0
  34. package/dist/prompts/planning/planning.prompt.js.map +1 -0
  35. package/dist/prompts/prompt-registry.d.ts +25 -0
  36. package/dist/prompts/prompt-registry.d.ts.map +1 -0
  37. package/dist/prompts/prompt-registry.js +68 -0
  38. package/dist/prompts/prompt-registry.js.map +1 -0
  39. package/dist/prompts/thinking/thinking.prompt.d.ts +29 -0
  40. package/dist/prompts/thinking/thinking.prompt.d.ts.map +1 -0
  41. package/dist/prompts/thinking/thinking.prompt.js +171 -0
  42. package/dist/prompts/thinking/thinking.prompt.js.map +1 -0
  43. package/dist/services/UpdateService.d.ts +29 -0
  44. package/dist/services/UpdateService.d.ts.map +1 -0
  45. package/dist/services/UpdateService.js +132 -0
  46. package/dist/services/UpdateService.js.map +1 -0
  47. package/dist/services/plan-watcher.service.d.ts +143 -0
  48. package/dist/services/plan-watcher.service.d.ts.map +1 -0
  49. package/dist/services/plan-watcher.service.js +914 -0
  50. package/dist/services/plan-watcher.service.js.map +1 -0
  51. package/dist/storage/local-filesystem-adapter.d.ts +39 -0
  52. package/dist/storage/local-filesystem-adapter.d.ts.map +1 -0
  53. package/dist/storage/local-filesystem-adapter.js +208 -0
  54. package/dist/storage/local-filesystem-adapter.js.map +1 -0
  55. package/dist/storage/storage-path-builder.d.ts +14 -0
  56. package/dist/storage/storage-path-builder.d.ts.map +1 -0
  57. package/dist/storage/storage-path-builder.js +43 -0
  58. package/dist/storage/storage-path-builder.js.map +1 -0
  59. package/dist/test-setup.d.ts +2 -0
  60. package/dist/test-setup.d.ts.map +1 -0
  61. package/dist/test-setup.js +12 -0
  62. package/dist/test-setup.js.map +1 -0
  63. package/dist/tools/analyse-request/analyse-request.tool.d.ts +8 -0
  64. package/dist/tools/analyse-request/analyse-request.tool.d.ts.map +1 -0
  65. package/dist/tools/analyse-request/analyse-request.tool.js +120 -0
  66. package/dist/tools/analyse-request/analyse-request.tool.js.map +1 -0
  67. package/dist/tools/index.d.ts +69 -0
  68. package/dist/tools/index.d.ts.map +1 -0
  69. package/dist/tools/index.js +24 -0
  70. package/dist/tools/index.js.map +1 -0
  71. package/dist/tools/memory/memory.tool.d.ts +15 -0
  72. package/dist/tools/memory/memory.tool.d.ts.map +1 -0
  73. package/dist/tools/memory/memory.tool.js +110 -0
  74. package/dist/tools/memory/memory.tool.js.map +1 -0
  75. package/dist/tools/persona/as.tool.d.ts +25 -0
  76. package/dist/tools/persona/as.tool.d.ts.map +1 -0
  77. package/dist/tools/persona/as.tool.js +294 -0
  78. package/dist/tools/persona/as.tool.js.map +1 -0
  79. package/dist/tools/persona/persona.tool.d.ts +8 -0
  80. package/dist/tools/persona/persona.tool.d.ts.map +1 -0
  81. package/dist/tools/persona/persona.tool.js +193 -0
  82. package/dist/tools/persona/persona.tool.js.map +1 -0
  83. package/dist/tools/plan/plan.tool.d.ts +18 -0
  84. package/dist/tools/plan/plan.tool.d.ts.map +1 -0
  85. package/dist/tools/plan/plan.tool.js +643 -0
  86. package/dist/tools/plan/plan.tool.js.map +1 -0
  87. package/dist/tools/strategy/strategy.tool.d.ts +13 -0
  88. package/dist/tools/strategy/strategy.tool.d.ts.map +1 -0
  89. package/dist/tools/strategy/strategy.tool.js +199 -0
  90. package/dist/tools/strategy/strategy.tool.js.map +1 -0
  91. package/dist/tools/thinking/thinking.tool.d.ts +13 -0
  92. package/dist/tools/thinking/thinking.tool.d.ts.map +1 -0
  93. package/dist/tools/thinking/thinking.tool.js +226 -0
  94. package/dist/tools/thinking/thinking.tool.js.map +1 -0
  95. package/dist/tools/tool-registry.d.ts +20 -0
  96. package/dist/tools/tool-registry.d.ts.map +1 -0
  97. package/dist/tools/tool-registry.js +61 -0
  98. package/dist/tools/tool-registry.js.map +1 -0
  99. package/dist/tools/update/update.tool.d.ts +15 -0
  100. package/dist/tools/update/update.tool.d.ts.map +1 -0
  101. package/dist/tools/update/update.tool.js +86 -0
  102. package/dist/tools/update/update.tool.js.map +1 -0
  103. package/dist/tools/validate-response/validate-response.tool.d.ts +13 -0
  104. package/dist/tools/validate-response/validate-response.tool.d.ts.map +1 -0
  105. package/dist/tools/validate-response/validate-response.tool.js +142 -0
  106. package/dist/tools/validate-response/validate-response.tool.js.map +1 -0
  107. package/dist/types/request-context.d.ts +7 -0
  108. package/dist/types/request-context.d.ts.map +1 -0
  109. package/dist/types/request-context.js +7 -0
  110. package/dist/types/request-context.js.map +1 -0
  111. package/package.json +77 -0
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ // Schema for tool arguments that will be provided by MCP
3
+ export const ToolArgumentsSchema = z.record(z.unknown());
4
+ // Schema for tool results that will be returned to MCP
5
+ export const ToolResultSchema = z.object({
6
+ content: z.array(z.object({
7
+ type: z.literal('text'),
8
+ text: z.string(),
9
+ })),
10
+ isError: z.boolean().optional(),
11
+ });
12
+ // Error result helper
13
+ export const createErrorResult = (error) => ({
14
+ content: [{ type: 'text', text: error }],
15
+ isError: true,
16
+ });
17
+ // Success result helper
18
+ export const createSuccessResult = (text) => ({
19
+ content: [{ type: 'text', text }],
20
+ isError: false,
21
+ });
22
+ // Note: Tools should be imported from their individual directories or from all-tools.ts
23
+ // to avoid circular dependencies
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,yDAAyD;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAGzD,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC,CACH;IACD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAGH,sBAAsB;AACtB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAc,EAAE,CAAC,CAAC;IAC/D,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACxC,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,wBAAwB;AACxB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAc,EAAE,CAAC,CAAC;IAChE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjC,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AA0CH,wFAAwF;AACxF,iCAAiC"}
@@ -0,0 +1,15 @@
1
+ import { type ToolArguments, type ToolResult } from '../index.js';
2
+ import type { RequestContext } from '../../types/request-context.js';
3
+ import type { Tool as MCPTool } from '@modelcontextprotocol/sdk/types.js';
4
+ export declare class MemoryTool {
5
+ /**
6
+ * Get the tool definition
7
+ */
8
+ static getToolDefinition(): MCPTool;
9
+ static execute(args: ToolArguments, context: RequestContext): Promise<ToolResult>;
10
+ private static handleRemember;
11
+ private static handleRecall;
12
+ private static handleShow;
13
+ private static handleForget;
14
+ }
15
+ //# sourceMappingURL=memory.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/memory.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAW1E,qBAAa,UAAU;IACrB;;OAEG;IACH,MAAM,CAAC,iBAAiB,IAAI,OAAO;WA4BtB,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;mBA6BlE,cAAc;mBAsBd,YAAY;mBAmBZ,UAAU;mBAcV,YAAY;CAkBlC"}
@@ -0,0 +1,110 @@
1
+ import { z } from 'zod';
2
+ import { createSuccessResult, createErrorResult, } from '../index.js';
3
+ import { MemoryService } from '@magic-ingredients/tiny-brain-core';
4
+ const MemoryArgsSchema = z.object({
5
+ operation: z.enum(['remember', 'recall', 'show', 'forget']),
6
+ content: z.string().optional(),
7
+ context: z.string().optional(),
8
+ });
9
+ export class MemoryTool {
10
+ /**
11
+ * Get the tool definition
12
+ */
13
+ static getToolDefinition() {
14
+ return {
15
+ name: 'memory',
16
+ description: '🧠 UNIFIED MEMORY MANAGEMENT 🧠\n\n⚡ ONE TOOL FOR ALL MEMORY: Remember, recall, and show all knowledge through a single interface.\n\n✅ OPERATIONS:\n • remember: Store facts with automatic entity extraction\n • recall: Search across all stored knowledge\n • show: Display complete knowledge graph\n • forget: Remove specific facts or entities\n\n🚀 SMART PROCESSING: Natural language input with intelligent parsing.\n💡 TIP: Specify operation and provide natural language input.',
17
+ inputSchema: {
18
+ type: 'object',
19
+ properties: {
20
+ operation: {
21
+ type: 'string',
22
+ enum: ['remember', 'recall', 'show', 'forget'],
23
+ description: 'The memory operation to perform',
24
+ },
25
+ content: {
26
+ type: 'string',
27
+ description: 'For remember: fact to store. For recall/forget: search query. Not needed for show.',
28
+ },
29
+ context: {
30
+ type: 'string',
31
+ description: 'Optional context or category (for remember operation)',
32
+ },
33
+ },
34
+ required: ['operation'],
35
+ },
36
+ };
37
+ }
38
+ static async execute(args, context) {
39
+ try {
40
+ const validatedArgs = MemoryArgsSchema.parse(args);
41
+ // Create service with RequestContext
42
+ const memoryService = new MemoryService(context);
43
+ switch (validatedArgs.operation) {
44
+ case 'remember':
45
+ return await MemoryTool.handleRemember(validatedArgs, memoryService, context.userId);
46
+ case 'recall':
47
+ return await MemoryTool.handleRecall(validatedArgs, memoryService, context.userId);
48
+ case 'show':
49
+ return await MemoryTool.handleShow(memoryService, context.userId);
50
+ case 'forget':
51
+ return await MemoryTool.handleForget(validatedArgs, memoryService, context.userId);
52
+ default:
53
+ return createErrorResult(`Unknown memory operation: ${validatedArgs.operation}`);
54
+ }
55
+ }
56
+ catch (error) {
57
+ if (error instanceof z.ZodError) {
58
+ return createErrorResult(`Invalid arguments: ${error.errors.map((e) => e.message).join(', ')}`);
59
+ }
60
+ return createErrorResult(error instanceof Error ? error.message : 'Unknown error occurred');
61
+ }
62
+ }
63
+ static async handleRemember(args, memoryService, userId) {
64
+ if (!args.content) {
65
+ return createErrorResult('Content is required for remember operation');
66
+ }
67
+ try {
68
+ const result = await memoryService.rememberFact(args.content, args.context, userId);
69
+ const message = `${result.message}\n\nExtracted:\n- Entities: ${result.entities.map((e) => `${e.name} (${e.entityType})`).join(', ')}\n- Relations: ${result.relations.map((r) => `${r.from} ${r.relationType} ${r.to}`).join(', ')}\n- Context: ${result.context || 'general'}`;
70
+ return createSuccessResult(message);
71
+ }
72
+ catch (error) {
73
+ return createErrorResult(`Failed to remember fact: ${error instanceof Error ? error.message : 'Unknown error'}`);
74
+ }
75
+ }
76
+ static async handleRecall(args, memoryService, userId) {
77
+ if (!args.content) {
78
+ return createErrorResult('Content is required for recall operation');
79
+ }
80
+ try {
81
+ const result = await memoryService.recallMemories(args.content, userId);
82
+ return createSuccessResult(JSON.stringify(result.results, null, 2));
83
+ }
84
+ catch (error) {
85
+ return createErrorResult(`Failed to recall memories: ${error instanceof Error ? error.message : 'Unknown error'}`);
86
+ }
87
+ }
88
+ static async handleShow(memoryService, userId) {
89
+ try {
90
+ const graph = await memoryService.getKnowledgeGraph(userId);
91
+ return createSuccessResult(JSON.stringify(graph, null, 2));
92
+ }
93
+ catch (error) {
94
+ return createErrorResult(`Failed to show knowledge graph: ${error instanceof Error ? error.message : 'Unknown error'}`);
95
+ }
96
+ }
97
+ static async handleForget(args, memoryService, userId) {
98
+ if (!args.content) {
99
+ return createErrorResult('Content is required for forget operation');
100
+ }
101
+ try {
102
+ const result = await memoryService.forgetMemories(args.content, userId);
103
+ return createSuccessResult(result.message);
104
+ }
105
+ catch (error) {
106
+ return createErrorResult(`Failed to forget memories: ${error instanceof Error ? error.message : 'Unknown error'}`);
107
+ }
108
+ }
109
+ }
110
+ //# sourceMappingURL=memory.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.tool.js","sourceRoot":"","sources":["../../../src/tools/memory/memory.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAGlB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAIH,MAAM,OAAO,UAAU;IACrB;;OAEG;IACH,MAAM,CAAC,iBAAiB;QACtB,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,oeAAoe;YACte,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;wBAC9C,WAAW,EAAE,iCAAiC;qBAC/C;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,oFAAoF;qBACvF;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,uDAAuD;qBACrE;iBACF;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,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,iBAAiB,CACtB,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACzF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import { type ToolArguments, type ToolResult } from '../index.js';
2
+ import type { RequestContext } from '../../types/request-context.js';
3
+ import { Tool as MCPTool } from '@modelcontextprotocol/sdk/types.js';
4
+ /**
5
+ * Top-level 'as' tool for quick persona switching
6
+ * This is a convenience tool that mirrors the functionality of the persona tool
7
+ * but is exposed at the top level for easier access
8
+ */
9
+ export declare class AsTool {
10
+ static getToolDefinition(): MCPTool;
11
+ static execute(args: ToolArguments, context: RequestContext): Promise<ToolResult>;
12
+ /**
13
+ * Load comprehensive persona context for MCP client session initialization
14
+ */
15
+ private static loadPersonaContext;
16
+ /**
17
+ * Extract communication style hints from profile content
18
+ */
19
+ private static extractCommunicationStyle;
20
+ /**
21
+ * Extract behavior hints from profile content
22
+ */
23
+ private static extractBehaviorHints;
24
+ }
25
+ //# sourceMappingURL=as.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/persona/as.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAmGrE;;;;GAIG;AACH,qBAAa,MAAM;IACjB,MAAM,CAAC,iBAAiB,IAAI,OAAO;WA4BtB,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IA2HvF;;OAEG;mBACkB,kBAAkB;IAwHvC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAgBxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAepC"}
@@ -0,0 +1,294 @@
1
+ import { z } from 'zod';
2
+ import { createErrorResult } from '../index.js';
3
+ import { PersonaService, createDefaultProfile } from '@magic-ingredients/tiny-brain-core';
4
+ // Schema for 'as' tool
5
+ const AsArgsSchema = z.object({
6
+ personaName: z.string(),
7
+ createIfMissing: z.boolean().optional(),
8
+ confirmCreate: z.boolean().optional(),
9
+ });
10
+ /**
11
+ * Top-level 'as' tool for quick persona switching
12
+ * This is a convenience tool that mirrors the functionality of the persona tool
13
+ * but is exposed at the top level for easier access
14
+ */
15
+ export class AsTool {
16
+ static getToolDefinition() {
17
+ return {
18
+ name: 'as',
19
+ description: "🎭 PERSONA SWITCHER 🎭\n\n⚡ INSTANT CONTEXT: Switch to or create a persona for context-aware conversations.\n\n✅ FEATURES:\n • Activate existing personas instantly\n • Create new personas with confirmation prompt\n • Auto-load persona's associated files\n • Maintain conversation context\n\n💡 USAGE: as <persona_name> [createIfMissing: true]\n\n🛡️ SAFETY: New personas require confirmation to prevent accidental creation\n\n🎯 USE CASES:\n • Project-specific contexts\n • Different communication styles\n • Specialized knowledge domains",
20
+ inputSchema: {
21
+ type: 'object',
22
+ properties: {
23
+ personaName: {
24
+ type: 'string',
25
+ description: 'Name of the persona to switch to',
26
+ },
27
+ createIfMissing: {
28
+ type: 'boolean',
29
+ description: "Create the persona if it doesn't exist",
30
+ default: false,
31
+ },
32
+ confirmCreate: {
33
+ type: 'boolean',
34
+ description: 'Confirm creation of new persona (used internally)',
35
+ default: false,
36
+ },
37
+ },
38
+ required: ['personaName'],
39
+ },
40
+ };
41
+ }
42
+ static async execute(args, context) {
43
+ try {
44
+ const validatedArgs = AsArgsSchema.parse(args);
45
+ // Create service with RequestContext
46
+ const service = new PersonaService(context);
47
+ // Load persona using new pattern with explicit args
48
+ let personaProfile = await service.loadPersona({
49
+ personaName: validatedArgs.personaName
50
+ });
51
+ if (!personaProfile) {
52
+ // Get available personas to show in error message
53
+ const availablePersonas = await service.listPersonas({});
54
+ const availableList = availablePersonas.length > 0
55
+ ? `Available personas: ${availablePersonas.join(', ')}`
56
+ : 'No personas available.';
57
+ if (!validatedArgs.createIfMissing) {
58
+ return createErrorResult(`Persona '${validatedArgs.personaName}' not found. ${availableList} Use createIfMissing: true to create it.`);
59
+ }
60
+ // If createIfMissing is true but no explicit confirmation, prompt for it
61
+ if (validatedArgs.createIfMissing && !validatedArgs.confirmCreate) {
62
+ return {
63
+ content: [
64
+ {
65
+ type: 'text',
66
+ text: JSON.stringify({
67
+ requiresConfirmation: true,
68
+ action: 'createPersona',
69
+ personaName: validatedArgs.personaName,
70
+ message: `Persona "${validatedArgs.personaName}" doesn't exist. Would you like to create it?`,
71
+ availablePersonas: availablePersonas.length > 0 ? availablePersonas : undefined,
72
+ hint: 'To confirm creation, call the tool again with confirmCreate: true',
73
+ }, null, 2),
74
+ },
75
+ ],
76
+ isError: false,
77
+ };
78
+ }
79
+ }
80
+ let isNew = false;
81
+ if (!personaProfile && validatedArgs.createIfMissing && validatedArgs.confirmCreate) {
82
+ // Create new persona with confirmation
83
+ const profileString = createDefaultProfile(validatedArgs.personaName, new Date().toISOString());
84
+ // Create persona using new pattern with explicit args
85
+ await service.createPersona({
86
+ personaName: validatedArgs.personaName,
87
+ profile: profileString
88
+ });
89
+ // Load the created persona to get the full PersonaProfile
90
+ personaProfile = await service.loadPersona({
91
+ personaName: validatedArgs.personaName
92
+ });
93
+ isNew = true;
94
+ }
95
+ // Set the active persona using the callback for subsequent tools
96
+ if (personaProfile && context.updateActivePersona) {
97
+ // Create a minimal PersonaProfile object for the context
98
+ const activePersona = {
99
+ id: validatedArgs.personaName,
100
+ userContent: {
101
+ profile: typeof personaProfile.profile === 'string' ? personaProfile.profile : undefined,
102
+ },
103
+ };
104
+ context.logger.info(`AS tool calling updateActivePersona with persona: ${validatedArgs.personaName}`);
105
+ context.updateActivePersona(activePersona);
106
+ context.logger.info(`AS tool completed updateActivePersona call`);
107
+ }
108
+ else {
109
+ context.logger.warn(`AS tool: Cannot update active persona - ${!personaProfile ? 'no profile' : 'no callback'}`);
110
+ }
111
+ // Load comprehensive persona context for MCP client
112
+ const personaContext = await AsTool.loadPersonaContext(validatedArgs.personaName, context);
113
+ const message = isNew
114
+ ? `Created and switched to new persona: "${validatedArgs.personaName}"`
115
+ : `Switched to "${validatedArgs.personaName}" persona. Loaded comprehensive context.`;
116
+ // Return full persona context for MCP client session initialization
117
+ const fullContext = {
118
+ success: true,
119
+ personaName: validatedArgs.personaName,
120
+ isNew,
121
+ message,
122
+ timestamp: new Date().toISOString(),
123
+ ...personaContext,
124
+ };
125
+ return {
126
+ content: [
127
+ {
128
+ type: 'text',
129
+ text: JSON.stringify(fullContext, null, 2),
130
+ },
131
+ ],
132
+ isError: false,
133
+ };
134
+ }
135
+ catch (error) {
136
+ if (error instanceof z.ZodError) {
137
+ return createErrorResult(`Invalid arguments: ${error.errors.map((e) => e.message).join(', ')}`);
138
+ }
139
+ return createErrorResult(error instanceof Error ? error.message : 'Unknown error occurred');
140
+ }
141
+ }
142
+ /**
143
+ * Load comprehensive persona context for MCP client session initialization
144
+ */
145
+ static async loadPersonaContext(personaName, context) {
146
+ try {
147
+ // Create service with RequestContext
148
+ const service = new PersonaService(context);
149
+ // Load full context using new pattern
150
+ const fullContext = await service.loadPersona({ personaName });
151
+ if (!fullContext) {
152
+ return {
153
+ error: 'Persona not found',
154
+ basicInfo: {
155
+ personaName,
156
+ filesAvailable: 0,
157
+ },
158
+ };
159
+ }
160
+ // Transform PersonaFullContext to PersonaContext structure
161
+ const personaContext = {
162
+ core: {},
163
+ context: {
164
+ recentPlans: {
165
+ plans: fullContext.recentPlans.map((plan) => ({
166
+ fileName: plan.fileName,
167
+ name: plan.name,
168
+ overview: plan.overview,
169
+ status: plan.currentStatus,
170
+ lastUpdated: plan.lastUpdated,
171
+ phaseCount: plan.phases?.length || 0,
172
+ })),
173
+ count: fullContext.recentPlans.length,
174
+ description: 'Recent planning documents and task lists',
175
+ },
176
+ memory: {
177
+ fileCount: fullContext.memoryFileCount,
178
+ description: 'Memory and knowledge graph data for context awareness',
179
+ },
180
+ },
181
+ session: {
182
+ configuration: {
183
+ communicationStyle: AsTool.extractCommunicationStyle(typeof fullContext.profile === 'string' ? fullContext.profile : null),
184
+ behaviorHints: AsTool.extractBehaviorHints(typeof fullContext.profile === 'string' ? fullContext.profile : null),
185
+ expertise: fullContext.insights?.expertise || [],
186
+ preferences: fullContext.insights?.preferences || [],
187
+ contextAware: true,
188
+ description: 'Configuration hints for MCP client session setup',
189
+ },
190
+ },
191
+ files: fullContext.files,
192
+ summary: {
193
+ totalFiles: fullContext.files.length,
194
+ coreFilesPresent: {
195
+ profile: !!fullContext.profile,
196
+ insights: !!fullContext.insights,
197
+ metadata: !!fullContext.metadata,
198
+ },
199
+ planCount: fullContext.planCount,
200
+ memoryFileCount: fullContext.memoryFileCount,
201
+ lastActivity: fullContext.metadata?.lastInteraction || fullContext.metadata?.lastUpdated,
202
+ description: 'Summary of available persona data and context',
203
+ },
204
+ };
205
+ // Set core data
206
+ if (fullContext.profile) {
207
+ const profileContent = typeof fullContext.profile === 'string'
208
+ ? fullContext.profile
209
+ : JSON.stringify(fullContext.profile, null, 2);
210
+ personaContext.core.profile = {
211
+ content: profileContent,
212
+ type: 'markdown',
213
+ description: 'Main persona profile defining identity, expertise, and communication style',
214
+ };
215
+ }
216
+ if (fullContext.insights) {
217
+ personaContext.core.insights = {
218
+ patterns: fullContext.insights.patterns,
219
+ preferences: fullContext.insights.preferences,
220
+ expertise: fullContext.insights.expertise,
221
+ totalLearnings: fullContext.insights.totalLearnings,
222
+ lastLearningDate: fullContext.insights.lastLearningDate,
223
+ description: 'AI-generated insights from previous interactions',
224
+ };
225
+ }
226
+ if (fullContext.metadata) {
227
+ personaContext.core.metadata = {
228
+ version: fullContext.metadata.version,
229
+ totalInteractions: fullContext.metadata.totalInteractions,
230
+ lastInteraction: fullContext.metadata.lastInteraction,
231
+ averageSessionLength: fullContext.metadata.averageSessionLength,
232
+ tags: fullContext.metadata.tags,
233
+ createdAt: fullContext.metadata.createdAt,
234
+ lastUpdated: fullContext.metadata.lastUpdated,
235
+ description: 'Persona usage statistics and metadata',
236
+ };
237
+ }
238
+ return personaContext;
239
+ }
240
+ catch (error) {
241
+ context.logger.error(`Failed to load persona context for ${personaName}:`, error);
242
+ return {
243
+ error: 'Failed to load comprehensive persona context',
244
+ basicInfo: {
245
+ personaName,
246
+ filesAvailable: 0,
247
+ },
248
+ };
249
+ }
250
+ }
251
+ /**
252
+ * Extract communication style hints from profile content
253
+ */
254
+ static extractCommunicationStyle(profile) {
255
+ if (!profile)
256
+ return ['neutral'];
257
+ const styles = [];
258
+ const lower = profile.toLowerCase();
259
+ // Simple heuristics to detect communication patterns
260
+ if (lower.includes('formal') || lower.includes('professional'))
261
+ styles.push('formal');
262
+ if (lower.includes('casual') || lower.includes('friendly'))
263
+ styles.push('casual');
264
+ if (lower.includes('technical') || lower.includes('precise'))
265
+ styles.push('technical');
266
+ if (lower.includes('creative') || lower.includes('artistic'))
267
+ styles.push('creative');
268
+ if (lower.includes('analytical') || lower.includes('data'))
269
+ styles.push('analytical');
270
+ return styles.length > 0 ? styles : ['adaptive'];
271
+ }
272
+ /**
273
+ * Extract behavior hints from profile content
274
+ */
275
+ static extractBehaviorHints(profile) {
276
+ if (!profile)
277
+ return [];
278
+ const hints = [];
279
+ const lower = profile.toLowerCase();
280
+ // Extract behavioral patterns
281
+ if (lower.includes('detail') || lower.includes('thorough'))
282
+ hints.push('detail-oriented');
283
+ if (lower.includes('quick') || lower.includes('efficient'))
284
+ hints.push('efficiency-focused');
285
+ if (lower.includes('question') || lower.includes('clarif'))
286
+ hints.push('clarification-seeking');
287
+ if (lower.includes('example') || lower.includes('practical'))
288
+ hints.push('example-driven');
289
+ if (lower.includes('step') || lower.includes('process'))
290
+ hints.push('process-oriented');
291
+ return hints;
292
+ }
293
+ }
294
+ //# sourceMappingURL=as.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as.tool.js","sourceRoot":"","sources":["../../../src/tools/persona/as.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAuC,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AA6F1F,uBAAuB;AACvB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,OAAO,MAAM;IACjB,MAAM,CAAC,iBAAiB;QACtB,OAAO;YACL,IAAI,EAAE,IAAI;YACV,WAAW,EACT,miBAAmiB;YACriB,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,kCAAkC;qBAChD;oBACD,eAAe,EAAE;wBACf,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,wCAAwC;wBACrD,OAAO,EAAE,KAAK;qBACf;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,mDAAmD;wBAChE,OAAO,EAAE,KAAK;qBACf;iBACF;gBACD,QAAQ,EAAE,CAAC,aAAa,CAAC;aAC1B;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAmB,EAAE,OAAuB;QAC/D,IAAI,CAAC;YACH,MAAM,aAAa,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AAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC1F,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC7F,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAChG,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3F,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAExF,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { type ToolArguments, type ToolResult } from '../index.js';
2
+ import type { RequestContext } from '../../types/request-context.js';
3
+ import { Tool as MCPTool } from '@modelcontextprotocol/sdk/types.js';
4
+ export declare class ManagePersonasTool {
5
+ static getToolDefinition(): MCPTool;
6
+ static execute(args: ToolArguments, context: RequestContext): Promise<ToolResult>;
7
+ }
8
+ //# sourceMappingURL=persona.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persona.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/persona/persona.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAQrE,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAUrE,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,iBAAiB,IAAI,OAAO;WA+BtB,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;CAiNxF"}