@ai-rpg-engine/campaign-memory 2.1.7 → 2.4.0
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.
- package/LICENSE +21 -0
- package/README.es.md +45 -45
- package/README.fr.md +45 -45
- package/README.hi.md +45 -45
- package/README.it.md +45 -45
- package/README.ja.md +45 -45
- package/README.md +104 -104
- package/README.pt-BR.md +45 -45
- package/README.zh.md +45 -45
- package/dist/journal.d.ts +13 -1
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +29 -9
- package/dist/journal.js.map +1 -1
- package/dist/memory-bank.d.ts +7 -1
- package/dist/memory-bank.d.ts.map +1 -1
- package/dist/memory-bank.js +17 -1
- package/dist/memory-bank.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MCP Tool Shop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.es.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.md">English</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Memoria persistente de los personajes no jugables (PNJs), relaciones multidimens
|
|
|
15
15
|
|
|
16
16
|
## Instalación
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## ¿Qué hace?
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ Los PNJs recuerdan lo que ha sucedido. No solo "hostil: verdadero", sino que reg
|
|
|
27
27
|
|
|
28
28
|
### Diario de campaña
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banco de memoria de los PNJs
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Ejes de relación
|
|
74
74
|
|
package/README.fr.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.md">English</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Mémoire persistante des PNJ, relations multi-axes et journal de campagne pour [
|
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## Fonctionnalités
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ Les PNJ se souviennent de ce qui s'est passé. Il ne s'agit pas seulement de "ho
|
|
|
27
27
|
|
|
28
28
|
### Journal de campagne
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banque de mémoire des PNJ
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Axes de relations
|
|
74
74
|
|
package/README.hi.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.md">English</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
## इंस्टॉलेशन
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## यह क्या करता है
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ npm install @ai-rpg-engine/campaign-memory
|
|
|
27
27
|
|
|
28
28
|
### अभियान जर्नल
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### एनपीसी मेमोरी बैंक
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### संबंधों के आयाम
|
|
74
74
|
|
package/README.it.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.md">English</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Memoria persistente dei personaggi non giocanti (PNG), relazioni multidimensiona
|
|
|
15
15
|
|
|
16
16
|
## Installazione
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## Funzionalità
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ I PNG ricordano ciò che è successo. Non solo "ostile: true" — tracciano fidu
|
|
|
27
27
|
|
|
28
28
|
### Diario di campagna
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banca di memoria dei PNG
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Assi di relazione
|
|
74
74
|
|
package/README.ja.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.md">English</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
## インストール
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## 機能概要
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ NPCは、起こったことを記憶します。単に「敵対的:true」と
|
|
|
27
27
|
|
|
28
28
|
### キャンペーンジャーナル
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### NPCの記憶バンク
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### 関係性の軸
|
|
74
74
|
|
package/README.md
CHANGED
|
@@ -2,107 +2,107 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
|
-
# @ai-rpg-engine/campaign-memory
|
|
10
|
-
|
|
11
|
-
[](https://www.npmjs.com/package/@ai-rpg-engine/campaign-memory)
|
|
12
|
-
[](https://github.com/mcp-tool-shop-org/ai-rpg-engine/blob/main/LICENSE)
|
|
13
|
-
|
|
14
|
-
Persistent NPC memory, multi-axis relationships, and campaign journal for [AI RPG Engine](https://github.com/mcp-tool-shop-org/ai-rpg-engine).
|
|
15
|
-
|
|
16
|
-
## Install
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## What It Does
|
|
23
|
-
|
|
24
|
-
NPCs remember what happened. Not just "hostile: true" — they track trust, fear, admiration, and familiarity across every interaction. Memories fade over time: vivid → faded → dim → forgotten. The campaign journal persists significant events across sessions.
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
### Campaign Journal
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### NPC Memory Bank
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Relationship Axes
|
|
74
|
-
|
|
75
|
-
| Axis | Range | Meaning |
|
|
76
|
-
|------|-------|---------|
|
|
77
|
-
| trust | -1 to 1 | Distrust → Trust |
|
|
78
|
-
| fear | 0 to 1 | Unafraid → Terrified |
|
|
79
|
-
| admiration | -1 to 1 | Contempt → Admiration |
|
|
80
|
-
| familiarity | 0 to 1 | Stranger → Intimate |
|
|
81
|
-
|
|
82
|
-
### Record Categories
|
|
83
|
-
|
|
84
|
-
`action` · `combat` · `kill` · `betrayal` · `gift` · `theft` · `debt` · `discovery` · `alliance` · `insult` · `rescue` · `death`
|
|
85
|
-
|
|
86
|
-
Each category has default relationship effects. A rescue builds trust (+0.4) and admiration (+0.3). A betrayal destroys trust (-0.5).
|
|
87
|
-
|
|
88
|
-
### Memory Consolidation
|
|
89
|
-
|
|
90
|
-
Memories decay over time through three stages:
|
|
91
|
-
|
|
92
|
-
- **vivid** — high salience, recently formed
|
|
93
|
-
- **faded** — salience dropped below fade threshold
|
|
94
|
-
- **dim** — barely remembered, about to be forgotten
|
|
95
|
-
|
|
96
|
-
Configure decay rates per-NPC or globally.
|
|
97
|
-
|
|
98
|
-
## Serialization
|
|
99
|
-
|
|
100
|
-
Both `CampaignJournal` and `NpcMemoryBank` support `serialize()` and `deserialize()` for persistence across sessions.
|
|
101
|
-
|
|
102
|
-
## Part of AI RPG Engine
|
|
103
|
-
|
|
104
|
-
This package is part of the [AI RPG Engine](https://github.com/mcp-tool-shop-org/ai-rpg-engine) monorepo. It works standalone or integrates with the engine's cognition and rumor systems.
|
|
105
|
-
|
|
106
|
-
## License
|
|
107
|
-
|
|
108
|
-
MIT
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
# @ai-rpg-engine/campaign-memory
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@ai-rpg-engine/campaign-memory)
|
|
12
|
+
[](https://github.com/mcp-tool-shop-org/ai-rpg-engine/blob/main/LICENSE)
|
|
13
|
+
|
|
14
|
+
Persistent NPC memory, multi-axis relationships, and campaign journal for [AI RPG Engine](https://github.com/mcp-tool-shop-org/ai-rpg-engine).
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What It Does
|
|
23
|
+
|
|
24
|
+
NPCs remember what happened. Not just "hostile: true" — they track trust, fear, admiration, and familiarity across every interaction. Memories fade over time: vivid → faded → dim → forgotten. The campaign journal persists significant events across sessions.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Campaign Journal
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### NPC Memory Bank
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Relationship Axes
|
|
74
|
+
|
|
75
|
+
| Axis | Range | Meaning |
|
|
76
|
+
|------|-------|---------|
|
|
77
|
+
| trust | -1 to 1 | Distrust → Trust |
|
|
78
|
+
| fear | 0 to 1 | Unafraid → Terrified |
|
|
79
|
+
| admiration | -1 to 1 | Contempt → Admiration |
|
|
80
|
+
| familiarity | 0 to 1 | Stranger → Intimate |
|
|
81
|
+
|
|
82
|
+
### Record Categories
|
|
83
|
+
|
|
84
|
+
`action` · `combat` · `kill` · `betrayal` · `gift` · `theft` · `debt` · `discovery` · `alliance` · `insult` · `rescue` · `death`
|
|
85
|
+
|
|
86
|
+
Each category has default relationship effects. A rescue builds trust (+0.4) and admiration (+0.3). A betrayal destroys trust (-0.5).
|
|
87
|
+
|
|
88
|
+
### Memory Consolidation
|
|
89
|
+
|
|
90
|
+
Memories decay over time through three stages:
|
|
91
|
+
|
|
92
|
+
- **vivid** — high salience, recently formed
|
|
93
|
+
- **faded** — salience dropped below fade threshold
|
|
94
|
+
- **dim** — barely remembered, about to be forgotten
|
|
95
|
+
|
|
96
|
+
Configure decay rates per-NPC or globally.
|
|
97
|
+
|
|
98
|
+
## Serialization
|
|
99
|
+
|
|
100
|
+
Both `CampaignJournal` and `NpcMemoryBank` support `serialize()` and `deserialize()` for persistence across sessions.
|
|
101
|
+
|
|
102
|
+
## Part of AI RPG Engine
|
|
103
|
+
|
|
104
|
+
This package is part of the [AI RPG Engine](https://github.com/mcp-tool-shop-org/ai-rpg-engine) monorepo. It works standalone or integrates with the engine's cognition and rumor systems.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
package/README.pt-BR.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.md">English</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ Memória persistente de NPCs, relações multi-eixos e diário de campanha para
|
|
|
15
15
|
|
|
16
16
|
## Instalação
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## O que ele faz
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ Os NPCs se lembram do que aconteceu. Não apenas "hostil: verdadeiro" — eles r
|
|
|
27
27
|
|
|
28
28
|
### Diário de Campanha
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### Banco de Memória de NPCs
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### Eixos de Relação
|
|
74
74
|
|
package/README.zh.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<a href="README.ja.md">日本語</a> | <a href="README.md">English</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
-
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
|
|
7
|
+
</p>
|
|
8
8
|
|
|
9
9
|
# @ai-rpg-engine/campaign-memory
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
## 安装
|
|
17
17
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
-
```
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ai-rpg-engine/campaign-memory
|
|
20
|
+
```
|
|
21
21
|
|
|
22
22
|
## 功能
|
|
23
23
|
|
|
@@ -27,48 +27,48 @@ NPC 会记住发生的事情。 不仅仅是“敌对:true”,他们会跟
|
|
|
27
27
|
|
|
28
28
|
### 战役日志
|
|
29
29
|
|
|
30
|
-
```typescript
|
|
31
|
-
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
-
|
|
33
|
-
const journal = new CampaignJournal();
|
|
34
|
-
|
|
35
|
-
// Record a significant event
|
|
36
|
-
const record = journal.record({
|
|
37
|
-
tick: 42,
|
|
38
|
-
category: 'kill',
|
|
39
|
-
actorId: 'player',
|
|
40
|
-
targetId: 'merchant_1',
|
|
41
|
-
zoneId: 'market',
|
|
42
|
-
description: 'Player killed the merchant during a robbery',
|
|
43
|
-
significance: 0.9,
|
|
44
|
-
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
-
data: { weapon: 'dagger' },
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Query the journal
|
|
49
|
-
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
-
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
-
```
|
|
30
|
+
```typescript
|
|
31
|
+
import { CampaignJournal } from '@ai-rpg-engine/campaign-memory';
|
|
32
|
+
|
|
33
|
+
const journal = new CampaignJournal();
|
|
34
|
+
|
|
35
|
+
// Record a significant event
|
|
36
|
+
const record = journal.record({
|
|
37
|
+
tick: 42,
|
|
38
|
+
category: 'kill',
|
|
39
|
+
actorId: 'player',
|
|
40
|
+
targetId: 'merchant_1',
|
|
41
|
+
zoneId: 'market',
|
|
42
|
+
description: 'Player killed the merchant during a robbery',
|
|
43
|
+
significance: 0.9,
|
|
44
|
+
witnesses: ['guard_1', 'bystander_2'],
|
|
45
|
+
data: { weapon: 'dagger' },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Query the journal
|
|
49
|
+
const playerActions = journal.query({ actorId: 'player', category: 'kill' });
|
|
50
|
+
const merchantHistory = journal.getInvolving('merchant_1');
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
### NPC 记忆库
|
|
54
54
|
|
|
55
|
-
```typescript
|
|
56
|
-
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
-
|
|
58
|
-
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
-
|
|
60
|
-
// Guard witnesses the player killing a merchant
|
|
61
|
-
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
-
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
-
|
|
64
|
-
// Check how the guard feels about the player
|
|
65
|
-
const rel = guardMemory.getRelationship('player');
|
|
66
|
-
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
-
|
|
68
|
-
// Later, memories fade
|
|
69
|
-
guardMemory.consolidate(currentTick);
|
|
70
|
-
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
-
```
|
|
55
|
+
```typescript
|
|
56
|
+
import { NpcMemoryBank, applyRelationshipEffect } from '@ai-rpg-engine/campaign-memory';
|
|
57
|
+
|
|
58
|
+
const guardMemory = new NpcMemoryBank('guard_1');
|
|
59
|
+
|
|
60
|
+
// Guard witnesses the player killing a merchant
|
|
61
|
+
guardMemory.remember(record, 0.9, -0.8); // high salience, very negative
|
|
62
|
+
applyRelationshipEffect(guardMemory, record, 'witness');
|
|
63
|
+
|
|
64
|
+
// Check how the guard feels about the player
|
|
65
|
+
const rel = guardMemory.getRelationship('player');
|
|
66
|
+
// { trust: -0.15, fear: 0.25, admiration: -0.05, familiarity: 0 }
|
|
67
|
+
|
|
68
|
+
// Later, memories fade
|
|
69
|
+
guardMemory.consolidate(currentTick);
|
|
70
|
+
const memories = guardMemory.recall({ aboutEntity: 'player', minSalience: 0.5 });
|
|
71
|
+
```
|
|
72
72
|
|
|
73
73
|
### 关系维度
|
|
74
74
|
|
package/dist/journal.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export type JournalQueryFilters = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare class CampaignJournal {
|
|
10
10
|
private records;
|
|
11
|
+
/**
|
|
12
|
+
* Per-instance ID counter. Record IDs depend only on (this journal's history),
|
|
13
|
+
* never on cross-instance order — see CP-01. Two journals number independently.
|
|
14
|
+
*/
|
|
15
|
+
private nextRecordId;
|
|
16
|
+
private generateId;
|
|
11
17
|
/** Record a significant event. Returns the created record with generated ID. */
|
|
12
18
|
record(entry: Omit<CampaignRecord, 'id'>): CampaignRecord;
|
|
13
19
|
/** Get a specific record by ID */
|
|
@@ -20,7 +26,13 @@ export declare class CampaignJournal {
|
|
|
20
26
|
size(): number;
|
|
21
27
|
/** Serializable state for persistence */
|
|
22
28
|
serialize(): CampaignRecord[];
|
|
23
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Restore from serialized state.
|
|
31
|
+
*
|
|
32
|
+
* CA-06: guards malformed input with a clear, actionable error instead of letting a raw
|
|
33
|
+
* TypeError escape ("records is not iterable", "cannot read 'id' of null"). The thrown
|
|
34
|
+
* Error names the offending element index/field and how to fix it.
|
|
35
|
+
*/
|
|
24
36
|
static deserialize(records: CampaignRecord[]): CampaignJournal;
|
|
25
37
|
}
|
|
26
38
|
//# sourceMappingURL=journal.d.ts.map
|
package/dist/journal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAA0C;IACzD;;;OAGG;IACH,OAAO,CAAC,YAAY,CAAK;IAEzB,OAAO,CAAC,UAAU;IAIlB,gFAAgF;IAChF,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,cAAc;IAMzD,kCAAkC;IAClC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI3C,gEAAgE;IAChE,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,EAAE;IAsBrD,+DAA+D;IAC/D,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,EAAE;IAMhD,uCAAuC;IACvC,IAAI,IAAI,MAAM;IAId,yCAAyC;IACzC,SAAS,IAAI,cAAc,EAAE;IAI7B;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,eAAe;CAgC/D"}
|
package/dist/journal.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// CampaignJournal — persistent record of significant campaign events
|
|
2
|
-
let nextRecordId = 1;
|
|
3
|
-
function generateId() {
|
|
4
|
-
return `cr_${nextRecordId++}`;
|
|
5
|
-
}
|
|
6
2
|
export class CampaignJournal {
|
|
7
3
|
records = new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Per-instance ID counter. Record IDs depend only on (this journal's history),
|
|
6
|
+
* never on cross-instance order — see CP-01. Two journals number independently.
|
|
7
|
+
*/
|
|
8
|
+
nextRecordId = 1;
|
|
9
|
+
generateId() {
|
|
10
|
+
return `cr_${this.nextRecordId++}`;
|
|
11
|
+
}
|
|
8
12
|
/** Record a significant event. Returns the created record with generated ID. */
|
|
9
13
|
record(entry) {
|
|
10
|
-
const record = { id: generateId(), ...entry };
|
|
14
|
+
const record = { id: this.generateId(), ...entry };
|
|
11
15
|
this.records.set(record.id, record);
|
|
12
16
|
return record;
|
|
13
17
|
}
|
|
@@ -49,13 +53,29 @@ export class CampaignJournal {
|
|
|
49
53
|
serialize() {
|
|
50
54
|
return Array.from(this.records.values()).sort((a, b) => a.tick - b.tick);
|
|
51
55
|
}
|
|
52
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Restore from serialized state.
|
|
58
|
+
*
|
|
59
|
+
* CA-06: guards malformed input with a clear, actionable error instead of letting a raw
|
|
60
|
+
* TypeError escape ("records is not iterable", "cannot read 'id' of null"). The thrown
|
|
61
|
+
* Error names the offending element index/field and how to fix it.
|
|
62
|
+
*/
|
|
53
63
|
static deserialize(records) {
|
|
64
|
+
if (!Array.isArray(records)) {
|
|
65
|
+
throw new Error(`CampaignJournal.deserialize: expected an array of records (got ${records === null ? 'null' : typeof records}) — pass the value returned by serialize()`);
|
|
66
|
+
}
|
|
54
67
|
const journal = new CampaignJournal();
|
|
55
|
-
for (
|
|
68
|
+
for (let i = 0; i < records.length; i++) {
|
|
69
|
+
const record = records[i];
|
|
70
|
+
if (typeof record !== 'object' || record === null) {
|
|
71
|
+
throw new Error(`CampaignJournal.deserialize: record[${i}] must be an object (got ${record === null ? 'null' : typeof record})`);
|
|
72
|
+
}
|
|
73
|
+
if (typeof record.id !== 'string') {
|
|
74
|
+
throw new Error(`CampaignJournal.deserialize: record[${i}] is missing a string "id" — each record needs an id like "cr_1"`);
|
|
75
|
+
}
|
|
56
76
|
journal.records.set(record.id, record);
|
|
57
77
|
}
|
|
58
|
-
//
|
|
78
|
+
// Advance THIS instance's counter past the highest restored id (CP-01).
|
|
59
79
|
let maxNum = 0;
|
|
60
80
|
for (const r of records) {
|
|
61
81
|
const match = r.id.match(/^cr_(\d+)$/);
|
|
@@ -63,7 +83,7 @@ export class CampaignJournal {
|
|
|
63
83
|
maxNum = Math.max(maxNum, parseInt(match[1], 10));
|
|
64
84
|
}
|
|
65
85
|
}
|
|
66
|
-
nextRecordId = maxNum + 1;
|
|
86
|
+
journal.nextRecordId = maxNum + 1;
|
|
67
87
|
return journal;
|
|
68
88
|
}
|
|
69
89
|
}
|
package/dist/journal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.js","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA,qEAAqE;
|
|
1
|
+
{"version":3,"file":"journal.js","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAYrE,MAAM,OAAO,eAAe;IAClB,OAAO,GAAgC,IAAI,GAAG,EAAE,CAAC;IACzD;;;OAGG;IACK,YAAY,GAAG,CAAC,CAAC;IAEjB,UAAU;QAChB,OAAO,MAAM,I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AAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/dist/memory-bank.d.ts
CHANGED
|
@@ -25,7 +25,13 @@ export declare class NpcMemoryBank {
|
|
|
25
25
|
getEntry(subjectId: string): NpcMemoryEntry | undefined;
|
|
26
26
|
/** Serializable state */
|
|
27
27
|
serialize(): NpcMemoryState;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Restore from serialized state.
|
|
30
|
+
*
|
|
31
|
+
* CA-06: guards malformed state with a clear, actionable error instead of building a
|
|
32
|
+
* half-formed bank that throws a raw TypeError on the next call. The thrown Error names
|
|
33
|
+
* the offending field and how to fix it.
|
|
34
|
+
*/
|
|
29
35
|
static deserialize(state: NpcMemoryState, config?: CampaignMemoryConfig): NpcMemoryBank;
|
|
30
36
|
private getOrCreateEntry;
|
|
31
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-bank.d.ts","sourceRoot":"","sources":["../src/memory-bank.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAUpB,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,MAAM,CAAiC;gBAEnC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,oBAAoB;IAK3D,oDAAoD;IACpD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IA8BjF,8CAA8C;IAC9C,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAMpD,oEAAoE;IACpE,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI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IAChD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAa9D,gFAAgF;IAChF,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAyBtC,+CAA+C;IAC/C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IASpC,qDAAqD;IACrD,aAAa,IAAI,MAAM,EAAE;IAIzB,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAUvD,yBAAyB;IACzB,SAAS,IAAI,cAAc;IAI3B;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,aAAa;IA0BvF,OAAO,CAAC,gBAAgB;CAYzB"}
|
package/dist/memory-bank.js
CHANGED
|
@@ -156,8 +156,24 @@ export class NpcMemoryBank {
|
|
|
156
156
|
serialize() {
|
|
157
157
|
return JSON.parse(JSON.stringify(this.state));
|
|
158
158
|
}
|
|
159
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Restore from serialized state.
|
|
161
|
+
*
|
|
162
|
+
* CA-06: guards malformed state with a clear, actionable error instead of building a
|
|
163
|
+
* half-formed bank that throws a raw TypeError on the next call. The thrown Error names
|
|
164
|
+
* the offending field and how to fix it.
|
|
165
|
+
*/
|
|
160
166
|
static deserialize(state, config) {
|
|
167
|
+
if (typeof state !== 'object' || state === null || Array.isArray(state)) {
|
|
168
|
+
throw new Error(`NpcMemoryBank.deserialize: expected a state object (got ${state === null ? 'null' : Array.isArray(state) ? 'array' : typeof state}) — pass the value returned by serialize()`);
|
|
169
|
+
}
|
|
170
|
+
if (typeof state.entityId !== 'string') {
|
|
171
|
+
throw new Error('NpcMemoryBank.deserialize: state is missing a string "entityId" — this is the NPC the bank belongs to');
|
|
172
|
+
}
|
|
173
|
+
const subjects = state.subjects;
|
|
174
|
+
if (typeof subjects !== 'object' || subjects === null || Array.isArray(subjects)) {
|
|
175
|
+
throw new Error(`NpcMemoryBank.deserialize: state.subjects must be an object mapping subjectId → entry (got ${subjects === undefined ? 'undefined' : subjects === null ? 'null' : Array.isArray(subjects) ? 'array' : typeof subjects})`);
|
|
176
|
+
}
|
|
161
177
|
const bank = new NpcMemoryBank(state.entityId, config);
|
|
162
178
|
bank.state = JSON.parse(JSON.stringify(state));
|
|
163
179
|
return bank;
|
package/dist/memory-bank.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-bank.js","sourceRoot":"","sources":["../src/memory-bank.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAW9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,cAAc,GAAmC;IACrD,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,KAAK;IAChB,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF,MAAM,OAAO,aAAa;IAChB,KAAK,CAAiB;IACtB,MAAM,CAAiC;IAE/C,YAAY,QAAgB,EAAE,MAA6B;QACzD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1C,CAAC;IAED,oDAAoD;IACpD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED,kEAAkE;IAClE,QAAQ,CAAC,MAAsB,EAAE,QAAgB,EAAE,eAAuB;QACxE,yEAAyE;QACzE,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ;YACtD,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAEnB,IAAI,CAAC,SAAS;YAAE,OAAO;QAEvB,MA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