@scalar/agent-chat 0.4.3 → 0.4.5

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