@scalar/agent-chat 0.5.16 → 0.5.18

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.
@@ -1,44 +1,47 @@
1
- import { defineComponent as K, useTemplateRef as j, computed as p, watch as _, createElementBlock as u, openBlock as s, createBlock as r, createCommentVNode as i, createElementVNode as l, withDirectives as w, unref as e, withModifiers as J, vModelText as O, withCtx as S, createVNode as g, Fragment as C, renderList as P, createTextVNode as T, toDisplayString as X, vShow as Z } from "vue";
2
- import { ScalarIconButton as I, ScalarLoading as G } from "@scalar/components";
3
- import { ScalarIconPlus as x, ScalarIconX as Q, ScalarIconLockSimple as W, ScalarIconCheck as Y, ScalarIconArrowUp as ee } from "@scalar/icons";
4
- import te from "../components/ActionsDropdown.vue.js";
5
- import oe from "../components/ApprovalSection.vue.js";
6
- import se from "../components/ErrorMessage.vue.js";
7
- import ne from "../components/FreeMessagesInfoSection.vue.js";
8
- import le from "../components/PaymentSection.vue.js";
9
- import ae from "../components/SearchPopover.vue.js";
10
- import re from "../components/UploadSection.vue.js";
11
- import { AgentErrorCodes as D } from "../entities/error/constants.js";
12
- import { MAX_PROMPT_SIZE as ie } from "../entities/prompt/constants.js";
13
- import { useRequestApprovals as ue } from "../hooks/use-chat-approvals.js";
14
- import { useChatError as ce } from "../hooks/use-chat-error.js";
15
- import { useChatPendingClientToolParts as pe } from "../hooks/use-chat-pending-client-tool-parts.js";
1
+ import { defineComponent as q, useTemplateRef as K, computed as d, watch as w, createElementBlock as r, openBlock as o, createBlock as u, createCommentVNode as a, createElementVNode as l, unref as e, withModifiers as j, withDirectives as J, vModelText as O, Fragment as f, withCtx as S, createVNode as g, renderList as C, createTextVNode as P, toDisplayString as X } from "vue";
2
+ import { ScalarIconButton as T, ScalarLoading as Z } from "@scalar/components";
3
+ import { ScalarIconPlus as I, ScalarIconX as G, ScalarIconLockSimple as Q, ScalarIconCheck as W, ScalarIconArrowUp as Y } from "@scalar/icons";
4
+ import ee from "../components/ActionsDropdown.vue.js";
5
+ import te from "../components/ApprovalSection.vue.js";
6
+ import oe from "../components/ErrorMessage.vue.js";
7
+ import se from "../components/FreeMessagesInfoSection.vue.js";
8
+ import ne from "../components/PaymentSection.vue.js";
9
+ import le from "../components/SearchPopover.vue.js";
10
+ import ae from "../components/UploadSection.vue.js";
11
+ import { AgentErrorCodes as x } from "../entities/error/constants.js";
12
+ import { MAX_PROMPT_SIZE as re } from "../entities/prompt/constants.js";
13
+ import { useRequestApprovals as ie } from "../hooks/use-chat-approvals.js";
14
+ import { useChatError as ue } from "../hooks/use-chat-error.js";
15
+ import { useChatPendingClientToolParts as ce } from "../hooks/use-chat-pending-client-tool-parts.js";
16
16
  import { useUploadTmpDocument as de } from "../hooks/use-upload-tmp-document.js";
17
- import { useState as me } from "../state/state.js";
18
- const ge = { class: "actionContainer" }, ve = ["disabled"], fe = { class: "inputActionsContainer" }, he = { class: "inputActionsLeft" }, ye = {
17
+ import { useState as pe } from "../state/state.js";
18
+ const me = { class: "actionContainer" }, ge = ["disabled"], ve = { class: "inputActionsContainer" }, fe = { class: "inputActionsLeft" }, he = {
19
19
  class: "addAPIButton",
20
20
  type: "button"
21
- }, be = {
21
+ }, ye = {
22
22
  class: "addAPIButton",
23
23
  type: "button"
24
- }, Ae = ["src"], ke = ["onClick"], _e = { class: "inputActionsRight" }, we = { class: "sendCheckboxContinue" }, Se = {
24
+ }, Ae = ["src"], be = ["onClick"], ke = { class: "inputActionsRight" }, _e = { class: "sendCheckboxContinue" }, we = {
25
25
  key: 0,
26
26
  class: "relative flex items-center gap-1.5"
27
- }, Ce = {
27
+ }, Se = {
28
28
  class: "termsAgree",
29
29
  for: "agentTermsAgree"
30
- }, Pe = { class: "addMoreContext" }, Te = { class: "ml-auto flex items-center gap-1" }, Ie = ["onClick"], xe = ["alt", "src"], Xe = /* @__PURE__ */ K({
30
+ }, Ce = {
31
+ key: 5,
32
+ class: "addMoreContext"
33
+ }, Pe = { class: "ml-auto flex items-center gap-1" }, Te = ["onClick"], Ie = ["alt", "src"], Oe = /* @__PURE__ */ q({
31
34
  __name: "PromptForm",
32
35
  emits: ["submit", "uploadApi"],
33
- setup(De, { expose: L, emit: E }) {
34
- const M = E;
35
- L({ focusPrompt: $ });
36
- const c = j("agentPrompt"), t = me(), R = p(() => t.prompt.value.trim().length > 0), B = p(
37
- () => t.prompt.value.trim().length > ie
38
- ), U = p(
39
- () => t.chat.messages.length > 1 && !t.getAgentKey?.() && m?.value?.code !== D.LIMIT_REACHED
36
+ setup(xe, { expose: D, emit: L }) {
37
+ const E = L;
38
+ D({ focusPrompt: z });
39
+ const c = K("agentPrompt"), t = pe(), M = d(() => t.prompt.value.trim().length > 0), R = d(
40
+ () => t.prompt.value.trim().length > re
41
+ ), B = d(
42
+ () => t.chat.messages.length > 1 && !t.getAgentKey?.() && m?.value?.code !== x.LIMIT_REACHED
40
43
  );
41
- _(t.prompt, () => {
44
+ w(t.prompt, () => {
42
45
  if (c?.value) {
43
46
  if (!t.prompt.value.length) {
44
47
  c.value.style.height = "0px";
@@ -47,144 +50,146 @@ const ge = { class: "actionContainer" }, ve = ["disabled"], fe = { class: "input
47
50
  c.value.style.height = "auto", c.value.style.height = c.value.scrollHeight + "px";
48
51
  }
49
52
  });
50
- function z(a) {
51
- t.loading.value || a.key === "Enter" && !a.shiftKey && (a.preventDefault(), A(), window.scrollTo(0, document.body.scrollHeight));
53
+ function U(i) {
54
+ t.loading.value || i.key === "Enter" && !i.shiftKey && (i.preventDefault(), k(), window.scrollTo(0, document.body.scrollHeight));
52
55
  }
53
- function $() {
56
+ function z() {
54
57
  c.value?.focus();
55
58
  }
56
- _(
59
+ w(
57
60
  () => t.chat.status,
58
- (a) => {
59
- (a === "ready" || a === "error") && c.value?.focus();
61
+ (i) => {
62
+ (i === "ready" || i === "error") && c.value?.focus();
60
63
  }
61
64
  );
62
- const { approvalRequiredParts: f, respondToRequestApprovals: h } = ue(), { pendingClientToolParts: V } = pe(), d = de();
63
- function F() {
64
- t.terms.accept(), t.mode === "preview" && t.getActiveDocumentJson && d.uploadTempDocument(t.getActiveDocumentJson(), !0);
65
+ const { approvalRequiredParts: h, respondToRequestApprovals: y } = ie(), { pendingClientToolParts: $ } = ce(), p = de();
66
+ function V() {
67
+ t.terms.accept(), t.mode === "preview" && t.getActiveDocumentJson && p.uploadTempDocument(t.getActiveDocumentJson(), !0);
65
68
  }
66
- const y = p(
69
+ const A = d(
67
70
  () => Object.values(t.pendingDocuments).some(Boolean)
68
- ), b = p(() => {
69
- const a = B.value, n = !R.value, o = f.value.length > 0, v = V.value.length > 0, k = t.mode === "preview", H = k && !t.terms.accepted.value, N = k && !!d.uploadState.value, q = y.value;
70
- return a || n || o || v || H || N || q;
71
+ ), b = d(() => {
72
+ const i = R.value, n = !M.value, s = h.value.length > 0, v = $.value.length > 0, _ = t.mode === "preview", F = _ && !t.terms.accepted.value, H = _ && !!p.uploadState.value, N = A.value;
73
+ return i || n || s || v || F || H || N;
71
74
  });
72
- function A() {
73
- b.value || M("submit");
75
+ function k() {
76
+ b.value || E("submit");
74
77
  }
75
- const m = ce();
76
- return (a, n) => (s(), u("div", ge, [
77
- e(d).uploadState.value || y.value ? (s(), r(re, {
78
+ const m = ue();
79
+ return (i, n) => (o(), r("div", me, [
80
+ e(p).uploadState.value || A.value ? (o(), u(ae, {
78
81
  key: 0,
79
- uploadState: e(d).uploadState.value ?? { type: "loading" }
80
- }, null, 8, ["uploadState"])) : i("", !0),
81
- e(m) ? (s(), r(se, {
82
+ uploadState: e(p).uploadState.value ?? { type: "loading" }
83
+ }, null, 8, ["uploadState"])) : a("", !0),
84
+ e(m) ? (o(), u(oe, {
82
85
  key: 1,
83
86
  error: e(m)
84
- }, null, 8, ["error"])) : i("", !0),
85
- e(f).length ? (s(), r(oe, {
87
+ }, null, 8, ["error"])) : a("", !0),
88
+ e(h).length ? (o(), u(te, {
86
89
  key: 2,
87
- onApprove: n[0] || (n[0] = (o) => e(h)(!0)),
88
- onReject: n[1] || (n[1] = (o) => e(h)(!1))
89
- })) : i("", !0),
90
- e(m)?.code === e(D).LIMIT_REACHED ? (s(), r(le, { key: 3 })) : i("", !0),
91
- U.value ? (s(), r(ne, { key: 4 })) : i("", !0),
90
+ onApprove: n[0] || (n[0] = (s) => e(y)(!0)),
91
+ onReject: n[1] || (n[1] = (s) => e(y)(!1))
92
+ })) : a("", !0),
93
+ e(m)?.code === e(x).LIMIT_REACHED ? (o(), u(ne, { key: 3 })) : a("", !0),
94
+ B.value ? (o(), u(se, { key: 4 })) : a("", !0),
92
95
  l("form", {
93
96
  class: "promptForm",
94
- onSubmit: J(A, ["prevent"])
97
+ onSubmit: j(k, ["prevent"])
95
98
  }, [
96
99
  n[6] || (n[6] = l("label", {
97
100
  class: "agentLabel",
98
101
  for: "agentTextarea"
99
102
  }, " Type a Request To get Started ", -1)),
100
- w(l("textarea", {
103
+ J(l("textarea", {
101
104
  id: "agentTextarea",
102
105
  ref: "agentPrompt",
103
- "onUpdate:modelValue": n[2] || (n[2] = (o) => e(t).prompt.value = o),
106
+ "onUpdate:modelValue": n[2] || (n[2] = (s) => e(t).prompt.value = s),
104
107
  class: "prompt custom-scroll",
105
108
  disabled: e(t).loading.value,
106
109
  name: "prompt",
107
110
  placeholder: "Ask me anything...",
108
- onKeydown: z
109
- }, null, 40, ve), [
111
+ onKeydown: U
112
+ }, null, 40, ge), [
110
113
  [O, e(t).prompt.value]
111
114
  ]),
112
- l("div", fe, [
113
- l("div", he, [
114
- e(t).isLoggedIn?.value ? (s(), r(te, {
115
- key: 1,
116
- onUploadApi: n[3] || (n[3] = (o) => a.$emit("uploadApi"))
117
- }, {
118
- default: S(() => [
119
- l("button", be, [
120
- g(e(x), {
121
- class: "size-4",
122
- weight: "bold"
123
- })
124
- ])
125
- ]),
126
- _: 1
127
- })) : (s(), r(ae, { key: 0 }, {
128
- default: S(() => [
129
- l("button", ye, [
130
- g(e(x), {
131
- class: "size-4",
132
- weight: "bold"
133
- })
134
- ])
135
- ]),
136
- _: 1
137
- })),
138
- (s(!0), u(C, null, P(e(t).registryDocuments.value, (o) => (s(), u("div", {
139
- key: o.id,
115
+ l("div", ve, [
116
+ l("div", fe, [
117
+ e(t).hideAddApi ? a("", !0) : (o(), r(f, { key: 0 }, [
118
+ e(t).isLoggedIn?.value ? (o(), u(ee, {
119
+ key: 1,
120
+ onUploadApi: n[3] || (n[3] = (s) => i.$emit("uploadApi"))
121
+ }, {
122
+ default: S(() => [
123
+ l("button", ye, [
124
+ g(e(I), {
125
+ class: "size-4",
126
+ weight: "bold"
127
+ })
128
+ ])
129
+ ]),
130
+ _: 1
131
+ })) : (o(), u(le, { key: 0 }, {
132
+ default: S(() => [
133
+ l("button", he, [
134
+ g(e(I), {
135
+ class: "size-4",
136
+ weight: "bold"
137
+ })
138
+ ])
139
+ ]),
140
+ _: 1
141
+ }))
142
+ ], 64)),
143
+ (o(!0), r(f, null, C(e(t).registryDocuments.value, (s) => (o(), r("div", {
144
+ key: s.id,
140
145
  class: "apiPill"
141
146
  }, [
142
- o.logoUrl ? (s(), u("img", {
147
+ s.logoUrl ? (o(), r("img", {
143
148
  key: 0,
144
149
  class: "apiPillLogo",
145
- src: o.logoUrl
146
- }, null, 8, Ae)) : i("", !0),
147
- T(" " + X(o.title) + " ", 1),
148
- o.removable ? (s(), u("button", {
150
+ src: s.logoUrl
151
+ }, null, 8, Ae)) : a("", !0),
152
+ P(" " + X(s.title) + " ", 1),
153
+ s.removable ? (o(), r("button", {
149
154
  key: 1,
150
155
  class: "apiPillRemove",
151
156
  type: "button",
152
- onClick: (v) => e(t).removeDocument(o)
157
+ onClick: (v) => e(t).removeDocument(s)
153
158
  }, [
154
- g(e(Q), {
159
+ g(e(G), {
155
160
  class: "size-4",
156
161
  weight: "bold"
157
162
  })
158
- ], 8, ke)) : i("", !0)
163
+ ], 8, be)) : a("", !0)
159
164
  ]))), 128))
160
165
  ]),
161
- l("div", _e, [
162
- e(t).loading.value ? i("", !0) : (s(), r(e(I), {
166
+ l("div", ke, [
167
+ e(t).loading.value ? a("", !0) : (o(), u(e(T), {
163
168
  key: 0,
164
169
  class: "settingsButton h-7 w-7 p-1.5",
165
- icon: e(W),
170
+ icon: e(Q),
166
171
  label: "Scalar",
167
172
  size: "md",
168
173
  weight: "bold",
169
- onClick: n[4] || (n[4] = (o) => e(t).settingsModal.show())
174
+ onClick: n[4] || (n[4] = (s) => e(t).settingsModal.show())
170
175
  }, null, 8, ["icon"])),
171
- l("div", we, [
172
- !e(t).terms.accepted.value && e(t).mode === "preview" ? (s(), u("div", Se, [
176
+ l("div", _e, [
177
+ !e(t).terms.accepted.value && e(t).mode === "preview" ? (o(), r("div", we, [
173
178
  l("input", {
174
179
  id: "agentTermsAgree",
175
180
  class: "sr-only",
176
181
  type: "checkbox",
177
- onChange: F
182
+ onChange: V
178
183
  }, null, 32),
179
- l("label", Ce, [
180
- g(e(Y), {
184
+ l("label", Se, [
185
+ g(e(W), {
181
186
  class: "termsAgreeIcon",
182
187
  weight: "bold"
183
188
  }),
184
- n[5] || (n[5] = T(" Agree to Terms & Conditions ", -1))
189
+ n[5] || (n[5] = P(" Agree to Terms & Conditions ", -1))
185
190
  ])
186
- ])) : i("", !0),
187
- e(t).loading.value ? (s(), r(e(G), {
191
+ ])) : a("", !0),
192
+ e(t).loading.value ? (o(), u(e(Z), {
188
193
  key: 2,
189
194
  class: "loader h-7 w-7",
190
195
  loader: {
@@ -202,11 +207,11 @@ const ge = { class: "actionContainer" }, ve = ["disabled"], fe = { class: "input
202
207
  }
203
208
  },
204
209
  size: "2xl"
205
- }, null, 8, ["loader"])) : (s(), r(e(I), {
210
+ }, null, 8, ["loader"])) : (o(), u(e(T), {
206
211
  key: 1,
207
212
  class: "sendButton h-7 w-7 p-1.5",
208
213
  disabled: b.value,
209
- icon: e(ee),
214
+ icon: e(Y),
210
215
  label: "Scalar",
211
216
  size: "md",
212
217
  type: "submit",
@@ -216,29 +221,27 @@ const ge = { class: "actionContainer" }, ve = ["disabled"], fe = { class: "input
216
221
  ])
217
222
  ])
218
223
  ], 32),
219
- w(l("div", Pe, [
224
+ e(t).chat.messages.length <= 1 && !e(t).hideAddApi ? (o(), r("div", Ce, [
220
225
  n[7] || (n[7] = l("span", null, "Add context from dozens of API's", -1)),
221
- l("div", Te, [
222
- (s(!0), u(C, null, P(e(t).curatedDocuments.value, (o) => (s(), u("button", {
223
- key: o.id,
226
+ l("div", Pe, [
227
+ (o(!0), r(f, null, C(e(t).curatedDocuments.value, (s) => (o(), r("button", {
228
+ key: s.id,
224
229
  class: "addAPIContext",
225
230
  type: "button",
226
- onClick: (v) => e(t).addDocument(o)
231
+ onClick: (v) => e(t).addDocument(s)
227
232
  }, [
228
- o.logoUrl ? (s(), u("img", {
233
+ s.logoUrl ? (o(), r("img", {
229
234
  key: 0,
230
- alt: o.title,
235
+ alt: s.title,
231
236
  class: "size-4",
232
- src: o.logoUrl
233
- }, null, 8, xe)) : i("", !0)
234
- ], 8, Ie))), 128))
237
+ src: s.logoUrl
238
+ }, null, 8, Ie)) : a("", !0)
239
+ ], 8, Te))), 128))
235
240
  ])
236
- ], 512), [
237
- [Z, e(t).chat.messages.length <= 1]
238
- ])
241
+ ])) : a("", !0)
239
242
  ]));
240
243
  }
241
244
  });
242
245
  export {
243
- Xe as default
246
+ Oe as default
244
247
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/agent-chat"
12
12
  },
13
- "version": "0.5.16",
13
+ "version": "0.5.18",
14
14
  "engines": {
15
15
  "node": ">=20"
16
16
  },
@@ -50,23 +50,23 @@
50
50
  "vue": "^3.5.26",
51
51
  "whatwg-mimetype": "4.0.0",
52
52
  "zod": "^4.3.5",
53
- "@scalar/api-client": "2.29.2",
54
- "@scalar/components": "0.19.8",
55
- "@scalar/helpers": "0.2.15",
53
+ "@scalar/api-client": "2.29.4",
54
+ "@scalar/components": "0.19.10",
56
55
  "@scalar/icons": "0.5.3",
56
+ "@scalar/helpers": "0.2.16",
57
57
  "@scalar/openapi-types": "0.5.3",
58
58
  "@scalar/themes": "0.14.0",
59
- "@scalar/types": "0.6.6",
59
+ "@scalar/types": "0.6.8",
60
60
  "@scalar/use-toasts": "0.9.1",
61
- "@scalar/json-magic": "0.11.4",
62
- "@scalar/workspace-store": "0.34.2"
61
+ "@scalar/json-magic": "0.11.5",
62
+ "@scalar/workspace-store": "0.34.4"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@modelcontextprotocol/sdk": "1.26.0",
66
66
  "@tailwindcss/vite": "^4.1.18",
67
67
  "@types/whatwg-mimetype": "3.0.2",
68
68
  "@vitejs/plugin-vue": "^6.0.3",
69
- "hono": "4.11.7",
69
+ "hono": "4.11.10",
70
70
  "tailwindcss": "^4.1.18",
71
71
  "vite": "^7.3.1",
72
72
  "@scalar/build-tooling": "0.4.1"