@openviking/react 0.1.5 → 0.1.7

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 (145) hide show
  1. package/README.md +15 -11
  2. package/dist/2~0.js +6 -5
  3. package/dist/37~0.js +27 -0
  4. package/dist/3c~0.js +24 -12
  5. package/dist/3~0.js +19 -9
  6. package/dist/ae~0.js +8 -1
  7. package/dist/ark-message-list-view~0.js +9 -4
  8. package/dist/a~0.js +13 -7
  9. package/dist/c7r~0.js +50 -0
  10. package/dist/ck~0.js +7 -0
  11. package/dist/client/paths.d.ts +10 -0
  12. package/dist/client/provider.d.ts +6 -1
  13. package/dist/components/agent-connect/style.css +268 -37
  14. package/dist/components/directory-tour/style.css +265 -21
  15. package/dist/components/directory-tour.js +1 -1
  16. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  17. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  18. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  19. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  20. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  21. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  22. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  23. package/dist/components/experience-dashboard/index.d.ts +2 -0
  24. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  25. package/dist/components/experience-dashboard/style.css +914 -0
  26. package/dist/components/experience-dashboard/style.js +0 -0
  27. package/dist/components/experience-dashboard/types.d.ts +106 -0
  28. package/dist/components/experience-dashboard.js +1 -0
  29. package/dist/components/file-browser-entries/style.css +463 -86
  30. package/dist/components/file-preview/style.css +267 -78
  31. package/dist/components/file-tree/file-tree-toolbar.d.ts +3 -3
  32. package/dist/components/file-tree/locales/en-US.d.ts +3 -0
  33. package/dist/components/file-tree/locales/zh-CN.d.ts +3 -0
  34. package/dist/components/file-tree/style.css +372 -88
  35. package/dist/components/file-tree/types.d.ts +13 -4
  36. package/dist/components/scope-switcher/style.css +412 -39
  37. package/dist/components/style.css +9326 -4553
  38. package/dist/components/tui/style.css +385 -67
  39. package/dist/components/viking-bot/interaction/style.css +143 -22
  40. package/dist/components/viking-bot/style.css +1075 -278
  41. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  42. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  43. package/dist/components/wiki-dashboard/style.css +956 -0
  44. package/dist/components/wiki-dashboard/style.js +0 -0
  45. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  46. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  47. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  48. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  49. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  50. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  51. package/dist/components/wiki-dashboard.js +1 -0
  52. package/dist/c~0.js +16 -8
  53. package/dist/ep~0.js +345 -0
  54. package/dist/e~0.js +33 -328
  55. package/dist/fj~0.js +507 -0
  56. package/dist/fl~0.js +709 -0
  57. package/dist/f~0.js +12 -27
  58. package/dist/icons/index.d.ts +28 -0
  59. package/dist/icons.js +1 -1
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +3 -1
  62. package/dist/k~0.js +277 -1
  63. package/dist/lk~0.js +56 -14
  64. package/dist/l~0.js +2786 -446
  65. package/dist/modules/console/index.d.ts +1 -2
  66. package/dist/modules/console/style.css +1787 -346
  67. package/dist/modules/console.js +1 -1
  68. package/dist/modules/file-browser/acl/acl-add-principal.d.ts +12 -0
  69. package/dist/modules/file-browser/acl/acl-candidate.d.ts +8 -0
  70. package/dist/modules/file-browser/acl/acl-client.d.ts +13 -0
  71. package/dist/modules/file-browser/acl/acl-confirmation.d.ts +6 -0
  72. package/dist/modules/file-browser/acl/acl-entry.d.ts +13 -0
  73. package/dist/modules/file-browser/acl/acl-labels.d.ts +47 -0
  74. package/dist/modules/file-browser/acl/acl-menu.d.ts +10 -0
  75. package/dist/modules/file-browser/acl/acl-modal.d.ts +17 -0
  76. package/dist/modules/file-browser/acl/acl-model.d.ts +17 -0
  77. package/dist/modules/file-browser/acl/acl-principal-tabs.d.ts +6 -0
  78. package/dist/modules/file-browser/acl/acl-tag.d.ts +7 -0
  79. package/dist/modules/file-browser/acl/locales/en-US.d.ts +44 -0
  80. package/dist/modules/file-browser/acl/locales/zh-CN.d.ts +44 -0
  81. package/dist/modules/file-browser/acl/use-acl-principals.d.ts +17 -0
  82. package/dist/modules/file-browser/acl/use-acl-report.d.ts +27 -0
  83. package/dist/modules/file-browser/acl-types.d.ts +86 -0
  84. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  85. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  86. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  87. package/dist/modules/file-browser/dashboard-model.d.ts +17 -0
  88. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  89. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  90. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  91. package/dist/modules/file-browser/file-browser-detail.d.ts +4 -1
  92. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  93. package/dist/modules/file-browser/file-browser-search.d.ts +20 -0
  94. package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -10
  95. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +4 -7
  96. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  97. package/dist/modules/file-browser/fs-directories.d.ts +9 -0
  98. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  99. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  100. package/dist/modules/file-browser/fs-model.d.ts +15 -3
  101. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  102. package/dist/modules/file-browser/index.d.ts +3 -2
  103. package/dist/modules/file-browser/locales/en-US.d.ts +5 -0
  104. package/dist/modules/file-browser/locales/zh-CN.d.ts +5 -0
  105. package/dist/modules/file-browser/style.css +4033 -483
  106. package/dist/modules/file-browser/types.d.ts +82 -20
  107. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  108. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  109. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  110. package/dist/modules/file-browser/use-file-browser-acl.d.ts +15 -0
  111. package/dist/modules/file-browser/use-file-browser.d.ts +6 -51
  112. package/dist/modules/file-browser/use-fs-tree.d.ts +3 -0
  113. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  114. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  115. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  116. package/dist/modules/file-browser.js +1 -1
  117. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  118. package/dist/modules/scope-cascade/index.d.ts +1 -2
  119. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  120. package/dist/modules/scope-cascade/style.css +581 -39
  121. package/dist/modules/scope-cascade/types.d.ts +8 -3
  122. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  123. package/dist/modules/scope-cascade.js +1 -1
  124. package/dist/modules/style.css +13589 -7966
  125. package/dist/n~0.js +73 -165
  126. package/dist/rt~0.js +255 -0
  127. package/dist/r~0.js +18 -39
  128. package/dist/shared/components/button/button.d.ts +20 -0
  129. package/dist/shared/components/input/input.d.ts +17 -0
  130. package/dist/shared/components/modal/locales/en-US.d.ts +4 -0
  131. package/dist/shared/components/modal/locales/zh-CN.d.ts +4 -0
  132. package/dist/shared/components/modal/modal.d.ts +2 -0
  133. package/dist/shared/components/modal/types.d.ts +18 -0
  134. package/dist/shared/components/overlay/lock-body-scroll.d.ts +1 -0
  135. package/dist/shared/components/popover/popover.d.ts +1 -1
  136. package/dist/shared/components/popover/types.d.ts +7 -1
  137. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  138. package/dist/static/image/dashboard-background.png +0 -0
  139. package/dist/style.css +16088 -5602
  140. package/dist/s~0.js +16 -0
  141. package/dist/u~0.js +15 -6
  142. package/dist/viking-bot-composer~0.js +30 -12
  143. package/dist/viking-bot-interaction~0.js +2 -1
  144. package/package.json +14 -3
  145. package/dist/o~0.js +0 -106
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 与服务端一致的行切分。
3
+ *
4
+ * `content/read` 的 `offset` / `limit` 是行号,服务端用 Python 的
5
+ * `str.splitlines(keepends=True)` 切分。前端自己切行时必须用同一套边界,否则两边
6
+ * 数出的行数不同:单独一个 `\r` 在 Python 里是一行结束,`split('\n')` 却看不见它;
7
+ * 而「2000 行、每行以 `\n` 结尾」的文本在 `split('\n')` 下会多出一个末尾空串,被
8
+ * 当成第 2001 行。
9
+ *
10
+ * Line splitting that matches the server.
11
+ *
12
+ * `offset` / `limit` on `content/read` are line numbers, and the server splits with
13
+ * Python's `str.splitlines(keepends=True)`. A client that slices lines itself has to
14
+ * use the same boundaries or the two disagree on how many lines there are: a lone
15
+ * `\r` ends a line in Python while `split('\n')` does not see it, and a text of 2000
16
+ * lines each ending in `\n` gains a trailing empty element under `split('\n')` that
17
+ * looks like a 2001st line.
18
+ */
19
+ /**
20
+ * 按服务端的分隔符切行,每行保留自己的换行符;末尾的换行符不产生额外空行。
21
+ *
22
+ * 空串返回空数组,与服务端一致——`''.splitlines()` 也是 `[]`。
23
+ *
24
+ * Splits into lines at the server's separators, each line keeping its own terminator;
25
+ * a trailing terminator produces no extra empty line.
26
+ *
27
+ * An empty string yields an empty array, matching the server: `''.splitlines()` is
28
+ * `[]` too.
29
+ */
30
+ export declare function splitLines(text: string): string[];
31
+ /**
32
+ * 把行拼回文本。行自带换行符,直接相连即可,不额外补。
33
+ * Joins lines back into text. Each line carries its own terminator, so they simply
34
+ * concatenate without adding any.
35
+ */
36
+ export declare function joinLines(lines: readonly string[]): string;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 记忆文件末尾的 `MEMORY_FIELDS` 注释:服务端写给系统的内部元数据(版本、来源
3
+ * 追踪 id、记忆类型),不属于正文,也不该出现在预览里。
4
+ *
5
+ * 正常读取(`content/read` 不带 `raw`)由服务端先剥掉它再按 offset/limit 切片,
6
+ * 这里的处理是同一规则的兜底:宿主可能通过自定义传输层或网关让请求带上
7
+ * `raw=true`,那条路径返回的是原始字节,尾注会原样回来。
8
+ *
9
+ * 规则与后端保持一致,而不是「看到同形注释就删」:
10
+ *
11
+ * - 只认**位于文件末尾**的那一块(其后只剩空白),正文中间出现的同形注释属于
12
+ * 内容本身,例如资源文档里举例的这段标记;
13
+ * - 连续多块尾注一起剥掉;
14
+ * - 只在记忆命名空间生效,资源与技能文件不经过这一步。
15
+ *
16
+ * 空白与「单词字符」都按 Python 的语义判定,不沿用 JS 的 `\s` / `\b` / `trim()`:
17
+ * 两者集合并不相同,照搬会在默认 `raw=false` 路径上删掉服务端已经保留的正文。
18
+ * 详见下面两个字符集的说明。
19
+ *
20
+ * The `MEMORY_FIELDS` comment at the end of a memory file: internal metadata the
21
+ * server writes for its own bookkeeping (version, trace ids, memory type). It is not
22
+ * part of the body and must not reach the preview.
23
+ *
24
+ * A normal read (`content/read` without `raw`) has the server strip it before slicing
25
+ * by offset/limit; the handling here is the same rule as a fallback. A host can make
26
+ * the request carry `raw=true` through a custom transport or a gateway, and that path
27
+ * returns the stored bytes with the trailer intact.
28
+ *
29
+ * The rule mirrors the backend rather than "delete anything shaped like this":
30
+ *
31
+ * - only the block that ends the file counts (nothing but whitespace after it); a
32
+ * same-shaped comment in the middle is content, such as one quoted in a resource
33
+ * document;
34
+ * - consecutive trailing blocks are all removed;
35
+ * - it applies to the memory namespace only — resource and skill files never go
36
+ * through it.
37
+ *
38
+ * Whitespace and "word characters" follow Python's definitions rather than JS's
39
+ * `\s` / `\b` / `trim()`. The two sets differ, and copying JS's would delete body text
40
+ * the server deliberately kept on the default `raw=false` path. Both sets are spelled
41
+ * out below.
42
+ */
43
+ /**
44
+ * 该 URI 是否落在记忆命名空间。`viking://~/memories/...` 这类当前用户别名按
45
+ * `user/<uid>` 展开后再判断,与请求边界上的解析一致。
46
+ *
47
+ * Whether the URI sits in the memory namespace. The `viking://~/memories/...` home
48
+ * alias is expanded to `user/<uid>` first, matching how the request boundary resolves
49
+ * it.
50
+ */
51
+ export declare function isMemoryUri(uri: string): boolean;
52
+ /**
53
+ * 剥掉文件末尾的 `MEMORY_FIELDS` 尾注;没有尾注时原样返回。
54
+ *
55
+ * 每次循环只认「其后全是空白」的最后一块,剥完再判断一次,因为连续多块尾注
56
+ * 需要逐个处理;正文中间的同形注释因此不会被误删。
57
+ *
58
+ * Removes the trailing `MEMORY_FIELDS` blocks; returns the text unchanged when there
59
+ * is none.
60
+ *
61
+ * Each pass takes only the last block that nothing but whitespace follows, then checks
62
+ * again, because consecutive trailing blocks need one pass each; a same-shaped comment
63
+ * in the middle of the body is therefore never removed.
64
+ */
65
+ export declare function stripMemoryFieldsTrailer(text: string): string;
@@ -12,6 +12,9 @@ export interface FsEntry {
12
12
  size?: number;
13
13
  modTime?: string;
14
14
  abstract?: string;
15
+ tags?: readonly string[];
16
+ access?: 'denied' | 'container';
17
+ permission?: 'read' | 'write' | 'manage';
15
18
  }
16
19
  /** 一个目录已加载的子节点与分页状态。 */
17
20
  export interface DirState {
@@ -54,16 +57,25 @@ export declare function nameFromUri(uri: string): string;
54
57
  * `index` is for search results: one URI can appear in two categories, and row
55
58
  * ids must be unique or selection and scroll targeting hit the wrong row.
56
59
  */
57
- export declare function toEntryRow(entry: FsEntry, depth: number, expanded: boolean, index?: number, busy?: boolean): FileTreeEntryRow;
60
+ export declare function toEntryRow(entry: FsEntry, depth: number, expanded: boolean, index?: number, busy?: boolean): FileTreeEntryRow & {
61
+ tags?: readonly string[];
62
+ };
58
63
  /**
59
64
  * 一个文件的预览页签。行数达到上限时按截断处理——接口不返回总行数,只能由
60
65
  * 「读满了」推断出「可能还有」。
61
66
  *
67
+ * 调用方自己切过行时用 `truncated` 说明结果,因为「正文行数等于上限」既可能是
68
+ * 正好读完,也可能是切掉了一部分,只有切的人知道是哪一种。
69
+ *
62
70
  * A preview tab for one file. Reaching the line cap is reported as truncation:
63
71
  * the API returns no total, so "the cap was filled" is the only signal that more
64
72
  * content may exist.
73
+ *
74
+ * A caller that sliced the lines itself states the outcome through `truncated`:
75
+ * "the body has exactly the cap" can mean the file ended there or that the rest was
76
+ * cut, and only the caller knows which.
65
77
  */
66
- export declare function toFileTab(entry: FsEntry, content: string, maxLines: number, icon?: ReactNode, openParent?: (uri: string) => Promise<void>): FilePreviewFileTab;
78
+ export declare function toFileTab(entry: FsEntry, content: string, maxLines: number, icon?: ReactNode, openParent?: (uri: string) => Promise<void>, truncated?: boolean): FilePreviewFileTab;
67
79
  /**
68
80
  * 目录的预览页签:两级摘要各自成一级,走 `directory` 页签,而不是文件页签。
69
81
  *
@@ -103,4 +115,4 @@ export declare function flattenTree(uri: string, depth: number, dirs: Record<str
103
115
  /** 请求被取消时不需要写回状态。A cancelled request has no state to write. */
104
116
  export declare function isAbort(error: unknown): boolean;
105
117
  /** 把任意抛出物归一成 Error。Normalises a thrown value into an Error. */
106
- export declare function toError(cause: unknown): Error;
118
+ export declare const toError: (cause: unknown) => Error;
@@ -0,0 +1,14 @@
1
+ import type { OvClient, OvRequestOptions } from '../../client/types.js';
2
+ import type { FilePreviewFileTab } from '../../components/file-preview/index.js';
3
+ /** 读取正文的行数上限;读满即按截断处理。The line cap; a full read counts as truncated. */
4
+ export declare const MAX_LINES = 2000;
5
+ /**
6
+ * 读文件并包装成页签。文本走 `content/read`,二进制走 `content/download` 取原始
7
+ * 字节——前者把内容当文本返回,二进制文件经过它只会得到一串乱码,图片与 PDF
8
+ * 因此永远渲染不出来。
9
+ *
10
+ * Reads a file into a tab. Text goes through `content/read` and binary files
11
+ * through `content/download` for the raw bytes: the former returns content as
12
+ * text, so a binary file only yields mojibake and images or PDFs never render.
13
+ */
14
+ export declare function readFile(client: OvClient, uri: string, options: OvRequestOptions, openParent?: (uri: string) => Promise<void>): Promise<FilePreviewFileTab>;
@@ -1,3 +1,4 @@
1
1
  export { FileBrowser } from './file-browser.js';
2
- export { useFileBrowser } from './use-file-browser.js';
3
- export type { FileBrowserActions, FileBrowserApi, FileBrowserLabels, FileBrowserProps, } from './types.js';
2
+ export type { FileBrowserLabels, FileBrowserDashboardLabels, FileBrowserProps, } from './types.js';
3
+ export type { FileBrowserDashboard } from './dashboard-model.js';
4
+ export type { FileBrowserAclLevel, FileBrowserAclEntry, FileBrowserAclReport, FileBrowserAclContext, FileBrowserAclPrincipalPage, FileBrowserAclOptions, FileBrowserAclLabels, } from './acl-types.js';
@@ -1,10 +1,15 @@
1
1
  declare const messages: {
2
2
  formatCharacterCount: (count: number) => string;
3
+ accessDenied: string;
4
+ traverseOnly: string;
3
5
  empty: string;
4
6
  error: string;
5
7
  retry: string;
6
8
  refresh: string;
7
9
  searchPlaceholder: string;
10
+ searchTitle: string;
11
+ searchAction: string;
12
+ searchHint: string;
8
13
  searchEmpty: string;
9
14
  searchFailed: string;
10
15
  loading: string;
@@ -1,10 +1,15 @@
1
1
  declare const messages: {
2
2
  formatCharacterCount: (count: number) => string;
3
+ accessDenied: string;
4
+ traverseOnly: string;
3
5
  empty: string;
4
6
  error: string;
5
7
  retry: string;
6
8
  refresh: string;
7
9
  searchPlaceholder: string;
10
+ searchTitle: string;
11
+ searchAction: string;
12
+ searchHint: string;
8
13
  searchEmpty: string;
9
14
  searchFailed: string;
10
15
  loading: string;