@magic-ingredients/tiny-brain-local 0.15.0 → 0.15.1

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.
@@ -81,6 +81,14 @@ export declare class MCPServer {
81
81
  * Initialize remote authentication
82
82
  */
83
83
  private initializeRemoteAuth;
84
+ /**
85
+ * Initialize bundled personas by copying to user directory if not present
86
+ *
87
+ * Bundled personas are included with the plugin at ${CLAUDE_PLUGIN_ROOT}/personas/
88
+ * and are copied to ~/.tiny-brain/personas/ on first init if they don't exist locally.
89
+ * Local personas take precedence (user can override bundled by creating their own).
90
+ */
91
+ private initializeBundledPersonas;
84
92
  /**
85
93
  * Initialize local personas
86
94
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/core/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,OAAO,KAAK,EAA4B,QAAQ,EAAkC,MAAM,oCAAoC,CAAC;AAE7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAQ5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IAEF,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OA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O,CAAC,IAAI,CAAC;IAsBjC;;;;;;;OAOG;YACW,sBAAsB;IA+DpC;;OAEG;YACW,iBAAiB;IAW/B;;;OAGG;YACW,oBAAoB;IA6BlC;;OAEG;YACW,oBAAoB;IAgFlC;;;;;;OAMG;YACW,yBAAyB;IA+CvC;;OAEG;YACW,kBAAkB;IAsBhC;;OAEG;YACW,wBAAwB;IA8BtC;;OAEG;YACW,mBAAmB;IA8BjC;;OAEG;IACG,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAiBjB,eAAe;YAMf,cAAc;YA6Fd,iBAAiB;YAMjB,eAAe;YAmEf,iBAAiB;CAQhC"}
@@ -4,6 +4,7 @@
4
4
  * Simplified MCP server for local execution without deployment complexity
5
5
  */
6
6
  import * as path from 'path';
7
+ import { existsSync, cpSync, readdirSync } from 'fs';
7
8
  import { Server as McpServer } from '@modelcontextprotocol/sdk/server/index.js';
8
9
  import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
9
10
  import { isDevelopment as checkIsDevelopment } from '@magic-ingredients/tiny-brain-core';
@@ -149,6 +150,7 @@ export class MCPServer {
149
150
  await this.initializeStorage();
150
151
  await this.initializeRepository();
151
152
  await this.initializeRemoteAuth();
153
+ await this.initializeBundledPersonas();
152
154
  await this.initializePersonas();
153
155
  await this.initializeRemotePersonas();
154
156
  await this.initializeDashboard();
@@ -341,6 +343,55 @@ export class MCPServer {
341
343
  // Continue in local mode - don't fail the entire initialization
342
344
  }
343
345
  }
346
+ /**
347
+ * Initialize bundled personas by copying to user directory if not present
348
+ *
349
+ * Bundled personas are included with the plugin at ${CLAUDE_PLUGIN_ROOT}/personas/
350
+ * and are copied to ~/.tiny-brain/personas/ on first init if they don't exist locally.
351
+ * Local personas take precedence (user can override bundled by creating their own).
352
+ */
353
+ async initializeBundledPersonas() {
354
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
355
+ if (!pluginRoot) {
356
+ this.logger.debug('CLAUDE_PLUGIN_ROOT not set, skipping bundled personas');
357
+ return;
358
+ }
359
+ const bundledPersonasDir = path.join(pluginRoot, 'personas');
360
+ if (!existsSync(bundledPersonasDir)) {
361
+ this.logger.debug('No bundled personas directory found');
362
+ return;
363
+ }
364
+ this.logger.info('Checking bundled personas...');
365
+ try {
366
+ const bundledPersonas = readdirSync(bundledPersonasDir);
367
+ for (const personaName of bundledPersonas) {
368
+ // Skip hidden files and non-directories
369
+ if (personaName.startsWith('.'))
370
+ continue;
371
+ const bundledPath = path.join(bundledPersonasDir, personaName);
372
+ const localStorage = this.storage;
373
+ const localPath = path.join(localStorage.personasDir, personaName);
374
+ // Only copy if bundled persona exists and local doesn't
375
+ if (existsSync(bundledPath) && !existsSync(localPath)) {
376
+ this.logger.info(`Copying bundled persona '${personaName}' to local storage`);
377
+ try {
378
+ cpSync(bundledPath, localPath, { recursive: true });
379
+ this.logger.info(`✓ Installed bundled persona: ${personaName}`);
380
+ }
381
+ catch (copyError) {
382
+ this.logger.warn(`Failed to copy bundled persona '${personaName}'`, copyError);
383
+ }
384
+ }
385
+ else if (existsSync(localPath)) {
386
+ this.logger.debug(`Bundled persona '${personaName}' already exists locally, skipping`);
387
+ }
388
+ }
389
+ }
390
+ catch (error) {
391
+ this.logger.warn('Failed to initialize bundled personas', error);
392
+ // Continue without bundled personas - this is optional
393
+ }
394
+ }
344
395
  /**
345
396
  * Initialize local personas
346
397
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-ingredients/tiny-brain-local",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "MCP server for Tiny Brain AI assistant",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "dxt:init": "cd dxt && dxt init"
32
32
  },
33
33
  "dependencies": {
34
- "@magic-ingredients/tiny-brain-core": "^0.15.0",
34
+ "@magic-ingredients/tiny-brain-core": "^0.15.1",
35
35
  "@magic-ingredients/tiny-brain-dashboard": "file:../tiny-brain-dashboard",
36
36
  "@modelcontextprotocol/sdk": "^1.0.6",
37
37
  "chalk": "^5.3.0",