@octavus/docs 0.0.5 → 0.0.6

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.
@@ -88,6 +88,6 @@ sequenceDiagram
88
88
 
89
89
  - [Quick Start](/docs/getting-started/quickstart) — Get your first agent running in minutes
90
90
  - [Server SDK](/docs/server-sdk/overview) — Learn about backend integration
91
- - [Client SDK](/docs/client-sdk/overview) — Build chat interfaces with React
91
+ - [Client SDK](/docs/client-sdk/overview) — Build chat interfaces with React (or other frameworks)
92
92
  - [Protocol Reference](/docs/protocol/overview) — Deep dive into agent protocols
93
93
 
@@ -21,8 +21,8 @@ Install the Octavus SDKs in your project:
21
21
  # Server SDK for backend
22
22
  npm install @octavus/server-sdk
23
23
 
24
- # Client SDK for frontend (React)
25
- npm install @octavus/client-sdk
24
+ # React bindings for frontend
25
+ npm install @octavus/react
26
26
  ```
27
27
 
28
28
  ## Backend Setup
@@ -124,7 +124,7 @@ Use the `useOctavusChat` hook to build a chat interface:
124
124
  // components/chat.tsx
125
125
  'use client';
126
126
 
127
- import { useOctavusChat, type UIMessage } from '@octavus/client-sdk';
127
+ import { useOctavusChat, type UIMessage } from '@octavus/react';
128
128
  import { useState } from 'react';
129
129
 
130
130
  interface ChatProps {
@@ -1,24 +1,43 @@
1
1
  ---
2
2
  title: Overview
3
- description: Introduction to the Octavus Client SDK for building chat interfaces.
3
+ description: Introduction to the Octavus Client SDKs for building chat interfaces.
4
4
  ---
5
5
 
6
6
  # Client SDK Overview
7
7
 
8
- The `@octavus/client-sdk` package provides React hooks for building chat interfaces with Octavus agents. It handles streaming, message state, and real-time updates.
8
+ Octavus provides two packages for frontend integration:
9
9
 
10
- **Current version:** `{{VERSION:@octavus/client-sdk}}`
10
+ | Package | Purpose | Use When |
11
+ |---------|---------|----------|
12
+ | `@octavus/react` | React hooks and bindings | Building React applications |
13
+ | `@octavus/client-sdk` | Framework-agnostic core | Using Vue, Svelte, vanilla JS, or custom integrations |
14
+
15
+ **Most users should install `@octavus/react`** — it includes everything from `@octavus/client-sdk` plus React-specific hooks.
11
16
 
12
17
  ## Installation
13
18
 
19
+ ### React Applications
20
+
21
+ ```bash
22
+ npm install @octavus/react
23
+ ```
24
+
25
+ **Current version:** `{{VERSION:@octavus/react}}`
26
+
27
+ ### Other Frameworks
28
+
14
29
  ```bash
15
30
  npm install @octavus/client-sdk
16
31
  ```
17
32
 
18
- ## Basic Usage
33
+ **Current version:** `{{VERSION:@octavus/client-sdk}}`
34
+
35
+ ## React Usage
36
+
37
+ The `useOctavusChat` hook provides state management and streaming for React applications:
19
38
 
20
39
  ```tsx
21
- import { useOctavusChat, type UIMessage } from '@octavus/client-sdk';
40
+ import { useOctavusChat, type UIMessage } from '@octavus/react';
22
41
 
23
42
  function Chat({ sessionId }: { sessionId: string }) {
24
43
  const { messages, status, send } = useOctavusChat({
@@ -59,6 +78,38 @@ function MessageBubble({ message }: { message: UIMessage }) {
59
78
  }
60
79
  ```
61
80
 
81
+ ## Framework-Agnostic Usage
82
+
83
+ The `OctavusChat` class can be used with any framework or vanilla JavaScript:
84
+
85
+ ```typescript
86
+ import { OctavusChat } from '@octavus/client-sdk';
87
+
88
+ const chat = new OctavusChat({
89
+ onTrigger: async (triggerName, input) => {
90
+ return fetch('/api/trigger', {
91
+ method: 'POST',
92
+ body: JSON.stringify({ sessionId, triggerName, input }),
93
+ });
94
+ },
95
+ });
96
+
97
+ // Subscribe to state changes
98
+ const unsubscribe = chat.subscribe(() => {
99
+ console.log('Messages:', chat.messages);
100
+ console.log('Status:', chat.status);
101
+ // Update your UI here
102
+ });
103
+
104
+ // Send a message
105
+ await chat.send('user-message', { USER_MESSAGE: 'Hello' }, {
106
+ userMessage: { content: 'Hello' },
107
+ });
108
+
109
+ // Cleanup when done
110
+ unsubscribe();
111
+ ```
112
+
62
113
  ## Key Features
63
114
 
64
115
  ### Unified Send Function
@@ -112,14 +163,14 @@ const { stop } = useOctavusChat({...});
112
163
  stop();
113
164
  ```
114
165
 
115
- ## Hook Reference
166
+ ## Hook Reference (React)
116
167
 
117
168
  ### useOctavusChat
118
169
 
119
170
  ```typescript
120
- function useOctavusChat(options: UseOctavusChatOptions): UseOctavusChatReturn;
171
+ function useOctavusChat(options: OctavusChatOptions): UseOctavusChatReturn;
121
172
 
122
- interface UseOctavusChatOptions {
173
+ interface OctavusChatOptions {
123
174
  // Required: Function that calls your backend trigger endpoint
124
175
  onTrigger: TriggerFunction;
125
176
 
@@ -157,6 +208,32 @@ interface UserMessageInput {
157
208
  }
158
209
  ```
159
210
 
211
+ ## Class Reference (Framework-Agnostic)
212
+
213
+ ### OctavusChat
214
+
215
+ ```typescript
216
+ class OctavusChat {
217
+ constructor(options: OctavusChatOptions);
218
+
219
+ // State (read-only)
220
+ readonly messages: UIMessage[];
221
+ readonly status: ChatStatus;
222
+ readonly error: Error | null;
223
+
224
+ // Actions
225
+ send(
226
+ triggerName: string,
227
+ input?: Record<string, unknown>,
228
+ options?: { userMessage?: UserMessageInput }
229
+ ): Promise<void>;
230
+ stop(): void;
231
+
232
+ // Subscription
233
+ subscribe(callback: () => void): () => void; // Returns unsubscribe function
234
+ }
235
+ ```
236
+
160
237
  ## Next Steps
161
238
 
162
239
  - [Messages](/docs/client-sdk/messages) — Working with message state
@@ -121,7 +121,7 @@ function MessageBubble({ message }: { message: UIMessage }) {
121
121
  ### Rendering Parts
122
122
 
123
123
  ```tsx
124
- import { isOtherThread, type UIMessagePart } from '@octavus/client-sdk';
124
+ import { isOtherThread, type UIMessagePart } from '@octavus/react';
125
125
 
126
126
  function PartRenderer({ part }: { part: UIMessagePart }) {
127
127
  // Check if part belongs to a named thread (e.g., "summary")
@@ -180,7 +180,7 @@ function TextPart({ part }: { part: UITextPart }) {
180
180
  Content from named threads (like "summary") is identified by the `thread` property. Use the `isOtherThread` helper:
181
181
 
182
182
  ```tsx
183
- import { isOtherThread } from '@octavus/client-sdk';
183
+ import { isOtherThread } from '@octavus/react';
184
184
 
185
185
  function PartRenderer({ part }: { part: UIMessagePart }) {
186
186
  if (isOtherThread(part)) {
@@ -49,7 +49,7 @@ function Chat() {
49
49
  Parts update in real-time during streaming. Use the part's `status` to show appropriate UI:
50
50
 
51
51
  ```tsx
52
- import type { UITextPart, UIReasoningPart } from '@octavus/client-sdk';
52
+ import type { UITextPart, UIReasoningPart } from '@octavus/react';
53
53
 
54
54
  function TextPart({ part }: { part: UITextPart }) {
55
55
  return (
@@ -88,7 +88,7 @@ function ReasoningPart({ part }: { part: UIReasoningPart }) {
88
88
  Tool calls progress through multiple states:
89
89
 
90
90
  ```tsx
91
- import type { UIToolCallPart } from '@octavus/client-sdk';
91
+ import type { UIToolCallPart } from '@octavus/react';
92
92
 
93
93
  function ToolCallPart({ part }: { part: UIToolCallPart }) {
94
94
  return (
@@ -188,7 +188,7 @@ When `stop()` is called:
188
188
  Content from named threads (like "summary") streams separately and is identified by the `thread` property:
189
189
 
190
190
  ```tsx
191
- import { isOtherThread } from '@octavus/client-sdk';
191
+ import { isOtherThread } from '@octavus/react';
192
192
 
193
193
  function MessageBubble({ message }: { message: UIMessage }) {
194
194
  // Separate main thread from named threads
@@ -25,7 +25,7 @@ interface UIOperationPart {
25
25
  Operations are typically shown as compact status indicators:
26
26
 
27
27
  ```tsx
28
- import type { UIOperationPart } from '@octavus/client-sdk';
28
+ import type { UIOperationPart } from '@octavus/react';
29
29
 
30
30
  function OperationCard({ operation }: { operation: UIOperationPart }) {
31
31
  return (
@@ -46,7 +46,7 @@ function OperationCard({ operation }: { operation: UIOperationPart }) {
46
46
  Operations appear alongside text, reasoning, and tool calls in the message's `parts` array:
47
47
 
48
48
  ```tsx
49
- import type { UIMessage, UIMessagePart } from '@octavus/client-sdk';
49
+ import type { UIMessage, UIMessagePart } from '@octavus/react';
50
50
 
51
51
  function MessageBubble({ message }: { message: UIMessage }) {
52
52
  return (
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  title: Client SDK
3
- description: Frontend integration with @octavus/client-sdk for React applications.
3
+ description: Frontend integration with @octavus/react for React applications and @octavus/client-sdk for other frameworks.
4
4
  ---
@@ -65,6 +65,8 @@ In prompts, reference with `{{INPUT_NAME}}`:
65
65
  You are a support agent for {{COMPANY_NAME}}.
66
66
  ```
67
67
 
68
+ > **Note:** Variables must be `UPPER_SNAKE_CASE`. Nested properties (dot notation like `{{VAR.property}}`) are not supported. Objects are serialized as JSON when interpolated.
69
+
68
70
  ## Resources
69
71
 
70
72
  Resources are persistent state that: