@h-ai/cli 1.0.0-beta.24 → 1.0.0-beta.25
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.25",
|
|
5
5
|
"description": "Hai Framework CLI for project scaffolding and code generation.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"node": "^22.23.4 || ^24.22.1 || ^26.12.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@h-ai/core": "1.0.0-beta.
|
|
33
|
+
"@h-ai/core": "1.0.0-beta.25",
|
|
34
34
|
"cac": "^7.1.0",
|
|
35
35
|
"chalk": "^6.0.1",
|
|
36
36
|
"fast-wrap-ansi": "^0.2.2",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"yaml": "^2.9.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@h-ai/api-client": "1.0.0-beta.
|
|
45
|
-
"@h-ai/cache": "1.0.0-beta.
|
|
46
|
-
"@h-ai/crypto": "1.0.0-beta.
|
|
47
|
-
"@h-ai/deploy": "1.0.0-beta.
|
|
48
|
-
"@h-ai/feedback": "1.0.0-beta.
|
|
49
|
-
"@h-ai/iam": "1.0.0-beta.
|
|
50
|
-
"@h-ai/kit": "1.0.0-beta.
|
|
51
|
-
"@h-ai/payment": "1.0.0-beta.
|
|
52
|
-
"@h-ai/reach": "1.0.0-beta.
|
|
53
|
-
"@h-ai/reldb": "1.0.0-beta.
|
|
54
|
-
"@h-ai/storage": "1.0.0-beta.
|
|
55
|
-
"@h-ai/vecdb": "1.0.0-beta.
|
|
44
|
+
"@h-ai/api-client": "1.0.0-beta.25",
|
|
45
|
+
"@h-ai/cache": "1.0.0-beta.25",
|
|
46
|
+
"@h-ai/crypto": "1.0.0-beta.25",
|
|
47
|
+
"@h-ai/deploy": "1.0.0-beta.25",
|
|
48
|
+
"@h-ai/feedback": "1.0.0-beta.25",
|
|
49
|
+
"@h-ai/iam": "1.0.0-beta.25",
|
|
50
|
+
"@h-ai/kit": "1.0.0-beta.25",
|
|
51
|
+
"@h-ai/payment": "1.0.0-beta.25",
|
|
52
|
+
"@h-ai/reach": "1.0.0-beta.25",
|
|
53
|
+
"@h-ai/reldb": "1.0.0-beta.25",
|
|
54
|
+
"@h-ai/storage": "1.0.0-beta.25",
|
|
55
|
+
"@h-ai/vecdb": "1.0.0-beta.25",
|
|
56
56
|
"@types/fs-extra": "^11.0.4",
|
|
57
57
|
"@types/node": "^26.6.6",
|
|
58
58
|
"@types/prompts": "^2.4.9",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"engines": { "node": "^22.23.4 || ^24.22.1 || ^26.12.1" },
|
|
3
3
|
"name": "{{projectName}}",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.25",
|
|
5
5
|
"private": true,
|
|
6
6
|
"packageManager": "pnpm@12.11.2",
|
|
7
7
|
"description": "{{#if_eq appType 'admin'}}Enterprise management system built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'website'}}Enterprise website built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'h5'}}Mobile H5 app built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'api'}}REST API service built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'mobile-app'}}Mobile app built with hai Agent Framework{{/if_eq}}",
|
|
@@ -104,7 +104,11 @@ function prepareTools(url: string, authorize: MCPServiceBrokerOptions['authorize
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
创建绑定时,工具入口按工具独立编译输入 Schema,并检查目录白名单。每次调用重新检查业务权限和目录,网络重定向会失败。`bindTools` 收到的是 Worker 生命周期信号。示例直接返回 `bound.data`,其中的 `signal` 会在绑定到期或被撤销时终止;默认有效期为 15 分钟,可通过 `ttlMs` 调整。会话关闭、Worker 失租或服务停止时撤销绑定。凭据在轮次中失效会取消本轮,后续调用返回 `ACP_CLOSED`。要继续使用工具,显式创建新会话,并按需带入用户授权的历史摘要。多个执行节点分别挂载自己的入口,使 Agent 始终访问签发本次凭据的节点。
|
|
108
|
+
|
|
109
|
+
应用使用 `scoped.approvals.rules(offset, limit)` 分页查看有效规则,使用 `revoke(id)` 撤销。`permissions.ruleIds` 可只启用指定持久规则,切换为 `approval: 'never'` 仍可复用同一执行安全范围的已授权操作。升级后,按旧 Worker 快照保存的规则仍可查看和撤销,继续使用时需重新授权。标准 Store 会在后台限批清理到期规则和已过期审批。
|
|
110
|
+
|
|
111
|
+
受管会话、任务索引和幂等意图的保留期至少为 7 天。对应 Runner 记录清理后,ACP 执行节点才清理关联数据。仍活动或未核验的 `unknown` 执行受保留保护。自定义关系 Store 通过 `queryKeys` 和 `removeIfUnchanged` 接入后台清理。Runner 的 `retentionMs` 控制执行记录的保留期,应用应单独保存需要长期展示的业务历史。
|
|
108
112
|
|
|
109
113
|
## 最小本机接入
|
|
110
114
|
|
|
@@ -237,7 +237,19 @@ IndexTTS 的 Node HTTP 请求使用同版本 Undici fetch/Agent/FormData;模
|
|
|
237
237
|
|
|
238
238
|
## LLM 结构化输出
|
|
239
239
|
|
|
240
|
-
`ai.llm.generateObject({ schema, messages, model?, systemPrompt?, maxRepairs?, signal? })
|
|
240
|
+
`ai.llm.generateObject({ schema, messages, model?, systemPrompt?, responseFormat?, schemaName?, maxRepairs?, signal? })` 适用于意图分类等需要结构化结果的场景。默认 `responseFormat: 'json_schema'` 向上游发送严格 Schema,仅在此模式使用 `schemaName`,默认 `result`。只支持通用 JSON 模式的 Chat 网关使用 `'json_object'`,框架将 Schema 加入提示词。两种模式都在本地用相同 Zod Schema 校验。解析或校验失败时按 `maxRepairs` 重试,默认再尝试一次。
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { ai } from '@h-ai/ai'
|
|
244
|
+
import { z } from 'zod'
|
|
245
|
+
|
|
246
|
+
const result = await ai.llm.generateObject({
|
|
247
|
+
schema: z.object({ intent: z.enum(['question', 'request']) }), // 定义允许的分类。
|
|
248
|
+
messages: [{ role: 'user', content: '如何部署?' }], // 输入待分类文本。
|
|
249
|
+
responseFormat: 'json_object', // 用于只提供通用 JSON 的 Chat 网关。
|
|
250
|
+
})
|
|
251
|
+
if (result.success) process.stdout.write(result.data.intent) // 示例输出 question。
|
|
252
|
+
```
|
|
241
253
|
|
|
242
254
|
## A2A
|
|
243
255
|
|