forbocai 0.3.13 → 0.3.15
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/README.md +55 -42
- package/dist/cli.js +12 -9
- package/dist/cli.mjs +12 -9
- package/dist/index.d.mts +62 -27
- package/dist/index.d.ts +62 -27
- package/dist/index.js +289 -207
- package/dist/index.mjs +294 -202
- package/package.json +49 -45
- package/postinstall.js +4 -14
package/README.md
CHANGED
|
@@ -59,8 +59,8 @@ The **ForbocAI SDK** is an **Engine-Agnostic** toolkit for creating autonomous A
|
|
|
59
59
|
|
|
60
60
|
- **Local SLM Cortex** — Run **WebLLM** (SmolLM2, Llama3) directly in-browser via WebGPU.
|
|
61
61
|
- **Autonomous NPCs** — Create agents with persona, memory, and validated actions.
|
|
62
|
-
- **Persistent Memory** —
|
|
63
|
-
- **Portable Souls** —
|
|
62
|
+
- **Persistent Memory** — Local vector storage for semantic recall.
|
|
63
|
+
- **Portable Souls** — Permanent storage (Arweave) + Solana NFTs for tradeable agent identities.
|
|
64
64
|
- **Automated QA** — Ghost Agents for headless testing at scale.
|
|
65
65
|
|
|
66
66
|
**Requirements**:
|
|
@@ -133,13 +133,13 @@ See [full CLI documentation](https://docs.forboc.ai/docs/pages/cli).
|
|
|
133
133
|
`Quíck_Stárt // Éxample`
|
|
134
134
|
|
|
135
135
|
```typescript
|
|
136
|
-
import {
|
|
136
|
+
import { createCortex, createAgent } from 'forbocai';
|
|
137
137
|
|
|
138
138
|
// Córtex_Init // Loćal_Inférence
|
|
139
|
-
const cortex = await
|
|
139
|
+
const cortex = await createCortex({ model: 'smollm2-135m' });
|
|
140
140
|
|
|
141
141
|
// Agént_Créate // NPC_Entíty
|
|
142
|
-
const npc = await
|
|
142
|
+
const npc = await createAgent({
|
|
143
143
|
cortex,
|
|
144
144
|
persona: 'A suspicious merchant who was once cheated by adventurers.',
|
|
145
145
|
state: { inventory: ['rusty_key', 'healing_potion'], mood: 'suspicious' }
|
|
@@ -168,41 +168,55 @@ console.log(response.dialogue);
|
|
|
168
168
|
| **Agent** | Autonomous entities with persona, state, memory | ✅ Complete |
|
|
169
169
|
| **Memory** | Local Vector DB (IndexedDB / FS) | ✅ Complete |
|
|
170
170
|
| **Bridge** | Neuro-symbolic action validation | ✅ Complete |
|
|
171
|
-
| **Soul** | Portable agent state on
|
|
171
|
+
| **Soul** | Portable agent state on Arweave/Solana | ✅ Complete |
|
|
172
172
|
| **Ghost** | Headless QA testing at scale | ✅ Complete |
|
|
173
173
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
|
-
##
|
|
176
|
+
## Architecture Overview
|
|
177
177
|
|
|
178
|
-
`Systém_Architécture //
|
|
178
|
+
`Systém_Architécture // Round_Tríp`
|
|
179
179
|
|
|
180
|
-
The **ForbocAI
|
|
180
|
+
The **ForbocAI SDK** orchestrates a **7-Step Round-Trip** between the Game, the Local Infrastructure, and the Cloud Mind.
|
|
181
181
|
|
|
182
182
|
```
|
|
183
|
-
|
|
184
|
-
│
|
|
185
|
-
|
|
186
|
-
│
|
|
187
|
-
│
|
|
188
|
-
│ │
|
|
189
|
-
│
|
|
190
|
-
│
|
|
191
|
-
│
|
|
192
|
-
│
|
|
193
|
-
│
|
|
194
|
-
│
|
|
195
|
-
│
|
|
196
|
-
|
|
183
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
184
|
+
│ YOUR APPLICATION │
|
|
185
|
+
├─────────────────────────────────────────────────────────────┤
|
|
186
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
187
|
+
│ │ Agent │ │ Memory │ │ Bridge │ │
|
|
188
|
+
│ └──────┬───────┘ └──────────────┘ └──────────────┘ │
|
|
189
|
+
│ │ (1) Request │
|
|
190
|
+
│ ▼ │
|
|
191
|
+
│ ┌──────────────┐ │
|
|
192
|
+
│ │ SDK Core │ <────── (7) Execute ─────────────────┐ │
|
|
193
|
+
│ └──────┬───────┘ │ │
|
|
194
|
+
│ │ (2) Bundle (6) Verdict │ │
|
|
195
|
+
│ ▼ (Signed) │ │
|
|
196
|
+
│ ┌──────────────┐ (3) Directive ┌──────────────┐ │ │
|
|
197
|
+
│ │ Cloud API │ ──────────────────► │ Cloud API │ │ │
|
|
198
|
+
│ │ (The Law) │ │ (Validation) │ │ │
|
|
199
|
+
│ └──────────────┘ └──────▲───────┘ │ │
|
|
200
|
+
│ │ │ │
|
|
201
|
+
│ (4) Input │ (5) │ │
|
|
202
|
+
│ ▼ │ Submit │ │
|
|
203
|
+
│ ┌──────────────┐ │ │ │
|
|
204
|
+
│ │ Cortex │ ───────────────────────────┘ │ │
|
|
205
|
+
│ │ (SLM/LLM) │ Generation │ │
|
|
206
|
+
│ └──────────────┘ │ │
|
|
207
|
+
└─────────────────────────────────────────────────────────────┘
|
|
197
208
|
```
|
|
198
209
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
**The Loop:**
|
|
211
|
+
1. **Game -> SDK**: Request Action.
|
|
212
|
+
2. **SDK -> API**: Send State/Memory.
|
|
213
|
+
3. **API -> SDK**: Return **Directive** (The Law).
|
|
214
|
+
4. **SDK -> Cortex**: Generate creative content based on Directive.
|
|
215
|
+
5. **SDK -> API**: Submit content for validation.
|
|
216
|
+
6. **API -> SDK**: Return **Verdict** (Signed Action).
|
|
217
|
+
7. **SDK -> Game**: Execute final action.
|
|
218
|
+
|
|
219
|
+
*Note: For Enterprise usage, Step 4 can be replaced by a Cloud LLM provider, unifying the architecture for low-end (SLM) and high-end (LLM) devices.*
|
|
206
220
|
|
|
207
221
|
|
|
208
222
|
`Mémory_Módule // Sémantic_Récall`
|
|
@@ -291,14 +305,14 @@ bridge.registerRule({
|
|
|
291
305
|
|
|
292
306
|
---
|
|
293
307
|
|
|
294
|
-
## Module: Soul (
|
|
308
|
+
## Module: Soul (Portable Agent Identity)
|
|
295
309
|
|
|
296
310
|
`Sóul_Módule // Pórtal_Idéntity`
|
|
297
311
|
|
|
298
|
-
The Soul module enables **cross-game agent portability** via
|
|
312
|
+
The Soul module enables **cross-game agent portability** via permanent storage (Arweave) and Solana NFTs.
|
|
299
313
|
|
|
300
314
|
```typescript
|
|
301
|
-
import { createSoulInstance,
|
|
315
|
+
import { createSoulInstance, importSoulFromUri } from 'forbocai';
|
|
302
316
|
|
|
303
317
|
// Create a Soul from agent data
|
|
304
318
|
const soul = createSoulInstance(
|
|
@@ -309,13 +323,12 @@ const soul = createSoulInstance(
|
|
|
309
323
|
memories // From Memory module
|
|
310
324
|
);
|
|
311
325
|
|
|
312
|
-
// Export to
|
|
313
|
-
const { cid,
|
|
314
|
-
console.log(`Soul
|
|
315
|
-
// ipfs://QmXyz...
|
|
326
|
+
// Export to Arweave (permanent, pay-once storage)
|
|
327
|
+
const { cid, uri, signature } = await soul.export();
|
|
328
|
+
console.log(`Soul stored: ${uri}`);
|
|
316
329
|
|
|
317
330
|
// Import Soul in another game
|
|
318
|
-
const importedSoul = await
|
|
331
|
+
const importedSoul = await importSoulFromUri(cid);
|
|
319
332
|
console.log(importedSoul.persona);
|
|
320
333
|
// "A suspicious merchant who distrusts adventurers"
|
|
321
334
|
|
|
@@ -325,9 +338,9 @@ const { agentId, persona } = await createAgentFromSoul(cid, cortexId);
|
|
|
325
338
|
```
|
|
326
339
|
|
|
327
340
|
**Features:**
|
|
328
|
-
- **
|
|
329
|
-
- **
|
|
330
|
-
- **NFT-Ready**:
|
|
341
|
+
- **Arweave Storage**: Permanent, pay-once (no pinning fees)
|
|
342
|
+
- **Encryption**: Soul content encrypted; key transfers with NFT ownership
|
|
343
|
+
- **NFT-Ready**: Metaplex Core on Solana for tradeable agent identities
|
|
331
344
|
|
|
332
345
|
---
|
|
333
346
|
|
|
@@ -396,7 +409,7 @@ In the ForbocAI ecosystem, an NFT is not just a receipt—it is an **Encapsulate
|
|
|
396
409
|
|
|
397
410
|
* **The Container**: A standardized bundle containing the Agent's Personality, Memories, and State.
|
|
398
411
|
* **The Chain**: The NFT is the *Deed of Ownership* pointing to this digital life.
|
|
399
|
-
* **Portability**: Take your trained NPC from *Forboc* to a sequel or entirely different world. Uses
|
|
412
|
+
* **Portability**: Take your trained NPC from *Forboc* to a sequel or entirely different world. Uses Arweave for permanent, pay-once storage.
|
|
400
413
|
* **Economy**: Train a specialist NPC and sell it on the open market. The value is in the *Experience*, not just the skin.
|
|
401
414
|
|
|
402
415
|
<!-- T̵h̷e̶ ̷s̸o̷u̷l̴ ̶i̶s̵ ̶n̵o̸t̵ ̵f̸o̵r̶ ̵s̷a̸l̶e̷.̶ ̴I̸t̸ ̴i̵s̷ ̶l̶e̷a̵s̵e̶d̴.̷ -->
|
package/dist/cli.js
CHANGED
|
@@ -293,22 +293,25 @@ async function agentState(agentId) {
|
|
|
293
293
|
console.log(`
|
|
294
294
|
Agent State:
|
|
295
295
|
`);
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
const mood = data.mood || data.stateMood || "unknown";
|
|
297
|
+
console.log(` Mood: \x1B[33m${mood}\x1B[0m`);
|
|
298
|
+
const inventory = data.inventory || data.stateInventory;
|
|
299
|
+
if (Array.isArray(inventory)) {
|
|
300
|
+
console.log(` Inventory: ${inventory.length > 0 ? inventory.join(", ") : "(empty)"}`);
|
|
301
|
+
} else if (inventory) {
|
|
302
|
+
console.log(` Inventory: ${JSON.stringify(inventory)}`);
|
|
300
303
|
}
|
|
301
|
-
|
|
304
|
+
const skills = data.skills || data.stateSkills;
|
|
305
|
+
if (skills && typeof skills === "object") {
|
|
302
306
|
console.log(` Skills:`);
|
|
303
|
-
const skills = data.stateSkills || data.skills || {};
|
|
304
307
|
for (const [skill, level] of Object.entries(skills)) {
|
|
305
308
|
console.log(` ${skill}: ${level}`);
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
|
-
|
|
311
|
+
const relationships = data.relationships || data.stateRelationships;
|
|
312
|
+
if (relationships && typeof relationships === "object") {
|
|
309
313
|
console.log(` Relationships:`);
|
|
310
|
-
const
|
|
311
|
-
for (const [entity, value] of Object.entries(rels)) {
|
|
314
|
+
for (const [entity, value] of Object.entries(relationships)) {
|
|
312
315
|
const indicator = value > 0 ? "\x1B[32m+" : "\x1B[31m";
|
|
313
316
|
console.log(` ${entity}: ${indicator}${value}\x1B[0m`);
|
|
314
317
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -270,22 +270,25 @@ async function agentState(agentId) {
|
|
|
270
270
|
console.log(`
|
|
271
271
|
Agent State:
|
|
272
272
|
`);
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
const mood = data.mood || data.stateMood || "unknown";
|
|
274
|
+
console.log(` Mood: \x1B[33m${mood}\x1B[0m`);
|
|
275
|
+
const inventory = data.inventory || data.stateInventory;
|
|
276
|
+
if (Array.isArray(inventory)) {
|
|
277
|
+
console.log(` Inventory: ${inventory.length > 0 ? inventory.join(", ") : "(empty)"}`);
|
|
278
|
+
} else if (inventory) {
|
|
279
|
+
console.log(` Inventory: ${JSON.stringify(inventory)}`);
|
|
277
280
|
}
|
|
278
|
-
|
|
281
|
+
const skills = data.skills || data.stateSkills;
|
|
282
|
+
if (skills && typeof skills === "object") {
|
|
279
283
|
console.log(` Skills:`);
|
|
280
|
-
const skills = data.stateSkills || data.skills || {};
|
|
281
284
|
for (const [skill, level] of Object.entries(skills)) {
|
|
282
285
|
console.log(` ${skill}: ${level}`);
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
|
-
|
|
288
|
+
const relationships = data.relationships || data.stateRelationships;
|
|
289
|
+
if (relationships && typeof relationships === "object") {
|
|
286
290
|
console.log(` Relationships:`);
|
|
287
|
-
const
|
|
288
|
-
for (const [entity, value] of Object.entries(rels)) {
|
|
291
|
+
for (const [entity, value] of Object.entries(relationships)) {
|
|
289
292
|
const indicator = value > 0 ? "\x1B[32m+" : "\x1B[31m";
|
|
290
293
|
console.log(` ${entity}: ${indicator}${value}\x1B[0m`);
|
|
291
294
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -32,12 +32,8 @@ interface CompletionOptions {
|
|
|
32
32
|
stop?: string[];
|
|
33
33
|
jsonSchema?: object;
|
|
34
34
|
}
|
|
35
|
-
type Mood =
|
|
35
|
+
type Mood = string;
|
|
36
36
|
interface AgentState {
|
|
37
|
-
inventory: string[];
|
|
38
|
-
skills: Record<string, number>;
|
|
39
|
-
relationships: Record<string, number>;
|
|
40
|
-
mood: Mood;
|
|
41
37
|
[key: string]: unknown;
|
|
42
38
|
}
|
|
43
39
|
interface AgentConfig {
|
|
@@ -48,13 +44,18 @@ interface AgentConfig {
|
|
|
48
44
|
initialState?: Partial<AgentState>;
|
|
49
45
|
memoryConfig?: MemoryConfig;
|
|
50
46
|
apiUrl?: string;
|
|
47
|
+
/** Strategy to determine action when API/network fails */
|
|
48
|
+
fallbackStrategy?: (state: AgentState, context: Record<string, unknown>) => {
|
|
49
|
+
instruction: string;
|
|
50
|
+
directive: string;
|
|
51
|
+
};
|
|
51
52
|
}
|
|
52
53
|
interface AgentResponse {
|
|
53
54
|
dialogue: string;
|
|
54
55
|
action?: AgentAction;
|
|
55
56
|
thought?: string;
|
|
56
57
|
}
|
|
57
|
-
type MemoryType =
|
|
58
|
+
type MemoryType = string;
|
|
58
59
|
interface MemoryConfig {
|
|
59
60
|
/** Decay strategy: 'none' | 'temporal' */
|
|
60
61
|
decay?: 'none' | 'temporal';
|
|
@@ -294,26 +295,6 @@ interface IBridge {
|
|
|
294
295
|
listRules(): ValidationRule[];
|
|
295
296
|
removeRule(ruleId: string): boolean;
|
|
296
297
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Rule: Movement must have valid coordinates
|
|
299
|
-
*/
|
|
300
|
-
declare const movementRule: ValidationRule;
|
|
301
|
-
/**
|
|
302
|
-
* Rule: Attack must have valid target
|
|
303
|
-
*/
|
|
304
|
-
declare const attackRule: ValidationRule;
|
|
305
|
-
/**
|
|
306
|
-
* Rule: Interact must have valid object
|
|
307
|
-
*/
|
|
308
|
-
declare const interactRule: ValidationRule;
|
|
309
|
-
/**
|
|
310
|
-
* Rule: Speak must have non-empty text
|
|
311
|
-
*/
|
|
312
|
-
declare const speakRule: ValidationRule;
|
|
313
|
-
/**
|
|
314
|
-
* Rule: Agent must have sufficient resources for action
|
|
315
|
-
*/
|
|
316
|
-
declare const resourceRule: ValidationRule;
|
|
317
298
|
/**
|
|
318
299
|
* Factory function to create Bridge instance (Functional/Closure based)
|
|
319
300
|
*/
|
|
@@ -434,6 +415,60 @@ declare const generateEmbedding: (text: string) => Promise<number[]>;
|
|
|
434
415
|
declare const getVectorTable: (dbPath: string, tableName?: string) => Promise<any>;
|
|
435
416
|
declare const createTable: (dbPath: string, tableName: string, data: any[]) => Promise<any>;
|
|
436
417
|
|
|
418
|
+
interface RPGAgentState extends AgentState {
|
|
419
|
+
inventory: string[];
|
|
420
|
+
hp: number;
|
|
421
|
+
mana: number;
|
|
422
|
+
skills: Record<string, number>;
|
|
423
|
+
relationships: Record<string, number>;
|
|
424
|
+
mood: string;
|
|
425
|
+
}
|
|
426
|
+
declare const RPG_MOODS: {
|
|
427
|
+
readonly hostile: "hostile";
|
|
428
|
+
readonly suspicious: "suspicious";
|
|
429
|
+
readonly neutral: "neutral";
|
|
430
|
+
readonly friendly: "friendly";
|
|
431
|
+
readonly loyal: "loyal";
|
|
432
|
+
};
|
|
433
|
+
declare const RPG_MEMORY_TYPES: {
|
|
434
|
+
readonly observation: "observation";
|
|
435
|
+
readonly experience: "experience";
|
|
436
|
+
readonly knowledge: "knowledge";
|
|
437
|
+
readonly emotion: "emotion";
|
|
438
|
+
};
|
|
439
|
+
declare const createRPGState: (partial?: Partial<RPGAgentState>) => RPGAgentState;
|
|
440
|
+
declare const rpgFallbackStrategy: (state: AgentState, context: Record<string, unknown>) => {
|
|
441
|
+
instruction: string;
|
|
442
|
+
directive: string;
|
|
443
|
+
};
|
|
444
|
+
declare const movementRule: ValidationRule;
|
|
445
|
+
declare const attackRule: ValidationRule;
|
|
446
|
+
declare const interactRule: ValidationRule;
|
|
447
|
+
declare const speakRule: ValidationRule;
|
|
448
|
+
declare const resourceRule: ValidationRule;
|
|
449
|
+
declare const rpgRules: ValidationRule[];
|
|
450
|
+
declare const spatialRules: ValidationRule[];
|
|
451
|
+
declare const socialRules: ValidationRule[];
|
|
452
|
+
declare const puzzleRules: ValidationRule[];
|
|
453
|
+
|
|
454
|
+
type presets_RPGAgentState = RPGAgentState;
|
|
455
|
+
declare const presets_RPG_MEMORY_TYPES: typeof RPG_MEMORY_TYPES;
|
|
456
|
+
declare const presets_RPG_MOODS: typeof RPG_MOODS;
|
|
457
|
+
declare const presets_attackRule: typeof attackRule;
|
|
458
|
+
declare const presets_createRPGState: typeof createRPGState;
|
|
459
|
+
declare const presets_interactRule: typeof interactRule;
|
|
460
|
+
declare const presets_movementRule: typeof movementRule;
|
|
461
|
+
declare const presets_puzzleRules: typeof puzzleRules;
|
|
462
|
+
declare const presets_resourceRule: typeof resourceRule;
|
|
463
|
+
declare const presets_rpgFallbackStrategy: typeof rpgFallbackStrategy;
|
|
464
|
+
declare const presets_rpgRules: typeof rpgRules;
|
|
465
|
+
declare const presets_socialRules: typeof socialRules;
|
|
466
|
+
declare const presets_spatialRules: typeof spatialRules;
|
|
467
|
+
declare const presets_speakRule: typeof speakRule;
|
|
468
|
+
declare namespace presets {
|
|
469
|
+
export { type presets_RPGAgentState as RPGAgentState, presets_RPG_MEMORY_TYPES as RPG_MEMORY_TYPES, presets_RPG_MOODS as RPG_MOODS, presets_attackRule as attackRule, presets_createRPGState as createRPGState, presets_interactRule as interactRule, presets_movementRule as movementRule, presets_puzzleRules as puzzleRules, presets_resourceRule as resourceRule, presets_rpgFallbackStrategy as rpgFallbackStrategy, presets_rpgRules as rpgRules, presets_socialRules as socialRules, presets_spatialRules as spatialRules, presets_speakRule as speakRule };
|
|
470
|
+
}
|
|
471
|
+
|
|
437
472
|
declare const init: () => void;
|
|
438
473
|
|
|
439
|
-
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type CompletionOptions, type CortexConfig, type CortexStatus, type Directive, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryConfig, type MemoryItem, type MemoryModuleConfig, type MemoryType, type Mood, type Observation, type Soul, type SoulExportConfig, type SoulExportResult, type SoulImportConfig, type SoulListEntry, type ValidationContext, type ValidationResult, type ValidationRule, type VectorStatus,
|
|
474
|
+
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type CompletionOptions, type CortexConfig, type CortexStatus, type Directive, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryConfig, type MemoryItem, type MemoryModuleConfig, type MemoryType, type Mood, type Observation, type Soul, type SoulExportConfig, type SoulExportResult, type SoulImportConfig, type SoulListEntry, type ValidationContext, type ValidationResult, type ValidationRule, type VectorStatus, createAgent, createAgentFromSoul, createBridge, createCortex, createGhost, createInitialState, createMemory, createMemoryItem, createSoul, createSoulInstance, createTable, deserializeSoul, exportSoulToIPFS, exportToSoul, fromSoul, generateEmbedding, getGhostHistory, getGhostResults, getGhostStatus, getSoulList, getVectorTable, importSoulFromIPFS, init, initVectorEngine, presets, processAgentInput, serializeSoul, startGhostSession, stopGhostSession, updateAgentState, validateAction, validateSoul, waitForGhostCompletion };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,12 +32,8 @@ interface CompletionOptions {
|
|
|
32
32
|
stop?: string[];
|
|
33
33
|
jsonSchema?: object;
|
|
34
34
|
}
|
|
35
|
-
type Mood =
|
|
35
|
+
type Mood = string;
|
|
36
36
|
interface AgentState {
|
|
37
|
-
inventory: string[];
|
|
38
|
-
skills: Record<string, number>;
|
|
39
|
-
relationships: Record<string, number>;
|
|
40
|
-
mood: Mood;
|
|
41
37
|
[key: string]: unknown;
|
|
42
38
|
}
|
|
43
39
|
interface AgentConfig {
|
|
@@ -48,13 +44,18 @@ interface AgentConfig {
|
|
|
48
44
|
initialState?: Partial<AgentState>;
|
|
49
45
|
memoryConfig?: MemoryConfig;
|
|
50
46
|
apiUrl?: string;
|
|
47
|
+
/** Strategy to determine action when API/network fails */
|
|
48
|
+
fallbackStrategy?: (state: AgentState, context: Record<string, unknown>) => {
|
|
49
|
+
instruction: string;
|
|
50
|
+
directive: string;
|
|
51
|
+
};
|
|
51
52
|
}
|
|
52
53
|
interface AgentResponse {
|
|
53
54
|
dialogue: string;
|
|
54
55
|
action?: AgentAction;
|
|
55
56
|
thought?: string;
|
|
56
57
|
}
|
|
57
|
-
type MemoryType =
|
|
58
|
+
type MemoryType = string;
|
|
58
59
|
interface MemoryConfig {
|
|
59
60
|
/** Decay strategy: 'none' | 'temporal' */
|
|
60
61
|
decay?: 'none' | 'temporal';
|
|
@@ -294,26 +295,6 @@ interface IBridge {
|
|
|
294
295
|
listRules(): ValidationRule[];
|
|
295
296
|
removeRule(ruleId: string): boolean;
|
|
296
297
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Rule: Movement must have valid coordinates
|
|
299
|
-
*/
|
|
300
|
-
declare const movementRule: ValidationRule;
|
|
301
|
-
/**
|
|
302
|
-
* Rule: Attack must have valid target
|
|
303
|
-
*/
|
|
304
|
-
declare const attackRule: ValidationRule;
|
|
305
|
-
/**
|
|
306
|
-
* Rule: Interact must have valid object
|
|
307
|
-
*/
|
|
308
|
-
declare const interactRule: ValidationRule;
|
|
309
|
-
/**
|
|
310
|
-
* Rule: Speak must have non-empty text
|
|
311
|
-
*/
|
|
312
|
-
declare const speakRule: ValidationRule;
|
|
313
|
-
/**
|
|
314
|
-
* Rule: Agent must have sufficient resources for action
|
|
315
|
-
*/
|
|
316
|
-
declare const resourceRule: ValidationRule;
|
|
317
298
|
/**
|
|
318
299
|
* Factory function to create Bridge instance (Functional/Closure based)
|
|
319
300
|
*/
|
|
@@ -434,6 +415,60 @@ declare const generateEmbedding: (text: string) => Promise<number[]>;
|
|
|
434
415
|
declare const getVectorTable: (dbPath: string, tableName?: string) => Promise<any>;
|
|
435
416
|
declare const createTable: (dbPath: string, tableName: string, data: any[]) => Promise<any>;
|
|
436
417
|
|
|
418
|
+
interface RPGAgentState extends AgentState {
|
|
419
|
+
inventory: string[];
|
|
420
|
+
hp: number;
|
|
421
|
+
mana: number;
|
|
422
|
+
skills: Record<string, number>;
|
|
423
|
+
relationships: Record<string, number>;
|
|
424
|
+
mood: string;
|
|
425
|
+
}
|
|
426
|
+
declare const RPG_MOODS: {
|
|
427
|
+
readonly hostile: "hostile";
|
|
428
|
+
readonly suspicious: "suspicious";
|
|
429
|
+
readonly neutral: "neutral";
|
|
430
|
+
readonly friendly: "friendly";
|
|
431
|
+
readonly loyal: "loyal";
|
|
432
|
+
};
|
|
433
|
+
declare const RPG_MEMORY_TYPES: {
|
|
434
|
+
readonly observation: "observation";
|
|
435
|
+
readonly experience: "experience";
|
|
436
|
+
readonly knowledge: "knowledge";
|
|
437
|
+
readonly emotion: "emotion";
|
|
438
|
+
};
|
|
439
|
+
declare const createRPGState: (partial?: Partial<RPGAgentState>) => RPGAgentState;
|
|
440
|
+
declare const rpgFallbackStrategy: (state: AgentState, context: Record<string, unknown>) => {
|
|
441
|
+
instruction: string;
|
|
442
|
+
directive: string;
|
|
443
|
+
};
|
|
444
|
+
declare const movementRule: ValidationRule;
|
|
445
|
+
declare const attackRule: ValidationRule;
|
|
446
|
+
declare const interactRule: ValidationRule;
|
|
447
|
+
declare const speakRule: ValidationRule;
|
|
448
|
+
declare const resourceRule: ValidationRule;
|
|
449
|
+
declare const rpgRules: ValidationRule[];
|
|
450
|
+
declare const spatialRules: ValidationRule[];
|
|
451
|
+
declare const socialRules: ValidationRule[];
|
|
452
|
+
declare const puzzleRules: ValidationRule[];
|
|
453
|
+
|
|
454
|
+
type presets_RPGAgentState = RPGAgentState;
|
|
455
|
+
declare const presets_RPG_MEMORY_TYPES: typeof RPG_MEMORY_TYPES;
|
|
456
|
+
declare const presets_RPG_MOODS: typeof RPG_MOODS;
|
|
457
|
+
declare const presets_attackRule: typeof attackRule;
|
|
458
|
+
declare const presets_createRPGState: typeof createRPGState;
|
|
459
|
+
declare const presets_interactRule: typeof interactRule;
|
|
460
|
+
declare const presets_movementRule: typeof movementRule;
|
|
461
|
+
declare const presets_puzzleRules: typeof puzzleRules;
|
|
462
|
+
declare const presets_resourceRule: typeof resourceRule;
|
|
463
|
+
declare const presets_rpgFallbackStrategy: typeof rpgFallbackStrategy;
|
|
464
|
+
declare const presets_rpgRules: typeof rpgRules;
|
|
465
|
+
declare const presets_socialRules: typeof socialRules;
|
|
466
|
+
declare const presets_spatialRules: typeof spatialRules;
|
|
467
|
+
declare const presets_speakRule: typeof speakRule;
|
|
468
|
+
declare namespace presets {
|
|
469
|
+
export { type presets_RPGAgentState as RPGAgentState, presets_RPG_MEMORY_TYPES as RPG_MEMORY_TYPES, presets_RPG_MOODS as RPG_MOODS, presets_attackRule as attackRule, presets_createRPGState as createRPGState, presets_interactRule as interactRule, presets_movementRule as movementRule, presets_puzzleRules as puzzleRules, presets_resourceRule as resourceRule, presets_rpgFallbackStrategy as rpgFallbackStrategy, presets_rpgRules as rpgRules, presets_socialRules as socialRules, presets_spatialRules as spatialRules, presets_speakRule as speakRule };
|
|
470
|
+
}
|
|
471
|
+
|
|
437
472
|
declare const init: () => void;
|
|
438
473
|
|
|
439
|
-
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type CompletionOptions, type CortexConfig, type CortexStatus, type Directive, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryConfig, type MemoryItem, type MemoryModuleConfig, type MemoryType, type Mood, type Observation, type Soul, type SoulExportConfig, type SoulExportResult, type SoulImportConfig, type SoulListEntry, type ValidationContext, type ValidationResult, type ValidationRule, type VectorStatus,
|
|
474
|
+
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type CompletionOptions, type CortexConfig, type CortexStatus, type Directive, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryConfig, type MemoryItem, type MemoryModuleConfig, type MemoryType, type Mood, type Observation, type Soul, type SoulExportConfig, type SoulExportResult, type SoulImportConfig, type SoulListEntry, type ValidationContext, type ValidationResult, type ValidationRule, type VectorStatus, createAgent, createAgentFromSoul, createBridge, createCortex, createGhost, createInitialState, createMemory, createMemoryItem, createSoul, createSoulInstance, createTable, deserializeSoul, exportSoulToIPFS, exportToSoul, fromSoul, generateEmbedding, getGhostHistory, getGhostResults, getGhostStatus, getSoulList, getVectorTable, importSoulFromIPFS, init, initVectorEngine, presets, processAgentInput, serializeSoul, startGhostSession, stopGhostSession, updateAgentState, validateAction, validateSoul, waitForGhostCompletion };
|