@openviking/react 0.1.0 → 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 (193) hide show
  1. package/README.md +57 -34
  2. package/dist/3~0.js +2117 -0
  3. package/dist/ark-message-list-view~0.js +310 -0
  4. package/dist/a~0.js +21 -0
  5. package/dist/c7~0.js +24 -0
  6. package/dist/client/client.d.ts +12 -0
  7. package/dist/client/errors.d.ts +30 -0
  8. package/dist/client/index.d.ts +4 -0
  9. package/dist/client/options.d.ts +101 -0
  10. package/dist/client/provider.d.ts +52 -0
  11. package/dist/client/types.d.ts +160 -0
  12. package/dist/client.js +239 -0
  13. package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
  14. package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
  15. package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
  16. package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
  17. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
  18. package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
  19. package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
  20. package/dist/components/agent-connect/agent-connect.d.ts +4 -1
  21. package/dist/components/agent-connect/content-en.d.ts +137 -0
  22. package/dist/components/agent-connect/content-zh.d.ts +137 -0
  23. package/dist/components/agent-connect/index.d.ts +1 -0
  24. package/dist/components/agent-connect/style.css +503 -0
  25. package/dist/components/agent-connect/types.d.ts +29 -0
  26. package/dist/components/agent-connect.js +1 -0
  27. package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
  28. package/dist/components/file-preview/file-preview-body.d.ts +27 -0
  29. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
  30. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
  31. package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
  32. package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
  33. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
  34. package/dist/components/file-preview/file-preview-header.d.ts +25 -0
  35. package/dist/components/file-preview/file-preview-labels.d.ts +16 -0
  36. package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
  37. package/dist/components/file-preview/file-preview-path.d.ts +30 -0
  38. package/dist/components/file-preview/file-preview-source.d.ts +24 -0
  39. package/dist/components/file-preview/file-preview-state.d.ts +28 -0
  40. package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
  41. package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
  42. package/dist/components/file-preview/file-preview.d.ts +14 -1
  43. package/dist/components/file-preview/index.d.ts +1 -0
  44. package/dist/components/file-preview/style.css +4139 -0
  45. package/dist/components/file-preview/types.d.ts +516 -0
  46. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
  47. package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
  48. package/dist/components/file-preview/use-file-preview-editing.d.ts +32 -0
  49. package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
  50. package/dist/components/file-preview.js +1 -0
  51. package/dist/components/file-tree/file-tree-body.d.ts +18 -0
  52. package/dist/components/file-tree/file-tree-entry-row.d.ts +12 -0
  53. package/dist/components/file-tree/file-tree-icons.d.ts +15 -0
  54. package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
  55. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
  56. package/dist/components/file-tree/file-tree-info.d.ts +29 -0
  57. package/dist/components/file-tree/file-tree-keyboard.d.ts +14 -0
  58. package/dist/components/file-tree/file-tree-row-context.d.ts +46 -0
  59. package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
  60. package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
  61. package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
  62. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
  63. package/dist/components/file-tree/file-tree-tooltip.d.ts +17 -0
  64. package/dist/components/file-tree/file-tree.d.ts +15 -1
  65. package/dist/components/file-tree/index.d.ts +1 -0
  66. package/dist/components/file-tree/style.css +410 -0
  67. package/dist/components/file-tree/types.d.ts +589 -0
  68. package/dist/components/file-tree/use-file-tree-actions.d.ts +17 -0
  69. package/dist/components/file-tree.js +1 -0
  70. package/dist/components/scope-switcher/index.d.ts +1 -0
  71. package/dist/components/scope-switcher/scope-keyboard.d.ts +2 -0
  72. package/dist/components/scope-switcher/scope-panel.d.ts +11 -0
  73. package/dist/components/scope-switcher/scope-selector.d.ts +2 -0
  74. package/dist/components/scope-switcher/scope-switcher.d.ts +6 -1
  75. package/dist/components/scope-switcher/style.css +452 -0
  76. package/dist/components/scope-switcher/types.d.ts +489 -0
  77. package/dist/components/scope-switcher.js +3 -0
  78. package/dist/components/style.css +14249 -18
  79. package/dist/components/tui/command-catalog.d.ts +58 -0
  80. package/dist/components/tui/command-completion.d.ts +19 -0
  81. package/dist/components/tui/command-definitions.d.ts +10 -0
  82. package/dist/components/tui/command-input.d.ts +16 -0
  83. package/dist/components/tui/index.d.ts +1 -0
  84. package/dist/components/tui/style.css +1552 -0
  85. package/dist/components/tui/tui-assist.d.ts +15 -0
  86. package/dist/components/tui/tui-code-block.d.ts +8 -0
  87. package/dist/components/tui/tui-command-help.d.ts +9 -0
  88. package/dist/components/tui/tui-command-text.d.ts +6 -0
  89. package/dist/components/tui/tui-composer.d.ts +24 -0
  90. package/dist/components/tui/tui-copy-button.d.ts +9 -0
  91. package/dist/components/tui/tui-input-mirror.d.ts +14 -0
  92. package/dist/components/tui/tui-labels-zh.d.ts +2 -0
  93. package/dist/components/tui/tui-labels.d.ts +5 -0
  94. package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
  95. package/dist/components/tui/tui-markdown.d.ts +6 -0
  96. package/dist/components/tui/tui-param-hint.d.ts +7 -0
  97. package/dist/components/tui/tui-record-time.d.ts +11 -0
  98. package/dist/components/tui/tui-record.d.ts +13 -0
  99. package/dist/components/tui/tui-resource-preview.d.ts +10 -0
  100. package/dist/components/tui/tui-resource-tree.d.ts +10 -0
  101. package/dist/components/tui/tui-result-header.d.ts +7 -0
  102. package/dist/components/tui/tui-result-text.d.ts +5 -0
  103. package/dist/components/tui/tui-search-list.d.ts +8 -0
  104. package/dist/components/tui/tui-skeleton.d.ts +6 -0
  105. package/dist/components/tui/tui-status-card.d.ts +7 -0
  106. package/dist/components/tui/tui-text.d.ts +10 -0
  107. package/dist/components/tui/tui-uri-text.d.ts +19 -0
  108. package/dist/components/tui/tui-write-result.d.ts +7 -0
  109. package/dist/components/tui/tui.d.ts +11 -1
  110. package/dist/components/tui/types.d.ts +527 -0
  111. package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
  112. package/dist/components/tui/use-tui-completion.d.ts +14 -0
  113. package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
  114. package/dist/components/tui.js +1 -0
  115. package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
  116. package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
  117. package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
  118. package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
  119. package/dist/components/viking-bot/index.d.ts +10 -0
  120. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
  121. package/dist/components/viking-bot/interaction/index.d.ts +4 -0
  122. package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
  123. package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
  124. package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
  125. package/dist/components/viking-bot/interaction/style.css +189 -0
  126. package/dist/components/viking-bot/interaction/types.d.ts +188 -0
  127. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
  128. package/dist/components/viking-bot/interaction.js +2 -0
  129. package/dist/components/viking-bot/labels.d.ts +2 -0
  130. package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
  131. package/dist/components/viking-bot/message-groups.d.ts +12 -0
  132. package/dist/components/viking-bot/model.d.ts +252 -0
  133. package/dist/components/viking-bot/render-part.d.ts +12 -0
  134. package/dist/components/viking-bot/style.css +7133 -0
  135. package/dist/components/viking-bot/types.d.ts +140 -0
  136. package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
  137. package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
  138. package/dist/components/viking-bot/viking-bot.d.ts +16 -1
  139. package/dist/components/viking-bot.js +4 -0
  140. package/dist/c~0.js +201 -0
  141. package/dist/file-preview-viewer~0.js +191 -0
  142. package/dist/f~0.js +356 -0
  143. package/dist/g~0.js +1207 -0
  144. package/dist/h~0.js +58 -0
  145. package/dist/icons/file-type-icon.d.ts +31 -0
  146. package/dist/icons/index.d.ts +33 -23
  147. package/dist/icons/nextjs-icon.d.ts +19 -0
  148. package/dist/icons.js +1 -25
  149. package/dist/index.d.ts +16 -2
  150. package/dist/index.js +8 -1
  151. package/dist/k~0.js +1440 -0
  152. package/dist/lk~0.js +233 -0
  153. package/dist/l~0.js +44 -0
  154. package/dist/modules/console/console.d.ts +4 -0
  155. package/dist/modules/console/index.d.ts +1 -0
  156. package/dist/modules/console/style.css +111 -0
  157. package/dist/modules/console/types.d.ts +101 -0
  158. package/dist/modules/console.js +1 -0
  159. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +10 -0
  160. package/dist/modules/file-browser/file-browser.d.ts +6 -0
  161. package/dist/modules/file-browser/index.d.ts +1 -0
  162. package/dist/modules/file-browser/style.css +158 -0
  163. package/dist/modules/file-browser/types.d.ts +101 -0
  164. package/dist/modules/file-browser.js +1 -0
  165. package/dist/modules/scope-cascade/controller.d.ts +6 -0
  166. package/dist/modules/scope-cascade/index.d.ts +3 -0
  167. package/dist/modules/scope-cascade/scope-cascade.d.ts +3 -0
  168. package/dist/modules/scope-cascade/style.css +456 -0
  169. package/dist/modules/scope-cascade/style.js +0 -0
  170. package/dist/modules/scope-cascade/types.d.ts +39 -0
  171. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +5 -0
  172. package/dist/modules/scope-cascade.js +1 -0
  173. package/dist/modules/style.css +808 -0
  174. package/dist/modules/style.js +0 -0
  175. package/dist/n~0.js +727 -0
  176. package/dist/shared/components/tooltip/index.d.ts +1 -0
  177. package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
  178. package/dist/shared/components/tooltip/types.d.ts +42 -0
  179. package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
  180. package/dist/style.css +15138 -18
  181. package/dist/u~0.js +1601 -0
  182. package/dist/viking-bot-composer~0.js +164 -0
  183. package/dist/viking-bot-interaction~0.js +284 -0
  184. package/dist/w~0.js +19 -0
  185. package/package.json +46 -22
  186. package/dist/components/resource-import/resource-import.d.ts +0 -1
  187. package/dist/components/resource-import/style.css +0 -2
  188. package/dist/components/status-badge/status-badge.d.ts +0 -8
  189. package/dist/components/status-badge/style.css +0 -37
  190. package/dist/components/status-badge.js +0 -30
  191. /package/dist/components/{resource-import → viking-bot/interaction}/style.js +0 -0
  192. /package/dist/{components/status-badge → modules/console}/style.js +0 -0
  193. /package/dist/{components/resource-import.js → modules/file-browser/style.js} +0 -0
@@ -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 {};
@@ -0,0 +1,189 @@
1
+ .ov-viking-bot__interaction {
2
+ box-sizing: border-box;
3
+ border-top: 1px solid var(--ov-viking-bot-border);
4
+ flex-direction: column;
5
+ flex: none;
6
+ gap: 8px;
7
+ padding: 12px;
8
+ display: flex;
9
+ }
10
+
11
+ .ov-viking-bot__interaction-header {
12
+ color: var(--ov-viking-bot-text-muted);
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ gap: 8px;
16
+ font-size: 12px;
17
+ display: flex;
18
+ }
19
+
20
+ .ov-viking-bot__interaction-title {
21
+ color: var(--ov-viking-bot-text);
22
+ font-weight: 500;
23
+ }
24
+
25
+ .ov-viking-bot__interaction-progress {
26
+ font-variant-numeric: tabular-nums;
27
+ }
28
+
29
+ .ov-viking-bot__interaction-question {
30
+ margin: 0;
31
+ font-size: 13px;
32
+ line-height: 1.6;
33
+ }
34
+
35
+ .ov-viking-bot__interaction-error {
36
+ color: var(--ov-viking-bot-danger);
37
+ margin: 0;
38
+ font-size: 12px;
39
+ }
40
+
41
+ .ov-viking-bot__interaction-options {
42
+ flex-direction: column;
43
+ gap: 4px;
44
+ margin: 0;
45
+ padding: 0;
46
+ list-style: none;
47
+ display: flex;
48
+ }
49
+
50
+ .ov-viking-bot__interaction-option {
51
+ border-radius: var(--ov-viking-bot-radius);
52
+ cursor: pointer;
53
+ align-items: center;
54
+ gap: 6px;
55
+ padding: 4px 6px;
56
+ display: flex;
57
+ }
58
+
59
+ .ov-viking-bot__interaction-option:hover {
60
+ background: var(--ov-viking-bot-surface-hover);
61
+ }
62
+
63
+ .ov-viking-bot__interaction-option:focus-within {
64
+ outline: 2px solid var(--ov-viking-bot-focus);
65
+ outline-offset: 1px;
66
+ }
67
+
68
+ .ov-viking-bot__interaction {
69
+ --ov-viking-bot-radius: 6px;
70
+ --ov-viking-bot-text: var(--ov-ui-color-text-1, var(--ov-ui-text-1-default, #0b0b0f));
71
+ --ov-viking-bot-text-muted: var(--ov-ui-color-text-3, var(--ov-ui-text-3-default, #6e718c));
72
+ --ov-viking-bot-accent: var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff));
73
+ --ov-viking-bot-accent-hover: var(--ov-ui-color-primary-hover, var(--ov-ui-primary-hover-default, #7075ff));
74
+ --ov-viking-bot-on-accent: var(--ov-ui-color-bg-1, var(--ov-ui-bg-1-default, #fff));
75
+ --ov-viking-bot-border: var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, #e1e4f2));
76
+ --ov-viking-bot-border-strong: var(--ov-ui-color-border-3, var(--ov-ui-border-3-default, #d7daea));
77
+ --ov-viking-bot-bg: var(--ov-ui-color-bg-1, var(--ov-ui-bg-1-default, #fff));
78
+ --ov-viking-bot-primary-light: var(--ov-ui-color-primary-light, var(--ov-ui-primary-light-default, #f5f7ff));
79
+ --ov-viking-bot-surface: var(--ov-ui-color-bg-4, var(--ov-ui-bg-4-default, #f6f7fa));
80
+ --ov-viking-bot-surface-hover: var(--ov-ui-color-bg-5, var(--ov-ui-bg-5-default, #f1f2f9));
81
+ --ov-viking-bot-focus: var(--ov-ui-color-focus, var(--ov-ui-focus-default, #5252ff));
82
+ --ov-viking-bot-danger: var(--ov-ui-color-status-error, var(--ov-ui-status-error-default, #c43838));
83
+ }
84
+
85
+ .ov-viking-bot__interaction-option input[type="radio"] {
86
+ box-sizing: border-box;
87
+ appearance: none;
88
+ border: 1px solid var(--ov-viking-bot-border-strong);
89
+ cursor: pointer;
90
+ background: none;
91
+ border-radius: 50%;
92
+ flex: none;
93
+ width: 14px;
94
+ height: 14px;
95
+ margin: 0;
96
+ }
97
+
98
+ .ov-viking-bot__interaction-option input[type="radio"]:checked {
99
+ border: 4px solid var(--ov-viking-bot-accent);
100
+ background: var(--ov-viking-bot-on-accent);
101
+ }
102
+
103
+ .ov-viking-bot__interaction-option input[type="radio"]:disabled {
104
+ cursor: not-allowed;
105
+ opacity: .5;
106
+ }
107
+
108
+ .ov-viking-bot__interaction-option small {
109
+ color: var(--ov-viking-bot-text-muted);
110
+ font-size: 11px;
111
+ }
112
+
113
+ .ov-viking-bot__interaction-option code {
114
+ background: var(--ov-viking-bot-surface);
115
+ border-radius: 4px;
116
+ padding: 0 4px;
117
+ font-size: 11px;
118
+ }
119
+
120
+ .ov-viking-bot__interaction-input {
121
+ box-sizing: border-box;
122
+ border: 1px solid var(--ov-viking-bot-border);
123
+ border-radius: var(--ov-viking-bot-radius);
124
+ width: 100%;
125
+ min-width: 0;
126
+ color: inherit;
127
+ font: inherit;
128
+ background: none;
129
+ padding: 6px 8px;
130
+ }
131
+
132
+ .ov-viking-bot__interaction-input:focus-visible {
133
+ outline: 2px solid var(--ov-viking-bot-focus);
134
+ outline-offset: -1px;
135
+ }
136
+
137
+ .ov-viking-bot__interaction-input:disabled {
138
+ background: var(--ov-viking-bot-surface);
139
+ color: var(--ov-viking-bot-text-muted);
140
+ cursor: not-allowed;
141
+ }
142
+
143
+ textarea.ov-viking-bot__interaction-input {
144
+ resize: vertical;
145
+ min-height: 72px;
146
+ }
147
+
148
+ .ov-viking-bot__interaction-hint {
149
+ color: var(--ov-viking-bot-text-muted);
150
+ font-size: 11px;
151
+ }
152
+
153
+ .ov-viking-bot__interaction-submit, .ov-viking-bot__interaction-cancel {
154
+ border: 1px solid var(--ov-viking-bot-border);
155
+ border-radius: var(--ov-viking-bot-radius);
156
+ color: var(--ov-viking-bot-text);
157
+ font: inherit;
158
+ cursor: pointer;
159
+ background: none;
160
+ align-self: flex-start;
161
+ padding: 4px 14px;
162
+ font-size: 12px;
163
+ }
164
+
165
+ .ov-viking-bot__interaction-submit {
166
+ border-color: var(--ov-viking-bot-accent);
167
+ background: var(--ov-viking-bot-accent);
168
+ color: var(--ov-viking-bot-on-accent);
169
+ }
170
+
171
+ .ov-viking-bot__interaction-submit:hover:not(:disabled) {
172
+ border-color: var(--ov-viking-bot-accent-hover);
173
+ background: var(--ov-viking-bot-accent-hover);
174
+ }
175
+
176
+ .ov-viking-bot__interaction-cancel:hover:not(:disabled) {
177
+ background: var(--ov-viking-bot-surface-hover);
178
+ }
179
+
180
+ .ov-viking-bot__interaction-submit:focus-visible, .ov-viking-bot__interaction-cancel:focus-visible {
181
+ outline: 2px solid var(--ov-viking-bot-focus);
182
+ outline-offset: 2px;
183
+ }
184
+
185
+ .ov-viking-bot__interaction-submit:disabled, .ov-viking-bot__interaction-cancel:disabled {
186
+ opacity: .5;
187
+ cursor: not-allowed;
188
+ }
189
+
@@ -0,0 +1,188 @@
1
+ import type { ReactNode } from 'react';
2
+ /** 可选项。An option offered by a question. */
3
+ export interface VikingBotInteractionOption {
4
+ /** 选项值。Option value. */
5
+ value: string;
6
+ /** 选项主文案。Primary label. */
7
+ label: ReactNode;
8
+ /** 选项下方的说明。Description shown under the label. */
9
+ description?: ReactNode;
10
+ /** 选项后附加的等宽片段,例如命令。Monospace snippet after the label. */
11
+ code?: string;
12
+ }
13
+ /** 定时值。A schedule value. */
14
+ export type VikingBotScheduleValue = {
15
+ /** 不启用。Disabled. */
16
+ mode: 'none';
17
+ } | {
18
+ /** 每天。Daily. */
19
+ mode: 'daily';
20
+ /** 时间,`HH:mm`。Time as `HH:mm`. */
21
+ time: string;
22
+ } | {
23
+ /** 每周。Weekly. */
24
+ mode: 'weekly';
25
+ /** 时间,`HH:mm`。Time as `HH:mm`. */
26
+ time: string;
27
+ /** 星期,1 为周一。Weekday, 1 is Monday. */
28
+ weekday: 1 | 2 | 3 | 4 | 5 | 6 | 7;
29
+ };
30
+ /** 修复候选。A repair candidate. */
31
+ export interface VikingBotRepairOption {
32
+ /** 候选标识。Candidate key. */
33
+ id: string;
34
+ /** 候选文案。Candidate label. */
35
+ label: string;
36
+ /** 来源说明。Source description. */
37
+ description?: string;
38
+ }
39
+ /** 自定义问题的渲染上下文。Render context for a custom question. */
40
+ export interface VikingBotInteractionRenderContext {
41
+ /** 是否禁用提交。Whether submission is disabled. */
42
+ disabled?: boolean;
43
+ /** 是否正在提交。Whether a submission is in flight. */
44
+ submitting?: boolean;
45
+ /** 上报答案;由宿主转成它自己的协议。Reports an answer; the host adapts it. */
46
+ submit: (value: unknown) => void | Promise<void>;
47
+ /** 放弃本次交互。Abandons this interaction. */
48
+ cancel: () => void;
49
+ }
50
+ /**
51
+ * 一次待确认的交互。组件内置 `choice`、`text`、`schedule`、`repair` 四种表单;
52
+ * 需要树选择器、上传等宿主能力时用 `custom` 自行渲染。
53
+ * One pending interaction. The component ships `choice`, `text`, `schedule` and
54
+ * `repair`; use `custom` when the form needs host capabilities such as a tree
55
+ * picker or an upload.
56
+ */
57
+ export type VikingBotInteractionRequest = {
58
+ /** 单选。Single choice. */
59
+ kind: 'choice';
60
+ /** 问题文案。Question copy. */
61
+ question?: ReactNode;
62
+ /** 选项。Options. */
63
+ options: readonly VikingBotInteractionOption[];
64
+ /** 是否提供「其他」输入项。Whether an inline "other" input is offered. */
65
+ allowCustomInput?: boolean | {
66
+ placeholder?: string;
67
+ };
68
+ } | {
69
+ /** 文本输入。Free text. */
70
+ kind: 'text';
71
+ /** 问题文案。Question copy. */
72
+ question?: ReactNode;
73
+ /** 初始值。Initial value. */
74
+ initialValue?: string;
75
+ /** 补充说明。Extra description. */
76
+ description?: ReactNode;
77
+ /** 是否多行。Whether the input is multiline. */
78
+ multiline?: boolean;
79
+ } | {
80
+ /** 定时。Schedule. */
81
+ kind: 'schedule';
82
+ /** 问题文案。Question copy. */
83
+ question?: ReactNode;
84
+ /** 时区。Time zone. */
85
+ timezone?: string;
86
+ /** 初始值。Initial value. */
87
+ initialValue: VikingBotScheduleValue;
88
+ } | {
89
+ /** 从候选修复项中选择。Pick one repair candidate. */
90
+ kind: 'repair';
91
+ /** 问题文案。Question copy. */
92
+ question?: ReactNode;
93
+ /** 候选。Candidates. */
94
+ options: readonly VikingBotRepairOption[];
95
+ /** 初始选中的候选标识。Initially selected candidate key. */
96
+ initialValue?: string;
97
+ } | {
98
+ /** 由宿主渲染。Rendered by the host. */
99
+ kind: 'custom';
100
+ /** 问题文案。Question copy. */
101
+ question?: ReactNode;
102
+ /** 渲染函数。Renderer. */
103
+ render: (context: VikingBotInteractionRenderContext) => ReactNode;
104
+ };
105
+ /** 交互答案。An interaction answer. */
106
+ export type VikingBotInteractionAnswer = {
107
+ kind: 'choice';
108
+ value: string;
109
+ } | {
110
+ kind: 'text';
111
+ value: string;
112
+ } | {
113
+ kind: 'schedule';
114
+ value: VikingBotScheduleValue;
115
+ } | {
116
+ kind: 'repair';
117
+ value: string;
118
+ } | {
119
+ kind: 'custom';
120
+ value: unknown;
121
+ };
122
+ /**
123
+ * 交互区文案。组件内置英文默认值,宿主可按需覆盖。
124
+ * Copy of the interaction area. The component ships English defaults; a host
125
+ * overrides any field it needs.
126
+ */
127
+ export interface VikingBotInteractionLabels {
128
+ /** 区域标题,缺省为「待确认」。Area title, "Needs your input" by default. */
129
+ title?: string;
130
+ /** 提交按钮。Submit button. */
131
+ submit?: string;
132
+ /** 取消按钮。Cancel button. */
133
+ cancel?: string;
134
+ /** 「其他」输入项文案。Label of the "other" input. */
135
+ other?: string;
136
+ /** 提交成功提示。Shown after a successful submission. */
137
+ submitted?: string;
138
+ /** 取消提示。Shown after cancelling. */
139
+ cancelled?: string;
140
+ /** 步骤进度,接收当前序号与总数。Step progress, given index and total. */
141
+ progress?: (index: number, total: number) => string;
142
+ /** 不启用定时的选项文案。Label of the "no schedule" option. */
143
+ scheduleNone?: string;
144
+ /** 每天的选项文案。Label of the daily option. */
145
+ scheduleDaily?: string;
146
+ /** 每周的选项文案。Label of the weekly option. */
147
+ scheduleWeekly?: string;
148
+ /** 时间输入的无障碍名称。Accessible name of the time input. */
149
+ scheduleTime?: string;
150
+ /** 星期选择的无障碍名称。Accessible name of the weekday select. */
151
+ scheduleWeekday?: string;
152
+ /** 星期名称,按周一至周日排列。Weekday names, Monday first. */
153
+ weekdays?: readonly string[];
154
+ }
155
+ /**
156
+ * 待确认交互区。宿主从自己的流里算出问题,这里只负责表单与状态;
157
+ * 答案通过 `onSubmit` 上报,宿主决定怎么发回去。
158
+ * The pending-interaction area. The host derives the question from its own
159
+ * stream; this renders the form and its state, and reports the answer.
160
+ */
161
+ export interface VikingBotInteractionProps {
162
+ /** 当前问题。The current question. */
163
+ request: VikingBotInteractionRequest;
164
+ /**
165
+ * 问题的稳定身份;变化时重置表单状态。省略时按 `request.kind` 与序号判定。
166
+ * Stable identity of the question; changes reset the form state. Defaults to
167
+ * the request kind plus the step index.
168
+ */
169
+ requestKey?: string;
170
+ /** 附加到根元素的类名。Class name applied to the root element. */
171
+ className?: string;
172
+ /** 当前步骤序号,从 0 开始。Current step index, starting at 0. */
173
+ index?: number;
174
+ /** 步骤总数。Total number of steps. */
175
+ total?: number;
176
+ /** 是否禁用。Whether the form is disabled. */
177
+ disabled?: boolean;
178
+ /** 是否正在提交。Whether a submission is in flight. */
179
+ submitting?: boolean;
180
+ /** 提交失败的原因。Why the last submission failed. */
181
+ error?: ReactNode;
182
+ /** 上报答案。Reports an answer. */
183
+ onSubmit?: (answer: VikingBotInteractionAnswer) => void | Promise<void>;
184
+ /** 放弃本次交互。Abandons this interaction. */
185
+ onCancel?: () => void;
186
+ /** 可替换文案,缺省为英文。Replaceable copy; English by default. */
187
+ labels?: VikingBotInteractionLabels;
188
+ }
@@ -0,0 +1,9 @@
1
+ import type { VikingBotInteractionProps } from './types.js';
2
+ /**
3
+ * 待确认交互区。表单由 Ark 的 AskHuman 渲染;需要树选择器、上传器等宿主
4
+ * 能力时,`custom` 直接交给宿主渲染。
5
+ *
6
+ * The pending-interaction area. Ark's AskHuman renders the form; when a question
7
+ * needs a tree picker or an uploader, `custom` hands rendering to the host.
8
+ */
9
+ export declare function VikingBotInteractionView({ request, className, requestKey, index, total, disabled, submitting, error, onSubmit, onCancel, labels: overrides, }: VikingBotInteractionProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { DEFAULT_INTERACTION_LABELS } from "../../c7~0.js";
2
+ export { VikingBotInteraction } from "../../w~0.js";
@@ -0,0 +1,2 @@
1
+ import type { VikingBotLabels } from './model.js';
2
+ export declare const DEFAULT_LABELS: Required<VikingBotLabels>;
@@ -0,0 +1,3 @@
1
+ import type { VikingBotComposerProps, VikingBotComposerRef } from './types.js';
2
+ /** 输入区。The composer. */
3
+ export declare const VikingBotComposer: import("react").ForwardRefExoticComponent<VikingBotComposerProps & import("react").RefAttributes<VikingBotComposerRef>>;
@@ -0,0 +1,12 @@
1
+ import type { VikingBotMessage, VikingBotMessagePart } from './model.js';
2
+ /** 把 `viking://` 地址从片段里抽出来,用于渲染可点击引用。 */
3
+ export declare function collectUris(parts: readonly VikingBotMessagePart[]): string[];
4
+ /** 把连续消息按轮次合并,便于渲染同一轮的助手步骤。 */
5
+ export declare function groupMessages(messages: readonly VikingBotMessage[]): VikingBotMessage[];
6
+ /** 取消息的纯文本,用于复制。Plain text of a message, used for copying. */
7
+ export declare function messageText(message: VikingBotMessage): string;
8
+ /** 同一执行块的片段归到一组,供折叠块使用。Groups parts of one activity block. */
9
+ export declare function groupByActivity(parts: readonly VikingBotMessagePart[]): {
10
+ groupId?: string;
11
+ parts: VikingBotMessagePart[];
12
+ }[];