@csntgao/uni-base 0.6.5 → 0.6.6
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/AGENTS.md +5 -5
- package/CLAUDE.md +5 -5
- package/README.md +21 -19
- package/docs//347/273/204/347/273/207/345/221/230/345/267/245/345/215/225/351/200/211/347/273/204/344/273/266/346/216/245/345/205/245/350/257/264/346/230/216.md +1 -1
- package/docs//347/273/204/347/273/207/345/221/230/345/267/245/345/244/232/351/200/211/347/273/204/344/273/266/346/216/245/345/205/245/350/257/264/346/230/216.md +1 -1
- package/examples/vanilla/main.js +1 -1
- package/examples/vanilla/package.json +3 -3
- package/package.json +4 -4
- package/packages/core/package.json +2 -2
- package/packages/web-components/package.json +3 -3
- package/packages/web-components/src/chat.ts +1 -1
- package/packages/web-components/src/customer-support-chat.ts +1 -1
- package/packages/web-components/src/customer-support-transport.ts +2 -2
- package/packages/web-components/src/index.ts +2 -2
- package/packages/web-components/src/notification-center.ts +1 -1
- package/packages/web-components/src/notification-popover.ts +1 -1
- package/packages/web-components/src/uniplat-base-notification-center-transport.ts +1 -1
- package/packages/web-components/tests/chat.test.ts +1 -1
- package/packages/web-components/tests/customer-support-chat.test.ts +1 -1
- package/packages/web-components/tests/notification-center.test.ts +1 -1
- package/packages/web-components/tests/notification-popover.test.ts +1 -1
- package/packages/web-components/tsup.config.ts +1 -1
- package/packages/web-components/tsup.runtime.config.ts +1 -1
- package/tsconfig.base.json +2 -2
- package/vitest.config.ts +2 -2
- package//344/272/244/346/216/245/346/226/207/346/241/243.md +21 -26
package/AGENTS.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
当前交付包括:
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
|
-
packages/core @
|
|
15
|
-
packages/web-components @
|
|
14
|
+
packages/core @csntgao/ai-employee-client
|
|
15
|
+
packages/web-components @csntgao/ai-employee-web-components
|
|
16
16
|
examples/vanilla 原生 HTML / JavaScript 接入示例
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -97,8 +97,8 @@ pnpm build
|
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
pnpm build
|
|
100
|
-
pnpm --filter @
|
|
101
|
-
pnpm --filter @
|
|
100
|
+
pnpm --filter @csntgao/ai-employee-client pack
|
|
101
|
+
pnpm --filter @csntgao/ai-employee-web-components pack
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
该规则适用于 core、Web Components、示例及构建配置等所有代码变更,不因本次修改只涉及其中一个 workspace 而省略另一个发布包。纯文档修改不要求重新打包。向其他项目同步 tarball 时仍须遵守跨项目修改边界,并同步更新调用方依赖声明、锁文件和包校验值。
|
|
@@ -121,7 +121,7 @@ pnpm --filter @uniplat/ai-employee-web-components pack
|
|
|
121
121
|
- serve 目录:`/Users/gaostudio/uni-base/dist/runtime`(即 Web Components 构建产物)。
|
|
122
122
|
- 证书与私钥:`/Users/gaostudio/.uni-base-runtime/10.10.10.131+2.pem` 与 `10.10.10.131+2-key.pem`,由 mkcert 签发的开发证书,SAN 覆盖 `localhost`、`10.10.10.131`、`127.0.0.1`。脚本与证书都放在仓库外的 `~/.uni-base-runtime/`,私钥属凭据不得写入仓库。
|
|
123
123
|
- 客户端需信任的根证书:`/Users/gaostudio/Library/Application Support/mkcert/rootCA.pem`。该证书只在安装了此 rootCA 的机器上被信任;其它机器的调用方需先安装该 rootCA,或改用正式证书。
|
|
124
|
-
- npm registry 当前为 `https://registry.
|
|
124
|
+
- npm registry 当前为 `https://registry.npmjs.org/`,本机已登录 `csntgao`。本仓库的可发布包统一使用 `@csntgao` scope;发布仍需逐次完成 npm 浏览器 2FA,并在远端回读版本后才能声称成功。
|
|
125
125
|
|
|
126
126
|
## Workspace 边界
|
|
127
127
|
|
package/CLAUDE.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
当前交付包括:
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
|
-
packages/core @
|
|
15
|
-
packages/web-components @
|
|
14
|
+
packages/core @csntgao/ai-employee-client
|
|
15
|
+
packages/web-components @csntgao/ai-employee-web-components
|
|
16
16
|
examples/vanilla 原生 HTML / JavaScript 接入示例
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -97,8 +97,8 @@ pnpm build
|
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
pnpm build
|
|
100
|
-
pnpm --filter @
|
|
101
|
-
pnpm --filter @
|
|
100
|
+
pnpm --filter @csntgao/ai-employee-client pack
|
|
101
|
+
pnpm --filter @csntgao/ai-employee-web-components pack
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
该规则适用于 core、Web Components、示例及构建配置等所有代码变更,不因本次修改只涉及其中一个 workspace 而省略另一个发布包。纯文档修改不要求重新打包。向其他项目同步 tarball 时仍须遵守跨项目修改边界,并同步更新调用方依赖声明、锁文件和包校验值。
|
|
@@ -121,7 +121,7 @@ pnpm --filter @uniplat/ai-employee-web-components pack
|
|
|
121
121
|
- serve 目录:`/Users/gaostudio/uni-base/dist/runtime`(即 Web Components 构建产物)。
|
|
122
122
|
- 证书与私钥:`/Users/gaostudio/.uni-base-runtime/10.10.10.131+2.pem` 与 `10.10.10.131+2-key.pem`,由 mkcert 签发的开发证书,SAN 覆盖 `localhost`、`10.10.10.131`、`127.0.0.1`。脚本与证书都放在仓库外的 `~/.uni-base-runtime/`,私钥属凭据不得写入仓库。
|
|
123
123
|
- 客户端需信任的根证书:`/Users/gaostudio/Library/Application Support/mkcert/rootCA.pem`。该证书只在安装了此 rootCA 的机器上被信任;其它机器的调用方需先安装该 rootCA,或改用正式证书。
|
|
124
|
-
- npm registry 当前为 `https://registry.
|
|
124
|
+
- npm registry 当前为 `https://registry.npmjs.org/`,本机已登录 `csntgao`。本仓库的可发布包统一使用 `@csntgao` scope;发布仍需逐次完成 npm 浏览器 2FA,并在远端回读版本后才能声称成功。
|
|
125
125
|
|
|
126
126
|
## Workspace 边界
|
|
127
127
|
|
package/README.md
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
## Workspace
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
packages/core @
|
|
9
|
-
packages/web-components @
|
|
8
|
+
packages/core @csntgao/ai-employee-client
|
|
9
|
+
packages/web-components @csntgao/ai-employee-web-components
|
|
10
10
|
examples/vanilla 无框架接入示例
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> 包 scope 已从 `@uniplat` 迁移到 `@csntgao`。调用方需要把依赖和 import 分别改为 `@csntgao/ai-employee-client`、`@csntgao/ai-employee-web-components`;`<uniplat-...>` Custom Element 标签、公开类型和后端协议名称保持不变。
|
|
14
|
+
|
|
13
15
|
要求 Node.js 20+ 和 pnpm。常用命令:
|
|
14
16
|
|
|
15
17
|
```bash
|
|
@@ -33,7 +35,7 @@ import {
|
|
|
33
35
|
AiEmployeeClient,
|
|
34
36
|
AiEmployeeTransportError,
|
|
35
37
|
type AiEmployeeTransport,
|
|
36
|
-
} from '@
|
|
38
|
+
} from '@csntgao/ai-employee-client'
|
|
37
39
|
|
|
38
40
|
const transport: AiEmployeeTransport = {
|
|
39
41
|
async createSessionWithFirstMessage(request) {
|
|
@@ -137,7 +139,7 @@ client.destroy()
|
|
|
137
139
|
|
|
138
140
|
### 浏览器运行时发布
|
|
139
141
|
|
|
140
|
-
`pnpm --filter @
|
|
142
|
+
`pnpm --filter @csntgao/ai-employee-web-components build` 除 npm 包的 `dist/` 外,还会生成可由官网运行时加载的独立浏览器 ESM:
|
|
141
143
|
|
|
142
144
|
```text
|
|
143
145
|
dist/runtime/current.json
|
|
@@ -145,7 +147,7 @@ dist/runtime/releases/<version>/index.js
|
|
|
145
147
|
dist/runtime/releases/<version>/index.js.map
|
|
146
148
|
```
|
|
147
149
|
|
|
148
|
-
运行时版本从 Web Components 的 `package.json` 读取。构建会实际导入独立 ESM,校验 Host 必需导出、九个 Custom Element 注册结果,并拒绝任何残留的运行时 import;全部通过后才原子写入本地 `current.json`。独立 ESM 会完整打包 `lit` 和 `@
|
|
150
|
+
运行时版本从 Web Components 的 `package.json` 读取。构建会实际导入独立 ESM,校验 Host 必需导出、九个 Custom Element 注册结果,并拒绝任何残留的运行时 import;全部通过后才原子写入本地 `current.json`。独立 ESM 会完整打包 `lit` 和 `@csntgao/ai-employee-client`。
|
|
149
151
|
|
|
150
152
|
部署时仍须先上传并验证整个版本目录,再原子替换远端 `current.json`;清单使用 `Cache-Control: no-store`,版本目录使用 `Cache-Control: public, max-age=31536000, immutable`。同一版本的文件不得覆盖,回滚只切回先前清单。缓存头、匿名 CORS、CSP 与远端原子替换由静态发布平台负责,不是 JavaScript 构建产物能够代替的配置。
|
|
151
153
|
|
|
@@ -160,7 +162,7 @@ import {
|
|
|
160
162
|
createUniplatBaseNotificationCenterTransport,
|
|
161
163
|
type UniplatNotificationCenter,
|
|
162
164
|
type UniplatNotificationPopover,
|
|
163
|
-
} from '@
|
|
165
|
+
} from '@csntgao/ai-employee-web-components'
|
|
164
166
|
|
|
165
167
|
const transport = createUniplatBaseNotificationCenterTransport({
|
|
166
168
|
serviceBaseUrl,
|
|
@@ -202,7 +204,7 @@ function applyNotificationRealtimeEvent(rawEvent: unknown) {
|
|
|
202
204
|
<uniplat-user-login id="user-login"></uniplat-user-login>
|
|
203
205
|
|
|
204
206
|
<script type="module">
|
|
205
|
-
import { createUniplatBaseUserLoginTransport } from '@
|
|
207
|
+
import { createUniplatBaseUserLoginTransport } from '@csntgao/ai-employee-web-components'
|
|
206
208
|
|
|
207
209
|
const transport = createUniplatBaseUserLoginTransport({
|
|
208
210
|
apiBaseUrl: '/api',
|
|
@@ -281,7 +283,7 @@ transport 可抛出 `OrganizationOnboardingTransportError`,稳定错误码为
|
|
|
281
283
|
UniplatBase 已在现有 `system.org` 服务下提供真实创建能力。Host 使用当前 JWT 对接时,不需要自行拼请求体:
|
|
282
284
|
|
|
283
285
|
```js
|
|
284
|
-
import { createUniplatBaseOrganizationOnboardingTransport } from '@
|
|
286
|
+
import { createUniplatBaseOrganizationOnboardingTransport } from '@csntgao/ai-employee-web-components'
|
|
285
287
|
|
|
286
288
|
accountContext.configure({
|
|
287
289
|
applicationName: 'OfficialWebsite',
|
|
@@ -366,7 +368,7 @@ selector.configure({
|
|
|
366
368
|
S.0 的“弹不弹”判定由纯函数 `resolveOrganizationEntryDecision()` 提供,它不读写宿主存储:
|
|
367
369
|
|
|
368
370
|
```js
|
|
369
|
-
import { resolveOrganizationEntryDecision } from '@
|
|
371
|
+
import { resolveOrganizationEntryDecision } from '@csntgao/ai-employee-web-components'
|
|
370
372
|
|
|
371
373
|
const decision = resolveOrganizationEntryDecision({
|
|
372
374
|
organizations,
|
|
@@ -390,7 +392,7 @@ UniplatBase 的组织投影由 `application.identity/list_available_organization
|
|
|
390
392
|
import {
|
|
391
393
|
createUniplatBaseOrganizationMultiEmployeeSelectorTransport,
|
|
392
394
|
type UniplatOrganizationMultiEmployeeSelectorElement,
|
|
393
|
-
} from '@
|
|
395
|
+
} from '@csntgao/ai-employee-web-components'
|
|
394
396
|
|
|
395
397
|
const selector = document.querySelector<UniplatOrganizationMultiEmployeeSelectorElement>(
|
|
396
398
|
'uniplat-organization-multi-employee-selector',
|
|
@@ -457,7 +459,7 @@ import {
|
|
|
457
459
|
createUniplatBaseAccountContextTransport,
|
|
458
460
|
createUniplatBaseApplicationSwitcherTransport,
|
|
459
461
|
createUniplatBaseOrganizationOnboardingTransport,
|
|
460
|
-
} from '@
|
|
462
|
+
} from '@csntgao/ai-employee-web-components'
|
|
461
463
|
|
|
462
464
|
const applicationName = 'OfficialWebsite'
|
|
463
465
|
const accountContext = document.querySelector('uniplat-account-context')
|
|
@@ -516,7 +518,7 @@ accountContext.addEventListener('organization-selected', async (event) => {
|
|
|
516
518
|
<uniplat-user-menu id="user-menu"></uniplat-user-menu>
|
|
517
519
|
|
|
518
520
|
<script type="module">
|
|
519
|
-
import '@
|
|
521
|
+
import '@csntgao/ai-employee-web-components'
|
|
520
522
|
|
|
521
523
|
const userMenu = document.querySelector('#user-menu')
|
|
522
524
|
userMenu.configure({
|
|
@@ -576,7 +578,7 @@ logout-requested detail: {}
|
|
|
576
578
|
对接 UniplatBase 时使用专用 transport。Application Switcher Host 只提供当前 JWT,不保存目标应用 JWT:
|
|
577
579
|
|
|
578
580
|
```js
|
|
579
|
-
import { createUniplatBaseApplicationSwitcherTransport } from '@
|
|
581
|
+
import { createUniplatBaseApplicationSwitcherTransport } from '@csntgao/ai-employee-web-components'
|
|
580
582
|
|
|
581
583
|
const transport = createUniplatBaseApplicationSwitcherTransport({
|
|
582
584
|
serviceBaseUrl: '/api/general/project/uniplat_base/service',
|
|
@@ -604,7 +606,7 @@ accountContext.addEventListener('application-selected', (event) => {
|
|
|
604
606
|
目标应用需要在启动最早阶段登录 Ticket。目标应用只能取自该前端项目的初始化配置,不能由 URL 覆盖。helper 一旦发现 Ticket,会先从地址栏删除 `uniplat_identity_ticket` 与 `source_system`、保留其他 Fragment 参数,再请求登录接口,并只把校验后的 JWT 交给目标 Host:
|
|
605
607
|
|
|
606
608
|
```js
|
|
607
|
-
import { loginWithUniplatBaseIdentityTicket } from '@
|
|
609
|
+
import { loginWithUniplatBaseIdentityTicket } from '@csntgao/ai-employee-web-components'
|
|
608
610
|
|
|
609
611
|
await loginWithUniplatBaseIdentityTicket({
|
|
610
612
|
serviceBaseUrl: '/api/general/project/uniplat_base/service',
|
|
@@ -622,7 +624,7 @@ await loginWithUniplatBaseIdentityTicket({
|
|
|
622
624
|
对接其他、已经提供扁平 Application Switcher 接口的服务时,可以使用通用 HTTP transport:
|
|
623
625
|
|
|
624
626
|
```js
|
|
625
|
-
import { createHttpApplicationSwitcherTransport } from '@
|
|
627
|
+
import { createHttpApplicationSwitcherTransport } from '@csntgao/ai-employee-web-components'
|
|
626
628
|
|
|
627
629
|
const transport = createHttpApplicationSwitcherTransport({
|
|
628
630
|
endpoint: 'https://hr-saas.example.com/api/application-entries',
|
|
@@ -662,7 +664,7 @@ accountContext.configure({
|
|
|
662
664
|
<uniplat-ai-employee-chat id="chat"></uniplat-ai-employee-chat>
|
|
663
665
|
|
|
664
666
|
<script type="module">
|
|
665
|
-
import '@
|
|
667
|
+
import '@csntgao/ai-employee-web-components'
|
|
666
668
|
|
|
667
669
|
const chat = document.querySelector('#chat')
|
|
668
670
|
chat.configure({
|
|
@@ -687,7 +689,7 @@ accountContext.configure({
|
|
|
687
689
|
点击“转人工”后,数字员工连接会先释放,再由同一抽屉切换为 `<uniplat-customer-support-chat>`;不会向数字员工发送一条模拟转人工文本,也不要求 Host 创建第二个抽屉。默认情况下,组件复用数字员工的 `realtimeUrl` 和 `transport.getAccessToken()`,并请求同源 `/api/general/project/hr_saas/service/customer_support_api`,因此使用标准网关路径的 Host 无需增加配置。只有客服网关地址或鉴权提供者不同时,才显式传入 `customerSupport` 覆盖默认配置:
|
|
688
690
|
|
|
689
691
|
```ts
|
|
690
|
-
import { createHrSaasCustomerSupportTransport } from '@
|
|
692
|
+
import { createHrSaasCustomerSupportTransport } from '@csntgao/ai-employee-web-components'
|
|
691
693
|
|
|
692
694
|
const customerSupportTransport = createHrSaasCustomerSupportTransport({
|
|
693
695
|
serviceBaseUrl: '/api/general/project/hr_saas/service/customer_support_api',
|
|
@@ -713,7 +715,7 @@ chat.configure({
|
|
|
713
715
|
```html
|
|
714
716
|
<uniplat-customer-support-chat id="customer-support"></uniplat-customer-support-chat>
|
|
715
717
|
<script type="module">
|
|
716
|
-
import { createHrSaasCustomerSupportTransport } from '@
|
|
718
|
+
import { createHrSaasCustomerSupportTransport } from '@csntgao/ai-employee-web-components'
|
|
717
719
|
|
|
718
720
|
const customerSupport = document.querySelector('#customer-support')
|
|
719
721
|
customerSupport.configure({
|
|
@@ -778,7 +780,7 @@ Nuxt v0.1 仅在客户端注册,例如创建 `plugins/ai-employee.client.ts`
|
|
|
778
780
|
|
|
779
781
|
```ts
|
|
780
782
|
export default defineNuxtPlugin(async () => {
|
|
781
|
-
await import('@
|
|
783
|
+
await import('@csntgao/ai-employee-web-components')
|
|
782
784
|
})
|
|
783
785
|
```
|
|
784
786
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import {
|
|
15
15
|
createUniplatBaseOrganizationSingleEmployeeSelectorTransport,
|
|
16
16
|
type UniplatOrganizationSingleEmployeeSelectorElement,
|
|
17
|
-
} from '@
|
|
17
|
+
} from '@csntgao/ai-employee-web-components'
|
|
18
18
|
|
|
19
19
|
const selector = document.querySelector<UniplatOrganizationSingleEmployeeSelectorElement>(
|
|
20
20
|
'#organization-single-employee-selector',
|
|
@@ -16,7 +16,7 @@ Host 使用 UniBase 的 `current.json` 加载版本化独立 ESM。只要本文
|
|
|
16
16
|
import {
|
|
17
17
|
createUniplatBaseOrganizationMultiEmployeeSelectorTransport,
|
|
18
18
|
type UniplatOrganizationMultiEmployeeSelectorElement,
|
|
19
|
-
} from '@
|
|
19
|
+
} from '@csntgao/ai-employee-web-components'
|
|
20
20
|
|
|
21
21
|
const selector = document.querySelector<UniplatOrganizationMultiEmployeeSelectorElement>(
|
|
22
22
|
'#organization-employee-selector',
|
package/examples/vanilla/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createMockOrganizationOnboardingTransport,
|
|
4
4
|
createUniplatBaseOrganizationOnboardingTransport,
|
|
5
5
|
resolveOrganizationEntryDecision,
|
|
6
|
-
} from '@
|
|
6
|
+
} from '@csntgao/ai-employee-web-components'
|
|
7
7
|
|
|
8
8
|
const config = window.AI_EMPLOYEE_EXAMPLE_CONFIG
|
|
9
9
|
const chat = document.querySelector('#employee-chat')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@
|
|
2
|
+
"name": "@csntgao/ai-employee-vanilla-example",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
12
|
+
"@csntgao/ai-employee-client": "workspace:*",
|
|
13
|
+
"@csntgao/ai-employee-web-components": "workspace:*"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csntgao/uni-base",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"vitest": "^3.2.4"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "pnpm --filter @
|
|
22
|
-
"dev": "pnpm --filter @
|
|
21
|
+
"build": "pnpm --filter @csntgao/ai-employee-client build && pnpm --filter @csntgao/ai-employee-web-components build && pnpm --filter @csntgao/ai-employee-vanilla-example build",
|
|
22
|
+
"dev": "pnpm --filter @csntgao/ai-employee-client build && pnpm --filter @csntgao/ai-employee-web-components build && pnpm --filter @csntgao/ai-employee-vanilla-example dev",
|
|
23
23
|
"lint": "eslint . --max-warnings 0",
|
|
24
24
|
"format": "prettier --write .",
|
|
25
25
|
"format:check": "prettier --check .",
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"test:watch": "vitest",
|
|
28
|
-
"typecheck": "pnpm --filter @
|
|
28
|
+
"typecheck": "pnpm --filter @csntgao/ai-employee-client typecheck && pnpm --filter @csntgao/ai-employee-web-components typecheck"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@
|
|
3
|
-
"version": "0.29.
|
|
2
|
+
"name": "@csntgao/ai-employee-web-components",
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"description": "Framework-independent Web Components for Uniplat account, login, application switching and AI Employee chat",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": true,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test": "vitest run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@
|
|
26
|
+
"@csntgao/ai-employee-client": "workspace:*",
|
|
27
27
|
"lit": "^3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type AiEmployeeMessage,
|
|
9
9
|
type AiEmployeeSessionSummary,
|
|
10
10
|
type OpenCustomerSupportAssistantAction,
|
|
11
|
-
} from '@
|
|
11
|
+
} from '@csntgao/ai-employee-client'
|
|
12
12
|
import { LitElement, css, html, nothing, type PropertyValues } from 'lit'
|
|
13
13
|
import type { UniplatCustomerSupportChat, CustomerSupportChatConfig } from './customer-support-chat'
|
|
14
14
|
import {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type CustomerSupportErrorDetail,
|
|
7
7
|
type CustomerSupportMessage,
|
|
8
8
|
type CustomerSupportSession,
|
|
9
|
-
} from '@
|
|
9
|
+
} from '@csntgao/ai-employee-client'
|
|
10
10
|
import { LitElement, css, html, nothing } from 'lit'
|
|
11
11
|
import { prototypeIcon } from './prototype-icons'
|
|
12
12
|
|
|
@@ -8,8 +8,8 @@ import type {
|
|
|
8
8
|
CustomerSupportSession,
|
|
9
9
|
CustomerSupportSessionStatus,
|
|
10
10
|
CustomerSupportTransport,
|
|
11
|
-
} from '@
|
|
12
|
-
import { isUuidV4 } from '@
|
|
11
|
+
} from '@csntgao/ai-employee-client'
|
|
12
|
+
import { isUuidV4 } from '@csntgao/ai-employee-client'
|
|
13
13
|
|
|
14
14
|
export interface HrSaasCustomerSupportTransportOptions {
|
|
15
15
|
serviceBaseUrl: string
|
|
@@ -85,12 +85,12 @@ export type {
|
|
|
85
85
|
HrSaasCustomerSupportTransportErrorCode,
|
|
86
86
|
HrSaasCustomerSupportTransportOptions,
|
|
87
87
|
} from './customer-support-transport'
|
|
88
|
-
export { isUuidV4, parseAiEmployeeAssistantContent } from '@
|
|
88
|
+
export { isUuidV4, parseAiEmployeeAssistantContent } from '@csntgao/ai-employee-client'
|
|
89
89
|
export type {
|
|
90
90
|
AiEmployeeAssistantAction,
|
|
91
91
|
OpenCustomerSupportAssistantAction,
|
|
92
92
|
ParsedAiEmployeeAssistantContent,
|
|
93
|
-
} from '@
|
|
93
|
+
} from '@csntgao/ai-employee-client'
|
|
94
94
|
export type {
|
|
95
95
|
NotificationCenterConfig,
|
|
96
96
|
NotificationCenterEventMap,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type NotificationCenterErrorDetail,
|
|
5
5
|
type NotificationDto,
|
|
6
6
|
type NotificationTypeSummary,
|
|
7
|
-
} from '@
|
|
7
|
+
} from '@csntgao/ai-employee-client'
|
|
8
8
|
import { LitElement, css, html, nothing, type TemplateResult } from 'lit'
|
|
9
9
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
|
|
10
10
|
import { renderSafeMarkdown } from './safe-markdown'
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type NotificationCenterErrorDetail,
|
|
4
4
|
type NotificationCenterTransport,
|
|
5
5
|
type NotificationDto,
|
|
6
|
-
} from '@
|
|
6
|
+
} from '@csntgao/ai-employee-client'
|
|
7
7
|
import { LitElement, css, html, nothing, type TemplateResult } from 'lit'
|
|
8
8
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
|
|
9
9
|
import { prototypeIcon, type PrototypeIconName } from './prototype-icons'
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
NotificationResource,
|
|
11
11
|
NotificationSource,
|
|
12
12
|
NotificationTypeSummary,
|
|
13
|
-
} from '@
|
|
13
|
+
} from '@csntgao/ai-employee-client'
|
|
14
14
|
|
|
15
15
|
export interface UniplatBaseNotificationCenterTransportOptions {
|
|
16
16
|
serviceBaseUrl: string
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type CustomerSupportHandoffResult,
|
|
10
10
|
type CustomerSupportSession,
|
|
11
11
|
type CustomerSupportTransport,
|
|
12
|
-
} from '@
|
|
12
|
+
} from '@csntgao/ai-employee-client'
|
|
13
13
|
import { HrSaasCustomerSupportTransportError } from '../src'
|
|
14
14
|
import '../src'
|
|
15
15
|
import type { UniplatAiEmployeeChat } from '../src'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
-
import type { CustomerSupportSession, CustomerSupportTransport } from '@
|
|
4
|
+
import type { CustomerSupportSession, CustomerSupportTransport } from '@csntgao/ai-employee-client'
|
|
5
5
|
import '../src'
|
|
6
6
|
import { UniplatCustomerSupportChat } from '../src'
|
|
7
7
|
|
package/tsconfig.base.json
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"skipLibCheck": true,
|
|
15
15
|
"baseUrl": ".",
|
|
16
16
|
"paths": {
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
17
|
+
"@csntgao/ai-employee-client": ["packages/core/src/index.ts"],
|
|
18
|
+
"@csntgao/ai-employee-web-components": ["packages/web-components/src/index.ts"]
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
package/vitest.config.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { defineConfig } from 'vitest/config'
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
resolve: {
|
|
6
6
|
alias: {
|
|
7
|
-
'@
|
|
7
|
+
'@csntgao/ai-employee-client': fileURLToPath(
|
|
8
8
|
new URL('./packages/core/src/index.ts', import.meta.url),
|
|
9
9
|
),
|
|
10
|
-
'@
|
|
10
|
+
'@csntgao/ai-employee-web-components': fileURLToPath(
|
|
11
11
|
new URL('./packages/web-components/src/index.ts', import.meta.url),
|
|
12
12
|
),
|
|
13
13
|
},
|
|
@@ -38,12 +38,12 @@ HEAD = 495ef35
|
|
|
38
38
|
|
|
39
39
|
| 位置 | npm 名称 | 当前本地版本 | 说明 |
|
|
40
40
|
| ------------------------- | -------------------------------------- | -----------: | --------------------------------------- |
|
|
41
|
-
| 根目录 | `@csntgao/uni-base` | `0.6.
|
|
42
|
-
| `packages/core` | `@
|
|
43
|
-
| `packages/web-components` | `@
|
|
44
|
-
| `examples/vanilla` | `@
|
|
41
|
+
| 根目录 | `@csntgao/uni-base` | `0.6.6` | 当前公开发布入口 |
|
|
42
|
+
| `packages/core` | `@csntgao/ai-employee-client` | `0.14.3` | UI 无关的 HTTP/WebSocket/Core 状态机 |
|
|
43
|
+
| `packages/web-components` | `@csntgao/ai-employee-web-components` | `0.29.6` | Lit Web Components 与独立浏览器 runtime |
|
|
44
|
+
| `examples/vanilla` | `@csntgao/ai-employee-vanilla-example` | 私有示例 | 必须消费 workspace 包的构建产物 |
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
注意:全部 npm workspace 包已经统一为 `@csntgao/*`。已有 `uniplat-*` Web Component 标签、数字员工类型名和运行时协议名称不随 npm scope 改名。
|
|
47
47
|
|
|
48
48
|
## 3. 当前公开 Web Components
|
|
49
49
|
|
|
@@ -315,27 +315,27 @@ Account Context 对外只派发净化后的 `LOAD_FAILED`,精确排错应看
|
|
|
315
315
|
|
|
316
316
|
## 7. 当前构建和验证状态
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
最近一次完整检查结果(本次 scope 迁移完成后需重新执行):
|
|
319
319
|
|
|
320
320
|
```text
|
|
321
321
|
pnpm format:check 通过
|
|
322
322
|
pnpm lint 通过
|
|
323
323
|
pnpm typecheck 通过
|
|
324
|
-
pnpm test
|
|
324
|
+
pnpm test 26 个测试文件通过;311 passed,2 skipped
|
|
325
325
|
pnpm build core、web-components、runtime、vanilla 全部通过
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
两个 SDK 已重新打包:
|
|
329
329
|
|
|
330
330
|
```text
|
|
331
|
-
/Users/gaostudio/uni-base/
|
|
332
|
-
/Users/gaostudio/uni-base/
|
|
331
|
+
/Users/gaostudio/uni-base/csntgao-ai-employee-client-0.14.3.tgz
|
|
332
|
+
/Users/gaostudio/uni-base/csntgao-ai-employee-web-components-0.29.6.tgz
|
|
333
333
|
```
|
|
334
334
|
|
|
335
335
|
根包本地产物:
|
|
336
336
|
|
|
337
337
|
```text
|
|
338
|
-
/Users/gaostudio/uni-base/csntgao-uni-base-0.
|
|
338
|
+
/Users/gaostudio/uni-base/csntgao-uni-base-0.6.6.tgz
|
|
339
339
|
```
|
|
340
340
|
|
|
341
341
|
这些 tarball 都是本地交付物,不应提交 Git。
|
|
@@ -348,8 +348,8 @@ pnpm lint
|
|
|
348
348
|
pnpm typecheck
|
|
349
349
|
pnpm test
|
|
350
350
|
pnpm build
|
|
351
|
-
pnpm --filter @
|
|
352
|
-
pnpm --filter @
|
|
351
|
+
pnpm --filter @csntgao/ai-employee-client pack
|
|
352
|
+
pnpm --filter @csntgao/ai-employee-web-components pack
|
|
353
353
|
```
|
|
354
354
|
|
|
355
355
|
代码再次修改后,旧 runtime 与 tarball 立即过期。纯文档修改不需要版本递增、构建、打包或发布。
|
|
@@ -362,9 +362,9 @@ pnpm --filter @uniplat/ai-employee-web-components pack
|
|
|
362
362
|
|
|
363
363
|
```text
|
|
364
364
|
Manifest: https://10.10.10.131:8787/current.json
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
Current: 0.29.5
|
|
366
|
+
Target: 0.29.6(本次 scope 迁移验证后发布)
|
|
367
|
+
Module: https://10.10.10.131:8787/releases/0.29.6/index.js
|
|
368
368
|
```
|
|
369
369
|
|
|
370
370
|
最后验证结果:
|
|
@@ -372,7 +372,7 @@ SHA-256: 60fbeac569ff3cb5e27f7e4ef650fc5114343c44b42a3be3f86ace1da1bb1de9
|
|
|
372
372
|
- `current.json`:HTTP 200、`Cache-Control: no-store`;
|
|
373
373
|
- 版本模块:HTTP 200、CORS `*`、`immutable`;
|
|
374
374
|
- 远端模块 hash 与本地一致;
|
|
375
|
-
- `current.json` 指向 `./releases/0.29.
|
|
375
|
+
- 发布前 `current.json` 指向 `./releases/0.29.5/index.js`;本次完成后应原子切换到 `./releases/0.29.6/index.js`。
|
|
376
376
|
|
|
377
377
|
静态服务未启动时可执行:
|
|
378
378
|
|
|
@@ -394,13 +394,12 @@ https://registry.npmjs.org/
|
|
|
394
394
|
|
|
395
395
|
```text
|
|
396
396
|
npm whoami csntgao(已登录)
|
|
397
|
-
@csntgao/uni-base
|
|
398
|
-
@
|
|
399
|
-
@
|
|
397
|
+
@csntgao/uni-base 0.6.5 已发布并回读校验;0.6.6 待本次发布
|
|
398
|
+
@csntgao/ai-employee-client 0.14.3 待首次发布
|
|
399
|
+
@csntgao/ai-employee-web-components 0.29.6 待首次发布
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
-
|
|
403
|
-
与本地打包一致。发布后远端 `npm view` 有几秒传播延迟,第一次回读到旧版本要重试再确认。注意该包没有 `main`/`exports`/`files`,发布内容是 91 个源码文件,
|
|
402
|
+
发布后远端 `npm view` 有几秒传播延迟,第一次回读到旧版本要重试再确认。注意根包没有 `main`/`exports`/`files`,发布内容是 workspace 源码,
|
|
404
403
|
不是可直接 `import` 的库;调用方仍应使用 runtime 或 workspace 包。
|
|
405
404
|
|
|
406
405
|
发布需要浏览器 2FA:该账号的第二因子是 passkey / WebAuthn,**没有 TOTP 六位码**,所以
|
|
@@ -416,11 +415,7 @@ script -q /dev/null npm publish <绝对路径或 tarball> --access public
|
|
|
416
415
|
注意两个陷阱:`npm publish packages/core` 会被当成 git 仓库简写;`npm publish <目录>`
|
|
417
416
|
不会改写 `workspace:*`,发布 web-components 必须使用 `pnpm pack` 生成的 tarball。
|
|
418
417
|
|
|
419
|
-
|
|
420
|
-
`@uniplat/html5-qrcode: read-write`,且该包 maintainer 是 `ytl003
|
|
421
|
-
<yanghua19970726@163.com>`,`npm org ls uniplat` 无输出,说明当前账号在该 scope 下
|
|
422
|
-
只有单包权限、没有创建新包的权限。需要 scope 所有者发布,或把 `@uniplat` 作为组织把
|
|
423
|
-
`csntgao` 加入并授予创建 public package 的权限;不要通过重命名内部包规避公开契约。
|
|
418
|
+
历史 `@uniplat/*` 包因 scope 权限未发布;本次经用户明确授权执行破坏性 scope 迁移,不再把它们作为发布目标。新包统一发布到账号自有的 `@csntgao/*` scope,Web Component 标签与运行时协议名称继续保持 `uniplat-*`。
|
|
424
419
|
|
|
425
420
|
## 9. 发布流程
|
|
426
421
|
|