@openviking/react 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.arco-design +21 -0
- package/README.md +25 -15
- package/dist/0~0.js +19 -0
- package/dist/2~0.js +2360 -0
- package/dist/2~0.js.LICENSE.txt +23 -0
- package/dist/3c~0.js +2206 -0
- package/dist/3~0.js +1205 -1982
- package/dist/4~0.js +18 -0
- package/dist/9~0.js +43 -0
- package/dist/ae~0.js +487 -0
- package/dist/ark-message-list-view~0.js +530 -119
- package/dist/a~0.js +1289 -10
- package/dist/c7~0.js +38 -2
- package/dist/ck~0.js +23 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/paths.d.ts +64 -0
- package/dist/client/provider.d.ts +5 -3
- package/dist/client/response.d.ts +31 -0
- package/dist/client/sse.d.ts +39 -0
- package/dist/client/stream.d.ts +26 -0
- package/dist/client/types.d.ts +109 -5
- package/dist/client.js +2 -239
- package/dist/components/agent-connect/agent-connect-copy.d.ts +19 -33
- package/dist/components/agent-connect/agent-connect-design.d.ts +1935 -167
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +135 -0
- package/dist/components/agent-connect/locales/en-US.d.ts +20 -0
- package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
- package/dist/components/agent-connect/style.css +14 -2
- package/dist/components/agent-connect/types.d.ts +2 -1
- package/dist/components/directory-tour/directory-tour.d.ts +3 -0
- package/dist/components/directory-tour/index.d.ts +3 -0
- package/dist/components/directory-tour/locales/en-US.d.ts +3 -0
- package/dist/components/directory-tour/locales/zh-CN.d.ts +3 -0
- package/dist/components/directory-tour/steps.d.ts +5 -0
- package/dist/components/directory-tour/style.css +237 -0
- package/dist/components/directory-tour/style.js +0 -0
- package/dist/components/directory-tour/types.d.ts +42 -0
- package/dist/components/directory-tour/use-tour-anchor.d.ts +5 -0
- package/dist/components/directory-tour/use-tour-position.d.ts +12 -0
- package/dist/components/directory-tour.js +40 -0
- package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
- package/dist/components/file-browser-entries/index.d.ts +1 -0
- package/dist/components/file-browser-entries/labels.d.ts +3 -0
- package/dist/components/file-browser-entries/locales/en-US.d.ts +6 -0
- package/dist/components/file-browser-entries/locales/zh-CN.d.ts +6 -0
- package/dist/components/file-browser-entries/style.css +905 -0
- package/dist/components/file-browser-entries/style.js +0 -0
- package/dist/components/file-browser-entries/types.d.ts +63 -0
- package/dist/components/file-browser-entries.js +1 -0
- package/dist/components/file-preview/file-preview-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-body.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +2 -1
- package/dist/components/file-preview/file-preview-directory.d.ts +33 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-header.d.ts +25 -3
- package/dist/components/file-preview/file-preview-image-frame.d.ts +5 -0
- package/dist/components/file-preview/file-preview-labels.d.ts +2 -14
- package/dist/components/file-preview/file-preview-level-tabs.d.ts +7 -0
- package/dist/components/file-preview/file-preview-markdown-images.d.ts +13 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +44 -0
- package/dist/components/file-preview/file-preview-state.d.ts +10 -3
- package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
- package/dist/components/file-preview/file-preview.d.ts +1 -1
- package/dist/components/file-preview/index.d.ts +2 -1
- package/dist/components/file-preview/level-selection.d.ts +25 -0
- package/dist/components/file-preview/locales/en-US.d.ts +16 -0
- package/dist/components/file-preview/locales/zh-CN.d.ts +16 -0
- package/dist/components/file-preview/style.css +234 -3
- package/dist/components/file-preview/types.d.ts +134 -11
- package/dist/components/file-preview/use-directory-level.d.ts +30 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +6 -2
- package/dist/components/file-preview/use-file-preview-actions.d.ts +1 -1
- package/dist/components/file-preview/use-file-preview-levels.d.ts +7 -0
- package/dist/components/file-preview/use-file-preview-view-state.d.ts +15 -0
- package/dist/components/file-preview.js +1 -1
- package/dist/components/file-tree/file-tree-info-labels.d.ts +0 -15
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +7 -7
- package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
- package/dist/components/file-tree/file-tree-row-context.d.ts +0 -5
- package/dist/components/file-tree/file-tree-row-shared.d.ts +1 -4
- package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +8 -8
- package/dist/components/file-tree/locales/en-US.d.ts +69 -0
- package/dist/components/file-tree/locales/zh-CN.d.ts +69 -0
- package/dist/components/file-tree/style.css +207 -42
- package/dist/components/file-tree/types.d.ts +58 -10
- package/dist/components/file-tree/use-file-tree-actions.d.ts +4 -1
- package/dist/components/scope-switcher/labels.d.ts +3 -0
- package/dist/components/scope-switcher/locales/en-US.d.ts +8 -0
- package/dist/components/scope-switcher/locales/zh-CN.d.ts +8 -0
- package/dist/components/scope-switcher/scope-panel.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +14 -2
- package/dist/components/scope-switcher/types.d.ts +11 -5
- package/dist/components/style.css +10144 -6840
- package/dist/components/tui/locales/en-US.d.ts +35 -0
- package/dist/components/tui/locales/zh-CN.d.ts +35 -0
- package/dist/components/tui/style.css +310 -18
- package/dist/components/tui/tui-copy-button.d.ts +1 -1
- package/dist/components/tui/tui-empty.d.ts +25 -0
- package/dist/components/tui/tui-labels.d.ts +2 -2
- package/dist/components/tui/tui.d.ts +1 -1
- package/dist/components/tui/types.d.ts +35 -12
- package/dist/components/tui.js +1 -1
- package/dist/components/viking-bot/ark-adapter.d.ts +2 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +1 -7
- package/dist/components/viking-bot/ark-message-list-view.d.ts +1 -1
- package/dist/components/viking-bot/ark-message-row.d.ts +3 -1
- package/dist/components/viking-bot/bot-popover.d.ts +9 -0
- package/dist/components/viking-bot/capabilities.d.ts +49 -0
- package/dist/components/viking-bot/composer-attachments.d.ts +13 -0
- package/dist/components/viking-bot/composer-controls.d.ts +10 -0
- package/dist/components/viking-bot/composer-footer.d.ts +17 -0
- package/dist/components/viking-bot/composer-references.d.ts +20 -0
- package/dist/components/viking-bot/composer-text.d.ts +10 -0
- package/dist/components/viking-bot/index.d.ts +3 -1
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +1 -1
- package/dist/components/viking-bot/interaction/labels.d.ts +2 -1
- package/dist/components/viking-bot/interaction/locales/en-US.d.ts +17 -0
- package/dist/components/viking-bot/interaction/locales/zh-CN.d.ts +17 -0
- package/dist/components/viking-bot/interaction/types.d.ts +8 -3
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/locales/en-US.d.ts +40 -0
- package/dist/components/viking-bot/locales/zh-CN.d.ts +40 -0
- package/dist/components/viking-bot/markdown-links.d.ts +27 -0
- package/dist/components/viking-bot/message-activity.d.ts +7 -0
- package/dist/components/viking-bot/message-code-block.d.ts +8 -0
- package/dist/components/viking-bot/message-footer.d.ts +8 -0
- package/dist/components/viking-bot/message-markdown.d.ts +9 -0
- package/dist/components/viking-bot/model.d.ts +37 -3
- package/dist/components/viking-bot/quick-input-tracker.d.ts +16 -0
- package/dist/components/viking-bot/quick-inputs.d.ts +6 -0
- package/dist/components/viking-bot/reference-picker.d.ts +16 -0
- package/dist/components/viking-bot/session-actions.d.ts +11 -0
- package/dist/components/viking-bot/style.css +1486 -48
- package/dist/components/viking-bot/tool-activity.d.ts +9 -0
- package/dist/components/viking-bot/tool-result-links.d.ts +6 -0
- package/dist/components/viking-bot/types.d.ts +21 -9
- package/dist/components/viking-bot/use-quick-input.d.ts +17 -0
- package/dist/components/viking-bot/viking-bot.d.ts +1 -6
- package/dist/components/viking-bot/welcome.d.ts +8 -0
- package/dist/components/viking-bot.js +1 -1
- package/dist/c~0.js +533 -66
- package/dist/e~0.js +333 -0
- package/dist/file-preview-viewer~0.js +90 -8
- package/dist/f~0.js +39 -47
- package/dist/h~0.js +5 -1
- package/dist/icons/console-icons.d.ts +12 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/viking-bot-icons.d.ts +6 -0
- package/dist/icons.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -1
- package/dist/k~0.js +1 -0
- package/dist/lg~0.js +155 -0
- package/dist/lk~0.js +37 -8
- package/dist/l~0.js +1447 -25
- package/dist/modules/console/command-messages.d.ts +19 -0
- package/dist/modules/console/command-parser.d.ts +15 -0
- package/dist/modules/console/command-specs.d.ts +15 -0
- package/dist/modules/console/commands.d.ts +6 -0
- package/dist/modules/console/console-history.d.ts +10 -0
- package/dist/modules/console/console-toolbar.d.ts +18 -0
- package/dist/modules/console/console.d.ts +1 -3
- package/dist/modules/console/controller.d.ts +17 -0
- package/dist/modules/console/index.d.ts +2 -0
- package/dist/modules/console/labels.d.ts +61 -0
- package/dist/modules/console/locales/en-US.d.ts +49 -0
- package/dist/modules/console/locales/zh-CN.d.ts +3 -0
- package/dist/modules/console/localize-records.d.ts +11 -0
- package/dist/modules/console/results.d.ts +2 -0
- package/dist/modules/console/style.css +10905 -15
- package/dist/modules/console/types.d.ts +59 -80
- package/dist/modules/console/use-console.d.ts +3 -0
- package/dist/modules/console.js +1 -1
- package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +34 -0
- package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
- package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
- package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-labels.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +17 -0
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +32 -0
- package/dist/modules/file-browser/file-browser.d.ts +14 -5
- package/dist/modules/file-browser/find-result.d.ts +24 -0
- package/dist/modules/file-browser/fs-directories.d.ts +33 -0
- package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
- package/dist/modules/file-browser/fs-icon.d.ts +17 -0
- package/dist/modules/file-browser/fs-model.d.ts +106 -0
- package/dist/modules/file-browser/fs-page.d.ts +16 -0
- package/dist/modules/file-browser/fs-path.d.ts +16 -0
- package/dist/modules/file-browser/fs-read-directory.d.ts +16 -0
- package/dist/modules/file-browser/fs-scope.d.ts +22 -0
- package/dist/modules/file-browser/fs-stat.d.ts +25 -0
- package/dist/modules/file-browser/index.d.ts +3 -1
- package/dist/modules/file-browser/locales/en-US.d.ts +25 -0
- package/dist/modules/file-browser/locales/zh-CN.d.ts +25 -0
- package/dist/modules/file-browser/style.css +6388 -41
- package/dist/modules/file-browser/types.d.ts +206 -52
- package/dist/modules/file-browser/use-container-width.d.ts +17 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +54 -0
- package/dist/modules/file-browser/use-fs-preview.d.ts +65 -0
- package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
- package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
- package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
- package/dist/modules/file-browser.js +1 -1
- package/dist/modules/scope-cascade/labels.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/en-US.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/zh-CN.d.ts +3 -0
- package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
- package/dist/modules/scope-cascade/style.css +14 -2
- package/dist/modules/scope-cascade/types.d.ts +3 -0
- package/dist/modules/style.css +17338 -77
- package/dist/nx~0.js +15 -0
- package/dist/n~0.js +403 -144
- package/dist/o~0.js +106 -0
- package/dist/p~0.js +27 -0
- package/dist/rslib-runtime~0.js +42 -0
- package/dist/r~0.js +152 -0
- package/dist/shared/components/divider/divider.d.ts +18 -0
- package/dist/shared/components/divider/index.d.ts +1 -0
- package/dist/shared/components/divider/types.d.ts +35 -0
- package/dist/shared/components/drawer/drawer.d.ts +13 -0
- package/dist/shared/components/drawer/index.d.ts +1 -0
- package/dist/shared/components/overlay/types.d.ts +7 -0
- package/dist/shared/components/{tooltip/use-tooltip-position.d.ts → overlay/use-overlay-position.d.ts} +6 -6
- package/dist/shared/components/popover/index.d.ts +1 -0
- package/dist/shared/components/popover/popover.d.ts +23 -0
- package/dist/shared/components/popover/types.d.ts +50 -0
- package/dist/shared/components/resizable/clamp.d.ts +13 -0
- package/dist/shared/components/resizable/index.d.ts +2 -0
- package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
- package/dist/shared/components/resizable/types.d.ts +48 -0
- package/dist/shared/components/tooltip/types.d.ts +5 -5
- package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
- package/dist/shared/locale.d.ts +6 -0
- package/dist/style.css +27753 -7176
- package/dist/u~0.js +75 -58
- package/dist/viking-bot-composer~0.js +434 -77
- package/dist/viking-bot-interaction~0.js +11 -11
- package/package.json +18 -4
- package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -17
- package/dist/components/tui/tui-labels-zh.d.ts +0 -2
- package/dist/g~0.js +0 -1207
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
package/dist/n~0.js
CHANGED
|
@@ -1,6 +1,163 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
2
|
+
import { cloneElement, forwardRef, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { resolveLocale, mergeLabels } from "./nx~0.js";
|
|
3
5
|
import { FolderOpenIcon, FolderIcon, ChevronRightIcon, DocumentIcon } from "./k~0.js";
|
|
6
|
+
import { useOverlayPosition } from "./o~0.js";
|
|
7
|
+
import { searchreact } from "./p~0.js";
|
|
8
|
+
const messages = {
|
|
9
|
+
search: 'Search files…',
|
|
10
|
+
refresh: 'Refresh file tree',
|
|
11
|
+
empty: 'No files yet',
|
|
12
|
+
error: 'Failed to load',
|
|
13
|
+
retry: 'Retry',
|
|
14
|
+
loadMore: 'Load more',
|
|
15
|
+
loading: 'Loading…',
|
|
16
|
+
expand: 'Expand {name}',
|
|
17
|
+
collapse: 'Collapse {name}',
|
|
18
|
+
info: {
|
|
19
|
+
description: {
|
|
20
|
+
userRoot: 'Context data for the current user',
|
|
21
|
+
memories: 'Long-term memory accumulated across sessions',
|
|
22
|
+
peers: 'Context isolated per application or workspace',
|
|
23
|
+
privacy: 'Keys and other sensitive configuration',
|
|
24
|
+
userResources: 'Private knowledge of this user',
|
|
25
|
+
sessions: 'Conversation and task execution records',
|
|
26
|
+
skills: 'Skills and tools available to the agent',
|
|
27
|
+
profile: 'User identity and background',
|
|
28
|
+
preferences: 'Personalized user preferences',
|
|
29
|
+
entities: 'People, projects, organizations and other entities',
|
|
30
|
+
events: 'Key events archived by date',
|
|
31
|
+
identity: 'Agent name and persona',
|
|
32
|
+
soul: 'Agent behaviour guidelines and boundaries',
|
|
33
|
+
cases: 'Interaction cases used to train experience',
|
|
34
|
+
trajectories: 'Reusable task execution trajectories',
|
|
35
|
+
experiences: 'Execution experience distilled automatically',
|
|
36
|
+
sharedResources: 'External resources the agent can reference',
|
|
37
|
+
agentRoot: 'Agent capabilities, tools and experience',
|
|
38
|
+
agentEndpoints: 'Communication endpoints shared across the account',
|
|
39
|
+
agentPayments: 'Payment capabilities shared across the account',
|
|
40
|
+
agentSkills: 'Skill definitions callable across the account',
|
|
41
|
+
agentTools: 'Tool configuration shared across the account',
|
|
42
|
+
memoryRoot: 'Long-term memory and accumulated information',
|
|
43
|
+
resourceRoot: 'External knowledge the agent can reference',
|
|
44
|
+
sessionRoot: 'Raw session records of the user',
|
|
45
|
+
systemRoot: 'Built-in system resources'
|
|
46
|
+
},
|
|
47
|
+
triggerBehavior: {
|
|
48
|
+
userRoot: 'Created from the current user identity; no manual setup needed',
|
|
49
|
+
memories: 'Committed sessions, explicit requests to remember, or continuous extraction from sessions',
|
|
50
|
+
peers: 'Created when connecting as a specific peer, isolating memory and material per peer_id',
|
|
51
|
+
userResources: 'Imported material, uploaded to this user’s private resource directory',
|
|
52
|
+
sessions: 'Created when a session calls OpenViking; messages, tool calls and archives are saved continuously',
|
|
53
|
+
skills: 'Created, installed or imported as a personal skill',
|
|
54
|
+
profile: 'A stable, explicit user background or working style appears in conversation',
|
|
55
|
+
preferences: 'The user explicitly states a specific preference, habit or style',
|
|
56
|
+
entities: 'A person, project or organization worth keeping appears in conversation',
|
|
57
|
+
events: 'An important decision, commitment, arrangement, progress or result appears in dialogue',
|
|
58
|
+
identity: 'Initialized on the first memory extraction run; later updated by write operations',
|
|
59
|
+
soul: 'Initialized on the first memory extraction run; later adjusted by write operations',
|
|
60
|
+
cases: 'A session with a clear task and an evaluable execution result is committed',
|
|
61
|
+
trajectories: 'A task containing decisions, tool calls or multi-step execution is committed',
|
|
62
|
+
experiences: 'Distilled from task cases and execution trajectories',
|
|
63
|
+
sharedResources: 'Imported material, uploaded to a shared resource space',
|
|
64
|
+
agentEndpoints: 'Configured when an integration endpoint is registered for the account',
|
|
65
|
+
agentPayments: 'Configured when a payment capability is enabled for the account',
|
|
66
|
+
agentSkills: 'Installed or imported as a shared skill available to every agent',
|
|
67
|
+
agentTools: 'Configured when a tool is registered for the account'
|
|
68
|
+
},
|
|
69
|
+
field: {
|
|
70
|
+
description: "Description",
|
|
71
|
+
triggerBehavior: 'Trigger',
|
|
72
|
+
path: 'Path'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const en_US = messages;
|
|
77
|
+
const zh_CN_messages = {
|
|
78
|
+
search: '搜索文件…',
|
|
79
|
+
refresh: '刷新文件树',
|
|
80
|
+
empty: '暂无文件',
|
|
81
|
+
error: '加载失败',
|
|
82
|
+
retry: '重试',
|
|
83
|
+
loadMore: '加载更多',
|
|
84
|
+
loading: '加载中…',
|
|
85
|
+
expand: '展开 {name}',
|
|
86
|
+
collapse: '收起 {name}',
|
|
87
|
+
info: {
|
|
88
|
+
description: {
|
|
89
|
+
userRoot: '当前用户的上下文数据',
|
|
90
|
+
memories: '跨会话沉淀的长期记忆',
|
|
91
|
+
peers: '按应用或工作区隔离的上下文',
|
|
92
|
+
privacy: '密钥等敏感配置',
|
|
93
|
+
userResources: '该用户的私有知识资料',
|
|
94
|
+
sessions: '对话与任务运行记录',
|
|
95
|
+
skills: 'Agent 可用的技能与工具',
|
|
96
|
+
profile: '用户身份与背景',
|
|
97
|
+
preferences: '个性化偏好',
|
|
98
|
+
entities: '人物、项目、组织等实体',
|
|
99
|
+
events: '按日期归档的关键事件',
|
|
100
|
+
identity: 'Agent 名称与人设',
|
|
101
|
+
soul: 'Agent 行为准则与边界',
|
|
102
|
+
cases: '用于训练经验的交互案例',
|
|
103
|
+
trajectories: '可复用的任务执行轨迹',
|
|
104
|
+
experiences: '自动提炼的执行经验',
|
|
105
|
+
sharedResources: 'Agent 可引用的外部资料',
|
|
106
|
+
agentRoot: 'Agent 的能力、工具与经验',
|
|
107
|
+
agentEndpoints: '账号内共享的通信端点配置',
|
|
108
|
+
agentPayments: '账号内共享的支付能力配置',
|
|
109
|
+
agentSkills: '账号内可调用的技能定义',
|
|
110
|
+
agentTools: '账号内共享的工具配置',
|
|
111
|
+
memoryRoot: '长期记忆与累积信息',
|
|
112
|
+
resourceRoot: 'Agent 可引用的外部知识',
|
|
113
|
+
sessionRoot: '用户的原始会话记录',
|
|
114
|
+
systemRoot: '系统内置资源'
|
|
115
|
+
},
|
|
116
|
+
triggerBehavior: {
|
|
117
|
+
userRoot: '根据当前用户身份自动建立,无需手动创建',
|
|
118
|
+
memories: '提交会话、主动要求记住信息,或从会话中持续抽取',
|
|
119
|
+
peers: '以特定 peer 身份连接时建立,按 peer_id 隔离记忆与资料',
|
|
120
|
+
userResources: '导入资料时上传到该用户的私有资源目录',
|
|
121
|
+
sessions: '会话调用 OpenViking 时建立,消息、工具调用与归档持续写入',
|
|
122
|
+
skills: '作为个人技能被创建、安装或导入',
|
|
123
|
+
profile: '对话中出现稳定、明确的用户背景或工作方式',
|
|
124
|
+
preferences: '用户明确表达某个偏好、习惯或风格',
|
|
125
|
+
entities: '对话中出现值得保留的人物、项目或组织',
|
|
126
|
+
events: '对话中出现重要决定、承诺、安排、进展或结果',
|
|
127
|
+
identity: '首次记忆抽取时初始化,之后由写入操作更新',
|
|
128
|
+
soul: '首次记忆抽取时初始化,之后由写入操作调整',
|
|
129
|
+
cases: '提交了任务明确、执行结果可评估的会话',
|
|
130
|
+
trajectories: '提交了包含决策、工具调用或多步执行的任务',
|
|
131
|
+
experiences: '从任务案例与执行轨迹中提炼',
|
|
132
|
+
sharedResources: '导入资料时上传到共享资源空间',
|
|
133
|
+
agentEndpoints: '为账号注册集成端点时配置',
|
|
134
|
+
agentPayments: '为账号开通支付能力时配置',
|
|
135
|
+
agentSkills: '作为共享技能安装或导入,供所有 Agent 使用',
|
|
136
|
+
agentTools: '为账号注册工具时配置'
|
|
137
|
+
},
|
|
138
|
+
field: {
|
|
139
|
+
description: '说明',
|
|
140
|
+
triggerBehavior: '触发行为',
|
|
141
|
+
path: '路径'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const zh_CN = zh_CN_messages;
|
|
146
|
+
const LOCALES = {
|
|
147
|
+
'en-US': en_US,
|
|
148
|
+
'zh-CN': zh_CN
|
|
149
|
+
};
|
|
150
|
+
function resolveFileTreeLabels(locale = 'en-US', labels) {
|
|
151
|
+
const defaults = resolveLocale(LOCALES, locale);
|
|
152
|
+
return {
|
|
153
|
+
...mergeLabels(defaults, labels),
|
|
154
|
+
info: {
|
|
155
|
+
description: mergeLabels(defaults.info.description, labels?.info?.description),
|
|
156
|
+
triggerBehavior: mergeLabels(defaults.info.triggerBehavior, labels?.info?.triggerBehavior),
|
|
157
|
+
field: mergeLabels(defaults.info.field, labels?.info?.field)
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
4
161
|
function FileTreeFolderIcon({ open }) {
|
|
5
162
|
return /*#__PURE__*/ jsxs("span", {
|
|
6
163
|
className: "ov-file-tree__folder",
|
|
@@ -59,6 +216,12 @@ const USER_SCOPE_KEY_BY_SEGMENT = {
|
|
|
59
216
|
sessions: 'sessions',
|
|
60
217
|
skills: 'skills'
|
|
61
218
|
};
|
|
219
|
+
const AGENT_KEY_BY_SEGMENT = {
|
|
220
|
+
endpoints: 'agentEndpoints',
|
|
221
|
+
payments: 'agentPayments',
|
|
222
|
+
skills: 'agentSkills',
|
|
223
|
+
tools: 'agentTools'
|
|
224
|
+
};
|
|
62
225
|
const MEMORY_KEY_BY_SEGMENT = {
|
|
63
226
|
'profile.md': 'profile',
|
|
64
227
|
preferences: 'preferences',
|
|
@@ -96,70 +259,149 @@ function resolveFileTreeInfoKey(uri) {
|
|
|
96
259
|
if ('resources' === first) return 'sharedResources';
|
|
97
260
|
return ROOT_KEY_BY_SEGMENT[first] ?? null;
|
|
98
261
|
}
|
|
262
|
+
if (('agent' === first || 'agents' === first) && 2 === segments.length) {
|
|
263
|
+
const second = segments[1];
|
|
264
|
+
return second ? AGENT_KEY_BY_SEGMENT[second] ?? null : null;
|
|
265
|
+
}
|
|
99
266
|
return null;
|
|
100
267
|
}
|
|
101
268
|
function showsInlineDescription(key) {
|
|
102
269
|
return null !== key && !TOOLTIP_ONLY_KEYS.has(key);
|
|
103
270
|
}
|
|
104
|
-
const
|
|
105
|
-
userRoot: 'Context data for the current user',
|
|
106
|
-
memories: 'Long-term memory accumulated across sessions',
|
|
107
|
-
peers: 'Context isolated per application or workspace',
|
|
108
|
-
privacy: 'Keys and other sensitive configuration',
|
|
109
|
-
userResources: 'Private knowledge of this user',
|
|
110
|
-
sessions: 'Conversation and task execution records',
|
|
111
|
-
skills: 'Skills and tools available to the agent',
|
|
112
|
-
profile: 'User identity and background',
|
|
113
|
-
preferences: 'Personalized user preferences',
|
|
114
|
-
entities: 'People, projects, organizations and other entities',
|
|
115
|
-
events: 'Key events archived by date',
|
|
116
|
-
identity: 'Agent name and persona',
|
|
117
|
-
soul: 'Agent behaviour guidelines and boundaries',
|
|
118
|
-
cases: 'Interaction cases used to train experience',
|
|
119
|
-
trajectories: 'Reusable task execution trajectories',
|
|
120
|
-
experiences: 'Execution experience distilled automatically',
|
|
121
|
-
sharedResources: 'External resources the agent can reference',
|
|
122
|
-
agentRoot: 'Agent capabilities, tools and experience',
|
|
123
|
-
memoryRoot: 'Long-term memory and accumulated information',
|
|
124
|
-
resourceRoot: 'External knowledge the agent can reference',
|
|
125
|
-
sessionRoot: 'Raw session records of the user',
|
|
126
|
-
systemRoot: 'Built-in system resources'
|
|
127
|
-
};
|
|
128
|
-
const TRIGGER_BEHAVIOR = {
|
|
129
|
-
userRoot: 'Created from the current user identity; no manual setup needed',
|
|
130
|
-
memories: 'Committed sessions, explicit requests to remember, or continuous extraction from sessions',
|
|
131
|
-
peers: 'Created when connecting as a specific peer, isolating memory and material per peer_id',
|
|
132
|
-
userResources: 'Imported material, uploaded to this user’s private resource directory',
|
|
133
|
-
sessions: 'Created when a session calls OpenViking; messages, tool calls and archives are saved continuously',
|
|
134
|
-
skills: 'Created, installed or imported as a personal skill',
|
|
135
|
-
profile: 'A stable, explicit user background or working style appears in conversation',
|
|
136
|
-
preferences: 'The user explicitly states a specific preference, habit or style',
|
|
137
|
-
entities: 'A person, project or organization worth keeping appears in conversation',
|
|
138
|
-
events: 'An important decision, commitment, arrangement, progress or result appears in dialogue',
|
|
139
|
-
identity: 'Initialized on the first memory extraction run; later updated by write operations',
|
|
140
|
-
soul: 'Initialized on the first memory extraction run; later adjusted by write operations',
|
|
141
|
-
cases: 'A session with a clear task and an evaluable execution result is committed',
|
|
142
|
-
trajectories: 'A task containing decisions, tool calls or multi-step execution is committed',
|
|
143
|
-
experiences: 'Distilled from task cases and execution trajectories',
|
|
144
|
-
sharedResources: 'Imported material, uploaded to a shared resource space'
|
|
145
|
-
};
|
|
146
|
-
const DEFAULT_INFO_LABELS = {
|
|
147
|
-
description: DESCRIPTION,
|
|
148
|
-
triggerBehavior: TRIGGER_BEHAVIOR,
|
|
149
|
-
field: {
|
|
150
|
-
description: "Description",
|
|
151
|
-
triggerBehavior: 'Trigger',
|
|
152
|
-
path: 'Path'
|
|
153
|
-
}
|
|
154
|
-
};
|
|
271
|
+
const DEFAULT_INFO_LABELS = en_US.info;
|
|
155
272
|
function resolveInfoCopy(key, hostLabels) {
|
|
156
|
-
const description = hostLabels?.description?.[key] ??
|
|
157
|
-
const triggerBehavior = hostLabels?.triggerBehavior?.[key] ??
|
|
273
|
+
const description = hostLabels?.description?.[key] ?? DEFAULT_INFO_LABELS.description?.[key] ?? void 0;
|
|
274
|
+
const triggerBehavior = hostLabels?.triggerBehavior?.[key] ?? DEFAULT_INFO_LABELS.triggerBehavior?.[key] ?? void 0;
|
|
158
275
|
return {
|
|
159
276
|
description: description || void 0,
|
|
160
277
|
triggerBehavior: triggerBehavior || void 0
|
|
161
278
|
};
|
|
162
279
|
}
|
|
280
|
+
function useMergedRef(ref, target) {
|
|
281
|
+
return useCallback((node)=>{
|
|
282
|
+
target.current = node;
|
|
283
|
+
if ('function' == typeof ref) ref(node);
|
|
284
|
+
else if (ref) ref.current = node;
|
|
285
|
+
}, [
|
|
286
|
+
ref,
|
|
287
|
+
target
|
|
288
|
+
]);
|
|
289
|
+
}
|
|
290
|
+
function Popover({ children, content, placement = 'right', trigger = 'hover', delay = 300, disabled = false, className, style, onOpenChange }) {
|
|
291
|
+
const [open, setOpen] = useState(false);
|
|
292
|
+
const triggerRef = useRef(null);
|
|
293
|
+
const timerRef = useRef(void 0);
|
|
294
|
+
const [surfaceNode, setSurfaceNode] = useState(null);
|
|
295
|
+
const id = useId();
|
|
296
|
+
const position = useOverlayPosition(open, triggerRef, surfaceNode, placement);
|
|
297
|
+
const change = useCallback((next)=>{
|
|
298
|
+
setOpen(next);
|
|
299
|
+
onOpenChange?.(next);
|
|
300
|
+
}, [
|
|
301
|
+
onOpenChange
|
|
302
|
+
]);
|
|
303
|
+
const clearTimer = useCallback(()=>{
|
|
304
|
+
if (void 0 !== timerRef.current) {
|
|
305
|
+
window.clearTimeout(timerRef.current);
|
|
306
|
+
timerRef.current = void 0;
|
|
307
|
+
}
|
|
308
|
+
}, []);
|
|
309
|
+
useEffect(()=>clearTimer, [
|
|
310
|
+
clearTimer
|
|
311
|
+
]);
|
|
312
|
+
useEffect(()=>{
|
|
313
|
+
if (disabled) {
|
|
314
|
+
clearTimer();
|
|
315
|
+
setOpen(false);
|
|
316
|
+
}
|
|
317
|
+
}, [
|
|
318
|
+
disabled,
|
|
319
|
+
clearTimer
|
|
320
|
+
]);
|
|
321
|
+
useEffect(()=>{
|
|
322
|
+
if (!open || 'click' !== trigger) return;
|
|
323
|
+
const onPointerDown = (event)=>{
|
|
324
|
+
const target = event.target;
|
|
325
|
+
if (surfaceNode?.contains(target) || triggerRef.current?.contains(target)) return;
|
|
326
|
+
change(false);
|
|
327
|
+
};
|
|
328
|
+
const onKeyDown = (event)=>{
|
|
329
|
+
if ('Escape' === event.key) change(false);
|
|
330
|
+
};
|
|
331
|
+
document.addEventListener('mousedown', onPointerDown);
|
|
332
|
+
document.addEventListener('keydown', onKeyDown);
|
|
333
|
+
return ()=>{
|
|
334
|
+
document.removeEventListener('mousedown', onPointerDown);
|
|
335
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
336
|
+
};
|
|
337
|
+
}, [
|
|
338
|
+
change,
|
|
339
|
+
open,
|
|
340
|
+
surfaceNode,
|
|
341
|
+
trigger
|
|
342
|
+
]);
|
|
343
|
+
const show = ()=>{
|
|
344
|
+
if (disabled) return;
|
|
345
|
+
if ('click' === trigger) return void change(!open);
|
|
346
|
+
clearTimer();
|
|
347
|
+
timerRef.current = window.setTimeout(()=>{
|
|
348
|
+
change(true);
|
|
349
|
+
timerRef.current = void 0;
|
|
350
|
+
}, delay);
|
|
351
|
+
};
|
|
352
|
+
const hide = ()=>{
|
|
353
|
+
if ('click' === trigger) return;
|
|
354
|
+
clearTimer();
|
|
355
|
+
change(false);
|
|
356
|
+
};
|
|
357
|
+
const child = children;
|
|
358
|
+
const childProps = child.props;
|
|
359
|
+
const childRef = child.ref;
|
|
360
|
+
const mergedRef = useMergedRef(childRef, triggerRef);
|
|
361
|
+
const declaresExpanded = 'aria-expanded' in childProps;
|
|
362
|
+
const triggerElement = /*#__PURE__*/ cloneElement(child, {
|
|
363
|
+
ref: mergedRef,
|
|
364
|
+
...declaresExpanded ? {} : {
|
|
365
|
+
'aria-expanded': open
|
|
366
|
+
},
|
|
367
|
+
onMouseEnter: (event)=>{
|
|
368
|
+
childProps.onMouseEnter?.(event);
|
|
369
|
+
if ('hover' === trigger) show();
|
|
370
|
+
},
|
|
371
|
+
onMouseLeave: (event)=>{
|
|
372
|
+
childProps.onMouseLeave?.(event);
|
|
373
|
+
if ('hover' === trigger) hide();
|
|
374
|
+
},
|
|
375
|
+
onClick: (event)=>{
|
|
376
|
+
childProps.onClick?.(event);
|
|
377
|
+
if ('click' === trigger) show();
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
const surface = open ? /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
|
|
381
|
+
ref: setSurfaceNode,
|
|
382
|
+
id: id,
|
|
383
|
+
role: 'click' === trigger ? 'dialog' : 'note',
|
|
384
|
+
className: [
|
|
385
|
+
'ov-popover',
|
|
386
|
+
className
|
|
387
|
+
].filter(Boolean).join(' '),
|
|
388
|
+
"data-placement": position.placement,
|
|
389
|
+
style: {
|
|
390
|
+
top: position.top,
|
|
391
|
+
left: position.left,
|
|
392
|
+
...style
|
|
393
|
+
},
|
|
394
|
+
onMouseEnter: 'hover' === trigger ? clearTimer : void 0,
|
|
395
|
+
onMouseLeave: 'hover' === trigger ? hide : void 0,
|
|
396
|
+
children: content
|
|
397
|
+
}), document.body) : null;
|
|
398
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
399
|
+
children: [
|
|
400
|
+
triggerElement,
|
|
401
|
+
surface
|
|
402
|
+
]
|
|
403
|
+
});
|
|
404
|
+
}
|
|
163
405
|
const DEFAULT_FIELDS = {
|
|
164
406
|
description: "Description",
|
|
165
407
|
triggerBehavior: 'Trigger',
|
|
@@ -167,7 +409,8 @@ const DEFAULT_FIELDS = {
|
|
|
167
409
|
};
|
|
168
410
|
function resolveFileTreeInfoCopy(row, infoLabels) {
|
|
169
411
|
const key = resolveFileTreeInfoKey(row.uri);
|
|
170
|
-
|
|
412
|
+
if (!key) return null;
|
|
413
|
+
const builtIn = resolveInfoCopy(key, infoLabels);
|
|
171
414
|
const description = row.description ?? builtIn.description;
|
|
172
415
|
if (!description && !builtIn.triggerBehavior) return null;
|
|
173
416
|
return {
|
|
@@ -183,14 +426,14 @@ function resolveFileTreeInfoCopy(row, infoLabels) {
|
|
|
183
426
|
}
|
|
184
427
|
function FileTreeInfoTooltip({ copy }) {
|
|
185
428
|
const { description, fields, path, title, triggerBehavior } = copy;
|
|
186
|
-
return /*#__PURE__*/ jsxs("
|
|
429
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
187
430
|
className: "ov-file-tree__info",
|
|
188
431
|
children: [
|
|
189
|
-
/*#__PURE__*/ jsx("
|
|
432
|
+
/*#__PURE__*/ jsx("div", {
|
|
190
433
|
className: "ov-file-tree__info-title",
|
|
191
434
|
children: title
|
|
192
435
|
}),
|
|
193
|
-
description ? /*#__PURE__*/ jsxs("
|
|
436
|
+
description ? /*#__PURE__*/ jsxs("div", {
|
|
194
437
|
className: "ov-file-tree__info-row",
|
|
195
438
|
children: [
|
|
196
439
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -203,7 +446,7 @@ function FileTreeInfoTooltip({ copy }) {
|
|
|
203
446
|
})
|
|
204
447
|
]
|
|
205
448
|
}) : null,
|
|
206
|
-
triggerBehavior ? /*#__PURE__*/ jsxs("
|
|
449
|
+
triggerBehavior ? /*#__PURE__*/ jsxs("div", {
|
|
207
450
|
className: "ov-file-tree__info-row",
|
|
208
451
|
children: [
|
|
209
452
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -216,7 +459,7 @@ function FileTreeInfoTooltip({ copy }) {
|
|
|
216
459
|
})
|
|
217
460
|
]
|
|
218
461
|
}) : null,
|
|
219
|
-
/*#__PURE__*/ jsxs("
|
|
462
|
+
/*#__PURE__*/ jsxs("div", {
|
|
220
463
|
className: "ov-file-tree__info-row",
|
|
221
464
|
children: [
|
|
222
465
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -232,31 +475,22 @@ function FileTreeInfoTooltip({ copy }) {
|
|
|
232
475
|
]
|
|
233
476
|
});
|
|
234
477
|
}
|
|
235
|
-
function
|
|
478
|
+
function FileTreeTooltipContent({ row, infoLabels, renderRowTooltip }) {
|
|
236
479
|
if (renderRowTooltip) {
|
|
237
480
|
const custom = renderRowTooltip(row);
|
|
238
481
|
if (null == custom || false === custom) return null;
|
|
239
|
-
return
|
|
240
|
-
role: "tooltip",
|
|
241
|
-
className: "ov-file-tree__tooltip",
|
|
242
|
-
children: custom
|
|
243
|
-
});
|
|
482
|
+
return custom;
|
|
244
483
|
}
|
|
245
484
|
const copy = resolveFileTreeInfoCopy(row, infoLabels);
|
|
246
485
|
if (!copy) return null;
|
|
247
|
-
return /*#__PURE__*/ jsx(
|
|
248
|
-
|
|
249
|
-
className: "ov-file-tree__tooltip",
|
|
250
|
-
children: /*#__PURE__*/ jsx(FileTreeInfoTooltip, {
|
|
251
|
-
copy: copy
|
|
252
|
-
})
|
|
486
|
+
return /*#__PURE__*/ jsx(FileTreeInfoTooltip, {
|
|
487
|
+
copy: copy
|
|
253
488
|
});
|
|
254
489
|
}
|
|
255
|
-
const INDENT =
|
|
256
|
-
const CHEVRON_SIZE = 16;
|
|
490
|
+
const INDENT = 'var(--ov-ui-file-tree-indent, 20px)';
|
|
257
491
|
function rowStyle(depth) {
|
|
258
492
|
return {
|
|
259
|
-
paddingLeft:
|
|
493
|
+
paddingLeft: `calc(2px + ${depth} * ${INDENT})`
|
|
260
494
|
};
|
|
261
495
|
}
|
|
262
496
|
function Guides({ depth }) {
|
|
@@ -267,14 +501,14 @@ function Guides({ depth }) {
|
|
|
267
501
|
"aria-hidden": "true",
|
|
268
502
|
className: "ov-file-tree__guide",
|
|
269
503
|
style: {
|
|
270
|
-
left:
|
|
504
|
+
left: `calc(10px + ${level} * ${INDENT})`
|
|
271
505
|
}
|
|
272
506
|
}, level))
|
|
273
507
|
});
|
|
274
508
|
}
|
|
275
509
|
const FILE_TREE_ROW_ATTRIBUTE = 'data-file-tree-row-id';
|
|
276
510
|
function FileTreeRowView({ row, ctx }) {
|
|
277
|
-
const { text, selectedId,
|
|
511
|
+
const { text, selectedId, getRowAttributes, renderDashboard, renderRowTooltip, renderRowIcon, onSelect, onToggleExpand, onOpenRetentionSettings, onRowKeyDown } = ctx;
|
|
278
512
|
const isDirectory = 'directory' === row.type;
|
|
279
513
|
const canExpand = isDirectory && false !== row.hasChildren;
|
|
280
514
|
const isExpanded = Boolean(row.expanded);
|
|
@@ -293,7 +527,7 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
293
527
|
event.stopPropagation();
|
|
294
528
|
onToggleExpand?.(row);
|
|
295
529
|
};
|
|
296
|
-
|
|
530
|
+
const rowNode = /*#__PURE__*/ jsxs("div", {
|
|
297
531
|
role: "treeitem",
|
|
298
532
|
tabIndex: 0,
|
|
299
533
|
"aria-level": row.depth + 1,
|
|
@@ -315,10 +549,6 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
315
549
|
},
|
|
316
550
|
onClick: handleClick,
|
|
317
551
|
onKeyDown: (event)=>onRowKeyDown(event, row),
|
|
318
|
-
onMouseEnter: ()=>onRowEnter(row.id),
|
|
319
|
-
onMouseLeave: onRowLeave,
|
|
320
|
-
onFocus: ()=>onRowEnter(row.id),
|
|
321
|
-
onBlur: onRowLeave,
|
|
322
552
|
children: [
|
|
323
553
|
/*#__PURE__*/ jsx(Guides, {
|
|
324
554
|
depth: row.depth
|
|
@@ -348,6 +578,7 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
348
578
|
}),
|
|
349
579
|
/*#__PURE__*/ jsxs("span", {
|
|
350
580
|
className: "ov-file-tree__label-group",
|
|
581
|
+
"data-description": Boolean(description) || void 0,
|
|
351
582
|
children: [
|
|
352
583
|
/*#__PURE__*/ jsx("span", {
|
|
353
584
|
className: "ov-file-tree__label",
|
|
@@ -382,14 +613,23 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
382
613
|
dashboard ? /*#__PURE__*/ jsx("span", {
|
|
383
614
|
className: "ov-file-tree__dashboard",
|
|
384
615
|
children: dashboard
|
|
385
|
-
}) : null,
|
|
386
|
-
tooltipRowId === row.id ? /*#__PURE__*/ jsx(FileTreeTooltipSurface, {
|
|
387
|
-
row: row,
|
|
388
|
-
infoLabels: ctx.infoLabels,
|
|
389
|
-
renderRowTooltip: renderRowTooltip
|
|
390
616
|
}) : null
|
|
391
617
|
]
|
|
392
618
|
});
|
|
619
|
+
const custom = renderRowTooltip?.(row);
|
|
620
|
+
const hasContent = renderRowTooltip ? null != custom && false !== custom : null !== resolveFileTreeInfoCopy(row, ctx.infoLabels);
|
|
621
|
+
if (!hasContent) return rowNode;
|
|
622
|
+
const tooltipContent = /*#__PURE__*/ jsx(FileTreeTooltipContent, {
|
|
623
|
+
row: row,
|
|
624
|
+
infoLabels: ctx.infoLabels,
|
|
625
|
+
renderRowTooltip: renderRowTooltip
|
|
626
|
+
});
|
|
627
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
628
|
+
content: tooltipContent,
|
|
629
|
+
placement: "right",
|
|
630
|
+
trigger: "hover",
|
|
631
|
+
children: rowNode
|
|
632
|
+
});
|
|
393
633
|
}
|
|
394
634
|
function FileTreeStateRow({ row, ctx }) {
|
|
395
635
|
const { text, onLoadMore, onRetry, getRowAttributes, renderSpinner } = ctx;
|
|
@@ -567,44 +807,63 @@ function handleRowKeyDown(event, { root, row, onSelect, onToggleExpand }) {
|
|
|
567
807
|
return;
|
|
568
808
|
}
|
|
569
809
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
810
|
+
function FileTreeToolbar({ search, refresh, text, refreshing, onSearch, onRefresh }) {
|
|
811
|
+
if (!search && !refresh) return null;
|
|
812
|
+
const searchDisabled = !onSearch || 'object' == typeof search && search.disabled;
|
|
813
|
+
const refreshDisabled = !onRefresh || 'object' == typeof refresh && refresh.disabled;
|
|
814
|
+
const busy = refreshing || 'object' == typeof refresh && refresh.loading;
|
|
815
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
816
|
+
className: "ov-file-tree__controls",
|
|
817
|
+
children: [
|
|
818
|
+
search ? /*#__PURE__*/ jsxs("button", {
|
|
819
|
+
type: "button",
|
|
820
|
+
className: "ov-file-tree__search",
|
|
821
|
+
disabled: Boolean(searchDisabled),
|
|
822
|
+
onClick: onSearch,
|
|
823
|
+
title: text.search,
|
|
824
|
+
children: [
|
|
825
|
+
/*#__PURE__*/ jsx(searchreact, {
|
|
826
|
+
width: 16,
|
|
827
|
+
height: 16,
|
|
828
|
+
"aria-hidden": "true"
|
|
829
|
+
}),
|
|
830
|
+
/*#__PURE__*/ jsx("span", {
|
|
831
|
+
className: "ov-file-tree__search-label",
|
|
832
|
+
children: text.search
|
|
833
|
+
})
|
|
834
|
+
]
|
|
835
|
+
}) : null,
|
|
836
|
+
refresh ? /*#__PURE__*/ jsx("button", {
|
|
837
|
+
type: "button",
|
|
838
|
+
className: "ov-file-tree__refresh",
|
|
839
|
+
"aria-label": text.refresh,
|
|
840
|
+
title: text.refresh,
|
|
841
|
+
"aria-busy": Boolean(busy),
|
|
842
|
+
disabled: Boolean(refreshDisabled || busy),
|
|
843
|
+
onClick: onRefresh,
|
|
844
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
845
|
+
"aria-hidden": "true",
|
|
846
|
+
width: 14,
|
|
847
|
+
height: 14,
|
|
848
|
+
viewBox: "0 0 16 16",
|
|
849
|
+
fill: "none",
|
|
850
|
+
className: busy ? 'ov-file-tree__refresh-spinning' : void 0,
|
|
851
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
852
|
+
d: "M13 6a5.2 5.2 0 1 0 .15 3.5M13 2.5V6H9.5",
|
|
853
|
+
stroke: "currentColor",
|
|
854
|
+
strokeWidth: "1.5",
|
|
855
|
+
strokeLinecap: "round",
|
|
856
|
+
strokeLinejoin: "round"
|
|
857
|
+
})
|
|
858
|
+
})
|
|
859
|
+
}) : null
|
|
860
|
+
]
|
|
861
|
+
});
|
|
604
862
|
}
|
|
605
863
|
function useFileTreeActions(props) {
|
|
606
864
|
const pending = useRef(new Set());
|
|
607
|
-
const
|
|
865
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
866
|
+
const { select, toggleExpand, loadMore, retry, openRetentionSettings, search, refresh } = props.operations ?? {};
|
|
608
867
|
async function run(key, execute, notify, value) {
|
|
609
868
|
if (pending.current.has(key)) return;
|
|
610
869
|
pending.current.add(key);
|
|
@@ -618,6 +877,13 @@ function useFileTreeActions(props) {
|
|
|
618
877
|
notify?.(value);
|
|
619
878
|
}
|
|
620
879
|
return {
|
|
880
|
+
refreshing,
|
|
881
|
+
onSearch: search ? ()=>void run('search', search, props.onSearch, void 0) : void 0,
|
|
882
|
+
onRefresh: refresh ? ()=>{
|
|
883
|
+
if (pending.current.has('refresh')) return;
|
|
884
|
+
setRefreshing(true);
|
|
885
|
+
run('refresh', refresh, props.onRefresh, void 0).finally(()=>setRefreshing(false));
|
|
886
|
+
} : void 0,
|
|
621
887
|
onSelect: select ? (row)=>void run(`select:${row.id}`, select, props.onSelect, row) : void 0,
|
|
622
888
|
onToggleExpand: toggleExpand ? (row)=>void run(`toggle:${row.id}`, toggleExpand, props.onToggleExpand, row) : void 0,
|
|
623
889
|
onLoadMore: loadMore ? (row)=>void run(`load:${row.id}`, loadMore, props.onLoadMore, row) : void 0,
|
|
@@ -635,33 +901,21 @@ function FileTreeSpinner({ className, ...rest }) {
|
|
|
635
901
|
].filter(Boolean).join(' ')
|
|
636
902
|
});
|
|
637
903
|
}
|
|
638
|
-
const DEFAULT_LABELS = {
|
|
639
|
-
empty: 'No files yet',
|
|
640
|
-
error: 'Failed to load',
|
|
641
|
-
retry: 'Retry',
|
|
642
|
-
loadMore: 'Load more',
|
|
643
|
-
loading: 'Loading…',
|
|
644
|
-
expand: 'Expand {name}',
|
|
645
|
-
collapse: 'Collapse {name}'
|
|
646
|
-
};
|
|
647
904
|
function findRow(root, id) {
|
|
648
905
|
return root?.querySelector(`[${FILE_TREE_ROW_ATTRIBUTE}="${CSS.escape(id)}"]`) ?? null;
|
|
649
906
|
}
|
|
650
|
-
const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, operations, selectedId, isReady = true, loadingFallback, errorFallback, emptyFallback, slots, labels, getRowAttributes, renderDashboard, renderRowTooltip, renderRowIcon, onSelect, onToggleExpand, onLoadMore, onRetry, onOpenRetentionSettings, className, ...rest }, ref) {
|
|
907
|
+
const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, locale, operations, selectedId, search, refresh, isReady = true, loadingFallback, errorFallback, emptyFallback, slots, labels, getRowAttributes, renderDashboard, renderRowTooltip, renderRowIcon, onSelect, onToggleExpand, onLoadMore, onRetry, onOpenRetentionSettings, onSearch, onRefresh, className, ...rest }, ref) {
|
|
651
908
|
const rootRef = useRef(null);
|
|
652
|
-
const text =
|
|
653
|
-
...DEFAULT_LABELS,
|
|
654
|
-
...labels,
|
|
655
|
-
info: labels?.info ?? DEFAULT_LABELS.info
|
|
656
|
-
};
|
|
657
|
-
const tooltip = useRowTooltip();
|
|
909
|
+
const text = resolveFileTreeLabels(locale, labels);
|
|
658
910
|
const actions = useFileTreeActions({
|
|
659
911
|
operations,
|
|
660
912
|
onSelect,
|
|
661
913
|
onToggleExpand,
|
|
662
914
|
onLoadMore,
|
|
663
915
|
onRetry,
|
|
664
|
-
onOpenRetentionSettings
|
|
916
|
+
onOpenRetentionSettings,
|
|
917
|
+
onSearch,
|
|
918
|
+
onRefresh
|
|
665
919
|
});
|
|
666
920
|
useImperativeHandle(ref, ()=>({
|
|
667
921
|
getRowElement: (id)=>findRow(rootRef.current, id),
|
|
@@ -677,9 +931,8 @@ const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, operations,
|
|
|
677
931
|
}), []);
|
|
678
932
|
const ctx = {
|
|
679
933
|
text,
|
|
680
|
-
infoLabels:
|
|
934
|
+
infoLabels: text.info,
|
|
681
935
|
selectedId,
|
|
682
|
-
tooltipRowId: tooltip.tooltipRowId,
|
|
683
936
|
getRowAttributes,
|
|
684
937
|
renderDashboard,
|
|
685
938
|
renderRowTooltip,
|
|
@@ -691,9 +944,7 @@ const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, operations,
|
|
|
691
944
|
row,
|
|
692
945
|
onSelect: actions.onSelect,
|
|
693
946
|
onToggleExpand: actions.onToggleExpand
|
|
694
|
-
})
|
|
695
|
-
onRowEnter: tooltip.show,
|
|
696
|
-
onRowLeave: tooltip.hide
|
|
947
|
+
})
|
|
697
948
|
};
|
|
698
949
|
return /*#__PURE__*/ jsxs("div", {
|
|
699
950
|
...rest,
|
|
@@ -707,6 +958,14 @@ const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, operations,
|
|
|
707
958
|
className: "ov-file-tree__toolbar",
|
|
708
959
|
children: slots.toolbar
|
|
709
960
|
}) : null,
|
|
961
|
+
/*#__PURE__*/ jsx(FileTreeToolbar, {
|
|
962
|
+
search: search,
|
|
963
|
+
refresh: refresh,
|
|
964
|
+
text: text,
|
|
965
|
+
refreshing: actions.refreshing,
|
|
966
|
+
onSearch: actions.onSearch,
|
|
967
|
+
onRefresh: actions.onRefresh
|
|
968
|
+
}),
|
|
710
969
|
/*#__PURE__*/ jsx("div", {
|
|
711
970
|
role: "tree",
|
|
712
971
|
"aria-label": rest['aria-label'],
|