@tano.page/workbench 0.14.0 → 0.16.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.
- package/package.json +50 -16
- package/src/App.vue +82 -752
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/agent-identities.ts +1 -97
- package/src/assistant/agent-task-context.ts +1 -54
- package/src/assistant/attachments.ts +1 -1
- package/src/assistant/completion.ts +1 -61
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +425 -8
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/connection-actions.ts +237 -0
- package/src/assistant/document-mentions.ts +1 -33
- package/src/assistant/engine.ts +1 -532
- package/src/assistant/execution.ts +6 -33
- package/src/assistant/files.ts +5 -13
- package/src/assistant/hash.ts +1 -4
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/language.ts +10 -37
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/plugin-bridge-builder.ts +146 -0
- package/src/assistant/prompts.ts +1 -58
- package/src/assistant/proposal-actions.ts +336 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +167 -327
- package/src/assistant/structures.ts +1 -155
- package/src/assistant/tasks.ts +8 -96
- package/src/assistant/tool-rules.ts +1 -7
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-help.ts +177 -0
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-lifecycle.ts +249 -0
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-settings.ts +185 -0
- package/src/composables/use-workbench-shortcuts.ts +40 -1021
- package/src/composables/use-workbench-views.ts +325 -0
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentActionMenu.vue +279 -0
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/documents/components/DocumentInspector.vue +168 -0
- package/src/documents/components/DocumentPane.vue +482 -0
- package/src/documents/description-merge.ts +1 -9
- package/src/features.ts +1 -0
- package/src/files/components/FileMetadataPanel.vue +49 -15
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locale-catalogs.ts +7 -6
- package/src/i18n/locale-registry.ts +8 -6
- package/src/i18n/locales/de-DE.json +371 -3
- package/src/i18n/locales/en-US.json +371 -2
- package/src/i18n/locales/es-ES.json +371 -3
- package/src/i18n/locales/ja-JP.json +370 -2
- package/src/i18n/locales/zh-TW.json +370 -2
- package/src/mail/components/MailAccountDialog.vue +450 -0
- package/src/mail/components/MailComposerDialog.vue +326 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +821 -0
- package/src/mail/components/SidebarMail.vue +134 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/content-references.ts +6 -56
- package/src/objects/wiki-links.ts +1 -48
- package/src/objects/workspace-objects.ts +3 -4
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +65 -9
- package/src/plans/components/CalendarAgendaView.vue +165 -0
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarFilterBar.vue +128 -0
- package/src/plans/components/CalendarMonthView.vue +224 -0
- package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
- package/src/plans/components/CalendarTimelineView.vue +517 -0
- package/src/plans/components/CalendarTopbarControls.vue +101 -0
- package/src/plans/components/CalendarView.vue +264 -748
- package/src/plans/components/CalendarYearView.vue +138 -0
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanConnectionsDialog.vue +1 -1
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/components/calendar-shared.css +192 -0
- package/src/plans/composables/use-calendar-interactions.ts +396 -0
- package/src/plans/composables/use-calendar-scroll.ts +420 -0
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +136 -57
- package/src/plugins/components/PluginDeveloperArea.vue +192 -0
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +21 -25
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +273 -288
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +37 -34
- package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +112 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/components/PluginsTabPage.vue +61 -0
- package/src/plugins/components/plugin-center.css +5 -0
- package/src/plugins/data.ts +9 -86
- package/src/plugins/editor-plugin-adapters.ts +169 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-data.ts +2 -3
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-rpc-router.ts +558 -0
- package/src/plugins/plugin-sdk.ts +1 -94
- package/src/plugins/plugin-ui-dialogs.ts +167 -0
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +1 -73
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/view-header.ts +2 -7
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +103 -4
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/SettingsPanel.vue +8 -3
- package/src/settings/components/WorkbenchSettings.vue +20 -7
- package/src/settings/components/settings-context.ts +1 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/settings/settings-tab.ts +1 -0
- package/src/shell/command-palette.ts +3 -3
- package/src/shell/components/EditorToolbar.vue +8 -9
- package/src/shell/components/EditorTools.vue +1 -5
- package/src/shell/components/PaneTopbar.vue +393 -0
- package/src/shell/components/SelectionToolbar.vue +0 -2
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +58 -34
- package/src/shell/components/WorkbenchModals.vue +47 -62
- package/src/shell/components/WorkbenchPanes.vue +371 -1342
- package/src/shell/components/WorkbenchSidebar.vue +486 -0
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/pane-registry.ts +69 -0
- package/src/shell/use-surface-dismissal.ts +219 -0
- package/src/shell/use-workbench-commands.ts +599 -0
- package/src/shell/use-workbench-keybindings.ts +337 -0
- package/src/shell/use-workbench.ts +531 -1153
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/shell/workbench-context.ts +30 -3
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-document-io.ts +807 -0
- package/src/stores/workspace-file-ops.ts +1 -1
- package/src/stores/workspace-knowledge.ts +2 -114
- package/src/stores/workspace-lifecycle.ts +459 -0
- package/src/stores/workspace-plugins-state.ts +254 -259
- package/src/stores/workspace-session.ts +287 -0
- package/src/stores/workspace-tabs-layout.ts +6 -44
- package/src/stores/workspace-types.ts +50 -0
- package/src/stores/workspace.ts +184 -1363
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +0 -1
- package/src/tabs/components/DesktopTabs.vue +19 -14
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/windows/AuxiliaryWindows.vue +2 -2
- package/src/windows/use-window-event-bridge.ts +152 -0
- package/src/workspace/components/TemplateLibrary.vue +1 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
- package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/assistant/locales/de-DE.json +0 -126
- package/src/assistant/locales/en-US.json +0 -126
- package/src/assistant/locales/es-ES.json +0 -126
- package/src/assistant/locales/ja-JP.json +0 -126
- package/src/assistant/locales/zh-CN.json +0 -126
- package/src/assistant/locales/zh-TW.json +0 -126
- package/src/assistant/task-prompts.json +0 -39
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -8,13 +8,19 @@ import type { InstalledObjectPlugin } from '../plugins/workspace-plugins';
|
|
|
8
8
|
export const appearanceKinds = ['color', 'icons', 'layout', 'material', 'shape'] as const;
|
|
9
9
|
/** Kinds a theme plugin may set. Materials are drawn by the host, so plugins cannot contribute or reference them. */
|
|
10
10
|
const pluginPresetKinds = ['color', 'icons', 'layout', 'shape'] as const;
|
|
11
|
+
/** Raised card: flat opaque surfaces with sculpted bevels and dimensional edges. */
|
|
12
|
+
export const raisedCardMaterial = 'builtin:raised';
|
|
11
13
|
/** The frosted-glass material turns the sidebar and page sheets of any layout into translucent glass. */
|
|
12
14
|
export const glassMaterial = 'builtin:frost';
|
|
13
15
|
/** Liquid glass: the same layers, but clear glass whose thick edges catch the light. */
|
|
14
16
|
export const liquidGlassMaterial = 'builtin:liquid';
|
|
15
17
|
/** Glass materials share the desk, the background image and the layer structure. */
|
|
16
18
|
export const glassMaterials: readonly string[] = [glassMaterial, liquidGlassMaterial];
|
|
17
|
-
const materialSurface: Record<string, NonNullable<AppearancePreset['material']>> = {
|
|
19
|
+
const materialSurface: Record<string, NonNullable<AppearancePreset['material']>> = {
|
|
20
|
+
[raisedCardMaterial]: 'raised',
|
|
21
|
+
[glassMaterial]: 'frost',
|
|
22
|
+
[liquidGlassMaterial]: 'liquid',
|
|
23
|
+
};
|
|
18
24
|
export type AppearanceKind = typeof appearanceKinds[number];
|
|
19
25
|
export const builtinDefault = 'builtin:tano';
|
|
20
26
|
export const insetLayout = 'builtin:inset';
|
|
@@ -26,7 +32,11 @@ export const builtinAppearance: AppearanceBuiltins = {
|
|
|
26
32
|
{ id: 'builtin:paper', label: '纸感', structure: 'document', surface: 'paper', gap: 24, pageWidth: 800 },
|
|
27
33
|
],
|
|
28
34
|
colors: builtinColors,
|
|
29
|
-
materials: [
|
|
35
|
+
materials: [
|
|
36
|
+
{ id: raisedCardMaterial, label: '立体卡片' },
|
|
37
|
+
{ id: glassMaterial, label: '磨砂玻璃' },
|
|
38
|
+
{ id: liquidGlassMaterial, label: '液态玻璃' },
|
|
39
|
+
],
|
|
30
40
|
shapes: [
|
|
31
41
|
{ id: 'builtin:rounded', label: '圆润宽松', tokens: { 'radius-control': '10px', 'radius-card': '16px', 'radius-dialog': '20px', 'space-panel': '22px', 'space-row-gap': '6px',
|
|
32
42
|
'overlay-shadow': '0px 1px 2px #1b263a14, 0px 8px 24px #1b263a14', 'dialog-shadow': '0px 24px 64px #1b263a33' } },
|
|
@@ -68,8 +78,8 @@ export interface AppearancePreset extends AppearanceChoice {
|
|
|
68
78
|
missing?: { kind: AppearanceKind; id: string }[];
|
|
69
79
|
previews?: AppearancePreview[];
|
|
70
80
|
structure?: LayoutThemeDefinition['structure'];
|
|
71
|
-
/** Set when the preset
|
|
72
|
-
material?: 'frost' | 'liquid';
|
|
81
|
+
/** Set when the preset uses a non-flat material, so the preview can draw it. */
|
|
82
|
+
material?: 'raised' | 'frost' | 'liquid';
|
|
73
83
|
}
|
|
74
84
|
export interface AppearanceSnapshot {
|
|
75
85
|
workspaceId: string;
|
|
@@ -99,8 +99,52 @@ const previews = computed(() => props.preset.previews?.length ? props.preset.pre
|
|
|
99
99
|
[data-preview-structure='document'] .theme-preview-heading { width: 44%; align-self: center; height: 3px; margin-bottom: 2px; }
|
|
100
100
|
[data-preview-structure='document'] .theme-preview-callout { display: none; }
|
|
101
101
|
[data-preview-structure='document'] .theme-preview-paragraph-short { display: flex; }
|
|
102
|
+
/* Raised card: clean flat surfaces with crisp 1px edge bevels and quiet double-bezel tray (see layout-themes.css). */
|
|
103
|
+
.theme-preview[data-preview-surface='raised'] .theme-preview-scene {
|
|
104
|
+
--preview-raised-edge: color-mix(in srgb, var(--preview-text) 5%, var(--preview-line));
|
|
105
|
+
--preview-raised-highlight: #ffffff;
|
|
106
|
+
--preview-raised-underside: color-mix(in srgb, var(--preview-text) 4%, transparent);
|
|
107
|
+
--preview-raised-groove: color-mix(in srgb, var(--preview-sidebar) 92%, var(--preview-paper) 8%);
|
|
108
|
+
--preview-raised-outer: color-mix(in srgb, var(--preview-line) 85%, var(--preview-paper) 15%);
|
|
109
|
+
--preview-raised-shadow:
|
|
110
|
+
inset 0 1px 0 var(--preview-raised-highlight),
|
|
111
|
+
inset 0 -1px 0 var(--preview-raised-underside),
|
|
112
|
+
0 1px 2px 0 color-mix(in srgb, var(--preview-text) 4.5%, transparent),
|
|
113
|
+
0 0 0 2px var(--preview-raised-groove),
|
|
114
|
+
0 0 0 2.5px var(--preview-raised-outer),
|
|
115
|
+
0 3px 6px -2px color-mix(in srgb, var(--preview-text) 5%, transparent);
|
|
116
|
+
background: color-mix(in srgb, var(--preview-sidebar) 97.5%, var(--preview-text) 2.5%);
|
|
117
|
+
}
|
|
118
|
+
.theme-preview[data-preview-surface='raised'] .theme-preview-scene[data-preview-mode='dark'] {
|
|
119
|
+
--preview-raised-edge: color-mix(in srgb, #ffffff 11%, var(--preview-paper));
|
|
120
|
+
--preview-raised-highlight: rgb(255 255 255 / 15%);
|
|
121
|
+
--preview-raised-underside: rgb(0 0 0 / 38%);
|
|
122
|
+
--preview-raised-groove: color-mix(in srgb, var(--preview-sidebar) 56%, #000000);
|
|
123
|
+
--preview-raised-outer: color-mix(in srgb, #ffffff 9%, var(--preview-sidebar));
|
|
124
|
+
--preview-raised-shadow:
|
|
125
|
+
inset 0 1px 0 var(--preview-raised-highlight),
|
|
126
|
+
inset 0 -1px 0 var(--preview-raised-underside),
|
|
127
|
+
0 1px 2px 0 rgb(0 0 0 / 52%),
|
|
128
|
+
0 0 0 2px var(--preview-raised-groove),
|
|
129
|
+
0 0 0 2.5px var(--preview-raised-outer),
|
|
130
|
+
0 4px 8px -2px rgb(0 0 0 / 50%);
|
|
131
|
+
background: color-mix(in srgb, var(--preview-sidebar) 70%, #000000 30%);
|
|
132
|
+
}
|
|
133
|
+
.theme-preview[data-preview-surface='raised'] .theme-preview-window {
|
|
134
|
+
border-color: var(--preview-raised-edge);
|
|
135
|
+
box-shadow: var(--preview-raised-shadow);
|
|
136
|
+
}
|
|
137
|
+
.theme-preview[data-preview-surface='raised'][data-preview-structure='islands']:not([data-preview-flat-sidebar]) .theme-preview-sidebar,
|
|
138
|
+
.theme-preview[data-preview-surface='raised'][data-preview-structure='islands'] .theme-preview-main,
|
|
139
|
+
.theme-preview[data-preview-surface='raised'][data-preview-structure='document'] .theme-preview-document {
|
|
140
|
+
border-color: var(--preview-raised-edge);
|
|
141
|
+
box-shadow: var(--preview-raised-shadow);
|
|
142
|
+
}
|
|
143
|
+
.theme-preview[data-preview-surface='raised'][data-preview-structure='continuous'] .theme-preview-main {
|
|
144
|
+
box-shadow: inset 1px 0 0 var(--preview-raised-edge), inset 0 1px 0 var(--preview-raised-highlight);
|
|
145
|
+
}
|
|
102
146
|
/* Frosted glass: the same two cards, milky and translucent over soft orbs of colour (see layout-themes.css). */
|
|
103
|
-
.theme-preview[data-preview-surface] .theme-preview-scene {
|
|
147
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-scene {
|
|
104
148
|
--preview-syntax-blue: #2d5fb8;
|
|
105
149
|
--preview-syntax-purple: #6a45b8;
|
|
106
150
|
--preview-syntax-teal: #0b7480;
|
|
@@ -114,7 +158,7 @@ const previews = computed(() => props.preset.previews?.length ? props.preset.pre
|
|
|
114
158
|
radial-gradient(36% 40% at 94% 4%, color-mix(in srgb, var(--preview-syntax-teal) 26%, transparent), transparent 70%),
|
|
115
159
|
linear-gradient(170deg, color-mix(in srgb, var(--preview-sidebar) 70%, #ffffff), color-mix(in srgb, var(--preview-sidebar) 40%, #ffffff));
|
|
116
160
|
}
|
|
117
|
-
.theme-preview[data-preview-surface] .theme-preview-scene[data-preview-mode='dark'] {
|
|
161
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-scene[data-preview-mode='dark'] {
|
|
118
162
|
--preview-syntax-blue: #9cbcff;
|
|
119
163
|
--preview-syntax-purple: #cbb5ff;
|
|
120
164
|
--preview-glass: 60%;
|
|
@@ -126,20 +170,20 @@ const previews = computed(() => props.preset.previews?.length ? props.preset.pre
|
|
|
126
170
|
radial-gradient(30% 40% at 82% 40%, color-mix(in srgb, var(--preview-syntax-purple) 16%, transparent), transparent 70%),
|
|
127
171
|
linear-gradient(170deg, var(--preview-sidebar), color-mix(in srgb, var(--preview-sidebar) 86%, var(--preview-text) 14%));
|
|
128
172
|
}
|
|
129
|
-
.theme-preview[data-preview-surface] .theme-preview-window,
|
|
130
|
-
.theme-preview[data-preview-surface] .theme-preview-toolbar,
|
|
131
|
-
.theme-preview[data-preview-surface] .theme-preview-workspace { background: transparent; }
|
|
132
|
-
.theme-preview[data-preview-surface] .theme-preview-window { border-color: transparent; box-shadow: none; }
|
|
173
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-window,
|
|
174
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-toolbar,
|
|
175
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-workspace { background: transparent; }
|
|
176
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-window { border-color: transparent; box-shadow: none; }
|
|
133
177
|
.theme-preview[data-preview-surface='frost']:not([data-preview-flat-sidebar]) .theme-preview-sidebar,
|
|
134
178
|
.theme-preview[data-preview-surface='liquid'][data-preview-structure='islands']:not([data-preview-flat-sidebar]) .theme-preview-sidebar,
|
|
135
|
-
.theme-preview[data-preview-surface] .theme-preview-main {
|
|
179
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-main {
|
|
136
180
|
border-color: var(--preview-rim);
|
|
137
181
|
border-radius: 6px;
|
|
138
182
|
background: linear-gradient(160deg, var(--preview-sheen), transparent 55%), color-mix(in srgb, var(--preview-paper) var(--preview-glass), transparent);
|
|
139
183
|
box-shadow: inset 0 1px 0 var(--preview-rim), 0 6px 12px -8px #1c305a4d;
|
|
140
184
|
-webkit-backdrop-filter: blur(8px) saturate(170%) brightness(1.04); backdrop-filter: blur(8px) saturate(170%) brightness(1.04);
|
|
141
185
|
}
|
|
142
|
-
.theme-preview[data-preview-surface] .theme-preview-main { --preview-glass: 74%; }
|
|
186
|
+
.theme-preview:is([data-preview-surface='frost'], [data-preview-surface='liquid']) .theme-preview-main { --preview-glass: 74%; }
|
|
143
187
|
/* Liquid glass: clearer cards whose edges catch the light (see layout-themes.css). */
|
|
144
188
|
.theme-preview[data-preview-surface='liquid'] .theme-preview-scene { --preview-glass: 10%; --preview-rim: #ffffff80; --preview-edge: #ffffff80; --preview-outline: #1c24301f; }
|
|
145
189
|
.theme-preview[data-preview-surface='liquid'] .theme-preview-scene[data-preview-mode='dark'] { --preview-glass: 16%; --preview-rim: #ffffff42; --preview-edge: #ffffff1a; --preview-outline: #00000073; }
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { sanitizeCustomFontName } from './editor-font';
|
|
2
|
+
|
|
3
|
+
/** Device-local typeface for menus, sidebars, tabs, dialogs and settings.
|
|
4
|
+
* Document prose keeps its own font setting (editor-font.ts). */
|
|
5
|
+
export type InterfaceFontChoice = 'builtin' | 'system' | 'custom';
|
|
6
|
+
export interface InterfaceFontPreference { choice: InterfaceFontChoice; customName: string }
|
|
7
|
+
|
|
8
|
+
export const interfaceFontPreferenceKey = 'tano.preference.interfaceFont';
|
|
9
|
+
export const interfaceFontChanged = 'tano:interface-font-changed';
|
|
10
|
+
|
|
11
|
+
export function defaultInterfaceFont(): InterfaceFontPreference {
|
|
12
|
+
return { choice: 'builtin', customName: '' };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function parseInterfaceFont(value: string | null): InterfaceFontPreference {
|
|
16
|
+
try {
|
|
17
|
+
const saved = JSON.parse(value ?? 'null');
|
|
18
|
+
if (!saved || typeof saved !== 'object') return defaultInterfaceFont();
|
|
19
|
+
const choice: InterfaceFontChoice = saved.choice === 'system' || saved.choice === 'custom' ? saved.choice : 'builtin';
|
|
20
|
+
const customName = typeof saved.customName === 'string' ? sanitizeCustomFontName(saved.customName) : '';
|
|
21
|
+
return { choice, customName };
|
|
22
|
+
} catch {
|
|
23
|
+
return defaultInterfaceFont();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function readInterfaceFont(): InterfaceFontPreference {
|
|
28
|
+
try {
|
|
29
|
+
return parseInterfaceFont(window.localStorage.getItem(interfaceFontPreferenceKey));
|
|
30
|
+
} catch {
|
|
31
|
+
return defaultInterfaceFont();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Same file the stylesheet's 'Tano UI Sans SC' 400 face points at; Vite emits
|
|
36
|
+
* one hashed asset for both references. */
|
|
37
|
+
export const builtinChineseRegularUrl = new URL('../fonts/TanoUISansSC-Regular.woff2', import.meta.url).href;
|
|
38
|
+
|
|
39
|
+
/** The bundled Chinese face is Simplified Chinese; other Han locales keep
|
|
40
|
+
* platform faces (workbench-shell.css :lang rule), so they skip the preload. */
|
|
41
|
+
export function usesBuiltinChinese(preference: InterfaceFontPreference, lang = document.documentElement.lang): boolean {
|
|
42
|
+
return preference.choice === 'builtin' && !/^(zh-(TW|HK|MO|Hant)|ja|ko)\b/i.test(lang);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Start fetching the regular Chinese face before Vue and the stylesheet load,
|
|
46
|
+
* so the first paint does not swap from the platform face. */
|
|
47
|
+
export function preloadBuiltinChinese(preference: InterfaceFontPreference): void {
|
|
48
|
+
if (!usesBuiltinChinese(preference) || document.querySelector('link[data-tano-ui-font]')) return;
|
|
49
|
+
const link = document.createElement('link');
|
|
50
|
+
link.rel = 'preload';
|
|
51
|
+
link.as = 'font';
|
|
52
|
+
link.type = 'font/woff2';
|
|
53
|
+
link.crossOrigin = 'anonymous';
|
|
54
|
+
link.href = builtinChineseRegularUrl;
|
|
55
|
+
link.dataset.tanoUiFont = '';
|
|
56
|
+
document.head.append(link);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** `undefined` keeps the stylesheet default (bundled Inter + bundled Noto Sans SC). */
|
|
60
|
+
export function interfaceFontFamily(preference: InterfaceFontPreference): string | undefined {
|
|
61
|
+
if (preference.choice === 'system') return 'var(--font-ui-system)';
|
|
62
|
+
const name = sanitizeCustomFontName(preference.customName).trim();
|
|
63
|
+
if (preference.choice === 'custom' && name) return `${JSON.stringify(name)}, var(--font-ui-system)`;
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function applyInterfaceFont(preference: InterfaceFontPreference, root: HTMLElement = document.documentElement): void {
|
|
68
|
+
const family = interfaceFontFamily(preference);
|
|
69
|
+
if (family) root.style.setProperty('--font-ui', family);
|
|
70
|
+
else root.style.removeProperty('--font-ui');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let syncInstalled = false;
|
|
74
|
+
/** Run once per window before Vue mounts, so the first paint already uses the
|
|
75
|
+
* chosen face and the separate settings window stays in step with the main one. */
|
|
76
|
+
export function installInterfaceFont(): void {
|
|
77
|
+
const preference = readInterfaceFont();
|
|
78
|
+
applyInterfaceFont(preference);
|
|
79
|
+
preloadBuiltinChinese(preference);
|
|
80
|
+
if (syncInstalled) return;
|
|
81
|
+
syncInstalled = true;
|
|
82
|
+
window.addEventListener('storage', (event) => {
|
|
83
|
+
if (event.key === interfaceFontPreferenceKey || event.key === null) applyInterfaceFont(readInterfaceFont());
|
|
84
|
+
});
|
|
85
|
+
window.addEventListener(interfaceFontChanged, (event) => {
|
|
86
|
+
applyInterfaceFont((event as CustomEvent<InterfaceFontPreference>).detail);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function saveInterfaceFont(preference: InterfaceFontPreference): void {
|
|
91
|
+
const value = { choice: preference.choice, customName: sanitizeCustomFontName(preference.customName) };
|
|
92
|
+
try {
|
|
93
|
+
window.localStorage.setItem(interfaceFontPreferenceKey, JSON.stringify(value));
|
|
94
|
+
} catch {
|
|
95
|
+
// The choice still applies to this window when device storage is unavailable.
|
|
96
|
+
}
|
|
97
|
+
applyInterfaceFont(value);
|
|
98
|
+
window.dispatchEvent(new CustomEvent<InterfaceFontPreference>(interfaceFontChanged, { detail: value }));
|
|
99
|
+
}
|
package/src/appearance/theme.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { appearanceVersion, themeTokenNames, themeColorTokens, themeRadiusTokens
|
|
|
2
2
|
// Legacy v2 shapes may declare fonts. Accept the package, but keep typography
|
|
3
3
|
// under the user's font settings rather than applying it with component shape.
|
|
4
4
|
const componentShapeTokens = [...themeRadiusTokens, ...themeSpaceTokens, ...themeShadowTokens];
|
|
5
|
+
export const THEME_STYLE_ID = 'tano-theme-tokens';
|
|
5
6
|
export type ThemePreference = 'light' | 'dark' | 'system';
|
|
6
7
|
export interface ResolvedTheme {
|
|
7
8
|
version: typeof appearanceVersion;
|
|
@@ -14,12 +15,34 @@ export const themeChangedEvent = 'tano-theme-changed';
|
|
|
14
15
|
let currentPreference: ThemePreference = 'system';
|
|
15
16
|
type ColorAppearance = Pick<ColorThemeDefinition, 'light' | 'dark'> & { id?: string };
|
|
16
17
|
let appearance: ColorAppearance = { light: {}, dark: {} };
|
|
17
|
-
const applied = new Set<string>();
|
|
18
18
|
let layout: LayoutThemeDefinition | undefined;
|
|
19
19
|
let shape: ShapeThemeDefinition | undefined;
|
|
20
20
|
|
|
21
|
+
function writeThemeStyle(resolved: ResolvedTheme['mode'], tokens: Record<string, string>): void {
|
|
22
|
+
if (typeof document === 'undefined' || !document.head) return;
|
|
23
|
+
const declarations = Object.entries(tokens)
|
|
24
|
+
.map(([key, value]) => `--${key}: ${value};`)
|
|
25
|
+
.join(' ');
|
|
26
|
+
let style = document.getElementById(THEME_STYLE_ID) as HTMLStyleElement | null;
|
|
27
|
+
if (!declarations) {
|
|
28
|
+
style?.remove();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const css = `:root[data-theme="${resolved}"] { ${declarations} }`;
|
|
32
|
+
if (!style) {
|
|
33
|
+
style = document.createElement('style');
|
|
34
|
+
style.id = THEME_STYLE_ID;
|
|
35
|
+
style.textContent = css;
|
|
36
|
+
const overlayStyle = document.head.querySelector('style[data-tano-overlay-style], #tano-workbench-overlay-style');
|
|
37
|
+
if (overlayStyle) document.head.insertBefore(style, overlayStyle);
|
|
38
|
+
else document.head.appendChild(style);
|
|
39
|
+
} else if (style.textContent !== css) {
|
|
40
|
+
style.textContent = css;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
/** Only validated contract tokens reach the host. Empty maps restore built-in CSS. */
|
|
22
|
-
/** `material` is a host-drawn card material (e.g. builtin:frost); undefined is the flat default. */
|
|
45
|
+
/** `material` is a host-drawn card material (e.g. builtin:raised, builtin:frost, builtin:liquid); undefined is the flat default. */
|
|
23
46
|
export function applyAppearance(value?: ColorAppearance, layoutValue?: LayoutThemeDefinition, shapeValue?: ShapeThemeDefinition, mode = currentPreference, material?: string): void {
|
|
24
47
|
appearance = value ?? { light: {}, dark: {} };
|
|
25
48
|
layout = layoutValue ? { ...layoutValue } : undefined;
|
|
@@ -48,8 +71,6 @@ export function resolvedTheme(): ResolvedTheme {
|
|
|
48
71
|
tokens: Object.fromEntries(themeTokenNames.map(key => [key, styles.getPropertyValue(`--${key}`).trim()]).filter(([, value]) => value)) };
|
|
49
72
|
}
|
|
50
73
|
|
|
51
|
-
|
|
52
|
-
|
|
53
74
|
export function parseThemePreference(value: unknown): ThemePreference {
|
|
54
75
|
return value === 'light' || value === 'dark' ? value : 'system';
|
|
55
76
|
}
|
|
@@ -79,14 +100,9 @@ export function applyTheme(preference: ThemePreference): void {
|
|
|
79
100
|
const resolved = resolveThemeMode(preference, appearance);
|
|
80
101
|
document.documentElement.dataset.theme = resolved;
|
|
81
102
|
document.documentElement.style.colorScheme = resolved;
|
|
82
|
-
for (const key of applied) document.documentElement.style.removeProperty(`--${key}`);
|
|
83
|
-
applied.clear();
|
|
84
103
|
const colors = appearance[resolved] ?? {};
|
|
85
104
|
const tokens = { ...Object.fromEntries(themeColorTokens.flatMap(key => colors[key] === undefined ? [] : [[key, colors[key]]])),
|
|
86
105
|
...Object.fromEntries(componentShapeTokens.flatMap(key => shape?.tokens[key] === undefined ? [] : [[key, shape.tokens[key]]])) };
|
|
87
|
-
|
|
88
|
-
document.documentElement.style.setProperty(`--${key}`, value);
|
|
89
|
-
applied.add(key);
|
|
90
|
-
}
|
|
106
|
+
writeThemeStyle(resolved, tokens);
|
|
91
107
|
window.dispatchEvent(new Event(themeChangedEvent));
|
|
92
108
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
interfaceFontChanged,
|
|
4
|
+
interfaceFontPreferenceKey,
|
|
5
|
+
readInterfaceFont,
|
|
6
|
+
saveInterfaceFont,
|
|
7
|
+
type InterfaceFontPreference,
|
|
8
|
+
} from './interface-font';
|
|
9
|
+
|
|
10
|
+
/** Settings-page binding; other windows follow through the storage event. */
|
|
11
|
+
export function useInterfaceFont() {
|
|
12
|
+
const preference = ref(readInterfaceFont());
|
|
13
|
+
function update(patch: Partial<InterfaceFontPreference>) {
|
|
14
|
+
preference.value = { ...preference.value, ...patch };
|
|
15
|
+
saveInterfaceFont(preference.value);
|
|
16
|
+
}
|
|
17
|
+
function sync(event: Event) {
|
|
18
|
+
if (event instanceof StorageEvent && event.key !== interfaceFontPreferenceKey && event.key !== null) return;
|
|
19
|
+
preference.value = event instanceof CustomEvent ? event.detail as InterfaceFontPreference : readInterfaceFont();
|
|
20
|
+
}
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
window.addEventListener('storage', sync);
|
|
23
|
+
window.addEventListener(interfaceFontChanged, sync);
|
|
24
|
+
});
|
|
25
|
+
onBeforeUnmount(() => {
|
|
26
|
+
window.removeEventListener('storage', sync);
|
|
27
|
+
window.removeEventListener(interfaceFontChanged, sync);
|
|
28
|
+
});
|
|
29
|
+
return { preference, update };
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Mail provider brand icons
|
|
2
|
+
|
|
3
|
+
These marks identify supported mail services. Brand and trademark rights
|
|
4
|
+
remain with their respective owners. No affiliation or endorsement is implied.
|
|
5
|
+
|
|
6
|
+
qq.svg — QQ Mail app icon from Tencent's webmail sign-in page, traced into SVG.
|
|
7
|
+
https://res.wx.qq.com/t/webmail/webmail/res/images/logo_app_20@2x.b90d16b.png
|
|
8
|
+
|
|
9
|
+
netease-163.svg — Red 163 mark cropped from the official header and traced.
|
|
10
|
+
https://mimg.127.net/p/freemail/index/unified/static/2026/css/style.52d41eed807f372e4154.css
|
|
11
|
+
|
|
12
|
+
netease-126.svg — Green 126 mark cropped from the official header and traced.
|
|
13
|
+
https://mimg.127.net/p/freemail/index/unified/static/2026/css/style.f725ce8b2ece3e1a366f.css
|
|
14
|
+
|
|
15
|
+
gmail.svg — Original Gmail SVG from Google Workspace.
|
|
16
|
+
https://www.gstatic.com/images/branding/productlogos/gmail_2026/v2/web/192px.svg
|
|
17
|
+
https://about.google/brand-resource-center/products-and-services/
|
|
18
|
+
|
|
19
|
+
icloud.svg — Mail icon shown for iCloud Mail in Apple's iCloud guide, traced.
|
|
20
|
+
https://support.apple.com/en-ca/guide/icloud/mm203ae070a2/icloud
|
|
21
|
+
https://help.apple.com/assets/6AAB1A7B3D258762A20204E6/6AAB1A7EA2303D266D0C0FD9/en_CA/9a1224c90714bed734cb49d2b96ebfaa.png
|
|
22
|
+
|
|
23
|
+
tencent-exmail.svg — Tencent Exmail symbol cropped from the official header sprite and traced.
|
|
24
|
+
https://rescdn.qqmail.com/bizmail/zh_CN/htmledition/images/wwbiz/indexIcons_2x7a90f5.png
|
|
25
|
+
|
|
26
|
+
aliyun-mail.svg — Alibaba Mail symbol cropped from the official sign-in logo and traced.
|
|
27
|
+
https://qiye.aliyun.com/static/0.2.9/images/forNetCN/logo.png
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51 32">
|
|
2
|
+
<path d="M0 0 C10.06 -0.62 10.06 -0.62 13.44 1.62 C13.95 2.41 14.47 3.19 15 4 C15.37 4.53 15.73 5.06 16.11 5.6 C17.11 7.05 18.06 8.52 19 10 C22.77 6.37 22.77 6.37 23.99 4.4 C25.22 2.51 26.17 1.34 28 0 C30.69 -0.27 30.69 -0.27 33.68 -0.17 C34.68 -0.15 35.67 -0.12 36.7 -0.1 C37.46 -0.06 38.22 -0.03 39 0 C39.86 3.91 40.71 7.83 41.56 11.74 C41.85 13.07 42.14 14.4 42.44 15.74 C42.86 17.65 43.27 19.57 43.69 21.48 C43.82 22.08 43.95 22.67 44.09 23.28 C44.72 26.23 45.16 28.98 45 32 C40.63 31.49 37.41 30.86 34 28 C31.87 23.93 30.71 19.53 30 15 C26.1 18.68 23.01 22.56 20 27 C15.8 23.28 13 18.68 10 14 C9.78 14.89 9.56 15.78 9.34 16.7 C6.52 27.39 6.52 27.39 3.12 29.75 C0.04 30.98 -2.73 31.51 -6 32 C-4.53 21.22 -2.32 10.63 0 0 Z " fill="#E23C39" transform="translate(6,0)"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" fill="none" viewBox="0 0 192 192"><path fill="url(#a)" d="M146 44h38v110c0 6.627-5.373 12-12 12h-20a6 6 0 0 1-6-6z"/><path fill="#fc413d" d="M46 44H8v110c0 6.627 5.373 12 12 12h20a6 6 0 0 0 6-6z"/><path fill="url(#b)" d="M39.226 30.456c-8.033-6.752-20.018-5.714-26.77 2.319-6.752 8.032-5.714 20.017 2.319 26.77l76.078 63.949a8 8 0 0 0 10.295 0l76.078-63.95c8.032-6.752 9.07-18.737 2.318-26.77-6.752-8.032-18.737-9.07-26.769-2.318L96 78.18z"/><defs><linearGradient id="a" x1="165" x2="165" y1="44" y2="166" gradientUnits="userSpaceOnUse"><stop stop-color="#60d673"/><stop offset=".17" stop-color="#42c868"/><stop offset=".39" stop-color="#0ebc5f"/><stop offset=".62" stop-color="#00a9bb"/><stop offset=".86" stop-color="#3c90ff"/><stop offset="1" stop-color="#3186ff"/></linearGradient><linearGradient id="b" x1="8" x2="184" y1="46.13" y2="46.13" gradientUnits="userSpaceOnUse"><stop offset=".08" stop-color="#ff63a0"/><stop offset=".3" stop-color="#fc413d"/><stop offset=".5" stop-color="#fc413d"/><stop offset=".65" stop-color="#fc413d"/><stop offset=".72" stop-color="#fc5c30"/><stop offset=".86" stop-color="#feb10c"/><stop offset=".91" stop-color="#fec700"/><stop offset=".96" stop-color="#ffdb0f"/></linearGradient></defs></svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="background" x2="0" y2="1">
|
|
4
|
+
<stop stop-color="#1d6ff1"/><stop offset="1" stop-color="#1ac9fc"/>
|
|
5
|
+
</linearGradient>
|
|
6
|
+
</defs>
|
|
7
|
+
<path d="M0 0 C1.61 -0 3.23 -0 4.84 -0 C8.2 -0.01 11.56 0.01 14.92 0.03 C19.2 0.06 23.48 0.06 27.75 0.04 C31.08 0.04 34.41 0.04 37.73 0.06 C39.31 0.06 40.88 0.06 42.46 0.06 C54.37 0.04 66.54 0.2 75.52 9.06 C82.3 16.46 84.07 23.97 84.09 33.88 C84.1 34.61 84.1 35.33 84.11 36.08 C84.12 38.47 84.13 40.87 84.13 43.26 C84.13 43.67 84.13 43.67 84.14 45.75 C84.16 50.1 84.17 54.45 84.17 58.79 C84.18 63.27 84.2 67.74 84.23 72.21 C84.25 75.66 84.25 79.12 84.25 82.58 C84.26 84.22 84.26 85.87 84.28 87.52 C84.44 109.93 84.44 109.93 76.93 118.5 C76.48 119.01 76.04 119.52 75.57 120.05 C67.38 128.19 55.56 129.01 44.63 129.03 C43.13 129.02 41.62 129 40.11 128.99 C38.52 128.99 36.93 128.99 35.35 129 C32.04 129 28.73 128.99 25.42 128.96 C21.21 128.93 17 128.94 12.8 128.95 C9.52 128.96 6.25 128.95 2.97 128.94 C1.42 128.93 -0.13 128.93 -1.68 128.94 C-14.15 128.95 -26.63 128.78 -36.07 119.5 C-45.18 109.98 -44.52 96.65 -44.47 84.37 C-44.47 82.73 -44.47 81.08 -44.48 79.44 C-44.48 76.02 -44.48 72.6 -44.46 69.17 C-44.44 64.81 -44.45 60.45 -44.47 56.08 C-44.48 52.7 -44.48 49.31 -44.47 45.93 C-44.47 44.32 -44.47 42.71 -44.48 41.11 C-44.55 19.03 -44.55 19.03 -37.07 10.5 C-36.62 9.98 -36.18 9.47 -35.71 8.94 C-26.28 -0.43 -12.36 -0.1 0 0 Z " fill="url(#background)" transform="translate(44.0703125,-0.49609375)"/>
|
|
8
|
+
<path d="M0 0 C27.06 0 54.12 0 82 0 C82 3 82 3 80.82 4.56 C80.54 4.83 80.54 4.83 79.14 6.23 C78.83 6.55 78.83 6.55 77.25 8.14 C76.57 8.82 75.88 9.49 75.18 10.19 C74.83 10.54 74.83 10.54 73.06 12.31 C71.58 13.79 70.09 15.26 68.6 16.73 C66.33 18.98 64.07 21.24 61.81 23.51 C60.37 24.94 58.93 26.38 57.49 27.81 C57.15 28.15 57.15 28.15 55.45 29.86 C46.79 38.39 46.79 38.39 41.19 38.56 C33.17 38.09 26.97 30.26 21.66 24.85 C21 24.19 20.35 23.54 19.67 22.86 C17.61 20.79 15.56 18.71 13.5 16.62 C12.09 15.21 10.68 13.79 9.27 12.37 C5.84 8.92 2.42 5.46 -1 2 C-0.67 1.34 -0.34 0.68 0 0 Z " fill="#FFFFFF" transform="translate(23,35)"/>
|
|
9
|
+
<path d="M0 0 C0.24 0.21 0.24 0.21 1.43 1.25 C2.05 1.79 2.67 2.33 3.32 2.88 C3.62 3.15 3.62 3.15 5.18 4.5 C9.5 8.06 13.46 9.58 18.99 9.35 C25.09 8.28 29.38 3.85 34 0 C42.25 8.25 50.5 16.5 59 25 C58.67 25.66 58.34 26.32 58 27 C30.94 27 3.88 27 -24 27 C-24 24 -24 24 -21.8 21.46 C-20.79 20.45 -19.77 19.45 -18.75 18.46 C-18.22 17.93 -17.68 17.4 -17.14 16.86 C-15.43 15.17 -13.72 13.49 -12 11.81 C-10.84 10.67 -9.69 9.53 -8.53 8.38 C-5.7 5.58 -2.85 2.79 0 0 Z " fill="#FFFFFF" transform="translate(47,66)"/>
|
|
10
|
+
<path d="M0 0 C0 17.16 0 34.32 0 52 C-4.14 48.45 -8.03 45.09 -11.84 41.26 C-12.25 40.84 -12.66 40.43 -13.09 40.01 C-14.37 38.71 -15.66 37.42 -16.94 36.12 C-17.82 35.24 -18.7 34.35 -19.59 33.46 C-21.73 31.31 -23.86 29.16 -26 27 C-24.42 23.1 -21.75 20.48 -18.81 17.58 C-18.3 17.07 -17.8 16.57 -17.28 16.05 C-16.21 14.99 -15.15 13.93 -14.08 12.87 C-12.43 11.25 -10.8 9.61 -9.17 7.98 C-8.13 6.95 -7.09 5.92 -6.06 4.89 C-5.57 4.4 -5.08 3.91 -4.57 3.4 C-1.12 0 -1.12 0 0 0 Z " fill="#FFFFFF" transform="translate(109,38)"/>
|
|
11
|
+
<path d="M0 0 C4.14 3.55 8.03 6.91 11.84 10.74 C12.25 11.16 12.66 11.57 13.09 11.99 C14.37 13.29 15.66 14.58 16.94 15.88 C17.82 16.76 18.7 17.65 19.59 18.54 C21.73 20.69 23.86 22.84 26 25 C24.42 28.9 21.75 31.52 18.81 34.42 C18.3 34.93 17.8 35.43 17.28 35.95 C16.21 37.01 15.15 38.07 14.08 39.13 C12.43 40.75 10.8 42.39 9.17 44.02 C8.13 45.05 7.09 46.08 6.06 47.11 C5.81 47.35 5.81 47.35 4.57 48.6 C1.12 52 1.12 52 0 52 C0 34.84 0 17.68 0 0 Z " fill="#FFFFFF" transform="translate(19,38)"/>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 121 61">
|
|
2
|
+
<path d="M0 0 C-1.6 4.96 -4.53 8.7 -7.62 12.81 C-7.88 13.16 -7.88 13.16 -9.19 14.91 C-10.45 16.61 -11.72 18.31 -13 20 C-11.92 19.97 -10.84 19.95 -9.73 19.92 C-3.49 19.93 1.6 22.6 6 27 C8.96 31.66 9.91 36.56 9 42 C6.98 48.62 2.62 53.13 -3 57 C-7.51 59.4 -11.83 59.37 -16.81 59.38 C-17.58 59.4 -18.35 59.42 -19.14 59.45 C-25.86 59.48 -31 57.65 -36.06 53.18 C-36.29 52.9 -36.29 52.9 -37.44 51.44 C-37.91 50.86 -38.38 50.28 -38.87 49.68 C-42.15 44.79 -41.57 38.62 -41 33 C-38.51 24.42 -31.92 17.38 -26.3 10.64 C-25 9 -25 9 -23.11 6.11 C-17.23 -2.32 -9.31 -0.86 0 0 Z M-22.83 34.4 C-24.99 37.34 -25.13 39.34 -25 43 C-23.23 45.49 -21.83 46.63 -19.06 47.88 C-16.19 48.05 -14.52 47.36 -12 46 C-9.35 43.26 -8.19 40.82 -8 37 C-9 34.25 -9 34.25 -11 32 C-16.12 30.26 -18.9 30.61 -22.83 34.4 Z " fill="#1E7E3E" transform="translate(112,2)"/>
|
|
3
|
+
<path d="M0 0 C3.45 3.55 4.95 6.63 5.5 11.56 C5.11 19.32 0.83 25.56 -3.56 31.69 C-4.07 32.41 -4.58 33.14 -5.11 33.89 C-6.36 35.66 -7.62 37.43 -8.88 39.19 C-3.92 39.52 1.02 39.85 6.12 40.19 C5.67 45.91 5.28 49.8 3.12 55.19 C-11.4 55.19 -25.92 55.19 -40.88 55.19 C-34.25 46.35 -34.25 46.35 -30.56 42.44 C-27.16 38.71 -23.98 34.89 -20.94 30.88 C-20.75 30.63 -20.75 30.63 -19.79 29.39 C-17 25.64 -15.21 22.17 -14.44 17.56 C-14.88 15.19 -14.88 15.19 -16.69 13.25 C-21.6 11.61 -25.94 12.99 -30.88 14.19 C-30.73 12.27 -30.59 10.35 -30.44 8.44 C-30.36 7.37 -30.28 6.3 -30.19 5.2 C-29.64 -0.07 -29.64 -0.07 -28.88 -1.81 C-19.3 -6.73 -8.93 -5.63 0 0 Z " fill="#1E7E3E" transform="translate(61.875,5.8125)"/>
|
|
4
|
+
<path d="M0 0 C1.41 2.81 0.73 4.55 0.2 7.64 C0.15 7.93 0.15 7.93 -0.1 9.39 C-0.42 11.29 -0.76 13.2 -1.09 15.1 C-1.32 16.42 -1.54 17.74 -1.77 19.06 C-2.36 22.54 -2.96 26.01 -3.57 29.49 C-4.18 33.03 -4.79 36.58 -5.4 40.12 C-6.59 47.08 -7.79 54.04 -9 61 C-14.28 61 -19.56 61 -25 61 C-24.42 53.15 -23.32 45.52 -21.84 37.8 C-21.5 35.98 -21.16 34.15 -20.82 32.32 C-19.15 23.46 -19.15 23.46 -18 20 C-20.97 20 -23.94 20 -27 20 C-27.52 15.06 -27.52 15.06 -26 12 C-21.64 8.98 -16.89 7.02 -12 5 C-10.8 4.49 -9.6 3.97 -8.4 3.45 C-5.62 2.26 -2.82 1.12 0 0 Z " fill="#1E7E3E" transform="translate(27,0)"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 60">
|
|
2
|
+
<path d="M0 0 C0 1.98 0 3.96 0 6 C-0.87 6.23 -1.74 6.46 -2.63 6.7 C-11.66 9.21 -17.13 11.56 -22 20 C-21.58 19.97 -21.58 19.97 -19.47 19.79 C-12.32 19.44 -7.6 19.67 -1.75 24.31 C2.7 28.61 3.18 31.86 3.44 37.88 C3.25 44.78 1.58 49.42 -3.31 54.31 C-10.53 58.84 -16.64 60.17 -25.17 58.6 C-31.06 56.84 -34.71 53.08 -38 48 C-41.66 40.63 -41.68 32.95 -40 25 C-36.36 14.87 -31.17 7.78 -21.44 3.12 C-14.17 0.11 -7.78 -0.14 0 0 Z M-26 30 C-26.69 43.97 -26.69 43.97 -24.12 47.81 C-21.55 50.46 -20.74 50.94 -17.06 51.25 C-14 51 -14 51 -12.19 49.69 C-9.67 46.11 -9.5 42.22 -10 38 C-11.11 34.42 -12.33 31.67 -15 29 C-19.28 27.57 -21.85 28.51 -26 30 Z " fill="#DB0816" transform="translate(73,1)"/>
|
|
3
|
+
<path d="M0 0 C2.54 1.99 4.54 4.08 6 7 C6.58 12.88 5.3 16.15 2 21 C2.21 21.24 2.21 21.24 3.28 22.46 C3.83 23.09 4.37 23.72 4.94 24.38 C5.48 25 6.03 25.63 6.59 26.27 C10.11 30.58 9.53 35.68 9 41 C6.92 46.74 1.22 51.04 -4.06 53.75 C-10.36 56.21 -18.46 56.87 -25.06 55.38 C-28.62 53.71 -29.87 52.24 -32 49 C-30.55 44.42 -30.55 44.42 -28.19 42.62 C-25.35 41.81 -23.81 42.11 -21 43 C-20.26 43.52 -19.52 44.03 -18.75 44.56 C-14.85 46.6 -11.31 46.74 -7 46 C-4.94 44.38 -4.94 44.38 -4 42 C-3.75 39 -3.75 39 -4 36 C-4.04 35.26 -4.08 34.52 -4.12 33.75 C-5 32 -5 32 -7.38 30.81 C-12.12 29.5 -17.11 29.33 -22 29 C-22 27.35 -22 25.7 -22 24 C-21.16 23.59 -20.31 23.18 -19.45 22.76 C-18.34 22.21 -17.23 21.67 -16.12 21.12 C-15.57 20.86 -15.01 20.59 -14.44 20.31 C-11.92 19.06 -10 18 -8 16 C-7.75 13.5 -7.75 13.5 -8 11 C-10.49 8.51 -11.43 8.68 -14.88 8.62 C-19.61 8.72 -19.61 8.72 -22.44 10.75 C-22.7 11.12 -22.7 11.12 -24 13 C-24.58 13.74 -25.16 14.48 -25.75 15.25 C-26.16 15.83 -26.58 16.41 -27 17 C-28.65 16.01 -30.3 15.02 -32 14 C-31.33 8.28 -28.72 4.68 -24.69 0.75 C-16.93 -4.3 -8.11 -4.32 0 0 Z " fill="#DB0816" transform="translate(111,4)"/>
|
|
4
|
+
<path d="M0 0 C0.33 16.83 0.66 33.66 1 51 C3.64 51.66 6.28 52.32 9 53 C9 54.98 9 56.96 9 59 C-0.9 59 -10.8 59 -21 59 C-21 57.02 -21 55.04 -21 53 C-18.69 52.34 -16.38 51.68 -14 51 C-13.67 38.79 -13.34 26.58 -13 14 C-15.97 14.66 -18.94 15.32 -22 16 C-22 14.02 -22 12.04 -22 10 C-2.3 0 -2.3 0 0 0 Z " fill="#DB0816" transform="translate(22,0)"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="background" x1="80%" y1="0%" x2="24%" y2="100%">
|
|
4
|
+
<stop stop-color="#d2ee15"/><stop offset=".4" stop-color="#f5dc12"/><stop offset=".72" stop-color="#ff9c03"/><stop offset="1" stop-color="#ff6d00"/>
|
|
5
|
+
</linearGradient>
|
|
6
|
+
</defs>
|
|
7
|
+
<path d="M0 0 C1.79 0.03 3.57 0 5.35 -0.03 C14.92 0.02 14.92 0.02 18.06 2.38 C21.09 6.42 20.53 12.06 20.44 16.86 C20.41 18.65 20.44 20.43 20.47 22.21 C20.42 31.78 20.42 31.78 18.06 34.93 C14.03 37.95 8.38 37.39 3.58 37.3 C1.79 37.28 0.01 37.3 -1.77 37.34 C-11.34 37.28 -11.34 37.28 -14.48 34.93 C-17.51 30.89 -16.95 25.25 -16.86 20.44 C-16.84 18.65 -16.86 16.88 -16.89 15.09 C-16.84 5.52 -16.84 5.52 -14.48 2.38 C-10.45 -0.65 -4.8 -0.09 0 0 Z " fill="url(#background)" transform="translate(16.2109375,-0.65185546875)"/>
|
|
8
|
+
<path d="M0 0 C0.98 -0 1.97 -0 2.98 -0 C4.02 -0 5.06 0 6.12 0.01 C6.64 0.01 6.64 0.01 9.27 -0 C10.25 -0 11.24 -0 12.25 0 C13.16 0 14.07 0 15.01 0 C17.12 0.13 17.12 0.13 18.12 1.13 C18.25 2.7 18.25 2.7 18.26 4.7 C18.26 5.05 18.26 5.05 18.26 6.86 C18.26 7.61 18.25 8.36 18.25 9.13 C18.25 9.51 18.25 9.51 18.26 11.41 C18.26 12.12 18.26 12.83 18.26 13.57 C18.26 14.23 18.26 14.89 18.25 15.57 C18.12 17.13 18.12 17.13 17.12 18.13 C15.5 18.23 13.88 18.26 12.25 18.27 C11.27 18.27 10.28 18.27 9.27 18.27 C8.23 18.27 7.19 18.26 6.12 18.26 C5.61 18.26 5.61 18.26 2.98 18.27 C2 18.27 1.01 18.27 0 18.27 C-0.91 18.26 -1.82 18.26 -2.76 18.26 C-4.88 18.13 -4.88 18.13 -5.88 17.13 C-6 15.57 -6 15.57 -6.01 13.57 C-6.01 12.86 -6.01 12.14 -6.01 11.41 C-6.01 10.66 -6 9.91 -6 9.13 C-6 8.38 -6.01 7.63 -6.01 6.86 C-6.01 6.15 -6.01 5.43 -6.01 4.7 C-6.01 4.04 -6.01 3.38 -6 2.7 C-5.71 -0.85 -2.92 0 0 0 Z M-0.88 3.13 C3.12 7.13 3.12 7.13 5 8.13 C8.49 8.13 10.4 6.24 13.12 4.13 C13.12 3.8 13.12 3.47 13.12 3.13 C8.5 3.13 3.88 3.13 -0.88 3.13 Z M-3.88 5.13 C-3.88 8.43 -3.88 11.73 -3.88 15.13 C2.73 15.13 9.33 15.13 16.12 15.13 C16.12 11.83 16.12 8.53 16.12 5.13 C15.43 5.57 15.43 5.57 11.94 7.76 C7.51 10.21 7.51 10.21 4.44 9.63 C3.67 9.14 2.91 8.64 2.12 8.13 C1.03 7.58 -0.08 7.04 -1.19 6.51 C-2.07 6.05 -2.96 5.6 -3.88 5.13 Z " fill="#FFFFFF" transform="translate(11.875,8.8671875)"/>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 38">
|
|
2
|
+
<path d="M0 0 C0.68 -0.03 1.36 -0.05 2.05 -0.08 C4.92 0.38 6.08 1.17 8.12 3.25 C8.52 5.79 8.66 7.9 8.62 10.44 C8.62 11.14 8.62 11.84 8.63 12.56 C8.62 14.03 8.61 15.51 8.59 16.98 C8.56 19.24 8.57 21.5 8.58 23.76 C8.58 25.19 8.57 26.63 8.56 28.06 C8.56 28.74 8.56 29.41 8.57 30.11 C8.51 32.96 8.43 34.82 6.73 37.17 C3.52 39.33 -0.18 38.82 -3.88 38.25 C-8.77 35.45 -12.26 30.53 -15.88 26.25 C-16.39 25.67 -16.9 25.1 -17.43 24.5 C-20.88 20.59 -20.88 20.59 -20.88 17.25 C-17.44 17.83 -15.91 18.9 -13.56 21.44 C-11.18 23.91 -8.8 26.33 -6.25 28.62 C-5.72 29.11 -5.19 29.59 -4.65 30.09 C-2.88 31.25 -2.88 31.25 2.12 32.25 C2.12 23.67 2.12 15.09 2.12 6.25 C-3.81 8.23 -5.83 9.74 -10.04 13.89 C-10.65 14.34 -11.25 14.79 -11.88 15.25 C-12.87 14.92 -13.86 14.59 -14.88 14.25 C-13.4 11.02 -11.56 8.36 -9.38 5.56 C-8.77 4.77 -8.16 3.99 -7.53 3.18 C-5.15 0.41 -3.52 0.08 0 0 Z " fill="#2984EF" transform="translate(45.875,-0.25)"/>
|
|
3
|
+
<path d="M0 0 C2.14 1.68 3.37 2.93 5 5 C5.28 5.29 5.28 5.29 6.67 6.79 C9.93 10.31 9.93 10.31 11 12 C10.67 12.99 10.34 13.98 10 15 C6.31 13.33 3.79 11.11 0.88 8.34 C-1 7 -1 7 -6 6 C-6 14.58 -6 23.16 -6 32 C-1.03 30.34 1.07 29.49 4.88 26.38 C5.66 25.74 6.44 25.11 7.24 24.46 C7.82 23.98 8.4 23.5 9 23 C9.66 23.33 10.32 23.66 11 24 C8.53 29.3 5.32 34.04 1 38 C-2.21 39.01 -4.79 39 -8 38 C-10.1 36.91 -10.1 36.91 -12 35 C-12.41 32.46 -12.56 30.35 -12.53 27.81 C-12.54 27.11 -12.54 26.41 -12.54 25.69 C-12.55 24.22 -12.54 22.74 -12.52 21.27 C-12.5 19.01 -12.52 16.75 -12.55 14.49 C-12.54 13.06 -12.54 11.62 -12.53 10.19 C-12.54 9.51 -12.55 8.84 -12.56 8.14 C-12.49 4.94 -12.39 3.4 -10.09 1.08 C-6.69 -0.68 -3.73 -0.78 0 0 Z " fill="#2984EF" transform="translate(12,0)"/>
|
|
4
|
+
</svg>
|
|
@@ -1,97 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AgentBinding, AssistantTransport, WorkspaceAdapter } from '@tano/protocol';
|
|
3
|
-
import { AgentTaskQueue } from './inbox';
|
|
4
|
-
|
|
5
|
-
/** Reserve the binding before creating its portable identity, allowing crash-safe repair. */
|
|
6
|
-
export async function ensureAgentIdentities(
|
|
7
|
-
workspaceId: string,
|
|
8
|
-
adapter: Pick<WorkspaceAdapter, 'refresh' | 'read' | 'write' | 'create' | 'reserveObjectId'>,
|
|
9
|
-
transport: Pick<AssistantTransport, 'inbox' | 'connections' | 'models' | 'hostedInbox'>,
|
|
10
|
-
signal?: AbortSignal,
|
|
11
|
-
) {
|
|
12
|
-
const errors: string[] = [];
|
|
13
|
-
if (!transport.inbox || !adapter.reserveObjectId) return errors;
|
|
14
|
-
const queue = new AgentTaskQueue(transport.inbox);
|
|
15
|
-
const connections = await transport.connections();
|
|
16
|
-
for (const connection of connections) {
|
|
17
|
-
if (connection.platformProvider && transport.hostedInbox) continue;
|
|
18
|
-
try {
|
|
19
|
-
signal?.throwIfAborted();
|
|
20
|
-
const inbox = await transport.inbox.load(workspaceId);
|
|
21
|
-
let binding = inbox.bindings.find((item) => item.connectionId === connection.id);
|
|
22
|
-
if (!binding) {
|
|
23
|
-
let models: string[] = [];
|
|
24
|
-
try { models = await transport.models(connection.id, signal ? AbortSignal.any([signal, AbortSignal.timeout(30_000)]) : AbortSignal.timeout(30_000)); }
|
|
25
|
-
catch (reason) { errors.push(`${connection.name} · ${String(reason)}`); }
|
|
26
|
-
signal?.throwIfAborted();
|
|
27
|
-
const workspace = await adapter.refresh();
|
|
28
|
-
if (workspace.id !== workspaceId || workspace.readOnly) return errors;
|
|
29
|
-
const personId = await adapter.reserveObjectId(inbox.bindings.map((item) => item.personId));
|
|
30
|
-
const candidate: AgentBinding = {
|
|
31
|
-
personId,
|
|
32
|
-
connectionId: connection.id,
|
|
33
|
-
model: models[0] ?? '',
|
|
34
|
-
enabled: true,
|
|
35
|
-
};
|
|
36
|
-
binding = await queue.update(workspaceId, (current) => {
|
|
37
|
-
const existing = current.bindings.find((item) => item.connectionId === connection.id);
|
|
38
|
-
if (existing) return { ...existing };
|
|
39
|
-
current.bindings.push(candidate);
|
|
40
|
-
return candidate;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const workspace = await adapter.refresh();
|
|
44
|
-
signal?.throwIfAborted();
|
|
45
|
-
if (workspace.id !== workspaceId || workspace.readOnly) return errors;
|
|
46
|
-
const path = `${objectDirectory}/${binding.personId}.tano.json`;
|
|
47
|
-
if (workspace.files.some((file) => file.path === path)) {
|
|
48
|
-
const object = parseObject((await adapter.read(path)).content);
|
|
49
|
-
if (object.id !== binding.personId || !isAgentPerson(object))
|
|
50
|
-
throw new Error('机器人身份与已有对象冲突');
|
|
51
|
-
if (!binding.provisioned) await queue.update(workspaceId, current => {
|
|
52
|
-
const saved = current.bindings.find(item => item.personId === binding!.personId);
|
|
53
|
-
if (saved) saved.provisioned = true;
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (binding.provisioned) {
|
|
58
|
-
await queue.update(workspaceId, current => {
|
|
59
|
-
const saved = current.bindings.find(item => item.personId === binding!.personId);
|
|
60
|
-
if (saved) saved.enabled = false;
|
|
61
|
-
});
|
|
62
|
-
errors.push(`${connection.name} · 机器人身份文件已移除,请从文件历史恢复后重新启用`);
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const object = {
|
|
66
|
-
version: 1,
|
|
67
|
-
id: binding.personId,
|
|
68
|
-
type: 'person',
|
|
69
|
-
name: connection.name,
|
|
70
|
-
description: '',
|
|
71
|
-
archived: false,
|
|
72
|
-
properties: { memberKind: 'agent' },
|
|
73
|
-
};
|
|
74
|
-
try {
|
|
75
|
-
await adapter.create(path, JSON.stringify(object, null, 2) + '\n');
|
|
76
|
-
} catch (error) {
|
|
77
|
-
const current = await adapter.refresh();
|
|
78
|
-
if (!current.files.some((file) => file.path === path)) throw error;
|
|
79
|
-
const saved = parseObject((await adapter.read(path)).content);
|
|
80
|
-
if (saved.id !== binding.personId || !isAgentPerson(saved)) throw error;
|
|
81
|
-
}
|
|
82
|
-
await queue.update(workspaceId, current => {
|
|
83
|
-
const saved = current.bindings.find(item => item.personId === binding!.personId);
|
|
84
|
-
if (saved) saved.provisioned = true;
|
|
85
|
-
});
|
|
86
|
-
} catch (reason) {
|
|
87
|
-
errors.push(`${connection.name} · ${String(reason)}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
await queue.update(workspaceId, (inbox) => {
|
|
91
|
-
for (const binding of inbox.bindings)
|
|
92
|
-
if (!connections.some((connection) => connection.id === binding.connectionId) ||
|
|
93
|
-
transport.hostedInbox && connections.some(connection => connection.id === binding.connectionId && connection.platformProvider))
|
|
94
|
-
binding.enabled = false;
|
|
95
|
-
});
|
|
96
|
-
return errors;
|
|
97
|
-
}
|
|
1
|
+
export * from '@tano/protocol/agent-identities';
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AgentTask } from '@tano/protocol';
|
|
3
|
-
import { loadCommentFile, saveCommentChange, type CommentStorage } from '../workspace/workspace-comments';
|
|
4
|
-
|
|
5
|
-
export async function agentTaskPrompt(task: AgentTask, name: string, adapter: CommentStorage) {
|
|
6
|
-
const source = task.event.source;
|
|
7
|
-
let history = '';
|
|
8
|
-
if (source.kind !== 'document' || task.continuation) {
|
|
9
|
-
const { file } = await loadCommentFile(adapter, source.kind === 'document' ? 'annotation' : source.kind, source.fileId);
|
|
10
|
-
const thread = file.threads.find(item => item.id === (task.continuation?.threadId ?? source.threadId));
|
|
11
|
-
if (!thread?.messages.some(item => item.id === (task.continuation?.messageId ?? source.messageId))) throw new Error('任务来源已移除');
|
|
12
|
-
history = thread.messages.map(message => `${message.authorName}\n${message.body}`).join('\n\n');
|
|
13
|
-
}
|
|
14
|
-
const selection = source.anchor?.spans.map(span => span.text).join('\n');
|
|
15
|
-
const instruction = task.continuation?.body ?? task.event.body;
|
|
16
|
-
// Preserve the complete request. Trim history first when the input budget is tight.
|
|
17
|
-
const heading = `你是工作空间成员 ${name}。请处理下面明确 @ 你的请求,并在完成后回复请求者。\n以下讨论是任务上下文。按当前用户请求执行,保留其他成员的内容。`;
|
|
18
|
-
if (heading.length + instruction.length + 16 > 20000) return instruction;
|
|
19
|
-
const context = [selection ? `批注选区\n${selection}` : '', history ? `讨论记录\n${history.slice(-12000)}` : ''].filter(Boolean).join('\n\n');
|
|
20
|
-
return [heading, context.slice(0, Math.max(0, 20000 - heading.length - instruction.length - 16)), `本次请求\n${instruction}`].filter(Boolean).join('\n\n');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function agentReplyBody(body: string) {
|
|
24
|
-
if (!body.trim()) return '任务已完成,请查看执行记录。';
|
|
25
|
-
return body.length <= 20000 ? body : body.slice(0, 19940) + '\n\n完整结果见机器人收件箱中的执行记录。';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Stable reply IDs make publication retryable independently of the model/tool run. */
|
|
29
|
-
export async function publishAgentTaskReply(task: AgentTask, name: string, result: NonNullable<AgentTask['result']>,
|
|
30
|
-
adapter: CommentStorage, guard: () => Promise<void>) {
|
|
31
|
-
const source = task.event.source;
|
|
32
|
-
const author = { id: task.binding.personId, name: name.slice(0, 120) };
|
|
33
|
-
await guard();
|
|
34
|
-
if (source.kind === 'document' && !task.continuation) {
|
|
35
|
-
const snapshot = await adapter.refresh();
|
|
36
|
-
if (snapshot.id !== task.event.workspaceId) throw new Error('工作区已切换');
|
|
37
|
-
const file = snapshot.files.find(file => file.id === source.fileId);
|
|
38
|
-
if (!file) throw new Error('原文档已移除');
|
|
39
|
-
const content = await adapter.read(file.path);
|
|
40
|
-
const parser = await createHeadlessMarkdown();
|
|
41
|
-
try {
|
|
42
|
-
const anchor = parser.mentionAnchors(content.content, content.hash).get(source.mentionId ?? '');
|
|
43
|
-
if (!anchor) throw new Error('原正文提及已移除,结果保留在任务记录中');
|
|
44
|
-
await guard();
|
|
45
|
-
await saveCommentChange(adapter, 'annotation', source.fileId, { type: 'start', id: result.messageId,
|
|
46
|
-
body: result.body, author, anchor, agentTaskId: task.id });
|
|
47
|
-
} finally { await parser.destroy(); }
|
|
48
|
-
} else {
|
|
49
|
-
await saveCommentChange(adapter, source.kind === 'document' ? 'annotation' : source.kind, source.fileId, {
|
|
50
|
-
type: 'reply', threadId: task.continuation?.threadId ?? source.threadId!, id: result.messageId, body: result.body,
|
|
51
|
-
author, replyTo: task.continuation?.messageId ?? source.messageId, agentTaskId: task.id,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
export * from '@tano/editor/agent-task-context';
|
|
@@ -3,7 +3,7 @@ import { t } from '../i18n/i18n';
|
|
|
3
3
|
|
|
4
4
|
export const maxAssistantAttachments = 10;
|
|
5
5
|
export const assistantAttachmentBytes = { text: 128 * 1024, media: 4 * 1024 * 1024 };
|
|
6
|
-
export
|
|
6
|
+
export { assistantClipboardSeparator } from '@tano/protocol/assistant-language';
|
|
7
7
|
|
|
8
8
|
const mediaTypes: Readonly<Record<string, string>> = {
|
|
9
9
|
png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp',
|