@openviking/react 0.1.1 → 0.1.2

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.
Files changed (164) hide show
  1. package/README.md +18 -15
  2. package/dist/3~0.js +2113 -4
  3. package/dist/ark-message-list-view~0.js +310 -0
  4. package/dist/c7~0.js +24 -0
  5. package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
  6. package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
  7. package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
  8. package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
  9. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
  10. package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
  11. package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
  12. package/dist/components/agent-connect/agent-connect.d.ts +3 -3
  13. package/dist/components/agent-connect/content-en.d.ts +137 -0
  14. package/dist/components/agent-connect/content-zh.d.ts +137 -0
  15. package/dist/components/agent-connect/style.css +495 -6
  16. package/dist/components/agent-connect/types.d.ts +20 -166
  17. package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
  18. package/dist/components/file-preview/file-preview-body.d.ts +24 -12
  19. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
  20. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
  21. package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
  22. package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
  23. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
  24. package/dist/components/file-preview/file-preview-header.d.ts +23 -14
  25. package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
  26. package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
  27. package/dist/components/file-preview/file-preview-path.d.ts +30 -0
  28. package/dist/components/file-preview/file-preview-source.d.ts +24 -0
  29. package/dist/components/file-preview/file-preview-state.d.ts +28 -0
  30. package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
  31. package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
  32. package/dist/components/file-preview/file-preview.d.ts +8 -11
  33. package/dist/components/file-preview/style.css +3984 -128
  34. package/dist/components/file-preview/types.d.ts +250 -169
  35. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
  36. package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
  37. package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
  38. package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
  39. package/dist/components/file-preview.js +1 -442
  40. package/dist/components/file-tree/file-tree-body.d.ts +8 -4
  41. package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
  42. package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
  43. package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
  44. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
  45. package/dist/components/file-tree/file-tree-info.d.ts +29 -0
  46. package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
  47. package/dist/components/file-tree/file-tree-row-context.d.ts +31 -9
  48. package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
  49. package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
  50. package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
  51. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
  52. package/dist/components/file-tree/file-tree-tooltip.d.ts +9 -3
  53. package/dist/components/file-tree/file-tree.d.ts +12 -1
  54. package/dist/components/file-tree/style.css +225 -57
  55. package/dist/components/file-tree/types.d.ts +183 -0
  56. package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
  57. package/dist/components/file-tree.js +1 -1
  58. package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
  59. package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
  60. package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
  61. package/dist/components/scope-switcher/style.css +282 -76
  62. package/dist/components/scope-switcher/types.d.ts +230 -108
  63. package/dist/components/style.css +13845 -372
  64. package/dist/components/tui/command-catalog.d.ts +58 -0
  65. package/dist/components/tui/command-completion.d.ts +19 -0
  66. package/dist/components/tui/command-definitions.d.ts +10 -0
  67. package/dist/components/tui/command-input.d.ts +16 -0
  68. package/dist/components/tui/style.css +1543 -5
  69. package/dist/components/tui/tui-assist.d.ts +15 -0
  70. package/dist/components/tui/tui-code-block.d.ts +8 -0
  71. package/dist/components/tui/tui-command-help.d.ts +9 -0
  72. package/dist/components/tui/tui-command-text.d.ts +6 -0
  73. package/dist/components/tui/tui-composer.d.ts +24 -0
  74. package/dist/components/tui/tui-copy-button.d.ts +9 -0
  75. package/dist/components/tui/tui-input-mirror.d.ts +14 -0
  76. package/dist/components/tui/tui-labels-zh.d.ts +2 -0
  77. package/dist/components/tui/tui-labels.d.ts +5 -0
  78. package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
  79. package/dist/components/tui/tui-markdown.d.ts +6 -0
  80. package/dist/components/tui/tui-param-hint.d.ts +7 -0
  81. package/dist/components/tui/tui-record-time.d.ts +11 -0
  82. package/dist/components/tui/tui-record.d.ts +13 -0
  83. package/dist/components/tui/tui-resource-preview.d.ts +10 -0
  84. package/dist/components/tui/tui-resource-tree.d.ts +10 -0
  85. package/dist/components/tui/tui-result-header.d.ts +7 -0
  86. package/dist/components/tui/tui-result-text.d.ts +5 -0
  87. package/dist/components/tui/tui-search-list.d.ts +8 -0
  88. package/dist/components/tui/tui-skeleton.d.ts +6 -0
  89. package/dist/components/tui/tui-status-card.d.ts +7 -0
  90. package/dist/components/tui/tui-text.d.ts +10 -0
  91. package/dist/components/tui/tui-uri-text.d.ts +19 -0
  92. package/dist/components/tui/tui-write-result.d.ts +7 -0
  93. package/dist/components/tui/tui.d.ts +10 -2
  94. package/dist/components/tui/types.d.ts +57 -15
  95. package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
  96. package/dist/components/tui/use-tui-completion.d.ts +14 -0
  97. package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
  98. package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
  99. package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
  100. package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
  101. package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
  102. package/dist/components/viking-bot/index.d.ts +10 -0
  103. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
  104. package/dist/components/viking-bot/interaction/index.d.ts +4 -0
  105. package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
  106. package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
  107. package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
  108. package/dist/components/viking-bot/interaction/style.css +189 -0
  109. package/dist/components/viking-bot/interaction/types.d.ts +188 -0
  110. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
  111. package/dist/components/viking-bot/interaction.js +2 -0
  112. package/dist/components/viking-bot/labels.d.ts +2 -0
  113. package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
  114. package/dist/components/viking-bot/message-groups.d.ts +12 -0
  115. package/dist/components/viking-bot/model.d.ts +252 -0
  116. package/dist/components/viking-bot/render-part.d.ts +12 -0
  117. package/dist/components/viking-bot/style.css +7135 -0
  118. package/dist/components/viking-bot/style.js +0 -0
  119. package/dist/components/viking-bot/types.d.ts +140 -0
  120. package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
  121. package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
  122. package/dist/components/viking-bot/viking-bot.d.ts +16 -0
  123. package/dist/components/viking-bot.js +4 -0
  124. package/dist/c~0.js +201 -0
  125. package/dist/file-preview-viewer~0.js +191 -0
  126. package/dist/f~0.js +149 -77
  127. package/dist/g~0.js +1207 -0
  128. package/dist/h~0.js +58 -0
  129. package/dist/icons/file-type-icon.d.ts +31 -0
  130. package/dist/icons/index.d.ts +33 -23
  131. package/dist/icons/nextjs-icon.d.ts +19 -0
  132. package/dist/icons.js +1 -25
  133. package/dist/index.d.ts +2 -2
  134. package/dist/index.js +1 -1
  135. package/dist/k~0.js +1440 -0
  136. package/dist/lk~0.js +25 -12
  137. package/dist/modules/console/style.css +83 -1
  138. package/dist/modules/file-browser/style.css +89 -6
  139. package/dist/modules/scope-cascade/style.css +282 -76
  140. package/dist/modules/style.css +533 -110
  141. package/dist/n~0.js +434 -206
  142. package/dist/shared/components/tooltip/index.d.ts +1 -0
  143. package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
  144. package/dist/shared/components/tooltip/types.d.ts +42 -0
  145. package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
  146. package/dist/style.css +14451 -474
  147. package/dist/u~0.js +1597 -4
  148. package/dist/viking-bot-composer~0.js +164 -0
  149. package/dist/viking-bot-interaction~0.js +284 -0
  150. package/dist/w~0.js +19 -0
  151. package/package.json +18 -10
  152. package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
  153. package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
  154. package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
  155. package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
  156. package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
  157. package/dist/i~0.js +0 -21
  158. package/dist/modules/task-center/columns.d.ts +0 -129
  159. package/dist/modules/task-center/index.d.ts +0 -1
  160. package/dist/modules/task-center/style.css +0 -29
  161. package/dist/modules/task-center/task-center.d.ts +0 -4
  162. package/dist/modules/task-center/types.d.ts +0 -168
  163. package/dist/modules/task-center.js +0 -1
  164. /package/dist/{modules/task-center → components/viking-bot/interaction}/style.js +0 -0
@@ -0,0 +1,15 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ import type { TuiCompletion } from './use-tui-completion.js';
4
+ export interface TuiAssistProps {
5
+ anchorRef: RefObject<HTMLDivElement | null>;
6
+ assistId: string;
7
+ labels: ResolvedTuiLabels;
8
+ completion: TuiCompletion;
9
+ activeIndex: number;
10
+ onActiveIndexChange: (index: number) => void;
11
+ onPick: (value: string) => void;
12
+ onDismiss: (value: string) => void;
13
+ }
14
+ /** 候选浮层和联动详情;现代浏览器使用顶层 Popover,保留宿主主题继承。 */
15
+ export declare function TuiAssist({ anchorRef, assistId, labels, completion, activeIndex, onActiveIndexChange, onPick, onDismiss, }: TuiAssistProps): import("react").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ import type { ResolvedTuiLabels } from './tui-labels.js';
2
+ /** 文本代码块共用复制与资源链接行为。 */
3
+ export declare function TuiCodeBlock({ text, labels, onCopy, onOpenUri, }: {
4
+ text: string;
5
+ labels: ResolvedTuiLabels;
6
+ onCopy?: (text: string) => void;
7
+ onOpenUri?: (uri: string) => void;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { TuiCommandHelpContent } from './types.js';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ export interface TuiCommandHelpProps {
4
+ content: TuiCommandHelpContent;
5
+ onPick?: (command: string) => void;
6
+ labels: ResolvedTuiLabels;
7
+ }
8
+ /** 命令帮助:按分组列出命令,点击填入输入框。 */
9
+ export declare function TuiCommandHelp({ content, onPick, labels, }: TuiCommandHelpProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** 展示宿主命令前缀与动作,保留原始大小写和空白。 */
2
+ export declare function TuiCommandText({ text, name, namespaceOnly, }: {
3
+ text: string;
4
+ name?: string;
5
+ namespaceOnly?: boolean;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ import type { TuiCompletion } from './use-tui-completion.js';
4
+ export interface TuiComposerProps {
5
+ anchorRef: RefObject<HTMLDivElement | null>;
6
+ assistId: string;
7
+ onFocus: () => void;
8
+ onDismiss: (value: string) => void;
9
+ onRequestPalette: () => void;
10
+ value: string;
11
+ history: readonly string[];
12
+ labels: ResolvedTuiLabels;
13
+ completion: TuiCompletion;
14
+ disabled: boolean;
15
+ readOnly: boolean;
16
+ canSubmit: boolean;
17
+ activeIndex: number;
18
+ onActiveIndexChange: (index: number | ((current: number) => number)) => void;
19
+ onValueChange?: (value: string) => void;
20
+ onSubmit?: (command: string) => void;
21
+ onOpenUri?: (uri: string) => void;
22
+ }
23
+ /** 命令输入区:受控输入、键盘补全与提交意图。 */
24
+ export declare function TuiComposer({ anchorRef, assistId, onFocus, onDismiss, onRequestPalette, value, history, labels, completion, disabled, readOnly, canSubmit, activeIndex, onActiveIndexChange, onValueChange, onSubmit, onOpenUri, }: TuiComposerProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ export interface TuiCopyButtonProps {
2
+ text: string;
3
+ label: string;
4
+ copiedLabel: string;
5
+ onCopy?: (text: string) => void;
6
+ className?: string;
7
+ }
8
+ /** 复制按钮:成功后短暂显示已复制,并通知宿主。 */
9
+ export declare function TuiCopyButton({ text, label, copiedLabel, onCopy, className, }: TuiCopyButtonProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { RefObject, UIEventHandler } from 'react';
2
+ import type { TuiInlineCompletion } from './command-completion.js';
3
+ import type { TuiCommandInputMatch } from './command-input.js';
4
+ /** 原生 textarea 负责编辑与选区,镜像只绘制颜色和不属于输入值的参数提示。 */
5
+ export declare function TuiInputMirror({ value, input, inline, colorInput, onOpenUri, onScroll, mirrorRef, hintId, }: {
6
+ value: string;
7
+ input: TuiCommandInputMatch | undefined;
8
+ inline?: TuiInlineCompletion;
9
+ colorInput?: boolean;
10
+ onOpenUri?: (uri: string) => void;
11
+ onScroll: UIEventHandler<HTMLSpanElement>;
12
+ mirrorRef: RefObject<HTMLSpanElement | null>;
13
+ hintId: string;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ResolvedTuiLabels } from './tui-labels.js';
2
+ export declare const ZH_TUI_LABELS: ResolvedTuiLabels;
@@ -0,0 +1,5 @@
1
+ import type { TuiLabels } from './types.js';
2
+ /** 补齐当前语言的默认界面文案。 */
3
+ export type ResolvedTuiLabels = Required<TuiLabels>;
4
+ export declare const DEFAULT_TUI_LABELS: ResolvedTuiLabels;
5
+ export declare function resolveTuiLabels(labels?: TuiLabels, locale?: 'en' | 'zh'): ResolvedTuiLabels;
@@ -0,0 +1,10 @@
1
+ import type { Components } from 'react-markdown';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ export interface TuiMarkdownOptions {
4
+ labels: ResolvedTuiLabels;
5
+ onOpenUri?: (uri: string) => void;
6
+ onCopy?: (text: string) => void;
7
+ }
8
+ export declare const TuiMarkdownContext: import("react").Context<TuiMarkdownOptions | null>;
9
+ /** Stable component types preserve DOM identity, focus and copy feedback across input updates. */
10
+ export declare const TUI_MARKDOWN_COMPONENTS: Components;
@@ -0,0 +1,6 @@
1
+ import { type TuiMarkdownOptions } from './tui-markdown-renderers.js';
2
+ export interface TuiMarkdownProps extends TuiMarkdownOptions {
3
+ text: string;
4
+ }
5
+ /** Markdown uses stable renderers; callbacks and labels flow through the instance context. */
6
+ export declare function TuiMarkdown({ text, ...options }: TuiMarkdownProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { TuiCommandDefinition } from './command-catalog.js';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ export declare function TuiParamHint({ command, labels, onPick, }: {
4
+ command: TuiCommandDefinition;
5
+ labels: ResolvedTuiLabels;
6
+ onPick: (value: string) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ResolvedTuiLabels } from './tui-labels.js';
2
+ import type { TuiRecord } from './types.js';
3
+ type RecordTime = Pick<TuiRecord, 'createdAt' | 'createdAtMs'>;
4
+ /** 按实际经过的毫秒计算相对时间;展示字符串不参与日期解析。 */
5
+ export declare function formatTuiRecordTime(record: RecordTime, labels: ResolvedTuiLabels, now?: number): string | undefined;
6
+ /** 客户端渲染时读取时钟,SSR 与 hydration 首屏使用相同的兜底文案。 */
7
+ export declare function TuiRecordTime({ record, labels, }: {
8
+ record: RecordTime;
9
+ labels: ResolvedTuiLabels;
10
+ }): import("react").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { TuiCommandDefinition } from './command-catalog.js';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ import type { TuiRecord } from './types.js';
4
+ export interface TuiRecordProps {
5
+ record: TuiRecord;
6
+ command?: TuiCommandDefinition;
7
+ labels: ResolvedTuiLabels;
8
+ onOpenUri?: (uri: string) => void;
9
+ onCopy?: (text: string) => void;
10
+ onPickCommand?: (command: string) => void;
11
+ }
12
+ /** 一条执行记录:命令回显、状态与结果。 */
13
+ export declare function TuiRecordItem(props: TuiRecordProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { TuiResourcePreviewContent } from './types.js';
2
+ import type { ResolvedTuiLabels } from './tui-labels.js';
3
+ export interface TuiResourcePreviewProps {
4
+ content: TuiResourcePreviewContent;
5
+ onOpenUri?: (uri: string) => void;
6
+ onCopy?: (text: string) => void;
7
+ labels: ResolvedTuiLabels;
8
+ }
9
+ /** 单个资源正文预览。A single resource body preview. */
10
+ export declare function TuiResourcePreview({ content, onOpenUri, onCopy, labels, }: TuiResourcePreviewProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { TuiResourceTreeContent } from './types.js';
2
+ export interface TuiResourceTreeProps {
3
+ content: TuiResourceTreeContent;
4
+ onOpenUri?: (uri: string) => void;
5
+ loadMoreLabel: string;
6
+ noResultLabel: string;
7
+ resourceLabel: string;
8
+ }
9
+ /** 资源树结果:有明细时按列对齐,否则逐行列出。 */
10
+ export declare function TuiResourceTree({ content, onOpenUri, loadMoreLabel, noResultLabel, resourceLabel, }: TuiResourceTreeProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { TuiRecordStatus } from './types.js';
2
+ /** 命令名与执行状态;图标通过名称表达状态。 */
3
+ export declare function TuiResultHeader({ command, status, label, }: {
4
+ command: string;
5
+ status: TuiRecordStatus;
6
+ label: string;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { TuiCommandDefinition } from './command-catalog.js';
2
+ /** 命令已出现在卡片头时,不重复显示同名正文标题。 */
3
+ export declare function getVisibleTuiResultTitle(title: string | undefined, command?: TuiCommandDefinition): string | undefined;
4
+ export declare function getTuiResultText(text: string, command?: TuiCommandDefinition): string;
5
+ export declare function isTuiJson(text: string): boolean;
@@ -0,0 +1,8 @@
1
+ import type { TuiSearchListContent } from './types.js';
2
+ export interface TuiSearchListProps {
3
+ content: TuiSearchListContent;
4
+ onOpenUri?: (uri: string) => void;
5
+ noResultLabel: string;
6
+ }
7
+ /** 检索结果列表。Search result list. */
8
+ export declare function TuiSearchList({ content, onOpenUri, noResultLabel, }: TuiSearchListProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { TuiSkeletonKind } from './command-catalog.js';
2
+ export interface TuiSkeletonProps {
3
+ kind: TuiSkeletonKind;
4
+ }
5
+ /** 等待中的骨架;按命令选择形态,未知命令使用通用骨架。 */
6
+ export declare function TuiSkeleton({ kind }: TuiSkeletonProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { TuiStatusContent } from './types.js';
2
+ export interface TuiStatusCardProps {
3
+ content: TuiStatusContent;
4
+ onOpenUri?: (uri: string) => void;
5
+ }
6
+ /** 键值状态卡片。Key/value status card. */
7
+ export declare function TuiStatusCard({ content, onOpenUri }: TuiStatusCardProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ /** Literal/code tokens end at whitespace or quoting delimiters, not filename punctuation. */
2
+ export declare const TUI_URI_PATTERN: RegExp;
3
+ /** Prose retains sentence punctuation outside automatic links. */
4
+ export declare const TUI_PROSE_URI_PATTERN: RegExp;
5
+ /** Resource targets permit only explicit resource or web navigation schemes. */
6
+ export declare function getTuiSafeHref(uri: string | undefined): string | undefined;
7
+ /** 复制文本到剪贴板;不可用时返回 `false`,不抛出。 */
8
+ export declare function copyTuiText(text: string): Promise<boolean>;
9
+ /** Validate JSON, then indent its original tokens without rewriting values. */
10
+ export declare function formatTuiJson(text: string): string;
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface TuiUriTextProps {
3
+ text: string;
4
+ onOpenUri?: (uri: string) => void;
5
+ /** 编辑镜像隐藏重复文字,但保留链接语义及输入框焦点。 */
6
+ editor?: boolean;
7
+ /** Every caller declares its content semantics; literal values retain filename punctuation. */
8
+ mode: 'prose' | 'literal';
9
+ }
10
+ /** A validated native link; rejected targets remain plain text. */
11
+ export declare function TuiUriLink({ uri, children, onOpenUri, editor, className, }: {
12
+ uri?: string;
13
+ children: ReactNode;
14
+ onOpenUri?: (uri: string) => void;
15
+ editor?: boolean;
16
+ className?: string;
17
+ }): import("react").JSX.Element;
18
+ /** 把纯文本中的 URI 渲染成链接;宿主可通过回调接管打开。 */
19
+ export declare function TuiUriText({ text, onOpenUri, editor, mode, }: TuiUriTextProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { TuiWriteResultContent } from './types.js';
2
+ export interface TuiWriteResultProps {
3
+ content: TuiWriteResultContent;
4
+ onOpenUri?: (uri: string) => void;
5
+ }
6
+ /** 写入结果。Write result. */
7
+ export declare function TuiWriteResult({ content, onOpenUri }: TuiWriteResultProps): import("react").JSX.Element;
@@ -1,3 +1,11 @@
1
+ import type { TuiProps } from './types.js';
2
+ export type { TuiCommandDefinition, TuiCommandExample, TuiCommandGroup, TuiCommandParam, TuiCommandOption, TuiSkeletonKind, } from './command-catalog.js';
1
3
  export type { TuiCommandHelpContent, TuiCommandHelpItem, TuiCommandHelpSection, TuiLabels, TuiProps, TuiRecord, TuiRecordContent, TuiRecordStatus, TuiResourcePreviewContent, TuiResourceTreeContent, TuiResourceTreeDetailRow, TuiResourceTreeItem, TuiSearchListContent, TuiSearchResultItem, TuiStatusContent, TuiStatusRow, TuiTextContent, TuiWriteResultContent, } from './types.js';
2
- /** 占位组件:仅渲染固定尺寸的空壳,真实实现按 props 契约重写。 */
3
- export declare function Tui(): import("react").JSX.Element;
4
+ /**
5
+ * 命令记录、结果与输入区。宿主负责执行与会话,组件渲染传入的记录,
6
+ * 上报用户的提交意图与已完成的复制。
7
+ *
8
+ * Command records, results and input. The host owns execution and sessions; the
9
+ * component renders supplied records and reports submission intent and successful copies.
10
+ */
11
+ export declare function Tui({ records, value, disabled, emptyState, locale, commands, commandGroups, onValueChange, onSubmit, onOpenUri, onCopy, labels, className, ...rest }: TuiProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { TuiCommandDefinition, TuiCommandGroup } from './command-catalog.js';
2
3
  /**
3
4
  * 一条执行记录的状态。
4
5
  * Status of one execution record.
@@ -316,8 +317,8 @@ export interface TuiCommandHelpItem {
316
317
  */
317
318
  key: string;
318
319
  /**
319
- * 命令名,包含开头的斜杠。
320
- * Command name including the leading slash.
320
+ * 用于显示和填入的命令文本。
321
+ * Command text used for display and insertion.
321
322
  */
322
323
  name: string;
323
324
  /**
@@ -351,10 +352,15 @@ export interface TuiRecord {
351
352
  */
352
353
  content?: TuiRecordContent;
353
354
  /**
354
- * 记录头部的展示时间。
355
- * Timestamp rendered in the record header.
355
+ * 未提供有效 createdAtMs 时使用的展示时间,不解析为日期。
356
+ * Display text used without a valid createdAtMs; never parsed as a date.
356
357
  */
357
358
  createdAt?: string;
359
+ /**
360
+ * 发送时的 Unix 毫秒时间戳,优先在客户端格式化为相对时间或本地日期。
361
+ * Unix timestamp in milliseconds; preferred for relative time or local date display on the client.
362
+ */
363
+ createdAtMs?: number;
358
364
  }
359
365
  /**
360
366
  * 可替换的界面文案,默认英文。
@@ -373,10 +379,14 @@ export interface TuiLabels {
373
379
  */
374
380
  unavailableMessage?: string;
375
381
  /**
376
- * 发送按钮文案。
377
- * Send button label.
382
+ * 底部发送快捷键的说明文案。
383
+ * Label for the send keyboard shortcut.
378
384
  */
379
385
  send?: string;
386
+ /** 全部指令快捷键说明。Label for the all-commands shortcut. */
387
+ allCommands?: string;
388
+ /** 历史指令快捷键说明。Label for recalling commands from the current records. */
389
+ historyCommands?: string;
380
390
  /**
381
391
  * 建议列表的无障碍名称。
382
392
  * Accessible name of the suggestion list.
@@ -417,6 +427,32 @@ export interface TuiLabels {
417
427
  * Message shown when there are no records.
418
428
  */
419
429
  empty?: string;
430
+ /** 无返回结果时的提示。Message for an empty command result. */
431
+ noResult?: string;
432
+ /** 刚刚发送的时间文案。Time label for a just-sent record. */
433
+ justNow?: string;
434
+ /** 命令帮助的标题与操作提示。Command-help heading and hint. */
435
+ availableCommands?: string;
436
+ helpHint?: string;
437
+ /** 参数帮助标题、示例与空参数提示。Parameter help headings and empty copy. */
438
+ parameters?: string;
439
+ examples?: string;
440
+ noParameters?: string;
441
+ /** 参数表列名与必填值。Parameter columns and required values. */
442
+ parameter?: string;
443
+ required?: string;
444
+ description?: string;
445
+ defaultValue?: string;
446
+ yes?: string;
447
+ no?: string;
448
+ /** 资源列表分页。Resource list pagination. */
449
+ loadMore?: string;
450
+ /** 资源表格的名称列。Resource identity column heading. */
451
+ resource?: string;
452
+ /** 格式化已过去的整分钟。Formats elapsed whole minutes. */
453
+ formatMinutesAgo?: (minutes: number) => string;
454
+ /** 格式化已过去的整小时。Formats elapsed whole hours. */
455
+ formatHoursAgo?: (hours: number) => string;
420
456
  }
421
457
  /**
422
458
  * 当前命令记录、结果与输入区的公开接口;会话、历史面板和外层工具栏由宿主组合。
@@ -452,23 +488,29 @@ export interface TuiProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCopy'
452
488
  * passing `null` hides empty-state content.
453
489
  */
454
490
  emptyState?: ReactNode;
455
- /**
456
- * 输入值变化时触发,包括接受补全或参数提示;填入不提交命令。省略时输入框
491
+ /** 内置界面文案的语言,默认英文;命令文案由宿主提供。 */
492
+ locale?: 'en' | 'zh';
493
+ /** 宿主提供的命令目录;省略时无候选和参数帮助,仍可提交文本。 */
494
+ commands?: readonly TuiCommandDefinition[];
495
+ /** 宿主提供的分组名称与顺序;未声明的组按目录顺序追加。 */
496
+ commandGroups?: readonly TuiCommandGroup[];
497
+ /**
498
+ * 输入值变化时触发,包括接受命令或示例;行内占位不改变值,也不提交。省略时输入框
457
499
  * 只读,用于展示历史记录。
458
- * Invoked when the input changes, including accepted completions and parameter
459
- * hints; filling the input does not submit a command. Omission makes the input
500
+ * Invoked when the input changes, including accepted commands and examples; filling the input does not submit a command. Omission makes the input
460
501
  * read-only, for showing history.
461
502
  */
462
503
  onValueChange?: (value: string) => void;
463
504
  /**
464
- * 命令发送成功后触发,失败时不触发。省略时不能提交命令。
465
- * Called after a command is sent successfully; not called on failure. Omission
466
- * disables submission.
505
+ * 用户显式提交时上报命令意图,宿主负责请求、权限和执行,并通过 records 回填状态。
506
+ * Reports an explicit submission intent. The host owns requests, permissions
507
+ * and execution, and supplies subsequent status through records. Omission disables submission.
467
508
  */
468
509
  onSubmit?: (command: string) => void;
469
510
  /**
470
- * 资源成功打开后触发,参数为已打开的资源 URI;失败时不触发。
471
- * Called after a resource opens successfully, with its URI; not called on failure.
511
+ * 点击资源 URI 时触发,由宿主接管打开;覆盖输入区、命令记录和结果中的链接。
512
+ * Called when a resource URI is activated in the input, command echo or results;
513
+ * the host owns navigation. Without a handler, text links use their native href.
472
514
  */
473
515
  onOpenUri?: (uri: string) => void;
474
516
  /**
@@ -0,0 +1,3 @@
1
+ import type { RefObject } from 'react';
2
+ /** 顶层浮层保留组件的主题继承;不支持 Popover 的浏览器回退为内联面板。 */
3
+ export declare function useTuiAssistPosition(anchorRef: RefObject<HTMLDivElement | null>, open: boolean, onDismiss: (value: string) => void): RefObject<HTMLDivElement | null>;
@@ -0,0 +1,14 @@
1
+ import type { TuiCommandDefinition, TuiCommandGroup } from './command-catalog.js';
2
+ import type { TuiCommandInputMatch } from './command-input.js';
3
+ import type { TuiCommandQuery } from './command-completion.js';
4
+ import type { TuiCommandSection } from './command-definitions.js';
5
+ export interface TuiCompletion {
6
+ query: TuiCommandQuery;
7
+ suggestions: readonly TuiCommandSection[];
8
+ options: readonly TuiCommandDefinition[];
9
+ activeInput: TuiCommandInputMatch | undefined;
10
+ showSuggestions: boolean;
11
+ enabled: boolean;
12
+ }
13
+ /** 由受控输入和宿主目录推导补全,无取数、执行或状态镜像。 */
14
+ export declare function useTuiCompletion(value: string, enabled: boolean, commands: readonly TuiCommandDefinition[], groups?: readonly TuiCommandGroup[], paletteScope?: string | null): TuiCompletion;
@@ -0,0 +1,25 @@
1
+ import type { KeyboardEvent, RefObject } from 'react';
2
+ import type { TuiInlineCompletion } from './command-completion.js';
3
+ import type { TuiCompletion } from './use-tui-completion.js';
4
+ interface KeyboardOptions {
5
+ inputRef: RefObject<HTMLTextAreaElement | null>;
6
+ value: string;
7
+ history: readonly string[];
8
+ completion: TuiCompletion;
9
+ inline: TuiInlineCompletion | undefined;
10
+ disabled: boolean;
11
+ readOnly: boolean;
12
+ canSubmit: boolean;
13
+ activeIndex: number;
14
+ onActiveIndexChange: (index: number | ((current: number) => number)) => void;
15
+ onValueChange?: (value: string) => void;
16
+ onSubmit?: (command: string) => void;
17
+ onDismiss: (value: string) => void;
18
+ onRequestPalette: () => void;
19
+ }
20
+ /** 编辑、补全和历史互斥处理;普通 Tab 留在编辑器,Shift+Tab 可移出。 */
21
+ export declare function useTuiComposerKeyboard({ inputRef, value, history, completion, inline, disabled, readOnly, canSubmit, activeIndex, onActiveIndexChange, onValueChange, onSubmit, onDismiss, onRequestPalette, }: KeyboardOptions): {
22
+ change: (next: string) => void;
23
+ handleKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => void;
24
+ };
25
+ export {};
@@ -0,0 +1,45 @@
1
+ import type { ActivityTimelineItem } from '@ark-design/ui/activity-timeline';
2
+ import type { VikingBotMessage, VikingBotMessagePart, VikingBotStreamingState } from './model.js';
3
+ /**
4
+ * 把归一化片段映射成 Ark 的渲染输入。两种宿主的流事件在接入层就已经变成
5
+ * 这里的片段,因此映射只做形态转换,不再判断来源协议。
6
+ *
7
+ * Maps normalized parts onto Ark's render inputs. Both hosts already turn their
8
+ * own stream events into these parts in their integration layer, so this only
9
+ * converts shape and never inspects a source protocol.
10
+ */
11
+ /** 消息渲染单元的标识,供 Ark 列表做 key 与测量。 */
12
+ export interface VikingBotRenderItem {
13
+ /** 唯一标识。Stable key. */
14
+ id: string;
15
+ /** 来源消息;流式单元没有对应消息。Source message; the streaming unit has none. */
16
+ message?: VikingBotMessage;
17
+ /** 助手仍在生成时追加的片段。Parts appended while streaming. */
18
+ streaming?: VikingBotStreamingState;
19
+ }
20
+ /** 一轮回复的时间线条目,由推理与工具片段聚合而来。 */
21
+ export interface VikingBotActivityGroup {
22
+ /** 执行块标识。Activity block key. */
23
+ id: string;
24
+ /** 条目。Items. */
25
+ items: ActivityTimelineItem[];
26
+ }
27
+ /**
28
+ * 把片段聚合成执行块:带 `groupId` 的相邻推理与工具片段归为一组,
29
+ * 其余片段原样保留,由调用方按类型分别渲染。
30
+ */
31
+ export declare function groupActivityParts(parts: readonly VikingBotMessagePart[]): {
32
+ groups: Map<string, VikingBotActivityGroup>;
33
+ order: string[];
34
+ };
35
+ /**
36
+ * 把消息列表展平成 Ark 列表的渲染单元,流式片段插到 `insertIndex` 指定位置。
37
+ *
38
+ * 插入位置在原始消息序列上确定:调用方先按原始下标切分,再分别合并两侧,
39
+ * 避免先合并再适配导致下标含义改变、把边界两侧的助手消息并到一起。
40
+ *
41
+ * Flattens the messages into Ark render items, inserting the streaming unit at
42
+ * `insertIndex`. The boundary is resolved against the original sequence so
43
+ * merging on either side cannot shift its meaning.
44
+ */
45
+ export declare function toRenderItems(messages: readonly VikingBotMessage[], streaming?: VikingBotStreamingState, group?: (messages: readonly VikingBotMessage[]) => VikingBotMessage[]): VikingBotRenderItem[];
@@ -0,0 +1,16 @@
1
+ import type { VikingBotMessage } from './model.js';
2
+ import type { VikingBotMessageListProps } from './types.js';
3
+ type Labels = NonNullable<VikingBotMessageListProps['labels']>;
4
+ /** Markdown 或纯文本正文。A Markdown or plain-text body. */
5
+ export declare function MessageText({ text, streaming, format, }: {
6
+ text: string;
7
+ streaming?: boolean;
8
+ format?: 'plain' | 'markdown';
9
+ }): import("react").JSX.Element;
10
+ /** 消息正文:执行块在前,其余片段按顺序渲染。 */
11
+ export declare function MessageBody({ message, labels, onOpenUri, }: {
12
+ message: VikingBotMessage;
13
+ labels: Labels;
14
+ onOpenUri?: (uri: string) => void;
15
+ }): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { VikingBotMessageListProps } from './types.js';
2
+ /**
3
+ * Ark 渲染的消息列表。只在懒加载边界之后加载,因此可以静态引用 Ark。
4
+ * The Ark-rendered message list. Loaded behind the lazy boundary, so it may
5
+ * import Ark statically.
6
+ */
7
+ export declare function VikingBotMessageListView({ messages, className, streaming, footer, listKey, onOpenUri, onCopy, onMessageAction, renderMessage, labels: overrides, }: VikingBotMessageListProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { VikingBotMessage, VikingBotStreamingState } from './model.js';
2
+ import type { VikingBotMessageListProps } from './types.js';
3
+ type Labels = NonNullable<VikingBotMessageListProps['labels']>;
4
+ /** 单条消息。One message. */
5
+ export declare function VikingBotMessageRow({ message, labels, onOpenUri, onCopy, onMessageAction, renderMessage, }: {
6
+ message: VikingBotMessage;
7
+ labels: Labels;
8
+ onOpenUri?: (uri: string) => void;
9
+ onCopy?: (text: string) => void;
10
+ onMessageAction?: (messageId: string, actionKey: string) => void;
11
+ renderMessage?: (message: VikingBotMessage) => React.ReactNode;
12
+ }): import("react").JSX.Element;
13
+ /** 助手仍在生成时的单元。The in-flight assistant unit. */
14
+ export declare function VikingBotStreamingRow({ streaming, labels, onOpenUri, }: {
15
+ streaming: VikingBotStreamingState;
16
+ labels: Labels;
17
+ onOpenUri?: (uri: string) => void;
18
+ }): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,10 @@
1
+ export { VikingBot } from './viking-bot.js';
2
+ export { VikingBotComposer } from './lazy-composer.js';
3
+ export { VikingBotMessageList } from './viking-bot-message-list.js';
4
+ export { VikingBotInteraction, DEFAULT_INTERACTION_LABELS, } from './interaction/index.js';
5
+ export type { InteractionLabels } from './interaction/index.js';
6
+ export { DEFAULT_LABELS } from './labels.js';
7
+ export { groupByActivity, groupMessages, messageText, } from './message-groups.js';
8
+ export type { VikingBotAttachment, VikingBotAttachmentPart, VikingBotContextPart, VikingBotDraft, VikingBotImagePart, VikingBotIterationPart, VikingBotLabels, VikingBotMessage, VikingBotMessagePart, VikingBotReasoningPart, VikingBotStreamingState, VikingBotTextPart, VikingBotToolPart, VikingBotToolResultPart, } from './model.js';
9
+ export type { VikingBotComposerProps, VikingBotComposerRef, VikingBotMessageListProps, VikingBotProps, } from './types.js';
10
+ export type { VikingBotInteractionAnswer, VikingBotInteractionLabels, VikingBotInteractionOption, VikingBotInteractionProps, VikingBotInteractionRenderContext, VikingBotInteractionRequest, VikingBotRepairOption, VikingBotScheduleValue, } from './interaction/types.js';
@@ -0,0 +1,10 @@
1
+ import type { AskHumanField, AskHumanValue } from '@ark-design/ui/ask-human';
2
+ import type { VikingBotInteractionAnswer, VikingBotInteractionRequest } from './types.js';
3
+ /** 把请求转成 AskHuman 的字段描述。 */
4
+ export declare const toFields: (request: VikingBotInteractionRequest) => AskHumanField[];
5
+ /** 把 AskHuman 的提交值转回交互答案。 */
6
+ export declare const toAnswer: (request: VikingBotInteractionRequest, value: AskHumanValue) => VikingBotInteractionAnswer;
7
+ /** 按 request 计算 AskHuman 的初始答案,保证预填值与提交值一致。 */
8
+ export declare const toDefaultValue: (request: VikingBotInteractionRequest) => AskHumanValue | undefined;
9
+ /** 选择类问题必须选中有效选项;其他类型按自身初始值即可提交。 */
10
+ export declare const isValidAnswer: (request: VikingBotInteractionRequest, value: AskHumanValue) => boolean;
@@ -0,0 +1,4 @@
1
+ export { VikingBotInteraction } from './lazy-interaction.js';
2
+ export { DEFAULT_INTERACTION_LABELS } from './labels.js';
3
+ export type { InteractionLabels } from './labels.js';
4
+ export type { VikingBotInteractionAnswer, VikingBotInteractionLabels, VikingBotInteractionOption, VikingBotInteractionProps, VikingBotInteractionRenderContext, VikingBotInteractionRequest, VikingBotRepairOption, VikingBotScheduleValue, } from './types.js';
@@ -0,0 +1,7 @@
1
+ import type { VikingBotInteractionLabels } from './types.js';
2
+ /** 内部完整文案类型,从公开类型派生,保证宿主可覆盖每一处文案。 */
3
+ export type InteractionLabels = Required<Omit<VikingBotInteractionLabels, 'progress'>> & {
4
+ progress: (index: number, total: number) => string;
5
+ };
6
+ /** 内置交互区文案。Built-in interaction copy. */
7
+ export declare const DEFAULT_INTERACTION_LABELS: InteractionLabels;
@@ -0,0 +1,3 @@
1
+ import type { VikingBotInteractionProps } from './types.js';
2
+ /** 待确认交互区。The pending-interaction area. */
3
+ export declare function VikingBotInteraction(props: VikingBotInteractionProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { InteractionLabels } from './labels.js';
2
+ import type { VikingBotInteractionRequest } from './types.js';
3
+ type ScheduleRequest = Extract<VikingBotInteractionRequest, {
4
+ kind: 'schedule';
5
+ }>;
6
+ /** 定时输入。Schedule input. */
7
+ export declare function ScheduleInput({ request, labels, disabled, onChange, }: {
8
+ request: ScheduleRequest;
9
+ labels: InteractionLabels;
10
+ disabled?: boolean;
11
+ onChange: (value: unknown) => void;
12
+ }): import("react").JSX.Element;
13
+ export {};