@h-ai/cli 0.1.0-alpha.38 → 0.1.0-alpha.40
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": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.40",
|
|
5
5
|
"description": "Hai Framework CLI for project scaffolding and code generation.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ora": "^9.1.0",
|
|
35
35
|
"prompts": "^2.4.2",
|
|
36
36
|
"yaml": "^2.7.0",
|
|
37
|
-
"@h-ai/core": "0.1.0-alpha.
|
|
37
|
+
"@h-ai/core": "0.1.0-alpha.40"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.40",
|
|
4
4
|
"private": true,
|
|
5
5
|
"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}}",
|
|
6
6
|
"keywords": ["hai", {{#unless isSvelteOnlyApp}}"sveltekit", {{/unless}}"svelte5", "{{appType}}"],
|
|
@@ -113,7 +113,7 @@ memory:
|
|
|
113
113
|
| 工具执行 | `registry.execute(tc, { signal, objectId, sessionId, deadline?, timeoutMs?, authorize? })` / `executeAll(...)` | Registry/单次授权必须同时通过;默认串行,支持取消/超时;只有确认无副作用时才 `parallel: true` |
|
|
114
114
|
| MCP 服务 | `createMcpServer(...)` | 按需连接 HTTP/SSE/Stdio transport |
|
|
115
115
|
| Embedding | `ai.embedding.embedText(text)` | 批量用 `embedBatch` |
|
|
116
|
-
| 记忆 | `ai.memory.extract/recall/injectMemories` |
|
|
116
|
+
| 记忆 | `ai.memory.extract/recall/injectMemories` | `extract(..., { signal })` 可取消整条提取链;用 `objectId` 做主体隔离,`scope` 做业务作用域隔离;scope 隔离越细,`candidateMultiplier` 调大以防漏召回 |
|
|
117
117
|
| 记忆作用域 | `ai.memory.scoped({ objectId, scope })` | **多租户推荐入口**:所有操作自动绑定 objectId/scope(含归属校验);`clear` 仅清作用域内 |
|
|
118
118
|
| 记忆管理 | `ai.memory.admin.clearAll({ confirm: true })` | 唯一的全局清空入口(需显式确认);`ai.memory.clear()` 空过滤会被拒绝,防误清全局 |
|
|
119
119
|
| 角色人格 | `ai.persona.save/get/compose` | 定义 AI 身份(systemPrompt + traits),`compose` 组合系统提示词;按 `objectId` 隔离多租户(不传默认 `system` 平台角色),`scope: { personaId }` 关联长期记忆 |
|
|
@@ -224,6 +224,8 @@ if (!compressed.success) return compressed
|
|
|
224
224
|
const answer = await ai.rag.query('核心架构是什么?', { sources: ['docs'], topK: 5 })
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
`tryCompress` 的成功结果一定满足 `compressedTokens <= maxTokens`。如果永久 system 指令、最近消息或最新 user 输入自身已超过预算,会返回 `HaiAIError.CONTEXT_BUDGET_EXCEEDED`;调用方应停止本次模型请求或提高预算,不能继续发送原始超长消息。
|
|
228
|
+
|
|
227
229
|
知识库流程:
|
|
228
230
|
|
|
229
231
|
```ts
|
|
@@ -94,7 +94,7 @@ Embedding OpenAI 客户端按 `apiKey + baseURL + timeout` 缓存;同一 key
|
|
|
94
94
|
|
|
95
95
|
| 方法 | 说明 |
|
|
96
96
|
| --- | --- |
|
|
97
|
-
| `extract(messages, options?)` |
|
|
97
|
+
| `extract(messages, options?)` | 从对话提取记忆并存储;`options.signal` 可取消事实抽取及 native 对账调用 |
|
|
98
98
|
| `add(entry)` | 手动添加记忆 |
|
|
99
99
|
| `get(memoryId, accessScope?)` / `update(memoryId, updates, accessScope?)` | 读取/更新(传 `accessScope: { objectId, scope? }` 做归属校验,不匹配→ `MEMORY_NOT_FOUND`) |
|
|
100
100
|
| `recall(query, options?)` | 检索相关记忆 |
|