@sophonsai/agent-embed-vue 0.0.0-stage → 0.2.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 +329 -2
- package/dist/index.d.mts +230 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +77 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -3
package/README.md
CHANGED
|
@@ -1,3 +1,330 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sophonsai/agent-embed-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 应用接入
|
|
4
|
+
|
|
5
|
+
传入 SAAP 服务地址 `endpoint` 和智能体的应用接入凭证 `token`。
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<AgentEmbed endpoint="https://agent.example.com" token="应用接入Token" style="height:600px" />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# npm
|
|
15
|
+
npm install @sophonsai/agent-embed-vue vue@^3.3
|
|
16
|
+
|
|
17
|
+
# pnpm
|
|
18
|
+
pnpm add @sophonsai/agent-embed-vue vue@^3.3
|
|
19
|
+
|
|
20
|
+
# yarn
|
|
21
|
+
yarn add @sophonsai/agent-embed-vue vue@^3.3
|
|
22
|
+
|
|
23
|
+
# bun
|
|
24
|
+
bun add @sophonsai/agent-embed-vue vue@^3.3
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 快速开始
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { reactive, shallowRef } from 'vue'
|
|
32
|
+
import {
|
|
33
|
+
AgentEmbed,
|
|
34
|
+
type AgentAppearance,
|
|
35
|
+
type AgentEmbedInstance,
|
|
36
|
+
type AgentEmbedTheme,
|
|
37
|
+
} from '@sophonsai/agent-embed-vue'
|
|
38
|
+
|
|
39
|
+
const endpoint = 'https://agent.example.com'
|
|
40
|
+
const token = '应用接入Token'
|
|
41
|
+
|
|
42
|
+
const appearance = reactive<AgentAppearance>({
|
|
43
|
+
theme: { preset: 'glacier-blue' },
|
|
44
|
+
fontSize: 16,
|
|
45
|
+
header: {
|
|
46
|
+
historyButton: true,
|
|
47
|
+
newConversationButton: true,
|
|
48
|
+
themeSettingButton: false,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const agent = shallowRef<AgentEmbedInstance | null>(null)
|
|
53
|
+
|
|
54
|
+
const handleThemeChange = (theme: AgentEmbedTheme) => {
|
|
55
|
+
appearance.theme = theme
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleFontSizeChange = (fontSize: number) => {
|
|
59
|
+
appearance.fontSize = fontSize
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<div class="page">
|
|
65
|
+
<AgentEmbed
|
|
66
|
+
class="agent-embed"
|
|
67
|
+
:endpoint="endpoint"
|
|
68
|
+
:token="token"
|
|
69
|
+
:appearance="appearance"
|
|
70
|
+
@theme-change="handleThemeChange"
|
|
71
|
+
@font-size-change="handleFontSizeChange"
|
|
72
|
+
@init-error="({ code, message }) => console.error('初始化失败', code, message)"
|
|
73
|
+
@settled="(result) => console.log('会话结束', result)"
|
|
74
|
+
@ready="(instance) => (agent = instance)"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<button :disabled="!agent" @click="agent?.sendMessage({ text: '你好' })">发送消息</button>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.page {
|
|
83
|
+
height: 640px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.agent-embed {
|
|
87
|
+
min-height: 480px;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 组件 Props
|
|
93
|
+
|
|
94
|
+
| Prop | 类型 | 必填 | 说明 |
|
|
95
|
+
| ------------------- | ----------------------- | ---- | ------------------------------------- |
|
|
96
|
+
| `endpoint` | `string` | 是 | 服务地址 |
|
|
97
|
+
| `token` | `string` | 是 | Agent 应用接入凭证 |
|
|
98
|
+
| `threadId` | `string` | 否 | 初始会话 ID |
|
|
99
|
+
| `runtime_variables` | `AgentRuntimeVariables` | 否 | 新会话绑定的运行时变量,值必须为 JSON |
|
|
100
|
+
| `appearance` | `AgentAppearance` | 否 | 主题、字号和头部按钮配置 |
|
|
101
|
+
|
|
102
|
+
## 组件事件
|
|
103
|
+
|
|
104
|
+
组件使用标准 Vue 事件,不接受 `onXxx` 回调 Props。
|
|
105
|
+
|
|
106
|
+
| 事件 | 参数 | 说明 |
|
|
107
|
+
| ------------------- | ---------- | ---------------- |
|
|
108
|
+
| `@ready` | `instance` | 面板初始化完成 |
|
|
109
|
+
| `@theme-change` | `theme` | 面板内部主题变化 |
|
|
110
|
+
| `@font-size-change` | `fontSize` | 面板内部字号变化 |
|
|
111
|
+
| `@init-error` | `failure` | 初始化失败 |
|
|
112
|
+
|
|
113
|
+
全部运行事件见“会话事件”章节。
|
|
114
|
+
|
|
115
|
+
## 初始化配置
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<AgentEmbed
|
|
119
|
+
endpoint="https://agent.example.com"
|
|
120
|
+
token="应用接入Token"
|
|
121
|
+
thread-id="可选初始会话ID"
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
接入配置只在挂载时读取;需要切换服务、token 或会话时,修改组件 `key` 重新挂载。
|
|
126
|
+
`appearance` 会随外观配置更新。
|
|
127
|
+
|
|
128
|
+
## 外观与受控状态
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const appearance = reactive<AgentAppearance>({
|
|
132
|
+
theme: { preset: 'studio-white' },
|
|
133
|
+
fontSize: 16,
|
|
134
|
+
header: {
|
|
135
|
+
historyButton: true,
|
|
136
|
+
newConversationButton: true,
|
|
137
|
+
themeSettingButton: true,
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`header.themeSettingButton` 默认值为 `true`,显式设置为 `false` 时隐藏主题设置按钮。
|
|
143
|
+
|
|
144
|
+
可用主题:
|
|
145
|
+
|
|
146
|
+
可以使用 `AgentEmbedThemePreset` 枚举式常量设置主题:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { AgentEmbedThemePreset } from '@sophonsai/agent-embed-vue'
|
|
150
|
+
|
|
151
|
+
const appearance = {
|
|
152
|
+
theme: { preset: AgentEmbedThemePreset.GlacierBlue },
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| 主题名 | preset | 类型 |
|
|
157
|
+
| ------ | ----------------- | -------- |
|
|
158
|
+
| 曜石紫 | `obsidian-violet` | 深色主题 |
|
|
159
|
+
| 石墨青 | `graphite-cyan` | 深色主题 |
|
|
160
|
+
| 午夜靛 | `midnight-indigo` | 深色主题 |
|
|
161
|
+
| 深海蓝 | `deep-ocean` | 深色主题 |
|
|
162
|
+
| 森野绿 | `forest-emerald` | 深色主题 |
|
|
163
|
+
| 影棚白 | `studio-white` | 浅色主题 |
|
|
164
|
+
| 珍珠紫 | `pearl-violet` | 浅色主题 |
|
|
165
|
+
| 冰川蓝 | `glacier-blue` | 浅色主题 |
|
|
166
|
+
| 暖杏色 | `warm-cream` | 浅色主题 |
|
|
167
|
+
| 薰衣草 | `lavender-mist` | 浅色主题 |
|
|
168
|
+
|
|
169
|
+
Vue 3 适配器会分别监听:
|
|
170
|
+
|
|
171
|
+
- `appearance.theme`,深度监听;
|
|
172
|
+
- `appearance.fontSize`;
|
|
173
|
+
- `appearance.header`,深度监听。
|
|
174
|
+
|
|
175
|
+
因此下面的修改会自动同步到面板:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
appearance.theme = { preset: 'warm-cream' }
|
|
179
|
+
appearance.fontSize = 18
|
|
180
|
+
appearance.header!.themeSettingButton = false
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
当主题或字号作为受控状态传入时,应在 `@theme-change` / `@font-size-change` 中更新响应式状态,否则外部状态仍会保留旧值。
|
|
184
|
+
|
|
185
|
+
将 `theme`、`fontSize` 或 `header` 改为 `undefined` 会撤销对应的宿主控制,让面板恢复内部默认值。
|
|
186
|
+
|
|
187
|
+
## 获取和使用实例
|
|
188
|
+
|
|
189
|
+
面板初始化完成后,`ready` 事件会返回 `AgentEmbedInstance`。在此之前,获取不到 `AgentEmbedInstance` 实例对象,无法操作面板执行行为。
|
|
190
|
+
|
|
191
|
+
推荐使用 `shallowRef` 保存实例:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
const agent = shallowRef<AgentEmbedInstance | null>(null)
|
|
195
|
+
|
|
196
|
+
const handleReady = (instance: AgentEmbedInstance) => {
|
|
197
|
+
agent.value = instance
|
|
198
|
+
instance.focusInput()
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`AgentEmbedInstance` 方法:
|
|
203
|
+
|
|
204
|
+
| 方法 | 说明 |
|
|
205
|
+
| ----------------------------------- | ------------------------------------------- |
|
|
206
|
+
| `sendMessage({ text })` | 立即提交消息;生成期间调用会使用 steer 行为 |
|
|
207
|
+
| `addInputQuery({ text, context? })` | 写入输入框和可选上下文,不立即提交 |
|
|
208
|
+
| `abortResponse()` | 终止当前回复 |
|
|
209
|
+
| `openHistoryPanel()` | 打开历史会话面板 |
|
|
210
|
+
| `openThemeSettingsPanel()` | 打开主题设置面板 |
|
|
211
|
+
| `newConversation()` | 新建会话 |
|
|
212
|
+
| `focusInput()` | 聚焦输入框 |
|
|
213
|
+
| `scrollToBottom()` | 滚动到底部 |
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
agent.value?.addInputQuery({
|
|
217
|
+
text: '请解释这段内容',
|
|
218
|
+
context: selectedText.value,
|
|
219
|
+
})
|
|
220
|
+
agent.value?.focusInput()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
组件卸载时会销毁 client,之前保存的 instance 随之失效。父组件应在切换实例时同步清理引用。
|
|
224
|
+
|
|
225
|
+
## 错误处理
|
|
226
|
+
|
|
227
|
+
```vue
|
|
228
|
+
<AgentEmbed :endpoint="endpoint" :token="token" @init-error="handleInitError" />
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
初始化失败码:
|
|
232
|
+
|
|
233
|
+
- `missing_token`:缺少 token;
|
|
234
|
+
- `invalid_token`:token 无效或过期;
|
|
235
|
+
- `forbidden`:无访问权限;
|
|
236
|
+
- `request_failed`:鉴权请求失败。
|
|
237
|
+
|
|
238
|
+
智能体加载失败码:
|
|
239
|
+
|
|
240
|
+
- `not_found`:未找到智能体;
|
|
241
|
+
- `forbidden`:无权访问智能体;
|
|
242
|
+
- `request_failed`:智能体请求失败。
|
|
243
|
+
|
|
244
|
+
失败对象还包含可读的 `message`。上述失败发生时不会触发 `ready`。
|
|
245
|
+
|
|
246
|
+
## 会话事件
|
|
247
|
+
|
|
248
|
+
```vue
|
|
249
|
+
<AgentEmbed
|
|
250
|
+
:endpoint="endpoint"
|
|
251
|
+
:token="token"
|
|
252
|
+
@session-context-ready="handleContextReady"
|
|
253
|
+
@tool-call-failed="handleToolFailed"
|
|
254
|
+
@settled="handleSettled"
|
|
255
|
+
/>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
全部运行事件如下:
|
|
259
|
+
|
|
260
|
+
| 事件 | 参数 | 说明 |
|
|
261
|
+
| ----------------------------- | --------------------------------------------------------------- | ------------------------------------------- |
|
|
262
|
+
| `@concurrent-send` | 无 | 回复生成期间再次发送消息 |
|
|
263
|
+
| `@event` | `AgentServerEvent` | 接收原始服务端事件 |
|
|
264
|
+
| `@session-context-ready` | `AgentSessionContext` | 会话上下文可用,包含 `threadId` 和 `turnId` |
|
|
265
|
+
| `@tool-call-created` | `AgentToolCallReadyEvent`, `AgentSessionEventContext` | 创建一个工具调用 |
|
|
266
|
+
| `@tool-approval-requested` | `AgentToolApprovalRequestedEvent`, `AgentSessionEventContext` | 一组工具调用需要确认 |
|
|
267
|
+
| `@tool-call-started` | `AgentToolCallStartedEvent`, `AgentSessionEventContext` | 工具调用开始 |
|
|
268
|
+
| `@tool-call-progress-updated` | `AgentToolCallProgressUpdatedEvent`, `AgentSessionEventContext` | 工具调用进度更新 |
|
|
269
|
+
| `@tool-call-backgrounded` | `AgentToolCallBackgroundedEvent`, `AgentSessionEventContext` | 工具调用转为后台执行 |
|
|
270
|
+
| `@tool-call-succeeded` | `AgentToolCallSucceededEvent`, `AgentSessionEventContext` | 工具调用成功 |
|
|
271
|
+
| `@tool-call-failed` | `AgentToolCallFailedEvent`, `AgentSessionEventContext` | 工具调用失败 |
|
|
272
|
+
| `@tool-call-cancelled` | `AgentToolCallCancelledEvent`, `AgentSessionEventContext` | 工具调用取消 |
|
|
273
|
+
| `@client-tool-request` | `AgentToolCallStartedEvent`, `AgentSessionEventContext` | 客户端工具执行请求;可通过 `clientTools` prop 注册自动执行函数 |
|
|
274
|
+
| `@client-action-request` | `AgentClientActionRequestEvent`, `AgentSessionEventContext` | 智能体请求宿主执行客户端动作 |
|
|
275
|
+
| `@user-feedback-consumed` | `AgentUserFeedbackConsumedEvent`, `AgentSessionEventContext` | 用户反馈已被处理 |
|
|
276
|
+
| `@user-steer-consumed` | `AgentUserSteerConsumedEvent`, `AgentSessionEventContext` | 用户 steer 指令已被处理 |
|
|
277
|
+
| `@user-steer-cancelled` | `AgentUserSteerCancelledEvent`, `AgentSessionRunEventContext` | 用户 steer 指令已取消 |
|
|
278
|
+
| `@user-input-submitted` | `AgentUserInputSubmittedEvent`, `AgentSessionEventContext` | 用户输入已提交 |
|
|
279
|
+
| `@session-turn-started` | `AgentSessionTurnStartedEvent`, `AgentSessionEventContext` | Turn 开始执行 |
|
|
280
|
+
| `@session-turn-succeeded` | `AgentSessionTurnSucceededEvent`, `AgentSessionEventContext` | Turn 执行成功 |
|
|
281
|
+
| `@session-turn-failed` | `AgentSessionTurnFailedEvent`, `AgentSessionEventContext` | Turn 执行失败 |
|
|
282
|
+
| `@session-turn-cancelled` | `AgentSessionTurnCancelledEvent`, `AgentSessionEventContext` | Turn 已取消 |
|
|
283
|
+
| `@session-run-started` | `AgentSessionRunStartedEvent`, `AgentSessionRunEventContext` | Run 已开始 |
|
|
284
|
+
| `@session-run-idled` | `AgentSessionRunIdledEvent`, `AgentSessionRunEventContext` | Run 已空闲 |
|
|
285
|
+
| `@session-run-ended` | `AgentSessionRunEndedEvent`, `AgentSessionRunEventContext` | Run 已结束 |
|
|
286
|
+
| `@system-message-consumed` | `AgentSystemMessageConsumedEvent`, `AgentSessionEventContext` | 系统消息已被处理 |
|
|
287
|
+
| `@success` | `AgentSessionSuccess` | 本轮会话成功结束 |
|
|
288
|
+
| `@error` | `AgentSessionFailure` | 本轮会话失败 |
|
|
289
|
+
| `@cancelled` | `AgentSessionCancelled` | 本轮会话取消 |
|
|
290
|
+
| `@settled` | `AgentSessionSettlement` | 本轮会话以任意状态结束 |
|
|
291
|
+
|
|
292
|
+
事件 payload、会话上下文和工具调用类型均由本包重导出。
|
|
293
|
+
|
|
294
|
+
## 布局说明
|
|
295
|
+
|
|
296
|
+
组件根节点默认样式为:
|
|
297
|
+
|
|
298
|
+
```css
|
|
299
|
+
width: 100%;
|
|
300
|
+
height: 100%;
|
|
301
|
+
min-height: 0;
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
父容器需要设置明确高度:
|
|
305
|
+
|
|
306
|
+
```vue
|
|
307
|
+
<template>
|
|
308
|
+
<main class="agent-page">
|
|
309
|
+
<AgentEmbed :endpoint="endpoint" :token="token" />
|
|
310
|
+
</main>
|
|
311
|
+
</template>
|
|
312
|
+
|
|
313
|
+
<style>
|
|
314
|
+
.agent-page {
|
|
315
|
+
height: calc(100vh - 64px);
|
|
316
|
+
}
|
|
317
|
+
</style>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
模板中传入的 `class` 和 `style` 会作用于根元素。
|
|
321
|
+
|
|
322
|
+
### 运行时变量
|
|
323
|
+
|
|
324
|
+
`runtime_variables` 是可选的 JSON 对象,名称须与智能体声明的运行时变量一致。仅创建新会话时发送,已有会话沿用已绑定的变量;同一面板新建会话时复用初始化值。参数在初始化时生成快照,改变值需要重建面板。数据通过 iframe 消息传递,不写入接入 URL。
|
|
325
|
+
|
|
326
|
+
```vue
|
|
327
|
+
<AgentEmbed :endpoint="endpoint" :token="token" :runtime_variables="{ customer_id: 'customer-1' }" />
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
初始化错误使用 `onInitError`(Vue: `@init-error`),包含 `code` 和 `message`,同次初始化只触发一次。失败时 `whenReady()` reject,聊天运行错误继续通过 `onError`(Vue: `@error`)报告。
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { AgentAppearance, AgentClientToolHandler, AgentEmbedInitError, AgentEmbedInstance, AgentEmbedTheme, AgentEvents, AgentRuntimeVariables } from "@sophonsai/agent-embed-sdk";
|
|
3
|
+
export * from "@sophonsai/agent-embed-sdk";
|
|
4
|
+
//#region ../core/dist/index.d.mts
|
|
5
|
+
interface AgentSessionContext {
|
|
6
|
+
threadId: string;
|
|
7
|
+
turnId: string;
|
|
8
|
+
}
|
|
9
|
+
interface AgentTextPayload {
|
|
10
|
+
version: 1;
|
|
11
|
+
range_unit: 'utf16';
|
|
12
|
+
references: Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
type: 'resource';
|
|
15
|
+
provider: string;
|
|
16
|
+
resource_id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
range: {
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
interface AgentSessionRunEventContext {
|
|
26
|
+
runId: string;
|
|
27
|
+
threadId: string | null;
|
|
28
|
+
step: number;
|
|
29
|
+
parentToolCallId: string | null;
|
|
30
|
+
}
|
|
31
|
+
type AgentSessionEventContext = AgentSessionRunEventContext & AgentSessionContext;
|
|
32
|
+
interface AgentToolCallStartedEvent {
|
|
33
|
+
toolCallId: string;
|
|
34
|
+
toolName: string;
|
|
35
|
+
toolNameEn?: string;
|
|
36
|
+
actionDescription?: string;
|
|
37
|
+
arguments: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
interface AgentToolCallSucceededEvent extends AgentToolCallStartedEvent {
|
|
40
|
+
result: string;
|
|
41
|
+
}
|
|
42
|
+
interface AgentToolCallProgressUpdatedEvent extends AgentToolCallStartedEvent {
|
|
43
|
+
sequence: number;
|
|
44
|
+
progress: {
|
|
45
|
+
type: string;
|
|
46
|
+
phase: string;
|
|
47
|
+
data: Record<string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
interface AgentToolCallFailedEvent extends AgentToolCallStartedEvent {
|
|
51
|
+
error: string;
|
|
52
|
+
}
|
|
53
|
+
interface AgentToolCallBackgroundedEvent {
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
toolName: string;
|
|
56
|
+
toolNameEn?: string;
|
|
57
|
+
content?: string;
|
|
58
|
+
}
|
|
59
|
+
interface AgentToolCallCancelledEvent {
|
|
60
|
+
toolCallId: string;
|
|
61
|
+
toolName: string;
|
|
62
|
+
toolNameEn?: string;
|
|
63
|
+
reason?: 'user_terminated' | 'session_disconnected' | 'background_cancelled' | 'unknown';
|
|
64
|
+
}
|
|
65
|
+
type AgentToolCall = AgentToolCallStartedEvent & ({
|
|
66
|
+
kind: 'tool';
|
|
67
|
+
executor: 'server' | 'client';
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'action';
|
|
70
|
+
executor: 'client';
|
|
71
|
+
});
|
|
72
|
+
interface AgentToolCallCreatedEvent {
|
|
73
|
+
toolCallId: string;
|
|
74
|
+
toolName: string;
|
|
75
|
+
icon?: string;
|
|
76
|
+
}
|
|
77
|
+
interface AgentToolCallReadyEvent {
|
|
78
|
+
toolCall: AgentToolCall;
|
|
79
|
+
dependsOn?: {
|
|
80
|
+
toolCallId: string;
|
|
81
|
+
reason: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
interface AgentToolApprovalRequestedEvent {
|
|
85
|
+
toolCallIds: string[];
|
|
86
|
+
}
|
|
87
|
+
interface AgentClientActionRequestEvent {
|
|
88
|
+
actionId: string;
|
|
89
|
+
actionName: string;
|
|
90
|
+
actionNameEn?: string;
|
|
91
|
+
arguments: Record<string, unknown>;
|
|
92
|
+
actionDescription?: string;
|
|
93
|
+
}
|
|
94
|
+
interface AgentUserFeedbackConsumedEvent {
|
|
95
|
+
content: string;
|
|
96
|
+
payload?: AgentTextPayload | null;
|
|
97
|
+
}
|
|
98
|
+
interface AgentUserSteerConsumedEvent {
|
|
99
|
+
steerId: string;
|
|
100
|
+
content: string;
|
|
101
|
+
payload?: AgentTextPayload;
|
|
102
|
+
}
|
|
103
|
+
interface AgentUserSteerCancelledEvent {
|
|
104
|
+
steerId: string;
|
|
105
|
+
}
|
|
106
|
+
interface AgentUserInputSubmittedEvent {
|
|
107
|
+
content: string;
|
|
108
|
+
payload?: AgentTextPayload | null;
|
|
109
|
+
}
|
|
110
|
+
type AgentSessionTurnStartedEvent = Record<string, never>;
|
|
111
|
+
type AgentSessionTurnSucceededEvent = Record<string, never>;
|
|
112
|
+
type AgentSessionRunStartedEvent = Record<string, never>;
|
|
113
|
+
type AgentSessionRunIdledEvent = Record<string, never>;
|
|
114
|
+
type AgentSessionRunEndedEvent = Record<string, never>;
|
|
115
|
+
interface AgentSessionTurnFailedEvent {
|
|
116
|
+
code: number;
|
|
117
|
+
error: string;
|
|
118
|
+
}
|
|
119
|
+
interface AgentSessionTurnCancelledEvent {
|
|
120
|
+
reason: 'user_graceful_termination' | 'user_forced_termination' | 'hitl_user_termination' | 'hitl_timeout' | 'session_orphaned' | 'runtime_lost' | 'unknown';
|
|
121
|
+
}
|
|
122
|
+
interface AgentSystemMessageConsumedEvent {
|
|
123
|
+
messageId: string;
|
|
124
|
+
messageType: string;
|
|
125
|
+
content: string;
|
|
126
|
+
modelContent: string;
|
|
127
|
+
data?: unknown;
|
|
128
|
+
}
|
|
129
|
+
interface AgentSessionSuccess {
|
|
130
|
+
status: 'success';
|
|
131
|
+
context: AgentSessionContext | null;
|
|
132
|
+
}
|
|
133
|
+
interface AgentSessionFailure {
|
|
134
|
+
status: 'failure';
|
|
135
|
+
context: AgentSessionContext | null;
|
|
136
|
+
error: unknown;
|
|
137
|
+
}
|
|
138
|
+
interface AgentSessionCancelled {
|
|
139
|
+
status: 'cancelled';
|
|
140
|
+
context: AgentSessionContext | null;
|
|
141
|
+
}
|
|
142
|
+
type AgentSessionSettlement = AgentSessionSuccess | AgentSessionFailure | AgentSessionCancelled;
|
|
143
|
+
type AgentServerEvent = Record<string, unknown>;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/index.d.ts
|
|
146
|
+
type KebabCase<Value extends string> = Value extends `${infer First}${infer Rest}` ? Rest extends Uncapitalize<Rest> ? `${Lowercase<First>}${KebabCase<Rest>}` : `${Lowercase<First>}-${KebabCase<Rest>}` : Value;
|
|
147
|
+
type CallbackEventName<Name extends string> = Name extends `on${infer EventName}` ? KebabCase<EventName> : never;
|
|
148
|
+
type AgentEventEmits = { [Name in keyof AgentEvents as CallbackEventName<Name & string>]-?: (...args: Parameters<NonNullable<AgentEvents[Name]>>) => boolean; };
|
|
149
|
+
declare const AgentEmbed: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
150
|
+
endpoint: {
|
|
151
|
+
type: StringConstructor;
|
|
152
|
+
required: true;
|
|
153
|
+
};
|
|
154
|
+
token: {
|
|
155
|
+
type: StringConstructor;
|
|
156
|
+
required: true;
|
|
157
|
+
};
|
|
158
|
+
baseUrl: {
|
|
159
|
+
type: StringConstructor;
|
|
160
|
+
default: string;
|
|
161
|
+
};
|
|
162
|
+
threadId: StringConstructor;
|
|
163
|
+
runtime_variables: PropType<AgentRuntimeVariables>;
|
|
164
|
+
clientTools: PropType<Record<string, AgentClientToolHandler>>;
|
|
165
|
+
appearance: PropType<AgentAppearance>;
|
|
166
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, AgentEventEmits & {
|
|
169
|
+
ready: (instance: AgentEmbedInstance) => boolean;
|
|
170
|
+
'theme-change': (theme: AgentEmbedTheme) => boolean;
|
|
171
|
+
'font-size-change': (fontSize: number) => boolean;
|
|
172
|
+
'init-error': (error: AgentEmbedInitError) => boolean;
|
|
173
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
|
+
endpoint: {
|
|
175
|
+
type: StringConstructor;
|
|
176
|
+
required: true;
|
|
177
|
+
};
|
|
178
|
+
token: {
|
|
179
|
+
type: StringConstructor;
|
|
180
|
+
required: true;
|
|
181
|
+
};
|
|
182
|
+
baseUrl: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: string;
|
|
185
|
+
};
|
|
186
|
+
threadId: StringConstructor;
|
|
187
|
+
runtime_variables: PropType<AgentRuntimeVariables>;
|
|
188
|
+
clientTools: PropType<Record<string, AgentClientToolHandler>>;
|
|
189
|
+
appearance: PropType<AgentAppearance>;
|
|
190
|
+
}>> & Readonly<{
|
|
191
|
+
"onConcurrent-send"?: (() => any) | undefined;
|
|
192
|
+
onEvent?: ((event: AgentServerEvent) => any) | undefined;
|
|
193
|
+
onReady?: ((instance: AgentEmbedInstance) => any) | undefined;
|
|
194
|
+
"onSession-context-ready"?: ((context: AgentSessionContext) => any) | undefined;
|
|
195
|
+
"onTool-call-created"?: ((event: AgentToolCallCreatedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
196
|
+
"onTool-call-ready"?: ((event: AgentToolCallReadyEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
197
|
+
"onTool-approval-requested"?: ((event: AgentToolApprovalRequestedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
198
|
+
"onTool-call-started"?: ((event: AgentToolCallStartedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
199
|
+
"onTool-call-progress-updated"?: ((event: AgentToolCallProgressUpdatedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
200
|
+
"onTool-call-backgrounded"?: ((event: AgentToolCallBackgroundedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
201
|
+
"onTool-call-succeeded"?: ((event: AgentToolCallSucceededEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
202
|
+
"onTool-call-failed"?: ((event: AgentToolCallFailedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
203
|
+
onCancelled?: ((result: AgentSessionCancelled) => any) | undefined;
|
|
204
|
+
"onTool-call-cancelled"?: ((event: AgentToolCallCancelledEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
205
|
+
"onClient-tool-request"?: ((event: AgentToolCallStartedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
206
|
+
"onClient-action-request"?: ((event: AgentClientActionRequestEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
207
|
+
"onUser-feedback-consumed"?: ((event: AgentUserFeedbackConsumedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
208
|
+
"onUser-steer-consumed"?: ((event: AgentUserSteerConsumedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
209
|
+
"onUser-steer-cancelled"?: ((event: AgentUserSteerCancelledEvent, context: AgentSessionRunEventContext) => any) | undefined;
|
|
210
|
+
"onUser-input-submitted"?: ((event: AgentUserInputSubmittedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
211
|
+
"onSession-turn-started"?: ((event: AgentSessionTurnStartedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
212
|
+
"onSession-turn-succeeded"?: ((event: AgentSessionTurnSucceededEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
213
|
+
"onSession-turn-failed"?: ((event: AgentSessionTurnFailedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
214
|
+
"onSession-turn-cancelled"?: ((event: AgentSessionTurnCancelledEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
215
|
+
"onSession-run-started"?: ((event: AgentSessionRunStartedEvent, context: AgentSessionRunEventContext) => any) | undefined;
|
|
216
|
+
"onSession-run-idled"?: ((event: AgentSessionRunIdledEvent, context: AgentSessionRunEventContext) => any) | undefined;
|
|
217
|
+
"onSession-run-ended"?: ((event: AgentSessionRunEndedEvent, context: AgentSessionRunEventContext) => any) | undefined;
|
|
218
|
+
"onSystem-message-consumed"?: ((event: AgentSystemMessageConsumedEvent, context: AgentSessionEventContext) => any) | undefined;
|
|
219
|
+
onSuccess?: ((result: AgentSessionSuccess) => any) | undefined;
|
|
220
|
+
onError?: ((result: AgentSessionFailure) => any) | undefined;
|
|
221
|
+
onSettled?: ((result: AgentSessionSettlement) => any) | undefined;
|
|
222
|
+
"onTheme-change"?: ((theme: AgentEmbedTheme) => any) | undefined;
|
|
223
|
+
"onFont-size-change"?: ((fontSize: number) => any) | undefined;
|
|
224
|
+
"onInit-error"?: ((error: AgentEmbedInitError) => any) | undefined;
|
|
225
|
+
}>, {
|
|
226
|
+
baseUrl: string;
|
|
227
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
228
|
+
//#endregion
|
|
229
|
+
export { AgentEmbed, AgentEmbed as default };
|
|
230
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../core/dist/index.d.mts","../src/index.ts"],"mappings":";;;;UAsBU;EACR;EACA;;UAEQ;EACR;EACA;EACA,YAAY;IACV;IACA;IACA;IACA;IACA;IACA;IACA;MACE;MACA;;;;UAII;EACR;EACA;EACA;EACA;;KAEG,2BAA2B,8BAA8B;UACpD;EACR;EACA;EACA;EACA;EACA,WAAW;;UAEH,oCAAoC;EAC5C;;UAEQ,0CAA0C;EAClD;EACA;IACE;IACA;IACA,MAAM;;;UAGA,iCAAiC;EACzC;;UAEQ;EACR;EACA;EACA;EACA;;UAEQ;EACR;EACA;EACA;EACA;;KAEG,gBAAgB;EACnB;EACA;;EAEA;EACA;;UAEQ;EACR;EACA;EACA;;UAEQ;EACR,UAAU;EACV;IACE;IACA;;;UAGM;EACR;;UAEQ;EACR;EACA;EACA;EACA,WAAW;EACX;;UAEQ;EACR;EACA,UAAU;;UAEF;EACR;EACA;EACA,UAAU;;UAEF;EACR;;UAEQ;EACR;EACA,UAAU;;KAEP,+BAA+B;KAC/B,iCAAiC;KACjC,8BAA8B;KAC9B,4BAA4B;KAC5B,4BAA4B;UACvB;EACR;EACA;;UAEQ;EACR;;UAEQ;EACR;EACA;EACA;EACA;EACA;;UAEQ;EACR;EACA,SAAS;;UAED;EACR;EACA,SAAS;EACT;;UAEQ;EACR;EACA,SAAS;;KAEN,yBAAyB,sBAAsB,sBAAsB;KACrE,mBAAmB;;;KCzInB,UAAU,wBAAwB,uBAAuB,cAAc,SACxE,aAAa,aAAa,WACrB,UAAU,SAAS,UAAU,aAC7B,UAAU,UAAU,UAAU,UACnC;KACC,kBAAkB,uBAAuB,wBAAwB,cAAc,UAAU;KACzF,qBACF,cAAc,eAAe,kBAAkB,uBAC3C,MAAM,WAAW,YAAY,YAAY;cAyBnC,0BAAU,8BAAA;;;;;;;;;;;;;;EAOU,mBAAA,SAAS;EACf,aAAA,SAAS,eAAe;EACzB,YAAA,SAAS;;;;EA9B1B,QAAC,UAAU;EACF,iBAAC,OAAO;EACJ,qBAAC;EACP,eAAC,OAAO;;;;;;;;;;;;;;;EAyBS,mBAAA,SAAS;EACf,aAAA,SAAS,eAAe;EACzB,YAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA8CjC"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
2
|
+
import { AGENT_EVENT_NAMES, DEFAULT_AGENT_EMBED_BASE_URL, createAgentEmbed } from "@sophonsai/agent-embed-sdk";
|
|
3
|
+
export * from "@sophonsai/agent-embed-sdk";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
const callbackNameToEventName = (name) => name.replace(/^on/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
|
+
const agentEventNames = AGENT_EVENT_NAMES.map(callbackNameToEventName);
|
|
7
|
+
const agentEmbedEmits = {
|
|
8
|
+
...Object.fromEntries(agentEventNames.map((name) => [name, () => true])),
|
|
9
|
+
ready: (_instance) => true,
|
|
10
|
+
"theme-change": (_theme) => true,
|
|
11
|
+
"font-size-change": (_fontSize) => true,
|
|
12
|
+
"init-error": (_error) => true
|
|
13
|
+
};
|
|
14
|
+
const createAgentEventForwarders = (emit) => Object.fromEntries(AGENT_EVENT_NAMES.map((callbackName) => [callbackName, (...args) => emit(callbackNameToEventName(callbackName), ...args)]));
|
|
15
|
+
const AgentEmbed = defineComponent({
|
|
16
|
+
name: "AgentEmbed",
|
|
17
|
+
props: {
|
|
18
|
+
endpoint: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
token: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
baseUrl: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: DEFAULT_AGENT_EMBED_BASE_URL
|
|
29
|
+
},
|
|
30
|
+
threadId: String,
|
|
31
|
+
runtime_variables: Object,
|
|
32
|
+
clientTools: Object,
|
|
33
|
+
appearance: Object
|
|
34
|
+
},
|
|
35
|
+
emits: agentEmbedEmits,
|
|
36
|
+
setup(props, { emit }) {
|
|
37
|
+
const host = ref();
|
|
38
|
+
let client;
|
|
39
|
+
const createOptions = () => ({
|
|
40
|
+
endpoint: props.endpoint,
|
|
41
|
+
token: props.token,
|
|
42
|
+
baseUrl: props.baseUrl,
|
|
43
|
+
threadId: props.threadId,
|
|
44
|
+
runtime_variables: props.runtime_variables,
|
|
45
|
+
clientTools: props.clientTools,
|
|
46
|
+
appearance: props.appearance,
|
|
47
|
+
...createAgentEventForwarders(emit),
|
|
48
|
+
onReady: (instance) => emit("ready", instance),
|
|
49
|
+
onThemeChange: (theme) => emit("theme-change", theme),
|
|
50
|
+
onFontSizeChange: (fontSize) => emit("font-size-change", fontSize),
|
|
51
|
+
onInitError: (error) => emit("init-error", error)
|
|
52
|
+
});
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
client = createAgentEmbed(createOptions());
|
|
55
|
+
if (host.value) client.mount(host.value).catch(() => void 0);
|
|
56
|
+
});
|
|
57
|
+
watch(() => props.appearance?.theme, (theme) => client?.updateTheme(theme), { deep: true });
|
|
58
|
+
watch(() => props.appearance?.fontSize, (fontSize) => client?.updateFontSize(fontSize));
|
|
59
|
+
watch(() => props.appearance?.header, (header) => client?.updateHeader(header), { deep: true });
|
|
60
|
+
onBeforeUnmount(() => {
|
|
61
|
+
client?.destroy();
|
|
62
|
+
client = void 0;
|
|
63
|
+
});
|
|
64
|
+
return () => h("div", {
|
|
65
|
+
ref: host,
|
|
66
|
+
style: {
|
|
67
|
+
width: "100%",
|
|
68
|
+
height: "100%",
|
|
69
|
+
minHeight: 0
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
export { AgentEmbed, AgentEmbed as default };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineComponent, h, onBeforeUnmount, onMounted as onVueMounted, ref, watch, type PropType } from 'vue'\nimport {\n AGENT_EVENT_NAMES,\n createAgentEmbed,\n DEFAULT_AGENT_EMBED_BASE_URL,\n type AgentAppearance,\n type AgentClientToolHandler,\n type AgentRuntimeVariables,\n type AgentEvents,\n type AgentEmbedClient,\n type AgentEmbedInstance,\n type AgentEmbedInitError,\n type AgentEmbedTheme,\n} from '@sophonsai/agent-embed-sdk'\n\nexport * from '@sophonsai/agent-embed-sdk'\n\nconst callbackNameToEventName = (name: string) =>\n name\n .replace(/^on/, '')\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .toLowerCase()\nconst agentEventNames = AGENT_EVENT_NAMES.map(callbackNameToEventName)\ntype KebabCase<Value extends string> = Value extends `${infer First}${infer Rest}`\n ? Rest extends Uncapitalize<Rest>\n ? `${Lowercase<First>}${KebabCase<Rest>}`\n : `${Lowercase<First>}-${KebabCase<Rest>}`\n : Value\ntype CallbackEventName<Name extends string> = Name extends `on${infer EventName}` ? KebabCase<EventName> : never\ntype AgentEventEmits = {\n [Name in keyof AgentEvents as CallbackEventName<Name & string>]-?: (\n ...args: Parameters<NonNullable<AgentEvents[Name]>>\n ) => boolean\n}\ntype AgentEmbedEmits = AgentEventEmits & {\n ready: (instance: AgentEmbedInstance) => boolean\n 'theme-change': (theme: AgentEmbedTheme) => boolean\n 'font-size-change': (fontSize: number) => boolean\n 'init-error': (error: AgentEmbedInitError) => boolean\n}\nconst agentEmbedEmits = {\n ...Object.fromEntries(agentEventNames.map((name) => [name, () => true])),\n ready: (_instance: AgentEmbedInstance) => true,\n 'theme-change': (_theme: AgentEmbedTheme) => true,\n 'font-size-change': (_fontSize: number) => true,\n 'init-error': (_error: AgentEmbedInitError) => true,\n} as AgentEmbedEmits\ntype Emit = (event: string, ...args: unknown[]) => void\nconst createAgentEventForwarders = (emit: Emit): AgentEvents =>\n Object.fromEntries(\n AGENT_EVENT_NAMES.map((callbackName) => [\n callbackName,\n (...args: unknown[]) => emit(callbackNameToEventName(callbackName), ...args),\n ]),\n ) as AgentEvents\n\nexport const AgentEmbed = defineComponent({\n name: 'AgentEmbed',\n props: {\n endpoint: { type: String, required: true },\n token: { type: String, required: true },\n baseUrl: { type: String, default: DEFAULT_AGENT_EMBED_BASE_URL },\n threadId: String,\n runtime_variables: Object as PropType<AgentRuntimeVariables>,\n clientTools: Object as PropType<Record<string, AgentClientToolHandler>>,\n appearance: Object as PropType<AgentAppearance>,\n },\n emits: agentEmbedEmits,\n setup(props, { emit }) {\n const host = ref<HTMLElement>()\n let client: AgentEmbedClient | undefined\n const createOptions = () => ({\n endpoint: props.endpoint,\n token: props.token,\n baseUrl: props.baseUrl,\n threadId: props.threadId,\n runtime_variables: props.runtime_variables,\n clientTools: props.clientTools,\n appearance: props.appearance,\n ...createAgentEventForwarders(emit as Emit),\n onReady: (instance: AgentEmbedInstance) => emit('ready', instance),\n onThemeChange: (theme: AgentEmbedTheme) => emit('theme-change', theme),\n onFontSizeChange: (fontSize: number) => emit('font-size-change', fontSize),\n onInitError: (error: AgentEmbedInitError) => emit('init-error', error),\n })\n onVueMounted(() => {\n client = createAgentEmbed(createOptions())\n if (host.value) {\n void client.mount(host.value).catch(() => undefined)\n }\n })\n watch(\n () => props.appearance?.theme,\n (theme) => client?.updateTheme(theme),\n { deep: true },\n )\n watch(\n () => props.appearance?.fontSize,\n (fontSize) => client?.updateFontSize(fontSize),\n )\n watch(\n () => props.appearance?.header,\n (header) => client?.updateHeader(header),\n { deep: true },\n )\n onBeforeUnmount(() => {\n client?.destroy()\n client = undefined\n })\n return () => h('div', { ref: host, style: { width: '100%', height: '100%', minHeight: 0 } })\n },\n})\n\nexport default AgentEmbed\n"],"mappings":";;;;AAiBA,MAAM,2BAA2B,SAC/B,KACG,QAAQ,OAAO,EAAE,CAAC,CAClB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,YAAY;AACjB,MAAM,kBAAkB,kBAAkB,IAAI,uBAAuB;AAkBrE,MAAM,kBAAkB;CACtB,GAAG,OAAO,YAAY,gBAAgB,KAAK,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC;CACvE,QAAQ,cAAkC;CAC1C,iBAAiB,WAA4B;CAC7C,qBAAqB,cAAsB;CAC3C,eAAe,WAAgC;AACjD;AAEA,MAAM,8BAA8B,SAClC,OAAO,YACL,kBAAkB,KAAK,iBAAiB,CACtC,eACC,GAAG,SAAoB,KAAK,wBAAwB,YAAY,GAAG,GAAG,IAAI,CAC7E,CAAC,CACH;AAEF,MAAa,aAAa,gBAAgB;CACxC,MAAM;CACN,OAAO;EACL,UAAU;GAAE,MAAM;GAAQ,UAAU;EAAK;EACzC,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK;EACtC,SAAS;GAAE,MAAM;GAAQ,SAAS;EAA6B;EAC/D,UAAU;EACV,mBAAmB;EACnB,aAAa;EACb,YAAY;CACd;CACA,OAAO;CACP,MAAM,OAAO,EAAE,QAAQ;EACrB,MAAM,OAAO,IAAiB;EAC9B,IAAI;EACJ,MAAM,uBAAuB;GAC3B,UAAU,MAAM;GAChB,OAAO,MAAM;GACb,SAAS,MAAM;GACf,UAAU,MAAM;GAChB,mBAAmB,MAAM;GACzB,aAAa,MAAM;GACnB,YAAY,MAAM;GAClB,GAAG,2BAA2B,IAAY;GAC1C,UAAU,aAAiC,KAAK,SAAS,QAAQ;GACjE,gBAAgB,UAA2B,KAAK,gBAAgB,KAAK;GACrE,mBAAmB,aAAqB,KAAK,oBAAoB,QAAQ;GACzE,cAAc,UAA+B,KAAK,cAAc,KAAK;EACvE;EACA,gBAAmB;GACjB,SAAS,iBAAiB,cAAc,CAAC;GACzC,IAAI,KAAK,OACP,OAAY,MAAM,KAAK,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;EAEvD,CAAC;EACD,YACQ,MAAM,YAAY,QACvB,UAAU,QAAQ,YAAY,KAAK,GACpC,EAAE,MAAM,KAAK,CACf;EACA,YACQ,MAAM,YAAY,WACvB,aAAa,QAAQ,eAAe,QAAQ,CAC/C;EACA,YACQ,MAAM,YAAY,SACvB,WAAW,QAAQ,aAAa,MAAM,GACvC,EAAE,MAAM,KAAK,CACf;EACA,sBAAsB;GACpB,QAAQ,QAAQ;GAChB,SAAS,KAAA;EACX,CAAC;EACD,aAAa,EAAE,OAAO;GAAE,KAAK;GAAM,OAAO;IAAE,OAAO;IAAQ,QAAQ;IAAQ,WAAW;GAAE;EAAE,CAAC;CAC7F;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sophonsai/agent-embed-vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Vue 3 adapter for Sophon Agent Embed.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"sophonsai",
|
|
8
|
+
"agent",
|
|
9
|
+
"agent-embed",
|
|
10
|
+
"vue3"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/index.d.mts",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"import": "./dist/index.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@sophonsai/agent-embed-sdk": "0.2.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"vue": ">=3.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
35
|
+
"jsdom": "^27.4.0",
|
|
36
|
+
"tsdown": "^0.22.14",
|
|
37
|
+
"vue": "^3.5.24"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsdown src/index.ts --format esm --dts",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"test": "vitest run --config vitest.config.ts",
|
|
43
|
+
"example": "vite --config example/vite.config.ts"
|
|
44
|
+
}
|
|
6
45
|
}
|