@webless/agent 0.2.0
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 +21 -0
- package/README.md +121 -0
- package/dist/chunk-WLQDMWO6.js +932 -0
- package/dist/chunk-WLQDMWO6.js.map +1 -0
- package/dist/embed.cjs +1188 -0
- package/dist/embed.cjs.map +1 -0
- package/dist/embed.css +945 -0
- package/dist/embed.css.map +1 -0
- package/dist/embed.d.cts +55 -0
- package/dist/embed.d.ts +55 -0
- package/dist/embed.js +248 -0
- package/dist/embed.js.map +1 -0
- package/dist/index.cjs +368 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +332 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +978 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.css +798 -0
- package/dist/react.css.map +1 -0
- package/dist/react.d.cts +113 -0
- package/dist/react.d.ts +113 -0
- package/dist/react.js +36 -0
- package/dist/react.js.map +1 -0
- package/package.json +61 -0
- package/scripts/build-agent-manifest-bundle-impl.mjs +87 -0
- package/scripts/build-agent-manifest-bundle.mjs +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Webless AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# `@webless/agent`
|
|
2
|
+
|
|
3
|
+
Webless Agent SDK — Eve runtime client, React UI, embed mount API, and IIFE bundle builder.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @webless/agent eve react react-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`react` and `react-dom` are required for `@webless/agent/react` and `@webless/agent/embed`.
|
|
12
|
+
|
|
13
|
+
## Headless client
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createAgentClient, pingAgentHealth } from "@webless/agent";
|
|
17
|
+
|
|
18
|
+
const health = await pingAgentHealth("https://runtime.staging.webless.ai");
|
|
19
|
+
console.log(health.ok ? "ready" : health.detail);
|
|
20
|
+
|
|
21
|
+
const agent = createAgentClient({
|
|
22
|
+
indexId: "YOUR_PUBLISHED_INDEX_ID",
|
|
23
|
+
runtimeOrigin: "https://runtime.staging.webless.ai",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const reply = await agent.sendTurn("What can you help me with?", {
|
|
27
|
+
handlers: {
|
|
28
|
+
onDelta: (delta) => process.stdout.write(delta),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## React UI
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { AgentRail, useAgentChat } from "@webless/agent/react";
|
|
37
|
+
import "@webless/agent/react.css";
|
|
38
|
+
|
|
39
|
+
function AssistPanel({ indexId }: { indexId: string }) {
|
|
40
|
+
const { state, submit } = useAgentChat({ indexId });
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<AgentRail
|
|
44
|
+
state={state}
|
|
45
|
+
onSubmit={(message) => void submit(message)}
|
|
46
|
+
onFollowUpSelect={(label) => void submit(label)}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Embed API (programmatic mount)
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { mountAgent, unmountAgent } from "@webless/agent/embed";
|
|
56
|
+
|
|
57
|
+
const handle = mountAgent({
|
|
58
|
+
manifest: {
|
|
59
|
+
customerId: "cust_123",
|
|
60
|
+
indexId: "idx_abc",
|
|
61
|
+
runtimeOrigin: "https://runtime.staging.webless.ai",
|
|
62
|
+
placement: { side: "right", along: 50, inset: 0, variant: "outline" },
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
handle.open();
|
|
67
|
+
handle.close();
|
|
68
|
+
handle.unmount();
|
|
69
|
+
// or unmountAgent("cust_123");
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
v1 defaults to a right-side edge tab + collapsible rail (Agent Studio tokens).
|
|
73
|
+
|
|
74
|
+
## Customer IIFE bundle (`agent.js`)
|
|
75
|
+
|
|
76
|
+
Build a copy-paste script bundle with manifest baked in:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cd packages/agent
|
|
80
|
+
npm run build:bundle -- \
|
|
81
|
+
--manifest examples/agent.manifest.json \
|
|
82
|
+
--customer-id demo_customer \
|
|
83
|
+
--out-dir dist/bundles
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Output: `dist/bundles/agent.js` exposing `window.WeblessAgent`:
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<script src="https://agents.webless.ai/demo_customer/agent.js" async></script>
|
|
90
|
+
<script>
|
|
91
|
+
window.WeblessAgent?.open();
|
|
92
|
+
</script>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Runtime endpoints
|
|
96
|
+
|
|
97
|
+
| Operation | Request |
|
|
98
|
+
|-----------|---------|
|
|
99
|
+
| Health | `GET /eve/v1/health` |
|
|
100
|
+
| Start session | `POST /eve/v1/session?indexId=<index-id>` |
|
|
101
|
+
| Continue session | `POST /eve/v1/session/:sessionId?indexId=<index-id>` |
|
|
102
|
+
| Resume stream | `GET /eve/v1/session/:sessionId/stream?indexId=<index-id>` |
|
|
103
|
+
|
|
104
|
+
## Local browser demo
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
cd webless-sdk
|
|
108
|
+
cp apps/agent-demo/.env.example apps/agent-demo/.env.local
|
|
109
|
+
npm install
|
|
110
|
+
npm run dev:agent
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Open **http://127.0.0.1:5178** for the headless Eve streaming demo.
|
|
114
|
+
|
|
115
|
+
## Exports
|
|
116
|
+
|
|
117
|
+
| Subpath | Purpose |
|
|
118
|
+
|---------|---------|
|
|
119
|
+
| `@webless/agent` | Headless Eve client |
|
|
120
|
+
| `@webless/agent/react` | AgentRail, AssistEdgeTab, `useAgentChat` |
|
|
121
|
+
| `@webless/agent/embed` | `mountAgent`, manifest normalization |
|