@h-ai/cli 0.1.0-alpha.34 → 0.1.0-alpha.35
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.35",
|
|
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.35"
|
|
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.35",
|
|
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}}"],
|
|
@@ -92,10 +92,11 @@ memory:
|
|
|
92
92
|
| 工具执行 | `registry.executeAll(toolCalls)` | 支持并行执行 |
|
|
93
93
|
| MCP 服务 | `createMcpServer(...)` | 按需连接 HTTP/SSE/Stdio transport |
|
|
94
94
|
| Embedding | `ai.embedding.embedText(text)` | 批量用 `embedBatch` |
|
|
95
|
-
| 记忆 | `ai.memory.extract/recall/injectMemories` | 用 `objectId` 做主体隔离,`scope`
|
|
95
|
+
| 记忆 | `ai.memory.extract/recall/injectMemories` | 用 `objectId` 做主体隔离,`scope` 做业务作用域隔离;scope 隔离越细,`candidateMultiplier` 调大以防漏召回 |
|
|
96
|
+
| 角色人格 | `ai.persona.save/get/compose` | 定义 AI 身份(systemPrompt + traits),`compose` 组合系统提示词,`scope: { personaId }` 关联长期记忆 |
|
|
96
97
|
| Retrieval/RAG | `ai.retrieval.retrieve` / `ai.rag.query` | Retrieval source 先注册或由配置预置 |
|
|
97
98
|
| Knowledge | `ai.knowledge.setup/ingest/ask` | 入库前会调用 datapipe 清洗分块 |
|
|
98
|
-
| Context | `ai.context.createManager` | 编排 LLM + Memory + RAG +
|
|
99
|
+
| Context | `ai.context.createManager` | 编排 LLM + Memory + RAG + 压缩;`manager.consolidate()` 把会话固化为长期记忆 |
|
|
99
100
|
| A2A | `ai.a2a.registerExecutor/handleRequest` | 延迟初始化 SDK handler |
|
|
100
101
|
|
|
101
102
|
## LLM + 工具调用
|
|
@@ -222,6 +223,25 @@ const reply = await managerResult.data.chat('你好')
|
|
|
222
223
|
await managerResult.data.save()
|
|
223
224
|
```
|
|
224
225
|
|
|
226
|
+
### 真实对话状态(Conversation Commit Layer)
|
|
227
|
+
|
|
228
|
+
`turnCommit: 'manual'` 时,`chat` / `chatStream` 不自动写入生成文本,只返回 `turnId`;由调用方提交**实际发生的内容**(TTS 播放 / 主持人打断等场景):
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
const m = ai.context.createManager({ turnCommit: 'manual', scope }).data
|
|
232
|
+
for await (const ev of m.chatStream('展开讲讲')) {
|
|
233
|
+
if (ev.type === 'delta') feedTts(ev.text)
|
|
234
|
+
else if (ev.type === 'done') {
|
|
235
|
+
interrupted
|
|
236
|
+
? await m.interruptTurn(ev.turnId, { text: spokenSoFar }) // 只提交播放出去的部分
|
|
237
|
+
: await m.commitTurn(ev.turnId) // 完整提交
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
- 只有 `committed` 的内容进入上下文与记忆;`getTurns()` 可观测 `generated` / `committed` / `status`。
|
|
243
|
+
|
|
244
|
+
|
|
225
245
|
## SvelteKit API 端点模式
|
|
226
246
|
|
|
227
247
|
```ts
|
|
@@ -413,6 +413,25 @@ const p = usePlatform()
|
|
|
413
413
|
/>
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
+
#### Charts 图表
|
|
417
|
+
|
|
418
|
+
`Chart type='line'` 默认使用 LayerChart 原生折线图;监控看板类场景需要“分段线 + 圆点 + 最近点 hover + 竖向参考线”时,使用 `lineVariant='segmented-point'`:
|
|
419
|
+
|
|
420
|
+
```svelte
|
|
421
|
+
<Chart
|
|
422
|
+
type='line'
|
|
423
|
+
data={trendData}
|
|
424
|
+
x='label'
|
|
425
|
+
y={['rateLimit', 'circuitBreak']}
|
|
426
|
+
series={trendSeries}
|
|
427
|
+
lineVariant='segmented-point'
|
|
428
|
+
tooltipMode='nearest'
|
|
429
|
+
showCrosshair
|
|
430
|
+
legend
|
|
431
|
+
grid
|
|
432
|
+
/>
|
|
433
|
+
```
|
|
434
|
+
|
|
416
435
|
#### CRUD 场景组件
|
|
417
436
|
|
|
418
437
|
| 组件 | 说明 |
|