@useago/sdk 0.2.0 → 0.2.1
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.
- package/README.md +101 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,112 @@
|
|
|
1
1
|
# @useago/sdk
|
|
2
2
|
|
|
3
|
-
Official JavaScript/TypeScript SDK for [AGO](https://useago.com)
|
|
3
|
+
Official JavaScript/TypeScript SDK for [AGO](https://useago.com) — embed AGO's AI
|
|
4
|
+
agents directly inside your own app. Stream answers, let the agent call **your**
|
|
5
|
+
client-side functions, navigate users around your UI, and feed it live context
|
|
6
|
+
about what the user is doing.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Works with **plain JS/TS, React, Vue and Angular**. The core is framework-agnostic;
|
|
9
|
+
each framework gets idiomatic bindings (hooks, composables, services) on top of the
|
|
10
|
+
same `AgoClient`.
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
13
|
npm install @useago/sdk
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
---
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
Pick your stack — each guide is self-contained.
|
|
21
|
+
|
|
22
|
+
| Stack | Guide |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| Plain JavaScript / TypeScript | [docs/core.md](docs/core.md) |
|
|
25
|
+
| React | [docs/react.md](docs/react.md) |
|
|
26
|
+
| Vue 3 | [docs/vue.md](docs/vue.md) |
|
|
27
|
+
| Angular | [docs/angular.md](docs/angular.md) |
|
|
28
|
+
| Embeddable widget (`<script>`) | [docs/widget.md](docs/widget.md) |
|
|
29
|
+
|
|
30
|
+
Cross-cutting topics (apply to every framework):
|
|
31
|
+
|
|
32
|
+
- [**Client-side functions & helpers**](docs/functions-and-context.md#client-side-functions) — let the agent run code in the browser
|
|
33
|
+
- [**Client context**](docs/functions-and-context.md#client-context) — tell the agent what the user is looking at
|
|
34
|
+
- [**Events & streaming**](docs/events-and-streaming.md) — low-level hooks into the message stream
|
|
35
|
+
- [**Testing**](docs/testing.md) — a mock client for unit tests
|
|
36
|
+
- [**Configuration & auth**](docs/configuration.md) — every `AgoConfig` option, headers, errors
|
|
37
|
+
|
|
38
|
+
The 30-second version (vanilla):
|
|
14
39
|
|
|
15
40
|
```ts
|
|
16
|
-
import
|
|
17
|
-
|
|
41
|
+
import { AgoClient } from "@useago/sdk";
|
|
42
|
+
|
|
43
|
+
const ago = new AgoClient({ baseUrl: "https://YOUR-DOMAIN.useago.com" });
|
|
44
|
+
|
|
45
|
+
ago.on("message:chunk", ({ content }) => process.stdout.write(content));
|
|
46
|
+
|
|
47
|
+
const reply = await ago.sendMessage("What can you do?");
|
|
48
|
+
console.log("\nDone:", reply.status);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Feature matrix
|
|
54
|
+
|
|
55
|
+
What ships out of the box for each entry point. The **core** (`@useago/sdk`)
|
|
56
|
+
APIs are usable from *any* framework — the framework columns mark where a more
|
|
57
|
+
idiomatic binding (hook / composable / service / component) is also provided.
|
|
58
|
+
|
|
59
|
+
| Feature | Core (vanilla) | React | Vue | Angular |
|
|
60
|
+
| --- | :---: | :---: | :---: | :---: |
|
|
61
|
+
| Create client | `new AgoClient()` | `useAgo` / `<AgoProvider>` | `AgoPlugin` / `useAgo` | `provideAgo` / `AgoService` |
|
|
62
|
+
| Zero-config auto-detect | ✅ `createAgo()` | ✅ | ✅ | ✅ |
|
|
63
|
+
| Send message (streaming) | ✅ | ✅ `useChat`/`useMessages` | ✅ `useChat`/`useMessages` | ✅ `AgoService.sendMessage` |
|
|
64
|
+
| File attachments | ✅ | ✅ | ✅ | ✅ |
|
|
65
|
+
| List / load conversations | ✅ | ✅ `useConversation` | ✅ `useConversation` | ✅ `AgoService` |
|
|
66
|
+
| All-in-one chat state | — | ✅ `useChat` | ✅ `useChat` | ➖ compose manually |
|
|
67
|
+
| Pre-built `<ChatWidget>` UI | — | ✅ | ➖ see example | — |
|
|
68
|
+
| Markdown / `<Message>` / `<ChatInput>` | — | ✅ | — | — |
|
|
69
|
+
| Client-side functions | ✅ `registerFunction` | ✅ `useAgoFunction` | ✅ `useAgoFunction` | ✅ `AgoService` |
|
|
70
|
+
| `defineFunction` / `withHandler` | ✅ | ✅ | ✅ | ✅ |
|
|
71
|
+
| Pre-built helpers (`showToast`, …) | ✅ | ✅ `helpers` prop | ✅ | ✅ |
|
|
72
|
+
| Navigation function | ✅ `registerNavigationFunction` | ✅ `useAgoNavigation` | ✅ `useAgoNavigation` | ✅ `AgoService` |
|
|
73
|
+
| Client context | ✅ `setContext` / `addDynamicContext` | ✅ `useAgoContext` | ✅ core API | ✅ core API |
|
|
74
|
+
| Auto page context | ✅ `enableAutoPageContext()` | ✅ `pageContext="auto"` | ✅ core API | ✅ core API |
|
|
75
|
+
| Events (`on`/`off`/`once`/`waitFor`) | ✅ | ✅ (via client) | ✅ `useAgoEvents` | ✅ `messages$` Observables |
|
|
76
|
+
| Streaming helpers / async generator | ✅ | ✅ | ✅ | ✅ |
|
|
77
|
+
| Tool calls (form/confirm/reject) | ✅ | ✅ | ✅ | ✅ `AgoService` |
|
|
78
|
+
| Message feedback | ✅ `submitFeedback` | ✅ | ✅ | ✅ `AgoService` |
|
|
79
|
+
| Testing mock client | ✅ `createMockClient` | ✅ | ✅ | ✅ |
|
|
80
|
+
|
|
81
|
+
Legend: ✅ first-class binding · ➖ supported via the core API, no dedicated sugar · — not applicable.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Package entry points
|
|
86
|
+
|
|
87
|
+
The package is published with several subpath exports so bundlers only pull in
|
|
88
|
+
what you use:
|
|
89
|
+
|
|
90
|
+
| Import | Contents |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| `@useago/sdk` | Core client, types, functions, helpers, streaming, testing |
|
|
93
|
+
| `@useago/sdk/react` | React provider, hooks and components |
|
|
94
|
+
| `@useago/sdk/vue` | Vue plugin and composables |
|
|
95
|
+
| `@useago/sdk/angular` | Angular service and provider |
|
|
96
|
+
| `@useago/sdk/helpers` | Pre-built client functions only |
|
|
97
|
+
| `@useago/sdk/widget` | `window.AGO` widget config types |
|
|
98
|
+
|
|
99
|
+
ESM and CJS builds are both shipped, with full TypeScript declarations.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Requirements
|
|
104
|
+
|
|
105
|
+
- A modern browser environment (uses `fetch` + `ReadableStream` for SSE) or Node 18+.
|
|
106
|
+
- `react` / `react-dom` `>=17` for the React bindings (peer dependency, optional).
|
|
107
|
+
- `vue` `>=3.3` for the Vue bindings (peer dependency, optional).
|
|
108
|
+
- Angular bindings have **no** hard Angular dependency — they work with any DI container.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT · [Documentation](https://docs.useago.com) · [Website](https://useago.com)
|