@deepseek-harness-tui/dsh-tui 0.9.0 → 0.9.2
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/README.md +69 -256
- package/bin/dsh-tui.js +172 -5
- package/cordis.patch.yml +16 -4
- package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -13
- package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -59
- package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -15
- package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -32
- package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -59
- package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -166
- package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -42
- package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -143
- package/dsh-ecosystem-spec/registry/README.md +14 -14
- package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -56
- package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -13
- package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -149
- package/lib/types/cc/hyperlink.d.ts +7 -1
- package/lib/types/cc/hyperlink.d.ts.map +1 -1
- package/lib/types/cc/hyperlink.js +3 -2
- package/lib/types/cc/markdown.d.ts.map +1 -1
- package/lib/types/cc/markdown.js +33 -3
- package/lib/types/cc/sessionColors.d.ts +27 -0
- package/lib/types/cc/sessionColors.d.ts.map +1 -0
- package/lib/types/cc/sessionColors.js +39 -0
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +6 -0
- package/lib/types/components/AutoRecapRow.d.ts +23 -0
- package/lib/types/components/AutoRecapRow.d.ts.map +1 -0
- package/lib/types/components/AutoRecapRow.js +23 -0
- package/lib/types/components/ColorPicker.d.ts +17 -0
- package/lib/types/components/ColorPicker.d.ts.map +1 -0
- package/lib/types/components/ColorPicker.js +20 -0
- package/lib/types/components/CommandSuggestions.d.ts +3 -1
- package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
- package/lib/types/components/ContextBarView.d.ts +33 -0
- package/lib/types/components/ContextBarView.d.ts.map +1 -0
- package/lib/types/components/ContextBarView.js +46 -0
- package/lib/types/components/EffortInputBorder.d.ts +12 -1
- package/lib/types/components/EffortInputBorder.d.ts.map +1 -1
- package/lib/types/components/EffortInputBorder.js +22 -5
- package/lib/types/components/FileActionsPanel.d.ts +22 -0
- package/lib/types/components/FileActionsPanel.d.ts.map +1 -0
- package/lib/types/components/FileActionsPanel.js +28 -0
- package/lib/types/components/FileSuggestions.d.ts +3 -1
- package/lib/types/components/FileSuggestions.d.ts.map +1 -1
- package/lib/types/components/MessageList.d.ts +3 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +13 -6
- package/lib/types/components/ModelPicker.d.ts +26 -4
- package/lib/types/components/ModelPicker.d.ts.map +1 -1
- package/lib/types/components/ModelPicker.js +26 -6
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +365 -57
- package/lib/types/components/RecapPanel.d.ts +25 -0
- package/lib/types/components/RecapPanel.d.ts.map +1 -0
- package/lib/types/components/RecapPanel.js +55 -0
- package/lib/types/components/ScrollbarGutter.d.ts.map +1 -1
- package/lib/types/components/ScrollbarGutter.js +55 -4
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +6 -4
- package/lib/types/components/SuggestionCard.d.ts +4 -2
- package/lib/types/components/SuggestionCard.d.ts.map +1 -1
- package/lib/types/components/TimelineRail.d.ts.map +1 -1
- package/lib/types/components/TimelineRail.js +9 -2
- package/lib/types/components/design-system/ThemeProvider.d.ts +7 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
- package/lib/types/components/design-system/ThemeProvider.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +8 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +36 -8
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +7 -3
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +41 -9
- package/lib/types/dsh-adapter/channel.d.ts +101 -2
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +969 -93
- package/lib/types/dsh-adapter/compat/index.d.ts +8 -6
- package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/index.js +8 -6
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +150 -0
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +518 -41
- package/lib/types/dsh-adapter/contract.d.ts +1 -1
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +1 -0
- package/lib/types/dsh-adapter/extension-events.d.ts +1 -1
- package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.d.ts +10 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +317 -8
- package/lib/types/dsh-adapter/presets.d.ts +18 -0
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +31 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts +29 -1
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +89 -5
- package/lib/types/dsh-adapter/questions.d.ts +19 -2
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +53 -10
- package/lib/types/dsh-adapter/recap.d.ts +49 -0
- package/lib/types/dsh-adapter/recap.d.ts.map +1 -0
- package/lib/types/dsh-adapter/recap.js +121 -0
- package/lib/types/dsh-adapter/sessionTree.d.ts +314 -0
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sessionTree.js +954 -0
- package/lib/types/dsh-adapter/shortcuts.d.ts +15 -44
- package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -1
- package/lib/types/dsh-adapter/shortcuts.js +28 -165
- package/lib/types/dsh-adapter/types.d.ts +1 -1
- package/lib/types/dsh-adapter/types.d.ts.map +1 -1
- package/lib/types/herdr.js +1 -1
- package/lib/types/i18n.d.ts +604 -176
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +206 -72
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +21 -0
- package/lib/types/migrationPrefs.d.ts +60 -0
- package/lib/types/migrationPrefs.d.ts.map +1 -0
- package/lib/types/migrationPrefs.js +97 -0
- package/lib/types/modelGroups.d.ts +72 -0
- package/lib/types/modelGroups.d.ts.map +1 -0
- package/lib/types/modelGroups.js +97 -0
- package/lib/types/modelRecents.d.ts +39 -0
- package/lib/types/modelRecents.d.ts.map +1 -0
- package/lib/types/modelRecents.js +97 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts +11 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -1
- package/lib/types/native-ts/yoga-layout/index.js +31 -1
- package/lib/types/oauth.d.ts +15 -0
- package/lib/types/oauth.d.ts.map +1 -0
- package/lib/types/oauth.js +14 -0
- package/lib/types/plugin-spec/registry.d.ts +1 -1
- package/lib/types/plugin-spec/registry.js +1 -1
- package/lib/types/reload.d.ts +109 -0
- package/lib/types/reload.d.ts.map +1 -0
- package/lib/types/reload.js +118 -0
- package/lib/types/screens/Chat.d.ts +3 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +588 -64
- package/lib/types/screens/SessionTree.d.ts +27 -0
- package/lib/types/screens/SessionTree.d.ts.map +1 -0
- package/lib/types/screens/SessionTree.js +555 -0
- package/lib/types/screens/StatusLine.d.ts +0 -9
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +215 -52
- package/lib/types/screens/StatusMetrics.d.ts +35 -3
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +63 -8
- package/lib/types/screens/chatOverlay.d.ts +17 -1
- package/lib/types/screens/chatOverlay.d.ts.map +1 -1
- package/lib/types/screens/chatOverlay.js +3 -1
- package/lib/types/tips.d.ts.map +1 -1
- package/lib/types/tips.js +22 -4
- package/lib/types/update.d.ts +159 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +496 -30
- package/lib/types/utils/debug.d.ts +1 -1
- package/lib/types/utils/debug.js +3 -3
- package/lib/types/utils/fileTarget.d.ts +46 -0
- package/lib/types/utils/fileTarget.d.ts.map +1 -0
- package/lib/types/utils/fileTarget.js +178 -0
- package/lib/types/utils/keymap.d.ts +134 -0
- package/lib/types/utils/keymap.d.ts.map +1 -0
- package/lib/types/utils/keymap.js +311 -0
- package/lib/types/utils/mentions.d.ts +25 -2
- package/lib/types/utils/mentions.d.ts.map +1 -1
- package/lib/types/utils/mentions.js +69 -10
- package/lib/types/utils/openExternal.d.ts +50 -0
- package/lib/types/utils/openExternal.d.ts.map +1 -0
- package/lib/types/utils/openExternal.js +170 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +21 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/README.md +140 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/cordis.patch.yml +11 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +44 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.d.ts +14 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.js +67 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.d.ts +64 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.js +170 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.d.ts +79 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.js +196 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.d.ts +68 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.js +193 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.d.ts +32 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.js +101 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.d.ts +31 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.js +68 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.d.ts +69 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.js +129 -0
- package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +70 -0
- package/node_modules/@dsh-std/command/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/command/LICENSE +21 -21
- package/node_modules/@dsh-std/command/README.md +26 -26
- package/node_modules/@dsh-std/command/README.zh.md +28 -28
- package/node_modules/@dsh-std/command/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/command/package.json +22 -22
- package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/node_modules/@dsh-std/connection/README.md +42 -42
- package/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/node_modules/@dsh-std/connection/package.json +20 -20
- package/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/core/LICENSE +21 -21
- package/node_modules/@dsh-std/core/README.md +13 -13
- package/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/core/package.json +21 -21
- package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
- package/node_modules/@dsh-std/manifest/LICENSE +21 -21
- package/node_modules/@dsh-std/manifest/README.md +5 -5
- package/node_modules/@dsh-std/manifest/README.zh.md +5 -5
- package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/manifest/package.json +20 -20
- package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
- package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/messages/LICENSE +21 -21
- package/node_modules/@dsh-std/messages/README.md +5 -5
- package/node_modules/@dsh-std/messages/README.zh.md +7 -7
- package/node_modules/@dsh-std/messages/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/messages/package.json +20 -20
- package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -54
- package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
- package/node_modules/@dsh-std/presentation/LICENSE +21 -21
- package/node_modules/@dsh-std/presentation/README.md +27 -27
- package/node_modules/@dsh-std/presentation/README.zh.md +29 -29
- package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
- package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/presentation/package.json +25 -25
- package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/storage/LICENSE +21 -21
- package/node_modules/@dsh-std/storage/README.md +5 -5
- package/node_modules/@dsh-std/storage/README.zh.md +7 -7
- package/node_modules/@dsh-std/storage/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/storage/package.json +20 -20
- package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -56
- package/package.json +17 -5
- package/presets/liangshen/.dsh-tui-managed.json +1 -1
- package/presets/liangshen/instruction-hint.mjs +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -42
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -20
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -5
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -5
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -20
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -27
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -29
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -25
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -42
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -20
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -21
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@dsh-std/manifest",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
|
|
10
|
-
"./schema/dsh-plugin-0.15.schema.json": "./schema/dsh-plugin-0.15.schema.json"
|
|
11
|
-
},
|
|
12
|
-
"files": ["lib", "schema", "CHANGELOG.md"],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "pnpm run typecheck && tsdown",
|
|
15
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
|
-
"test": "vitest run"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": { "@dsh-std/core": "workspace:*" },
|
|
19
|
-
"engines": { "node": "^22.19 || >=24" }
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-std/manifest",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
|
|
10
|
+
"./schema/dsh-plugin-0.15.schema.json": "./schema/dsh-plugin-0.15.schema.json"
|
|
11
|
+
},
|
|
12
|
+
"files": ["lib", "schema", "CHANGELOG.md"],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "pnpm run typecheck && tsdown",
|
|
15
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
|
+
"test": "vitest run"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": { "@dsh-std/core": "workspace:*" },
|
|
19
|
+
"engines": { "node": "^22.19 || >=24" }
|
|
20
|
+
}
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "DSH Plugin Manifest Community Draft v0.15",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": ["$schema", "manifestVersion", "id", "name", "version", "facets", "requires", "permissions", "contributes", "subscriptions"],
|
|
7
|
-
"properties": {
|
|
8
|
-
"$schema": { "type": "string", "format": "uri" },
|
|
9
|
-
"manifestVersion": { "const": "0.15" },
|
|
10
|
-
"id": { "$ref": "#/$defs/namespacedId" },
|
|
11
|
-
"name": { "type": "string", "minLength": 1 },
|
|
12
|
-
"version": { "type": "string", "minLength": 1 },
|
|
13
|
-
"facets": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"required": ["host"],
|
|
17
|
-
"properties": {
|
|
18
|
-
"host": {
|
|
19
|
-
"type": "object",
|
|
20
|
-
"additionalProperties": false,
|
|
21
|
-
"required": ["entry", "apiVersion"],
|
|
22
|
-
"properties": {
|
|
23
|
-
"entry": { "type": "string", "minLength": 1, "pattern": "^(?![\\\\/])(?![A-Za-z]:[\\\\/])(?!.*(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)).+$" },
|
|
24
|
-
"apiVersion": { "type": "string", "pattern": "^v[1-9][0-9]*(?:(?:alpha|beta)[1-9][0-9]*)?$" }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"requires": {
|
|
30
|
-
"type": "object",
|
|
31
|
-
"additionalProperties": false,
|
|
32
|
-
"required": ["contracts"],
|
|
33
|
-
"properties": {
|
|
34
|
-
"contracts": { "type": "array", "items": { "$ref": "#/$defs/contract" } },
|
|
35
|
-
"services": { "type": "array", "maxItems": 0 }
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"permissions": { "type": "array", "items": { "$ref": "#/$defs/permission" } },
|
|
39
|
-
"contributes": {
|
|
40
|
-
"type": "object",
|
|
41
|
-
"required": ["commands"],
|
|
42
|
-
"properties": {
|
|
43
|
-
"commands": { "type": "array", "items": { "$ref": "#/$defs/command" } },
|
|
44
|
-
"panels": { "type": "array", "maxItems": 0 }
|
|
45
|
-
},
|
|
46
|
-
"patternProperties": { "^x-": { "type": "array" } },
|
|
47
|
-
"additionalProperties": false
|
|
48
|
-
},
|
|
49
|
-
"subscriptions": {
|
|
50
|
-
"type": "array",
|
|
51
|
-
"items": {
|
|
52
|
-
"oneOf": [
|
|
53
|
-
{ "type": "string", "minLength": 1 },
|
|
54
|
-
{ "$ref": "#/$defs/subscription" }
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"license": { "type": "string", "minLength": 1 },
|
|
59
|
-
"source": {
|
|
60
|
-
"type": "object",
|
|
61
|
-
"additionalProperties": false,
|
|
62
|
-
"required": ["repository"],
|
|
63
|
-
"properties": {
|
|
64
|
-
"repository": { "type": "string", "format": "uri" },
|
|
65
|
-
"revision": { "type": "string", "minLength": 1 }
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"artifact": {
|
|
69
|
-
"type": "object",
|
|
70
|
-
"additionalProperties": false,
|
|
71
|
-
"required": ["digest", "algorithm", "path"],
|
|
72
|
-
"properties": {
|
|
73
|
-
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
74
|
-
"algorithm": { "const": "sha256" },
|
|
75
|
-
"path": { "type": "string", "minLength": 1 }
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"compat": {
|
|
79
|
-
"type": "object",
|
|
80
|
-
"additionalProperties": false,
|
|
81
|
-
"properties": { "hosts": { "type": "array", "items": { "type": "string", "minLength": 1 } } }
|
|
82
|
-
},
|
|
83
|
-
"overrides": {
|
|
84
|
-
"type": "array",
|
|
85
|
-
"items": {
|
|
86
|
-
"type": "object",
|
|
87
|
-
"additionalProperties": false,
|
|
88
|
-
"required": ["target", "kind"],
|
|
89
|
-
"properties": {
|
|
90
|
-
"target": { "type": "string", "minLength": 1 },
|
|
91
|
-
"kind": { "enum": ["patch", "native", "build"] },
|
|
92
|
-
"description": { "type": "string", "minLength": 1 }
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"patternProperties": { "^x-": {} },
|
|
98
|
-
"$defs": {
|
|
99
|
-
"namespacedId": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$" },
|
|
100
|
-
"apiVersion": { "type": "string", "pattern": "^[a-z][a-z0-9.-]*/v[1-9][0-9]*(?:(?:alpha|beta)[1-9][0-9]*)?$" },
|
|
101
|
-
"kind": { "type": "string", "pattern": "^[A-Z][A-Za-z0-9]*$" },
|
|
102
|
-
"contract": {
|
|
103
|
-
"type": "object",
|
|
104
|
-
"additionalProperties": false,
|
|
105
|
-
"required": ["apiVersion", "kind"],
|
|
106
|
-
"properties": {
|
|
107
|
-
"apiVersion": { "$ref": "#/$defs/apiVersion" },
|
|
108
|
-
"kind": { "$ref": "#/$defs/kind" },
|
|
109
|
-
"optional": { "type": "boolean" },
|
|
110
|
-
"fallback": { "type": "string", "minLength": 1 }
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"permission": {
|
|
114
|
-
"type": "object",
|
|
115
|
-
"additionalProperties": false,
|
|
116
|
-
"required": ["name", "scope"],
|
|
117
|
-
"properties": {
|
|
118
|
-
"name": { "$ref": "#/$defs/namespacedId" },
|
|
119
|
-
"scope": { "type": "string", "minLength": 1 },
|
|
120
|
-
"reason": { "type": "string", "minLength": 1 }
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"command": {
|
|
124
|
-
"type": "object",
|
|
125
|
-
"additionalProperties": false,
|
|
126
|
-
"required": ["id", "title"],
|
|
127
|
-
"properties": {
|
|
128
|
-
"id": { "$ref": "#/$defs/namespacedId" },
|
|
129
|
-
"title": { "type": "string", "minLength": 1 },
|
|
130
|
-
"description": { "type": "string", "minLength": 1 }
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"subscription": {
|
|
134
|
-
"type": "object",
|
|
135
|
-
"additionalProperties": false,
|
|
136
|
-
"required": ["apiVersion", "kind"],
|
|
137
|
-
"properties": {
|
|
138
|
-
"apiVersion": { "$ref": "#/$defs/apiVersion" },
|
|
139
|
-
"kind": { "$ref": "#/$defs/kind" },
|
|
140
|
-
"scope": { "type": "string", "minLength": 1 }
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DSH Plugin Manifest Community Draft v0.15",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["$schema", "manifestVersion", "id", "name", "version", "facets", "requires", "permissions", "contributes", "subscriptions"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": { "type": "string", "format": "uri" },
|
|
9
|
+
"manifestVersion": { "const": "0.15" },
|
|
10
|
+
"id": { "$ref": "#/$defs/namespacedId" },
|
|
11
|
+
"name": { "type": "string", "minLength": 1 },
|
|
12
|
+
"version": { "type": "string", "minLength": 1 },
|
|
13
|
+
"facets": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": ["host"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"host": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"required": ["entry", "apiVersion"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"entry": { "type": "string", "minLength": 1, "pattern": "^(?![\\\\/])(?![A-Za-z]:[\\\\/])(?!.*(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)).+$" },
|
|
24
|
+
"apiVersion": { "type": "string", "pattern": "^v[1-9][0-9]*(?:(?:alpha|beta)[1-9][0-9]*)?$" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"requires": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["contracts"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"contracts": { "type": "array", "items": { "$ref": "#/$defs/contract" } },
|
|
35
|
+
"services": { "type": "array", "maxItems": 0 }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"permissions": { "type": "array", "items": { "$ref": "#/$defs/permission" } },
|
|
39
|
+
"contributes": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["commands"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"commands": { "type": "array", "items": { "$ref": "#/$defs/command" } },
|
|
44
|
+
"panels": { "type": "array", "maxItems": 0 }
|
|
45
|
+
},
|
|
46
|
+
"patternProperties": { "^x-": { "type": "array" } },
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
},
|
|
49
|
+
"subscriptions": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"oneOf": [
|
|
53
|
+
{ "type": "string", "minLength": 1 },
|
|
54
|
+
{ "$ref": "#/$defs/subscription" }
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"license": { "type": "string", "minLength": 1 },
|
|
59
|
+
"source": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["repository"],
|
|
63
|
+
"properties": {
|
|
64
|
+
"repository": { "type": "string", "format": "uri" },
|
|
65
|
+
"revision": { "type": "string", "minLength": 1 }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"artifact": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"required": ["digest", "algorithm", "path"],
|
|
72
|
+
"properties": {
|
|
73
|
+
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
74
|
+
"algorithm": { "const": "sha256" },
|
|
75
|
+
"path": { "type": "string", "minLength": 1 }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"compat": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"properties": { "hosts": { "type": "array", "items": { "type": "string", "minLength": 1 } } }
|
|
82
|
+
},
|
|
83
|
+
"overrides": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": ["target", "kind"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"target": { "type": "string", "minLength": 1 },
|
|
91
|
+
"kind": { "enum": ["patch", "native", "build"] },
|
|
92
|
+
"description": { "type": "string", "minLength": 1 }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"patternProperties": { "^x-": {} },
|
|
98
|
+
"$defs": {
|
|
99
|
+
"namespacedId": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$" },
|
|
100
|
+
"apiVersion": { "type": "string", "pattern": "^[a-z][a-z0-9.-]*/v[1-9][0-9]*(?:(?:alpha|beta)[1-9][0-9]*)?$" },
|
|
101
|
+
"kind": { "type": "string", "pattern": "^[A-Z][A-Za-z0-9]*$" },
|
|
102
|
+
"contract": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"required": ["apiVersion", "kind"],
|
|
106
|
+
"properties": {
|
|
107
|
+
"apiVersion": { "$ref": "#/$defs/apiVersion" },
|
|
108
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
109
|
+
"optional": { "type": "boolean" },
|
|
110
|
+
"fallback": { "type": "string", "minLength": 1 }
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"permission": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": false,
|
|
116
|
+
"required": ["name", "scope"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"name": { "$ref": "#/$defs/namespacedId" },
|
|
119
|
+
"scope": { "type": "string", "minLength": 1 },
|
|
120
|
+
"reason": { "type": "string", "minLength": 1 }
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"command": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"additionalProperties": false,
|
|
126
|
+
"required": ["id", "title"],
|
|
127
|
+
"properties": {
|
|
128
|
+
"id": { "$ref": "#/$defs/namespacedId" },
|
|
129
|
+
"title": { "type": "string", "minLength": 1 },
|
|
130
|
+
"description": { "type": "string", "minLength": 1 }
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"subscription": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"required": ["apiVersion", "kind"],
|
|
137
|
+
"properties": {
|
|
138
|
+
"apiVersion": { "$ref": "#/$defs/apiVersion" },
|
|
139
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
140
|
+
"scope": { "type": "string", "minLength": 1 }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
Changes to `@dsh-std/messages` are recorded here.
|
|
4
|
-
|
|
5
|
-
## 0.1.0 (draft)
|
|
6
|
-
|
|
7
|
-
- Defined message observation events with privacy classification and structured content blocks.
|
|
8
|
-
- Added schemas and validators for the portable text and image subset.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Changes to `@dsh-std/messages` are recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (draft)
|
|
6
|
+
|
|
7
|
+
- Defined message observation events with privacy classification and structured content blocks.
|
|
8
|
+
- Added schemas and validators for the portable text and image subset.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 DSH Standard contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DSH Standard contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# @dsh-std/messages
|
|
2
|
-
|
|
3
|
-
English | [中文](README.zh.md)
|
|
4
|
-
|
|
5
|
-
This package defines the Community v0.15 `messages.dsh/v1alpha1` `MessageObserver` coordinates, negotiation definition, event types, and validators for the ContentBlock text/image subset. Event sources, subscription dispatch, and authorization interfaces are supplied by implementations.
|
|
1
|
+
# @dsh-std/messages
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
This package defines the Community v0.15 `messages.dsh/v1alpha1` `MessageObserver` coordinates, negotiation definition, event types, and validators for the ContentBlock text/image subset. Event sources, subscription dispatch, and authorization interfaces are supplied by implementations.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @dsh-std/messages
|
|
2
|
-
|
|
3
|
-
[English](README.md) | 中文
|
|
4
|
-
|
|
5
|
-
规范见 [Message Observation](../../docs/proposals/message-observer.zh.md)。
|
|
6
|
-
|
|
7
|
-
本包定义 Community v0.15 的 `messages.dsh/v1alpha1` `MessageObserver` 协议坐标、协商 definition、事件类型和 ContentBlock text/image 子集校验器。事件来源、订阅调度与授权界面由实现提供。
|
|
1
|
+
# @dsh-std/messages
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
规范见 [Message Observation](../../docs/proposals/message-observer.zh.md)。
|
|
6
|
+
|
|
7
|
+
本包定义 Community v0.15 的 `messages.dsh/v1alpha1` `MessageObserver` 协议坐标、协商 definition、事件类型和 ContentBlock text/image 子集校验器。事件来源、订阅调度与授权界面由实现提供。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {\n ProtocolCatalog,\n ProtocolDefinition,\n ProtocolIssue,\n ProtocolSupport,\n} from '@dsh-std/core'\n\nexport const API_VERSION = 'messages.dsh/v1alpha1'\nexport const KIND = 'MessageObserver'\nexport const READ_PERMISSION = 'messages.observe.read'\nexport const EVENT_TYPE = 'messages.observe'\nexport const EVENT_VERSION = '0.15'\n\nexport type PrivacyClass = 'public' | 'internal' | 'sensitive'\nexport type MessageEventKind = 'message.created' | 'message.received' | 'message.sent'\n\nexport interface TextContentBlock {\n readonly type: 'text'\n readonly text: string\n}\n\nexport interface ImageContentBlock {\n readonly type: 'image'\n readonly data: string\n readonly mimeType: string\n}\n\nexport type MessageContentBlock = TextContentBlock | ImageContentBlock\n\nexport interface MessagePayload {\n readonly kind: MessageEventKind\n readonly messageId?: string\n readonly author?: string\n readonly content: readonly MessageContentBlock[]\n readonly truncated?: boolean\n}\n\nexport interface MessageEvent {\n readonly eventType: typeof EVENT_TYPE\n readonly eventVersion: typeof EVENT_VERSION\n readonly eventId: string\n readonly scope: string\n readonly sequence: number\n readonly privacyClass: PrivacyClass\n readonly summary: string\n readonly payload: MessagePayload\n}\n\nexport interface MessageSubscription {\n readonly scope?: string\n}\n\nexport type MessageObserverErrorCode =\n | 'PERMISSION_NOT_GRANTED'\n | 'UNKNOWN_PRIVACY_CLASS'\n | 'INVALID_EVENT_ENVELOPE'\n | 'SUBSCRIPTION_CLOSED'\n\nexport const protocol: ProtocolDefinition = Object.freeze({\n apiVersion: API_VERSION,\n kind: KIND,\n validateRequirement: emptySpec,\n validateSupport: emptySpec,\n negotiate: negotiatePublisher,\n})\n\nexport const support: ProtocolSupport = Object.freeze({\n apiVersion: API_VERSION,\n kind: KIND,\n})\n\nexport function register(catalog: ProtocolCatalog): () => void {\n return catalog.register(protocol)\n}\n\nexport function validateSubscription(value: unknown): asserts value is MessageSubscription {\n const subscription = exactRecord(value, ['scope'], [], 'MessageObserver subscription')\n if (subscription.scope !== undefined) boundedText(subscription.scope, 256, 'MessageObserver subscription.scope', false)\n}\n\nexport function validateMessageEvent(value: unknown): asserts value is MessageEvent {\n const envelope = exactRecord(\n value,\n ['eventType', 'eventVersion', 'eventId', 'scope', 'sequence', 'privacyClass', 'summary', 'payload'],\n ['eventType', 'eventVersion', 'eventId', 'scope', 'sequence', 'privacyClass', 'summary', 'payload'],\n 'MessageObserver event',\n )\n if (envelope.eventType !== EVENT_TYPE) throw new TypeError(`MessageObserver event.eventType must be ${JSON.stringify(EVENT_TYPE)}`)\n if (envelope.eventVersion !== EVENT_VERSION) throw new TypeError(`MessageObserver event.eventVersion must be ${JSON.stringify(EVENT_VERSION)}`)\n if (typeof envelope.eventId !== 'string' || !/^[A-Za-z0-9._:-]+$/u.test(envelope.eventId)) {\n throw new TypeError('MessageObserver event.eventId is invalid')\n }\n boundedText(envelope.scope, 256, 'MessageObserver event.scope', false)\n if (!Number.isSafeInteger(envelope.sequence) || (envelope.sequence as number) < 0) {\n throw new TypeError('MessageObserver event.sequence must be a non-negative safe integer')\n }\n if (envelope.privacyClass !== 'public' && envelope.privacyClass !== 'internal' && envelope.privacyClass !== 'sensitive') {\n throw new TypeError('MessageObserver event.privacyClass is invalid')\n }\n boundedText(envelope.summary, 1024, 'MessageObserver event.summary', true)\n validatePayload(envelope.payload)\n}\n\nexport function parseMessageEvent(value: unknown): MessageEvent {\n validateMessageEvent(value)\n return deepFreeze(structuredClone(value))\n}\n\nexport function validateContentBlock(value: unknown): asserts value is MessageContentBlock {\n if (!record(value)) throw new TypeError('MessageObserver content block must be an object')\n if (value.type === 'text') {\n const block = exactRecord(value, ['type', 'text'], ['type', 'text'], 'MessageObserver text block')\n if (typeof block.text !== 'string' || block.text.length > 262_144) {\n throw new TypeError('MessageObserver text block.text must be a string of at most 262144 characters')\n }\n return\n }\n if (value.type === 'image') {\n const block = exactRecord(value, ['type', 'data', 'mimeType'], ['type', 'data', 'mimeType'], 'MessageObserver image block')\n if (typeof block.data !== 'string' || !base64(block.data)) {\n throw new TypeError('MessageObserver image block.data must be a base64 string')\n }\n if (typeof block.mimeType !== 'string' || !/^[A-Za-z0-9.+-]+\\/[A-Za-z0-9.+-]+$/u.test(block.mimeType)) {\n throw new TypeError('MessageObserver image block.mimeType is invalid')\n }\n return\n }\n throw new TypeError('MessageObserver content block.type must be \"text\" or \"image\"')\n}\n\nfunction validatePayload(value: unknown): asserts value is MessagePayload {\n const payload = exactRecord(\n value,\n ['kind', 'messageId', 'author', 'content', 'truncated'],\n ['kind', 'content'],\n 'MessageObserver event.payload',\n )\n if (payload.kind !== 'message.created' && payload.kind !== 'message.received' && payload.kind !== 'message.sent') {\n throw new TypeError('MessageObserver event.payload.kind is invalid')\n }\n if (payload.messageId !== undefined) boundedText(payload.messageId, 256, 'MessageObserver event.payload.messageId', true)\n if (payload.author !== undefined) boundedText(payload.author, 256, 'MessageObserver event.payload.author', true)\n if (!Array.isArray(payload.content) || payload.content.length === 0) {\n throw new TypeError('MessageObserver event.payload.content must be a non-empty array')\n }\n for (const block of payload.content) validateContentBlock(block)\n if (payload.truncated !== undefined && typeof payload.truncated !== 'boolean') {\n throw new TypeError('MessageObserver event.payload.truncated must be boolean')\n }\n}\n\nfunction negotiatePublisher(input: Parameters<NonNullable<ProtocolDefinition['negotiate']>>[0]) {\n const issues: ProtocolIssue[] = []\n const publishers = new Map<string, string>()\n for (const row of input.requirements) {\n const candidates = input.supports.filter(candidate => candidate.participant !== row.participant)\n if (candidates.length === 0) {\n issues.push(Object.freeze({\n code: row.requirement.optional === true ? 'optional-support-missing' : 'required-support-missing',\n severity: row.requirement.optional === true ? 'warning' : 'error',\n participant: row.participant,\n message: `no participant supports ${API_VERSION} ${KIND}`,\n }))\n } else if (candidates.length > 1) {\n issues.push(Object.freeze({\n code: 'support-ambiguous',\n severity: 'error',\n participant: row.participant,\n message: `multiple participants support ${API_VERSION} ${KIND}`,\n }))\n } else {\n publishers.set(row.participant, candidates[0]!.participant)\n }\n }\n return {\n agreement: Object.freeze({\n kind: 'MessageObserverBindings',\n publishers: Object.freeze(Object.fromEntries([...publishers].sort(([left], [right]) => left.localeCompare(right)))),\n }),\n issues: Object.freeze(issues),\n }\n}\n\nfunction emptySpec(value: unknown): undefined {\n if (value !== undefined) throw new TypeError(`${KIND} does not accept spec in v1alpha1`)\n return undefined\n}\n\nfunction exactRecord(\n value: unknown,\n allowed: readonly string[],\n required: readonly string[],\n label: string,\n): Record<string, unknown> {\n if (!record(value)) throw new TypeError(`${label} must be an object`)\n const unknown = Object.keys(value).filter(name => !allowed.includes(name))\n if (unknown.length > 0) throw new TypeError(`${label} contains unknown field ${JSON.stringify(unknown[0])}`)\n for (const name of required) {\n if (!Object.hasOwn(value, name)) throw new TypeError(`${label}.${name} is required`)\n }\n return value\n}\n\nfunction boundedText(value: unknown, maximum: number, label: string, empty: boolean): asserts value is string {\n if (typeof value !== 'string' || (!empty && value.length === 0) || value.length > maximum) {\n throw new TypeError(`${label} must be ${empty ? '' : 'a non-empty '}string of at most ${maximum} characters`)\n }\n}\n\nfunction base64(value: string): boolean {\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(value)\n}\n\nfunction record(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) return value\n Object.freeze(value)\n for (const child of Object.values(value)) deepFreeze(child)\n return value\n}\n"],"mappings":";AAOA,MAAa,cAAc;AAC3B,MAAa,OAAO;AACpB,MAAa,kBAAkB;AAC/B,MAAa,aAAa;AAC1B,MAAa,gBAAgB;AA+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AO,KAAK,KAAK,CAAC,CAAC,QAAO,SAAQ,CAAC,QAAQ,SAAS,IAAI,CAAC;CACzE,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,UAAU,GAAG,MAAM,0BAA0B,KAAK,UAAU,QAAQ,EAAE,GAAG;CAC3G,KAAK,MAAM,QAAQ,UACjB,IAAI,CAAC,OAAO,OAAO,OAAO,IAAI,GAAG,MAAM,IAAI,UAAU,GAAG,MAAM,GAAG,KAAK,aAAa;CAErF,OAAO;AACT;AAEA,SAAS,YAAY,OAAgB,SAAiB,OAAe,OAAyC;CAC5G,IAAI,OAAO,UAAU,YAAa,CAAC,SAAS,MAAM,WAAW,KAAM,MAAM,SAAS,SAChF,MAAM,IAAI,UAAU,GAAG,MAAM,WAAW,QAAQ,KAAK,eAAe,oBAAoB,QAAQ,YAAY;AAEhH;AAEA,SAAS,OAAO,OAAwB;CACtC,OAAO,oEAAoE,KAAK,KAAK;AACvF;AAEA,SAAS,OAAO,OAAkD;CAChE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAc,OAAa;CAClC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GAAG,OAAO;CAClF,OAAO,OAAO,KAAK;CACnB,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,WAAW,KAAK;CAC1D,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {\r\n ProtocolCatalog,\r\n ProtocolDefinition,\r\n ProtocolIssue,\r\n ProtocolSupport,\r\n} from '@dsh-std/core'\r\n\r\nexport const API_VERSION = 'messages.dsh/v1alpha1'\r\nexport const KIND = 'MessageObserver'\r\nexport const READ_PERMISSION = 'messages.observe.read'\r\nexport const EVENT_TYPE = 'messages.observe'\r\nexport const EVENT_VERSION = '0.15'\r\n\r\nexport type PrivacyClass = 'public' | 'internal' | 'sensitive'\r\nexport type MessageEventKind = 'message.created' | 'message.received' | 'message.sent'\r\n\r\nexport interface TextContentBlock {\r\n readonly type: 'text'\r\n readonly text: string\r\n}\r\n\r\nexport interface ImageContentBlock {\r\n readonly type: 'image'\r\n readonly data: string\r\n readonly mimeType: string\r\n}\r\n\r\nexport type MessageContentBlock = TextContentBlock | ImageContentBlock\r\n\r\nexport interface MessagePayload {\r\n readonly kind: MessageEventKind\r\n readonly messageId?: string\r\n readonly author?: string\r\n readonly content: readonly MessageContentBlock[]\r\n readonly truncated?: boolean\r\n}\r\n\r\nexport interface MessageEvent {\r\n readonly eventType: typeof EVENT_TYPE\r\n readonly eventVersion: typeof EVENT_VERSION\r\n readonly eventId: string\r\n readonly scope: string\r\n readonly sequence: number\r\n readonly privacyClass: PrivacyClass\r\n readonly summary: string\r\n readonly payload: MessagePayload\r\n}\r\n\r\nexport interface MessageSubscription {\r\n readonly scope?: string\r\n}\r\n\r\nexport type MessageObserverErrorCode =\r\n | 'PERMISSION_NOT_GRANTED'\r\n | 'UNKNOWN_PRIVACY_CLASS'\r\n | 'INVALID_EVENT_ENVELOPE'\r\n | 'SUBSCRIPTION_CLOSED'\r\n\r\nexport const protocol: ProtocolDefinition = Object.freeze({\r\n apiVersion: API_VERSION,\r\n kind: KIND,\r\n validateRequirement: emptySpec,\r\n validateSupport: emptySpec,\r\n negotiate: negotiatePublisher,\r\n})\r\n\r\nexport const support: ProtocolSupport = Object.freeze({\r\n apiVersion: API_VERSION,\r\n kind: KIND,\r\n})\r\n\r\nexport function register(catalog: ProtocolCatalog): () => void {\r\n return catalog.register(protocol)\r\n}\r\n\r\nexport function validateSubscription(value: unknown): asserts value is MessageSubscription {\r\n const subscription = exactRecord(value, ['scope'], [], 'MessageObserver subscription')\r\n if (subscription.scope !== undefined) boundedText(subscription.scope, 256, 'MessageObserver subscription.scope', false)\r\n}\r\n\r\nexport function validateMessageEvent(value: unknown): asserts value is MessageEvent {\r\n const envelope = exactRecord(\r\n value,\r\n ['eventType', 'eventVersion', 'eventId', 'scope', 'sequence', 'privacyClass', 'summary', 'payload'],\r\n ['eventType', 'eventVersion', 'eventId', 'scope', 'sequence', 'privacyClass', 'summary', 'payload'],\r\n 'MessageObserver event',\r\n )\r\n if (envelope.eventType !== EVENT_TYPE) throw new TypeError(`MessageObserver event.eventType must be ${JSON.stringify(EVENT_TYPE)}`)\r\n if (envelope.eventVersion !== EVENT_VERSION) throw new TypeError(`MessageObserver event.eventVersion must be ${JSON.stringify(EVENT_VERSION)}`)\r\n if (typeof envelope.eventId !== 'string' || !/^[A-Za-z0-9._:-]+$/u.test(envelope.eventId)) {\r\n throw new TypeError('MessageObserver event.eventId is invalid')\r\n }\r\n boundedText(envelope.scope, 256, 'MessageObserver event.scope', false)\r\n if (!Number.isSafeInteger(envelope.sequence) || (envelope.sequence as number) < 0) {\r\n throw new TypeError('MessageObserver event.sequence must be a non-negative safe integer')\r\n }\r\n if (envelope.privacyClass !== 'public' && envelope.privacyClass !== 'internal' && envelope.privacyClass !== 'sensitive') {\r\n throw new TypeError('MessageObserver event.privacyClass is invalid')\r\n }\r\n boundedText(envelope.summary, 1024, 'MessageObserver event.summary', true)\r\n validatePayload(envelope.payload)\r\n}\r\n\r\nexport function parseMessageEvent(value: unknown): MessageEvent {\r\n validateMessageEvent(value)\r\n return deepFreeze(structuredClone(value))\r\n}\r\n\r\nexport function validateContentBlock(value: unknown): asserts value is MessageContentBlock {\r\n if (!record(value)) throw new TypeError('MessageObserver content block must be an object')\r\n if (value.type === 'text') {\r\n const block = exactRecord(value, ['type', 'text'], ['type', 'text'], 'MessageObserver text block')\r\n if (typeof block.text !== 'string' || block.text.length > 262_144) {\r\n throw new TypeError('MessageObserver text block.text must be a string of at most 262144 characters')\r\n }\r\n return\r\n }\r\n if (value.type === 'image') {\r\n const block = exactRecord(value, ['type', 'data', 'mimeType'], ['type', 'data', 'mimeType'], 'MessageObserver image block')\r\n if (typeof block.data !== 'string' || !base64(block.data)) {\r\n throw new TypeError('MessageObserver image block.data must be a base64 string')\r\n }\r\n if (typeof block.mimeType !== 'string' || !/^[A-Za-z0-9.+-]+\\/[A-Za-z0-9.+-]+$/u.test(block.mimeType)) {\r\n throw new TypeError('MessageObserver image block.mimeType is invalid')\r\n }\r\n return\r\n }\r\n throw new TypeError('MessageObserver content block.type must be \"text\" or \"image\"')\r\n}\r\n\r\nfunction validatePayload(value: unknown): asserts value is MessagePayload {\r\n const payload = exactRecord(\r\n value,\r\n ['kind', 'messageId', 'author', 'content', 'truncated'],\r\n ['kind', 'content'],\r\n 'MessageObserver event.payload',\r\n )\r\n if (payload.kind !== 'message.created' && payload.kind !== 'message.received' && payload.kind !== 'message.sent') {\r\n throw new TypeError('MessageObserver event.payload.kind is invalid')\r\n }\r\n if (payload.messageId !== undefined) boundedText(payload.messageId, 256, 'MessageObserver event.payload.messageId', true)\r\n if (payload.author !== undefined) boundedText(payload.author, 256, 'MessageObserver event.payload.author', true)\r\n if (!Array.isArray(payload.content) || payload.content.length === 0) {\r\n throw new TypeError('MessageObserver event.payload.content must be a non-empty array')\r\n }\r\n for (const block of payload.content) validateContentBlock(block)\r\n if (payload.truncated !== undefined && typeof payload.truncated !== 'boolean') {\r\n throw new TypeError('MessageObserver event.payload.truncated must be boolean')\r\n }\r\n}\r\n\r\nfunction negotiatePublisher(input: Parameters<NonNullable<ProtocolDefinition['negotiate']>>[0]) {\r\n const issues: ProtocolIssue[] = []\r\n const publishers = new Map<string, string>()\r\n for (const row of input.requirements) {\r\n const candidates = input.supports.filter(candidate => candidate.participant !== row.participant)\r\n if (candidates.length === 0) {\r\n issues.push(Object.freeze({\r\n code: row.requirement.optional === true ? 'optional-support-missing' : 'required-support-missing',\r\n severity: row.requirement.optional === true ? 'warning' : 'error',\r\n participant: row.participant,\r\n message: `no participant supports ${API_VERSION} ${KIND}`,\r\n }))\r\n } else if (candidates.length > 1) {\r\n issues.push(Object.freeze({\r\n code: 'support-ambiguous',\r\n severity: 'error',\r\n participant: row.participant,\r\n message: `multiple participants support ${API_VERSION} ${KIND}`,\r\n }))\r\n } else {\r\n publishers.set(row.participant, candidates[0]!.participant)\r\n }\r\n }\r\n return {\r\n agreement: Object.freeze({\r\n kind: 'MessageObserverBindings',\r\n publishers: Object.freeze(Object.fromEntries([...publishers].sort(([left], [right]) => left.localeCompare(right)))),\r\n }),\r\n issues: Object.freeze(issues),\r\n }\r\n}\r\n\r\nfunction emptySpec(value: unknown): undefined {\r\n if (value !== undefined) throw new TypeError(`${KIND} does not accept spec in v1alpha1`)\r\n return undefined\r\n}\r\n\r\nfunction exactRecord(\r\n value: unknown,\r\n allowed: readonly string[],\r\n required: readonly string[],\r\n label: string,\r\n): Record<string, unknown> {\r\n if (!record(value)) throw new TypeError(`${label} must be an object`)\r\n const unknown = Object.keys(value).filter(name => !allowed.includes(name))\r\n if (unknown.length > 0) throw new TypeError(`${label} contains unknown field ${JSON.stringify(unknown[0])}`)\r\n for (const name of required) {\r\n if (!Object.hasOwn(value, name)) throw new TypeError(`${label}.${name} is required`)\r\n }\r\n return value\r\n}\r\n\r\nfunction boundedText(value: unknown, maximum: number, label: string, empty: boolean): asserts value is string {\r\n if (typeof value !== 'string' || (!empty && value.length === 0) || value.length > maximum) {\r\n throw new TypeError(`${label} must be ${empty ? '' : 'a non-empty '}string of at most ${maximum} characters`)\r\n }\r\n}\r\n\r\nfunction base64(value: string): boolean {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(value)\r\n}\r\n\r\nfunction record(value: unknown): value is Record<string, unknown> {\r\n return typeof value === 'object' && value !== null && !Array.isArray(value)\r\n}\r\n\r\nfunction deepFreeze<T>(value: T): T {\r\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) return value\r\n Object.freeze(value)\r\n for (const child of Object.values(value)) deepFreeze(child)\r\n return value\r\n}\r\n"],"mappings":";AAOA,MAAa,cAAc;AAC3B,MAAa,OAAO;AACpB,MAAa,kBAAkB;A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U,GAAG,MAAM,mBAAmB;CACpE,MAAM,UAAU,OAAO,KAAK,KAAK,CAAC,CAAC,QAAO,SAAQ,CAAC,QAAQ,SAAS,IAAI,CAAC;CACzE,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,UAAU,GAAG,MAAM,0BAA0B,KAAK,UAAU,QAAQ,EAAE,GAAG;CAC3G,KAAK,MAAM,QAAQ,UACjB,IAAI,CAAC,OAAO,OAAO,OAAO,IAAI,GAAG,MAAM,IAAI,UAAU,GAAG,MAAM,GAAG,KAAK,aAAa;CAErF,OAAO;AACT;AAEA,SAAS,YAAY,OAAgB,SAAiB,OAAe,OAAyC;CAC5G,IAAI,OAAO,UAAU,YAAa,CAAC,SAAS,MAAM,WAAW,KAAM,MAAM,SAAS,SAChF,MAAM,IAAI,UAAU,GAAG,MAAM,WAAW,QAAQ,KAAK,eAAe,oBAAoB,QAAQ,YAAY;AAEhH;AAEA,SAAS,OAAO,OAAwB;CACtC,OAAO,oEAAoE,KAAK,KAAK;AACvF;AAEA,SAAS,OAAO,OAAkD;CAChE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAc,OAAa;CAClC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GAAG,OAAO;CAClF,OAAO,OAAO,KAAK;CACnB,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,WAAW,KAAK;CAC1D,OAAO;AACT"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@dsh-std/messages",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
|
|
10
|
-
"./schema/message-observer-envelope-0.15.json": "./schema/message-observer-envelope-0.15.schema.json"
|
|
11
|
-
},
|
|
12
|
-
"files": ["lib", "schema", "CHANGELOG.md"],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "pnpm run typecheck && tsdown",
|
|
15
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
|
-
"test": "vitest run --passWithNoTests"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": { "@dsh-std/core": "workspace:*" },
|
|
19
|
-
"engines": { "node": "^22.19 || >=24" }
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-std/messages",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
|
|
10
|
+
"./schema/message-observer-envelope-0.15.json": "./schema/message-observer-envelope-0.15.schema.json"
|
|
11
|
+
},
|
|
12
|
+
"files": ["lib", "schema", "CHANGELOG.md"],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "pnpm run typecheck && tsdown",
|
|
15
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
|
+
"test": "vitest run --passWithNoTests"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": { "@dsh-std/core": "workspace:*" },
|
|
19
|
+
"engines": { "node": "^22.19 || >=24" }
|
|
20
|
+
}
|