briyah 1.1.1 → 1.1.3

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 (59) hide show
  1. package/README.md +3 -3
  2. package/dist-sdk/server/src/ai/ai-factory.module.js +0 -2
  3. package/dist-sdk/server/src/ai/ai-factory.service.d.ts +1 -3
  4. package/dist-sdk/server/src/ai/ai-factory.service.js +1 -8
  5. package/dist-sdk/server/src/config/configuration.service.d.ts +0 -2
  6. package/dist-sdk/server/src/config/configuration.service.js +0 -8
  7. package/dist-sdk/server/src/sdk/briyah.d.ts +1 -0
  8. package/dist-sdk/server/src/sdk/briyah.js +16 -7
  9. package/docs/assets/hierarchy.js +1 -1
  10. package/docs/classes/Agent.html +14 -14
  11. package/docs/classes/Briyah.html +12 -12
  12. package/docs/classes/BriyahConfigService.html +5 -5
  13. package/docs/classes/Room.html +23 -23
  14. package/docs/classes/RoomMessage.html +10 -10
  15. package/docs/enums/MessageAction.html +3 -3
  16. package/docs/hierarchy.html +1 -1
  17. package/docs/index.html +5 -4
  18. package/docs/interfaces/AgentInfo.html +2 -2
  19. package/docs/interfaces/AgentMessagesResponse.html +2 -2
  20. package/docs/interfaces/AppService.html +109 -109
  21. package/docs/interfaces/Artifact.html +3 -3
  22. package/docs/interfaces/ArtifactMetadata.html +2 -2
  23. package/docs/interfaces/AttachDocumentResponse.html +2 -2
  24. package/docs/interfaces/BriyahConfigOptions.html +6 -6
  25. package/docs/interfaces/ChapterInfo.html +2 -2
  26. package/docs/interfaces/Character.html +2 -2
  27. package/docs/interfaces/CreateAgentResponse.html +2 -2
  28. package/docs/interfaces/CreateRoomResponse.html +2 -2
  29. package/docs/interfaces/CreateStoryResponse.html +2 -2
  30. package/docs/interfaces/FileList.html +2 -2
  31. package/docs/interfaces/LoggingOptions.html +5 -5
  32. package/docs/interfaces/Message.html +2 -2
  33. package/docs/interfaces/ModelInfo.html +2 -2
  34. package/docs/interfaces/PreparedPromptResponse.html +2 -2
  35. package/docs/interfaces/ProcessTextResponse.html +2 -2
  36. package/docs/interfaces/PromptFile.html +2 -2
  37. package/docs/interfaces/PromptFileContent.html +2 -2
  38. package/docs/interfaces/PromptFilesResponse.html +2 -2
  39. package/docs/interfaces/PromptFolder.html +2 -2
  40. package/docs/interfaces/PromptFoldersResponse.html +2 -2
  41. package/docs/interfaces/RoomDetails.html +2 -2
  42. package/docs/interfaces/RoomInfo.html +2 -2
  43. package/docs/interfaces/RoomMessagesResponse.html +2 -2
  44. package/docs/interfaces/StoryErrorEvent.html +3 -3
  45. package/docs/interfaces/StoryIdea.html +2 -2
  46. package/docs/interfaces/StoryInfo.html +3 -3
  47. package/docs/interfaces/StoryIntroduceCharacterEvent.html +3 -3
  48. package/docs/interfaces/StoryProgressChapterEvent.html +3 -3
  49. package/docs/interfaces/StoryState.html +5 -5
  50. package/docs/interfaces/StoryStateEvent.html +3 -3
  51. package/docs/interfaces/Transaction.html +2 -2
  52. package/docs/interfaces/TransactionHistoryResponse.html +2 -2
  53. package/docs/modules.html +1 -1
  54. package/docs/types/PromptScope.html +1 -1
  55. package/package.json +1 -4
  56. package/dist-sdk/server/src/ai/LLM/vertexai.module.d.ts +0 -2
  57. package/dist-sdk/server/src/ai/LLM/vertexai.module.js +0 -21
  58. package/dist-sdk/server/src/ai/LLM/vertexai.service.d.ts +0 -17
  59. package/dist-sdk/server/src/ai/LLM/vertexai.service.js +0 -321
package/README.md CHANGED
@@ -87,10 +87,11 @@ interface BriyahConfigOptions {
87
87
  **LLM Provider API Keys** (at least one required):
88
88
  - `ANTHROPIC_API_KEY` - For Claude models
89
89
  - `OPENAI_API_KEY` - For GPT models
90
- - `GOOGLE_VERTEX_PROJECT_ID` - For Google Vertex AI
90
+ - `GOOGLE_GENAI_API_KEY` - For Google AI (Gemini) models
91
91
  - `XAI_API_KEY` - For Grok models
92
92
  - `DEEPSEEK_API_KEY` - For DeepSeek models
93
93
  - `TOGETHER_API_KEY` - For Together AI models
94
+ - `FAL_API_KEY` - For Fal image-generation models
94
95
 
95
96
  **Optional:**
96
97
  - `STARTING_BALANCE` - Starting balance for new users (e.g., "10.00")
@@ -470,8 +471,7 @@ Briyah stores data in the following structure:
470
471
  ```
471
472
  {dataPath}/
472
473
  ├── common/ # Shared across all users
473
- │ ├── creds/ # Service account credentials
474
- │ ├── prices/ # LLM pricing data
474
+ │ ├── config/ # LLM pricing and image-model config
475
475
  │ ├── prompts/ # Global prompt templates
476
476
  │ └── published-agents.json # Published agent mappings
477
477
  └── user/
@@ -11,7 +11,6 @@ const common_1 = require("@nestjs/common");
11
11
  const ai_factory_service_1 = require("./ai-factory.service");
12
12
  const openai_module_1 = require("./LLM/openai.module");
13
13
  const grok_module_1 = require("./LLM/grok.module");
14
- const vertexai_module_1 = require("./LLM/vertexai.module");
15
14
  const anthropic_module_1 = require("./LLM/anthropic.module");
16
15
  const deepseek_module_1 = require("./LLM/deepseek.module");
17
16
  const together_module_1 = require("./LLM/together.module");
@@ -26,7 +25,6 @@ exports.AiFactoryModule = AiFactoryModule = __decorate([
26
25
  imports: [
27
26
  openai_module_1.OpenAiModule,
28
27
  grok_module_1.GrokAiModule,
29
- vertexai_module_1.VertexAiModule,
30
28
  anthropic_module_1.AnthropicAiModule,
31
29
  deepseek_module_1.DeepSeekAiModule,
32
30
  together_module_1.TogetherAiModule,
@@ -1,7 +1,6 @@
1
1
  import { BaseAiService } from './LLM/base-ai.service';
2
2
  import { OpenAiService } from './LLM/openai.service';
3
3
  import { GrokAiService } from './LLM/grok.service';
4
- import { VertexAiService } from './LLM/vertexai.service';
5
4
  import { AnthropicAiService } from './LLM/anthropic.service';
6
5
  import { DeepSeekAiService } from './LLM/deepseek.service';
7
6
  import { TogetherAiService } from './LLM/together.service';
@@ -11,14 +10,13 @@ import { FalAiService } from './LLM/fal.service';
11
10
  export declare class AiFactoryService {
12
11
  private readonly openAiService;
13
12
  private readonly grokAiService;
14
- private readonly vertexAiService;
15
13
  private readonly anthropicAiService;
16
14
  private readonly deepSeekAiService;
17
15
  private readonly togetherAiService;
18
16
  private readonly mockAiService;
19
17
  private readonly googleAiService;
20
18
  private readonly falAiService;
21
- constructor(openAiService: OpenAiService, grokAiService: GrokAiService, vertexAiService: VertexAiService, anthropicAiService: AnthropicAiService, deepSeekAiService: DeepSeekAiService, togetherAiService: TogetherAiService, mockAiService: MockAiService, googleAiService: GoogleAiService, falAiService: FalAiService);
19
+ constructor(openAiService: OpenAiService, grokAiService: GrokAiService, anthropicAiService: AnthropicAiService, deepSeekAiService: DeepSeekAiService, togetherAiService: TogetherAiService, mockAiService: MockAiService, googleAiService: GoogleAiService, falAiService: FalAiService);
22
20
  createAiService(serviceName: string): BaseAiService;
23
21
  getAllAiServices(): BaseAiService[];
24
22
  }
@@ -13,7 +13,6 @@ exports.AiFactoryService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const openai_service_1 = require("./LLM/openai.service");
15
15
  const grok_service_1 = require("./LLM/grok.service");
16
- const vertexai_service_1 = require("./LLM/vertexai.service");
17
16
  const anthropic_service_1 = require("./LLM/anthropic.service");
18
17
  const deepseek_service_1 = require("./LLM/deepseek.service");
19
18
  const together_service_1 = require("./LLM/together.service");
@@ -23,17 +22,15 @@ const fal_service_1 = require("./LLM/fal.service");
23
22
  let AiFactoryService = class AiFactoryService {
24
23
  openAiService;
25
24
  grokAiService;
26
- vertexAiService;
27
25
  anthropicAiService;
28
26
  deepSeekAiService;
29
27
  togetherAiService;
30
28
  mockAiService;
31
29
  googleAiService;
32
30
  falAiService;
33
- constructor(openAiService, grokAiService, vertexAiService, anthropicAiService, deepSeekAiService, togetherAiService, mockAiService, googleAiService, falAiService) {
31
+ constructor(openAiService, grokAiService, anthropicAiService, deepSeekAiService, togetherAiService, mockAiService, googleAiService, falAiService) {
34
32
  this.openAiService = openAiService;
35
33
  this.grokAiService = grokAiService;
36
- this.vertexAiService = vertexAiService;
37
34
  this.anthropicAiService = anthropicAiService;
38
35
  this.deepSeekAiService = deepSeekAiService;
39
36
  this.togetherAiService = togetherAiService;
@@ -47,8 +44,6 @@ let AiFactoryService = class AiFactoryService {
47
44
  return this.openAiService;
48
45
  case this.grokAiService.getServiceName():
49
46
  return this.grokAiService;
50
- case this.vertexAiService.getServiceName():
51
- return this.vertexAiService;
52
47
  case this.anthropicAiService.getServiceName():
53
48
  return this.anthropicAiService;
54
49
  case this.deepSeekAiService.getServiceName():
@@ -69,7 +64,6 @@ let AiFactoryService = class AiFactoryService {
69
64
  return [
70
65
  this.openAiService,
71
66
  this.grokAiService,
72
- this.vertexAiService,
73
67
  this.anthropicAiService,
74
68
  this.deepSeekAiService,
75
69
  this.togetherAiService,
@@ -84,7 +78,6 @@ exports.AiFactoryService = AiFactoryService = __decorate([
84
78
  (0, common_1.Injectable)(),
85
79
  __metadata("design:paramtypes", [openai_service_1.OpenAiService,
86
80
  grok_service_1.GrokAiService,
87
- vertexai_service_1.VertexAiService,
88
81
  anthropic_service_1.AnthropicAiService,
89
82
  deepseek_service_1.DeepSeekAiService,
90
83
  together_service_1.TogetherAiService,
@@ -1,6 +1,5 @@
1
1
  export declare class ConfigurationService {
2
2
  private dataDir;
3
- private credsDir;
4
3
  private promptsDir;
5
4
  private commonPromptsDir;
6
5
  private userPromptsDir;
@@ -11,7 +10,6 @@ export declare class ConfigurationService {
11
10
  private userId;
12
11
  constructor(userId: string, baseDataPath?: string);
13
12
  getDataDir(): string;
14
- getCredsDir(): string;
15
13
  getPromptsDir(): string;
16
14
  getUploadDir(): string;
17
15
  getUserConfigDir(): string;
@@ -38,7 +38,6 @@ const fs = __importStar(require("fs"));
38
38
  const path = __importStar(require("path"));
39
39
  class ConfigurationService {
40
40
  dataDir;
41
- credsDir;
42
41
  promptsDir;
43
42
  commonPromptsDir;
44
43
  userPromptsDir;
@@ -55,10 +54,6 @@ class ConfigurationService {
55
54
  fs.mkdirSync(this.dataDir, { recursive: true });
56
55
  }
57
56
  const commonDir = path.resolve(this.dataDir, 'common');
58
- this.credsDir = path.resolve(commonDir, 'creds');
59
- if (!fs.existsSync(this.credsDir)) {
60
- fs.mkdirSync(this.credsDir, { recursive: true });
61
- }
62
57
  this.commonConfigDir = path.resolve(commonDir, 'config');
63
58
  if (!fs.existsSync(this.commonConfigDir)) {
64
59
  fs.mkdirSync(this.commonConfigDir, { recursive: true });
@@ -85,9 +80,6 @@ class ConfigurationService {
85
80
  getDataDir() {
86
81
  return this.dataDir;
87
82
  }
88
- getCredsDir() {
89
- return this.credsDir;
90
- }
91
83
  getPromptsDir() {
92
84
  return this.promptsDir;
93
85
  }
@@ -19,6 +19,7 @@ export declare class Briyah {
19
19
  private validateEnvironment;
20
20
  private initializeSingletons;
21
21
  init(): Promise<void>;
22
+ private static readonly ALWAYS_REFRESH_FILES;
22
23
  private seedCommonData;
23
24
  getAppService(userId: string): AppService;
24
25
  removeUserService(userId: string): void;
@@ -40,7 +40,6 @@ const logger_1 = require("../common/logger");
40
40
  const ai_factory_service_1 = require("../ai/ai-factory.service");
41
41
  const openai_service_1 = require("../ai/LLM/openai.service");
42
42
  const anthropic_service_1 = require("../ai/LLM/anthropic.service");
43
- const vertexai_service_1 = require("../ai/LLM/vertexai.service");
44
43
  const grok_service_1 = require("../ai/LLM/grok.service");
45
44
  const deepseek_service_1 = require("../ai/LLM/deepseek.service");
46
45
  const together_service_1 = require("../ai/LLM/together.service");
@@ -85,14 +84,14 @@ class Briyah {
85
84
  validateEnvironment() {
86
85
  const hasAnyProvider = this.configService.get('ANTHROPIC_API_KEY') ||
87
86
  this.configService.get('OPENAI_API_KEY') ||
88
- this.configService.get('GOOGLE_VERTEX_PROJECT_ID') ||
87
+ this.configService.get('GOOGLE_GENAI_API_KEY') ||
89
88
  this.configService.get('XAI_API_KEY') ||
90
89
  this.configService.get('DEEPSEEK_API_KEY') ||
91
- this.configService.get('TOGETHER_API_KEY');
92
- this.configService.get('FAL_API_KEY');
90
+ this.configService.get('TOGETHER_API_KEY') ||
91
+ this.configService.get('FAL_API_KEY');
93
92
  if (!hasAnyProvider) {
94
93
  logger_1.logger.warn('[Briyah] No LLM provider API keys configured. Some features will not be available.');
95
- logger_1.logger.warn('[Briyah] Set one or more of: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_VERTEX_PROJECT_ID, XAI_API_KEY, DEEPSEEK_API_KEY, TOGETHER_API_KEY');
94
+ logger_1.logger.warn('[Briyah] Set one or more of: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENAI_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, TOGETHER_API_KEY, FAL_API_KEY');
96
95
  }
97
96
  const startingBalance = this.configService.get('STARTING_BALANCE');
98
97
  if (!startingBalance) {
@@ -102,14 +101,13 @@ class Briyah {
102
101
  initializeSingletons(_baseDataPath) {
103
102
  const openAiService = new openai_service_1.OpenAiService();
104
103
  const anthropicService = new anthropic_service_1.AnthropicAiService();
105
- const vertexService = new vertexai_service_1.VertexAiService();
106
104
  const grokService = new grok_service_1.GrokAiService();
107
105
  const deepseekService = new deepseek_service_1.DeepSeekAiService();
108
106
  const togetherService = new together_service_1.TogetherAiService();
109
107
  const mockService = new mock_service_1.MockAiService();
110
108
  const googleAiService = new googleai_service_1.GoogleAiService();
111
109
  const falAiService = new fal_service_1.FalAiService();
112
- this.aiFactoryService = new ai_factory_service_1.AiFactoryService(openAiService, grokService, vertexService, anthropicService, deepseekService, togetherService, mockService, googleAiService, falAiService);
110
+ this.aiFactoryService = new ai_factory_service_1.AiFactoryService(openAiService, grokService, anthropicService, deepseekService, togetherService, mockService, googleAiService, falAiService);
113
111
  this.agentMessageService = new agent_message_service_1.AgentMessageService();
114
112
  this.roomMessageService = new room_message_service_1.RoomMessageService();
115
113
  this.storyProgressService = new story_progress_service_1.StoryProgressService();
@@ -130,6 +128,9 @@ class Briyah {
130
128
  this.userServiceManager.onModuleInit();
131
129
  this.initialized = true;
132
130
  }
131
+ static ALWAYS_REFRESH_FILES = [
132
+ 'config/model_prices.json',
133
+ ];
133
134
  seedCommonData() {
134
135
  const dataPath = this.configService.get('BRIYAH_DATA_PATH') || path.resolve(process.cwd(), 'briyah-data');
135
136
  const userCommonDir = path.resolve(dataPath, 'common');
@@ -145,6 +146,14 @@ class Briyah {
145
146
  fs.mkdirSync(target, { recursive: true });
146
147
  fs.cpSync(source, target, { recursive: true, force: false, errorOnExist: false });
147
148
  }
149
+ for (const relPath of Briyah.ALWAYS_REFRESH_FILES) {
150
+ const source = path.resolve(packageCommonDir, relPath);
151
+ const target = path.resolve(userCommonDir, relPath);
152
+ if (!fs.existsSync(source))
153
+ continue;
154
+ fs.mkdirSync(path.dirname(target), { recursive: true });
155
+ fs.copyFileSync(source, target);
156
+ }
148
157
  }
149
158
  getAppService(userId) {
150
159
  if (!this.initialized) {
@@ -1 +1 @@
1
- window.hierarchyData = "eJx1jc0KwjAQhN9lzqkliq3sO3jxWnoI7dYG0wSy8VTy7hL/KIKngZ1v51sRQ0gC6hrd9gqRJ8dDssELaEWj2xLeLAzCmUXMlaFws34E7Y+Nwj06EKxPHCczsNRvajenxUFhcEYEhCRjVd6qL1rK2boxsgd1Wh90nxVKbpyXEJZfr96fPt7nOku9wf6KX4ec8wMBuFA6"
1
+ window.hierarchyData = "eJx1jc0KgzAQhN9lzrESS0X2HXrpVTwEXWtoTCCbniTvXtI/pNDTwM63822IISQB9a3uBoXIs+Mx2eAFtKHVXQlvVgbhzCLmylC4WT+BmlOrcI8OBOsTx9mMLPWbOixpdVAYnREBIclUlbfqi5ZysW6K7EG91sdmyAold85LCOuvVzfdx/tcZ6l32F/x65BzfgAEPVA+"