@tbox.cn/app-template-agent 0.10.1 → 0.10.3

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.
@@ -41,17 +41,32 @@ const vite = await createViteServer({
41
41
  appType: 'custom',
42
42
  });
43
43
 
44
- // 升级委托:与 vite hmrServerWsListener 同条件(协议整串匹配 + pathname === 认领路径)。
45
- // viteHmrPath 与 vite 同一 resolved config、同式 posix.join 派生——恒等无漂移(字面比较
46
- // 在未来设 base 时有悬挂方向:delegate 认领转发而 vite 不接,socket 无人销毁)。协议轴
47
- // 必须保留:hub 是纯事件载体无 destroy,仅匹配 path 的非 vite 协议升级会转发后无人认领。
44
+ // 升级委托:pathname === 认领路径(与 vite 同一 resolved config 同式 posix.join 派生——
45
+ // 恒等无漂移,字面比较在未来设 base 时有悬挂方向:delegate 认领转发而 vite 不接,socket
46
+ // 无人销毁);协议轴 = 子协议补写 + 白名单(见下)。
47
+ // 子协议补写(2026-09-21,详见 .agents/notes/implemented/bug-fix/
48
+ // 2026-09-21-spanner-ws-subprotocol-strip-reload-loop.md):Spanner 网关(*.coding.tboxpro.cn
49
+ // 车道)把 WS 升级的 Sec-WebSocket-Protocol 视为 hop-by-hop 在下游拨号时剥除(2026-09-09
50
+ // Terminal Note 同源实证:Authorization/Cookie/子协议均剥、query 唯一存活)。剥除后的拨号
51
+ // 无协议头——原逻辑不认领 → 回落 app upgrade destroy → 网关报 "unexpected EOF";WebKit
52
+ // (Safari/iOS 支付宝·微信)宽松接受网关乐观 101(无协议回显),hmr WS open 即断 → vite
53
+ // client vite:ws:disconnect → vite-ping 探测又被乐观 101 放行(成功判据 = open 事件,先于
54
+ // 下游拨号结果)→ location.reload() 无限循环(Chrome/Blink 严格校验协议回显恒不 open,
55
+ // 走静默分支免疫)。补写让下游握手成立:vite 101 带协议回显 + connected → 连接保持 →
56
+ // 无 disconnect/ping/reload,WebKit 下 HMR 恢复可用。补写在网关透传修复(agtchannel spec
57
+ // 2026-09-21 close/握手头透传,1b)落地后自动退化为死分支——长留不移除(sync 覆盖 + DRM
58
+ // 回滚场景防回归载体)。其余非 vite 协议值仍不认领(smoke ⑤⑥ 语义不变)。
48
59
  // 未认领的升级回落 app 路由(业务 /ws、根路径归还业务、fail-fast 语义不变)。
49
60
  const viteHmrPath = path.posix.join(vite.config.base, HMR_WS_PATH);
50
61
  registerUpgradeDelegate((request, socket, head) => {
51
- const protocol = request.headers['sec-websocket-protocol'];
52
- if (protocol !== 'vite-hmr' && protocol !== 'vite-ping') return false;
53
62
  const { pathname } = new URL(request.url || '/', 'http://localhost');
54
63
  if (pathname !== viteHmrPath) return false;
64
+ const protocol = request.headers['sec-websocket-protocol'];
65
+ if (!protocol) {
66
+ request.headers['sec-websocket-protocol'] = 'vite-hmr';
67
+ } else if (protocol !== 'vite-hmr' && protocol !== 'vite-ping') {
68
+ return false;
69
+ }
55
70
  hmrHub.emit('upgrade', request, socket, head);
56
71
  return true;
57
72
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-template-agent",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "tbox AI Agent 全栈模板(多包 pnpm workspace):apps/client + apps/server。唯一模板(W4 单一模板统一化:缺省空装配 chat 形态;mall 能力经 profiles/mall 加装),能力经 tbox-app module add 模块扩展(shopping-guide/member 等)。",
5
5
  "engines": {
6
6
  "node": ">=24.0.0 <25.0.0"
@@ -19,11 +19,11 @@ catalogs:
19
19
  specifier: 0.1.1
20
20
  version: 0.1.1
21
21
  '@tbox.cn/app-agent-sdk-server':
22
- specifier: 0.1.1
23
- version: 0.1.1
22
+ specifier: 0.1.2
23
+ version: 0.1.2
24
24
  '@tbox.cn/app-contracts':
25
- specifier: 0.12.0
26
- version: 0.12.0
25
+ specifier: 0.12.1
26
+ version: 0.12.1
27
27
  '@tbox.cn/app-contracts-mall':
28
28
  specifier: 0.12.1
29
29
  version: 0.12.1
@@ -31,8 +31,8 @@ catalogs:
31
31
  specifier: 0.21.0
32
32
  version: 0.21.0
33
33
  '@tbox.cn/app-theme-tbox':
34
- specifier: 0.1.2
35
- version: 0.1.2
34
+ specifier: 0.1.3
35
+ version: 0.1.3
36
36
  '@types/express':
37
37
  specifier: 4.17.25
38
38
  version: 4.17.25
@@ -145,10 +145,10 @@ importers:
145
145
  version: 0.1.1(@types/react@18.3.31)
146
146
  '@tbox.cn/app-contracts':
147
147
  specifier: 'catalog:'
148
- version: 0.12.0
148
+ version: 0.12.1
149
149
  '@tbox.cn/app-theme-tbox':
150
150
  specifier: 'catalog:'
151
- version: 0.1.2
151
+ version: 0.1.3
152
152
  react:
153
153
  specifier: 'catalog:'
154
154
  version: 18.3.1
@@ -206,10 +206,10 @@ importers:
206
206
  version: 0.1.0(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2)(rxjs@7.8.1)(zod@3.25.76))(@tbox-dev-js/sdk@0.1.18)(zod@3.25.76)
207
207
  '@tbox.cn/app-agent-sdk-server':
208
208
  specifier: 'catalog:'
209
- version: 0.1.1(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)
209
+ version: 0.1.2(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)
210
210
  '@tbox.cn/app-contracts':
211
211
  specifier: 'catalog:'
212
- version: 0.12.0
212
+ version: 0.12.1
213
213
  express:
214
214
  specifier: 'catalog:'
215
215
  version: 4.22.2
@@ -249,7 +249,7 @@ importers:
249
249
  version: 0.1.1(@types/react@18.3.31)
250
250
  '@tbox.cn/app-contracts':
251
251
  specifier: 'catalog:'
252
- version: 0.12.0
252
+ version: 0.12.1
253
253
  antd-mobile:
254
254
  specifier: 'catalog:'
255
255
  version: 5.42.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -317,10 +317,10 @@ importers:
317
317
  version: 0.1.1(@types/react@18.3.31)
318
318
  '@tbox.cn/app-agent-sdk-server':
319
319
  specifier: 'catalog:'
320
- version: 0.1.1(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)
320
+ version: 0.1.2(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)
321
321
  '@tbox.cn/app-contracts':
322
322
  specifier: 'catalog:'
323
- version: 0.12.0
323
+ version: 0.12.1
324
324
  devDependencies:
325
325
  '@types/node':
326
326
  specifier: 24.13.3
@@ -1339,8 +1339,8 @@ packages:
1339
1339
  resolution: {integrity: sha512-+HynOgllJS7dupTYTQ5R/5Ajpp5ErOVvGl/dz0wNBb/oZQxKgV0/ePQSxrlS1YnFXsiA9mzELdASz6CudOP/4A==}
1340
1340
  engines: {node: '>=20.0.0'}
1341
1341
 
1342
- '@tbox.cn/app-agent-sdk-server@0.1.1':
1343
- resolution: {integrity: sha512-0KmAWR+wZODm5oRJ6IPgKfFFz49V8ACnetaFShgl5HI2HSianWWMECAWdyxdwp4hBOAMQU+IG6t2sz0gyE0UNQ==}
1342
+ '@tbox.cn/app-agent-sdk-server@0.1.2':
1343
+ resolution: {integrity: sha512-qS9RDPAGHiFB+FesBtgc2QLZnGNgXrG62fCyPQ663Cb9xfF0Fs0r+fTPXpG2ewsBkoST7c1oy/ZlfMO85o7/pw==}
1344
1344
  engines: {node: '>=20.0.0'}
1345
1345
 
1346
1346
  '@tbox.cn/app-contracts-mall@0.12.1':
@@ -1351,6 +1351,10 @@ packages:
1351
1351
  resolution: {integrity: sha512-GFthajvUSE7tY6Y5kLJgg2dRuZQdLfxq/WAEHOh+Q7RTwg7mpuLsWiNhXISkXMAtpxg0RkSgtwyRq33QS0ay3w==}
1352
1352
  engines: {node: '>=20.0.0'}
1353
1353
 
1354
+ '@tbox.cn/app-contracts@0.12.1':
1355
+ resolution: {integrity: sha512-h5HXIfk5frNx6hufY2IBE+hISCk3/2n8A7G3EtnAF4JsR91Pm/uwdmn4zYtZOz0r9cL7Wk1SrUMcokMZ9HkbLw==}
1356
+ engines: {node: '>=20.0.0'}
1357
+
1354
1358
  '@tbox.cn/app-sdk-client@0.21.1':
1355
1359
  resolution: {integrity: sha512-hN+tIj8kh11PD0HMhq5KUs/nZYjxS+ps3F3HTTmOHWXNXzilYafFxeIWJ1bXKVm1Di5EUIjNaRPUDkP6HAcHvw==}
1356
1360
  engines: {node: '>=20.0.0'}
@@ -1359,13 +1363,17 @@ packages:
1359
1363
  resolution: {integrity: sha512-hvdcXntg4iJniVu9LEwo5A/vov3L08kRlJLTgStYRdAlH9AJXWLDxFITMNf7YJX8W+j9wjJmmS7Sv88iswxM+w==}
1360
1364
  engines: {node: '>=20.0.0'}
1361
1365
 
1366
+ '@tbox.cn/app-sdk-core@0.20.1':
1367
+ resolution: {integrity: sha512-OSncc0sjhcuEQAlcANLCKNP0V+hgVhP0qol6pIyYSxSUUVLf69naiGWC4CBtY7PTIYlhximMw6bIn8tqNYKFXg==}
1368
+ engines: {node: '>=20.0.0'}
1369
+
1362
1370
  '@tbox.cn/app-sdk-server@0.21.0':
1363
1371
  resolution: {integrity: sha512-buiwhnT46Jb1P99UJN1p0ATjRzhFIXIgqIYQDT4aT3fVbmMxWUuAPpFYhM3uTFGx5oPh18/ju3MVz0FxZ5DMCg==}
1364
1372
  engines: {node: '>=20.0.0'}
1365
1373
  hasBin: true
1366
1374
 
1367
- '@tbox.cn/app-theme-tbox@0.1.2':
1368
- resolution: {integrity: sha512-/0x1XjcE1dDgQ4CTaqcXFZjWS47JQ2u7JS2jAbORTqrSmo7F0X/3m4LsH+WHAn+2r709KIRFh99NT3iMYqci2g==}
1375
+ '@tbox.cn/app-theme-tbox@0.1.3':
1376
+ resolution: {integrity: sha512-Wf2umpT/k+Ppy1oKuCDqe6M5yvp4F/tjdGpU7uygGWMaEduwFnoK0EVh4eDcA6dMlERLCAjxFlEUY68xXGq99A==}
1369
1377
 
1370
1378
  '@tbox.cn/app-toolkit@0.5.0':
1371
1379
  resolution: {integrity: sha512-ShLYwxsMzhr8V5sjixo4GFGBZbAw4/8CoTnCigrbBcRLtydf2ezLrLDR9jHfi/d5fQworFR5ZBzI7xDSjvR2zA==}
@@ -4081,7 +4089,7 @@ snapshots:
4081
4089
  - '@types/react'
4082
4090
  - immer
4083
4091
 
4084
- '@tbox.cn/app-agent-sdk-server@0.1.1(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)':
4092
+ '@tbox.cn/app-agent-sdk-server@0.1.2(@tbox-dev-js/sdk@0.1.18)(rxjs@7.8.1)':
4085
4093
  dependencies:
4086
4094
  '@ag-ui/core': 0.0.47
4087
4095
  '@ai-sdk/openai-compatible': 2.0.68(zod@3.25.76)
@@ -4089,8 +4097,8 @@ snapshots:
4089
4097
  '@mastra/core': 1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2)(rxjs@7.8.1)(zod@3.25.76)
4090
4098
  '@mastra/observability': 1.16.5(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2)(rxjs@7.8.1)(zod@3.25.76))(zod@3.25.76)
4091
4099
  '@tbox.cn/agent-plugin': 0.1.0(@mastra/core@1.59.0(ai@6.0.246(zod@3.25.76))(express@4.22.2)(rxjs@7.8.1)(zod@3.25.76))(@tbox-dev-js/sdk@0.1.18)(zod@3.25.76)
4092
- '@tbox.cn/app-contracts': 0.12.0
4093
- '@tbox.cn/app-sdk-core': 0.20.0
4100
+ '@tbox.cn/app-contracts': 0.12.1
4101
+ '@tbox.cn/app-sdk-core': 0.20.1
4094
4102
  '@tbox.cn/app-sdk-server': 0.21.0
4095
4103
  ai: 6.0.246(zod@3.25.76)
4096
4104
  express: 4.22.2
@@ -4120,6 +4128,12 @@ snapshots:
4120
4128
  react: 18.3.1
4121
4129
  zod: 3.25.76
4122
4130
 
4131
+ '@tbox.cn/app-contracts@0.12.1':
4132
+ dependencies:
4133
+ '@ag-ui/core': 0.0.47
4134
+ react: 18.3.1
4135
+ zod: 3.25.76
4136
+
4123
4137
  '@tbox.cn/app-sdk-client@0.21.1':
4124
4138
  dependencies:
4125
4139
  '@tbox.cn/app-contracts': 0.12.0
@@ -4131,6 +4145,10 @@ snapshots:
4131
4145
  dependencies:
4132
4146
  '@tbox.cn/app-contracts': 0.12.0
4133
4147
 
4148
+ '@tbox.cn/app-sdk-core@0.20.1':
4149
+ dependencies:
4150
+ '@tbox.cn/app-contracts': 0.12.1
4151
+
4134
4152
  '@tbox.cn/app-sdk-server@0.21.0':
4135
4153
  dependencies:
4136
4154
  '@ag-ui/core': 0.0.47
@@ -4143,7 +4161,7 @@ snapshots:
4143
4161
  transitivePeerDependencies:
4144
4162
  - supports-color
4145
4163
 
4146
- '@tbox.cn/app-theme-tbox@0.1.2': {}
4164
+ '@tbox.cn/app-theme-tbox@0.1.3': {}
4147
4165
 
4148
4166
  '@tbox.cn/app-toolkit@0.5.0':
4149
4167
  dependencies:
@@ -38,14 +38,14 @@ catalog:
38
38
  ws: 8.21.3
39
39
  "@types/ws": 8.18.1
40
40
  "@tbox.cn/agent-plugin": 0.1.0
41
- "@tbox.cn/app-sdk-core": 0.20.0
41
+ "@tbox.cn/app-sdk-core": 0.20.1
42
42
  "@tbox.cn/app-sdk-client": 0.21.1
43
43
  "@tbox.cn/app-sdk-server": 0.21.0
44
- "@tbox.cn/app-agent-sdk-server": 0.1.1
44
+ "@tbox.cn/app-agent-sdk-server": 0.1.2
45
45
  "@tbox.cn/app-agent-sdk-client": 0.1.1
46
- "@tbox.cn/app-contracts": 0.12.0
46
+ "@tbox.cn/app-contracts": 0.12.1
47
47
  "@tbox.cn/app-contracts-mall": 0.12.1
48
- "@tbox.cn/app-theme-tbox": 0.1.2
48
+ "@tbox.cn/app-theme-tbox": 0.1.3
49
49
  zustand: 4.5.7
50
50
  eslint: 9.39.5
51
51
  typescript-eslint: 8.67.0