briyah 2.0.6 → 2.0.8

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/README.md +105 -0
  2. package/data/packs/dnd5e/pack.json +7 -1
  3. package/dist-sdk/server/src/ai/agent.d.ts +27 -0
  4. package/dist-sdk/server/src/ai/agent.js +54 -13
  5. package/dist-sdk/server/src/app/user-service-factory.js +3 -0
  6. package/dist-sdk/server/src/app.controller.d.ts +7 -1
  7. package/dist-sdk/server/src/app.controller.js +55 -0
  8. package/dist-sdk/server/src/app.service.d.ts +114 -2
  9. package/dist-sdk/server/src/app.service.js +181 -4
  10. package/dist-sdk/server/src/documents/document-conversion.d.ts +70 -0
  11. package/dist-sdk/server/src/documents/document-conversion.js +394 -0
  12. package/dist-sdk/server/src/documents/library/chunking.d.ts +65 -0
  13. package/dist-sdk/server/src/documents/library/chunking.js +263 -0
  14. package/dist-sdk/server/src/documents/library/document-guide.builder.d.ts +2 -0
  15. package/dist-sdk/server/src/documents/library/document-guide.builder.js +58 -0
  16. package/dist-sdk/server/src/documents/library/document-registry.d.ts +22 -0
  17. package/dist-sdk/server/src/documents/library/document-registry.js +44 -0
  18. package/dist-sdk/server/src/documents/library/document.types.d.ts +108 -0
  19. package/dist-sdk/server/src/documents/library/document.types.js +20 -0
  20. package/dist-sdk/server/src/documents/library/embedding.d.ts +57 -0
  21. package/dist-sdk/server/src/documents/library/embedding.js +151 -0
  22. package/dist-sdk/server/src/packs/pack-manifest.d.ts +46 -0
  23. package/dist-sdk/server/src/packs/pack-manifest.js +46 -1
  24. package/dist-sdk/server/src/room/artifact-store.service.js +44 -11
  25. package/dist-sdk/server/src/room/artifact.d.ts +8 -0
  26. package/dist-sdk/server/src/room/room.js +7 -1
  27. package/dist-sdk/server/src/rpg/rpg-roster.d.ts +70 -29
  28. package/dist-sdk/server/src/rpg/rpg-roster.js +152 -41
  29. package/dist-sdk/server/src/rpg/rpg.service.d.ts +66 -29
  30. package/dist-sdk/server/src/rpg/rpg.service.js +140 -65
  31. package/dist-sdk/server/src/sdk/index.d.ts +12 -2
  32. package/dist-sdk/server/src/sdk/index.js +27 -1
  33. package/dist-sdk/server/src/tools/core/document.tools.d.ts +39 -0
  34. package/dist-sdk/server/src/tools/core/document.tools.js +391 -0
  35. package/dist-sdk/server/src/tools/core/index.js +2 -1
  36. package/dist-sdk/server/src/tools/native-tool.types.d.ts +37 -0
  37. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +23 -2
  38. package/dist-sdk/server/src/tools/tool-execution.service.js +30 -6
  39. package/dist-sdk/shared/types/app.types.d.ts +39 -5
  40. package/package.json +172 -167
@@ -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.6",
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.8",
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
+ "jszip": "^3.10.2",
104
+ "mammoth": "^1.13.0",
105
+ "multer": "^2.2.0",
106
+ "openai": "^7.4.0",
107
+ "passport": "^0.7.0",
108
+ "passport-jwt": "^4.0.1",
109
+ "pdf-data-parser": "^1.2.22",
110
+ "pdf-lib": "^1.17.1",
111
+ "reflect-metadata": "^0.2.2",
112
+ "rxjs": "^7.8.2",
113
+ "save": "^2.9.0",
114
+ "stripe": "~22.0.0",
115
+ "together-ai": "^0.47.0",
116
+ "turndown": "^7.2.4",
117
+ "yauzl": "^3.4.0",
118
+ "zod": "^4.4.3"
119
+ },
120
+ "devDependencies": {
121
+ "@nestjs/cli": "^11.0.24",
122
+ "@nestjs/schematics": "^11.1.0",
123
+ "@nestjs/testing": "^11.1.28",
124
+ "@types/bcrypt": "^6.0.0",
125
+ "@types/cookie-parser": "^1.4.10",
126
+ "@types/eventsource": "^3.0.0",
127
+ "@types/express": "^5.0.6",
128
+ "@types/jest": "^30.0.0",
129
+ "@types/multer": "^2.2.0",
130
+ "@types/node": "~24.x",
131
+ "@types/passport-jwt": "^4.0.1",
132
+ "@types/supertest": "^7.2.1",
133
+ "@types/turndown": "^5.0.6",
134
+ "@typescript-eslint/eslint-plugin": "^8.66.0",
135
+ "@typescript-eslint/parser": "^8.66.0",
136
+ "copyfiles": "^2.4.1",
137
+ "eslint": "^10.8.1",
138
+ "eslint-config-prettier": "^10.1.8",
139
+ "eslint-plugin-prettier": "^5.5.6",
140
+ "eventsource": "^4.1.1",
141
+ "jest": "^30.4.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
+ }