@webless/agent 0.2.0 → 0.2.7
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 +22 -106
- package/dist/{chunk-WLQDMWO6.js → chunk-4QGS7UZY.js} +899 -736
- package/dist/chunk-4QGS7UZY.js.map +1 -0
- package/dist/embed.cjs +709 -612
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +156 -148
- package/dist/embed.css.map +1 -1
- package/dist/embed.d.cts +23 -13
- package/dist/embed.d.ts +23 -13
- package/dist/embed.js +72 -131
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +19 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/dist/placement-CXW_83AF.d.cts +25 -0
- package/dist/placement-CXW_83AF.d.ts +25 -0
- package/dist/react.cjs +876 -718
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +156 -1
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +16 -13
- package/dist/react.d.ts +16 -13
- package/dist/react.js +8 -1
- package/dist/react.js.map +1 -1
- package/package.json +5 -5
- package/scripts/build-agent-manifest-bundle-impl.mjs +32 -32
- package/scripts/ensure-css-imports.mjs +53 -0
- package/dist/chunk-WLQDMWO6.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,121 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @webless/agent
|
|
2
2
|
|
|
3
|
-
Webless Agent
|
|
3
|
+
Webless Agent — AI assist for your site.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Get started
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
```
|
|
7
|
+
1. Sign up at [app.webless.ai](https://app.webless.ai)
|
|
8
|
+
2. Create and publish an index
|
|
9
|
+
3. Open **Agent Studio** for that index
|
|
10
|
+
4. Build a preview bundle, then copy the **install snippet**
|
|
11
|
+
5. Paste the snippet into your site HTML
|
|
71
12
|
|
|
72
|
-
|
|
13
|
+
That is the full integration. Webless builds and hosts the agent script for you.
|
|
73
14
|
|
|
74
|
-
|
|
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`:
|
|
15
|
+
The snippet is a single script tag, for example:
|
|
87
16
|
|
|
88
17
|
```html
|
|
89
|
-
<script src="
|
|
90
|
-
<script>
|
|
91
|
-
window.WeblessAgent?.open();
|
|
92
|
-
</script>
|
|
18
|
+
<script defer src="…"></script>
|
|
93
19
|
```
|
|
94
20
|
|
|
95
|
-
|
|
21
|
+
The exact URL is generated in the console when you build your bundle.
|
|
96
22
|
|
|
97
|
-
|
|
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>` |
|
|
23
|
+
## What you get
|
|
103
24
|
|
|
104
|
-
|
|
25
|
+
- A collapsible assist panel on your site
|
|
26
|
+
- Answers grounded in your published index
|
|
27
|
+
- Edge tab launcher (position configured in Agent Studio)
|
|
28
|
+
- Session continuity for returning visitors
|
|
105
29
|
|
|
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
30
|
|
|
113
|
-
|
|
31
|
+
## This npm package
|
|
32
|
+
|
|
33
|
+
`@webless/agent` is published for Webless tooling and internal use. It powers the script bundle served from the console install flow.
|
|
114
34
|
|
|
115
|
-
|
|
35
|
+
Customers integrate via the **console snippet only** — not via `@webless/agent/react` or a direct npm dependency.
|
|
116
36
|
|
|
117
|
-
|
|
118
|
-
|---------|---------|
|
|
119
|
-
| `@webless/agent` | Headless Eve client |
|
|
120
|
-
| `@webless/agent/react` | AgentRail, AssistEdgeTab, `useAgentChat` |
|
|
121
|
-
| `@webless/agent/embed` | `mountAgent`, manifest normalization |
|
|
37
|
+
If you are building on Webless internally, see the package source and `apps/agent-demo` in the [webless-sdk](https://github.com/tech-webless/webless-sdk) repo.
|