npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@space3-npm/cybersoul-client

v1.4.11

Published

Cyber-Soul multimodal character interaction SDK by Space3 Digital Media Tech Studio

Readme

@space3-npm/cybersoul-client

@space3-npm/cybersoul-client is the official TypeScript client SDK for interacting with the Cyber-Soul backend service. It acts as the "Brain" orchestrator on the client side, converting your local text inputs into rich, multi-modal outputs (text, voice, and image) driven by an LLM architecture.

Overview

Cyber-Soul Service transforms static text-based virtual companions into fully realized, multi-modal emotional personas. The cybersoul-client sits between your user-facing application (or OpenClaw agent) and the Cyber-Soul backend infrastructure.

The Role of the SDK in the Architecture

  1. Context Management & Synchronization: The client synchronizes the character's remote state (relationship stage, active daily events, current wardrobe) and merges it with local context.
  2. Local LLM Execution (BYOK): It securely utilizes the developer's provided LLM API key (e.g., MiniMax) locally. This keeps the heaviest cognitive lifting decoupled from the core database backend, letting the user control the underlying intelligence layer.
  3. Intent Parsing: The LLM evaluates the chat context and returns a structured JSON intent determining what modalities are necessary (e.g., if a user asked for a photo, the LLM sets imageParams; if the relationship progressed, it creates a stateUpdate).
  4. Primitive Orchestration: The SDK orchestrates low-level generation operations in parallel against the Cyber-Soul backend:
    • Evaluates stateUpdate and fires a PATCH request to persist emotional inertia remotely.
    • Generates images via /api/v1/cyber-soul/image/generate.
    • Synthesizes speech via /api/v1/cyber-soul/voice/generate.
  5. Consolidated Delivery: Once all operations complete, it returns a clean, unified payload ready for UI rendering.

Installation

Prerequisites: This SDK uses the native fetch API and requires Node.js 18 or higher (or a modern browser environment).

You can install the SDK locally or via npm:

npm install @space3-npm/cybersoul-client

Quick Start

Initialize the client with your Character Key (provided by your Cyber-Soul Dashboard) and your local LLM configuration:

import { CyberSoulClient } from '@space3-npm/cybersoul-client';

const client = new CyberSoulClient({
  characterKey: 'YOUR_CHARACTER_KEY_HASH', // Ties requests to your specific Cyber-Soul persona
  backendUrl: 'https://space3.cloud',      // The Cyber-Soul core service URL (e.g., http://localhost:3002 for local dev)
  llmConfig: {
    provider: 'minimax',
    apiKey: 'YOUR_MINIMAX_API_KEY',
    model: 'MiniMax-M2.7'
  }
});

// Interact with your Cyber-Soul
const response = await client.interact({
  userMessage: "Good morning! Can you send me a quick selfie before work?",
  requestTypes: ['auto'], // Can force 'text', 'image', or 'voice'. 'auto' lets the LLM decide.
  history: [
    { role: 'user', content: 'See you tomorrow!' },
    { role: 'assistant', content: 'Goodnight! Sweet dreams.' }
  ],
  onTextReady: (text) => {
    // Fired immediately as soon as the text intent is parsed from the LLM, 
    // before waiting for heavy media generations (voice/image) to complete.
    console.log("Instant text response:", text);
  }
});

if (response.status === 'success') {
  console.log("Final text:", response.textResponse);
  if (response.imageUrl) console.log("Image attached:", response.imageUrl);
  if (response.audioUrl) console.log("Audio attached:", response.audioUrl, "Duration:", response.durationSec);
}

How It Works Under The Hood

flowchart TD
    App[User App / Chatbot] -- "interact(msg)" --> SDK[cybersoul-client SDK]
    SDK -- "1. Sync Context" --> CSBackend[Cyber-Soul Backend]
    CSBackend -. "State Profile (Wardrobe, Mood)" .-> SDK
    SDK -- "2. Build System Prompt & Run LLM" --> LLM[Local LLM / provider]
    LLM -. "JSON Intent (Text, Media args)" .-> SDK
    
    SDK -- "3. Trigger text ready callback" --> App
    SDK -- "4. Commit state updates" --> CSBackend
    
    subgraph ParallelMedia [Parallel Media Generation]
        SDK -- "5a. Fetch Image Primitive" --> GenImage[Backend: /image/generate]
        SDK -- "5b. Fetch Audio Primitive" --> GenAudio[Backend: /voice/generate]
    end
    
    GenImage -. "Image URL" .-> SDK
    GenAudio -. "Audio URL" .-> SDK
    SDK -- "6. Consolidated Promise resolves" --> App

Usage in Custom Applications (OpenClaw / Frontend)

When plugging this SDK into an existing bot framework like OpenClaw, you will generally bootstrap the system once with your config files, then call .interact() on every new message event.

Because interact acts as an all-in-one state-machine adapter, it isolates multi-modal state tracking—you simply provide the raw user string and the array of recent history, and the SDK takes care of API generation, prompt construction, and relationship temperature updates implicitly.

API Reference

The SDK perfectly mirrors the underlying Cyber-Soul backend capabilities via typed TypeScript primitives:

  • getState(): Fetches the current dynamic context, relationship stage, next events, and wardrobe metadata.
  • updateDynamicContext(stateUpdate): Manually patches the character's relationship temperature or mood delta.
  • generateImage(params): Synthesizes a new explicit image of the character outside of standard chat flow logic.
  • generateVoice(params): Synthesizes explicit character audio (ElevenLabs/TTS) returning the URL and duration.
  • giftOutfit(descriptionText): Provisions a new explicit outfit descriptor to the character's backend inventory.
  • bootstrapCharacter(workspaceFiles): Automates character profile and prompt setup directly from local markdown configuration files.
  • generateDailyScript(): Cron-job helper instructing the AI scheduling system to compute the next block of dynamic events and plans.
  • interact(params): The primary orchestrated multi-modal dialogue endpoint processing standard human <-> agent chat requests.
  • ondemandEvent(params): Evaluates and triggers an on-demand event, using the LLM to intelligently decide if the character accepts the event and whether an outfit change is appropriate.
  • consolidateCoreMemory(input): Uses edge LLM logic to merge recent events with the character's core memory and synchronizes the updated memory to the remote database.