@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providerWizard.d.ts","sourceRoot":"","sources":["../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
69
|
const { host, ask, notify, pushLocal } = deps;
|
|
70
70
|
try {
|
|
71
71
|
// ── 1. mode ────────────────────────────────────────────────────────
|
|
72
|
+
const modeOptions = [
|
|
73
|
+
{ label: t('provider-opt-catalog'), description: t('provider-opt-catalog-desc') },
|
|
74
|
+
{ label: t('provider-opt-custom'), description: t('provider-opt-custom-desc') },
|
|
75
|
+
];
|
|
76
|
+
// The OAuth branch exists only while a dsh-auth-style plugin is mounted;
|
|
77
|
+
// without the service the mode question stays exactly two options.
|
|
78
|
+
if (host.oauth !== undefined) {
|
|
79
|
+
modeOptions.push({ label: t('provider-opt-oauth'), description: t('provider-opt-oauth-desc') });
|
|
80
|
+
}
|
|
72
81
|
const modeAnswer = await ask({
|
|
73
|
-
questions: [optionQuestion('mode', t('provider-q-mode'),
|
|
74
|
-
{ label: t('provider-opt-catalog'), description: t('provider-opt-catalog-desc') },
|
|
75
|
-
{ label: t('provider-opt-custom'), description: t('provider-opt-custom-desc') },
|
|
76
|
-
], { hideCustomInput: true })],
|
|
82
|
+
questions: [optionQuestion('mode', t('provider-q-mode'), modeOptions, { hideCustomInput: true })],
|
|
77
83
|
});
|
|
78
|
-
const
|
|
84
|
+
const pickedMode = answerSelected(modeAnswer, 'mode')[0];
|
|
85
|
+
if (host.oauth !== undefined && pickedMode === t('provider-opt-oauth')) {
|
|
86
|
+
return runOAuthWizard(deps, host.oauth);
|
|
87
|
+
}
|
|
88
|
+
const isCatalog = pickedMode === t('provider-opt-catalog');
|
|
79
89
|
// ── 2. route ───────────────────────────────────────────────────────
|
|
80
90
|
let route = '';
|
|
81
91
|
if (isCatalog) {
|
|
@@ -267,6 +277,80 @@ export async function runProviderWizard(deps) {
|
|
|
267
277
|
return 'failed';
|
|
268
278
|
}
|
|
269
279
|
}
|
|
280
|
+
/** Masked state line for one provider row in the OAuth pick question. */
|
|
281
|
+
function oauthStateDescription(status) {
|
|
282
|
+
if (status.signedIn) {
|
|
283
|
+
return t('provider-oauth-state-in', { time: new Date(status.expiresAt ?? 0).toISOString() });
|
|
284
|
+
}
|
|
285
|
+
return status.expired
|
|
286
|
+
? t('provider-oauth-state-expired')
|
|
287
|
+
: (status.loginLabel ?? status.oauthLabel);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The OAuth branch of `/provider`: pick a subscription provider, then sign
|
|
291
|
+
* in (the plugin's own question panels carry the flow — device codes,
|
|
292
|
+
* authorization URLs), or re-login / sign out when one is already signed in.
|
|
293
|
+
* No settings or credential writes happen here; the plugin owns its store.
|
|
294
|
+
*/
|
|
295
|
+
async function runOAuthWizard(deps, oauth) {
|
|
296
|
+
const { ask, notify, pushLocal } = deps;
|
|
297
|
+
try {
|
|
298
|
+
const statuses = await oauth.providers();
|
|
299
|
+
if (statuses.length === 0) {
|
|
300
|
+
notify(t('provider-oauth-none'), { color: 'warning' });
|
|
301
|
+
return 'failed';
|
|
302
|
+
}
|
|
303
|
+
const pickAnswer = await ask({
|
|
304
|
+
questions: [optionQuestion('oauth-provider', t('provider-q-oauth'), statuses.map(status => ({
|
|
305
|
+
label: status.provider,
|
|
306
|
+
description: oauthStateDescription(status),
|
|
307
|
+
})), { hideCustomInput: true })],
|
|
308
|
+
});
|
|
309
|
+
const providerId = answerSelected(pickAnswer, 'oauth-provider')[0];
|
|
310
|
+
const status = statuses.find(row => row.provider === providerId);
|
|
311
|
+
if (status === undefined)
|
|
312
|
+
return 'cancelled';
|
|
313
|
+
if (status.signedIn) {
|
|
314
|
+
const actionAnswer = await ask({
|
|
315
|
+
questions: [optionQuestion('oauth-signed-action', t('provider-q-oauth-signed', { provider: status.provider }), [
|
|
316
|
+
{ label: t('provider-opt-oauth-relogin'), description: t('provider-opt-oauth-relogin-desc') },
|
|
317
|
+
{ label: t('provider-opt-oauth-logout'), description: t('provider-opt-oauth-logout-desc') },
|
|
318
|
+
{ label: t('provider-opt-confirm-cancel') },
|
|
319
|
+
], { hideCustomInput: true })],
|
|
320
|
+
});
|
|
321
|
+
const action = answerSelected(actionAnswer, 'oauth-signed-action')[0];
|
|
322
|
+
if (action === t('provider-opt-oauth-logout')) {
|
|
323
|
+
await oauth.logout(status.provider);
|
|
324
|
+
pushLocal('/provider', [
|
|
325
|
+
t('provider-line-oauth-provider', { provider: status.provider }),
|
|
326
|
+
t('provider-line-oauth-out'),
|
|
327
|
+
]);
|
|
328
|
+
notify(t('provider-oauth-logout-ok', { provider: status.provider }), { color: 'success' });
|
|
329
|
+
return 'signed-out';
|
|
330
|
+
}
|
|
331
|
+
if (action !== t('provider-opt-oauth-relogin'))
|
|
332
|
+
return 'cancelled';
|
|
333
|
+
}
|
|
334
|
+
const result = await oauth.login(status.provider);
|
|
335
|
+
pushLocal('/provider', [
|
|
336
|
+
t('provider-line-oauth-provider', { provider: result.provider }),
|
|
337
|
+
t('provider-line-oauth-flow', { flow: result.oauthLabel }),
|
|
338
|
+
t('provider-line-oauth-expires', { time: new Date(result.expiresAt).toISOString() }),
|
|
339
|
+
t('provider-switch-hint'),
|
|
340
|
+
]);
|
|
341
|
+
notify(t('provider-oauth-login-ok', { provider: result.provider }), { color: 'success' });
|
|
342
|
+
return 'added';
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
if (error instanceof UserQuestionError) {
|
|
346
|
+
notify(t('provider-cancelled'));
|
|
347
|
+
return 'cancelled';
|
|
348
|
+
}
|
|
349
|
+
const err = error instanceof Error ? error.message : String(error);
|
|
350
|
+
notify(t('provider-oauth-login-failed', { err }), { color: 'error', timeoutMs: 8000 });
|
|
351
|
+
return 'failed';
|
|
352
|
+
}
|
|
353
|
+
}
|
|
270
354
|
/** Prompt for a route id until it validates or the retry budget runs out. */
|
|
271
355
|
async function promptRouteId(ask, notify) {
|
|
272
356
|
for (let attempt = 0; attempt < MAX_RETRY; attempt += 1) {
|
|
@@ -18,6 +18,12 @@ export interface QuestionSelection {
|
|
|
18
18
|
readonly selected: string[];
|
|
19
19
|
readonly custom?: string;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* In-progress answer state kept while navigating between questions. Drafts
|
|
23
|
+
* are deliberately separate from committed answers: leaving a question
|
|
24
|
+
* should preserve what the user typed without making it count as answered.
|
|
25
|
+
*/
|
|
26
|
+
export type QuestionDraft = QuestionSelection;
|
|
21
27
|
/** What the TUI renders while a question is pending. */
|
|
22
28
|
export interface QuestionSnapshot {
|
|
23
29
|
/** Stable key so the panel remounts (fresh selection state) per question. */
|
|
@@ -29,6 +35,10 @@ export interface QuestionSnapshot {
|
|
|
29
35
|
readonly total: number;
|
|
30
36
|
/** Questions answered before the current one. */
|
|
31
37
|
readonly answered: number;
|
|
38
|
+
/** Previously saved answer or draft for the current question. */
|
|
39
|
+
readonly draft?: QuestionDraft;
|
|
40
|
+
/** Whether Esc should navigate to the previous question. */
|
|
41
|
+
readonly canGoBack: boolean;
|
|
32
42
|
}
|
|
33
43
|
/** Completed batch summary, pushed into the transcript by the caller. */
|
|
34
44
|
export interface QuestionSummary {
|
|
@@ -88,11 +98,18 @@ export declare class QuestionStore {
|
|
|
88
98
|
/** Advance to the next queued ask, if any. */
|
|
89
99
|
private startNext;
|
|
90
100
|
/**
|
|
91
|
-
* The user submitted an answer for the current question;
|
|
92
|
-
* batch and settles it once
|
|
101
|
+
* The user submitted an answer for the current question; replaces any
|
|
102
|
+
* previous answer at that position, advances the batch, and settles it once
|
|
103
|
+
* every question is answered.
|
|
93
104
|
* @param selection - Selected option labels plus optional custom text.
|
|
94
105
|
*/
|
|
95
106
|
answerCurrent(selection: QuestionSelection): void;
|
|
107
|
+
/**
|
|
108
|
+
* Navigate to the previous question without cancelling the batch. The
|
|
109
|
+
* caller supplies the panel's current draft so partially typed text can be
|
|
110
|
+
* restored when the user returns.
|
|
111
|
+
*/
|
|
112
|
+
backCurrent(draft?: QuestionDraft): void;
|
|
96
113
|
/** The user interrupted the questionnaire (Esc / Ctrl+C). */
|
|
97
114
|
cancelCurrent(): void;
|
|
98
115
|
/** Reject the active and all queued asks (plugin teardown). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/questions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,iCAAiC,CAAA;AAExC;mEACmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/questions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,iCAAiC,CAAA;AAExC;mEACmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAA;AAwB7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;IACtC,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAA;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,OAAO,C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|
return text;
|
|
28
28
|
return `${text.slice(0, max)}…`;
|
|
29
29
|
}
|
|
30
|
+
function isDefined(value) {
|
|
31
|
+
return value !== undefined;
|
|
32
|
+
}
|
|
33
|
+
function copyDraft(draft) {
|
|
34
|
+
return {
|
|
35
|
+
selected: [...draft.selected],
|
|
36
|
+
...(draft.custom !== undefined ? { custom: draft.custom } : {}),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function selectionFromAnswer(answer) {
|
|
40
|
+
return copyDraft(answer);
|
|
41
|
+
}
|
|
30
42
|
function buildSummary(pending) {
|
|
31
|
-
const lines = pending.
|
|
32
|
-
const
|
|
43
|
+
const lines = pending.request.questions.flatMap((question, index) => {
|
|
44
|
+
const answer = pending.answers[index];
|
|
45
|
+
if (answer === undefined)
|
|
46
|
+
return [];
|
|
33
47
|
const text = pending.redact
|
|
34
48
|
? '••••••'
|
|
35
49
|
: (() => {
|
|
@@ -38,7 +52,7 @@ function buildSummary(pending) {
|
|
|
38
52
|
? labels === '' ? answer.custom : `${labels}:${answer.custom}`
|
|
39
53
|
: labels;
|
|
40
54
|
})();
|
|
41
|
-
return `· ${question
|
|
55
|
+
return `· ${question.question} → ${clip(text)}`;
|
|
42
56
|
});
|
|
43
57
|
const total = pending.request.questions.length;
|
|
44
58
|
return {
|
|
@@ -103,12 +117,20 @@ export class QuestionStore {
|
|
|
103
117
|
return;
|
|
104
118
|
}
|
|
105
119
|
const question = pending.request.questions[pending.index];
|
|
120
|
+
const savedDraft = pending.drafts[pending.index];
|
|
121
|
+
const savedAnswer = pending.answers[pending.index];
|
|
106
122
|
this.snapshotCache = question === undefined ? null : {
|
|
107
123
|
key: `${pending.batchId}-${pending.index}`,
|
|
108
124
|
question,
|
|
109
125
|
position: pending.index + 1,
|
|
110
126
|
total: pending.request.questions.length,
|
|
111
|
-
answered: pending.
|
|
127
|
+
answered: pending.index,
|
|
128
|
+
...(savedDraft !== undefined
|
|
129
|
+
? { draft: savedDraft }
|
|
130
|
+
: savedAnswer !== undefined
|
|
131
|
+
? { draft: selectionFromAnswer(savedAnswer) }
|
|
132
|
+
: {}),
|
|
133
|
+
canGoBack: pending.index > 0,
|
|
112
134
|
};
|
|
113
135
|
}
|
|
114
136
|
/**
|
|
@@ -127,7 +149,8 @@ export class QuestionStore {
|
|
|
127
149
|
request,
|
|
128
150
|
batchId: ++this.batchSeq,
|
|
129
151
|
index: 0,
|
|
130
|
-
answers:
|
|
152
|
+
answers: new Array(request.questions.length),
|
|
153
|
+
drafts: new Array(request.questions.length),
|
|
131
154
|
...(options?.redact ? { redact: true } : {}),
|
|
132
155
|
resolve,
|
|
133
156
|
reject,
|
|
@@ -160,8 +183,9 @@ export class QuestionStore {
|
|
|
160
183
|
this.emit();
|
|
161
184
|
}
|
|
162
185
|
/**
|
|
163
|
-
* The user submitted an answer for the current question;
|
|
164
|
-
* batch and settles it once
|
|
186
|
+
* The user submitted an answer for the current question; replaces any
|
|
187
|
+
* previous answer at that position, advances the batch, and settles it once
|
|
188
|
+
* every question is answered.
|
|
165
189
|
* @param selection - Selected option labels plus optional custom text.
|
|
166
190
|
*/
|
|
167
191
|
answerCurrent(selection) {
|
|
@@ -169,25 +193,44 @@ export class QuestionStore {
|
|
|
169
193
|
const question = pending?.request.questions[pending.index];
|
|
170
194
|
if (pending === undefined || question === undefined)
|
|
171
195
|
return;
|
|
172
|
-
|
|
196
|
+
const answer = {
|
|
173
197
|
id: question.id,
|
|
174
198
|
selected: [...selection.selected],
|
|
175
199
|
...(selection.custom !== undefined && selection.custom !== ''
|
|
176
200
|
? { custom: selection.custom }
|
|
177
201
|
: {}),
|
|
178
|
-
}
|
|
202
|
+
};
|
|
203
|
+
pending.answers[pending.index] = answer;
|
|
204
|
+
pending.drafts[pending.index] = copyDraft(selection);
|
|
179
205
|
pending.index += 1;
|
|
180
206
|
if (pending.index >= pending.request.questions.length) {
|
|
181
207
|
// Batch complete: settle the harness promise, remember a transcript
|
|
182
208
|
// summary, and drain the next queued ask if any.
|
|
209
|
+
const answers = pending.answers.filter(isDefined);
|
|
183
210
|
this.active = undefined;
|
|
184
|
-
pending.resolve({ answers
|
|
211
|
+
pending.resolve({ answers });
|
|
185
212
|
this.summaries.push(buildSummary(pending));
|
|
186
213
|
this.startNext();
|
|
187
214
|
}
|
|
188
215
|
this.rebuildSnapshot();
|
|
189
216
|
this.emit();
|
|
190
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Navigate to the previous question without cancelling the batch. The
|
|
220
|
+
* caller supplies the panel's current draft so partially typed text can be
|
|
221
|
+
* restored when the user returns.
|
|
222
|
+
*/
|
|
223
|
+
backCurrent(draft) {
|
|
224
|
+
const pending = this.active;
|
|
225
|
+
if (pending === undefined || pending.index <= 0)
|
|
226
|
+
return;
|
|
227
|
+
if (draft !== undefined) {
|
|
228
|
+
pending.drafts[pending.index] = copyDraft(draft);
|
|
229
|
+
}
|
|
230
|
+
pending.index -= 1;
|
|
231
|
+
this.rebuildSnapshot();
|
|
232
|
+
this.emit();
|
|
233
|
+
}
|
|
191
234
|
/** The user interrupted the questionnaire (Esc / Ctrl+C). */
|
|
192
235
|
cancelCurrent() {
|
|
193
236
|
const pending = this.active;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session recap (`/recap`, pi-recap semantics): a single TOOL-LESS LLM
|
|
3
|
+
* call that summarizes the session's RECENT activity into one line and
|
|
4
|
+
* proposes a short title. Unlike `/btw` it does not replay the full
|
|
5
|
+
* derived history — the recent-activity excerpt below IS the payload, so
|
|
6
|
+
* the call stays cheap and the recap is about the tail of the session,
|
|
7
|
+
* which is exactly what a glance at a resumed/unknown session needs.
|
|
8
|
+
*
|
|
9
|
+
* The answer never enters the session log — it is pure UI state (the
|
|
10
|
+
* RecapPanel in the Chat screen); applying the proposed title goes
|
|
11
|
+
* through the normal `/rename` path (channel.renameSession).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
16
|
+
/** Max chars of recent activity fed to the recap call. */
|
|
17
|
+
export declare const RECAP_RECENT_CHARS = 6000;
|
|
18
|
+
/**
|
|
19
|
+
* Collect the most recent user/assistant exchanges from a session event
|
|
20
|
+
* log as plain `role: text` lines, capped to the tail turns and a char
|
|
21
|
+
* budget. Rows derived from the log (tool cards, notices) are skipped —
|
|
22
|
+
* the recap wants the conversation, not the chrome.
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectRecentActivity(events: readonly SessionEvent[], limitChars: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Wrap the recent-activity excerpt with the single-response, JSON-only
|
|
27
|
+
* recap contract. The model answers with a title + one-line summary in
|
|
28
|
+
* the language of the activity (matching the user's own words).
|
|
29
|
+
*/
|
|
30
|
+
export declare function wrapRecapPrompt(activity: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse the model's recap response: extract the JSON object (tolerating
|
|
33
|
+
* stray prose around it); on failure the whole text becomes the summary
|
|
34
|
+
* and no title is proposed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseRecapResponse(raw: string): {
|
|
37
|
+
summary: string;
|
|
38
|
+
title?: string;
|
|
39
|
+
};
|
|
40
|
+
/** Outcome of one recap call, as surfaced on the Channel. */
|
|
41
|
+
export interface RecapOutcome {
|
|
42
|
+
/** The one-line summary, or null when the call failed. */
|
|
43
|
+
summary: string | null;
|
|
44
|
+
/** Proposed session title, when the model offered one. */
|
|
45
|
+
title?: string;
|
|
46
|
+
/** Human-readable failure reason (llm missing, stream error, …). */
|
|
47
|
+
error?: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=recap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recap.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/recap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAkBtC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA4BjG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYxD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBnF;AAED,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session recap (`/recap`, pi-recap semantics): a single TOOL-LESS LLM
|
|
3
|
+
* call that summarizes the session's RECENT activity into one line and
|
|
4
|
+
* proposes a short title. Unlike `/btw` it does not replay the full
|
|
5
|
+
* derived history — the recent-activity excerpt below IS the payload, so
|
|
6
|
+
* the call stays cheap and the recap is about the tail of the session,
|
|
7
|
+
* which is exactly what a glance at a resumed/unknown session needs.
|
|
8
|
+
*
|
|
9
|
+
* The answer never enters the session log — it is pure UI state (the
|
|
10
|
+
* RecapPanel in the Chat screen); applying the proposed title goes
|
|
11
|
+
* through the normal `/rename` path (channel.renameSession).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/** Max chars of recent activity fed to the recap call. */
|
|
16
|
+
export const RECAP_RECENT_CHARS = 6000;
|
|
17
|
+
/** How many exchanges (user + assistant) the recap looks back. */
|
|
18
|
+
const RECAP_RECENT_TURNS = 6;
|
|
19
|
+
/** The first text block of a message `content` payload. */
|
|
20
|
+
function textOfContent(content) {
|
|
21
|
+
if (typeof content === 'string')
|
|
22
|
+
return content.trim() || undefined;
|
|
23
|
+
if (!Array.isArray(content))
|
|
24
|
+
return undefined;
|
|
25
|
+
for (const block of content) {
|
|
26
|
+
if (block === null || typeof block !== 'object')
|
|
27
|
+
continue;
|
|
28
|
+
const record = block;
|
|
29
|
+
if (record['type'] !== 'text')
|
|
30
|
+
continue;
|
|
31
|
+
const value = record['text'];
|
|
32
|
+
if (typeof value === 'string' && value.trim().length > 0)
|
|
33
|
+
return value.trim();
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Collect the most recent user/assistant exchanges from a session event
|
|
39
|
+
* log as plain `role: text` lines, capped to the tail turns and a char
|
|
40
|
+
* budget. Rows derived from the log (tool cards, notices) are skipped —
|
|
41
|
+
* the recap wants the conversation, not the chrome.
|
|
42
|
+
*/
|
|
43
|
+
export function collectRecentActivity(events, limitChars) {
|
|
44
|
+
const entries = [];
|
|
45
|
+
for (const event of events) {
|
|
46
|
+
const record = event;
|
|
47
|
+
if (record['type'] === 'user/message') {
|
|
48
|
+
const data = record['data'];
|
|
49
|
+
const text = textOfContent(data?.['content']);
|
|
50
|
+
if (text !== undefined)
|
|
51
|
+
entries.push({ role: 'user', text });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (record['type'] === 'assistant/message') {
|
|
55
|
+
const data = record['data'];
|
|
56
|
+
const message = data?.['message'];
|
|
57
|
+
const text = textOfContent(message?.['content']);
|
|
58
|
+
if (text !== undefined)
|
|
59
|
+
entries.push({ role: 'assistant', text });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const tail = entries.slice(-RECAP_RECENT_TURNS * 2);
|
|
63
|
+
let budget = limitChars;
|
|
64
|
+
const lines = [];
|
|
65
|
+
for (const entry of tail) {
|
|
66
|
+
const text = entry.text.length > budget ? entry.text.slice(0, budget) : entry.text;
|
|
67
|
+
lines.push(`${entry.role}: ${text}`);
|
|
68
|
+
budget -= text.length + entry.role.length + 2;
|
|
69
|
+
if (budget <= 0)
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return lines.join('\n');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Wrap the recent-activity excerpt with the single-response, JSON-only
|
|
76
|
+
* recap contract. The model answers with a title + one-line summary in
|
|
77
|
+
* the language of the activity (matching the user's own words).
|
|
78
|
+
*/
|
|
79
|
+
export function wrapRecapPrompt(activity) {
|
|
80
|
+
return `<system-reminder>You are a thoughtful assistant helping the user wrap up this session. Look at the recent activity below and give it a quick human review — like a colleague summarizing what the two of you just worked on.
|
|
81
|
+
|
|
82
|
+
TASK — do BOTH:
|
|
83
|
+
1. Write ONE short line (about 10-20 words) recapping the RECENT ACTIVITY: what was being worked on and where things stand. Write it in the same language the user writes in. Sound natural and professional — a warm recap, not a dry log.
|
|
84
|
+
2. Propose a short session title (about 2-6 words, same language) that captures what this session is about.
|
|
85
|
+
|
|
86
|
+
Respond with ONLY a JSON object, no markdown fences, no extra text:
|
|
87
|
+
{"title": "<short title>", "summary": "<one-line summary>"}
|
|
88
|
+
|
|
89
|
+
RECENT ACTIVITY:
|
|
90
|
+
${activity}</system-reminder>`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parse the model's recap response: extract the JSON object (tolerating
|
|
94
|
+
* stray prose around it); on failure the whole text becomes the summary
|
|
95
|
+
* and no title is proposed.
|
|
96
|
+
*/
|
|
97
|
+
export function parseRecapResponse(raw) {
|
|
98
|
+
const start = raw.indexOf('{');
|
|
99
|
+
const end = raw.lastIndexOf('}');
|
|
100
|
+
if (start !== -1 && end > start) {
|
|
101
|
+
try {
|
|
102
|
+
const parsed = JSON.parse(raw.slice(start, end + 1));
|
|
103
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
104
|
+
const record = parsed;
|
|
105
|
+
const summary = typeof record['summary'] === 'string' && record['summary'].trim() !== ''
|
|
106
|
+
? record['summary'].trim()
|
|
107
|
+
: undefined;
|
|
108
|
+
const title = typeof record['title'] === 'string' && record['title'].trim() !== ''
|
|
109
|
+
? record['title'].trim()
|
|
110
|
+
: undefined;
|
|
111
|
+
if (summary !== undefined) {
|
|
112
|
+
return title === undefined ? { summary } : { summary, title };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Fall through to the raw-text fallback below.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return { summary: raw.trim() };
|
|
121
|
+
}
|