@useago/sdk 1.7.2 → 1.12.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/CHANGELOG.md +175 -0
- package/README.md +96 -1
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +402 -5
- package/dist/angular.d.ts +402 -5
- package/dist/angular.js +11 -7
- package/dist/{createConversationSession-DP90nY71.js → createConversationSession-B1Qn-y0I.js} +3 -3
- package/dist/createConversationSession-B3v_xOU7.cjs +1 -0
- package/dist/createFormCollector-FvwDOqnV.cjs +1 -0
- package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-m79zk_NA.js} +1 -1
- package/dist/createMockClient-BEOXI8yW.cjs +1 -0
- package/dist/{createMockClient-BDLW6tVc.js → createMockClient-Beao82tu.js} +31 -18
- package/dist/devtools.cjs +61 -12
- package/dist/devtools.d.cts +403 -5
- package/dist/devtools.d.ts +403 -5
- package/dist/devtools.js +225 -73
- package/dist/errors-BLfjXnLB.js +32 -0
- package/dist/errors-o1IB5fEu.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +489 -7
- package/dist/index.d.ts +489 -7
- package/dist/index.js +124 -118
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +510 -3
- package/dist/react.d.ts +510 -3
- package/dist/react.js +1036 -752
- package/dist/sheetController-BThJRtOu.cjs +1 -0
- package/dist/sheetController-aEKXIvjk.js +343 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +393 -3
- package/dist/testing.d.ts +393 -3
- package/dist/testing.js +1 -1
- package/dist/types-Ct1hlKwg.js +2408 -0
- package/dist/types-mcW8vB1U.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +615 -3
- package/dist/vue.d.ts +615 -3
- package/dist/vue.js +202 -154
- package/dist/widget.cjs +6 -4
- package/dist/widget.d.cts +733 -5
- package/dist/widget.d.ts +733 -5
- package/dist/widget.js +3996 -786
- package/llms-full.txt +264 -31
- package/package.json +1 -1
- package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
- package/dist/AgoClient-DTkBRGFE.js +0 -1965
- package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
- package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
- package/dist/createMockClient-BSNuN3ys.cjs +0 -1
- package/dist/sheetController-CBUVOroo.js +0 -205
- package/dist/sheetController-DY-sC13T.cjs +0 -1
package/dist/devtools.js
CHANGED
|
@@ -1,97 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { n as te } from "./errors-BLfjXnLB.js";
|
|
2
|
+
function Q(n, e, i) {
|
|
3
|
+
if (!n) return;
|
|
4
|
+
const r = document.createElement("div");
|
|
5
|
+
r.className = `dev-log-line dev-log-${i}`, r.textContent = `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ${e}`, n.appendChild(r), n.scrollTop = n.scrollHeight;
|
|
6
|
+
}
|
|
7
|
+
function ne(n) {
|
|
8
|
+
let e;
|
|
9
|
+
return n.type ? e = n.type : n.content !== void 0 ? e = "content" : n.full_content !== void 0 ? e = "full_content" : n.status ? e = `status:${n.status}` : e = "event", `${e} ${JSON.stringify(n)}`;
|
|
10
|
+
}
|
|
11
|
+
var oe = "ago_dev_panel_collapsed", ae = "ago_dev_events_collapsed";
|
|
12
|
+
function _(n, e, i, r) {
|
|
13
|
+
n.classList.toggle("collapsed", e);
|
|
14
|
+
const v = n.querySelector(".dev-toggle");
|
|
15
|
+
v && (v.textContent = e ? "▢" : "—", v.title = e ? `Expand ${r}` : `Collapse ${r}`, v.setAttribute("aria-expanded", String(!e)));
|
|
15
16
|
try {
|
|
16
|
-
localStorage.setItem(
|
|
17
|
+
localStorage.setItem(i, e ? "1" : "0");
|
|
17
18
|
} catch {
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}),
|
|
24
|
-
|
|
21
|
+
function W(n, e, i) {
|
|
22
|
+
n.querySelector(".dev-toggle")?.addEventListener("click", (v) => {
|
|
23
|
+
v.stopPropagation(), _(n, !n.classList.contains("collapsed"), e, i);
|
|
24
|
+
}), n.addEventListener("click", () => {
|
|
25
|
+
n.classList.contains("collapsed") && _(n, !1, e, i);
|
|
25
26
|
});
|
|
26
|
-
let
|
|
27
|
+
let r = !1;
|
|
27
28
|
try {
|
|
28
|
-
|
|
29
|
+
r = localStorage.getItem(e) === "1";
|
|
29
30
|
} catch {
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
_(n, r, e, i);
|
|
33
|
+
}
|
|
34
|
+
var re = 0;
|
|
35
|
+
function ce(n) {
|
|
36
|
+
const { client: e, target: i, label: r, side: v = "right", enableFunctionRunner: F = !1 } = n;
|
|
37
|
+
if (F && typeof e.executeClientFunction != "function") throw new te("initDevPanel: enableFunctionRunner requires client.executeClientFunction. Pass a real AgoClient, not a mock that omits it.", "dev_panel_missing_capability");
|
|
38
|
+
let u = !1;
|
|
39
|
+
const P = re++, R = P === 0 ? "" : `-${P + 1}`, A = document.querySelectorAll(`#ago-dev-panel[data-ago-dev-side="${v}"]`).length, N = A > 0 ? `${16 + A * 376}px` : "";
|
|
40
|
+
let w = null, J = null, q = null;
|
|
41
|
+
const Z = () => {
|
|
42
|
+
const t = e.getContextSnapshot()?.entries ?? {};
|
|
43
|
+
return Object.fromEntries(Object.entries(t).map(([o, { name: d, data: a }]) => [o, {
|
|
44
|
+
name: d,
|
|
45
|
+
data: a
|
|
41
46
|
}]));
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
47
|
+
}, h = () => {
|
|
48
|
+
u || w && (w.textContent = JSON.stringify(Z(), null, 2));
|
|
49
|
+
}, k = (t, o) => {
|
|
50
|
+
u || Q(J, t, o);
|
|
46
51
|
};
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
const w = (t.getRegisteredFunctions?.() ?? []).map((o) => o.name).join(", ") || "—";
|
|
53
|
-
s.innerHTML = `
|
|
52
|
+
de();
|
|
53
|
+
const D = typeof i == "string" ? document.querySelector(i) : i instanceof Element ? i : document.body, I = (t) => {
|
|
54
|
+
t.dataset.agoDevSide = v, v === "left" ? (t.style.right = "auto", t.style.left = N || "16px") : N && (t.style.right = N);
|
|
55
|
+
}, p = document.createElement("aside");
|
|
56
|
+
p.id = "ago-dev-panel", p.className = "ago-dev-card", I(p), (D ?? document.body).appendChild(p), p.innerHTML = `
|
|
54
57
|
<div class="dev-head">
|
|
55
58
|
<span class="dev-badge">DEV</span>
|
|
56
|
-
<span class="dev-title">${
|
|
59
|
+
<span class="dev-title">${r ? `DEV TOOLS · ${r}` : "DEV TOOLS · client-side function state — not for production"}</span>
|
|
57
60
|
<button type="button" class="dev-toggle" aria-label="Toggle dev tools">—</button>
|
|
58
61
|
</div>
|
|
59
62
|
<div class="dev-body">
|
|
60
|
-
<div class="dev-fns">Registered functions: <code
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
<div class="dev-fns">Registered functions: <code></code></div>
|
|
64
|
+
<details class="dev-details" open>
|
|
65
|
+
<summary class="dev-section-label">JSON object (built by the agent)</summary>
|
|
66
|
+
<pre class="dev-state" id="ago-dev-state"></pre>
|
|
67
|
+
</details>
|
|
68
|
+
<details class="dev-details" open>
|
|
69
|
+
<summary class="dev-section-label">Function calls</summary>
|
|
70
|
+
<div class="dev-log" id="ago-dev-log"></div>
|
|
71
|
+
</details>
|
|
65
72
|
</div>
|
|
66
|
-
`,
|
|
67
|
-
const
|
|
68
|
-
|
|
73
|
+
`, w = p.querySelector(".dev-state"), J = p.querySelector(".dev-log");
|
|
74
|
+
const M = p.querySelector(".dev-fns code");
|
|
75
|
+
let b = null, L = null, $ = "";
|
|
76
|
+
const m = () => {
|
|
77
|
+
if (u) return;
|
|
78
|
+
const t = e.getRegisteredFunctions?.() ?? [], o = t.map((a) => a.name);
|
|
79
|
+
if (M && (M.textContent = o.join(", ") || "—"), !b) return;
|
|
80
|
+
let d = $;
|
|
81
|
+
if (o.includes(d) || (d = o.includes("setPageState") ? "setPageState" : o[0] ?? ""), $ = d, b.innerHTML = "", o.length === 0) {
|
|
82
|
+
const a = document.createElement("option");
|
|
83
|
+
a.textContent = "(no functions registered)", a.disabled = !0, b.appendChild(a);
|
|
84
|
+
}
|
|
85
|
+
for (const a of o) {
|
|
86
|
+
const s = document.createElement("option");
|
|
87
|
+
s.value = a, s.textContent = a, s.selected = a === d, b.appendChild(s);
|
|
88
|
+
}
|
|
89
|
+
if (L) {
|
|
90
|
+
const a = t.find((s) => s.name === d);
|
|
91
|
+
L.textContent = a ? JSON.stringify(a.parameters ?? {}, null, 2) : "";
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
W(p, oe + R, "dev tools");
|
|
95
|
+
const g = document.createElement("aside");
|
|
96
|
+
g.id = "ago-dev-events", g.className = "ago-dev-card", I(g), (D ?? document.body).appendChild(g), g.innerHTML = `
|
|
69
97
|
<div class="dev-head">
|
|
70
98
|
<span class="dev-badge">SSE</span>
|
|
71
|
-
<span class="dev-title">${
|
|
99
|
+
<span class="dev-title">${r ? `SSE EVENT LOG · ${r}` : "SSE EVENT LOG · raw stream messages"}</span>
|
|
72
100
|
<button type="button" class="dev-toggle" aria-label="Toggle SSE event log">—</button>
|
|
73
101
|
</div>
|
|
74
102
|
<div class="dev-body">
|
|
75
103
|
<div class="dev-log" id="ago-dev-event-log"></div>
|
|
76
104
|
</div>
|
|
77
|
-
`,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
105
|
+
`, q = g.querySelector(".dev-log"), W(g, ae + R, "SSE event log");
|
|
106
|
+
function j(t) {
|
|
107
|
+
u || Q(q, ne(t), "event");
|
|
108
|
+
}
|
|
109
|
+
function V({ functionName: t, arguments: o }) {
|
|
110
|
+
u || (k(`→ ${t}(${JSON.stringify(o ?? {})})`, "invoke"), m());
|
|
111
|
+
}
|
|
112
|
+
function H({ result: t, error: o }) {
|
|
113
|
+
u || (k(o ? `✗ error: ${o}` : `← ${JSON.stringify(t)}`, o ? "error" : "result"), h(), m());
|
|
114
|
+
}
|
|
115
|
+
function U() {
|
|
116
|
+
u || (h(), m());
|
|
117
|
+
}
|
|
118
|
+
function B(t) {
|
|
119
|
+
if (u) return;
|
|
120
|
+
const o = (t.messages ?? []).flatMap((d) => d.toolCalls ?? []);
|
|
121
|
+
k(`⟳ hydrated "${t.title || t.id}" — replayed ${o.length} tool call${o.length === 1 ? "" : "s"}`, "hydrate"), h();
|
|
122
|
+
}
|
|
123
|
+
if (e.on("stream:message", j), e.on("function:invoke", V), e.on("function:result", H), e.on("context:changed", U), e.on("conversation:loaded", B), F) {
|
|
124
|
+
const t = document.createElement("div");
|
|
125
|
+
t.className = "dev-runner";
|
|
126
|
+
const o = document.createElement("div");
|
|
127
|
+
o.className = "dev-section-label", o.textContent = "LOCAL FUNCTION RUNNER", t.appendChild(o);
|
|
128
|
+
const d = document.createElement("div");
|
|
129
|
+
d.className = "dev-runner-warning", d.textContent = "Executes locally. Does not contact the agent backend.", t.appendChild(d);
|
|
130
|
+
const a = document.createElement("div");
|
|
131
|
+
a.className = "dev-runner-row";
|
|
132
|
+
const s = document.createElement("select");
|
|
133
|
+
s.className = "dev-runner-select", a.appendChild(s);
|
|
134
|
+
const y = document.createElement("button");
|
|
135
|
+
y.type = "button", y.className = "dev-runner-btn dev-runner-btn-sm", y.textContent = "Refresh", y.addEventListener("click", m), a.appendChild(y), t.appendChild(a), b = s;
|
|
136
|
+
const O = document.createElement("div");
|
|
137
|
+
O.className = "dev-section-label", O.textContent = "SCHEMA", t.appendChild(O);
|
|
138
|
+
const z = document.createElement("pre");
|
|
139
|
+
z.className = "dev-runner-schema", t.appendChild(z), L = z, s.addEventListener("change", () => {
|
|
140
|
+
$ = s.value, m();
|
|
141
|
+
});
|
|
142
|
+
const T = document.createElement("div");
|
|
143
|
+
T.className = "dev-section-label", T.textContent = "ARGUMENTS (JSON)", t.appendChild(T);
|
|
144
|
+
const C = document.createElement("textarea");
|
|
145
|
+
C.className = "dev-runner-args", C.value = "{}", C.spellcheck = !1, t.appendChild(C);
|
|
146
|
+
const f = document.createElement("button");
|
|
147
|
+
f.type = "button", f.className = "dev-runner-btn", f.textContent = "Run", t.appendChild(f);
|
|
148
|
+
const l = document.createElement("div");
|
|
149
|
+
l.className = "dev-runner-status", t.appendChild(l);
|
|
150
|
+
const x = document.createElement("pre");
|
|
151
|
+
x.className = "dev-runner-result", t.appendChild(x);
|
|
152
|
+
const E = document.createElement("div");
|
|
153
|
+
E.className = "dev-runner-bytes", t.appendChild(E);
|
|
154
|
+
const ee = e.executeClientFunction.bind(e);
|
|
155
|
+
f.addEventListener("click", async () => {
|
|
156
|
+
l.textContent = "", x.textContent = "", E.textContent = "";
|
|
157
|
+
let G;
|
|
158
|
+
try {
|
|
159
|
+
const c = JSON.parse(C.value);
|
|
160
|
+
if (c === null || Array.isArray(c) || typeof c != "object") {
|
|
161
|
+
l.textContent = "Error: arguments must be a JSON object.", l.className = "dev-runner-status dev-runner-error";
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
G = c;
|
|
165
|
+
} catch (c) {
|
|
166
|
+
l.textContent = `Parse error: ${c instanceof Error ? c.message : String(c)}`, l.className = "dev-runner-status dev-runner-error";
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const Y = s.value;
|
|
170
|
+
if (!Y) return;
|
|
171
|
+
f.disabled = !0, l.textContent = "Running…", l.className = "dev-runner-status";
|
|
172
|
+
let S, K = !1;
|
|
173
|
+
try {
|
|
174
|
+
S = await ee(Y, G), K = !0;
|
|
175
|
+
} catch (c) {
|
|
176
|
+
if (u) return;
|
|
177
|
+
l.textContent = "Execution error", l.className = "dev-runner-status dev-runner-error", x.textContent = c instanceof Error ? `${c.constructor.name}: ${c.message}` : String(c);
|
|
178
|
+
}
|
|
179
|
+
if (!u) {
|
|
180
|
+
if (K)
|
|
181
|
+
if (l.textContent = "OK", l.className = "dev-runner-status dev-runner-ok", S === void 0) x.textContent = "(undefined)";
|
|
182
|
+
else try {
|
|
183
|
+
x.textContent = JSON.stringify(S, null, 2), E.textContent = `${new TextEncoder().encode(JSON.stringify(S)).length} bytes (UTF-8)`;
|
|
184
|
+
} catch {
|
|
185
|
+
x.textContent = "(result not serializable)";
|
|
186
|
+
}
|
|
187
|
+
f.disabled = !1, h(), m();
|
|
188
|
+
}
|
|
189
|
+
}), p.querySelector(".dev-body").appendChild(t);
|
|
190
|
+
}
|
|
191
|
+
return m(), h(), () => {
|
|
192
|
+
u || (u = !0, e.off("stream:message", j), e.off("function:invoke", V), e.off("function:result", H), e.off("context:changed", U), e.off("conversation:loaded", B), p.remove(), g.remove());
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
var X = "ago-dev-panel-styles";
|
|
196
|
+
function de() {
|
|
197
|
+
if (document.getElementById(X)) return;
|
|
198
|
+
const n = document.createElement("style");
|
|
199
|
+
n.id = X, n.textContent = se, document.head.appendChild(n);
|
|
200
|
+
}
|
|
201
|
+
var se = `
|
|
95
202
|
.ago-dev-card {
|
|
96
203
|
position: fixed;
|
|
97
204
|
right: 16px;
|
|
@@ -133,7 +240,7 @@ var q = `
|
|
|
133
240
|
cursor: pointer;
|
|
134
241
|
}
|
|
135
242
|
.ago-dev-card .dev-toggle:hover { color: #d7e0e8; border-color: #3a4655; }
|
|
136
|
-
.ago-dev-card .dev-body { display: flex; flex-direction: column; gap: 8px; }
|
|
243
|
+
.ago-dev-card .dev-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }
|
|
137
244
|
|
|
138
245
|
/* Collapsed: shrink to a small clickable widget showing only the badge. */
|
|
139
246
|
.ago-dev-card.collapsed {
|
|
@@ -156,6 +263,11 @@ var q = `
|
|
|
156
263
|
.ago-dev-card .dev-title { color: #f59e0b; font-size: 11px; line-height: 1.3; }
|
|
157
264
|
.ago-dev-card .dev-fns { color: #7c8a99; font-size: 11px; }
|
|
158
265
|
.ago-dev-card .dev-fns code { color: #9ecbff; }
|
|
266
|
+
.ago-dev-card .dev-details { margin: 0; }
|
|
267
|
+
.ago-dev-card .dev-details > summary { list-style: none; cursor: pointer; }
|
|
268
|
+
.ago-dev-card .dev-details > summary::-webkit-details-marker { display: none; }
|
|
269
|
+
.ago-dev-card .dev-details > summary::before { content: "▸ "; }
|
|
270
|
+
.ago-dev-card .dev-details[open] > summary::before { content: "▾ "; }
|
|
159
271
|
.ago-dev-card .dev-section-label {
|
|
160
272
|
color: #7c8a99;
|
|
161
273
|
text-transform: uppercase;
|
|
@@ -191,7 +303,47 @@ var q = `
|
|
|
191
303
|
.ago-dev-card .dev-log-error { color: #fca5a5; }
|
|
192
304
|
.ago-dev-card .dev-log-hydrate { color: #d8b4fe; }
|
|
193
305
|
.ago-dev-card .dev-log-event { color: #7c8a99; }
|
|
306
|
+
/* Function runner */
|
|
307
|
+
.ago-dev-card .dev-runner { border-top: 1px solid #2a3441; padding-top: 8px; margin-top: 4px; }
|
|
308
|
+
.ago-dev-card .dev-runner-warning { color: #f59e0b; font-size: 10px; margin-bottom: 4px; }
|
|
309
|
+
.ago-dev-card .dev-runner-row { display: flex; gap: 6px; align-items: center; }
|
|
310
|
+
.ago-dev-card .dev-runner-select {
|
|
311
|
+
flex: 1;
|
|
312
|
+
background: #060a0e; color: #d7e0e8; border: 1px solid #2a3441;
|
|
313
|
+
border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 11px;
|
|
314
|
+
}
|
|
315
|
+
.ago-dev-card .dev-runner-btn {
|
|
316
|
+
background: #1a2633; color: #9ecbff; border: 1px solid #2a3441;
|
|
317
|
+
border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 11px;
|
|
318
|
+
cursor: pointer;
|
|
319
|
+
}
|
|
320
|
+
.ago-dev-card .dev-runner-btn:hover { background: #243040; }
|
|
321
|
+
.ago-dev-card .dev-runner-btn:disabled { opacity: .5; cursor: default; }
|
|
322
|
+
.ago-dev-card .dev-runner-btn-sm { padding: 4px 8px; }
|
|
323
|
+
.ago-dev-card .dev-runner-schema {
|
|
324
|
+
margin: 0; padding: 6px 8px; background: #060a0e;
|
|
325
|
+
border-radius: 6px; overflow: auto; max-height: 16vh;
|
|
326
|
+
white-space: pre; color: #7c8a99; font-size: 11px;
|
|
327
|
+
}
|
|
328
|
+
.ago-dev-card .dev-runner-args {
|
|
329
|
+
width: 100%; box-sizing: border-box; min-height: 48px; max-height: 20vh;
|
|
330
|
+
resize: vertical; background: #060a0e; color: #d7e0e8;
|
|
331
|
+
border: 1px solid #2a3441; border-radius: 6px; padding: 6px 8px;
|
|
332
|
+
font: inherit; font-size: 11px;
|
|
333
|
+
}
|
|
334
|
+
.ago-dev-card .dev-runner-status { font-size: 11px; margin-top: 4px; }
|
|
335
|
+
.ago-dev-card .dev-runner-ok { color: #86efac; }
|
|
336
|
+
.ago-dev-card .dev-runner-error { color: #fca5a5; }
|
|
337
|
+
.ago-dev-card .dev-runner-result {
|
|
338
|
+
margin: 0; padding: 6px 8px; background: #060a0e;
|
|
339
|
+
border-radius: 6px; overflow: auto; max-height: 24vh;
|
|
340
|
+
white-space: pre-wrap; word-break: break-word;
|
|
341
|
+
color: #c8e6c9; font-size: 11px;
|
|
342
|
+
}
|
|
343
|
+
.ago-dev-card .dev-runner-result:empty { display: none; }
|
|
344
|
+
.ago-dev-card .dev-runner-bytes { color: #7c8a99; font-size: 10px; margin-top: 2px; }
|
|
345
|
+
.ago-dev-card .dev-runner-bytes:empty { display: none; }
|
|
194
346
|
`;
|
|
195
347
|
export {
|
|
196
|
-
|
|
348
|
+
ce as initDevPanel
|
|
197
349
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var t = class extends Error {
|
|
2
|
+
constructor(s, r, e) {
|
|
3
|
+
super(s), this.code = r, this.statusCode = e, this.name = "AgoError";
|
|
4
|
+
}
|
|
5
|
+
}, u = class a extends t {
|
|
6
|
+
constructor(r, e, o, n, c, i) {
|
|
7
|
+
super(r, e, o), this.type = n, this.param = c, this.docUrl = i, this.name = "AgoApiError";
|
|
8
|
+
}
|
|
9
|
+
static fromResponse(r, e) {
|
|
10
|
+
const o = r.error;
|
|
11
|
+
return new a(o.doc_url ? `${o.message} See ${o.doc_url}` : o.message, o.code, e, o.type, o.param, o.doc_url);
|
|
12
|
+
}
|
|
13
|
+
}, g = class extends t {
|
|
14
|
+
constructor(s, r) {
|
|
15
|
+
super(s, "network_error"), this.originalError = r, this.name = "AgoNetworkError";
|
|
16
|
+
}
|
|
17
|
+
}, m = class extends t {
|
|
18
|
+
constructor(s, r = "stream_error") {
|
|
19
|
+
super(s, r), this.name = "AgoStreamError";
|
|
20
|
+
}
|
|
21
|
+
}, p = class extends t {
|
|
22
|
+
constructor(s, r, e) {
|
|
23
|
+
super(s, "function_error"), this.functionName = r, this.originalError = e, this.name = "AgoFunctionError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
m as a,
|
|
28
|
+
g as i,
|
|
29
|
+
t as n,
|
|
30
|
+
p as r,
|
|
31
|
+
u as t
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=class extends Error{constructor(o,r,t){super(o),this.code=r,this.statusCode=t,this.name="AgoError"}},a=class s extends n{constructor(r,t,e,u,c,i){super(r,t,e),this.type=u,this.param=c,this.docUrl=i,this.name="AgoApiError"}static fromResponse(r,t){const e=r.error;return new s(e.doc_url?`${e.message} See ${e.doc_url}`:e.message,e.code,t,e.type,e.param,e.doc_url)}},g=class extends n{constructor(o,r){super(o,"network_error"),this.originalError=r,this.name="AgoNetworkError"}},m=class extends n{constructor(o,r="stream_error"){super(o,r),this.name="AgoStreamError"}},A=class extends n{constructor(o,r,t){super(o,"function_error"),this.functionName=r,this.originalError=t,this.name="AgoFunctionError"}};Object.defineProperty(exports,"AgoApiError",{enumerable:!0,get:function(){return a}});Object.defineProperty(exports,"AgoError",{enumerable:!0,get:function(){return n}});Object.defineProperty(exports,"AgoFunctionError",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"AgoNetworkError",{enumerable:!0,get:function(){return g}});Object.defineProperty(exports,"AgoStreamError",{enumerable:!0,get:function(){return m}});
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./types-mcW8vB1U.cjs"),f=require("./errors-o1IB5fEu.cjs"),S=require("./autoContinue-CP9pJR-V.cjs"),p=require("./createConversationSession-B3v_xOU7.cjs"),A=require("./createFormCollector-FvwDOqnV.cjs"),w=require("./createMockClient-BEOXI8yW.cjs");require("./testing.cjs");const g=require("./functions-CPs7omgM.cjs");function F(e){return e}function _(e,t){return e.on("message:complete",t),()=>e.off("message:complete",t)}function y(e,t){return e.on("message:chunk",t),()=>e.off("message:chunk",t)}function M(e,t){return e.on("message:start",t),()=>e.off("message:start",t)}function v(e,t){return e.on("message:error",t),()=>e.off("message:error",t)}function T(e,t){return e.on("toolCall:received",t),()=>e.off("toolCall:received",t)}function R(e,t){return e.on("form:submitted",t),()=>e.off("form:submitted",t)}function b(e,t){return e.on("form:error",t),()=>e.off("form:error",t)}function q(e,t){return e.on("function:invoke",t),()=>e.off("function:invoke",t)}async function*I(e,t,c){const i=[];let n=null,a=!1;const l=s=>{i.push(s),n?.()},m=s=>l({type:"start",data:s}),d=s=>l({type:"chunk",data:s}),r=s=>{l({type:"complete",data:s}),a=!0,n?.()},u=s=>{l({type:"error",data:s}),a=!0,n?.()},E=s=>l({type:"toolCall",data:s}),h=()=>{a=!0,n?.()};e.on("message:start",m),e.on("message:chunk",d),e.on("message:complete",r),e.on("message:error",u),e.on("message:stopped",h),e.on("toolCall:received",E),e.sendMessage(t,c).catch(()=>{a=!0,n?.()});try{for(;!a||i.length>0;)i.length>0?yield i.shift():(await new Promise(s=>{n=s}),n=null)}finally{e.off("message:start",m),e.off("message:chunk",d),e.off("message:complete",r),e.off("message:error",u),e.off("message:stopped",h),e.off("toolCall:received",E)}}function C(e){let t,c,i,n,a,l,m;if(typeof window<"u"&&window.AGO){const r=window.AGO;t=r.basepath,c=r.widgetId,i=r.agent||r.defaultAgent,n=r.permission,a=r.email,l=r.jwt,m=r.metadata}if(typeof document<"u"){const r=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;t=t||r("ago-base-url"),c=c||r("ago-widget-id"),i=i||r("ago-agent")||r("ago-agent-id"),n=n||r("ago-permission"),a=a||r("ago-user-email")}if(typeof document<"u"){const r=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of r)u&&(t=t||u.getAttribute("data-ago-base-url")||void 0,c=c||u.getAttribute("data-ago-widget-id")||void 0,i=i||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,n=n||u.getAttribute("data-ago-permission")||void 0,a=a||u.getAttribute("data-ago-user-email")||void 0)}t=e?.baseUrl||t,c=e?.widgetId||c,i=e?.agent||e?.defaultAgentId||i,n=e?.permission||n,a=e?.userEmail||a,l=e?.userJwt||l,e?.metadata!==void 0&&(m=e.metadata);const d=e?.debug;return t?{baseUrl:t,widgetId:c,agent:i,permission:n,userEmail:a,userJwt:l,metadata:m,debug:d}:null}function U(e){const t=C(e);if(!t)throw new f.AgoError('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.',"config_missing_base_url");return new o.AgoClient(t)}function D(e,t){return{...e,handler:t}}exports.ActivityLedger=o.ActivityLedger;exports.AgoApiError=f.AgoApiError;exports.AgoClient=o.AgoClient;exports.AgoError=f.AgoError;exports.AgoFunctionError=f.AgoFunctionError;exports.AgoNetworkError=f.AgoNetworkError;exports.AgoStreamError=f.AgoStreamError;exports.ClientContextRegistry=o.ClientContextRegistry;exports.DEFAULT_MAX_ACTIVITY_ENTRIES=o.DEFAULT_MAX_ACTIVITY_ENTRIES;exports.DEFAULT_MAX_ERRORS=o.DEFAULT_MAX_ERRORS;exports.DEFAULT_MAX_ERROR_AGE_MS=o.DEFAULT_MAX_ERROR_AGE_MS;exports.ErrorWatcher=o.ErrorWatcher;exports.EventEmitter=o.EventEmitter;exports.FEEDBACK_REASONS=o.FEEDBACK_REASONS;exports.FunctionRegistry=o.FunctionRegistry;exports.SSEHandler=o.SSEHandler;exports.SignalCollector=o.SignalCollector;exports.attachAutoContinueAfterNavigation=S.attachAutoContinueAfterNavigation;exports.autoDetectConfig=C;exports.canInlineImage=o.canInlineImage;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=U;exports.createAgoProactive=o.createAgoProactive;exports.createConversationSession=p.createConversationSession;exports.createFormCollector=A.createFormCollector;exports.createMessageStream=I;exports.createMockClient=w.createMockClient;exports.createStore=o.createStore;exports.defineFunction=F;exports.deriveFormStatus=A.deriveFormStatus;exports.formatFileSize=o.formatFileSize;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=o.isStreamNetworkError;exports.loadFormCollector=A.loadFormCollector;exports.logger=o.logger;exports.matchesRoutePattern=o.matchesRoutePattern;exports.matchesWhen=o.matchesWhen;exports.onFormError=b;exports.onFormSubmitted=R;exports.onFunctionInvoke=q;exports.onMessage=_;exports.onMessageChunk=y;exports.onMessageError=v;exports.onMessageStart=M;exports.onToolCall=T;exports.openUrl=g.openUrl;exports.partialDeepMatch=o.partialDeepMatch;exports.safeAttachmentUrl=o.safeAttachmentUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.validateConfig=o.validateConfig;exports.withHandler=D;
|