FOUR SDK / V1.0.0
Five-minute offline quickstart
import { FourBTDClient } from '@fourbtd/sdk';
const fourBtd = new FourBTDClient({
network: 'local',
});
const mira = await fourBtd.characters.create({
name: 'Mira',
owner: 'player-one',
world: 'forest',
traits: ['curious'],
goals: ['Find the lost city'],
metadata: {
faction: 'explorers',
},
});
const event = await fourBtd.events.capture({
characterId: mira.id,
type: 'quest',
content: 'A traveler revealed the path to the lost city.',
importance: 0.9,
idempotencyKey: 'quest-revelation-1',
});
await fourBtd.memory.commit({
characterId: mira.id,
type: 'episodic',
content: event.content,
salience: 0.9,
tags: ['lost-city'],
provenance: [event.id],
});
const recalled = await fourBtd.memory.recall({
characterId: mira.id,
query: 'lost city',
});
console.log(recalled.items.map((memory) => memory.content));From the checkout, npm run examples runs the quickstart and a complete cross-session
integration journey offline. Other examples in examples/ are compiled by npm run typecheck.
