dsh-plugin-core 0.2.14 → 0.4.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/LICENSE +21 -0
- package/README.md +52 -83
- package/dist/design/tokens-css.d.ts +1 -1
- package/dist/design/tokens-css.d.ts.map +1 -1
- package/dist/design/tokens-css.generated.d.ts +2 -0
- package/dist/design/tokens-css.generated.d.ts.map +1 -0
- package/dist/design/tokens-css.generated.js +4 -0
- package/dist/design/tokens-css.generated.js.map +1 -0
- package/dist/design/tokens-css.js +1 -252
- package/dist/design/tokens-css.js.map +1 -1
- package/dist/explorer/FileBrowser.d.ts +41 -0
- package/dist/explorer/FileBrowser.d.ts.map +1 -0
- package/dist/explorer/FileBrowser.js +659 -0
- package/dist/explorer/FileBrowser.js.map +1 -0
- package/dist/explorer/explorer-css.d.ts +1 -1
- package/dist/explorer/explorer-css.d.ts.map +1 -1
- package/dist/explorer/explorer-css.generated.d.ts +2 -0
- package/dist/explorer/explorer-css.generated.d.ts.map +1 -0
- package/dist/explorer/explorer-css.generated.js +4 -0
- package/dist/explorer/explorer-css.generated.js.map +1 -0
- package/dist/explorer/explorer-css.js +1 -31
- package/dist/explorer/explorer-css.js.map +1 -1
- package/dist/explorer/index.d.ts +4 -2
- package/dist/explorer/index.d.ts.map +1 -1
- package/dist/explorer/index.js +4 -2
- package/dist/explorer/index.js.map +1 -1
- package/dist/explorer/open.d.ts +103 -0
- package/dist/explorer/open.d.ts.map +1 -0
- package/dist/explorer/open.js +282 -0
- package/dist/explorer/open.js.map +1 -0
- package/dist/explorer/preview/BytesPreview.d.ts +13 -0
- package/dist/explorer/preview/BytesPreview.d.ts.map +1 -0
- package/dist/explorer/preview/BytesPreview.js +56 -0
- package/dist/explorer/preview/BytesPreview.js.map +1 -0
- package/dist/explorer/preview/HtmlPreview.d.ts +18 -0
- package/dist/explorer/preview/HtmlPreview.d.ts.map +1 -0
- package/dist/explorer/preview/HtmlPreview.js +112 -0
- package/dist/explorer/preview/HtmlPreview.js.map +1 -0
- package/dist/explorer/preview/OfficePreview.d.ts +11 -0
- package/dist/explorer/preview/OfficePreview.d.ts.map +1 -0
- package/dist/explorer/preview/OfficePreview.js +53 -0
- package/dist/explorer/preview/OfficePreview.js.map +1 -0
- package/dist/explorer/preview/TextPreview.d.ts +17 -0
- package/dist/explorer/preview/TextPreview.d.ts.map +1 -0
- package/dist/explorer/preview/TextPreview.js +95 -0
- package/dist/explorer/preview/TextPreview.js.map +1 -0
- package/dist/explorer/preview/index.d.ts +10 -3
- package/dist/explorer/preview/index.d.ts.map +1 -1
- package/dist/explorer/preview/index.js +52 -55
- package/dist/explorer/preview/index.js.map +1 -1
- package/dist/explorer/preview/md-labels.d.ts +3 -0
- package/dist/explorer/preview/md-labels.d.ts.map +1 -0
- package/dist/explorer/preview/md-labels.js +12 -0
- package/dist/explorer/preview/md-labels.js.map +1 -0
- package/dist/explorer/types.d.ts +186 -4
- package/dist/explorer/types.d.ts.map +1 -1
- package/dist/explorer/types.js +401 -14
- package/dist/explorer/types.js.map +1 -1
- package/dist/host/index.d.ts +66 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +60 -0
- package/dist/host/index.js.map +1 -0
- package/dist/session/SessionViewModal.d.ts +42 -0
- package/dist/session/SessionViewModal.d.ts.map +1 -0
- package/dist/session/SessionViewModal.js +997 -0
- package/dist/session/SessionViewModal.js.map +1 -0
- package/dist/session/changes.d.ts +73 -0
- package/dist/session/changes.d.ts.map +1 -0
- package/dist/session/changes.js +134 -0
- package/dist/session/changes.js.map +1 -0
- package/dist/session/faces.d.ts +198 -0
- package/dist/session/faces.d.ts.map +1 -0
- package/dist/session/faces.js +17 -0
- package/dist/session/faces.js.map +1 -0
- package/dist/session/index.d.ts +5 -23
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +25 -70
- package/dist/session/index.js.map +1 -1
- package/dist/session/mirror/ChangedFileDiff.d.ts +22 -0
- package/dist/session/mirror/ChangedFileDiff.d.ts.map +1 -0
- package/dist/session/mirror/ChangedFileDiff.js +157 -0
- package/dist/session/mirror/ChangedFileDiff.js.map +1 -0
- package/dist/session/mirror/ChangedFilesCard.d.ts +18 -0
- package/dist/session/mirror/ChangedFilesCard.d.ts.map +1 -0
- package/dist/session/mirror/ChangedFilesCard.js +158 -0
- package/dist/session/mirror/ChangedFilesCard.js.map +1 -0
- package/dist/session/mirror/ChatGroupSeat.d.ts +24 -0
- package/dist/session/mirror/ChatGroupSeat.d.ts.map +1 -0
- package/dist/session/mirror/ChatGroupSeat.js +134 -0
- package/dist/session/mirror/ChatGroupSeat.js.map +1 -0
- package/dist/session/mirror/ChatNodeSeat.d.ts +43 -0
- package/dist/session/mirror/ChatNodeSeat.d.ts.map +1 -0
- package/dist/session/mirror/ChatNodeSeat.js +133 -0
- package/dist/session/mirror/ChatNodeSeat.js.map +1 -0
- package/dist/session/mirror/ChatView.d.ts +47 -0
- package/dist/session/mirror/ChatView.d.ts.map +1 -0
- package/dist/session/mirror/ChatView.js +127 -0
- package/dist/session/mirror/ChatView.js.map +1 -0
- package/dist/session/mirror/CommandCard.d.ts +20 -0
- package/dist/session/mirror/CommandCard.d.ts.map +1 -0
- package/dist/session/mirror/CommandCard.js +69 -0
- package/dist/session/mirror/CommandCard.js.map +1 -0
- package/dist/session/mirror/Deliverables.d.ts +24 -0
- package/dist/session/mirror/Deliverables.d.ts.map +1 -0
- package/dist/session/mirror/Deliverables.js +134 -0
- package/dist/session/mirror/Deliverables.js.map +1 -0
- package/dist/session/mirror/GenericCommandCard.d.ts +25 -0
- package/dist/session/mirror/GenericCommandCard.d.ts.map +1 -0
- package/dist/session/mirror/GenericCommandCard.js +567 -0
- package/dist/session/mirror/GenericCommandCard.js.map +1 -0
- package/dist/session/mirror/MessageIconActions.d.ts +16 -0
- package/dist/session/mirror/MessageIconActions.d.ts.map +1 -0
- package/dist/session/mirror/MessageIconActions.js +71 -0
- package/dist/session/mirror/MessageIconActions.js.map +1 -0
- package/dist/session/mirror/MessageItem.d.ts +66 -0
- package/dist/session/mirror/MessageItem.d.ts.map +1 -0
- package/dist/session/mirror/MessageItem.js +135 -0
- package/dist/session/mirror/MessageItem.js.map +1 -0
- package/dist/session/mirror/ReasoningRow.d.ts +11 -0
- package/dist/session/mirror/ReasoningRow.d.ts.map +1 -0
- package/dist/session/mirror/ReasoningRow.js +49 -0
- package/dist/session/mirror/ReasoningRow.js.map +1 -0
- package/dist/session/mirror/StatDialog.d.ts +20 -0
- package/dist/session/mirror/StatDialog.d.ts.map +1 -0
- package/dist/session/mirror/StatDialog.js +36 -0
- package/dist/session/mirror/StatDialog.js.map +1 -0
- package/dist/session/mirror/TurnProcessNodeView.d.ts +10 -0
- package/dist/session/mirror/TurnProcessNodeView.d.ts.map +1 -0
- package/dist/session/mirror/TurnProcessNodeView.js +68 -0
- package/dist/session/mirror/TurnProcessNodeView.js.map +1 -0
- package/dist/session/mirror/TurnTailNodeView.d.ts +32 -0
- package/dist/session/mirror/TurnTailNodeView.d.ts.map +1 -0
- package/dist/session/mirror/TurnTailNodeView.js +48 -0
- package/dist/session/mirror/TurnTailNodeView.js.map +1 -0
- package/dist/session/mirror/TurnTriggerNodeView.d.ts +14 -0
- package/dist/session/mirror/TurnTriggerNodeView.d.ts.map +1 -0
- package/dist/session/mirror/TurnTriggerNodeView.js +87 -0
- package/dist/session/mirror/TurnTriggerNodeView.js.map +1 -0
- package/dist/session/mirror/TurnUsagePanel.d.ts +21 -0
- package/dist/session/mirror/TurnUsagePanel.d.ts.map +1 -0
- package/dist/session/mirror/TurnUsagePanel.js +41 -0
- package/dist/session/mirror/TurnUsagePanel.js.map +1 -0
- package/dist/session/mirror/message-chrome.d.ts +33 -0
- package/dist/session/mirror/message-chrome.d.ts.map +1 -0
- package/dist/session/mirror/message-chrome.js +158 -0
- package/dist/session/mirror/message-chrome.js.map +1 -0
- package/dist/session/mirror/process-groups.d.ts +56 -0
- package/dist/session/mirror/process-groups.d.ts.map +1 -0
- package/dist/session/mirror/process-groups.js +202 -0
- package/dist/session/mirror/process-groups.js.map +1 -0
- package/dist/session/official-classes.d.ts +28 -0
- package/dist/session/official-classes.d.ts.map +1 -0
- package/dist/session/official-classes.js +146 -0
- package/dist/session/official-classes.js.map +1 -0
- package/dist/session/open-session-view.d.ts +17 -0
- package/dist/session/open-session-view.d.ts.map +1 -0
- package/dist/session/open-session-view.js +136 -0
- package/dist/session/open-session-view.js.map +1 -0
- package/dist/session/session-css.d.ts +1 -1
- package/dist/session/session-css.d.ts.map +1 -1
- package/dist/session/session-css.generated.d.ts +2 -0
- package/dist/session/session-css.generated.d.ts.map +1 -0
- package/dist/session/session-css.generated.js +4 -0
- package/dist/session/session-css.generated.js.map +1 -0
- package/dist/session/session-css.js +1 -17
- package/dist/session/session-css.js.map +1 -1
- package/dist/ui/AlertModal.d.ts +28 -0
- package/dist/ui/AlertModal.d.ts.map +1 -0
- package/dist/ui/AlertModal.js +29 -0
- package/dist/ui/AlertModal.js.map +1 -0
- package/dist/ui/Button.d.ts.map +1 -1
- package/dist/ui/Button.js +14 -1
- package/dist/ui/Button.js.map +1 -1
- package/dist/ui/Card.d.ts +4 -2
- package/dist/ui/Card.d.ts.map +1 -1
- package/dist/ui/Card.js +12 -6
- package/dist/ui/Card.js.map +1 -1
- package/dist/ui/Chip.d.ts +9 -1
- package/dist/ui/Chip.d.ts.map +1 -1
- package/dist/ui/Chip.js +8 -2
- package/dist/ui/Chip.js.map +1 -1
- package/dist/ui/CodeViewer.d.ts +36 -0
- package/dist/ui/CodeViewer.d.ts.map +1 -0
- package/dist/ui/CodeViewer.js +90 -0
- package/dist/ui/CodeViewer.js.map +1 -0
- package/dist/ui/ConfirmModal.d.ts +30 -0
- package/dist/ui/ConfirmModal.d.ts.map +1 -0
- package/dist/ui/ConfirmModal.js +23 -0
- package/dist/ui/ConfirmModal.js.map +1 -0
- package/dist/ui/DateTimePicker.d.ts +45 -0
- package/dist/ui/DateTimePicker.d.ts.map +1 -0
- package/dist/ui/DateTimePicker.js +447 -0
- package/dist/ui/DateTimePicker.js.map +1 -0
- package/dist/ui/Field.d.ts +11 -2
- package/dist/ui/Field.d.ts.map +1 -1
- package/dist/ui/Field.js +15 -5
- package/dist/ui/Field.js.map +1 -1
- package/dist/ui/MarqueeText.d.ts.map +1 -1
- package/dist/ui/MarqueeText.js +3 -1
- package/dist/ui/MarqueeText.js.map +1 -1
- package/dist/ui/Modal.d.ts +25 -3
- package/dist/ui/Modal.d.ts.map +1 -1
- package/dist/ui/Modal.js +41 -7
- package/dist/ui/Modal.js.map +1 -1
- package/dist/ui/ModelPicker.d.ts +25 -12
- package/dist/ui/ModelPicker.d.ts.map +1 -1
- package/dist/ui/ModelPicker.js +67 -19
- package/dist/ui/ModelPicker.js.map +1 -1
- package/dist/ui/PanelDock.d.ts +127 -0
- package/dist/ui/PanelDock.d.ts.map +1 -0
- package/dist/ui/PanelDock.js +297 -0
- package/dist/ui/PanelDock.js.map +1 -0
- package/dist/ui/Picker.d.ts +8 -2
- package/dist/ui/Picker.d.ts.map +1 -1
- package/dist/ui/Picker.js +86 -18
- package/dist/ui/Picker.js.map +1 -1
- package/dist/ui/SectionHead.d.ts +3 -3
- package/dist/ui/SectionHead.d.ts.map +1 -1
- package/dist/ui/SectionHead.js +4 -4
- package/dist/ui/SectionHead.js.map +1 -1
- package/dist/ui/Segmented.d.ts +4 -0
- package/dist/ui/Segmented.d.ts.map +1 -1
- package/dist/ui/Segmented.js +88 -31
- package/dist/ui/Segmented.js.map +1 -1
- package/dist/ui/Textarea.d.ts +2 -0
- package/dist/ui/Textarea.d.ts.map +1 -1
- package/dist/ui/Textarea.js +6 -1
- package/dist/ui/Textarea.js.map +1 -1
- package/dist/ui/Toast.d.ts +41 -8
- package/dist/ui/Toast.d.ts.map +1 -1
- package/dist/ui/Toast.js +216 -28
- package/dist/ui/Toast.js.map +1 -1
- package/dist/ui/WorkspacePicker.d.ts +15 -28
- package/dist/ui/WorkspacePicker.d.ts.map +1 -1
- package/dist/ui/WorkspacePicker.js +18 -27
- package/dist/ui/WorkspacePicker.js.map +1 -1
- package/dist/ui/card-css.d.ts +1 -1
- package/dist/ui/card-css.d.ts.map +1 -1
- package/dist/ui/card-css.generated.d.ts +2 -0
- package/dist/ui/card-css.generated.d.ts.map +1 -0
- package/dist/ui/card-css.generated.js +4 -0
- package/dist/ui/card-css.generated.js.map +1 -0
- package/dist/ui/card-css.js +1 -35
- package/dist/ui/card-css.js.map +1 -1
- package/dist/ui/chip-css.d.ts +1 -1
- package/dist/ui/chip-css.d.ts.map +1 -1
- package/dist/ui/chip-css.generated.d.ts +2 -0
- package/dist/ui/chip-css.generated.d.ts.map +1 -0
- package/dist/ui/chip-css.generated.js +4 -0
- package/dist/ui/chip-css.generated.js.map +1 -0
- package/dist/ui/chip-css.js +1 -17
- package/dist/ui/chip-css.js.map +1 -1
- package/dist/ui/code-viewer-css.d.ts +2 -0
- package/dist/ui/code-viewer-css.d.ts.map +1 -0
- package/dist/ui/code-viewer-css.generated.d.ts +2 -0
- package/dist/ui/code-viewer-css.generated.d.ts.map +1 -0
- package/dist/ui/code-viewer-css.generated.js +4 -0
- package/dist/ui/code-viewer-css.generated.js.map +1 -0
- package/dist/ui/code-viewer-css.js +3 -0
- package/dist/ui/code-viewer-css.js.map +1 -0
- package/dist/ui/code-viewer-lang.d.ts +15 -0
- package/dist/ui/code-viewer-lang.d.ts.map +1 -0
- package/dist/ui/code-viewer-lang.js +190 -0
- package/dist/ui/code-viewer-lang.js.map +1 -0
- package/dist/ui/code-viewer-theme.d.ts +5 -0
- package/dist/ui/code-viewer-theme.d.ts.map +1 -0
- package/dist/ui/code-viewer-theme.js +138 -0
- package/dist/ui/code-viewer-theme.js.map +1 -0
- package/dist/ui/controls/back-to-top-css.generated.d.ts +2 -0
- package/dist/ui/controls/back-to-top-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/back-to-top-css.generated.js +4 -0
- package/dist/ui/controls/back-to-top-css.generated.js.map +1 -0
- package/dist/ui/controls/button-css.generated.d.ts +2 -0
- package/dist/ui/controls/button-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/button-css.generated.js +4 -0
- package/dist/ui/controls/button-css.generated.js.map +1 -0
- package/dist/ui/controls/datetime-css.generated.d.ts +2 -0
- package/dist/ui/controls/datetime-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/datetime-css.generated.js +4 -0
- package/dist/ui/controls/datetime-css.generated.js.map +1 -0
- package/dist/ui/controls/field-css.generated.d.ts +2 -0
- package/dist/ui/controls/field-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/field-css.generated.js +4 -0
- package/dist/ui/controls/field-css.generated.js.map +1 -0
- package/dist/ui/controls/hint-css.generated.d.ts +2 -0
- package/dist/ui/controls/hint-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/hint-css.generated.js +4 -0
- package/dist/ui/controls/hint-css.generated.js.map +1 -0
- package/dist/ui/controls/loading-css.generated.d.ts +2 -0
- package/dist/ui/controls/loading-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/loading-css.generated.js +4 -0
- package/dist/ui/controls/loading-css.generated.js.map +1 -0
- package/dist/ui/controls/segmented-css.generated.d.ts +2 -0
- package/dist/ui/controls/segmented-css.generated.d.ts.map +1 -0
- package/dist/ui/controls/segmented-css.generated.js +4 -0
- package/dist/ui/controls/segmented-css.generated.js.map +1 -0
- package/dist/ui/controls-css.d.ts +7 -8
- package/dist/ui/controls-css.d.ts.map +1 -1
- package/dist/ui/controls-css.js +13 -11
- package/dist/ui/controls-css.js.map +1 -1
- package/dist/ui/css.d.ts +5 -0
- package/dist/ui/css.d.ts.map +1 -1
- package/dist/ui/css.js +13 -4
- package/dist/ui/css.js.map +1 -1
- package/dist/ui/datetime-logic.d.ts +100 -0
- package/dist/ui/datetime-logic.d.ts.map +1 -0
- package/dist/ui/datetime-logic.js +193 -0
- package/dist/ui/datetime-logic.js.map +1 -0
- package/dist/ui/feedback-css.d.ts +1 -1
- package/dist/ui/feedback-css.d.ts.map +1 -1
- package/dist/ui/feedback-css.generated.d.ts +2 -0
- package/dist/ui/feedback-css.generated.d.ts.map +1 -0
- package/dist/ui/feedback-css.generated.js +4 -0
- package/dist/ui/feedback-css.generated.js.map +1 -0
- package/dist/ui/feedback-css.js +1 -53
- package/dist/ui/feedback-css.js.map +1 -1
- package/dist/ui/host-data.d.ts +103 -0
- package/dist/ui/host-data.d.ts.map +1 -0
- package/dist/ui/host-data.js +106 -0
- package/dist/ui/host-data.js.map +1 -0
- package/dist/ui/host-toast.d.ts +23 -0
- package/dist/ui/host-toast.d.ts.map +1 -0
- package/dist/ui/host-toast.js +34 -0
- package/dist/ui/host-toast.js.map +1 -0
- package/dist/ui/index.d.ts +12 -6
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +10 -4
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/marquee-css.d.ts +2 -0
- package/dist/ui/marquee-css.d.ts.map +1 -0
- package/dist/ui/marquee-css.generated.d.ts +2 -0
- package/dist/ui/marquee-css.generated.d.ts.map +1 -0
- package/dist/ui/marquee-css.generated.js +4 -0
- package/dist/ui/marquee-css.generated.js.map +1 -0
- package/dist/ui/marquee-css.js +4 -0
- package/dist/ui/marquee-css.js.map +1 -0
- package/dist/ui/modal-host.d.ts +30 -0
- package/dist/ui/modal-host.d.ts.map +1 -0
- package/dist/ui/modal-host.js +101 -0
- package/dist/ui/modal-host.js.map +1 -0
- package/dist/ui/official.d.ts.map +1 -1
- package/dist/ui/official.js +45 -1
- package/dist/ui/official.js.map +1 -1
- package/dist/ui/panel-dock-css.d.ts +2 -0
- package/dist/ui/panel-dock-css.d.ts.map +1 -0
- package/dist/ui/panel-dock-css.generated.d.ts +2 -0
- package/dist/ui/panel-dock-css.generated.d.ts.map +1 -0
- package/dist/ui/panel-dock-css.generated.js +4 -0
- package/dist/ui/panel-dock-css.generated.js.map +1 -0
- package/dist/ui/panel-dock-css.js +4 -0
- package/dist/ui/panel-dock-css.js.map +1 -0
- package/dist/ui/panel-dock-logic.d.ts +50 -0
- package/dist/ui/panel-dock-logic.d.ts.map +1 -0
- package/dist/ui/panel-dock-logic.js +64 -0
- package/dist/ui/panel-dock-logic.js.map +1 -0
- package/dist/ui/picker-css.d.ts +1 -1
- package/dist/ui/picker-css.d.ts.map +1 -1
- package/dist/ui/picker-css.generated.d.ts +2 -0
- package/dist/ui/picker-css.generated.d.ts.map +1 -0
- package/dist/ui/picker-css.generated.js +4 -0
- package/dist/ui/picker-css.generated.js.map +1 -0
- package/dist/ui/picker-css.js +1 -48
- package/dist/ui/picker-css.js.map +1 -1
- package/dist/ui/picker-icons.d.ts +12 -0
- package/dist/ui/picker-icons.d.ts.map +1 -0
- package/dist/ui/picker-icons.js +29 -0
- package/dist/ui/picker-icons.js.map +1 -0
- package/dist/ui/picker-logic.d.ts +4 -1
- package/dist/ui/picker-logic.d.ts.map +1 -1
- package/dist/ui/picker-logic.js +1 -2
- package/dist/ui/picker-logic.js.map +1 -1
- package/dist/ui/resizer.d.ts +3 -1
- package/dist/ui/resizer.d.ts.map +1 -1
- package/dist/ui/resizer.js +1 -1
- package/dist/ui/resizer.js.map +1 -1
- package/dist/ui/toast-host.d.ts +24 -0
- package/dist/ui/toast-host.d.ts.map +1 -0
- package/dist/ui/toast-host.js +20 -0
- package/dist/ui/toast-host.js.map +1 -0
- package/dist/utils/date.d.ts +8 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +16 -0
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/i18n.d.ts +1 -1
- package/dist/utils/i18n.d.ts.map +1 -1
- package/dist/utils/i18n.js +437 -18
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +1 -0
- package/dist/utils/path.js.map +1 -1
- package/docs/README.md +12 -5
- package/docs/design/architecture.md +38 -8
- package/docs/design/copywriting.md +95 -0
- package/docs/design/doc-format.md +80 -0
- package/docs/design/doc-format.ts +39 -0
- package/docs/design/external/dsh-host.md +150 -1
- package/docs/design/features.md +4 -17
- package/docs/design/methods.md +13 -34
- package/docs/design/structure.md +25 -22
- package/docs/design/style.md +24 -50
- package/docs/help/design.doc.ts +112 -0
- package/docs/help/design.md +88 -0
- package/docs/help/explorer.doc.ts +136 -0
- package/docs/help/explorer.md +68 -0
- package/docs/help/index.doc.ts +79 -0
- package/docs/help/index.md +28 -0
- package/docs/help/integration.doc.ts +114 -0
- package/docs/help/integration.md +127 -0
- package/docs/help/methods.md +58 -0
- package/docs/help/session.doc.ts +154 -0
- package/docs/help/session.md +91 -0
- package/docs/help/style.md +80 -0
- package/docs/help/ui.doc.ts +404 -0
- package/docs/help/ui.md +342 -0
- package/docs/help/utils.doc.ts +133 -0
- package/docs/help/utils.md +96 -0
- package/docs/requirements.md +33 -12
- package/package.json +44 -3
- package/dist/ui/ErrorBoundary.d.ts +0 -22
- package/dist/ui/ErrorBoundary.d.ts.map +0 -1
- package/dist/ui/ErrorBoundary.js +0 -30
- package/dist/ui/ErrorBoundary.js.map +0 -1
- package/docs/design/features/design.md +0 -55
- package/docs/design/features/explorer.md +0 -73
- package/docs/design/features/session.md +0 -70
- package/docs/design/features/ui.md +0 -225
- package/docs/design/features/utils.md +0 -64
- package/docs/examples/integration.md +0 -103
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// 帮助文档索引 —— 真源(TS 数据模块)。内容全在此一处:md 投影与 demo 站都从这份派生。
|
|
2
|
+
import type { DocTopic } from '../design/doc-format.js'
|
|
3
|
+
|
|
4
|
+
const doc: DocTopic = {
|
|
5
|
+
title: { zh: '帮助索引', en: 'Help index' },
|
|
6
|
+
sections: [
|
|
7
|
+
{
|
|
8
|
+
id: 'help-index',
|
|
9
|
+
heading: { zh: '按你要做的事挑一份', en: 'Pick the one you need' },
|
|
10
|
+
prose: [
|
|
11
|
+
{
|
|
12
|
+
zh: '本索引只回答「读哪一份」。按你要做的事挑一行,跳过去读完就能写代码。',
|
|
13
|
+
en: 'This index answers one question: which document to read. Pick the row matching your task.',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
zh: '文件都在同一目录(`docs/help/`):`<主题>.md` 给人读,同名的 `.doc.ts` 是真源。改内容请改真源后重跑 `node scripts/gen-docs.mjs`,`.md` 由它生成。',
|
|
17
|
+
en: 'Everything lives in `docs/help/`: `<topic>.md` is what you read, the `<topic>.doc.ts` beside it is the source. Edit the source, then rerun `node scripts/gen-docs.mjs` — the `.md` is generated.',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
api: [
|
|
21
|
+
{
|
|
22
|
+
id: 'help-index-table',
|
|
23
|
+
rows: [
|
|
24
|
+
{
|
|
25
|
+
name: '把这个包接进我的插件',
|
|
26
|
+
type: 'integration.md',
|
|
27
|
+
def: '—',
|
|
28
|
+
desc: { zh: '装包、初始化样式、最小可用控件与工具函数、清理,一条龙示例', en: 'Install, style init, minimal working controls and helpers, teardown — end to end' },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: '用控件(按钮 / 输入 / 选择器 / 弹窗 / 右侧分栏)',
|
|
32
|
+
type: 'ui.md',
|
|
33
|
+
def: '—',
|
|
34
|
+
desc: { zh: '控件清单与全部 props;弹窗与 PanelDock 的布局约定在此', en: 'Control inventory and every prop; dialog and PanelDock layout contracts are here' },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: '建 style kit、覆盖 token、多插件同页隔离',
|
|
38
|
+
type: 'design.md',
|
|
39
|
+
def: '—',
|
|
40
|
+
desc: { zh: 'design 子包的 API:`createStyleKit` / `registerStyle` / 注入机制', en: 'The `design` subpackage API: `createStyleKit` / `registerStyle` / how injection works' },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: '处理日期、字符串、字节、HTTP',
|
|
44
|
+
type: 'utils.md',
|
|
45
|
+
def: '—',
|
|
46
|
+
desc: { zh: '纯函数清单与参数,含每个函数的失败返回值', en: 'Pure helpers and their arguments, including each one’s failure return' },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: '加工作区文件浏览与预览',
|
|
50
|
+
type: 'explorer.md',
|
|
51
|
+
def: '—',
|
|
52
|
+
desc: { zh: '右侧分栏预览与文件选择器;都要宿主提供的工作区快照', en: 'Right-dock preview and file picker; both need the host workspace snapshot' },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: '把一次会话渲染成只读预览',
|
|
56
|
+
type: 'session.md',
|
|
57
|
+
def: '—',
|
|
58
|
+
desc: { zh: '会话数据链与弹窗 props;归档会话同样可读', en: 'The session data chain and dialog props; archived sessions read fine too' },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: '查方法的统一口径(失败不抛错、兜底不编造)',
|
|
62
|
+
type: 'methods.md',
|
|
63
|
+
def: '—',
|
|
64
|
+
desc: { zh: '所有 utils 方法的共同行为约定,写调用代码前先看它', en: 'Shared behavior contract of every utils helper — read before writing call sites' },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '用 token、配色或定制皮肤',
|
|
68
|
+
type: 'style.md',
|
|
69
|
+
def: '—',
|
|
70
|
+
desc: { zh: 'token 清单、明暗判据、能改什么改到哪为止', en: 'Token inventory, dark-mode predicate, and how far customization goes' },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default doc
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- 本文件由 scripts/gen-docs.mjs 自动生成,请勿手改;改对应的 .doc.ts 后重跑 node scripts/gen-docs.mjs -->
|
|
2
|
+
|
|
3
|
+
# 帮助索引
|
|
4
|
+
|
|
5
|
+
> EN: Help index
|
|
6
|
+
|
|
7
|
+
## 按你要做的事挑一份
|
|
8
|
+
|
|
9
|
+
> EN: Pick the one you need
|
|
10
|
+
|
|
11
|
+
本索引只回答「读哪一份」。按你要做的事挑一行,跳过去读完就能写代码。
|
|
12
|
+
|
|
13
|
+
> EN: This index answers one question: which document to read. Pick the row matching your task.
|
|
14
|
+
|
|
15
|
+
文件都在同一目录(`docs/help/`):`<主题>.md` 给人读,同名的 `.doc.ts` 是真源。改内容请改真源后重跑 `node scripts/gen-docs.mjs`,`.md` 由它生成。
|
|
16
|
+
|
|
17
|
+
> EN: Everything lives in `docs/help/`: `<topic>.md` is what you read, the `<topic>.doc.ts` beside it is the source. Edit the source, then rerun `node scripts/gen-docs.mjs` — the `.md` is generated.
|
|
18
|
+
|
|
19
|
+
| 参数 | 类型 | 默认 | 说明(zh) | 说明(en) |
|
|
20
|
+
|---|---|---|---|---|
|
|
21
|
+
| `把这个包接进我的插件` | `integration.md` | — | 装包、初始化样式、最小可用控件与工具函数、清理,一条龙示例 | Install, style init, minimal working controls and helpers, teardown — end to end |
|
|
22
|
+
| `用控件(按钮 / 输入 / 选择器 / 弹窗 / 右侧分栏)` | `ui.md` | — | 控件清单与全部 props;弹窗与 PanelDock 的布局约定在此 | Control inventory and every prop; dialog and PanelDock layout contracts are here |
|
|
23
|
+
| `建 style kit、覆盖 token、多插件同页隔离` | `design.md` | — | design 子包的 API:`createStyleKit` / `registerStyle` / 注入机制 | The `design` subpackage API: `createStyleKit` / `registerStyle` / how injection works |
|
|
24
|
+
| `处理日期、字符串、字节、HTTP` | `utils.md` | — | 纯函数清单与参数,含每个函数的失败返回值 | Pure helpers and their arguments, including each one’s failure return |
|
|
25
|
+
| `加工作区文件浏览与预览` | `explorer.md` | — | 右侧分栏预览与文件选择器;都要宿主提供的工作区快照 | Right-dock preview and file picker; both need the host workspace snapshot |
|
|
26
|
+
| `把一次会话渲染成只读预览` | `session.md` | — | 会话数据链与弹窗 props;归档会话同样可读 | The session data chain and dialog props; archived sessions read fine too |
|
|
27
|
+
| `查方法的统一口径(失败不抛错、兜底不编造)` | `methods.md` | — | 所有 utils 方法的共同行为约定,写调用代码前先看它 | Shared behavior contract of every utils helper — read before writing call sites |
|
|
28
|
+
| `用 token、配色或定制皮肤` | `style.md` | — | token 清单、明暗判据、能改什么改到哪为止 | Token inventory, dark-mode predicate, and how far customization goes |
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// 样例:从零接入一个插件 —— 真源(TS 数据模块)。内容全在此一处,demo 与 md 都从这份派生。
|
|
2
|
+
import type { DocTopic } from '../design/doc-format.js'
|
|
3
|
+
|
|
4
|
+
const install = `pnpm add dsh-plugin-core`
|
|
5
|
+
const initStyle = `// 插件 client 入口
|
|
6
|
+
import { createStyleKit } from 'dsh-plugin-core/design'
|
|
7
|
+
import { ensureControls, setStyleKit } from 'dsh-plugin-core/ui'
|
|
8
|
+
|
|
9
|
+
const kit = createStyleKit({ id: 'dsh-task-reminder-ui' })
|
|
10
|
+
setStyleKit(kit)
|
|
11
|
+
ensureControls()`
|
|
12
|
+
const useControl = `import { Button, Input, Picker, showToast } from 'dsh-plugin-core/ui'
|
|
13
|
+
|
|
14
|
+
h(Input, { value: name, onChange: setName, placeholder: '任务名', error: nameError })
|
|
15
|
+
h(Button, { variant: 'primary', onClick: save }, '保存')
|
|
16
|
+
h(Picker, {
|
|
17
|
+
options: models, // [{ value, label }]
|
|
18
|
+
value: current,
|
|
19
|
+
onChange: (v) => setCurrent(v as string),
|
|
20
|
+
searchable: true,
|
|
21
|
+
clearable: true,
|
|
22
|
+
})
|
|
23
|
+
showToast('已保存', { variant: 'success' })`
|
|
24
|
+
const useUtils = `import { formatDateTime, relativeFuture, formatBytes } from 'dsh-plugin-core/utils'
|
|
25
|
+
|
|
26
|
+
formatDateTime(task.runAt, { seconds: true }) // 2026-10-18 09:30:05
|
|
27
|
+
relativeFuture(task.runAt, Date.now()) // 3 分钟后(未来时间用这个)
|
|
28
|
+
formatBytes(file.size) // 12 KB`
|
|
29
|
+
const useExplorer = `import { openFilePreview, pickWorkspaceFile } from 'dsh-plugin-core/explorer'
|
|
30
|
+
|
|
31
|
+
// 从 ctx 取出这一小块(不要传整个 ctx)
|
|
32
|
+
const workspaceFiles = ctx.remote.workspaceFiles
|
|
33
|
+
|
|
34
|
+
// 预览某文件:右侧分栏(挤窄 row 左边的主区,不是浮在上面)
|
|
35
|
+
openFilePreview({ mount: pageRowEl, workspaceFiles, sessionId, path: 'docs/requirements.md' })
|
|
36
|
+
|
|
37
|
+
// 让用户选文件:锚定按钮旁弹模态,Promise 返回 { path, isDir }(工作区相对路径)
|
|
38
|
+
const picked = await pickWorkspaceFile({ workspaceFiles, sessionId, anchor: btn, filter: { exts: ['ts'] } })`
|
|
39
|
+
const useSession = `import { openSessionView, SessionViewModal } from 'dsh-plugin-core/session'
|
|
40
|
+
|
|
41
|
+
// sessions / uiConversation 同样从 ctx 取出(懒得取就用官方 client 服务)
|
|
42
|
+
const view = openSessionView(sessions, uiConversation, sessionId, 'dsh-task-reminder')
|
|
43
|
+
if (view !== null) {
|
|
44
|
+
h(SessionViewModal, {
|
|
45
|
+
sessionId, view,
|
|
46
|
+
// 关闭必须释放 retain 引用
|
|
47
|
+
onClose: () => { view.dispose(); setOpen(false) },
|
|
48
|
+
onOpenFile: (path) => openFilePreview({ mount: pageRowEl, workspaceFiles, sessionId, path }),
|
|
49
|
+
})
|
|
50
|
+
}`
|
|
51
|
+
const cleanup = `kit.dispose() // 撤掉 <style> 标签并清空登记域(插件卸载 / HMR)`
|
|
52
|
+
|
|
53
|
+
const doc: DocTopic = {
|
|
54
|
+
title: { zh: '样例:从零接入一个插件', en: 'Example: integrate a plugin from scratch' },
|
|
55
|
+
sections: [
|
|
56
|
+
{
|
|
57
|
+
id: 'quickstart',
|
|
58
|
+
heading: { zh: '从零接入', en: 'Integrate from scratch' },
|
|
59
|
+
prose: [
|
|
60
|
+
{
|
|
61
|
+
zh: '从装包到用上各子包的完整路径,示例都是可直接粘贴的最小可用版。',
|
|
62
|
+
en: 'The full path from install to every subpackage, with copy-paste-ready minimal examples.',
|
|
63
|
+
},
|
|
64
|
+
{ zh: '§0 装包:`react` 是 optional peer,只用 `utils` / `design` 的插件不必装。', en: '§0 Install: `react` is an optional peer — plugins using only `utils`/`design` need not install it.' },
|
|
65
|
+
{
|
|
66
|
+
zh: '§1 初始化样式(入口一次):`id` 必须插件内唯一,多插件同页靠它互不覆盖;变量与类名固定 `dshpc` 前缀,不需传参。',
|
|
67
|
+
en: '§1 Initialize styles (once at entry): `id` must be unique within the plugin so co-mounted plugins don’t clobber; vars and classes use the fixed `dshpc` prefix, no parameter.',
|
|
68
|
+
},
|
|
69
|
+
{ zh: '§2 用一个控件', en: '§2 Use a control' },
|
|
70
|
+
{ zh: '§3 用通用方法', en: '§3 Use helpers' },
|
|
71
|
+
{
|
|
72
|
+
zh: '§4 接工作区浏览:`mount` 必填(预览面板是布局成员,占宽挤窄主区),传页面那层 flex 行。`sessionId` 必须属于该工作区。',
|
|
73
|
+
en: '§4 Wire workspace browsing: `mount` is required (the preview panel is a layout member that takes width); pass the page’s flex row. `sessionId` must belong to that workspace.',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
zh: '§5 接会话预览:`openSessionView` 返回 `null` 表示该会话不可解析;拿到 view 后交给 `SessionViewModal`,关闭时记得 `dispose()`。',
|
|
77
|
+
en: '§5 Wire session preview: `openSessionView` returns `null` when the session cannot be resolved; hand the view to `SessionViewModal` and remember `dispose()` on close.',
|
|
78
|
+
},
|
|
79
|
+
{ zh: '§6 卸载清理(可选)', en: '§6 Teardown (optional)' },
|
|
80
|
+
],
|
|
81
|
+
code: [
|
|
82
|
+
{ id: 'integration-install', lang: 'bash', src: install },
|
|
83
|
+
{ id: 'integration-init-style', lang: 'ts', src: initStyle },
|
|
84
|
+
{ id: 'integration-use-control', lang: 'tsx', src: useControl },
|
|
85
|
+
{ id: 'integration-use-utils', lang: 'ts', src: useUtils },
|
|
86
|
+
{ id: 'integration-use-explorer', lang: 'tsx', src: useExplorer },
|
|
87
|
+
{ id: 'integration-use-session', lang: 'tsx', src: useSession },
|
|
88
|
+
{ id: 'integration-cleanup', lang: 'ts', src: cleanup },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'reference',
|
|
93
|
+
heading: { zh: '接入坑', en: 'Pitfalls' },
|
|
94
|
+
prose: [
|
|
95
|
+
{ zh: '按踩频排序的常犯错误:', en: 'Common mistakes, ranked by frequency:' },
|
|
96
|
+
],
|
|
97
|
+
api: [
|
|
98
|
+
{
|
|
99
|
+
id: 'integration-pitfalls',
|
|
100
|
+
rows: [
|
|
101
|
+
{ name: '忘了 setStyleKit 就渲染控件', type: '现象:样式晚一帧或落到默认 style id', def: '—', desc: { zh: '入口处先调,再渲染', en: 'Call it at entry, then render' } },
|
|
102
|
+
{ name: '指望本包帮你引官方 @deepseek-ai/*', type: '现象:Node 下 ERR_MODULE_NOT_FOUND', def: '—', desc: { zh: '本包 ui 零官方依赖;要用官方件请自行处理平台模块', en: 'Our ui has zero official deps; handle platform modules yourself' } },
|
|
103
|
+
{ name: '给 read 少传第三参 range', type: "现象:远端拒:expected 3 business argument(s) … got 2", def: '—', desc: { zh: '一律显式传 {}', en: 'Always pass {} explicitly' } },
|
|
104
|
+
{ name: '用 relativePast 显示未来时间', type: '现象:「3 分钟后」显示成「刚刚」', def: '—', desc: { zh: '用 relativeFuture', en: 'Use relativeFuture' } },
|
|
105
|
+
{ name: '想让组件自己取工作区 / 模型列表', type: '现象:取不到(通道是插件私有的)', def: '—', desc: { zh: '数据经 props 给,宿主能力经接口注入', en: 'Data via props, host capability via injected interface' } },
|
|
106
|
+
{ name: '暗色不跟随宿主', type: '现象:插件固守一种明暗', def: '—', desc: { zh: '判据是 body[data-ds-dark-theme],别用 prefers-color-scheme', en: 'Predicate is body[data-ds-dark-theme], not prefers-color-scheme' } },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default doc
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!-- 本文件由 scripts/gen-docs.mjs 自动生成,请勿手改;改对应的 .doc.ts 后重跑 node scripts/gen-docs.mjs -->
|
|
2
|
+
|
|
3
|
+
# 样例:从零接入一个插件
|
|
4
|
+
|
|
5
|
+
> EN: Example: integrate a plugin from scratch
|
|
6
|
+
|
|
7
|
+
## 从零接入
|
|
8
|
+
|
|
9
|
+
> EN: Integrate from scratch
|
|
10
|
+
|
|
11
|
+
从装包到用上各子包的完整路径,示例都是可直接粘贴的最小可用版。
|
|
12
|
+
|
|
13
|
+
> EN: The full path from install to every subpackage, with copy-paste-ready minimal examples.
|
|
14
|
+
|
|
15
|
+
§0 装包:`react` 是 optional peer,只用 `utils` / `design` 的插件不必装。
|
|
16
|
+
|
|
17
|
+
> EN: §0 Install: `react` is an optional peer — plugins using only `utils`/`design` need not install it.
|
|
18
|
+
|
|
19
|
+
§1 初始化样式(入口一次):`id` 必须插件内唯一,多插件同页靠它互不覆盖;变量与类名固定 `dshpc` 前缀,不需传参。
|
|
20
|
+
|
|
21
|
+
> EN: §1 Initialize styles (once at entry): `id` must be unique within the plugin so co-mounted plugins don’t clobber; vars and classes use the fixed `dshpc` prefix, no parameter.
|
|
22
|
+
|
|
23
|
+
§2 用一个控件
|
|
24
|
+
|
|
25
|
+
> EN: §2 Use a control
|
|
26
|
+
|
|
27
|
+
§3 用通用方法
|
|
28
|
+
|
|
29
|
+
> EN: §3 Use helpers
|
|
30
|
+
|
|
31
|
+
§4 接工作区浏览:`mount` 必填(预览面板是布局成员,占宽挤窄主区),传页面那层 flex 行。`sessionId` 必须属于该工作区。
|
|
32
|
+
|
|
33
|
+
> EN: §4 Wire workspace browsing: `mount` is required (the preview panel is a layout member that takes width); pass the page’s flex row. `sessionId` must belong to that workspace.
|
|
34
|
+
|
|
35
|
+
§5 接会话预览:`openSessionView` 返回 `null` 表示该会话不可解析;拿到 view 后交给 `SessionViewModal`,关闭时记得 `dispose()`。
|
|
36
|
+
|
|
37
|
+
> EN: §5 Wire session preview: `openSessionView` returns `null` when the session cannot be resolved; hand the view to `SessionViewModal` and remember `dispose()` on close.
|
|
38
|
+
|
|
39
|
+
§6 卸载清理(可选)
|
|
40
|
+
|
|
41
|
+
> EN: §6 Teardown (optional)
|
|
42
|
+
|
|
43
|
+
```bash id="integration-install"
|
|
44
|
+
pnpm add dsh-plugin-core
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts id="integration-init-style"
|
|
48
|
+
// 插件 client 入口
|
|
49
|
+
import { createStyleKit } from 'dsh-plugin-core/design'
|
|
50
|
+
import { ensureControls, setStyleKit } from 'dsh-plugin-core/ui'
|
|
51
|
+
|
|
52
|
+
const kit = createStyleKit({ id: 'dsh-task-reminder-ui' })
|
|
53
|
+
setStyleKit(kit)
|
|
54
|
+
ensureControls()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```tsx id="integration-use-control"
|
|
58
|
+
import { Button, Input, Picker, showToast } from 'dsh-plugin-core/ui'
|
|
59
|
+
|
|
60
|
+
h(Input, { value: name, onChange: setName, placeholder: '任务名', error: nameError })
|
|
61
|
+
h(Button, { variant: 'primary', onClick: save }, '保存')
|
|
62
|
+
h(Picker, {
|
|
63
|
+
options: models, // [{ value, label }]
|
|
64
|
+
value: current,
|
|
65
|
+
onChange: (v) => setCurrent(v as string),
|
|
66
|
+
searchable: true,
|
|
67
|
+
clearable: true,
|
|
68
|
+
})
|
|
69
|
+
showToast('已保存', { variant: 'success' })
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```ts id="integration-use-utils"
|
|
73
|
+
import { formatDateTime, relativeFuture, formatBytes } from 'dsh-plugin-core/utils'
|
|
74
|
+
|
|
75
|
+
formatDateTime(task.runAt, { seconds: true }) // 2026-10-18 09:30:05
|
|
76
|
+
relativeFuture(task.runAt, Date.now()) // 3 分钟后(未来时间用这个)
|
|
77
|
+
formatBytes(file.size) // 12 KB
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```tsx id="integration-use-explorer"
|
|
81
|
+
import { openFilePreview, pickWorkspaceFile } from 'dsh-plugin-core/explorer'
|
|
82
|
+
|
|
83
|
+
// 从 ctx 取出这一小块(不要传整个 ctx)
|
|
84
|
+
const workspaceFiles = ctx.remote.workspaceFiles
|
|
85
|
+
|
|
86
|
+
// 预览某文件:右侧分栏(挤窄 row 左边的主区,不是浮在上面)
|
|
87
|
+
openFilePreview({ mount: pageRowEl, workspaceFiles, sessionId, path: 'docs/requirements.md' })
|
|
88
|
+
|
|
89
|
+
// 让用户选文件:锚定按钮旁弹模态,Promise 返回 { path, isDir }(工作区相对路径)
|
|
90
|
+
const picked = await pickWorkspaceFile({ workspaceFiles, sessionId, anchor: btn, filter: { exts: ['ts'] } })
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```tsx id="integration-use-session"
|
|
94
|
+
import { openSessionView, SessionViewModal } from 'dsh-plugin-core/session'
|
|
95
|
+
|
|
96
|
+
// sessions / uiConversation 同样从 ctx 取出(懒得取就用官方 client 服务)
|
|
97
|
+
const view = openSessionView(sessions, uiConversation, sessionId, 'dsh-task-reminder')
|
|
98
|
+
if (view !== null) {
|
|
99
|
+
h(SessionViewModal, {
|
|
100
|
+
sessionId, view,
|
|
101
|
+
// 关闭必须释放 retain 引用
|
|
102
|
+
onClose: () => { view.dispose(); setOpen(false) },
|
|
103
|
+
onOpenFile: (path) => openFilePreview({ mount: pageRowEl, workspaceFiles, sessionId, path }),
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ts id="integration-cleanup"
|
|
109
|
+
kit.dispose() // 撤掉 <style> 标签并清空登记域(插件卸载 / HMR)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 接入坑
|
|
113
|
+
|
|
114
|
+
> EN: Pitfalls
|
|
115
|
+
|
|
116
|
+
按踩频排序的常犯错误:
|
|
117
|
+
|
|
118
|
+
> EN: Common mistakes, ranked by frequency:
|
|
119
|
+
|
|
120
|
+
| 参数 | 类型 | 默认 | 说明(zh) | 说明(en) |
|
|
121
|
+
|---|---|---|---|---|
|
|
122
|
+
| `忘了 setStyleKit 就渲染控件` | `现象:样式晚一帧或落到默认 style id` | — | 入口处先调,再渲染 | Call it at entry, then render |
|
|
123
|
+
| `指望本包帮你引官方 @deepseek-ai/*` | `现象:Node 下 ERR_MODULE_NOT_FOUND` | — | 本包 ui 零官方依赖;要用官方件请自行处理平台模块 | Our ui has zero official deps; handle platform modules yourself |
|
|
124
|
+
| `给 read 少传第三参 range` | `现象:远端拒:expected 3 business argument(s) … got 2` | — | 一律显式传 {} | Always pass {} explicitly |
|
|
125
|
+
| `用 relativePast 显示未来时间` | `现象:「3 分钟后」显示成「刚刚」` | — | 用 relativeFuture | Use relativeFuture |
|
|
126
|
+
| `想让组件自己取工作区 / 模型列表` | `现象:取不到(通道是插件私有的)` | — | 数据经 props 给,宿主能力经接口注入 | Data via props, host capability via injected interface |
|
|
127
|
+
| `暗色不跟随宿主` | `现象:插件固守一种明暗` | — | 判据是 body[data-ds-dark-theme],别用 prefers-color-scheme | Predicate is body[data-ds-dark-theme], not prefers-color-scheme |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# 方法规范(`utils`)
|
|
2
|
+
|
|
3
|
+
> EN: Helper conventions (`utils`)
|
|
4
|
+
|
|
5
|
+
`utils` 的口径:**解析失败不抛错、给兜底、不编造**。每个方法都按这一页的口径行事,
|
|
6
|
+
你可以据此预期它们的返回值。
|
|
7
|
+
EN: Every helper behaves as follows: **never throws on bad input, returns a fallback, never invents data**.
|
|
8
|
+
Rely on these guarantees when calling them.
|
|
9
|
+
|
|
10
|
+
## 总口径
|
|
11
|
+
|
|
12
|
+
> EN: Core contract
|
|
13
|
+
|
|
14
|
+
| 情形 | 统一行为 |
|
|
15
|
+
|---|---|
|
|
16
|
+
| 输入解析失败(日期 / 数字) | **不抛错**,返回兜底;兜底可传则传,不可传用固定占位 |
|
|
17
|
+
| 固定占位 | 日期类 `—`,时刻类 `-`,体积类 `—`;可用 `opts.fallback` 覆盖 |
|
|
18
|
+
| 空值(`null` / `undefined` / 空串) | 与解析失败同口径,不特殊崩 |
|
|
19
|
+
| 边界值(0 / 负数 / NaN) | 明确处理,不静默通过 |
|
|
20
|
+
| 时区 | 一律**本机时区**;要显式时区请在调用方转换后再传 |
|
|
21
|
+
|
|
22
|
+
EN: Parse failure → no throw, fallback instead; placeholders `—` / `-`, overridable via `opts.fallback`;
|
|
23
|
+
null/undefined/empty treated like parse failure; edge values handled explicitly; always local timezone.
|
|
24
|
+
|
|
25
|
+
## 为什么解析失败不抛错
|
|
26
|
+
|
|
27
|
+
> EN: Why no throw on bad input
|
|
28
|
+
|
|
29
|
+
这些方法大量用在渲染路径上(列表每一行都调)。一个坏数据让整页崩,不如显示一个占位符。
|
|
30
|
+
**但兜底不编造**:不知道就不显示,绝不猜一个时间。
|
|
31
|
+
EN: These run in render paths, so one bad row should not take the page down. **The fallback never invents data**:
|
|
32
|
+
if the value is unknown it stays blank, never a guessed time.
|
|
33
|
+
|
|
34
|
+
## 分模块口径
|
|
35
|
+
|
|
36
|
+
> EN: Per-module behavior
|
|
37
|
+
|
|
38
|
+
- **日期**:每个函数的失败返回值都列在它自己的参数表里。
|
|
39
|
+
`relativePast` / `relativeFuture` 是对偶的,别用错。
|
|
40
|
+
- **字符串**:`truncateBytes` 按 **UTF-8 字节**截断,不切半个字(中文场景必须)。
|
|
41
|
+
`baseNameOf` 处理目录尾斜杠,不会取成空串。
|
|
42
|
+
- **数字**:`formatBytes` 对 0 与负数返回 `—`,不显示「0 B」这种假精确。
|
|
43
|
+
- **HTTP**:默认 10s 超时;超时抛 `AbortError`,非 2xx 抛带 `status` 的 `HttpError`。
|
|
44
|
+
|
|
45
|
+
EN: Dates: each function’s failure return is listed in its own parameter table; `relativePast`/`relativeFuture`
|
|
46
|
+
are duals. Strings: `truncateBytes` cuts by UTF-8 bytes. Numbers: `formatBytes` returns `—` for 0 and
|
|
47
|
+
negatives. HTTP: 10s timeout, `AbortError` on timeout, `HttpError` with `status` on non-2xx.
|
|
48
|
+
|
|
49
|
+
## 多语言口径
|
|
50
|
+
|
|
51
|
+
> EN: Localization
|
|
52
|
+
|
|
53
|
+
- 本包自带的固定提示语:**内置中英**,`setLocale` 切换。
|
|
54
|
+
- 需要文案的 API 一律可传 `translate: Translate` 覆盖;不传走内置。
|
|
55
|
+
- 插件自己界面的文案由插件自管——本包不提供插件级 i18n 框架。
|
|
56
|
+
|
|
57
|
+
EN: Built-in prompts ship with zh/en (`setLocale` to switch); any API that renders text takes
|
|
58
|
+
`translate: Translate` to override; your plugin’s own UI copy is yours to manage.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// session 子包的使用帮助 —— 真源(TS 数据模块)。内容全在此一处,demo 与 md 都从这份派生。
|
|
2
|
+
import type { DocTopic } from '../design/doc-format.js'
|
|
3
|
+
|
|
4
|
+
const usage = `import { openSessionView, SessionViewModal } from 'dsh-plugin-core/session'
|
|
5
|
+
|
|
6
|
+
// 宿主服务由调用方注入:sessions ← dsh-api-session-controller、
|
|
7
|
+
// uiConversation ← dsh-client-ui-conversation
|
|
8
|
+
const view = openSessionView(sessions, uiConversation, sessionId, 'dsh-task-reminder')
|
|
9
|
+
if (view !== null) {
|
|
10
|
+
h(SessionViewModal, {
|
|
11
|
+
sessionId,
|
|
12
|
+
view,
|
|
13
|
+
heading: '镜像升级日报', // 标题,缺省「会话预览」
|
|
14
|
+
onClose: () => { view.dispose(); setOpen(false) }, // 关闭必须 dispose
|
|
15
|
+
// 续聊(可选):fork 开分支 → 跳官方会话区;两者缺一即不渲染该入口
|
|
16
|
+
forkSession: (id, atSeq) => sessions.fork({ sessionId: id, increaseTitle: true, atSeq }),
|
|
17
|
+
openHostSession: (id) => uiWorkspace.openSession(id),
|
|
18
|
+
// 暂存输入框(可选):由调用方 fork + 发首轮 + 跳转
|
|
19
|
+
onContinue: async (message) => {
|
|
20
|
+
const child = await forkSession(sessionId)
|
|
21
|
+
await hostContinue(child, message)
|
|
22
|
+
openHostSession(child)
|
|
23
|
+
},
|
|
24
|
+
onOpenFile: (path) => openFilePreview(path), // 文件打开出口
|
|
25
|
+
archived, // 是否已归档
|
|
26
|
+
t, // 可选,覆盖文案
|
|
27
|
+
})
|
|
28
|
+
}`
|
|
29
|
+
|
|
30
|
+
const dataChain = `// 数据链(越往上越早):
|
|
31
|
+
// sessions.retain(id, { source }) 物化 scope
|
|
32
|
+
// → sessions.binding(id) 取绑定
|
|
33
|
+
// → session.open() 幂等拉历史尾页
|
|
34
|
+
// → uiConversation.binding(binding).target('chat')
|
|
35
|
+
// 拿 ChatSnapshot:order + nodes(keyed 流)
|
|
36
|
+
// 用完必须 view.dispose(),否则会话 scope 不回收。`
|
|
37
|
+
|
|
38
|
+
const doc: DocTopic = {
|
|
39
|
+
title: { zh: 'session —— 会话预览', en: 'session — session preview' },
|
|
40
|
+
exports: ['SessionViewModal', 'openSessionView'],
|
|
41
|
+
sections: [
|
|
42
|
+
{
|
|
43
|
+
id: 'session',
|
|
44
|
+
heading: { zh: '会话预览', en: 'Session preview' },
|
|
45
|
+
prose: [
|
|
46
|
+
{
|
|
47
|
+
zh: '把一次会话渲染成**只读弹窗**,观感与官方会话页一致。先用 `openSessionView` 建数据链得到 `view`(不可解析返回 `null`),再交给 `SessionViewModal`;**关闭时必须 `view.dispose()`**。',
|
|
48
|
+
en: 'Renders one session as a **read-only dialog** that looks like the official session page. First `openSessionView` builds the chain and returns a `view` (`null` when unresolvable), then hand it to `SessionViewModal`; **call `view.dispose()` on close**.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
zh: '数据全由调用方注入,组件不自己取。`archived` 从官方 `workspaces` 快照的 `archivedSessionIds` 读取并订阅刷新。归档会话走同一条链,同样可读。',
|
|
52
|
+
en: 'All data is injected by the caller; the component fetches nothing. Read `archived` from `archivedSessionIds` on the official `workspaces` snapshot and keep it subscribed. Archived sessions travel the same chain and read fine.',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
zh: '快照只读,框内不能打字续聊。续聊 = `forkSession` 开分支 + `openHostSession` 跳官方会话区;暂存输入框的确定走 `onContinue`(fork + 发首轮 + 跳转)。',
|
|
56
|
+
en: 'The snapshot is read-only, so you cannot type inside the dialog. Continuing means `forkSession` + `openHostSession`; the staging input’s confirm goes through `onContinue` (fork + first turn + navigate).',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
zh: '文件出口只有一个:工具卡路径、行内引用、交付卡都走 `onOpenFile`;不传则链接降级为纯文本。预览由调用方开在**页面右侧**(`openFilePreview` 的 dock),弹窗不需要任何遮罩参数。',
|
|
60
|
+
en: 'There is exactly one file exit: tool-card paths, inline mentions and delivered cards all go through `onOpenFile`; without it links degrade to plain text. The caller opens the preview as a **page-level right column** (the `openFilePreview` dock) — the dialog takes no mask props.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
zh: '限制:官方样式未注入时回退自绘观感(功能不受影响);长会话一次全渲染,用「加载更早记录」向前翻页;👍👎 反馈走官方 slots,弹窗没有该插槽。',
|
|
64
|
+
en: 'Limits: without official styles injected, the self-drawn look applies (functionality unaffected); long sessions render whole, paged backward via "load earlier"; 👍👎 feedback goes through official slots, which this dialog lacks.',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
api: [
|
|
68
|
+
{
|
|
69
|
+
id: 'session-view-target',
|
|
70
|
+
rows: [
|
|
71
|
+
{
|
|
72
|
+
name: 'openSessionView',
|
|
73
|
+
type: '(sessions, uiConversation, id, retainSource?) => SessionViewTarget | null',
|
|
74
|
+
def: '—',
|
|
75
|
+
required: '是',
|
|
76
|
+
desc: { zh: '建数据链:retain → binding → open → target(chat);不可解析返回 null', en: 'Builds the chain retain → binding → open → target(chat); null when unresolvable' },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'target',
|
|
80
|
+
type: 'SnapshotFace<ChatViewFace | undefined>',
|
|
81
|
+
def: '—',
|
|
82
|
+
desc: { zh: 'chat 快照订阅面(供 useSyncExternalStore)', en: 'Chat snapshot surface (for useSyncExternalStore)' },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'session',
|
|
86
|
+
type: 'SnapshotFace<SessionSnapshotFace>',
|
|
87
|
+
def: '—',
|
|
88
|
+
desc: { zh: '会话自身快照(加载态 / 是否翻尽)', en: 'Snapshot of the session itself (loading state, paged-out)' },
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'loadOlder',
|
|
92
|
+
type: '() => void',
|
|
93
|
+
def: '—',
|
|
94
|
+
desc: { zh: '向前翻一页更早的历史', en: 'Page backward through older history' },
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'dispose',
|
|
98
|
+
type: '() => void',
|
|
99
|
+
def: '—',
|
|
100
|
+
desc: { zh: '释放 retain 引用;弹窗关闭必调', en: 'Release the retain reference; call on close' },
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'session-view-modal',
|
|
106
|
+
rows: [
|
|
107
|
+
{ name: 'sessionId', type: 'string', def: '—', required: '是', desc: { zh: '要预览的会话', en: 'The session to preview' } },
|
|
108
|
+
{ name: 'view', type: 'SessionViewTarget', def: '—', required: '是', desc: { zh: 'openSessionView 的返回值', en: 'What openSessionView returned' } },
|
|
109
|
+
{ name: 'onClose', type: '() => void', def: '—', required: '是', desc: { zh: '关闭回调;由调用方在里面调 view.dispose()', en: 'Close callback; the caller calls view.dispose() inside it' } },
|
|
110
|
+
{ name: 'heading', type: 'string', def: '「会话预览」', required: '否', desc: { zh: '弹窗标题,通常传宿主 sessions.list 的 displayTitle;会话 id 显示在标题下方副标题行(等宽小字)', en: 'Dialog title, usually the displayTitle from the host sessions.list; the session id sits on the monospace subtitle line below it' } },
|
|
111
|
+
{ name: 'archived', type: 'boolean', def: 'false', required: '否', desc: { zh: '已归档时标题旁显示归档徽标,且「继续对话」先弹 fork 确认框;未归档则直跳官方会话页', en: 'When true an archive badge appears beside the title and "Continue" asks to fork first; when false it jumps straight to the official session page' } },
|
|
112
|
+
{
|
|
113
|
+
name: 'forkSession',
|
|
114
|
+
type: '(sessionId, atSeq?) => Promise<string>',
|
|
115
|
+
def: '—',
|
|
116
|
+
desc: { zh: '开分支并返回子会话 id;缺 openHostSession 则不渲染「继续对话」', en: 'Fork and resolve the child session id; without openHostSession "Continue" does not render' },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'openHostSession',
|
|
120
|
+
type: '(sessionId: string) => void',
|
|
121
|
+
def: '—',
|
|
122
|
+
desc: { zh: '跳官方会话区(uiWorkspace.openSession)', en: 'Jump into the official session area (uiWorkspace.openSession)' },
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'onContinue',
|
|
126
|
+
type: '(message: string) => Promise<void>',
|
|
127
|
+
def: '—',
|
|
128
|
+
desc: { zh: '暂存输入框的确定:调用方完成 fork + 发首轮 + 跳转;缺省 = 不渲染输入框', en: 'Staging input confirm: caller forks, sends the first turn, navigates; absent = no input rendered' },
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'onOpenFile',
|
|
132
|
+
type: '(path: string, sessionId: string) => void',
|
|
133
|
+
def: '—',
|
|
134
|
+
desc: { zh: '文件打开出口(工具卡 fileLink / 行内引用 / 交付卡共用);第二参是文件所属会话 id,别拿别的会话去定位;缺省 = 链接纯文本', en: 'File-open exit shared by fileLinks, mentions and delivered cards; the second arg is the owning session id — locate the file there, not elsewhere; absent = plain text' },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'onOpenReview',
|
|
138
|
+
type: '(locator: ChangedFileReviewLocator) => void',
|
|
139
|
+
def: '—',
|
|
140
|
+
desc: { zh: '变更文件的审阅出口(等价官方 openReview);缺省 = 变更卡整张不可点', en: 'Review exit for changed files (equals official openReview); absent = the change card is not clickable' },
|
|
141
|
+
},
|
|
142
|
+
{ name: 't', type: 'Translate', def: '内置', desc: { zh: '覆盖文案(内置字典已含全部会话文案,中英)', en: 'Override copy (the built-in dictionary has all session copy, zh+en)' } },
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
code: [
|
|
147
|
+
{ id: 'session-usage', lang: 'tsx', src: usage },
|
|
148
|
+
{ id: 'session-data-chain', lang: 'ts', src: dataChain },
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default doc
|