@qfei-design/make-ai-assistant 0.1.0
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/PUBLIC_API.md +120 -0
- package/README.md +125 -0
- package/artifact-v1.schema.json +318 -0
- package/capabilities.json +60 -0
- package/dist/conversation-B5kECJz8.js +595 -0
- package/dist/conversation-DpYszfVd.cjs +1 -0
- package/dist/core/conversation.d.ts +72 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/registry.d.ts +19 -0
- package/dist/core/sse-transport.d.ts +40 -0
- package/dist/core/text.d.ts +1 -0
- package/dist/core/types.d.ts +167 -0
- package/dist/core/validation.d.ts +14 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +64 -0
- package/dist/react/artifact-renderer.d.ts +12 -0
- package/dist/react/artifact-templates.d.ts +11 -0
- package/dist/react/format.d.ts +2 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/make-ai-assistant.d.ts +27 -0
- package/dist/react/scale.d.ts +5 -0
- package/dist/react.cjs +1 -0
- package/dist/react.mjs +661 -0
- package/dist/sse.cjs +8 -0
- package/dist/sse.d.ts +1 -0
- package/dist/sse.mjs +157 -0
- package/dist/styles.css +615 -0
- package/dist/styles.css.d.ts +2 -0
- package/dist/testing/fixtures.d.ts +10 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing.cjs +1 -0
- package/dist/testing.mjs +132 -0
- package/docs/artifact-v1.md +101 -0
- package/docs/backend-contract.md +94 -0
- package/package.ai.json +52 -0
- package/package.json +115 -0
- package/recipes.json +81 -0
package/PUBLIC_API.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Public API Contract
|
|
2
|
+
|
|
3
|
+
## Entrypoints
|
|
4
|
+
|
|
5
|
+
- `@qfei-design/make-ai-assistant`:headless Artifact、会话、模板注册和 transport 合同。
|
|
6
|
+
- `@qfei-design/make-ai-assistant/react`:React 助手壳、ArtifactRenderer 和平台模板。
|
|
7
|
+
- `@qfei-design/make-ai-assistant/sse`:基于 Fetch、ReadableStream 的浏览器/现代 Node SSE transport;公开声明不要求 TypeScript `DOM` lib。
|
|
8
|
+
- `@qfei-design/make-ai-assistant/testing`:Mock transport 和通用 fixtures,仅用于开发、测试与 Gallery。
|
|
9
|
+
- `@qfei-design/make-ai-assistant/styles.css`:助手壳与默认模板样式。
|
|
10
|
+
- `@qfei-design/make-ai-assistant/artifact-v1.schema.json`:服务端与工具使用的机器可读 Schema。
|
|
11
|
+
|
|
12
|
+
禁止宿主从 `src`、`dist` 或包内部路径导入。
|
|
13
|
+
|
|
14
|
+
## Headless exports
|
|
15
|
+
|
|
16
|
+
- `validateArtifact` / `parseArtifact`
|
|
17
|
+
- `createArtifactTemplateRegistry`
|
|
18
|
+
- `extendArtifactTemplateRegistry`
|
|
19
|
+
- `resolveArtifactTemplate`
|
|
20
|
+
- `createArtifactCapabilities`
|
|
21
|
+
- `createAssistantConversationState`
|
|
22
|
+
- `appendUserMessage`
|
|
23
|
+
- `reduceAssistantEvent`
|
|
24
|
+
- `parseAssistantEvent`
|
|
25
|
+
- `AssistantTransport`
|
|
26
|
+
- `AssistantEvent`
|
|
27
|
+
- `MakeAiArtifact` 及所有 V1 Artifact 类型
|
|
28
|
+
- `MakeAssistantHostContext`
|
|
29
|
+
- `ArtifactAction` / `ArtifactActionHandler`
|
|
30
|
+
- `ArtifactActionErrorHandler`
|
|
31
|
+
|
|
32
|
+
根入口没有 React 或 DOM 类型依赖,可以在 Service、测试和协议工具中使用。需要直接使用
|
|
33
|
+
Fetch SSE 实现时,从 `/sse` 入口导入 `createSseAssistantTransport`。
|
|
34
|
+
|
|
35
|
+
## React exports
|
|
36
|
+
|
|
37
|
+
- `MakeAiAssistant`:默认浮动入口与右侧抽屉;支持受控开关和自定义 launcher。
|
|
38
|
+
- `AssistantPanel`:不带 Drawer 的嵌入式会话面板。
|
|
39
|
+
- `ArtifactRenderer`:注册表驱动的单 Artifact 渲染器。
|
|
40
|
+
- `createPlatformArtifactRegistry`
|
|
41
|
+
- `platformArtifactTemplates`
|
|
42
|
+
- `ReactArtifactTemplate`
|
|
43
|
+
- `ReactArtifactTemplateRegistry`
|
|
44
|
+
- `formatArtifactValue`
|
|
45
|
+
|
|
46
|
+
`ArtifactRenderer`、`AssistantPanel` 和 `MakeAiAssistant` 支持 `onActionError`。当宿主
|
|
47
|
+
`onAction` 同步抛错或返回 rejected Promise 时,包会把错误、动作和上下文交还给
|
|
48
|
+
`onActionError`;未提供回调时只记录不含敏感上下文的失败日志,不产生未处理的
|
|
49
|
+
Promise rejection。`onActionError` 自身同步抛错或返回 rejected Promise 时也会被包隔离,
|
|
50
|
+
不会污染宿主的全局未处理异常。
|
|
51
|
+
|
|
52
|
+
## AssistantTransport
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
interface AssistantTransport {
|
|
56
|
+
run(
|
|
57
|
+
request: AssistantRunRequest,
|
|
58
|
+
options?: { signal?: AbortSignal },
|
|
59
|
+
): AsyncIterable<AssistantEvent>;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
传输边界支持中断。UI 在停止时会立即回到可输入状态、忽略迟到事件,并尝试关闭
|
|
64
|
+
AsyncIterator,因此即使自定义 transport 没有及时响应 `AbortSignal`,也不会一直卡在
|
|
65
|
+
streaming。真实实现可以读取 fetch SSE,也可以把 AG-UI runtime 事件归一化为包事件。
|
|
66
|
+
UI 不直接请求固定 URL。
|
|
67
|
+
|
|
68
|
+
`/sse` 的 `createSseAssistantTransport` 实现 `docs/backend-contract.md` 中的标准命名 SSE
|
|
69
|
+
事件;宿主只配置 Service endpoint、credentials、可选 headers 和单事件字符上限
|
|
70
|
+
`maxEventCharacters`(默认 1,000,000)。公开 `SseFetch`、headers 和 credentials 类型由包
|
|
71
|
+
自身声明,可在只启用 `ES2022` + Node types 的 TypeScript 项目中消费。非标准或旧协议由
|
|
72
|
+
宿主 adapter 转换。
|
|
73
|
+
|
|
74
|
+
SSE 流必须以 `run.complete`、`run.cancelled` 或 `error` 结束。连接在终止事件前关闭会
|
|
75
|
+
被视为可重试的 transport 错误,避免 UI 永久停留在 streaming 状态。终止事件、解析
|
|
76
|
+
失败、超限、Abort 和消费者提前结束都会取消并释放 response reader。
|
|
77
|
+
|
|
78
|
+
用户输入与单次响应文本默认各限制为 100,000 字符。Artifact 的集合、字符串、JSON
|
|
79
|
+
深度/节点/累计文本和校验问题数量也有固定预算;超限输入会被拒绝,不会继续遍历或
|
|
80
|
+
进入 React 模板。React UI 会在消费任意 `AssistantTransport` 时再次调用
|
|
81
|
+
`parseArtifact`,自定义 transport 也不能绕过运行时白名单。
|
|
82
|
+
|
|
83
|
+
自定义 transport 抛出的任意异常不会直接展示给用户;UI 只展示包自身的可控校验/
|
|
84
|
+
限制消息或通用“连接失败,请重试”,完整内部错误应由宿主在 transport 边界记录。
|
|
85
|
+
|
|
86
|
+
单个 run 最多接收 20 条 assistant message 和 50 个 Artifact。根入口、`/sse` 和
|
|
87
|
+
`/testing` 可在没有安装 React 的 headless/Node 工程中单独使用;React 与 ReactDOM 是
|
|
88
|
+
可选 peer,只有使用 `/react` 时才需要安装。
|
|
89
|
+
|
|
90
|
+
自定义 transport 必须保持 `message.start -> delta/artifact -> message.complete` 的消息
|
|
91
|
+
顺序,并保证同一会话内 message id、同一 run 内 Artifact id 唯一,且 run id 前后一致;
|
|
92
|
+
UI 会拒绝孤立、迟到、重复或跨 run 混入的事件,避免静默丢数据和 React key 冲突。
|
|
93
|
+
输入和流式文本长度按 Unicode code point 计算,与 Artifact 字符上限语义一致。
|
|
94
|
+
|
|
95
|
+
所有 transport 事件在进入 UI 前都会由 headless `parseAssistantEvent` 检查事件类型、
|
|
96
|
+
字段白名单、必填值、identifier 长度与 Artifact;宿主 adapter 也可以直接复用该函数。
|
|
97
|
+
|
|
98
|
+
## Host responsibilities
|
|
99
|
+
|
|
100
|
+
Host app provides context, transport, action execution, permission checks, Service routes, authentication and routing. The package provides the presentation runtime and contracts, but does not access Make API and does not execute server-generated HTML.
|
|
101
|
+
|
|
102
|
+
Artifact 的 `action.target` 只是 JSON 意图。宿主必须根据当前权限和支持能力验证后再执行。
|
|
103
|
+
组件只说明上下文会随请求发送;数据权限以宿主服务端重新鉴权的结果为准,包本身不作
|
|
104
|
+
权限承诺。
|
|
105
|
+
|
|
106
|
+
`presentation.density` 会映射为默认 Artifact 的 compact/comfortable 密度,
|
|
107
|
+
`action.appearance` 会映射为 primary/secondary/link 视觉层级;两者都只是已校验的样式语义,
|
|
108
|
+
不会触发动态代码。独立使用 `AssistantPanel` 或 `ArtifactRenderer` 时仍会获得包级主题变量、
|
|
109
|
+
盒模型和键盘焦点样式。
|
|
110
|
+
|
|
111
|
+
模板注册表会在运行时拒绝未知 kind、非有限 priority 以及非法 render/canRender 回调,
|
|
112
|
+
并把注册项复制冻结;调用方不能在注册后通过突变改变全局模板选择。
|
|
113
|
+
|
|
114
|
+
## Compatibility
|
|
115
|
+
|
|
116
|
+
- npm 包版本与 Artifact schemaVersion 独立;
|
|
117
|
+
- 当前只接受 `schemaVersion: "1.0"`;
|
|
118
|
+
- 未注册模板安全降级;
|
|
119
|
+
- `presentation.template` 不会触发代码加载;
|
|
120
|
+
- 新模板不得复用已有 id。
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @qfei-design/make-ai-assistant
|
|
2
|
+
|
|
3
|
+
面向 Make Console 与所有 Make App 的 AI 助手前端包。它提供统一的右下角浮动入口、右侧抽屉、流式会话状态、版本化 Artifact 协议、平台默认结果模板和 App 扩展机制。
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @qfei-design/make-ai-assistant@^0.1.0
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { MakeAiAssistant } from "@qfei-design/make-ai-assistant/react";
|
|
15
|
+
import "@qfei-design/make-ai-assistant/styles.css";
|
|
16
|
+
|
|
17
|
+
export function AppAssistant() {
|
|
18
|
+
return (
|
|
19
|
+
<MakeAiAssistant
|
|
20
|
+
context={{
|
|
21
|
+
app: { id: "sales-app", name: "销售管理" },
|
|
22
|
+
location: { pathname: window.location.pathname },
|
|
23
|
+
locale: "zh-CN",
|
|
24
|
+
timezone: "Asia/Shanghai",
|
|
25
|
+
}}
|
|
26
|
+
transport={assistantTransport}
|
|
27
|
+
suggestions={["总结当前页面", "找出需要关注的记录"]}
|
|
28
|
+
onAction={(action) => hostActionAdapter.execute(action)}
|
|
29
|
+
onActionError={(error, action) => hostActionAdapter.reportFailure(error, action)}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`MakeAiAssistant` 默认渲染右下角动效入口和右侧抽屉。宿主可以使用 `open` / `onOpenChange` 受控管理开关,也可以用 `AssistantPanel` 嵌入自己的容器。
|
|
36
|
+
|
|
37
|
+
## Package provides
|
|
38
|
+
|
|
39
|
+
- Artifact V1 类型、运行时校验与 JSON Schema;
|
|
40
|
+
- Artifact 模板注册、能力协商和稳定降级;
|
|
41
|
+
- 纯会话 reducer 与 `AssistantTransport` 合同;
|
|
42
|
+
- `/sse` 入口提供可直接配置 endpoint 的 `createSseAssistantTransport`;
|
|
43
|
+
- `MakeAiAssistant`、`AssistantPanel` 和 `ArtifactRenderer`;
|
|
44
|
+
- metric、comparison、trend、ranking、record-list、notice 六类默认模板;
|
|
45
|
+
- Mock transport 与 Gallery fixtures;
|
|
46
|
+
- 可由宿主覆盖的 `--make-ai-*` CSS 主题变量。
|
|
47
|
+
|
|
48
|
+
## Host app provides
|
|
49
|
+
|
|
50
|
+
- 当前 App、路径、Entity/Record/View 等最小上下文;
|
|
51
|
+
- 实现 `AssistantTransport` 的 Mock、SSE 或 AG-UI 适配器;
|
|
52
|
+
- Artifact 动作到宿主路由、命令与权限检查的映射;
|
|
53
|
+
- Service `/api`、认证、数据查询、模型运行和服务端权限校验;
|
|
54
|
+
- 可选的 App 领域模板和主题变量。
|
|
55
|
+
|
|
56
|
+
The package does not access Make API, does not hold or forward Make tokens, and does not execute server-generated HTML, JSX, CSS, or JavaScript.
|
|
57
|
+
|
|
58
|
+
React/ReactDOM 是 UI 入口的可选 peer dependency;只使用根入口、`/sse` 或 `/testing`
|
|
59
|
+
的 Service/Node 工具不需要安装 React。
|
|
60
|
+
|
|
61
|
+
只使用 `AssistantPanel` 做嵌入式接入,或单独使用 `ArtifactRenderer` 时,同一个
|
|
62
|
+
`styles.css` 入口仍会提供默认主题变量、盒模型、可见焦点和 reduced-motion 处理。
|
|
63
|
+
|
|
64
|
+
## Artifact template extension
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import {
|
|
68
|
+
createPlatformArtifactRegistry,
|
|
69
|
+
platformArtifactTemplates,
|
|
70
|
+
type ReactArtifactTemplate,
|
|
71
|
+
} from "@qfei-design/make-ai-assistant/react";
|
|
72
|
+
|
|
73
|
+
const appTemplate: ReactArtifactTemplate = {
|
|
74
|
+
id: "sales.metric.target-progress",
|
|
75
|
+
kinds: ["metric"],
|
|
76
|
+
priority: 50,
|
|
77
|
+
canRender: (artifact, context) =>
|
|
78
|
+
context.app.id === "sales-app" && artifact.meta?.semantic === "target-progress",
|
|
79
|
+
render: (artifact) => <SalesTargetProgress artifact={artifact} />,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const registry = createPlatformArtifactRegistry([
|
|
83
|
+
...platformArtifactTemplates,
|
|
84
|
+
appTemplate,
|
|
85
|
+
]);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
后端可以通过 `presentation.template` 请求某个已协商模板;若不匹配,前端会按优先级和 `canRender` 选择其他安全模板。
|
|
89
|
+
模板注册时会校验 kind、priority 和回调类型,并保存只读快照。
|
|
90
|
+
|
|
91
|
+
## Transport
|
|
92
|
+
|
|
93
|
+
`AssistantTransport.run()` 接收消息、上下文和前端能力目录,返回 `AsyncIterable<AssistantEvent>`。Mock、原生 SSE 和 AG-UI 都应适配到同一合同,因此更换后端不会改 UI。
|
|
94
|
+
|
|
95
|
+
标准 SSE 后端可直接使用:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { createSseAssistantTransport } from "@qfei-design/make-ai-assistant/sse";
|
|
99
|
+
|
|
100
|
+
const assistantTransport = createSseAssistantTransport({
|
|
101
|
+
endpoint: "/api/assistant/runs",
|
|
102
|
+
credentials: "include",
|
|
103
|
+
maxEventCharacters: 1_000_000,
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
需要兼容已有事件协议时,在宿主内实现薄 adapter;不要修改聊天组件或复制 Artifact 模板。
|
|
108
|
+
|
|
109
|
+
流必须以 `run.complete`、`run.cancelled` 或 `error` 终止;异常断流会进入可重试错误状态。
|
|
110
|
+
停止生成会立即解除输入锁定并丢弃迟到事件;标准 SSE transport 会同步取消底层 reader。
|
|
111
|
+
`/sse` 的公开类型不依赖 TypeScript `DOM` lib,现代 Node 宿主也可直接消费。
|
|
112
|
+
调用前已经取消的 `AbortSignal` 不会触发网络请求。
|
|
113
|
+
助手只发送宿主提供的上下文,实际数据权限始终由宿主 Service 在服务端重新校验。
|
|
114
|
+
|
|
115
|
+
生产接口建议和 SSE 事件定义见仓库 `docs/backend-contract.md`。AG-UI 在这里是可选的前后端事件协议,不是生成 React 组件的 UI 库。
|
|
116
|
+
|
|
117
|
+
## Validation
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pnpm test
|
|
121
|
+
pnpm typecheck
|
|
122
|
+
pnpm build
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
发布统一走 GitLab CI;不要从功能分支本地执行 npm publish。
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://qfei-design.github.io/make-ai-assistant/artifact-v1.schema.json",
|
|
4
|
+
"title": "Make AI Assistant Artifact V1",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{ "$ref": "#/$defs/metric" },
|
|
7
|
+
{ "$ref": "#/$defs/comparison" },
|
|
8
|
+
{ "$ref": "#/$defs/trend" },
|
|
9
|
+
{ "$ref": "#/$defs/ranking" },
|
|
10
|
+
{ "$ref": "#/$defs/recordList" },
|
|
11
|
+
{ "$ref": "#/$defs/notice" }
|
|
12
|
+
],
|
|
13
|
+
"$defs": {
|
|
14
|
+
"base": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["schemaVersion", "id", "kind", "data"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schemaVersion": { "const": "1.0" },
|
|
19
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
20
|
+
"kind": { "type": "string" },
|
|
21
|
+
"data": { "type": "object" },
|
|
22
|
+
"title": { "type": "string", "maxLength": 20000 },
|
|
23
|
+
"summary": { "type": "string", "maxLength": 20000 },
|
|
24
|
+
"presentation": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"template": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
28
|
+
"density": { "enum": ["compact", "comfortable"] }
|
|
29
|
+
},
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
},
|
|
32
|
+
"actions": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"maxItems": 10,
|
|
35
|
+
"items": { "$ref": "#/$defs/action" }
|
|
36
|
+
},
|
|
37
|
+
"meta": { "$ref": "#/$defs/jsonObject" }
|
|
38
|
+
},
|
|
39
|
+
"additionalProperties": false
|
|
40
|
+
},
|
|
41
|
+
"jsonValue": {
|
|
42
|
+
"anyOf": [
|
|
43
|
+
{ "type": "null" },
|
|
44
|
+
{ "type": "boolean" },
|
|
45
|
+
{ "type": "number" },
|
|
46
|
+
{ "type": "string", "maxLength": 20000 },
|
|
47
|
+
{
|
|
48
|
+
"type": "array",
|
|
49
|
+
"maxItems": 10000,
|
|
50
|
+
"items": { "$ref": "#/$defs/jsonValue" }
|
|
51
|
+
},
|
|
52
|
+
{ "$ref": "#/$defs/jsonObject" }
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"jsonObject": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"maxProperties": 10000,
|
|
58
|
+
"propertyNames": { "maxLength": 20000 },
|
|
59
|
+
"additionalProperties": { "$ref": "#/$defs/jsonValue" }
|
|
60
|
+
},
|
|
61
|
+
"format": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"style": { "enum": ["decimal", "currency", "percent"] },
|
|
65
|
+
"currency": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
66
|
+
"precision": { "type": "integer", "minimum": 0, "maximum": 20 },
|
|
67
|
+
"unit": { "type": "string", "maxLength": 20000 }
|
|
68
|
+
},
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
},
|
|
71
|
+
"action": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"required": ["id", "label", "intent", "target"],
|
|
74
|
+
"properties": {
|
|
75
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
76
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
77
|
+
"intent": { "enum": ["navigate", "open-record", "open-list", "invoke"] },
|
|
78
|
+
"target": { "$ref": "#/$defs/jsonObject" },
|
|
79
|
+
"appearance": { "enum": ["primary", "secondary", "link"] }
|
|
80
|
+
},
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
},
|
|
83
|
+
"metric": {
|
|
84
|
+
"allOf": [
|
|
85
|
+
{ "$ref": "#/$defs/base" },
|
|
86
|
+
{
|
|
87
|
+
"properties": {
|
|
88
|
+
"kind": { "const": "metric" },
|
|
89
|
+
"data": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"required": ["value"],
|
|
92
|
+
"properties": {
|
|
93
|
+
"value": { "type": ["number", "string"], "maxLength": 20000 },
|
|
94
|
+
"format": { "$ref": "#/$defs/format" },
|
|
95
|
+
"delta": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"required": ["value"],
|
|
98
|
+
"properties": {
|
|
99
|
+
"value": { "type": "number" },
|
|
100
|
+
"format": { "enum": ["decimal", "percent"] },
|
|
101
|
+
"direction": { "enum": ["up", "down", "flat"] },
|
|
102
|
+
"label": { "type": "string", "maxLength": 20000 }
|
|
103
|
+
},
|
|
104
|
+
"additionalProperties": false
|
|
105
|
+
},
|
|
106
|
+
"context": { "type": "string", "maxLength": 20000 }
|
|
107
|
+
},
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"comparisonItem": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": ["id", "label", "value"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
119
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
120
|
+
"value": { "type": ["number", "string"], "maxLength": 20000 },
|
|
121
|
+
"format": { "$ref": "#/$defs/format" },
|
|
122
|
+
"hint": { "type": "string", "maxLength": 20000 }
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false
|
|
125
|
+
},
|
|
126
|
+
"comparison": {
|
|
127
|
+
"allOf": [
|
|
128
|
+
{ "$ref": "#/$defs/base" },
|
|
129
|
+
{
|
|
130
|
+
"properties": {
|
|
131
|
+
"kind": { "const": "comparison" },
|
|
132
|
+
"data": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"required": ["items"],
|
|
135
|
+
"properties": {
|
|
136
|
+
"items": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"minItems": 1,
|
|
139
|
+
"maxItems": 24,
|
|
140
|
+
"items": { "$ref": "#/$defs/comparisonItem" }
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"additionalProperties": false
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"trend": {
|
|
150
|
+
"allOf": [
|
|
151
|
+
{ "$ref": "#/$defs/base" },
|
|
152
|
+
{
|
|
153
|
+
"properties": {
|
|
154
|
+
"kind": { "const": "trend" },
|
|
155
|
+
"data": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"required": ["series"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"series": {
|
|
160
|
+
"type": "array",
|
|
161
|
+
"minItems": 1,
|
|
162
|
+
"maxItems": 8,
|
|
163
|
+
"items": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"required": ["id", "label", "points"],
|
|
166
|
+
"properties": {
|
|
167
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
168
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
169
|
+
"format": { "$ref": "#/$defs/format" },
|
|
170
|
+
"points": {
|
|
171
|
+
"type": "array",
|
|
172
|
+
"minItems": 1,
|
|
173
|
+
"maxItems": 120,
|
|
174
|
+
"items": {
|
|
175
|
+
"type": "object",
|
|
176
|
+
"required": ["x", "y"],
|
|
177
|
+
"properties": {
|
|
178
|
+
"x": { "type": ["number", "string"], "maxLength": 20000 },
|
|
179
|
+
"y": { "type": "number" }
|
|
180
|
+
},
|
|
181
|
+
"additionalProperties": false
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"additionalProperties": false
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"additionalProperties": false
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
"ranking": {
|
|
196
|
+
"allOf": [
|
|
197
|
+
{ "$ref": "#/$defs/base" },
|
|
198
|
+
{
|
|
199
|
+
"properties": {
|
|
200
|
+
"kind": { "const": "ranking" },
|
|
201
|
+
"data": {
|
|
202
|
+
"type": "object",
|
|
203
|
+
"required": ["items"],
|
|
204
|
+
"properties": {
|
|
205
|
+
"items": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"minItems": 1,
|
|
208
|
+
"maxItems": 50,
|
|
209
|
+
"items": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"required": ["id", "label", "value"],
|
|
212
|
+
"properties": {
|
|
213
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
214
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
215
|
+
"value": { "type": "number" },
|
|
216
|
+
"format": { "$ref": "#/$defs/format" },
|
|
217
|
+
"description": { "type": "string", "maxLength": 20000 }
|
|
218
|
+
},
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"additionalProperties": false
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
"recordList": {
|
|
230
|
+
"allOf": [
|
|
231
|
+
{ "$ref": "#/$defs/base" },
|
|
232
|
+
{
|
|
233
|
+
"properties": {
|
|
234
|
+
"kind": { "const": "record-list" },
|
|
235
|
+
"data": {
|
|
236
|
+
"type": "object",
|
|
237
|
+
"required": ["entity", "columns", "records"],
|
|
238
|
+
"properties": {
|
|
239
|
+
"entity": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"required": ["key"],
|
|
242
|
+
"properties": {
|
|
243
|
+
"key": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
244
|
+
"label": { "type": "string", "maxLength": 20000 }
|
|
245
|
+
},
|
|
246
|
+
"additionalProperties": false
|
|
247
|
+
},
|
|
248
|
+
"columns": {
|
|
249
|
+
"type": "array",
|
|
250
|
+
"minItems": 1,
|
|
251
|
+
"maxItems": 20,
|
|
252
|
+
"items": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"required": ["key", "label"],
|
|
255
|
+
"properties": {
|
|
256
|
+
"key": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
257
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
258
|
+
"format": { "$ref": "#/$defs/format" }
|
|
259
|
+
},
|
|
260
|
+
"additionalProperties": false
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"records": {
|
|
264
|
+
"type": "array",
|
|
265
|
+
"maxItems": 100,
|
|
266
|
+
"items": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"required": ["id", "values"],
|
|
269
|
+
"properties": {
|
|
270
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 20000 },
|
|
271
|
+
"title": { "type": "string", "maxLength": 20000 },
|
|
272
|
+
"values": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"maxProperties": 100,
|
|
275
|
+
"propertyNames": { "maxLength": 20000 },
|
|
276
|
+
"additionalProperties": {
|
|
277
|
+
"anyOf": [
|
|
278
|
+
{ "type": "string", "maxLength": 20000 },
|
|
279
|
+
{ "type": "number" },
|
|
280
|
+
{ "type": "boolean" },
|
|
281
|
+
{ "type": "null" }
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"action": { "$ref": "#/$defs/action" }
|
|
286
|
+
},
|
|
287
|
+
"additionalProperties": false
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"total": { "type": "integer", "minimum": 0 }
|
|
291
|
+
},
|
|
292
|
+
"additionalProperties": false
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
},
|
|
298
|
+
"notice": {
|
|
299
|
+
"allOf": [
|
|
300
|
+
{ "$ref": "#/$defs/base" },
|
|
301
|
+
{
|
|
302
|
+
"properties": {
|
|
303
|
+
"kind": { "const": "notice" },
|
|
304
|
+
"data": {
|
|
305
|
+
"type": "object",
|
|
306
|
+
"required": ["tone", "body"],
|
|
307
|
+
"properties": {
|
|
308
|
+
"tone": { "enum": ["info", "success", "warning", "danger"] },
|
|
309
|
+
"body": { "type": "string", "minLength": 1, "maxLength": 20000 }
|
|
310
|
+
},
|
|
311
|
+
"additionalProperties": false
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packageName": "@qfei-design/make-ai-assistant",
|
|
3
|
+
"catalogVersion": 1,
|
|
4
|
+
"features": [
|
|
5
|
+
{
|
|
6
|
+
"id": "artifact-core",
|
|
7
|
+
"name": "Artifact V1 core",
|
|
8
|
+
"category": "core",
|
|
9
|
+
"status": "experimental",
|
|
10
|
+
"summary": "Versioned semantic result contract, runtime validation and JSON Schema.",
|
|
11
|
+
"docPath": "PUBLIC_API.md",
|
|
12
|
+
"relatedExports": ["validateArtifact", "parseArtifact", "MakeAiArtifact"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "artifact-registry",
|
|
16
|
+
"name": "Artifact template registry",
|
|
17
|
+
"category": "core",
|
|
18
|
+
"status": "experimental",
|
|
19
|
+
"summary": "Deterministic template selection, extension and capability negotiation.",
|
|
20
|
+
"docPath": "PUBLIC_API.md",
|
|
21
|
+
"relatedExports": ["createArtifactTemplateRegistry", "resolveArtifactTemplate", "createArtifactCapabilities"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "react-shell",
|
|
25
|
+
"name": "React assistant shell",
|
|
26
|
+
"category": "ui",
|
|
27
|
+
"status": "experimental",
|
|
28
|
+
"summary": "Floating launcher, right-side drawer, embedded panel and streaming conversation UI.",
|
|
29
|
+
"docPath": "README.md",
|
|
30
|
+
"relatedExports": ["MakeAiAssistant", "AssistantPanel"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "platform-templates",
|
|
34
|
+
"name": "Platform Artifact templates",
|
|
35
|
+
"category": "ui",
|
|
36
|
+
"status": "experimental",
|
|
37
|
+
"summary": "Default metric, comparison, trend, ranking, record-list and notice renderers.",
|
|
38
|
+
"docPath": "PUBLIC_API.md",
|
|
39
|
+
"relatedExports": ["ArtifactRenderer", "createPlatformArtifactRegistry", "platformArtifactTemplates"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "sse-transport",
|
|
43
|
+
"name": "SSE transport",
|
|
44
|
+
"category": "integration",
|
|
45
|
+
"status": "experimental",
|
|
46
|
+
"summary": "Abortable fetch SSE adapter for the standard Make AI Assistant event contract.",
|
|
47
|
+
"docPath": "PUBLIC_API.md",
|
|
48
|
+
"relatedExports": ["@qfei-design/make-ai-assistant/sse:createSseAssistantTransport", "AssistantTransport"]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "mock-transport",
|
|
52
|
+
"name": "Testing adapter",
|
|
53
|
+
"category": "testing",
|
|
54
|
+
"status": "experimental",
|
|
55
|
+
"summary": "Protocol-compatible mock transport and generic fixtures for App integration before backend readiness.",
|
|
56
|
+
"docPath": "README.md",
|
|
57
|
+
"relatedExports": ["createMockAssistantTransport", "artifactFixtures"]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|