site-operator-react 0.1.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/README.md +58 -0
- package/dist/index.d.ts +33 -0
- package/dist/site-operator-react.es.js +312 -0
- package/dist/site-operator-react.umd.js +22 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Site Operator React
|
|
2
|
+
|
|
3
|
+
The React 19 wrapper for Site Operator. It provides a seamless integration of the Site Operator agent widget into React applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install site-operator-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
*Note: You must also have `react` and `react-dom` installed.*
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### AgentChat Component
|
|
16
|
+
|
|
17
|
+
The `<AgentChat />` component renders the chat widget. It wraps the underlying Web Component and handles prop syncing.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { AgentChat } from 'site-operator-react';
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
return (
|
|
24
|
+
<div className="App">
|
|
25
|
+
<AgentChat
|
|
26
|
+
backendUrl="http://localhost:8001/ag_ui"
|
|
27
|
+
appName="My React App"
|
|
28
|
+
agentAvatar="/avatar.png"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### useChatPortal Hook
|
|
36
|
+
|
|
37
|
+
The `useChatPortal` hook allows you to register the "Copilot" capabilities (Portal Spec) for your application. This lets the agent control the app (e.g., navigate, perform actions).
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useChatPortal } from 'site-operator-react';
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
useChatPortal({
|
|
44
|
+
actions: {
|
|
45
|
+
openSettings: () => {
|
|
46
|
+
// Your logic to open settings
|
|
47
|
+
},
|
|
48
|
+
navigate: ({ path }) => {
|
|
49
|
+
// Your router logic
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
// ...
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AgentState } from 'site-operator';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { NavGraph } from 'site-operator';
|
|
4
|
+
import { NavNode } from 'site-operator';
|
|
5
|
+
import { PortalSpec } from 'site-operator';
|
|
6
|
+
|
|
7
|
+
export declare const AgentChat: default_2.FC<AgentChatProps>;
|
|
8
|
+
|
|
9
|
+
export declare interface AgentChatProps {
|
|
10
|
+
backendUrl?: string;
|
|
11
|
+
appName?: string;
|
|
12
|
+
agentAvatar?: string;
|
|
13
|
+
inspector?: boolean;
|
|
14
|
+
appContext?: AgentState;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AgentState }
|
|
19
|
+
|
|
20
|
+
export { NavGraph }
|
|
21
|
+
|
|
22
|
+
export { NavNode }
|
|
23
|
+
|
|
24
|
+
export { PortalSpec }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A hook to register a Chat Portal specification for the agent.
|
|
28
|
+
* This allows the agent to navigate and control the host application.
|
|
29
|
+
* @param spec The PortalSpec defining navigation graph and actions.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useChatPortal(spec: PortalSpec): void;
|
|
32
|
+
|
|
33
|
+
export { }
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import ee, { useRef as re, useEffect as D } from "react";
|
|
2
|
+
import { chatPortalService as te } from "site-operator";
|
|
3
|
+
var b = { exports: {} }, E = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var $;
|
|
14
|
+
function ne() {
|
|
15
|
+
if ($) return E;
|
|
16
|
+
$ = 1;
|
|
17
|
+
var s = Symbol.for("react.transitional.element"), f = Symbol.for("react.fragment");
|
|
18
|
+
function c(i, o, u) {
|
|
19
|
+
var l = null;
|
|
20
|
+
if (u !== void 0 && (l = "" + u), o.key !== void 0 && (l = "" + o.key), "key" in o) {
|
|
21
|
+
u = {};
|
|
22
|
+
for (var d in o)
|
|
23
|
+
d !== "key" && (u[d] = o[d]);
|
|
24
|
+
} else u = o;
|
|
25
|
+
return o = u.ref, {
|
|
26
|
+
$$typeof: s,
|
|
27
|
+
type: i,
|
|
28
|
+
key: l,
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: u
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return E.Fragment = f, E.jsx = c, E.jsxs = c, E;
|
|
34
|
+
}
|
|
35
|
+
var _ = {};
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
var I;
|
|
46
|
+
function ae() {
|
|
47
|
+
return I || (I = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
|
+
function s(e) {
|
|
49
|
+
if (e == null) return null;
|
|
50
|
+
if (typeof e == "function")
|
|
51
|
+
return e.$$typeof === Z ? null : e.displayName || e.name || null;
|
|
52
|
+
if (typeof e == "string") return e;
|
|
53
|
+
switch (e) {
|
|
54
|
+
case p:
|
|
55
|
+
return "Fragment";
|
|
56
|
+
case q:
|
|
57
|
+
return "Profiler";
|
|
58
|
+
case U:
|
|
59
|
+
return "StrictMode";
|
|
60
|
+
case G:
|
|
61
|
+
return "Suspense";
|
|
62
|
+
case X:
|
|
63
|
+
return "SuspenseList";
|
|
64
|
+
case H:
|
|
65
|
+
return "Activity";
|
|
66
|
+
}
|
|
67
|
+
if (typeof e == "object")
|
|
68
|
+
switch (typeof e.tag == "number" && console.error(
|
|
69
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
+
), e.$$typeof) {
|
|
71
|
+
case W:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case V:
|
|
74
|
+
return e.displayName || "Context";
|
|
75
|
+
case J:
|
|
76
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case z:
|
|
78
|
+
var r = e.render;
|
|
79
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
|
+
case B:
|
|
81
|
+
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
|
|
82
|
+
case T:
|
|
83
|
+
r = e._payload, e = e._init;
|
|
84
|
+
try {
|
|
85
|
+
return s(e(r));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function f(e) {
|
|
92
|
+
return "" + e;
|
|
93
|
+
}
|
|
94
|
+
function c(e) {
|
|
95
|
+
try {
|
|
96
|
+
f(e);
|
|
97
|
+
var r = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
r = !0;
|
|
100
|
+
}
|
|
101
|
+
if (r) {
|
|
102
|
+
r = console;
|
|
103
|
+
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return t.call(
|
|
105
|
+
r,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
n
|
|
108
|
+
), f(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function i(e) {
|
|
112
|
+
if (e === p) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === T)
|
|
114
|
+
return "<...>";
|
|
115
|
+
try {
|
|
116
|
+
var r = s(e);
|
|
117
|
+
return r ? "<" + r + ">" : "<...>";
|
|
118
|
+
} catch {
|
|
119
|
+
return "<...>";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function o() {
|
|
123
|
+
var e = k.A;
|
|
124
|
+
return e === null ? null : e.getOwner();
|
|
125
|
+
}
|
|
126
|
+
function u() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
128
|
+
}
|
|
129
|
+
function l(e) {
|
|
130
|
+
if (y.call(e, "key")) {
|
|
131
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
|
+
if (r && r.isReactWarning) return !1;
|
|
133
|
+
}
|
|
134
|
+
return e.key !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function d(e, r) {
|
|
137
|
+
function t() {
|
|
138
|
+
j || (j = !0, console.error(
|
|
139
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
+
r
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: t,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function L() {
|
|
149
|
+
var e = s(this.type);
|
|
150
|
+
return x[e] || (x[e] = !0, console.error(
|
|
151
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
|
+
}
|
|
154
|
+
function M(e, r, t, n, v, O) {
|
|
155
|
+
var a = t.ref;
|
|
156
|
+
return e = {
|
|
157
|
+
$$typeof: w,
|
|
158
|
+
type: e,
|
|
159
|
+
key: r,
|
|
160
|
+
props: t,
|
|
161
|
+
_owner: n
|
|
162
|
+
}, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
get: L
|
|
165
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
166
|
+
configurable: !1,
|
|
167
|
+
enumerable: !1,
|
|
168
|
+
writable: !0,
|
|
169
|
+
value: 0
|
|
170
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
171
|
+
configurable: !1,
|
|
172
|
+
enumerable: !1,
|
|
173
|
+
writable: !0,
|
|
174
|
+
value: null
|
|
175
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
176
|
+
configurable: !1,
|
|
177
|
+
enumerable: !1,
|
|
178
|
+
writable: !0,
|
|
179
|
+
value: v
|
|
180
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
181
|
+
configurable: !1,
|
|
182
|
+
enumerable: !1,
|
|
183
|
+
writable: !0,
|
|
184
|
+
value: O
|
|
185
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
|
+
}
|
|
187
|
+
function S(e, r, t, n, v, O) {
|
|
188
|
+
var a = r.children;
|
|
189
|
+
if (a !== void 0)
|
|
190
|
+
if (n)
|
|
191
|
+
if (Q(a)) {
|
|
192
|
+
for (n = 0; n < a.length; n++)
|
|
193
|
+
g(a[n]);
|
|
194
|
+
Object.freeze && Object.freeze(a);
|
|
195
|
+
} else
|
|
196
|
+
console.error(
|
|
197
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
|
+
);
|
|
199
|
+
else g(a);
|
|
200
|
+
if (y.call(r, "key")) {
|
|
201
|
+
a = s(e);
|
|
202
|
+
var m = Object.keys(r).filter(function(K) {
|
|
203
|
+
return K !== "key";
|
|
204
|
+
});
|
|
205
|
+
n = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", Y[a + n] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
207
|
+
let props = %s;
|
|
208
|
+
<%s {...props} />
|
|
209
|
+
React keys must be passed directly to JSX without using spread:
|
|
210
|
+
let props = %s;
|
|
211
|
+
<%s key={someKey} {...props} />`,
|
|
212
|
+
n,
|
|
213
|
+
a,
|
|
214
|
+
m,
|
|
215
|
+
a
|
|
216
|
+
), Y[a + n] = !0);
|
|
217
|
+
}
|
|
218
|
+
if (a = null, t !== void 0 && (c(t), a = "" + t), l(r) && (c(r.key), a = "" + r.key), "key" in r) {
|
|
219
|
+
t = {};
|
|
220
|
+
for (var P in r)
|
|
221
|
+
P !== "key" && (t[P] = r[P]);
|
|
222
|
+
} else t = r;
|
|
223
|
+
return a && d(
|
|
224
|
+
t,
|
|
225
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
|
+
), M(
|
|
227
|
+
e,
|
|
228
|
+
a,
|
|
229
|
+
t,
|
|
230
|
+
o(),
|
|
231
|
+
v,
|
|
232
|
+
O
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function g(e) {
|
|
236
|
+
h(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === T && (e._payload.status === "fulfilled" ? h(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
237
|
+
}
|
|
238
|
+
function h(e) {
|
|
239
|
+
return typeof e == "object" && e !== null && e.$$typeof === w;
|
|
240
|
+
}
|
|
241
|
+
var R = ee, w = Symbol.for("react.transitional.element"), W = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), V = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), G = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), k = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, Q = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
R = {
|
|
245
|
+
react_stack_bottom_frame: function(e) {
|
|
246
|
+
return e();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var j, x = {}, N = R.react_stack_bottom_frame.bind(
|
|
250
|
+
R,
|
|
251
|
+
u
|
|
252
|
+
)(), C = A(i(u)), Y = {};
|
|
253
|
+
_.Fragment = p, _.jsx = function(e, r, t) {
|
|
254
|
+
var n = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return S(
|
|
256
|
+
e,
|
|
257
|
+
r,
|
|
258
|
+
t,
|
|
259
|
+
!1,
|
|
260
|
+
n ? Error("react-stack-top-frame") : N,
|
|
261
|
+
n ? A(i(e)) : C
|
|
262
|
+
);
|
|
263
|
+
}, _.jsxs = function(e, r, t) {
|
|
264
|
+
var n = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return S(
|
|
266
|
+
e,
|
|
267
|
+
r,
|
|
268
|
+
t,
|
|
269
|
+
!0,
|
|
270
|
+
n ? Error("react-stack-top-frame") : N,
|
|
271
|
+
n ? A(i(e)) : C
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
})()), _;
|
|
275
|
+
}
|
|
276
|
+
var F;
|
|
277
|
+
function oe() {
|
|
278
|
+
return F || (F = 1, process.env.NODE_ENV === "production" ? b.exports = ne() : b.exports = ae()), b.exports;
|
|
279
|
+
}
|
|
280
|
+
var se = oe();
|
|
281
|
+
const ce = ({
|
|
282
|
+
backendUrl: s,
|
|
283
|
+
appName: f,
|
|
284
|
+
agentAvatar: c,
|
|
285
|
+
inspector: i,
|
|
286
|
+
appContext: o,
|
|
287
|
+
className: u
|
|
288
|
+
}) => {
|
|
289
|
+
const l = re(null);
|
|
290
|
+
return D(() => {
|
|
291
|
+
l.current && o && l.current.setAppContext(o);
|
|
292
|
+
}, [o]), /* @__PURE__ */ se.jsx(
|
|
293
|
+
"agent-chat",
|
|
294
|
+
{
|
|
295
|
+
ref: l,
|
|
296
|
+
"backend-url": s,
|
|
297
|
+
"app-name": f,
|
|
298
|
+
"agent-avatar": c,
|
|
299
|
+
inspector: i ? "true" : void 0,
|
|
300
|
+
class: u
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
};
|
|
304
|
+
function ie(s) {
|
|
305
|
+
D(() => {
|
|
306
|
+
te.registerPortal(s);
|
|
307
|
+
}, [s]);
|
|
308
|
+
}
|
|
309
|
+
export {
|
|
310
|
+
ce as AgentChat,
|
|
311
|
+
ie as useChatPortal
|
|
312
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("site-operator")):typeof define=="function"&&define.amd?define(["exports","react","site-operator"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.SiteOperatorReact={},l.React,l.SiteOperator))})(this,(function(l,i,W){"use strict";var v={exports:{}},_={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var y;function U(){if(y)return _;y=1;var s=Symbol.for("react.transitional.element"),m=Symbol.for("react.fragment");function f(d,o,u){var c=null;if(u!==void 0&&(c=""+u),o.key!==void 0&&(c=""+o.key),"key"in o){u={};for(var p in o)p!=="key"&&(u[p]=o[p])}else u=o;return o=u.ref,{$$typeof:s,type:d,key:c,ref:o!==void 0?o:null,props:u}}return _.Fragment=m,_.jsx=f,_.jsxs=f,_}var R={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var g;function $(){return g||(g=1,process.env.NODE_ENV!=="production"&&(function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case Z:return"Profiler";case H:return"StrictMode";case re:return"Suspense";case te:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case B:return"Portal";case K:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ne:return r=e.displayName||null,r!==null?r:s(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return s(e(r))}catch{}}return null}function m(e){return""+e}function f(e){try{m(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),m(e)}}function d(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=s(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=S.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function c(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function p(e,r){function t(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function G(){var e=s(this.type);return F[e]||(F[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function X(e,r,t,n,T,P){var a=t.ref;return e={$$typeof:C,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:G}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,r,t,n,T,P){var a=r.children;if(a!==void 0)if(n)if(se(a)){for(n=0;n<a.length;n++)x(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(a);if(Y.call(r,"key")){a=s(e);var E=Object.keys(r).filter(function(ue){return ue!=="key"});n=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",L[a+n]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,n,a,E,a),L[a+n]=!0)}if(a=null,t!==void 0&&(f(t),a=""+t),c(r)&&(f(r.key),a=""+r.key),"key"in r){t={};for(var h in r)h!=="key"&&(t[h]=r[h])}else t=r;return a&&p(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),X(e,a,t,o(),T,P)}function x(e){N(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?N(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function N(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}var b=i,C=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),K=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),S=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,se=Array.isArray,A=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(e){return e()}};var I,F={},D=b.react_stack_bottom_frame.bind(b,u)(),M=A(d(u)),L={};R.Fragment=k,R.jsx=function(e,r,t){var n=1e4>S.recentlyCreatedOwnerStacks++;return w(e,r,t,!1,n?Error("react-stack-top-frame"):D,n?A(d(e)):M)},R.jsxs=function(e,r,t){var n=1e4>S.recentlyCreatedOwnerStacks++;return w(e,r,t,!0,n?Error("react-stack-top-frame"):D,n?A(d(e)):M)}})()),R}var j;function J(){return j||(j=1,process.env.NODE_ENV==="production"?v.exports=U():v.exports=$()),v.exports}var V=J();const z=({backendUrl:s,appName:m,agentAvatar:f,inspector:d,appContext:o,className:u})=>{const c=i.useRef(null);return i.useEffect(()=>{c.current&&o&&c.current.setAppContext(o)},[o]),V.jsx("agent-chat",{ref:c,"backend-url":s,"app-name":m,"agent-avatar":f,inspector:d?"true":void 0,class:u})};function q(s){i.useEffect(()=>{W.chatPortalService.registerPortal(s)},[s])}l.AgentChat=z,l.useChatPortal=q,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "site-operator-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React wrapper for site-operator, providing AgentChat component and hooks.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "jostvian-agent",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/jostvian-agent/site-operator.git",
|
|
11
|
+
"directory": "packages/react"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/jostvian-agent/site-operator/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/jostvian-agent/site-operator#readme",
|
|
17
|
+
"main": "./dist/site-operator-react.umd.js",
|
|
18
|
+
"module": "./dist/site-operator-react.es.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/site-operator-react.es.js",
|
|
27
|
+
"require": "./dist/site-operator-react.umd.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "vite build",
|
|
32
|
+
"dev": "vite build --watch"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"site-operator": "*"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^19.0.0",
|
|
39
|
+
"react-dom": "^19.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0",
|
|
44
|
+
"@types/react": "^19.0.0",
|
|
45
|
+
"@types/react-dom": "^19.0.0",
|
|
46
|
+
"typescript": "~5.9.3",
|
|
47
|
+
"vite": "^6.0.0",
|
|
48
|
+
"vite-plugin-dts": "^4.5.0"
|
|
49
|
+
}
|
|
50
|
+
}
|