Soul Module

Export, import, and list portable NPC souls via API-backed thunks

View as Markdown

The current SDK exposes Soul workflows through thunks and CLI commands.

Export Soul

1import { createSDKStore, setNPCInfo, remoteExportSoulThunk } from '@forbocai/core';
2
3const store = createSDKStore();
4
5store.dispatch(setNPCInfo({ id: 'npc_1', persona: 'A careful merchant' }));
6
7const exported = await store.dispatch(remoteExportSoulThunk({
8 npcId: 'npc_1',
9 apiUrl: 'https://api.forboc.ai',
10 apiKey: process.env.FORBOCAI_API_KEY
11})).unwrap();
12
13console.log(exported.txId, exported.url);

Import Soul by Transaction ID

1import { importSoulFromArweaveThunk } from '@forbocai/core';
2
3const soul = await store.dispatch(importSoulFromArweaveThunk({
4 txId: 'arweave_tx_id_here',
5 apiUrl: 'https://api.forboc.ai',
6 apiKey: process.env.FORBOCAI_API_KEY
7})).unwrap();
8
9console.log(soul.name, soul.persona);

List Souls

1import { getSoulListThunk } from '@forbocai/core';
2
3const souls = await store.dispatch(getSoulListThunk({
4 limit: 20,
5 apiUrl: 'https://api.forboc.ai',
6 apiKey: process.env.FORBOCAI_API_KEY
7})).unwrap();
8
9console.log(souls.length);

CLI

$npx forbocai soul export <npcId>
$npx forbocai soul import <txId-or-local-json-file>
$npx forbocai soul list 20
$npx forbocai soul chat <npcId>