@tano.page/workbench 0.14.0 → 0.15.0

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 (177) hide show
  1. package/package.json +21 -8
  2. package/src/App.vue +76 -17
  3. package/src/appearance/appearance.ts +14 -4
  4. package/src/appearance/components/ThemePresetPreview.vue +52 -8
  5. package/src/appearance/interface-font.ts +99 -0
  6. package/src/appearance/theme.ts +26 -10
  7. package/src/appearance/use-interface-font.ts +30 -0
  8. package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
  9. package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
  10. package/src/assets/mail-provider-icons/gmail.svg +1 -0
  11. package/src/assets/mail-provider-icons/icloud.svg +12 -0
  12. package/src/assets/mail-provider-icons/netease-126.svg +5 -0
  13. package/src/assets/mail-provider-icons/netease-163.svg +5 -0
  14. package/src/assets/mail-provider-icons/qq.svg +9 -0
  15. package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
  16. package/src/assistant/components/AssistantChangeList.vue +98 -21
  17. package/src/assistant/components/AssistantPanel.vue +424 -7
  18. package/src/assistant/components/PluginToolProposalCard.vue +235 -0
  19. package/src/assistant/engine.ts +56 -3
  20. package/src/assistant/files.ts +5 -13
  21. package/src/assistant/inbox.ts +1 -148
  22. package/src/assistant/locales/de-DE.json +4 -1
  23. package/src/assistant/locales/en-US.json +4 -1
  24. package/src/assistant/locales/es-ES.json +4 -1
  25. package/src/assistant/locales/ja-JP.json +4 -1
  26. package/src/assistant/locales/zh-CN.json +4 -1
  27. package/src/assistant/locales/zh-TW.json +4 -1
  28. package/src/assistant/mention-autocomplete.ts +69 -0
  29. package/src/assistant/prompts.ts +7 -0
  30. package/src/assistant/results.ts +20 -86
  31. package/src/assistant/store.ts +319 -12
  32. package/src/assistant/structures.ts +7 -5
  33. package/src/assistant/tasks.ts +3 -5
  34. package/src/assistant/workspace-bridge.ts +1 -1
  35. package/src/composables/use-document-actions.ts +38 -20
  36. package/src/composables/use-file-tree-controller.ts +7 -12
  37. package/src/composables/use-workbench-history.ts +2 -4
  38. package/src/composables/use-workbench-modals.ts +6 -1
  39. package/src/composables/use-workbench-outline.ts +0 -5
  40. package/src/composables/use-workbench-shortcuts.ts +26 -22
  41. package/src/data-tables/data-tables.ts +1 -2
  42. package/src/documents/components/DocumentHistoryPanel.vue +3 -1
  43. package/src/features.ts +1 -0
  44. package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
  45. package/src/fonts/Inter-Latin.woff2 +0 -0
  46. package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
  47. package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
  48. package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
  49. package/src/help/help-milestones.ts +3 -5
  50. package/src/i18n/locales/de-DE.json +349 -3
  51. package/src/i18n/locales/en-US.json +349 -2
  52. package/src/i18n/locales/es-ES.json +349 -3
  53. package/src/i18n/locales/ja-JP.json +348 -2
  54. package/src/i18n/locales/zh-TW.json +348 -2
  55. package/src/mail/components/MailAccountDialog.vue +449 -0
  56. package/src/mail/components/MailComposerDialog.vue +325 -0
  57. package/src/mail/components/MailProviderIcon.vue +30 -0
  58. package/src/mail/components/MailWorkspaceView.vue +820 -0
  59. package/src/mail/components/SidebarMail.vue +133 -0
  60. package/src/mail/mail-avatar.ts +17 -0
  61. package/src/mail/mail-bridge.ts +68 -0
  62. package/src/mail/mail-calendar.ts +208 -0
  63. package/src/mail/mail-markdown.ts +195 -0
  64. package/src/mail/types.ts +226 -0
  65. package/src/objects/components/ObjectDetailModal.vue +1001 -0
  66. package/src/objects/workspace-objects.ts +1 -1
  67. package/src/plan-sync/types.ts +6 -3
  68. package/src/plans/calendar-interaction.ts +194 -0
  69. package/src/plans/calendar.ts +63 -7
  70. package/src/plans/components/CalendarDayPopover.vue +172 -39
  71. package/src/plans/components/CalendarView.vue +1736 -276
  72. package/src/plans/components/PlanArchiveDialog.vue +295 -0
  73. package/src/plans/components/PlanDateField.vue +6 -4
  74. package/src/plans/components/PlanDetailPanel.vue +227 -32
  75. package/src/plans/components/PlanEventList.vue +16 -4
  76. package/src/plans/components/SidebarPlan.vue +22 -15
  77. package/src/plans/components/TaskRepeatControls.vue +169 -30
  78. package/src/plans/local-reminders.ts +149 -0
  79. package/src/plans/personal-plans.ts +10 -1
  80. package/src/plans/plan-date.ts +8 -1
  81. package/src/plans/plan-migration.ts +95 -0
  82. package/src/plans/recurrence.ts +95 -0
  83. package/src/plans/task-repeat.ts +8 -8
  84. package/src/plans/timeline-layout.ts +92 -0
  85. package/src/plugins/assistant-bridge.ts +520 -0
  86. package/src/plugins/attachment-reader.ts +3 -1
  87. package/src/plugins/cache-storage.ts +42 -2
  88. package/src/plugins/components/PluginAutomations.vue +3 -3
  89. package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
  90. package/src/plugins/components/PluginChangeSummary.vue +16 -3
  91. package/src/plugins/components/PluginConnections.vue +1 -1
  92. package/src/plugins/components/PluginCustomView.vue +2 -2
  93. package/src/plugins/components/PluginDetailPage.vue +129 -54
  94. package/src/plugins/components/PluginDocumentSlot.vue +63 -0
  95. package/src/plugins/components/PluginExplorer.vue +15 -21
  96. package/src/plugins/components/PluginImportDialog.vue +410 -0
  97. package/src/plugins/components/PluginInstaller.vue +39 -145
  98. package/src/plugins/components/PluginListItem.vue +3 -0
  99. package/src/plugins/components/PluginMaintenance.vue +21 -6
  100. package/src/plugins/components/PluginRuntimePanel.vue +3 -3
  101. package/src/plugins/components/PluginSettingsForm.vue +111 -0
  102. package/src/plugins/components/PluginStatusBar.vue +161 -0
  103. package/src/plugins/components/PluginSurface.vue +18 -6
  104. package/src/plugins/components/PluginUiDialog.vue +452 -0
  105. package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
  106. package/src/plugins/excalidraw/manifest.json +12 -1
  107. package/src/plugins/host.ts +662 -43
  108. package/src/plugins/native.ts +2 -10
  109. package/src/plugins/overlay-mapping.ts +125 -0
  110. package/src/plugins/packages.ts +73 -1
  111. package/src/plugins/plugin-permissions.ts +57 -0
  112. package/src/plugins/plugin-sdk.ts +174 -8
  113. package/src/plugins/policy.ts +53 -3
  114. package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
  115. package/src/plugins/presentation-preview/manifest.json +2 -1
  116. package/src/plugins/queries.ts +3 -1
  117. package/src/plugins/sandbox.ts +15 -1
  118. package/src/plugins/use-plugin-actions.ts +67 -20
  119. package/src/plugins/user-plugins.ts +254 -0
  120. package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
  121. package/src/plugins/word-preview/manifest.json +13 -1
  122. package/src/plugins/workbench.ts +175 -2
  123. package/src/plugins/worker.js +105 -8
  124. package/src/plugins/workspace-plugin-runtime.ts +23 -7
  125. package/src/plugins/workspace-plugins.ts +212 -21
  126. package/src/runtime.ts +101 -3
  127. package/src/settings/components/SettingsAppearancePage.vue +46 -0
  128. package/src/settings/components/SettingsDocumentsPage.vue +0 -1
  129. package/src/settings/components/settings-search.ts +2 -3
  130. package/src/shell/components/SidebarNavigation.vue +22 -2
  131. package/src/shell/components/WorkbenchContextMenus.vue +21 -8
  132. package/src/shell/components/WorkbenchModals.vue +27 -46
  133. package/src/shell/components/WorkbenchPanes.vue +267 -84
  134. package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
  135. package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
  136. package/src/shell/use-workbench.ts +116 -145
  137. package/src/shell/workbench-async-components.ts +14 -5
  138. package/src/stores/mail.ts +414 -0
  139. package/src/stores/plan-sync.ts +2 -1
  140. package/src/stores/plans.ts +2 -9
  141. package/src/stores/workspace-knowledge.ts +1 -113
  142. package/src/stores/workspace-plugins-state.ts +537 -14
  143. package/src/stores/workspace-tabs-layout.ts +5 -43
  144. package/src/stores/workspace.ts +69 -66
  145. package/src/styles/agent-diff-modals.css +0 -7
  146. package/src/styles/dark-theme.css +3 -3
  147. package/src/styles/inspector.css +0 -59
  148. package/src/styles/layout-themes.css +346 -0
  149. package/src/styles/mail.css +1568 -0
  150. package/src/styles/mobile.css +2 -2
  151. package/src/styles/recent-and-media.css +0 -17
  152. package/src/styles/theme-contract.css +3 -3
  153. package/src/styles/workbench-shell.css +110 -17
  154. package/src/styles/workspace-states.css +9 -33
  155. package/src/styles.css +1 -1
  156. package/src/tabs/components/DesktopTabs.vue +0 -3
  157. package/src/tabs/components/NewTabPicker.vue +10 -4
  158. package/src/tabs/tab-label.ts +0 -1
  159. package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
  160. package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
  161. package/src/workspace/workspace-comments.ts +11 -151
  162. package/src/workspace/workspace-welcome.ts +1 -1
  163. package/src/documents/components/FormulaMenu.vue +0 -50
  164. package/src/files/components/FileDatabasePage.vue +0 -152
  165. package/src/files/components/FolderHomeIcon.vue +0 -12
  166. package/src/objects/components/ObjectDatabasePage.vue +0 -100
  167. package/src/objects/components/ObjectPanel.vue +0 -554
  168. package/src/plans/components/PersonalPlanDialog.vue +0 -105
  169. package/src/shell/components/WorkspaceViewPage.vue +0 -127
  170. package/src/shell/components/WorkspaceViewTab.vue +0 -24
  171. package/src/styles/object-panel.css +0 -163
  172. package/src/workspace/components/GitInspectionPanel.vue +0 -35
  173. package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
  174. package/src/workspace/welcome-slogans.ts +0 -11
  175. package/src/workspace/workspace-git.ts +0 -35
  176. package/src/workspace/workspace-sync.ts +0 -46
  177. package/src/workspace/workspace-views.ts +0 -48
@@ -1,127 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue';
3
- import { AlertTriangle, ArrowUpRight, Boxes, Table2 } from 'lucide-vue-next';
4
- import { basename } from '@tano/protocol';
5
- import ResourceIcon from '../../files/components/ResourceIcon.vue';
6
- import type { FileEntry, ReferenceIdentity, WorkspaceViewDefinition } from '@tano/protocol';
7
- import { t } from '../../i18n/i18n';
8
- import { useWorkspaceStore } from '../../stores/workspace';
9
- import FileDatabasePage from '../../files/components/FileDatabasePage.vue';
10
- import ObjectDatabasePage from '../../objects/components/ObjectDatabasePage.vue';
11
- import LoadingSkeleton from './LoadingSkeleton.vue';
12
-
13
- const props = defineProps<{ view: WorkspaceViewDefinition }>();
14
- const emit = defineEmits<{
15
- 'open-file': [file: FileEntry];
16
- 'edit-document-properties': [file: FileEntry];
17
- 'open-object': [identity: ReferenceIdentity];
18
- }>();
19
- const store = useWorkspaceStore();
20
-
21
- const kindLabel = computed(() => ({
22
- files: t('文件视图'),
23
- objects: t('对象视图'),
24
- table: t('表格视图'),
25
- graph: t('关系视图'),
26
- }[props.view.kind]));
27
- const sourceRows = computed(() => props.view.sources.map((source) => {
28
- if (source.layer === 'file') {
29
- const file = store.workspace?.files.find((entry) => entry.id === source.fileId && entry.kind === 'file');
30
- return {
31
- key: `file:${source.fileId}`,
32
- layer: 'file' as const,
33
- label: file?.path ?? t('文件已不存在'),
34
- detail: file ? `${basename(file.path)} · ${file.size} bytes` : t('稳定文件 ID 未解析'),
35
- file,
36
- missing: !file,
37
- };
38
- }
39
- const target = store.referenceTargets.find((entry) => entry.type === source.type && entry.id === source.id);
40
- const record = store.objects.find((entry) => entry.object.type === source.type && entry.object.id === source.id);
41
- return {
42
- key: `object:${source.type}/${source.id}`,
43
- layer: 'object' as const,
44
- label: target?.name ?? record?.object.name ?? `${source.type}/${source.id}`,
45
- detail: target?.path ?? record?.path ?? t('对象已不存在'),
46
- identity: { type: source.type, id: source.id },
47
- missing: !target && !record,
48
- };
49
- }));
50
- const missingCount = computed(() => sourceRows.value.filter((row) => row.missing).length);
51
- function open(row: (typeof sourceRows.value)[number]) {
52
- if (row.file) emit('open-file', row.file);
53
- else if (row.identity && !row.missing) emit('open-object', row.identity);
54
- }
55
- </script>
56
-
57
- <template>
58
- <LoadingSkeleton v-if="store.workspaceLoading?.views || (view.objectDatabase && store.workspaceLoading?.objects)" variant="document" :rows="6" />
59
- <FileDatabasePage v-else-if="view.database" :view="view" @open-file="emit('open-file', $event)" @edit-document-properties="emit('edit-document-properties', $event)" />
60
- <ObjectDatabasePage v-else-if="view.objectDatabase" :view="view" @open-object="emit('open-object', $event)" />
61
- <main v-else class="workspace-view-page" :aria-label="view.name">
62
- <header class="workspace-view-header">
63
- <div>
64
- <p class="workspace-view-kicker"><Table2 :size="15" />{{ kindLabel }}</p>
65
- <h1>{{ view.name }}</h1>
66
- <p class="workspace-view-description">
67
- {{ t('这是由稳定文件 ID 和对象 ID 重建的投影。打开来源时,Tano 会解析当前路径和内容版本。') }}
68
- </p>
69
- </div>
70
- <span class="workspace-view-count">{{ sourceRows.length }} {{ t('个来源') }}</span>
71
- </header>
72
-
73
- <div v-if="view.query" class="workspace-view-query">
74
- <span>{{ t('查询提示') }}</span>{{ view.query }}
75
- </div>
76
- <div v-if="missingCount" class="workspace-view-warning" role="status">
77
- <AlertTriangle :size="16" />
78
- {{ t('{0} 个来源当前无法解析,原始视图文件仍已保留。', [missingCount]) }}
79
- </div>
80
-
81
- <section class="workspace-view-sources" :aria-label="t('视图来源')">
82
- <button
83
- v-for="row in sourceRows"
84
- :key="row.key"
85
- type="button"
86
- class="workspace-view-source"
87
- :class="{ missing: row.missing }"
88
- :disabled="row.missing"
89
- @click="open(row)"
90
- >
91
- <Boxes v-if="row.layer === 'object'" :size="19" />
92
- <ResourceIcon v-else :path="row.file?.path ?? ''" :size="19" />
93
- <span class="workspace-view-source-copy">
94
- <strong>{{ row.label }}</strong>
95
- <small>{{ row.layer === 'file' ? t('File · 真实文件来源') : t('Object · 结构化语义来源') }}</small>
96
- <small class="workspace-view-source-detail">{{ row.detail }}</small>
97
- </span>
98
- <ArrowUpRight v-if="!row.missing" :size="16" />
99
- <span v-else class="workspace-view-missing">{{ t('不可用') }}</span>
100
- </button>
101
- </section>
102
- </main>
103
- </template>
104
-
105
- <style scoped>
106
- .workspace-view-page { height: 100%; overflow: auto; padding: clamp(28px, 6vw, 72px) clamp(20px, 7vw, 96px); box-sizing: border-box; background: var(--surface); }
107
- .workspace-view-header { max-width: 960px; margin: 0 auto 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
108
- .workspace-view-kicker { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
109
- h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); letter-spacing: -.03em; }
110
- .workspace-view-description { max-width: 680px; margin: 10px 0 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
111
- .workspace-view-count { flex-shrink: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
112
- .workspace-view-query, .workspace-view-warning { max-width: 960px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
113
- .workspace-view-query span { margin-right: 8px; font-weight: 500; color: var(--text); }
114
- .workspace-view-warning { display: flex; align-items: center; gap: 8px; border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); color: var(--warning); }
115
- .workspace-view-sources { max-width: 960px; margin: 18px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; }
116
- .workspace-view-source { display: flex; align-items: flex-start; gap: 10px; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-raised, var(--surface)); color: var(--text); transition: border-color .15s, background .15s; }
117
- .workspace-view-source:not(:disabled):hover { border-color: var(--accent); background: var(--surface-hover, var(--surface)); }
118
- .workspace-view-source > svg:last-child { flex-shrink: 0; margin-left: auto; color: var(--muted); }
119
- .workspace-view-source-copy { min-width: 0; flex: 1; }
120
- .workspace-view-source-copy strong, .workspace-view-source-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
121
- .workspace-view-source-copy strong { font-size: 14px; font-weight: 500; }
122
- .workspace-view-source-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; }
123
- .workspace-view-source-detail { overflow-wrap: anywhere; white-space: normal !important; }
124
- .workspace-view-source.missing { opacity: .62; cursor: default; }
125
- .workspace-view-missing { flex-shrink: 0; color: var(--muted); font-size: 11px; }
126
- @media (max-width: 620px) { .workspace-view-header { display: block; } .workspace-view-count { display: inline-block; margin-top: 14px; } }
127
- </style>
@@ -1,24 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue';
3
- import type { FileEntry, ReferenceIdentity } from '@tano/protocol';
4
- import { t } from '../../i18n/i18n';
5
- import { useWorkspaceStore } from '../../stores/workspace';
6
- import LoadingSkeleton from './LoadingSkeleton.vue';
7
- import WorkspaceViewPage from './WorkspaceViewPage.vue';
8
- const props = defineProps<{ tabId: string }>();
9
- const emit = defineEmits<{
10
- 'open-file': [file: FileEntry];
11
- 'edit-document-properties': [file: FileEntry];
12
- 'open-object': [identity: ReferenceIdentity];
13
- }>();
14
- const store = useWorkspaceStore();
15
- const record = computed(() => store.workspaceViews.find(record => `workspace-view:${record.view.id}` === props.tabId));
16
- </script>
17
-
18
- <template>
19
- <LoadingSkeleton v-if="store.workspaceLoading.views" variant="document" :rows="6" />
20
- <WorkspaceViewPage v-else-if="record" :view="record.view"
21
- @open-file="emit('open-file', $event)" @edit-document-properties="emit('edit-document-properties', $event)"
22
- @open-object="emit('open-object', $event)" />
23
- <p v-else role="status">{{ t('视图已不存在') }}</p>
24
- </template>
@@ -1,163 +0,0 @@
1
- .object-panel-backdrop {
2
- position: fixed;
3
- inset: 0;
4
- z-index: 80;
5
- display: grid;
6
- place-items: center;
7
- background: #0005;
8
- padding: 24px;
9
- }
10
- .object-panel {
11
- background: var(--surface);
12
- color: var(--text);
13
- border: 1px solid var(--line);
14
- border-radius: 14px;
15
- width: min(880px, 100%);
16
- max-height: 90vh;
17
- overflow: auto;
18
- box-shadow: 0 18px 60px #0003;
19
- padding: 24px;
20
- }
21
- .object-panel header {
22
- display: flex;
23
- justify-content: space-between;
24
- align-items: flex-start;
25
- gap: 12px;
26
- }
27
- .object-panel h2 {
28
- margin: 0;
29
- font-size: 20px;
30
- }
31
- .object-panel small,
32
- .object-panel p {
33
- color: var(--muted);
34
- font-size: 12px;
35
- line-height: 1.7;
36
- }
37
- .object-panel h2 small {
38
- font-weight: normal;
39
- }
40
- .object-panel button {
41
- padding: 8px 12px;
42
- border: 1px solid var(--line);
43
- border-radius: 6px;
44
- background: var(--surface);
45
- color: inherit;
46
- cursor: pointer;
47
- }
48
- .object-panel button:disabled {
49
- opacity: 0.5;
50
- cursor: default;
51
- }
52
- .object-panel-body {
53
- display: grid;
54
- grid-template-columns: 240px 1fr;
55
- gap: 24px;
56
- margin-top: 16px;
57
- }
58
- .object-panel aside {
59
- display: flex;
60
- flex-direction: column;
61
- gap: 8px;
62
- max-height: 60vh;
63
- overflow: auto;
64
- }
65
- .object-panel aside button {
66
- text-align: left;
67
- }
68
- .object-panel aside button small {
69
- display: block;
70
- }
71
- .object-panel aside .selected {
72
- border-color: var(--green);
73
- }
74
- .object-panel form {
75
- display: flex;
76
- flex-direction: column;
77
- gap: 12px;
78
- min-width: 0;
79
- }
80
- .object-panel label {
81
- display: flex;
82
- flex-direction: column;
83
- gap: 6px;
84
- font-size: 13px;
85
- }
86
- .object-panel input,
87
- .object-panel select,
88
- .object-panel textarea,
89
- .tano-reference-picker input {
90
- border: 1px solid var(--line);
91
- border-radius: 6px;
92
- background: var(--surface);
93
- color: inherit;
94
- padding: 8px;
95
- font: inherit;
96
- min-width: 0;
97
- }
98
- .object-panel textarea {
99
- resize: vertical;
100
- }
101
- .object-panel .object-archive {
102
- flex-direction: row;
103
- align-items: center;
104
- }
105
- .object-identity {
106
- display: block;
107
- overflow-wrap: anywhere;
108
- font-size: 11px;
109
- color: var(--muted);
110
- user-select: all;
111
- }
112
- .object-panel footer {
113
- display: flex;
114
- flex-wrap: wrap;
115
- gap: 8px;
116
- }
117
- .object-panel .object-notice {
118
- padding: 8px 12px;
119
- background: var(--hover);
120
- border-radius: 6px;
121
- margin: 0;
122
- }
123
- .object-panel [role='alert'] {
124
- color: var(--danger);
125
- }
126
- .object-fields {
127
- display: grid;
128
- gap: 12px;
129
- }
130
- .object-resource-actions {
131
- display: flex;
132
- gap: 8px;
133
- flex-wrap: wrap;
134
- }
135
- .object-resource dl {
136
- font-size: 13px;
137
- }
138
- .object-resource dd {
139
- margin: 4px 0 12px;
140
- overflow-wrap: anywhere;
141
- }
142
- .object-resource dt {
143
- color: var(--muted);
144
- }
145
- .object-asset-preview {
146
- max-width: 100%;
147
- max-height: 220px;
148
- object-fit: contain;
149
- }
150
- @media (max-width: 700px) {
151
- .object-panel-backdrop {
152
- padding: 8px;
153
- }
154
- .object-panel {
155
- padding: 16px;
156
- }
157
- .object-panel-body {
158
- grid-template-columns: 1fr;
159
- }
160
- .object-panel aside {
161
- max-height: 160px;
162
- }
163
- }
@@ -1,35 +0,0 @@
1
- <script setup lang="ts">
2
- import { uiLocale, t } from '../../i18n/i18n';
3
- import { onMounted, onBeforeUnmount } from 'vue';
4
- import { createGitInspection } from '../workspace-git';
5
- const props = defineProps<{ workspaceId: string }>();
6
- const git = createGitInspection(() => props.workspaceId);
7
- const { status, history, diff, busy, error } = git;
8
- onMounted(git.refresh); onBeforeUnmount(git.dispose);
9
- const label = (value: string) => t({ M: '修改', A: '新增', D: '删除', R: '重命名', C: '复制', U: '冲突', '?': '未跟踪', T: '类型变化' }[value] ?? '—');
10
- const canRead = (path: string) => !path.split('/').some(part => part.startsWith('.'));
11
- </script>
12
- <template>
13
- <section class="git-inspection" :aria-label="t('Git 变更与历史')">
14
- <header><strong>{{ status.branch ? t('当前分支 · {0}', [status.branch]) : status.detached ? t('分离 HEAD') : t('本地 Git 仓库') }}</strong>
15
- <button class="secondary-button" :disabled="busy" @click="git.refresh">{{ busy ? t('正在读取…') : t('刷新 Git 状态') }}</button></header>
16
- <p>{{ t('读取已保存文件。未保存草稿不参与 Git 查询;未跟踪文件尚无 Git 差异。') }}</p>
17
- <p v-if="error" role="alert">{{ error }}</p>
18
- <h3>{{ t('文件变更 ·') }} {{ status.entries.length }}</h3>
19
- <div v-if="status.entries.length" class="git-table-scroll"><table>
20
- <thead><tr><th>{{ t('文件') }}</th><th>{{ t('暂存区') }}</th><th>{{ t('工作区') }}</th><th>{{ t('差异') }}</th></tr></thead>
21
- <tbody><tr v-for="entry in status.entries" :key="entry.path"><td>{{ entry.path }}</td><td>{{ label(entry.index) }}</td><td>{{ label(entry.worktree) }}</td>
22
- <td class="git-diff-actions"><button class="secondary-button" :aria-label="t('查看 {0} 暂存差异', [entry.path])" :disabled="busy || !canRead(entry.path) || entry.index === ' ' || entry.index === '?'" @click="git.showDiff(entry.path, true)">{{ t('暂存区') }}</button>
23
- <button class="secondary-button" :aria-label="t('查看 {0} 工作区差异', [entry.path])" :disabled="busy || !canRead(entry.path) || entry.worktree === ' ' || entry.index === '?'" @click="git.showDiff(entry.path, false)">{{ t('工作区') }}</button></td></tr></tbody>
24
- </table></div>
25
- <p v-else-if="!busy && !error">{{ t('已保存文件没有 Git 变更。') }}</p>
26
- <section v-if="diff" :aria-label="t('Git 文件差异')"><h3>{{ diff.path }} · {{ diff.staged ? t('暂存区') : t('工作区') }}</h3>
27
- <p v-if="diff.truncated">{{ t('差异较长,仅预览前 48 KiB。') }}</p><pre>{{ diff.patch || t('当前没有文本差异。') }}</pre></section>
28
- <section :aria-label="t('Git 提交历史')"><h3>{{ t('最近提交') }}</h3><ol v-if="history.commits.length"><li v-for="commit in history.commits" :key="commit.id"><strong>{{ commit.subject }}</strong><small>{{ commit.shortId }} · {{ commit.author }} · {{ new Date(commit.date).toLocaleString(uiLocale) }}</small></li></ol><p v-else-if="!busy && !error">{{ t('尚无提交历史。') }}</p></section>
29
- </section>
30
- </template>
31
- <style scoped>
32
- header { display: flex; align-items: center; justify-content: space-between; gap: 12px; } p, small { color: var(--muted, #787774); } h3 { font-size: 14px; margin: 20px 0 10px; } .git-table-scroll { overflow-x: auto; }
33
- table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; } th, td { padding: 9px 8px; border-bottom: 1px solid var(--border, #ddd); } td:first-child { overflow-wrap: anywhere; min-width: 140px; } .git-diff-actions { white-space: nowrap; } .git-diff-actions button + button { margin-left: 6px; }
34
- pre { overflow: auto; max-height: 280px; padding: 12px; border: 1px solid var(--border, #ddd); border-radius: 8px; font: 12px/1.6 var(--font-mono); } ol { list-style: none; padding: 0; } li { padding: 10px 0; border-bottom: 1px solid var(--border, #ddd); } small { display: block; margin-top: 4px; } [role=alert] { color: var(--danger, #c33); }
35
- </style>
@@ -1,50 +0,0 @@
1
- <script setup lang="ts">
2
- import { uiLocale, t } from '../../i18n/i18n';
3
- import { vSurfaceMotion } from '@tano/editor/surface-motion';
4
- import GitInspectionPanel from './GitInspectionPanel.vue';
5
- import { ref } from 'vue';
6
- import { X, RefreshCw, GitBranch } from 'lucide-vue-next';
7
- import type { WorkspaceSyncController } from '../workspace-sync';
8
- import type { WorkbenchExtensions } from '../../runtime';
9
- const props = defineProps<{ workspaceId: string; controller: WorkspaceSyncController; cloud?: WorkbenchExtensions['sync'] }>();
10
- const emit = defineEmits<{ close: [] }>();
11
- const remote = ref('');
12
- const tab = ref<'git' | 'sync'>('git');
13
- const { state, busy, error } = props.controller;
14
- async function enable() { await props.controller.action('configure', remote.value.trim()); if (state.value.backend === 'git') await props.controller.action('run'); }
15
- </script>
16
- <template>
17
- <div v-surface-motion="'WorkspaceSyncPanel:0'" class="modal-backdrop" @mousedown.self="emit('close')" @keydown.esc="emit('close')">
18
- <section class="modal workspace-sync-panel" role="dialog" aria-modal="true" :aria-label="t('Git 与同步')">
19
- <header><h2><GitBranch :size="20" />{{ t('Git 与同步') }}</h2><button class="icon-button" :aria-label="t('关闭同步')" @click="emit('close')"><X :size="18" /></button></header>
20
- <nav :aria-label="t('Git 功能')"><button class="secondary-button" :aria-pressed="tab === 'git'" @click="tab = 'git'">{{ t('变更与历史') }}</button><button class="secondary-button" :aria-pressed="tab === 'sync'" @click="tab = 'sync'">{{ t('同步设置') }}</button></nav>
21
- <GitInspectionPanel v-if="tab === 'git'" :key="workspaceId" :workspace-id="workspaceId" />
22
- <template v-else>
23
- <p>{{ t('当前后端:') }}{{ state.backend === 'git' ? 'Git' : state.backend === 'cloud' ? t('Tano 云端') : t('未启用') }}</p>
24
- <template v-if="state.backend !== 'cloud'">
25
- <p>{{ t('Git 同步源文件及 .tano 元数据,按仓库忽略规则提交已保存的修改。每 30 秒尝试同步;断网时保留本地提交。') }}</p>
26
- <template v-if="state.backend !== 'git'">
27
- <label>{{ t('Git 远端地址') }}<input v-model="remote" :placeholder="t('https://…/workspace.git 或 git@…')" :disabled="busy" /></label>
28
- <p>{{ t('新目录会初始化 main 分支;已有仓库使用 origin 和当前分支。第二台设备请克隆同一仓库,再在 Tano 中打开。SSH 使用系统认证,操作不会弹出终端。') }}</p>
29
- <button class="primary-button" :disabled="busy || !remote.trim()" @click="enable">{{ t('启用 Git 并同步') }}</button>
30
- </template>
31
- <button v-else class="primary-button" :disabled="busy" @click="controller.action('run')"><RefreshCw :size="16" />{{ busy ? t('正在同步…') : t('立即同步') }}</button>
32
- </template>
33
- <p v-if="state.lastSynced">{{ t('最近完成:') }}{{ new Date(state.lastSynced).toLocaleString(uiLocale) }}</p>
34
- <p role="status">{{ state.message }}</p>
35
- <p v-if="error" role="alert">{{ error }}</p>
36
- <ul v-if="state.conflicts.length"><li v-for="path in state.conflicts" :key="path">{{ path }}</li></ul>
37
- <p v-if="state.conflicts.length">{{ t('本地文件未被冲突标记覆盖。请在外部 Git 中合并 origin 对应分支、解决冲突并提交,然后重试。') }}</p>
38
- <footer><button v-if="state.backend" class="secondary-button" :disabled="busy" @click="controller.action('disable')">{{ t('停用同步') }}</button>
39
- <button v-if="cloud" class="secondary-button" :disabled="busy || state.backend === 'git'" @click="emit('close'); cloud.open()">{{ t('配置 Tano 云端同步') }}</button>
40
- <button class="secondary-button" :disabled="busy" @click="controller.action('status')">{{ t('刷新状态') }}</button></footer>
41
- </template>
42
- </section>
43
- </div>
44
- </template>
45
- <style scoped>
46
- .workspace-sync-panel { width: min(900px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; padding: 24px; }
47
- header, h2, footer, nav { display: flex; align-items: center; gap: 12px; } header { justify-content: space-between; } h2 { margin: 0; font-size: 18px; }
48
- nav { margin: 20px 0; } nav [aria-pressed=true] { outline: 2px solid var(--accent, #24845b); }
49
- p { line-height: 1.7; } label { display: grid; gap: 8px; } input { width: 100%; box-sizing: border-box; padding: 8px; } footer { margin-top: 20px; flex-wrap: wrap; } [role=alert] { color: var(--danger, #c33); } li { overflow-wrap: anywhere; }
50
- </style>
@@ -1,11 +0,0 @@
1
- export const welcomeSlogans = ['好想法,值得在同页', '人与 AI,在同页工作'] as const;
2
-
3
- export function sloganParts(slogan: string): { text: string; latin: boolean }[] {
4
- const spaced = slogan
5
- .replace(/([\u3400-\u9fff])([A-Za-z0-9])/g, '$1 $2')
6
- .replace(/([A-Za-z0-9])([\u3400-\u9fff])/g, '$1 $2');
7
- return spaced
8
- .split(/([A-Za-z0-9]+)/g)
9
- .filter(Boolean)
10
- .map((text) => ({ text, latin: /^[A-Za-z0-9]+$/.test(text) }));
11
- }
@@ -1,35 +0,0 @@
1
- import { nativeInvoke as invoke } from '../platform/native-bridge';
2
- import { ref } from 'vue';
3
- export interface GitEntry { path: string; index: string; worktree: string; originalPath: string | null }
4
- export interface GitStatus { branch: string | null; detached: boolean; entries: GitEntry[] }
5
- export interface GitDiff { path: string; staged: boolean; patch: string }
6
- export interface GitCommit { id: string; shortId: string; author: string; date: string; subject: string }
7
- export interface GitLog { path: string | null; commits: GitCommit[] }
8
- export function createGitInspection(workspaceId: () => string) {
9
- const status = ref<GitStatus>({ branch: null, detached: false, entries: [] });
10
- const history = ref<GitLog>({ path: null, commits: [] });
11
- const diff = ref<(GitDiff & { truncated: boolean }) | null>(null);
12
- const busy = ref(false), error = ref('');
13
- let generation = 0;
14
- const query = <T>(id: string, kind: string, args = {}) => invoke<T>('workspace_git_query', { workspaceId: id, kind, args });
15
- async function perform(action: (id: string, current: () => boolean) => Promise<void>) {
16
- if (busy.value) return;
17
- const id = workspaceId(), token = generation;
18
- busy.value = true; error.value = '';
19
- const current = () => token === generation && id === workspaceId();
20
- try { await action(id, current); } catch (cause) { if (current()) error.value = String(cause).replace(/^Error: /, ''); }
21
- finally { busy.value = false; }
22
- }
23
- const refresh = () => perform(async (id, current) => {
24
- const [next, log] = await Promise.all([query<GitStatus>(id, 'status'), query<GitLog>(id, 'log', { limit: 30 })]);
25
- if (current()) { status.value = next; history.value = log; diff.value = null; }
26
- });
27
- const showDiff = (path: string, staged: boolean) => perform(async (id, current) => {
28
- if (!status.value.entries.some(entry => entry.path === path)) throw new Error('文件状态已变化,请刷新');
29
- const result = await query<GitDiff>(id, 'diff', { path, staged });
30
- const bytes = new TextEncoder().encode(result.patch), truncated = bytes.length > 48 * 1024;
31
- if (current()) diff.value = { ...result, patch: truncated ? new TextDecoder().decode(bytes.slice(0, 48 * 1024)) : result.patch, truncated };
32
- });
33
- function dispose() { generation++; }
34
- return { status, history, diff, busy, error, refresh, showDiff, dispose };
35
- }
@@ -1,46 +0,0 @@
1
- import { nativeInvoke as invoke } from '../platform/native-bridge';
2
- import { ref } from 'vue';
3
- import type { WorkbenchExtensions } from '../runtime';
4
- import type { useWorkspaceStore } from '../stores/workspace';
5
-
6
- export interface WorkspaceSyncState { backend: 'git' | 'cloud' | null; lastSynced: number | null; message: string; conflicts: string[] }
7
- export const syncEvent = 'tano:workspace-sync';
8
- export function openWorkspaceSync(workspaceId?: string) { window.dispatchEvent(new CustomEvent(syncEvent, { detail: { workspaceId } })); }
9
- export function systemSync(workspaceId: string, action: 'status' | 'configure' | 'run' | 'disable' | 'claimCloud' | 'releaseCloud', remote?: string) {
10
- return invoke<WorkspaceSyncState>('workspace_sync', { request: { workspaceId, action, ...(remote === undefined ? {} : { remote }) } });
11
- }
12
- /** Window-scoped orchestration. Durable backend selection and history live in the native host. */
13
- export function createWorkspaceSync(store: ReturnType<typeof useWorkspaceStore>, extensions: WorkbenchExtensions) {
14
- const state = ref<WorkspaceSyncState>({ backend: null, lastSynced: null, message: '', conflicts: [] });
15
- const busy = ref(false), error = ref('');
16
- const operation = ref<'status' | 'configure' | 'run' | 'disable'>();
17
- let generation = 0;
18
- async function action(kind: 'status' | 'configure' | 'run' | 'disable', remote?: string) {
19
- const id = store.workspace?.id;
20
- if (!id || store.isWeb || store.isDemo || busy.value) return;
21
- const current = generation;
22
- busy.value = true; operation.value = kind; error.value = '';
23
- try {
24
- if (kind === 'disable' && extensions.sync?.enabled) await extensions.sync.disconnect();
25
- if (kind === 'configure' || kind === 'run') {
26
- if (extensions.sync?.enabled || extensions.editing.active) throw new Error('请先断开云端文件同步与实时协作,再启用 Git 同步');
27
- if (!(await store.flush())) throw new Error('请先处理未保存修改');
28
- await extensions.editing.flush();
29
- }
30
- if (id !== store.workspace?.id || current !== generation) return;
31
- const result = await systemSync(id, kind, remote);
32
- if (id !== store.workspace?.id || current !== generation) return;
33
- state.value = result;
34
- if (kind === 'run') await store.refresh();
35
- } catch (reason) { if (current === generation) error.value = String(reason).replace(/^Error: /, ''); }
36
- finally { busy.value = false; operation.value = undefined; }
37
- }
38
- function reset() { generation++; state.value = { backend: null, lastSynced: null, message: '', conflicts: [] }; error.value = ''; }
39
- async function tick() {
40
- if (busy.value || store.busy || !store.workspace || store.isWeb || store.isDemo) return;
41
- await action('status');
42
- if (state.value.backend === 'git' && !state.value.conflicts.length && !extensions.editing.active) await action('run');
43
- }
44
- return { state, busy, operation, error, action, reset, tick };
45
- }
46
- export type WorkspaceSyncController = ReturnType<typeof createWorkspaceSync>;
@@ -1,48 +0,0 @@
1
- import { isWorkspaceViewPath, parseWorkspaceView, workspaceViewPath } from '@tano/protocol';
2
- import type { FileSnapshot, Workspace, WorkspaceAdapter, WorkspaceViewDefinition } from '@tano/protocol';
3
-
4
- /** A parsed portable view and the revision of the definition file that supplied it. */
5
- export interface WorkspaceViewRecord {
6
- view: WorkspaceViewDefinition;
7
- path: string;
8
- snapshot: FileSnapshot;
9
- }
10
-
11
- /**
12
- * Load only portable view definitions from the current workspace.
13
- *
14
- * A malformed or cross-workspace view is reported while the source file stays
15
- * untouched. View files are projections and can be rebuilt; they never become
16
- * an alternate content store.
17
- */
18
- export async function loadWorkspaceViews(adapter: Pick<WorkspaceAdapter, 'read'>, workspace: Workspace) {
19
- const records: WorkspaceViewRecord[] = [];
20
- const errors: string[] = [];
21
- for (const file of workspace.files.filter(
22
- (entry) => entry.kind === 'file' && isWorkspaceViewPath(entry.path),
23
- )) {
24
- try {
25
- const snapshot = await adapter.read(file.path);
26
- const view = parseWorkspaceView(snapshot.content);
27
- if (workspaceViewPath(view.id) !== file.path) {
28
- errors.push(`${file.path}:视图文件名必须与稳定视图 ID 一致,已跳过`);
29
- continue;
30
- }
31
- if (view.workspaceId !== workspace.id) {
32
- errors.push(`${file.path}:视图属于其他工作区,已跳过`);
33
- continue;
34
- }
35
- records.push({ view, path: file.path, snapshot });
36
- } catch (error) {
37
- errors.push(`${file.path}:${String(error)}`);
38
- }
39
- }
40
- const ids = new Map<string, number>();
41
- for (const record of records) ids.set(record.view.id, (ids.get(record.view.id) ?? 0) + 1);
42
- for (const [id, count] of ids)
43
- if (count > 1) errors.push(`视图 ID ${id} 重复,已停用重复定义`);
44
- return {
45
- records: records.filter((record) => ids.get(record.view.id) === 1),
46
- errors,
47
- };
48
- }