@hugex/ai 2.8.11 → 2.8.12
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/LICENSE +1 -1
- package/README.md +13 -18
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -4,7 +4,7 @@ Copyright (c) HugeX. All rights reserved.
|
|
|
4
4
|
|
|
5
5
|
Permission is granted to HugeX customers and authorized partners to install,
|
|
6
6
|
use, and integrate @hugex packages (@hugex/ai, @hugex/ui, @hugex/shared, and
|
|
7
|
-
related scoped packages) solely in connection with a HugeX
|
|
7
|
+
related scoped packages) solely in connection with a HugeX or Ora deployment
|
|
8
8
|
you are licensed to operate.
|
|
9
9
|
|
|
10
10
|
You may not copy, modify, merge, publish, distribute, sublicense, or sell
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
HugeX Agent runtime for Cloudflare Workers — flow execution (`FlowEngine`), session state (`AgentDO`), server route handlers, and the React client hook (`useAgent`).
|
|
4
4
|
|
|
5
|
-
Flows are **designed** in [
|
|
5
|
+
Flows are **designed** in the [HugeX platform](https://hugex.co/) (**Agent Design**) and **saved** to HX Core. Tenant apps install this package, wire the worker routes, and connect the UI with `useAgent`.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Flows are **designed** in [hx-ai](https://hugex.co/) (`AgentDesign.tsx`, React F
|
|
|
10
10
|
pnpm add @hugex/ai
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Peer
|
|
13
|
+
Peer dependencies are declared in the package — align versions with your tenant app.
|
|
14
14
|
|
|
15
15
|
## Exports
|
|
16
16
|
|
|
@@ -32,12 +32,6 @@ import {
|
|
|
32
32
|
handleCommonRoutes,
|
|
33
33
|
handleIntancesRoutes,
|
|
34
34
|
} from '@hugex/ai';
|
|
35
|
-
import { createRequestHandler } from 'react-router';
|
|
36
|
-
|
|
37
|
-
const requestHandler = createRequestHandler(
|
|
38
|
-
() => import('virtual:react-router/server-build'),
|
|
39
|
-
import.meta.env.MODE,
|
|
40
|
-
);
|
|
41
35
|
|
|
42
36
|
export default {
|
|
43
37
|
async fetch(request, env, ctx) {
|
|
@@ -53,7 +47,8 @@ export default {
|
|
|
53
47
|
const instances = await handleIntancesRoutes(request, env, ctx);
|
|
54
48
|
if (instances instanceof Response) return instances;
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
// Then delegate to your app's SSR/router handler.
|
|
51
|
+
return yourAppHandler(request, { cloudflare: { env, ctx }, state: { ...auth } });
|
|
57
52
|
},
|
|
58
53
|
} satisfies ExportedHandler<Env>;
|
|
59
54
|
|
|
@@ -104,7 +99,7 @@ Rules: exactly one Start, at least one Answer, all paths connected.
|
|
|
104
99
|
|
|
105
100
|
## `useAgent` — client hook
|
|
106
101
|
|
|
107
|
-
`useAgent` opens a WebSocket to the session DO, decodes the `TYPE::CONTENT` wire protocol, and writes conversation state into
|
|
102
|
+
`useAgent` opens a WebSocket to the session DO, decodes the `TYPE::CONTENT` wire protocol, and writes conversation state into the agent store. UI components subscribe to the store and call `send`, `clearHistory`, etc.
|
|
108
103
|
|
|
109
104
|
### Options
|
|
110
105
|
|
|
@@ -158,9 +153,9 @@ Reference: `ora-base/app/secure/chat/components/ChatView.tsx`.
|
|
|
158
153
|
Flow under design in Agent Design; `flowId` from route params; session from run store; JWT via `query`:
|
|
159
154
|
|
|
160
155
|
```tsx
|
|
161
|
-
const
|
|
156
|
+
const flowId = '…'; // from your route or config
|
|
162
157
|
const sessionId = '…'; // from run session store
|
|
163
|
-
const socketUrl = tenant.data.ora.socketServer; //
|
|
158
|
+
const socketUrl = tenant.data.ora.socketServer; // tenant worker host
|
|
164
159
|
|
|
165
160
|
const { send, sendAuth, clearHistory } = useAgent({
|
|
166
161
|
host: socketUrl,
|
|
@@ -173,7 +168,7 @@ const { send, sendAuth, clearHistory } = useAgent({
|
|
|
173
168
|
const messages = useAgentStore((s) => s.messages);
|
|
174
169
|
```
|
|
175
170
|
|
|
176
|
-
Reference: `hx-ai/.../RunStatusPanel.tsx
|
|
171
|
+
Reference: `hx-ai/.../RunStatusPanel.tsx`.
|
|
177
172
|
|
|
178
173
|
Start-node flags (`allow_images`, `allow_documents`, `memory_enabled`) are read from the canvas nodes to drive the Run UI.
|
|
179
174
|
|
|
@@ -228,7 +223,7 @@ Subscribe via `useAgentStore` (global) or `store` (isolated):
|
|
|
228
223
|
| `status` | `'connecting' \| 'connected' \| 'disconnected'` — gate input on `'connected'` |
|
|
229
224
|
| `flowConfig` | Start-node config from server (`CFG::`: greeting, attachments) |
|
|
230
225
|
| `events` | Tool/info events from `SE::` stream |
|
|
231
|
-
| `composioAuth` | OAuth redirect when
|
|
226
|
+
| `composioAuth` | OAuth redirect when a connected tool requires manual authorization |
|
|
232
227
|
| `approvals` | Human-in-the-loop tool approvals |
|
|
233
228
|
|
|
234
229
|
## Wire protocol (summary)
|
|
@@ -238,7 +233,7 @@ Inbound frames use `TYPE::CONTENT`:
|
|
|
238
233
|
| Code | Meaning |
|
|
239
234
|
|---|---|
|
|
240
235
|
| `HIS` | Full history replay |
|
|
241
|
-
| `SE` | Server event (tools, memory,
|
|
236
|
+
| `SE` | Server event (tools, memory, external integrations, …) |
|
|
242
237
|
| `TS` / `TSC` | Assistant text stream / complete |
|
|
243
238
|
| `RS` / `RSC` | Reasoning stream / complete |
|
|
244
239
|
| `CFG` | Flow config (attachments, greeting) |
|
|
@@ -246,11 +241,11 @@ Inbound frames use `TYPE::CONTENT`:
|
|
|
246
241
|
|
|
247
242
|
Outbound: `M:` user message, `CH:` clear history, `AUT:` runtime credential, `UID:` session identity.
|
|
248
243
|
|
|
249
|
-
Full reference:
|
|
244
|
+
Full reference: wire protocol details in the HugeX runtime source (`WEBSOCKET_EVENTS.md`).
|
|
250
245
|
|
|
251
|
-
##
|
|
246
|
+
## Bundler
|
|
252
247
|
|
|
253
|
-
Exclude `@hugex/ai` from
|
|
248
|
+
Exclude `@hugex/ai` from dependency pre-bundling in your dev server:
|
|
254
249
|
|
|
255
250
|
```ts
|
|
256
251
|
optimizeDeps: {
|
package/package.json
CHANGED