@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
package/dist/lk~0.js ADDED
@@ -0,0 +1,233 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState, useSyncExternalStore } from "react";
3
+ import { ScopeSelector, ScopeSwitcher } from "./f~0.js";
4
+ const indices = [
5
+ 0,
6
+ 1,
7
+ 2
8
+ ];
9
+ const empty = (enabled, parentIds = [])=>({
10
+ options: [],
11
+ enabled,
12
+ loading: false,
13
+ error: null,
14
+ scopeKey: JSON.stringify(parentIds),
15
+ parentIds
16
+ });
17
+ function createScopeController() {
18
+ const snapshots = [
19
+ empty(true),
20
+ empty(false),
21
+ empty(false)
22
+ ];
23
+ const listeners = indices.map(()=>new Set());
24
+ const requests = [];
25
+ let api;
26
+ let active = false;
27
+ const notify = (index)=>listeners[index].forEach((listener)=>listener());
28
+ const update = (index, patch)=>{
29
+ snapshots[index] = {
30
+ ...snapshots[index],
31
+ ...patch
32
+ };
33
+ };
34
+ const abort = (index)=>{
35
+ requests[index]?.abort();
36
+ requests[index] = void 0;
37
+ };
38
+ const resetDescendants = (index)=>{
39
+ for(let next = index + 1; next < 3; next++){
40
+ abort(next);
41
+ const ancestors = snapshots.slice(0, next).map((item)=>item.selected?.id);
42
+ snapshots[next] = empty(ancestors.every((id)=>void 0 !== id), ancestors.filter((id)=>void 0 !== id));
43
+ }
44
+ };
45
+ const load = async (index)=>{
46
+ if (!active || !api || !snapshots[index].enabled) return;
47
+ abort(index);
48
+ const request = new AbortController();
49
+ requests[index] = request;
50
+ update(index, {
51
+ loading: true,
52
+ error: null
53
+ });
54
+ notify(index);
55
+ try {
56
+ const libraryId = snapshots[0].selected?.id;
57
+ const spaceId = snapshots[1].selected?.id;
58
+ const options = await (0 === index ? api.loadLibraries(request.signal) : 1 === index ? api.loadSpaces(libraryId, request.signal) : api.loadUsers(libraryId, spaceId, request.signal));
59
+ if (!active || request.signal.aborted || requests[index] !== request) return;
60
+ const previous = snapshots[index].selected;
61
+ const selected = options.find((option)=>option.id === previous?.id && !option.disabled) ?? options.find((option)=>!option.disabled);
62
+ const changed = void 0 !== selected && selected.id !== previous?.id;
63
+ update(index, {
64
+ options,
65
+ selected,
66
+ loading: false,
67
+ error: null
68
+ });
69
+ const revoked = void 0 !== previous && void 0 === selected;
70
+ if (revoked || changed) resetDescendants(index);
71
+ notify(index);
72
+ if (revoked || changed) for(let next = index + 1; next < 3; next++)notify(next);
73
+ if (changed && index < 2) load(index + 1);
74
+ } catch (error) {
75
+ if (!active || request.signal.aborted || requests[index] !== request) return;
76
+ update(index, {
77
+ loading: false,
78
+ error: error instanceof Error ? error : new Error(String(error))
79
+ });
80
+ notify(index);
81
+ }
82
+ };
83
+ const select = (index, candidate)=>{
84
+ const state = snapshots[index];
85
+ if (!active || !state.enabled || state.loading || state.error) return;
86
+ const option = state.options.find((item)=>item.id === candidate.id && !item.disabled);
87
+ if (!option || option.id === state.selected?.id) return;
88
+ update(index, {
89
+ selected: option
90
+ });
91
+ resetDescendants(index);
92
+ for(let next = index; next < 3; next++)notify(next);
93
+ if (index < 2) load(index + 1);
94
+ };
95
+ const channel = (index)=>({
96
+ getSnapshot: ()=>snapshots[index],
97
+ subscribe: (listener)=>{
98
+ listeners[index].add(listener);
99
+ return ()=>{
100
+ listeners[index].delete(listener);
101
+ };
102
+ },
103
+ select: (option)=>select(index, option),
104
+ refresh: ()=>{
105
+ load(index);
106
+ }
107
+ });
108
+ const controller = {
109
+ levels: [
110
+ channel(0),
111
+ channel(1),
112
+ channel(2)
113
+ ]
114
+ };
115
+ return {
116
+ controller,
117
+ start (nextApi) {
118
+ api = nextApi;
119
+ active = true;
120
+ indices.forEach((index)=>{
121
+ abort(index);
122
+ snapshots[index] = empty(0 === index);
123
+ });
124
+ indices.forEach(notify);
125
+ load(0);
126
+ return ()=>{
127
+ active = false;
128
+ indices.forEach(abort);
129
+ };
130
+ }
131
+ };
132
+ }
133
+ function useScopeCascade({ loadLibraries, loadSpaces, loadUsers }) {
134
+ const [instance] = useState(createScopeController);
135
+ useEffect(()=>instance.start({
136
+ loadLibraries,
137
+ loadSpaces,
138
+ loadUsers
139
+ }), [
140
+ instance,
141
+ loadLibraries,
142
+ loadSpaces,
143
+ loadUsers
144
+ ]);
145
+ return instance.controller;
146
+ }
147
+ function useScopeCascadeLevel(level) {
148
+ return useSyncExternalStore(level.subscribe, level.getSnapshot, level.getSnapshot);
149
+ }
150
+ function ConnectedLevel(props) {
151
+ const state = useScopeCascadeLevel(props.level);
152
+ return /*#__PURE__*/ jsx(LevelView, {
153
+ ...props,
154
+ state: state
155
+ }, state.scopeKey);
156
+ }
157
+ function LevelView({ level, state, name, labels, retryLabel }) {
158
+ const [keyword, setKeyword] = useState('');
159
+ return /*#__PURE__*/ jsx(ScopeSelector, {
160
+ labels: labels,
161
+ kind: "selectable",
162
+ identity: {
163
+ key: name,
164
+ ariaLabel: name
165
+ },
166
+ trigger: {
167
+ label: state.selected?.label ?? name,
168
+ icon: state.selected?.icon
169
+ },
170
+ data: {
171
+ selectedId: state.selected?.id ?? '',
172
+ total: state.options.length,
173
+ options: state.options,
174
+ visibleOptions: state.options.filter((option)=>option.label.toLocaleLowerCase().includes(keyword.toLocaleLowerCase()))
175
+ },
176
+ state: {
177
+ disabled: !state.enabled,
178
+ loading: state.loading,
179
+ error: null !== state.error,
180
+ searchKeyword: keyword
181
+ },
182
+ actions: {
183
+ onSearchKeywordChange: setKeyword,
184
+ onSelect: (option)=>{
185
+ level.select(option);
186
+ setKeyword('');
187
+ }
188
+ },
189
+ slots: {
190
+ errorFallback: /*#__PURE__*/ jsxs(Fragment, {
191
+ children: [
192
+ labels?.error ?? 'Unable to load options',
193
+ ' ',
194
+ /*#__PURE__*/ jsx("button", {
195
+ type: "button",
196
+ onClick: level.refresh,
197
+ children: retryLabel ?? 'Retry'
198
+ })
199
+ ]
200
+ })
201
+ }
202
+ });
203
+ }
204
+ function ScopeCascade({ controller, labels, levelNames = [
205
+ 'Library',
206
+ 'Space',
207
+ 'User'
208
+ ], retryLabel, ...props }) {
209
+ return /*#__PURE__*/ jsxs(ScopeSwitcher, {
210
+ ...props,
211
+ children: [
212
+ /*#__PURE__*/ jsx(ConnectedLevel, {
213
+ level: controller.levels[0],
214
+ name: levelNames[0],
215
+ labels: labels,
216
+ retryLabel: retryLabel
217
+ }),
218
+ /*#__PURE__*/ jsx(ConnectedLevel, {
219
+ level: controller.levels[1],
220
+ name: levelNames[1],
221
+ labels: labels,
222
+ retryLabel: retryLabel
223
+ }),
224
+ /*#__PURE__*/ jsx(ConnectedLevel, {
225
+ level: controller.levels[2],
226
+ name: levelNames[2],
227
+ labels: labels,
228
+ retryLabel: retryLabel
229
+ })
230
+ ]
231
+ });
232
+ }
233
+ export { ScopeCascade, useScopeCascade, useScopeCascadeLevel };
package/dist/l~0.js ADDED
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ function FileBrowserToolbarButton({ icon, children, onClick, disabled, className, ...rest }) {
3
+ return /*#__PURE__*/ jsxs("button", {
4
+ ...rest,
5
+ type: "button",
6
+ disabled: disabled,
7
+ className: [
8
+ 'ov-file-browser__toolbar-button',
9
+ className
10
+ ].filter(Boolean).join(' '),
11
+ onClick: onClick,
12
+ children: [
13
+ /*#__PURE__*/ jsx("span", {
14
+ className: "ov-file-browser__toolbar-button-icon",
15
+ "aria-hidden": "true",
16
+ children: icon
17
+ }),
18
+ /*#__PURE__*/ jsx("span", {
19
+ className: "ov-file-browser__toolbar-button-label",
20
+ children: children
21
+ })
22
+ ]
23
+ });
24
+ }
25
+ function FileBrowser({ className, style, labels }) {
26
+ return /*#__PURE__*/ jsxs("div", {
27
+ className: [
28
+ 'ov-module-placeholder',
29
+ className
30
+ ].filter(Boolean).join(' '),
31
+ style: style,
32
+ children: [
33
+ /*#__PURE__*/ jsx("p", {
34
+ className: "ov-module-placeholder__title",
35
+ children: labels?.title ?? 'File browser'
36
+ }),
37
+ /*#__PURE__*/ jsx("p", {
38
+ className: "ov-module-placeholder__description",
39
+ children: labels?.description ?? 'Placeholder. Functionality is not available yet.'
40
+ })
41
+ ]
42
+ });
43
+ }
44
+ export { FileBrowser, FileBrowserToolbarButton };
@@ -0,0 +1,4 @@
1
+ import type { ConsoleProps } from './types.js';
2
+ export type { ConsoleLabels, ConsoleMode, ConsoleProps, ConsoleSlots, } from './types.js';
3
+ /** 占位组件:渲染一个带模块名的空容器,真实实现随模块 Hook 与组合视图迁入。 */
4
+ export declare function Console({ className, style, labels }: ConsoleProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './console.js';
@@ -0,0 +1,111 @@
1
+ .ov-agent-connect, .ov-file-browser, .ov-file-preview, .ov-file-tree, .ov-module-placeholder, .ov-scope-switcher, .ov-tooltip, .ov-tui, .ov-viking-bot, .ov-viking-bot__interaction {
2
+ --ov-ui-primary-default: #5252ff;
3
+ --ov-ui-primary-hover-default: #7075ff;
4
+ --ov-ui-primary-active-default: #3833d2;
5
+ --ov-ui-primary-light-default: #f5f7ff;
6
+ --ov-ui-connect-glow-warm-default: #ff952b0a;
7
+ --ov-ui-connect-glow-pink-default: #fb4fbc0f;
8
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc0a;
9
+ --ov-ui-on-primary-default: #fff;
10
+ --ov-ui-text-1-default: #0b0b0f;
11
+ --ov-ui-text-2-default: #3f3f51;
12
+ --ov-ui-text-3-default: #6e718c;
13
+ --ov-ui-text-description-default: #0006;
14
+ --ov-ui-text-disabled-default: #a5a7bb;
15
+ --ov-ui-border-1-default: #f0f2fa;
16
+ --ov-ui-border-2-default: #e1e4f2;
17
+ --ov-ui-border-3-default: #d7daea;
18
+ --ov-ui-bg-1-default: #fff;
19
+ --ov-ui-bg-3-default: #f7f8fd;
20
+ --ov-ui-bg-4-default: #f6f7fa;
21
+ --ov-ui-bg-5-default: #f1f2f9;
22
+ --ov-ui-status-success-default: #1f9d55;
23
+ --ov-ui-shadow-default: #0f172a;
24
+ --ov-ui-focus-default: #5252ff;
25
+ --ov-ui-fill-hover-default: #f1f2f9;
26
+ --ov-ui-status-error-default: #c43838;
27
+ --ov-ui-warning-default: #b26a00;
28
+ --ov-ui-warning-light-default: #fff0b3;
29
+ --ov-ui-tooltip-bg-default: #1f2329;
30
+ --ov-ui-tooltip-text-default: #fff;
31
+ }
32
+
33
+ .dark .ov-agent-connect, .dark .ov-file-browser, .dark .ov-file-preview, .dark .ov-file-tree, .dark .ov-module-placeholder, .dark .ov-scope-switcher, .dark .ov-tooltip, .dark .ov-tui, .dark .ov-viking-bot, .dark .ov-viking-bot__interaction {
34
+ --ov-ui-primary-default: #5f5fff;
35
+ --ov-ui-primary-hover-default: #7075ff;
36
+ --ov-ui-primary-active-default: #4242ba;
37
+ --ov-ui-primary-light-default: #1a1632;
38
+ --ov-ui-connect-glow-warm-default: #ff952b05;
39
+ --ov-ui-connect-glow-pink-default: #fb4fbc08;
40
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc05;
41
+ --ov-ui-text-1-default: #c7ccd6;
42
+ --ov-ui-text-2-default: #9da3af;
43
+ --ov-ui-text-3-default: #737a87;
44
+ --ov-ui-text-description-default: #fff6;
45
+ --ov-ui-text-disabled-default: #42464e;
46
+ --ov-ui-border-1-default: #23252a;
47
+ --ov-ui-border-2-default: #2e3138;
48
+ --ov-ui-border-3-default: #3a3d45;
49
+ --ov-ui-bg-1-default: #131416;
50
+ --ov-ui-bg-3-default: #1b1d21;
51
+ --ov-ui-bg-4-default: #202227;
52
+ --ov-ui-bg-5-default: #23252a;
53
+ --ov-ui-focus-default: #5f5fff;
54
+ --ov-ui-fill-hover-default: #23252a;
55
+ --ov-ui-status-error-default: #ff9595;
56
+ --ov-ui-warning-default: #e0a04a;
57
+ --ov-ui-warning-light-default: #3a2f14;
58
+ --ov-ui-tooltip-bg-default: #2a2d33;
59
+ --ov-ui-tooltip-text-default: #f0f1f3;
60
+ }
61
+
62
+ .ov-agent-connect {
63
+ --ov-ui-connect-card-default: #fbfbfc;
64
+ --ov-ui-connect-tabs-default: #f7f7f9;
65
+ --ov-ui-connect-selected-default: #f3f4f7;
66
+ --ov-ui-connect-border-default: #edeef2;
67
+ --ov-ui-connect-outline-default: #e1e3ea;
68
+ --ov-ui-connect-muted-default: #787c91;
69
+ --ov-ui-connect-notice-default: #2e2984;
70
+ }
71
+
72
+ .dark .ov-agent-connect {
73
+ --ov-ui-connect-card-default: var(--ov-ui-bg-3-default);
74
+ --ov-ui-connect-tabs-default: var(--ov-ui-bg-3-default);
75
+ --ov-ui-connect-selected-default: var(--ov-ui-bg-4-default);
76
+ --ov-ui-connect-border-default: var(--ov-ui-border-1-default);
77
+ --ov-ui-connect-outline-default: var(--ov-ui-border-2-default);
78
+ --ov-ui-connect-muted-default: var(--ov-ui-text-3-default);
79
+ --ov-ui-connect-notice-default: var(--ov-ui-text-2-default);
80
+ }
81
+
82
+ .ov-module-placeholder {
83
+ box-sizing: border-box;
84
+ border: 1px dashed
85
+ var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, currentColor));
86
+ border-radius: var(--ov-ui-radius, 6px);
87
+ min-width: 0;
88
+ min-height: 160px;
89
+ color: inherit;
90
+ font: inherit;
91
+ text-align: center;
92
+ overflow-wrap: anywhere;
93
+ flex-direction: column;
94
+ justify-content: center;
95
+ align-items: center;
96
+ gap: 8px;
97
+ padding: 24px;
98
+ display: flex;
99
+ }
100
+
101
+ .ov-module-placeholder__title {
102
+ margin: 0;
103
+ }
104
+
105
+ .ov-module-placeholder__description {
106
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 75%, transparent));
107
+ margin: 0;
108
+ }
109
+
110
+
111
+
@@ -0,0 +1,101 @@
1
+ import type { OvRequestOptions } from '../../client/index.js';
2
+ import type { HTMLAttributes, ReactNode } from 'react';
3
+ /**
4
+ * 面板模式。对话与命令共用同一面板,切换时各自保留状态。
5
+ * Panel mode. Conversation and commands share one panel, each keeping its own
6
+ * state when the mode switches.
7
+ */
8
+ export type ConsoleMode = 'conversation' | 'command';
9
+ /** 交互面板模块的插槽。Slots of the console module. */
10
+ export interface ConsoleSlots {
11
+ /**
12
+ * 面板顶部工具栏。模式切换由模块渲染,这里放宿主专属入口。
13
+ * Panel toolbar. The module renders the mode switch; put host-specific
14
+ * entries here.
15
+ */
16
+ toolbar?: ReactNode;
17
+ /**
18
+ * 对话模式下输入区上方的附加内容,例如当前资源上下文。
19
+ * Extra content above the composer in conversation mode, for example the
20
+ * current resource context.
21
+ */
22
+ conversationContext?: ReactNode;
23
+ /**
24
+ * 命令模式下的命令帮助内容。省略时由模块按宿主声明的命令生成。
25
+ * Command help in command mode. When omitted, the module derives it from the
26
+ * commands the host declares.
27
+ */
28
+ commandHelp?: ReactNode;
29
+ }
30
+ /** 交互面板模块的可替换文案。Replaceable copy of the console module. */
31
+ export interface ConsoleLabels {
32
+ /**
33
+ * 占位说明。缺省为 `Placeholder. Functionality is not available yet.`。
34
+ * Placeholder description. Defaults to "Placeholder. Functionality is not
35
+ * available yet.".
36
+ */
37
+ description?: string;
38
+ /** 对话模式名称。Conversation mode label. */
39
+ conversation?: string;
40
+ /** 命令模式名称。Command mode label. */
41
+ command?: string;
42
+ /** 会话加载失败提示。Session load failure message. */
43
+ error?: string;
44
+ /** 重试按钮文案。Retry button label. */
45
+ retry?: string;
46
+ }
47
+ /**
48
+ * 交互面板模块的属性。
49
+ *
50
+ * 模块自己通过 Hook 取数,props 里没有会话与命令记录:宿主给配置、受控模式、
51
+ * 插槽与文案。打开资源通过回调交给宿主,与文件浏览模块的联动不依赖对方的私有
52
+ * 状态。
53
+ *
54
+ * Props of the console module.
55
+ *
56
+ * The module loads its own data through a Hook, so no prop carries sessions or
57
+ * command records: the host supplies configuration, the controlled mode, slots
58
+ * and copy. Opening a resource goes back to the host through a callback, and
59
+ * coordination with the file browser never reaches into the other module's
60
+ * private state.
61
+ */
62
+ export interface ConsoleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect' | 'children'> {
63
+ /**
64
+ * 受控的当前模式。传入时由宿主决定模式,模块只上报切换意图。
65
+ * The controlled mode. When given, the host owns the mode and the module only
66
+ * reports switch intent.
67
+ */
68
+ mode?: ConsoleMode;
69
+ /**
70
+ * 非受控时的初始模式,缺省为 `conversation`。
71
+ * Initial mode when uncontrolled; defaults to `conversation`.
72
+ */
73
+ defaultMode?: ConsoleMode;
74
+ /**
75
+ * 模式变化后触发。
76
+ * Called after the mode changes.
77
+ */
78
+ onModeChange?: (mode: ConsoleMode) => void;
79
+ /**
80
+ * 资源成功打开后触发,参数为资源 URI;失败时不触发。
81
+ * Called after a resource opens successfully, with its URI; not called on
82
+ * failure.
83
+ */
84
+ onOpenUri?: (uri: string) => void;
85
+ /**
86
+ * 插槽,见 {@link ConsoleSlots}。
87
+ * Slots, see {@link ConsoleSlots}.
88
+ */
89
+ slots?: ConsoleSlots;
90
+ /**
91
+ * 可替换文案,缺省为英文。
92
+ * Replaceable copy; English by default.
93
+ */
94
+ labels?: ConsoleLabels;
95
+ /**
96
+ * 请求配置覆盖,逐字段覆盖最近的 Provider。
97
+ * Request configuration override, applied field by field over the nearest
98
+ * Provider.
99
+ */
100
+ requestOptions?: OvRequestOptions;
101
+ }
@@ -0,0 +1 @@
1
+ export { Console } from "../a~0.js";
@@ -0,0 +1,10 @@
1
+ import type { FileBrowserToolbarButtonProps } from './types.js';
2
+ /**
3
+ * 工具栏按钮。模块自己的搜索与刷新用它渲染,宿主在 `toolbarActions` 里也用它
4
+ * 组合入口,两边的外观因此保持一致。
5
+ *
6
+ * A toolbar button. The module renders its own search and refresh with it, and
7
+ * the host composes its entries with it inside `toolbarActions`, so both sides
8
+ * look the same.
9
+ */
10
+ export declare function FileBrowserToolbarButton({ icon, children, onClick, disabled, className, ...rest }: FileBrowserToolbarButtonProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { FileBrowserToolbarButton } from './file-browser-toolbar-button.js';
2
+ import type { FileBrowserProps } from './types.js';
3
+ export { FileBrowserToolbarButton };
4
+ export type { FileBrowserLabels, FileBrowserProps, FileBrowserToolbarButtonProps, } from './types.js';
5
+ /** 占位组件:渲染一个带模块名的空容器,真实实现随模块 Hook 与组合视图迁入。 */
6
+ export declare function FileBrowser({ className, style, labels }: FileBrowserProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './file-browser.js';
@@ -0,0 +1,158 @@
1
+ .ov-agent-connect, .ov-file-browser, .ov-file-preview, .ov-file-tree, .ov-module-placeholder, .ov-scope-switcher, .ov-tooltip, .ov-tui, .ov-viking-bot, .ov-viking-bot__interaction {
2
+ --ov-ui-primary-default: #5252ff;
3
+ --ov-ui-primary-hover-default: #7075ff;
4
+ --ov-ui-primary-active-default: #3833d2;
5
+ --ov-ui-primary-light-default: #f5f7ff;
6
+ --ov-ui-connect-glow-warm-default: #ff952b0a;
7
+ --ov-ui-connect-glow-pink-default: #fb4fbc0f;
8
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc0a;
9
+ --ov-ui-on-primary-default: #fff;
10
+ --ov-ui-text-1-default: #0b0b0f;
11
+ --ov-ui-text-2-default: #3f3f51;
12
+ --ov-ui-text-3-default: #6e718c;
13
+ --ov-ui-text-description-default: #0006;
14
+ --ov-ui-text-disabled-default: #a5a7bb;
15
+ --ov-ui-border-1-default: #f0f2fa;
16
+ --ov-ui-border-2-default: #e1e4f2;
17
+ --ov-ui-border-3-default: #d7daea;
18
+ --ov-ui-bg-1-default: #fff;
19
+ --ov-ui-bg-3-default: #f7f8fd;
20
+ --ov-ui-bg-4-default: #f6f7fa;
21
+ --ov-ui-bg-5-default: #f1f2f9;
22
+ --ov-ui-status-success-default: #1f9d55;
23
+ --ov-ui-shadow-default: #0f172a;
24
+ --ov-ui-focus-default: #5252ff;
25
+ --ov-ui-fill-hover-default: #f1f2f9;
26
+ --ov-ui-status-error-default: #c43838;
27
+ --ov-ui-warning-default: #b26a00;
28
+ --ov-ui-warning-light-default: #fff0b3;
29
+ --ov-ui-tooltip-bg-default: #1f2329;
30
+ --ov-ui-tooltip-text-default: #fff;
31
+ }
32
+
33
+ .dark .ov-agent-connect, .dark .ov-file-browser, .dark .ov-file-preview, .dark .ov-file-tree, .dark .ov-module-placeholder, .dark .ov-scope-switcher, .dark .ov-tooltip, .dark .ov-tui, .dark .ov-viking-bot, .dark .ov-viking-bot__interaction {
34
+ --ov-ui-primary-default: #5f5fff;
35
+ --ov-ui-primary-hover-default: #7075ff;
36
+ --ov-ui-primary-active-default: #4242ba;
37
+ --ov-ui-primary-light-default: #1a1632;
38
+ --ov-ui-connect-glow-warm-default: #ff952b05;
39
+ --ov-ui-connect-glow-pink-default: #fb4fbc08;
40
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc05;
41
+ --ov-ui-text-1-default: #c7ccd6;
42
+ --ov-ui-text-2-default: #9da3af;
43
+ --ov-ui-text-3-default: #737a87;
44
+ --ov-ui-text-description-default: #fff6;
45
+ --ov-ui-text-disabled-default: #42464e;
46
+ --ov-ui-border-1-default: #23252a;
47
+ --ov-ui-border-2-default: #2e3138;
48
+ --ov-ui-border-3-default: #3a3d45;
49
+ --ov-ui-bg-1-default: #131416;
50
+ --ov-ui-bg-3-default: #1b1d21;
51
+ --ov-ui-bg-4-default: #202227;
52
+ --ov-ui-bg-5-default: #23252a;
53
+ --ov-ui-focus-default: #5f5fff;
54
+ --ov-ui-fill-hover-default: #23252a;
55
+ --ov-ui-status-error-default: #ff9595;
56
+ --ov-ui-warning-default: #e0a04a;
57
+ --ov-ui-warning-light-default: #3a2f14;
58
+ --ov-ui-tooltip-bg-default: #2a2d33;
59
+ --ov-ui-tooltip-text-default: #f0f1f3;
60
+ }
61
+
62
+ .ov-agent-connect {
63
+ --ov-ui-connect-card-default: #fbfbfc;
64
+ --ov-ui-connect-tabs-default: #f7f7f9;
65
+ --ov-ui-connect-selected-default: #f3f4f7;
66
+ --ov-ui-connect-border-default: #edeef2;
67
+ --ov-ui-connect-outline-default: #e1e3ea;
68
+ --ov-ui-connect-muted-default: #787c91;
69
+ --ov-ui-connect-notice-default: #2e2984;
70
+ }
71
+
72
+ .dark .ov-agent-connect {
73
+ --ov-ui-connect-card-default: var(--ov-ui-bg-3-default);
74
+ --ov-ui-connect-tabs-default: var(--ov-ui-bg-3-default);
75
+ --ov-ui-connect-selected-default: var(--ov-ui-bg-4-default);
76
+ --ov-ui-connect-border-default: var(--ov-ui-border-1-default);
77
+ --ov-ui-connect-outline-default: var(--ov-ui-border-2-default);
78
+ --ov-ui-connect-muted-default: var(--ov-ui-text-3-default);
79
+ --ov-ui-connect-notice-default: var(--ov-ui-text-2-default);
80
+ }
81
+
82
+ .ov-file-browser__toolbar-button {
83
+ align-items: center;
84
+ gap: var(--ov-ui-space-2, 8px);
85
+ padding: var(--ov-ui-space-2, 8px) var(--ov-ui-space-3, 12px);
86
+ border-radius: var(--ov-ui-radius-sm, 4px);
87
+ color: var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff));
88
+ font: inherit;
89
+ cursor: pointer;
90
+ background: none;
91
+ border: 0;
92
+ display: inline-flex;
93
+ }
94
+
95
+ .ov-file-browser__toolbar-button:hover:not(:disabled) {
96
+ background: var(--ov-ui-color-fill-hover, var(--ov-ui-fill-hover-default, #f1f2f9));
97
+ }
98
+
99
+ .ov-file-browser__toolbar-button:focus-visible {
100
+ outline: 2px solid
101
+ var(--ov-ui-color-focus, var(--ov-ui-focus-default, #5252ff));
102
+ outline-offset: 2px;
103
+ }
104
+
105
+ .ov-file-browser__toolbar-button:disabled {
106
+ color: var(--ov-ui-color-text-disabled, var(--ov-ui-text-disabled-default, #a5a7bb));
107
+ cursor: not-allowed;
108
+ }
109
+
110
+ .ov-file-browser__toolbar-button-icon {
111
+ flex: none;
112
+ display: inline-flex;
113
+ }
114
+
115
+ .ov-file-browser__toolbar-button-label {
116
+ white-space: nowrap;
117
+ }
118
+
119
+ .ov-file-browser__toolbar-actions > * + :before {
120
+ content: "";
121
+ width: 1px;
122
+ height: 16px;
123
+ margin-right: var(--ov-ui-space-2, 8px);
124
+ background: var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, #e1e4f2));
125
+ vertical-align: middle;
126
+ display: inline-block;
127
+ }
128
+
129
+ .ov-module-placeholder {
130
+ box-sizing: border-box;
131
+ border: 1px dashed
132
+ var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, currentColor));
133
+ border-radius: var(--ov-ui-radius, 6px);
134
+ min-width: 0;
135
+ min-height: 160px;
136
+ color: inherit;
137
+ font: inherit;
138
+ text-align: center;
139
+ overflow-wrap: anywhere;
140
+ flex-direction: column;
141
+ justify-content: center;
142
+ align-items: center;
143
+ gap: 8px;
144
+ padding: 24px;
145
+ display: flex;
146
+ }
147
+
148
+ .ov-module-placeholder__title {
149
+ margin: 0;
150
+ }
151
+
152
+ .ov-module-placeholder__description {
153
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 75%, transparent));
154
+ margin: 0;
155
+ }
156
+
157
+
158
+