Package Structure & Responsibilities
Core Principle
Section titled “Core Principle”Viber is a Space-oriented collaborative workspace platform. Unlike task-oriented frameworks, Viber provides persistent workspaces where artifacts evolve through continuous user-agent collaboration.
The viber package is the unified runtime engine that manages Spaces, XAgents, artifact evolution, and defines adapter interfaces. Storage implementations are provided by @viber/local (SQLite/filesystem) and @viber/supabase (cloud).
Package Responsibilities
Section titled “Package Responsibilities”Framework Structure
Section titled “Framework Structure”Viber is distributed as a single unified package (viber) with targeted exports for framework integrations. This simplifies dependency management while maintaining modular separation of concerns.
viber (Main Export)
Section titled “viber (Main Export)”Import: import { ... } from "viber"
The core runtime engine that allows you to build, orchestrate, and run agents.
Contains:
- Core Abstractions:
Agent,Space,Task,Plan - Orchestration:
XAgent(The project manager) - Data Types: All shared interfaces and configuration types
- Server Adapters:
nodeadapter integration - Storage: Built-in support for
local(SQLite/FileSystem) andsupabase(Cloud) persistence logic - Tools: Standard toolsets for file I/O, browsing, and search
viber/react
Section titled “viber/react”Import: import { ... } from "viber/react"
React integration layer for building custom UIs.
Contains:
useAgent: Hook for connecting to an agent instanceuseSpace: Hook for managing space stateAgentProvider: Context provider
viber/svelte
Section titled “viber/svelte”Import: import { ... } from "viber/svelte"
Svelte 5 integration layer using Runes.
Contains:
createAgentStore: Reactive store for agent statecreateSpaceStore: Reactive store for space management
viber/defaults (Internal)
Section titled “viber/defaults (Internal)”Default configurations for agents, prompts, and tools are bundled within the main package to provide “batteries-included” functionality.
Data Flow
Section titled “Data Flow”viber (Unified Runtime) ↓ managesSpace (Persistent Container) ↓ containsArtifacts, History, Config ↓ persisted viaBuilt-in Storage Adapters (Local/Supabase)Key Concepts
Section titled “Key Concepts”Hierarchy
Section titled “Hierarchy”Space (persistent container) └── Mission (user's substantial goal) └── Plan (strategy, evolves) └── Task[] (individual work items)Note: Our “Task” is different from AI SDK’s “steps” (multi-turn tool loops). Viber Tasks are higher-level work items.
Mission Lifecycle
Section titled “Mission Lifecycle”// Create a Space and start a Missionconst space = await XAgent.start("Write my thesis");// Creates: Space + Mission("Write my thesis") + initial Plan
// Work on Tasks within the Planawait xAgent.chat("Write the introduction"); // Executes Task, creates artifact v1await xAgent.chat("Make it more concise"); // Creates artifact v2
// Resume later (next day, next week...)const space = await XAgent.resume(spaceId);await xAgent.chat("Now work on chapter 2"); // Full context preserved, Plan adaptsArtifact Evolution
Section titled “Artifact Evolution”// Artifacts are versioned automaticallythesis.md├── v1: Initial draft├── v2: More concise├── v3: Added citations└── v4: Final polish
// Can access any versionconst v2 = await space.getArtifactVersion("thesis.md", 2);Context Accumulation
Section titled “Context Accumulation”// Context builds up over the sessionawait xAgent.chat("Research topic X"); // Context: researchawait xAgent.chat("Focus on Y aspect"); // Context: research + Yawait xAgent.chat("Write a summary"); // Context: research + Y + findings// XAgent knows everything discussedComparison to Task-Oriented Design
Section titled “Comparison to Task-Oriented Design”| Aspect | Task-Oriented | Space-Oriented (Viber) |
|---|---|---|
| Lifecycle | Start → Execute → End | Create → Collaborate → Pause → Resume → … |
| State | Ephemeral | Persistent |
| Artifacts | Output files | Living documents with history |
| Context | Per-task | Accumulated across sessions |
| Use Case | Automation scripts | Document editing, research, collaboration |