@svadmin/ai-elements 0.8.0 → 0.10.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/README.md +18 -7
- package/dist/ai-workspace-contract.d.ts +14 -0
- package/dist/ai-workspace-contract.js +14 -0
- package/dist/ai.css +2 -1
- package/dist/components/commit/CommitHeader.svelte +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -147,13 +147,24 @@ interaction or pixel parity. `JSXPreview` intentionally uses a restricted,
|
|
|
147
147
|
TypeBox-validated parser instead of executing arbitrary JSX. `Tool.getStatusBadge`
|
|
148
148
|
returns Svelte-renderable status metadata instead of a React element.
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
## Ant Design X-inspired AI workspace boundary
|
|
151
|
+
|
|
152
|
+
SVAdmin adopts the interaction model of Ant Design X for enterprise admin
|
|
153
|
+
workflows, while keeping a Svelte-native API and the existing
|
|
154
|
+
`ChatProvider`/`AgentProvider` boundaries. The stable core loop is:
|
|
155
|
+
|
|
156
|
+
- welcome and suggestion entry points;
|
|
157
|
+
- conversation, message, sender, streaming, stop, retry, and persistence;
|
|
158
|
+
- reasoning and structured tool-call presentation;
|
|
159
|
+
- explicit confirmation before privileged or mutating operations;
|
|
160
|
+
- a command bar that falls back to ordinary navigation search when AI is
|
|
161
|
+
unavailable.
|
|
162
|
+
|
|
163
|
+
Long-running task progress is currently `experimental`. React component APIs,
|
|
164
|
+
direct model mutations, and visual 1:1 compatibility with Ant Design X are not
|
|
165
|
+
part of the SVAdmin contract. The machine-readable boundary is exported as
|
|
166
|
+
`AI_WORKSPACE_CAPABILITIES`; its acceptance conditions must remain satisfied
|
|
167
|
+
when these surfaces evolve.
|
|
157
168
|
|
|
158
169
|
## AdminApp Integration
|
|
159
170
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ant Design X-inspired interaction capabilities for the SVAdmin AI workspace.
|
|
3
|
+
*
|
|
4
|
+
* This is a product-boundary contract, not a claim of React API compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export type AIWorkspaceCapabilityStage = 'stable' | 'experimental' | 'planned';
|
|
7
|
+
export interface AIWorkspaceCapability {
|
|
8
|
+
id: 'welcome' | 'suggestion' | 'conversation' | 'sender' | 'streaming' | 'reasoning' | 'tool-calling' | 'approval' | 'task-progress' | 'command-bar' | 'persistence';
|
|
9
|
+
stage: AIWorkspaceCapabilityStage;
|
|
10
|
+
localSurfaces: readonly string[];
|
|
11
|
+
acceptance: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare const AI_WORKSPACE_CAPABILITIES: readonly AIWorkspaceCapability[];
|
|
14
|
+
export declare const AI_WORKSPACE_STABLE_CAPABILITIES: AIWorkspaceCapability[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const AI_WORKSPACE_CAPABILITIES = [
|
|
2
|
+
{ id: 'welcome', stage: 'stable', localSurfaces: ['ConversationEmptyState', 'ChatDialog'], acceptance: ['空态提供当前租户和资源范围内的下一步入口'] },
|
|
3
|
+
{ id: 'suggestion', stage: 'stable', localSurfaces: ['Suggestion', 'Suggestions', 'SmartSuggest'], acceptance: ['建议只能提交到当前对话或字段,不得直接执行写操作'] },
|
|
4
|
+
{ id: 'conversation', stage: 'stable', localSurfaces: ['Conversation', 'Message', 'Response'], acceptance: ['消息按当前用户、租户和资源作用域隔离'] },
|
|
5
|
+
{ id: 'sender', stage: 'stable', localSurfaces: ['PromptInput', 'PromptInputTextarea', 'PromptInputSubmit'], acceptance: ['发送、附件、停止和失败重试可被键盘和屏幕阅读器操作'] },
|
|
6
|
+
{ id: 'streaming', stage: 'stable', localSurfaces: ['ChatProvider', 'ChatDialog', 'Response'], acceptance: ['流式输出可中断,过期响应不得写回新会话'] },
|
|
7
|
+
{ id: 'reasoning', stage: 'stable', localSurfaces: ['Reasoning', 'ChainOfThought'], acceptance: ['推理过程可折叠,最终回答与中间过程视觉区分'] },
|
|
8
|
+
{ id: 'tool-calling', stage: 'stable', localSurfaces: ['AgentProvider', 'Tool', 'AdminTool'], acceptance: ['工具参数经 TypeBox 校验且服务端重新授权'] },
|
|
9
|
+
{ id: 'approval', stage: 'stable', localSurfaces: ['Confirmation', 'needsApproval', 'executeAdminTool'], acceptance: ['破坏性、权限、计费和批量写操作确认后才执行'] },
|
|
10
|
+
{ id: 'task-progress', stage: 'experimental', localSurfaces: ['Task', 'Plan', 'Queue', 'Checkpoint'], acceptance: ['长任务展示进度、失败原因和可恢复入口'] },
|
|
11
|
+
{ id: 'command-bar', stage: 'stable', localSurfaces: ['AICommandBar'], acceptance: ['导航搜索与自然语言查询可区分,失败时回退到普通命令搜索'] },
|
|
12
|
+
{ id: 'persistence', stage: 'stable', localSurfaces: ['ChatDialog', 'persistKey', 'onPersist', 'onRestore'], acceptance: ['历史恢复失败时禁止空历史覆盖远端记录'] },
|
|
13
|
+
];
|
|
14
|
+
export const AI_WORKSPACE_STABLE_CAPABILITIES = AI_WORKSPACE_CAPABILITIES.filter(({ stage }) => stage === 'stable');
|
package/dist/ai.css
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte'; import { cn } from '../../utils.js'; import { useCommitContext } from './context.svelte.js';
|
|
3
3
|
let { class: className = '', children, ...rest }: { class?: string; children?: Snippet; [key: string]: unknown } = $props();
|
|
4
4
|
const disclosure = useCommitContext();
|
|
5
|
-
function toggle(event:
|
|
5
|
+
function toggle(event: Event): void {
|
|
6
6
|
if (event.target instanceof Element && event.target.closest('[data-slot="commit-actions"]')) return;
|
|
7
7
|
disclosure.toggle();
|
|
8
8
|
}
|
|
9
9
|
function toggleFromKeyboard(event: KeyboardEvent): void {
|
|
10
10
|
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
11
11
|
event.preventDefault();
|
|
12
|
-
toggle(event
|
|
12
|
+
toggle(event);
|
|
13
13
|
}
|
|
14
14
|
</script>
|
|
15
15
|
<div class={cn('group flex cursor-pointer items-center justify-between gap-4 p-3 text-left transition-opacity hover:opacity-80 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring', className)} role="button" tabindex="0" aria-expanded={disclosure.open} onclick={toggle} onkeydown={toggleFromKeyboard} {...rest}>{@render children?.()}</div>
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,8 @@ export * as SourcesParts from "./components/sources/index.js";
|
|
|
147
147
|
export * as SpeechInputParts from "./components/speech-input/index.js";
|
|
148
148
|
export * as StackTraceParts from "./components/stack-trace/index.js";
|
|
149
149
|
export * as SuggestionParts from "./components/suggestion/index.js";
|
|
150
|
+
export { AI_WORKSPACE_CAPABILITIES, AI_WORKSPACE_STABLE_CAPABILITIES, } from "./ai-workspace-contract.js";
|
|
151
|
+
export type { AIWorkspaceCapability, AIWorkspaceCapabilityStage, } from "./ai-workspace-contract.js";
|
|
150
152
|
export * as TaskParts from "./components/task/index.js";
|
|
151
153
|
export * as TerminalParts from "./components/terminal/index.js";
|
|
152
154
|
export * as TestResultsParts from "./components/test-results/index.js";
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,7 @@ export * as SourcesParts from "./components/sources/index.js";
|
|
|
111
111
|
export * as SpeechInputParts from "./components/speech-input/index.js";
|
|
112
112
|
export * as StackTraceParts from "./components/stack-trace/index.js";
|
|
113
113
|
export * as SuggestionParts from "./components/suggestion/index.js";
|
|
114
|
+
export { AI_WORKSPACE_CAPABILITIES, AI_WORKSPACE_STABLE_CAPABILITIES, } from "./ai-workspace-contract.js";
|
|
114
115
|
export * as TaskParts from "./components/task/index.js";
|
|
115
116
|
export * as TerminalParts from "./components/terminal/index.js";
|
|
116
117
|
export * as TestResultsParts from "./components/test-results/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ai-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Composable Svelte 5 AI interaction components for SVAdmin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@svadmin/core": "^0.
|
|
59
|
+
"@svadmin/core": "^0.55.0",
|
|
60
60
|
"@tanstack/svelte-query": "^6.1.48",
|
|
61
61
|
"svelte": "^5.56.10"
|
|
62
62
|
},
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"vitest": "^4.1.11"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
|
-
"build": "node ../../scripts/
|
|
108
|
+
"build": "node ../../scripts/check-native-style-sources.mjs ai-elements && node ../../scripts/build-native-classnames.mjs ai-elements && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts",
|
|
109
109
|
"check": "svelte-check --tsgo-experimental-api --tsconfig ./tsconfig.json --threshold error",
|
|
110
110
|
"test": "vitest run --config ./vitest.config.ts && bun test scripts/clean-dist.test.ts scripts/audit-upstream-parity.test.ts",
|
|
111
111
|
"audit:upstream": "bun scripts/audit-upstream-parity.ts",
|
|
112
|
-
"styles:migrated:check": "node ../../scripts/
|
|
112
|
+
"styles:migrated:check": "node ../../scripts/check-native-style-sources.mjs ai-elements"
|
|
113
113
|
},
|
|
114
114
|
"license": "MIT",
|
|
115
115
|
"publishConfig": {
|