briyah 2.0.5 → 2.0.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 (55) hide show
  1. package/README.md +105 -0
  2. package/data/common/prompts/moderate.json +34 -0
  3. package/data/common/prompts/moderate.prompt +136 -0
  4. package/data/packs/dnd5e/pack.json +7 -1
  5. package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +16 -0
  6. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +23 -0
  7. package/dist-sdk/server/src/ai/agent.d.ts +33 -0
  8. package/dist-sdk/server/src/ai/agent.js +64 -13
  9. package/dist-sdk/server/src/app/user-service-factory.js +3 -0
  10. package/dist-sdk/server/src/app.controller.d.ts +7 -1
  11. package/dist-sdk/server/src/app.controller.js +55 -0
  12. package/dist-sdk/server/src/app.service.d.ts +114 -2
  13. package/dist-sdk/server/src/app.service.js +181 -4
  14. package/dist-sdk/server/src/data/data-guide.builder.d.ts +2 -0
  15. package/dist-sdk/server/src/data/data-guide.builder.js +90 -0
  16. package/dist-sdk/server/src/data/data-registry.d.ts +32 -0
  17. package/dist-sdk/server/src/data/data-registry.js +61 -0
  18. package/dist-sdk/server/src/data/data.types.d.ts +158 -0
  19. package/dist-sdk/server/src/data/data.types.js +24 -0
  20. package/dist-sdk/server/src/data/query-validation.d.ts +45 -0
  21. package/dist-sdk/server/src/data/query-validation.js +245 -0
  22. package/dist-sdk/server/src/documents/document-conversion.d.ts +70 -0
  23. package/dist-sdk/server/src/documents/document-conversion.js +341 -0
  24. package/dist-sdk/server/src/documents/library/chunking.d.ts +65 -0
  25. package/dist-sdk/server/src/documents/library/chunking.js +263 -0
  26. package/dist-sdk/server/src/documents/library/document-guide.builder.d.ts +2 -0
  27. package/dist-sdk/server/src/documents/library/document-guide.builder.js +58 -0
  28. package/dist-sdk/server/src/documents/library/document-registry.d.ts +22 -0
  29. package/dist-sdk/server/src/documents/library/document-registry.js +44 -0
  30. package/dist-sdk/server/src/documents/library/document.types.d.ts +108 -0
  31. package/dist-sdk/server/src/documents/library/document.types.js +20 -0
  32. package/dist-sdk/server/src/documents/library/embedding.d.ts +57 -0
  33. package/dist-sdk/server/src/documents/library/embedding.js +151 -0
  34. package/dist-sdk/server/src/packs/pack-manifest.d.ts +46 -0
  35. package/dist-sdk/server/src/packs/pack-manifest.js +46 -1
  36. package/dist-sdk/server/src/room/artifact-store.service.js +44 -11
  37. package/dist-sdk/server/src/room/artifact.d.ts +8 -0
  38. package/dist-sdk/server/src/room/room.d.ts +7 -5
  39. package/dist-sdk/server/src/room/room.js +44 -7
  40. package/dist-sdk/server/src/rpg/rpg-roster.d.ts +70 -29
  41. package/dist-sdk/server/src/rpg/rpg-roster.js +152 -41
  42. package/dist-sdk/server/src/rpg/rpg.service.d.ts +66 -29
  43. package/dist-sdk/server/src/rpg/rpg.service.js +140 -65
  44. package/dist-sdk/server/src/sdk/index.d.ts +16 -2
  45. package/dist-sdk/server/src/sdk/index.js +37 -1
  46. package/dist-sdk/server/src/tools/core/data.tools.d.ts +17 -0
  47. package/dist-sdk/server/src/tools/core/data.tools.js +165 -0
  48. package/dist-sdk/server/src/tools/core/document.tools.d.ts +39 -0
  49. package/dist-sdk/server/src/tools/core/document.tools.js +391 -0
  50. package/dist-sdk/server/src/tools/core/index.js +3 -1
  51. package/dist-sdk/server/src/tools/native-tool.types.d.ts +37 -0
  52. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +23 -2
  53. package/dist-sdk/server/src/tools/tool-execution.service.js +30 -6
  54. package/dist-sdk/shared/types/app.types.d.ts +39 -5
  55. package/package.json +172 -167
@@ -1,7 +1,16 @@
1
1
  import { ToolDefinition, ToolRunResult } from '../../../shared/types/app.types';
2
2
  import { ToolStoreService } from './tool-store.service';
3
3
  import { NativeToolRegistry } from './native-tool-registry.service';
4
- import { NativeToolDefinition, ToolHelpers, ToolContext, ToolIllustration, ToolPackDocuments, ToolRoomAccess } from './native-tool.types';
4
+ import { NativeToolDefinition, ToolHeldDocument, ToolHelpers, ToolContext, ToolIllustration, ToolPackDocuments, ToolRoomAccess } from './native-tool.types';
5
+ /**
6
+ * @internal What {@link ToolAgentDocuments} is built on: attachment for any agent,
7
+ * by id. Tools never see this — they get a copy bound to the calling agent.
8
+ */
9
+ export interface AgentDocumentStore {
10
+ attach(agentId: string, fileName: string, body: string): Promise<string>;
11
+ detach(agentId: string, documentId: string): Promise<boolean>;
12
+ held(agentId: string): Promise<ToolHeldDocument[]>;
13
+ }
5
14
  type CompiledTool = (args: Record<string, any>, helpers: ToolHelpers, context: ToolContext) => Promise<any>;
6
15
  /**
7
16
  * Executes tools an agent calls with the EXECUTE action. Tools come from two
@@ -21,6 +30,7 @@ export declare class ToolExecutionService {
21
30
  private readonly allowUserAuthoredTools;
22
31
  private readonly packDocuments?;
23
32
  private compiledCache;
33
+ private agentDocuments?;
24
34
  /**
25
35
  * @param toolStore The user's store of user-authored tools
26
36
  * @param nativeRegistry The process-wide registry of host-implemented tools
@@ -38,6 +48,11 @@ export declare class ToolExecutionService {
38
48
  * @returns The compiled async function
39
49
  */
40
50
  static compile(tool: ToolDefinition): CompiledTool;
51
+ /**
52
+ * @internal Wires the store behind `helpers.documents`. Set after construction
53
+ * because the store is the AppService, which is built after this service.
54
+ */
55
+ setAgentDocumentStore(store: AgentDocumentStore): void;
41
56
  /**
42
57
  * The room-facing entry point: validates the grant, the tool, and the
43
58
  * arguments before running. All failures are returned in-band as
@@ -47,9 +62,15 @@ export declare class ToolExecutionService {
47
62
  * @param grantedNames The tool names granted to the calling agent
48
63
  * @param context The host's opaque per-invocation context
49
64
  * @param room Access to the calling agent's room, exposed as helpers.room
65
+ * @param illustration The room's illustration capability, exposed as helpers.illustration
66
+ * @param callerAgentId The calling agent's id, from the room's own record of
67
+ * who is calling — never from anything the agent sent. `helpers.documents`
68
+ * is bound to it.
50
69
  * @returns The tool run result
51
70
  */
52
- runForAgent(name: string, contentJson: string, grantedNames: string[], context?: ToolContext, room?: ToolRoomAccess, illustration?: ToolIllustration): Promise<ToolRunResult>;
71
+ runForAgent(name: string, contentJson: string, grantedNames: string[], context?: ToolContext, room?: ToolRoomAccess, illustration?: ToolIllustration, callerAgentId?: string): Promise<ToolRunResult>;
72
+ /** `helpers.documents` for one agent, or undefined when there is no caller or no store. */
73
+ private documentsFor;
53
74
  /**
54
75
  * Runs a tool for the API test endpoint. Same validation as the agent path,
55
76
  * minus the grant check, so the Test panel shows the errors agents would get.
@@ -24,6 +24,7 @@ class ToolExecutionService {
24
24
  allowUserAuthoredTools;
25
25
  packDocuments;
26
26
  compiledCache = new Map();
27
+ agentDocuments;
27
28
  /**
28
29
  * @param toolStore The user's store of user-authored tools
29
30
  * @param nativeRegistry The process-wide registry of host-implemented tools
@@ -48,6 +49,13 @@ class ToolExecutionService {
48
49
  static compile(tool) {
49
50
  return new AsyncFunction('args', 'helpers', 'context', tool.code);
50
51
  }
52
+ /**
53
+ * @internal Wires the store behind `helpers.documents`. Set after construction
54
+ * because the store is the AppService, which is built after this service.
55
+ */
56
+ setAgentDocumentStore(store) {
57
+ this.agentDocuments = store;
58
+ }
51
59
  /**
52
60
  * The room-facing entry point: validates the grant, the tool, and the
53
61
  * arguments before running. All failures are returned in-band as
@@ -57,9 +65,13 @@ class ToolExecutionService {
57
65
  * @param grantedNames The tool names granted to the calling agent
58
66
  * @param context The host's opaque per-invocation context
59
67
  * @param room Access to the calling agent's room, exposed as helpers.room
68
+ * @param illustration The room's illustration capability, exposed as helpers.illustration
69
+ * @param callerAgentId The calling agent's id, from the room's own record of
70
+ * who is calling — never from anything the agent sent. `helpers.documents`
71
+ * is bound to it.
60
72
  * @returns The tool run result
61
73
  */
62
- async runForAgent(name, contentJson, grantedNames, context, room, illustration) {
74
+ async runForAgent(name, contentJson, grantedNames, context, room, illustration, callerAgentId) {
63
75
  if (!grantedNames.includes(name)) {
64
76
  return { ok: false, error: `Tool "${name}" is not available to you` };
65
77
  }
@@ -75,7 +87,18 @@ class ToolExecutionService {
75
87
  return { ok: false, error: 'Arguments must be a JSON object of named parameters' };
76
88
  }
77
89
  }
78
- return this.runValidated(name, args, context, room, illustration);
90
+ return this.runValidated(name, args, context, room, illustration, this.documentsFor(callerAgentId));
91
+ }
92
+ /** `helpers.documents` for one agent, or undefined when there is no caller or no store. */
93
+ documentsFor(agentId) {
94
+ const store = this.agentDocuments;
95
+ if (!store || !agentId)
96
+ return undefined;
97
+ return {
98
+ attach: (fileName, body) => store.attach(agentId, fileName, body),
99
+ detach: (documentId) => store.detach(agentId, documentId),
100
+ held: () => store.held(agentId),
101
+ };
79
102
  }
80
103
  /**
81
104
  * Runs a tool for the API test endpoint. Same validation as the agent path,
@@ -99,14 +122,14 @@ class ToolExecutionService {
99
122
  * @param room Access to the calling agent's room, if any
100
123
  * @returns The tool run result
101
124
  */
102
- async runValidated(name, args, context, room, illustration) {
125
+ async runValidated(name, args, context, room, illustration, documents) {
103
126
  // Native tools take precedence and are always available.
104
127
  const nativeTool = this.nativeRegistry.getTool(name);
105
128
  if (nativeTool) {
106
129
  const invalid = ToolExecutionService.validateParams(nativeTool.parameters, args);
107
130
  if (invalid)
108
131
  return { ok: false, error: invalid };
109
- return this.execute(name, nativeTool.timeoutMs, nativeTool.maxResultChars, (helpers) => nativeTool.handler(args, helpers, context), room, illustration);
132
+ return this.execute(name, nativeTool.timeoutMs, nativeTool.maxResultChars, (helpers) => nativeTool.handler(args, helpers, context), room, illustration, documents);
110
133
  }
111
134
  if (!this.allowUserAuthoredTools) {
112
135
  return { ok: false, error: `Tool "${name}" does not exist` };
@@ -125,7 +148,7 @@ class ToolExecutionService {
125
148
  catch (e) {
126
149
  return { ok: false, error: `Tool code does not compile: ${e.message}` };
127
150
  }
128
- return this.execute(name, tool.timeoutMs, tool.maxResultChars, (helpers) => fn(args, helpers, context), room, illustration);
151
+ return this.execute(name, tool.timeoutMs, tool.maxResultChars, (helpers) => fn(args, helpers, context), room, illustration, documents);
129
152
  }
130
153
  /**
131
154
  * Checks the LLM-supplied arguments against the declared parameters:
@@ -167,7 +190,7 @@ class ToolExecutionService {
167
190
  * @param room Access to the calling agent's room, omitted when there is none
168
191
  * @returns The tool run result
169
192
  */
170
- async execute(name, toolTimeoutMs, toolMaxResultChars, invoke, room, illustration) {
193
+ async execute(name, toolTimeoutMs, toolMaxResultChars, invoke, room, illustration, documents) {
171
194
  const timeoutMs = Math.min(toolTimeoutMs || DEFAULT_TIMEOUT_MS, MAX_TIMEOUT_MS);
172
195
  const controller = new AbortController();
173
196
  const helpers = {
@@ -175,6 +198,7 @@ class ToolExecutionService {
175
198
  ...(room ? { room } : {}),
176
199
  ...(illustration ? { illustration } : {}),
177
200
  ...(this.packDocuments ? { packDocuments: this.packDocuments } : {}),
201
+ ...(documents ? { documents } : {}),
178
202
  };
179
203
  let timeoutHandle;
180
204
  const timeout = new Promise((_, reject) => {
@@ -563,11 +563,11 @@ export interface RpgModelEntry {
563
563
  name: string;
564
564
  description: string;
565
565
  service: string;
566
- /** An AI player's model, and the crew's `modelRole: 'primary'` — the Dungeon Master. */
566
+ /** An AI player's model, and the crew's `modelRole: 'primary'` — the game's leader. */
567
567
  model: string;
568
568
  /** Same-service smaller model, for mechanical prompts like compaction. */
569
569
  small_model?: string;
570
- /** The `modelRole: 'economy'` tier: the four cheap crew agents. Falls back to primary. */
570
+ /** The `modelRole: 'economy'` tier: the cheap crew agents. Falls back to primary. */
571
571
  economy_service?: string;
572
572
  economy_model?: string;
573
573
  /** True for the entry the quality picker preselects. Expected on exactly one. */
@@ -589,6 +589,33 @@ export interface RpgModelOption {
589
589
  /** True for the entry to preselect. */
590
590
  isDefault?: boolean;
591
591
  }
592
+ /**
593
+ * A game as the create dialog is offered one: one installed pack's `table` block,
594
+ * resolved against the templates it names.
595
+ *
596
+ * Projected rather than served as stored, the same way {@link RpgModelOption} is: the
597
+ * room and agent template keys are the server's business, and the copy the dialog needs
598
+ * is derived from the pack's own templates so a pack never writes UI text twice.
599
+ */
600
+ export interface RpgPackOption {
601
+ /** The pack name, and what {@link CreateRpgCampaignRequest.pack} accepts. */
602
+ pack: string;
603
+ title: string;
604
+ description?: string;
605
+ /** What one player is called at this table: `Player`, `Student`. */
606
+ playerNoun: string;
607
+ /**
608
+ * The seats, in order. Its length is the table's capacity — a separate maximum would
609
+ * be a second copy of the same number.
610
+ */
611
+ seatNames: string[];
612
+ /** Crew the quality tier's own model runs. Labels, from the pack's agent templates. */
613
+ primaryRoles: string[];
614
+ /** Crew that runs on the tier's economy model. Empty when the pack asks for none. */
615
+ economyRoles: string[];
616
+ /** True for the pack to preselect. */
617
+ isDefault?: boolean;
618
+ }
592
619
  export interface RpgPlayerRequest {
593
620
  /**
594
621
  * A seat, not a character.
@@ -606,9 +633,11 @@ export interface RpgPlayerRequest {
606
633
  }
607
634
  export interface CreateRpgCampaignRequest {
608
635
  name: string;
636
+ /** An {@link RpgPackOption} name — the rules the table plays by. Absent takes the default. */
637
+ pack?: string;
609
638
  /**
610
- * An {@link RpgModelOption} name. Its model runs the Dungeon Master and its economy
611
- * tier the other four crew agents. Absent takes the file's default.
639
+ * An {@link RpgModelOption} name. Its model runs the crew's `primary` agents and its
640
+ * economy tier the rest. Absent takes the file's default.
612
641
  */
613
642
  quality?: string;
614
643
  /** In seating order. At least one, at least one of them human. */
@@ -628,13 +657,16 @@ export interface RpgPlayerInfo {
628
657
  export interface RpgCrewInfo {
629
658
  agentId: string;
630
659
  nickname: string;
631
- /** The pack template's key: dungeon_master, battle_master, table_moderator, ... */
660
+ /** The pack template's key: dungeon_master, discipleship_mentor, table_moderator, ... */
632
661
  role: string;
633
662
  }
634
663
  export interface RpgCampaignInfo {
635
664
  /** The template room's id: what the campaign is, and what deleting it deletes. */
636
665
  campaignId: string;
637
666
  name: string;
667
+ /** The pack whose rules the table plays by, and that pack's title. */
668
+ pack: string;
669
+ packTitle: string;
638
670
  /**
639
671
  * The published instance's id — the public link, and the room that is actually
640
672
  * played. Absent when the campaign has no instance, which only happens if one was
@@ -704,6 +736,8 @@ export interface Artifact {
704
736
  creator: string;
705
737
  body: string;
706
738
  viewers?: string[];
739
+ createdAt?: string;
740
+ updatedAt?: string;
707
741
  }
708
742
  export interface RoomArtifactsResponse {
709
743
  artifacts: Artifact[];
package/package.json CHANGED
@@ -1,167 +1,172 @@
1
- {
2
- "name": "briyah",
3
- "version": "2.0.5",
4
- "description": "SDK for AI agents, multi-agent rooms, interactive stories, and role-playing games with per-user data isolation and cost tracking",
5
- "private": false,
6
- "license": "Apache-2.0",
7
- "author": "Wilhite Software Consulting, LLC",
8
- "homepage": "https://briyah.ai/docs",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/WilhiteSoftwareLLC/briyah.git",
12
- "directory": "server"
13
- },
14
- "bugs": {
15
- "email": "jeff@wilhite.software"
16
- },
17
- "keywords": [
18
- "ai",
19
- "llm",
20
- "agents",
21
- "multi-agent",
22
- "ai-agents",
23
- "tool-calling",
24
- "anthropic",
25
- "claude",
26
- "openai",
27
- "sdk",
28
- "typescript",
29
- "rpg"
30
- ],
31
- "engines": {
32
- "node": ">=20.11.0"
33
- },
34
- "main": "dist-sdk/server/src/sdk/index.js",
35
- "types": "dist-sdk/server/src/sdk/index.d.ts",
36
- "files": [
37
- "dist-sdk/",
38
- "data/common/config",
39
- "!data/common/config/random_words.txt",
40
- "data/common/prompts",
41
- "data/packs/dnd5e",
42
- "README.md",
43
- "LICENSE"
44
- ],
45
- "exports": {
46
- ".": {
47
- "import": "./dist-sdk/server/src/sdk/index.js",
48
- "require": "./dist-sdk/server/src/sdk/index.js",
49
- "types": "./dist-sdk/server/src/sdk/index.d.ts"
50
- },
51
- "./package.json": "./package.json"
52
- },
53
- "scripts": {
54
- "prebuild": "rimraf dist",
55
- "build": "nest build",
56
- "build:sdk": "rimraf dist-sdk && tsc -p tsconfig.build.json",
57
- "docs": "typedoc",
58
- "update:prices": "node scripts/update-model-prices.js",
59
- "build:local": "npm run build:sdk && npm run docs",
60
- "prepublishOnly": "npm run build:sdk",
61
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
62
- "start": "nest start",
63
- "dev": "nest start --watch",
64
- "start:dev": "nest start --watch",
65
- "start:debug": "nest start --debug --watch",
66
- "start:prod": "node dist/main",
67
- "debug": "nest start --debug",
68
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
69
- "test": "jest",
70
- "test:watch": "jest --watch",
71
- "test:cov": "jest --coverage",
72
- "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
73
- "test:e2e": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json",
74
- "test:e2e:watch": "jest --config ./test/jest-e2e.json --watch",
75
- "test:e2e:cheap": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json --testPathIgnorePatterns=\"llm\" --testPathIgnorePatterns=\"conversation\" --testPathIgnorePatterns=\"stories\" --testPathIgnorePatterns=\"sse\" --testPathIgnorePatterns=\"workflow\"",
76
- "test:e2e:cov": "jest --silent --config ./test/jest-e2e.json --coverage"
77
- },
78
- "dependencies": {
79
- "@ai-sdk/deepseek": "^2.0.52",
80
- "@ai-sdk/google": "^3.0.104",
81
- "@ai-sdk/openai": "^3.0.91",
82
- "@ai-sdk/xai": "^3.0.115",
83
- "@anthropic-ai/sdk": "^0.116.0",
84
- "@fal-ai/client": "^1.10.1",
85
- "@google/genai": "^2.16.0",
86
- "@nestjs/common": "^11.1.28",
87
- "@nestjs/config": "^4.0.4",
88
- "@nestjs/core": "^11.1.28",
89
- "@nestjs/jwt": "^11.0.2",
90
- "@nestjs/passport": "^11.0.5",
91
- "@nestjs/platform-express": "^11.1.28",
92
- "@nestjs/serve-static": "^5.0.5",
93
- "@types/yauzl": "^3.4.0",
94
- "ai": "^6.0.246",
95
- "archiver": "^7.0.1",
96
- "bcrypt": "^6.0.0",
97
- "body-parser": "^2.3.0",
98
- "cookie-parser": "^1.4.7",
99
- "dotenv": "^17.4.2",
100
- "handlebars": "^4.7.9",
101
- "jsonrepair": "^3.15.0",
102
- "multer": "^2.2.0",
103
- "openai": "^7.4.0",
104
- "passport": "^0.7.0",
105
- "passport-jwt": "^4.0.1",
106
- "pdf-data-parser": "^1.2.22",
107
- "pdf-lib": "^1.17.1",
108
- "reflect-metadata": "^0.2.2",
109
- "rxjs": "^7.8.2",
110
- "save": "^2.9.0",
111
- "stripe": "~22.0.0",
112
- "together-ai": "^0.47.0",
113
- "yauzl": "^3.4.0",
114
- "zod": "^4.4.3"
115
- },
116
- "devDependencies": {
117
- "@nestjs/cli": "^11.0.24",
118
- "@nestjs/schematics": "^11.1.0",
119
- "@nestjs/testing": "^11.1.28",
120
- "@types/bcrypt": "^6.0.0",
121
- "@types/cookie-parser": "^1.4.10",
122
- "@types/eventsource": "^3.0.0",
123
- "@types/express": "^5.0.6",
124
- "@types/jest": "^30.0.0",
125
- "@types/multer": "^2.2.0",
126
- "@types/node": "~24.x",
127
- "@types/passport-jwt": "^4.0.1",
128
- "@types/supertest": "^7.2.1",
129
- "@typescript-eslint/eslint-plugin": "^8.66.0",
130
- "@typescript-eslint/parser": "^8.66.0",
131
- "copyfiles": "^2.4.1",
132
- "eslint": "^10.8.1",
133
- "eslint-config-prettier": "^10.1.8",
134
- "eslint-plugin-prettier": "^5.5.6",
135
- "eventsource": "^4.1.1",
136
- "jest": "^30.4.2",
137
- "prettier": "^3.9.6",
138
- "rimraf": "^6.1.3",
139
- "sharp": "^0.35.3",
140
- "source-map-support": "^0.5.21",
141
- "supertest": "^7.2.2",
142
- "ts-jest": "^29.4.12",
143
- "ts-loader": "^9.6.2",
144
- "ts-node": "^10.9.2",
145
- "tsc-alias": "^1.9.1",
146
- "tsconfig-paths": "^4.2.0",
147
- "typedoc": "^0.28.20",
148
- "typescript": "^5.9.3"
149
- },
150
- "jest": {
151
- "moduleFileExtensions": [
152
- "ts",
153
- "js",
154
- "json"
155
- ],
156
- "rootDir": "src",
157
- "testRegex": ".*\\.spec\\.ts$",
158
- "transform": {
159
- "^.+\\.(t|j)s$": "ts-jest"
160
- },
161
- "collectCoverageFrom": [
162
- "**/*.(t|j)s"
163
- ],
164
- "coverageDirectory": "../coverage",
165
- "testEnvironment": "node"
166
- }
167
- }
1
+ {
2
+ "name": "briyah",
3
+ "version": "2.0.7",
4
+ "description": "SDK for AI agents, multi-agent rooms, interactive stories, and role-playing games with per-user data isolation and cost tracking",
5
+ "private": false,
6
+ "license": "Apache-2.0",
7
+ "author": "Wilhite Software Consulting, LLC",
8
+ "homepage": "https://briyah.ai/docs",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/WilhiteSoftwareLLC/briyah.git",
12
+ "directory": "server"
13
+ },
14
+ "bugs": {
15
+ "email": "jeff@wilhite.software"
16
+ },
17
+ "keywords": [
18
+ "ai",
19
+ "llm",
20
+ "agents",
21
+ "multi-agent",
22
+ "ai-agents",
23
+ "tool-calling",
24
+ "anthropic",
25
+ "claude",
26
+ "openai",
27
+ "sdk",
28
+ "typescript",
29
+ "rpg"
30
+ ],
31
+ "engines": {
32
+ "node": ">=20.11.0"
33
+ },
34
+ "main": "dist-sdk/server/src/sdk/index.js",
35
+ "types": "dist-sdk/server/src/sdk/index.d.ts",
36
+ "files": [
37
+ "dist-sdk/",
38
+ "data/common/config",
39
+ "!data/common/config/random_words.txt",
40
+ "data/common/prompts",
41
+ "data/packs/dnd5e",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "exports": {
46
+ ".": {
47
+ "import": "./dist-sdk/server/src/sdk/index.js",
48
+ "require": "./dist-sdk/server/src/sdk/index.js",
49
+ "types": "./dist-sdk/server/src/sdk/index.d.ts"
50
+ },
51
+ "./package.json": "./package.json"
52
+ },
53
+ "scripts": {
54
+ "prebuild": "rimraf dist",
55
+ "build": "nest build",
56
+ "build:sdk": "rimraf dist-sdk && tsc -p tsconfig.build.json",
57
+ "docs": "typedoc",
58
+ "update:prices": "node scripts/update-model-prices.js",
59
+ "build:local": "npm run build:sdk && npm run docs",
60
+ "prepublishOnly": "npm run build:sdk",
61
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
62
+ "start": "nest start",
63
+ "dev": "nest start --watch",
64
+ "start:dev": "nest start --watch",
65
+ "start:debug": "nest start --debug --watch",
66
+ "start:prod": "node dist/main",
67
+ "debug": "nest start --debug",
68
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
69
+ "test": "jest",
70
+ "test:watch": "jest --watch",
71
+ "test:cov": "jest --coverage",
72
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
73
+ "test:e2e": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json",
74
+ "test:e2e:watch": "jest --config ./test/jest-e2e.json --watch",
75
+ "test:e2e:cheap": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json --testPathIgnorePatterns=\"llm\" --testPathIgnorePatterns=\"conversation\" --testPathIgnorePatterns=\"stories\" --testPathIgnorePatterns=\"sse\" --testPathIgnorePatterns=\"workflow\"",
76
+ "test:e2e:cov": "jest --silent --config ./test/jest-e2e.json --coverage"
77
+ },
78
+ "dependencies": {
79
+ "@ai-sdk/deepseek": "^2.0.52",
80
+ "@ai-sdk/google": "^3.0.104",
81
+ "@ai-sdk/openai": "^3.0.91",
82
+ "@ai-sdk/xai": "^3.0.115",
83
+ "@anthropic-ai/sdk": "^0.116.0",
84
+ "@fal-ai/client": "^1.10.1",
85
+ "@google/genai": "^2.16.0",
86
+ "@nestjs/common": "^11.1.28",
87
+ "@nestjs/config": "^4.0.4",
88
+ "@nestjs/core": "^11.1.28",
89
+ "@nestjs/jwt": "^11.0.2",
90
+ "@nestjs/passport": "^11.0.5",
91
+ "@nestjs/platform-express": "^11.1.28",
92
+ "@nestjs/serve-static": "^5.0.5",
93
+ "@types/yauzl": "^3.4.0",
94
+ "ai": "^6.0.246",
95
+ "archiver": "^7.0.1",
96
+ "bcrypt": "^6.0.0",
97
+ "body-parser": "^2.3.0",
98
+ "cookie-parser": "^1.4.7",
99
+ "dotenv": "^17.4.2",
100
+ "exceljs": "^4.4.0",
101
+ "handlebars": "^4.7.9",
102
+ "jsonrepair": "^3.15.0",
103
+ "mammoth": "^1.13.0",
104
+ "multer": "^2.2.0",
105
+ "openai": "^7.4.0",
106
+ "passport": "^0.7.0",
107
+ "passport-jwt": "^4.0.1",
108
+ "pdf-data-parser": "^1.2.22",
109
+ "pdf-lib": "^1.17.1",
110
+ "reflect-metadata": "^0.2.2",
111
+ "rxjs": "^7.8.2",
112
+ "save": "^2.9.0",
113
+ "stripe": "~22.0.0",
114
+ "together-ai": "^0.47.0",
115
+ "turndown": "^7.2.4",
116
+ "yauzl": "^3.4.0",
117
+ "zod": "^4.4.3"
118
+ },
119
+ "devDependencies": {
120
+ "@nestjs/cli": "^11.0.24",
121
+ "@nestjs/schematics": "^11.1.0",
122
+ "@nestjs/testing": "^11.1.28",
123
+ "@types/bcrypt": "^6.0.0",
124
+ "@types/cookie-parser": "^1.4.10",
125
+ "@types/eventsource": "^3.0.0",
126
+ "@types/express": "^5.0.6",
127
+ "@types/jest": "^30.0.0",
128
+ "@types/multer": "^2.2.0",
129
+ "@types/node": "~24.x",
130
+ "@types/passport-jwt": "^4.0.1",
131
+ "@types/supertest": "^7.2.1",
132
+ "@types/turndown": "^5.0.6",
133
+ "@typescript-eslint/eslint-plugin": "^8.66.0",
134
+ "@typescript-eslint/parser": "^8.66.0",
135
+ "copyfiles": "^2.4.1",
136
+ "eslint": "^10.8.1",
137
+ "eslint-config-prettier": "^10.1.8",
138
+ "eslint-plugin-prettier": "^5.5.6",
139
+ "eventsource": "^4.1.1",
140
+ "jest": "^30.4.2",
141
+ "jszip": "^3.10.2",
142
+ "prettier": "^3.9.6",
143
+ "rimraf": "^6.1.3",
144
+ "sharp": "^0.35.3",
145
+ "source-map-support": "^0.5.21",
146
+ "supertest": "^7.2.2",
147
+ "ts-jest": "^29.4.12",
148
+ "ts-loader": "^9.6.2",
149
+ "ts-node": "^10.9.2",
150
+ "tsc-alias": "^1.9.1",
151
+ "tsconfig-paths": "^4.2.0",
152
+ "typedoc": "^0.28.20",
153
+ "typescript": "^5.9.3"
154
+ },
155
+ "jest": {
156
+ "moduleFileExtensions": [
157
+ "ts",
158
+ "js",
159
+ "json"
160
+ ],
161
+ "rootDir": "src",
162
+ "testRegex": ".*\\.spec\\.ts$",
163
+ "transform": {
164
+ "^.+\\.(t|j)s$": "ts-jest"
165
+ },
166
+ "collectCoverageFrom": [
167
+ "**/*.(t|j)s"
168
+ ],
169
+ "coverageDirectory": "../coverage",
170
+ "testEnvironment": "node"
171
+ }
172
+ }