@deepseek-harness-tui/dsh-tui 0.8.5 → 0.8.7
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 +13 -3
- package/bin/dsh-tui.js +269 -218
- package/cordis.patch.yml +48 -22
- 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/figures.d.ts +7 -0
- package/lib/types/cc/figures.d.ts.map +1 -1
- package/lib/types/cc/figures.js +24 -0
- package/lib/types/cc/markdown.d.ts.map +1 -1
- package/lib/types/cc/markdown.js +47 -14
- package/lib/types/cc/syntaxRuns.d.ts +16 -0
- package/lib/types/cc/syntaxRuns.d.ts.map +1 -0
- package/lib/types/cc/syntaxRuns.js +79 -0
- package/lib/types/cc/syntaxTheme.d.ts +12 -0
- package/lib/types/cc/syntaxTheme.d.ts.map +1 -0
- package/lib/types/cc/syntaxTheme.js +76 -0
- package/lib/types/commands.d.ts +14 -0
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +20 -1
- package/lib/types/components/Chat/SubagentMessage.d.ts +19 -0
- package/lib/types/components/Chat/SubagentMessage.d.ts.map +1 -0
- package/lib/types/components/Chat/SubagentMessage.js +75 -0
- package/lib/types/components/EffortChargeGlyph.d.ts +26 -0
- package/lib/types/components/EffortChargeGlyph.d.ts.map +1 -0
- package/lib/types/components/EffortChargeGlyph.js +70 -0
- package/lib/types/components/EffortInputBorder.d.ts +36 -0
- package/lib/types/components/EffortInputBorder.d.ts.map +1 -0
- package/lib/types/components/EffortInputBorder.js +73 -0
- package/lib/types/components/EffortTierBadge.d.ts +26 -0
- package/lib/types/components/EffortTierBadge.d.ts.map +1 -0
- package/lib/types/components/EffortTierBadge.js +97 -0
- package/lib/types/components/HelpMenu.d.ts +8 -1
- package/lib/types/components/HelpMenu.d.ts.map +1 -1
- package/lib/types/components/HelpMenu.js +15 -4
- package/lib/types/components/LoadedContextPanel.js +1 -1
- package/lib/types/components/LogoV2.d.ts +3 -1
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +2 -2
- package/lib/types/components/MessageList.d.ts +6 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +22 -13
- package/lib/types/components/ModelPicker.js +2 -2
- package/lib/types/components/PromptInput.d.ts +1 -1
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +83 -18
- package/lib/types/components/SkillsPicker.js +2 -2
- package/lib/types/components/SplitDiffView.d.ts +2 -17
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +9 -162
- package/lib/types/components/StreamingMarkdown.js +1 -1
- package/lib/types/components/SubagentCard.d.ts +9 -0
- package/lib/types/components/SubagentCard.d.ts.map +1 -0
- package/lib/types/components/SubagentCard.js +26 -0
- package/lib/types/components/SubagentDashboard.d.ts +13 -0
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -0
- package/lib/types/components/SubagentDashboard.js +50 -0
- package/lib/types/components/SubagentDetailScene.d.ts +16 -0
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -0
- package/lib/types/components/SubagentDetailScene.js +141 -0
- package/lib/types/components/SyntaxText.d.ts +15 -0
- package/lib/types/components/SyntaxText.d.ts.map +1 -0
- package/lib/types/components/SyntaxText.js +34 -0
- package/lib/types/components/ThinkingToggle.d.ts +3 -10
- package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
- package/lib/types/components/ThinkingToggle.js +4 -9
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
- package/lib/types/components/design-system/ListItem.js +1 -1
- package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -1
- package/lib/types/components/design-system/ThemedBox.js +4 -1
- package/lib/types/components/design-system/ThemedText.js +2 -2
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +12 -6
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +37 -10
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +71 -18
- package/lib/types/components/messages/UserPromptMessage.d.ts +4 -6
- package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -1
- package/lib/types/components/messages/UserPromptMessage.js +19 -10
- package/lib/types/dsh-adapter/channel.d.ts +58 -2
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +337 -7
- package/lib/types/dsh-adapter/contract.d.ts +27 -4
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +56 -10
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +9 -3
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +38 -0
- package/lib/types/dsh-adapter/shortcuts.js +3 -3
- package/lib/types/dsh-adapter/subagents.d.ts +87 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -0
- package/lib/types/dsh-adapter/subagents.js +204 -0
- package/lib/types/herdr.d.ts +28 -0
- package/lib/types/herdr.d.ts.map +1 -0
- package/lib/types/herdr.js +133 -0
- package/lib/types/i18n.d.ts +215 -31
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +65 -14
- package/lib/types/ink/ink.d.ts +4 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +46 -15
- package/lib/types/minimalMode.d.ts +13 -0
- package/lib/types/minimalMode.d.ts.map +1 -0
- package/lib/types/minimalMode.js +17 -0
- package/lib/types/screens/Chat.d.ts +1 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +95 -45
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +6 -2
- package/lib/types/screens/TrajectoryScene.d.ts.map +1 -1
- package/lib/types/screens/TrajectoryScene.js +4 -2
- package/lib/types/theme.d.ts +20 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +77 -23
- package/lib/types/tips.js +3 -3
- package/lib/types/trajectory/effortIgnition.d.ts +66 -0
- package/lib/types/trajectory/effortIgnition.d.ts.map +1 -0
- package/lib/types/trajectory/effortIgnition.js +142 -0
- package/lib/types/update.d.ts +18 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +73 -2
- package/lib/types/utils/execFileNoThrow.d.ts +3 -20
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
- package/lib/types/utils/execFileNoThrow.js +53 -32
- package/lib/types/utils/externalEditor.d.ts +12 -11
- package/lib/types/utils/externalEditor.d.ts.map +1 -1
- package/lib/types/utils/externalEditor.js +11 -11
- 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 +64 -58
- 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,43 @@
|
|
|
1
|
-
|
|
1
|
+
/** Primary validated upstream line (newest). */
|
|
2
|
+
export declare const UPSTREAM_VALIDATED_VERSION = "0.1.0-rc.8";
|
|
3
|
+
/** Every upstream rc line the adapter has been validated against.
|
|
4
|
+
*
|
|
5
|
+
* rc.8 = primary; rc.7 = previous line (full CI coverage); rc.6 = legacy
|
|
6
|
+
* line (install- and type-level compatibility, feature surface may lack
|
|
7
|
+
* rc.7/rc.8 additions — new features must degrade gracefully there).
|
|
8
|
+
* The peer range in package.json is deliberately wider than this list: an
|
|
9
|
+
* install on an older line is allowed but reports drift at boot.
|
|
10
|
+
*/
|
|
11
|
+
export declare const UPSTREAM_VALIDATED_RC_LINES: readonly [6, 7, 8];
|
|
2
12
|
/**
|
|
3
13
|
* Framework packages version on their own lines; the contract validates
|
|
4
14
|
* their MAJOR (breaking surface), not the harness rc number.
|
|
5
15
|
*/
|
|
6
16
|
export declare const UPSTREAM_FRAMEWORK_MAJORS: Record<string, number>;
|
|
7
17
|
/** Official packages the adapter consumes at runtime or as types. */
|
|
8
|
-
export declare const UPSTREAM_BLESSED_PACKAGES: readonly ["@deepseek-ai/cordis", "@deepseek-ai/schemastery", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-presets", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-commands", "@deepseek-ai/dsh-cordis-host-runner", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-persona", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-storage", "@deepseek-ai/dsh-storage-domain", "@deepseek-ai/dsh-storage-json", "@deepseek-ai/dsh-workspace", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-terminal", "@deepseek-ai/dsh-terminal-bash", "@deepseek-ai/dsh-tool-ask-user", "@deepseek-ai/dsh-tool-bash-persistent", "@deepseek-ai/dsh-tool-cordis", "@deepseek-ai/dsh-user-approval", "@deepseek-ai/dsh-user-questions"];
|
|
18
|
+
export declare const UPSTREAM_BLESSED_PACKAGES: readonly ["@deepseek-ai/cordis", "@deepseek-ai/schemastery", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-presets", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-commands", "@deepseek-ai/dsh-cordis-host-runner", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-persona", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-storage", "@deepseek-ai/dsh-storage-domain", "@deepseek-ai/dsh-storage-json", "@deepseek-ai/dsh-workspace", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-terminal", "@deepseek-ai/dsh-terminal-bash", "@deepseek-ai/dsh-tool-ask-user", "@deepseek-ai/dsh-tool-bash-persistent", "@deepseek-ai/dsh-tool-cordis", "@deepseek-ai/dsh-user-approval", "@deepseek-ai/dsh-user-questions"];
|
|
9
19
|
export interface UpstreamDriftEntry {
|
|
10
20
|
package: string;
|
|
11
21
|
installed: string | undefined;
|
|
12
22
|
validated: string;
|
|
13
23
|
}
|
|
24
|
+
/** Human-readable summary of the validated lines, e.g. `0.1.0-rc.8 (rc.6/rc.7/rc.8)`. */
|
|
25
|
+
export declare const UPSTREAM_VALIDATED_LABEL: string;
|
|
14
26
|
export declare function installedUpstreamVersions(): Record<string, string | undefined>;
|
|
27
|
+
/** The installed upstream rc line of one blessed package (undefined when
|
|
28
|
+
* missing or not on the 0.1.0-rc line). Feature gates compare this against
|
|
29
|
+
* the line a behavior was introduced on, so the adapter degrades on older
|
|
30
|
+
* installs instead of calling APIs they do not have. */
|
|
31
|
+
export declare function installedLineOf(packageName: string): number | undefined;
|
|
32
|
+
/** The distinct upstream rc lines installed across the blessed harness
|
|
33
|
+
* packages (framework packages excluded). One line = coherent install;
|
|
34
|
+
* several = a mixed tree, which the per-package drift check cannot see.
|
|
35
|
+
* Empty when nothing (or no harness package) is installed. */
|
|
36
|
+
export declare function installedUpstreamLines(): number[];
|
|
15
37
|
/**
|
|
16
|
-
* Report every blessed package whose installed version is NOT the
|
|
17
|
-
* release
|
|
38
|
+
* Report every blessed package whose installed version is NOT one of the
|
|
39
|
+
* validated release lines. Empty array = the running install matches the
|
|
40
|
+
* contract.
|
|
18
41
|
*/
|
|
19
42
|
export declare function upstreamDrift(): UpstreamDriftEntry[];
|
|
20
43
|
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/contract.ts"],"names":[],"mappings":"AAgBA,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,eAAe,CAAA;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,oBAAqB,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG5D,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,2zBA2B5B,CAAA;AAEV,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,yFAAyF;AACzF,eAAO,MAAM,wBAAwB,QAAmG,CAAA;AAYxI,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAqB9E;AAED;;;yDAGyD;AACzD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAOD;;;+DAG+D;AAC/D,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAQjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,kBAAkB,EAAE,CAuBpD"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Upstream compatibility contract.
|
|
3
3
|
*
|
|
4
|
-
* The TUI is validated against
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The TUI is validated against a set of upstream release lines — the
|
|
5
|
+
* current primary (0.1.0-rc.8) plus older lines kept in backward
|
|
6
|
+
* compatibility (0.1.0-rc.7, 0.1.0-rc.6). Every official package this
|
|
7
|
+
* adapter touches is blessed here; anything else must go through upstream
|
|
8
|
+
* channels or the adapter, never the UI.
|
|
7
9
|
*
|
|
8
10
|
* `upstreamDrift()` powers both the boot-time warning (dev visibility) and
|
|
9
11
|
* the CI gate (scripts/verify-upstream-contract.ts) so a mismatched
|
|
@@ -11,7 +13,17 @@
|
|
|
11
13
|
*/
|
|
12
14
|
import { readFileSync } from 'node:fs';
|
|
13
15
|
import { fileURLToPath } from 'node:url';
|
|
14
|
-
|
|
16
|
+
/** Primary validated upstream line (newest). */
|
|
17
|
+
export const UPSTREAM_VALIDATED_VERSION = '0.1.0-rc.8';
|
|
18
|
+
/** Every upstream rc line the adapter has been validated against.
|
|
19
|
+
*
|
|
20
|
+
* rc.8 = primary; rc.7 = previous line (full CI coverage); rc.6 = legacy
|
|
21
|
+
* line (install- and type-level compatibility, feature surface may lack
|
|
22
|
+
* rc.7/rc.8 additions — new features must degrade gracefully there).
|
|
23
|
+
* The peer range in package.json is deliberately wider than this list: an
|
|
24
|
+
* install on an older line is allowed but reports drift at boot.
|
|
25
|
+
*/
|
|
26
|
+
export const UPSTREAM_VALIDATED_RC_LINES = [6, 7, 8];
|
|
15
27
|
/**
|
|
16
28
|
* Framework packages version on their own lines; the contract validates
|
|
17
29
|
* their MAJOR (breaking surface), not the harness rc number.
|
|
@@ -34,6 +46,7 @@ export const UPSTREAM_BLESSED_PACKAGES = [
|
|
|
34
46
|
'@deepseek-ai/dsh-llm',
|
|
35
47
|
'@deepseek-ai/dsh-persona',
|
|
36
48
|
'@deepseek-ai/dsh-session',
|
|
49
|
+
'@deepseek-ai/dsh-settings',
|
|
37
50
|
'@deepseek-ai/dsh-skill',
|
|
38
51
|
'@deepseek-ai/dsh-storage',
|
|
39
52
|
'@deepseek-ai/dsh-storage-domain',
|
|
@@ -48,6 +61,8 @@ export const UPSTREAM_BLESSED_PACKAGES = [
|
|
|
48
61
|
'@deepseek-ai/dsh-user-approval',
|
|
49
62
|
'@deepseek-ai/dsh-user-questions',
|
|
50
63
|
];
|
|
64
|
+
/** Human-readable summary of the validated lines, e.g. `0.1.0-rc.8 (rc.6/rc.7/rc.8)`. */
|
|
65
|
+
export const UPSTREAM_VALIDATED_LABEL = `${UPSTREAM_VALIDATED_VERSION} (${UPSTREAM_VALIDATED_RC_LINES.map((n) => `rc.${n}`).join('/')})`;
|
|
51
66
|
function resolvePackageJson(packageName) {
|
|
52
67
|
try {
|
|
53
68
|
const path = import.meta.resolve(`${packageName}/package.json`);
|
|
@@ -57,7 +72,13 @@ function resolvePackageJson(packageName) {
|
|
|
57
72
|
return undefined;
|
|
58
73
|
}
|
|
59
74
|
}
|
|
75
|
+
let cachedVersions;
|
|
60
76
|
export function installedUpstreamVersions() {
|
|
77
|
+
// Package manifests do not change mid-process; memoize so per-call gates
|
|
78
|
+
// (e.g. the command-images line check) stay cheap. Frozen so callers can
|
|
79
|
+
// never corrupt the shared cache.
|
|
80
|
+
if (cachedVersions !== undefined)
|
|
81
|
+
return cachedVersions;
|
|
61
82
|
const result = {};
|
|
62
83
|
for (const packageName of UPSTREAM_BLESSED_PACKAGES) {
|
|
63
84
|
let version;
|
|
@@ -73,15 +94,39 @@ export function installedUpstreamVersions() {
|
|
|
73
94
|
}
|
|
74
95
|
result[packageName] = version;
|
|
75
96
|
}
|
|
76
|
-
|
|
97
|
+
cachedVersions = Object.freeze(result);
|
|
98
|
+
return cachedVersions;
|
|
99
|
+
}
|
|
100
|
+
/** The installed upstream rc line of one blessed package (undefined when
|
|
101
|
+
* missing or not on the 0.1.0-rc line). Feature gates compare this against
|
|
102
|
+
* the line a behavior was introduced on, so the adapter degrades on older
|
|
103
|
+
* installs instead of calling APIs they do not have. */
|
|
104
|
+
export function installedLineOf(packageName) {
|
|
105
|
+
return rcNumber(installedUpstreamVersions()[packageName]);
|
|
77
106
|
}
|
|
78
107
|
function rcNumber(version) {
|
|
79
|
-
const match =
|
|
108
|
+
const match = /^0\.1\.0-rc\.(\d+)$/u.exec(version ?? '');
|
|
80
109
|
return match === null ? undefined : Number(match[1]);
|
|
81
110
|
}
|
|
111
|
+
/** The distinct upstream rc lines installed across the blessed harness
|
|
112
|
+
* packages (framework packages excluded). One line = coherent install;
|
|
113
|
+
* several = a mixed tree, which the per-package drift check cannot see.
|
|
114
|
+
* Empty when nothing (or no harness package) is installed. */
|
|
115
|
+
export function installedUpstreamLines() {
|
|
116
|
+
const lines = new Set();
|
|
117
|
+
for (const packageName of UPSTREAM_BLESSED_PACKAGES) {
|
|
118
|
+
if (UPSTREAM_FRAMEWORK_MAJORS[packageName] !== undefined)
|
|
119
|
+
continue;
|
|
120
|
+
const line = rcNumber(installedUpstreamVersions()[packageName]);
|
|
121
|
+
if (line !== undefined)
|
|
122
|
+
lines.add(line);
|
|
123
|
+
}
|
|
124
|
+
return [...lines].sort((a, b) => a - b);
|
|
125
|
+
}
|
|
82
126
|
/**
|
|
83
|
-
* Report every blessed package whose installed version is NOT the
|
|
84
|
-
* release
|
|
127
|
+
* Report every blessed package whose installed version is NOT one of the
|
|
128
|
+
* validated release lines. Empty array = the running install matches the
|
|
129
|
+
* contract.
|
|
85
130
|
*/
|
|
86
131
|
export function upstreamDrift() {
|
|
87
132
|
const drift = [];
|
|
@@ -96,13 +141,14 @@ export function upstreamDrift() {
|
|
|
96
141
|
matches = installedMajor === frameworkMajor;
|
|
97
142
|
}
|
|
98
143
|
else {
|
|
99
|
-
|
|
144
|
+
const installedLine = rcNumber(installed);
|
|
145
|
+
matches = installedLine !== undefined && UPSTREAM_VALIDATED_RC_LINES.includes(installedLine);
|
|
100
146
|
}
|
|
101
147
|
if (!matches) {
|
|
102
148
|
drift.push({
|
|
103
149
|
package: packageName,
|
|
104
150
|
installed,
|
|
105
|
-
validated: frameworkMajor !== undefined ? `major ${frameworkMajor}` :
|
|
151
|
+
validated: frameworkMajor !== undefined ? `major ${frameworkMajor}` : UPSTREAM_VALIDATED_LABEL,
|
|
106
152
|
});
|
|
107
153
|
}
|
|
108
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAErG,eAAO,MAAM,IAAI,YAAY,CAAA;AAU7B,eAAO,MAAM,MAAM,UAAa,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;yEAKqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;gDAC4C;IAC5C,K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EF;;;;;;GAMG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBvE"}
|
|
@@ -64,11 +64,17 @@ export const Config = Schema.object({
|
|
|
64
64
|
* @returns a promise settling when the TUI teardown completes.
|
|
65
65
|
*/
|
|
66
66
|
export async function apply(ctx, config) {
|
|
67
|
-
const { upstreamDrift,
|
|
67
|
+
const { upstreamDrift, installedUpstreamLines, UPSTREAM_VALIDATED_LABEL } = await import('./contract.js');
|
|
68
68
|
for (const entry of upstreamDrift()) {
|
|
69
69
|
console.warn(`[dsh-tui] upstream drift: ${entry.package} installed=${entry.installed ?? 'missing'} ` +
|
|
70
|
-
`validated=${
|
|
71
|
-
|
|
70
|
+
`validated=${entry.validated} — the TUI is validated against ${UPSTREAM_VALIDATED_LABEL}; ` +
|
|
71
|
+
`upgrade or downgrade the profile when the upstream line changes.`);
|
|
72
|
+
}
|
|
73
|
+
const installedLines = installedUpstreamLines();
|
|
74
|
+
if (installedLines.length > 1) {
|
|
75
|
+
console.warn(`[dsh-tui] mixed upstream lines detected (${installedLines.map(n => `rc.${n}`).join(', ')}) — ` +
|
|
76
|
+
`blessed packages are on different rc lines; the TUI is validated against ${UPSTREAM_VALIDATED_LABEL} ` +
|
|
77
|
+
`and a coherent install is strongly recommended.`);
|
|
72
78
|
}
|
|
73
79
|
const { apply: ccTuiApply } = await import('./plugin.js');
|
|
74
80
|
return ccTuiApply(ctx, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAA;AAGhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAA;AAGhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAqCnC;;;;;;;;GAQG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA60BvE;AA6GD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,GAAG;IACjF,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB,CAcA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,KAAK,GAAG,SAAS,CAAA;IAC5B,YAAY,EAAE,KAAK,CAAA;CACpB,GAAG,OAAO,CAQV"}
|
|
@@ -25,6 +25,7 @@ import { checkForTuiUpdate, installedTuiVersion, isBootDeadlockTarget, isVersion
|
|
|
25
25
|
import { getLang, isLang, resolveStartupLang, setLang, t, writeLangPref } from '../i18n.js';
|
|
26
26
|
import { DEFAULT_STATUS_BAR, normalizeStatusBar, normalizeToolBackground } from '../tuiDisplayPrefs.js';
|
|
27
27
|
import { detectLegacyEnv, migrateLegacyDataDir, RENAMED_ENV } from '../utils/paths.js';
|
|
28
|
+
import { attachHerdrIntegration } from '../herdr.js';
|
|
28
29
|
import { Chat } from '../screens/Chat.js';
|
|
29
30
|
import { getHostDialogStore } from './dialogs.js';
|
|
30
31
|
import { getHostStatusStore } from './status.js';
|
|
@@ -357,6 +358,11 @@ export async function apply(ctx, config) {
|
|
|
357
358
|
trajectory: Schema.boolean().default(DEFAULT_STATUS_BAR.trajectory),
|
|
358
359
|
shortcutHint: Schema.boolean().default(DEFAULT_STATUS_BAR.shortcutHint),
|
|
359
360
|
}).default({ ...DEFAULT_STATUS_BAR }),
|
|
361
|
+
// Header pixel whale art; on unless settings.yaml says otherwise.
|
|
362
|
+
whale: Schema.boolean().default(true),
|
|
363
|
+
// Minimal mode: strips the header splash, emoji glyphs, and
|
|
364
|
+
// decorative colors; code highlight and tool colors stay.
|
|
365
|
+
minimal: Schema.boolean().default(false),
|
|
360
366
|
// No default on purpose: an unset `lang` keeps the field showing
|
|
361
367
|
// the effective language (see the section's format below) and lets
|
|
362
368
|
// cordis.yml / lang.json keep their precedence.
|
|
@@ -365,6 +371,12 @@ export async function apply(ctx, config) {
|
|
|
365
371
|
const applyLayout = (value) => {
|
|
366
372
|
channel.setDiffLayout(value.diffLayout ?? config.diffLayout ?? 'auto');
|
|
367
373
|
};
|
|
374
|
+
const applyWhale = (value) => {
|
|
375
|
+
channel.setWhale(value.whale ?? true);
|
|
376
|
+
};
|
|
377
|
+
const applyMinimal = (value) => {
|
|
378
|
+
channel.setMinimal(value.minimal ?? false);
|
|
379
|
+
};
|
|
368
380
|
// The /settings language field writes `lang` through the settings
|
|
369
381
|
// service (user layer): apply it live and mirror it to lang.json so
|
|
370
382
|
// the /lang command and next-boot resolution agree. DSH_TUI_LANG
|
|
@@ -385,6 +397,8 @@ export async function apply(ctx, config) {
|
|
|
385
397
|
};
|
|
386
398
|
const apply = (next) => {
|
|
387
399
|
applyLayout(next);
|
|
400
|
+
applyWhale(next);
|
|
401
|
+
applyMinimal(next);
|
|
388
402
|
applyLang(next);
|
|
389
403
|
applyDisplay(next);
|
|
390
404
|
};
|
|
@@ -595,6 +609,22 @@ export async function apply(ctx, config) {
|
|
|
595
609
|
group: 'status-bar',
|
|
596
610
|
kind: 'boolean',
|
|
597
611
|
},
|
|
612
|
+
{
|
|
613
|
+
path: ['whale'],
|
|
614
|
+
label: 'Whale art',
|
|
615
|
+
descriptions: { zh: '鲸鱼娘' },
|
|
616
|
+
hint: 'Show the pixel whale in the header splash.',
|
|
617
|
+
hintDescriptions: { zh: '开屏头部显示像素鲸鱼娘。' },
|
|
618
|
+
kind: 'boolean',
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
path: ['minimal'],
|
|
622
|
+
label: 'Minimal mode',
|
|
623
|
+
descriptions: { zh: '极简模式' },
|
|
624
|
+
hint: 'Hide the header splash, emoji glyphs, and decorative colors; code highlight and tool colors stay. Trims the status bar to model + cwd.',
|
|
625
|
+
hintDescriptions: { zh: '隐藏开屏头部、emoji 状态符与装饰性配色;代码高亮与工具配色保留,底栏只留模型与目录。' },
|
|
626
|
+
kind: 'boolean',
|
|
627
|
+
},
|
|
598
628
|
],
|
|
599
629
|
});
|
|
600
630
|
ctx.effect(() => unregister);
|
|
@@ -612,6 +642,14 @@ export async function apply(ctx, config) {
|
|
|
612
642
|
ctx.on('approval/request', (req, next) => String(req.agent.id) === channel.agentId ? approvalStore.park(req) : next());
|
|
613
643
|
ctx.effect(() => () => approvalStore.settleAll('cancelled'));
|
|
614
644
|
}
|
|
645
|
+
const herdr = attachHerdrIntegration({
|
|
646
|
+
channel,
|
|
647
|
+
questions: questionStore,
|
|
648
|
+
approvals: approvalStore,
|
|
649
|
+
});
|
|
650
|
+
if (herdr !== undefined) {
|
|
651
|
+
ctx.effect(() => () => herdr.dispose());
|
|
652
|
+
}
|
|
615
653
|
// Positional command-line arguments are the initial prompt (issue #53):
|
|
616
654
|
// `dsh-tui "run the tests"` forwards positionals through the dsh CLI,
|
|
617
655
|
// which mounts them as ctx.cmdlineArgs. Submit once the channel exists —
|
|
@@ -43,9 +43,9 @@ const NAMED_KEYS = {
|
|
|
43
43
|
* Combos the TUI owns, globally or inside the prompt editor (the editor's
|
|
44
44
|
* bindings are checked AFTER plugin shortcuts, so refusing them here is
|
|
45
45
|
* what keeps "locals win" true). Built-in handlers match a MODIFIER SUBSET
|
|
46
|
-
* (`
|
|
46
|
+
* (`key.ctrl && input === 'g'` — they never exclude an extra Shift), so
|
|
47
47
|
* the reserved check below refuses a plugin combo whose SHIFTLESS form is
|
|
48
|
-
* reserved: ctrl+shift+
|
|
48
|
+
* reserved: ctrl+shift+g would shadow Ctrl+G on terminals that report both
|
|
49
49
|
* as the same keypress (ConPTY does), and would be dead weight on terminals
|
|
50
50
|
* that don't.
|
|
51
51
|
*/
|
|
@@ -54,7 +54,7 @@ const RESERVED_COMBOS = new Set([
|
|
|
54
54
|
'ctrl+d', // exit on empty input
|
|
55
55
|
'ctrl+t', // startup context panel
|
|
56
56
|
'ctrl+r', // history search
|
|
57
|
-
'ctrl+
|
|
57
|
+
'ctrl+g', // external editor
|
|
58
58
|
'ctrl+o', // transcript mode toggle
|
|
59
59
|
'ctrl+l', // terminal redraw
|
|
60
60
|
'ctrl+e', // show all messages / line end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Unified subagent activity domain model used by the adapter and every view. */
|
|
2
|
+
export type SubagentStatus = 'starting' | 'running' | 'completed' | 'failed' | 'cancelled' | 'unknown';
|
|
3
|
+
export type SubagentOutputKind = 'text' | 'thinking' | 'tool' | 'error' | 'system';
|
|
4
|
+
export interface SubagentOutputLine {
|
|
5
|
+
kind: SubagentOutputKind;
|
|
6
|
+
text: string;
|
|
7
|
+
at: number;
|
|
8
|
+
/** False while the line is still absorbing streaming deltas. */
|
|
9
|
+
settled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SubagentToolCall {
|
|
12
|
+
id?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
status: 'running' | 'completed' | 'failed';
|
|
15
|
+
startedAt: number;
|
|
16
|
+
endedAt?: number;
|
|
17
|
+
argsPreview?: string;
|
|
18
|
+
resultPreview?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SubagentTokenUsage {
|
|
22
|
+
input?: number;
|
|
23
|
+
output?: number;
|
|
24
|
+
total?: number;
|
|
25
|
+
context?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SubagentState {
|
|
28
|
+
agentId: string;
|
|
29
|
+
runId?: string;
|
|
30
|
+
description: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
effort?: string;
|
|
34
|
+
status: SubagentStatus;
|
|
35
|
+
startedAt: number;
|
|
36
|
+
completedAt?: number;
|
|
37
|
+
endedAt?: number;
|
|
38
|
+
local?: boolean;
|
|
39
|
+
parentSessionId?: string;
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
stopReason?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
/** Compatibility projection for older consumers. */
|
|
44
|
+
output: string[];
|
|
45
|
+
outputEvents: SubagentOutputLine[];
|
|
46
|
+
toolCalls: SubagentToolCall[];
|
|
47
|
+
tokens?: SubagentTokenUsage;
|
|
48
|
+
summary?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class SubagentActivityStore {
|
|
51
|
+
private states;
|
|
52
|
+
private sessionToAgent;
|
|
53
|
+
private listeners;
|
|
54
|
+
private commitLine;
|
|
55
|
+
private pushLine;
|
|
56
|
+
onSpawned(agentId: string, provider?: string, model?: string, info?: Partial<SubagentState>): void;
|
|
57
|
+
linkSession(agentId: string, session: unknown): void;
|
|
58
|
+
getSubagentIdBySession(session: unknown): string | undefined;
|
|
59
|
+
appendOutput(agentId: string, text: string, kind?: SubagentOutputKind): void;
|
|
60
|
+
/** Mark the streaming tail line complete (run settlement). */
|
|
61
|
+
flushOutput(agentId: string): void;
|
|
62
|
+
onSessionEvent(agentId: string, event: unknown): void;
|
|
63
|
+
/** Merge partial updates (model discovery, session id) into one subagent. */
|
|
64
|
+
patch(agentId: string, partial: Partial<SubagentState>): void;
|
|
65
|
+
/** One-line preview of a tool-result content block (text or item list). */
|
|
66
|
+
private previewOf;
|
|
67
|
+
recordTool(agentId: string, input: Partial<SubagentToolCall> & {
|
|
68
|
+
name?: string;
|
|
69
|
+
}): void;
|
|
70
|
+
setTokens(agentId: string, usage: {
|
|
71
|
+
inputTokens?: number;
|
|
72
|
+
outputTokens?: number;
|
|
73
|
+
input?: number;
|
|
74
|
+
output?: number;
|
|
75
|
+
total?: number;
|
|
76
|
+
context?: number;
|
|
77
|
+
}): void;
|
|
78
|
+
onCompleted(agentId: string, summary?: string, stopReason?: string): void;
|
|
79
|
+
onFailed(agentId: string, error: string): void;
|
|
80
|
+
onCancelled(agentId: string, reason?: string, summary?: string): void;
|
|
81
|
+
private finish;
|
|
82
|
+
snapshot(): SubagentState[];
|
|
83
|
+
get(agentId: string): SubagentState | undefined;
|
|
84
|
+
subscribe(listener: () => void): () => void;
|
|
85
|
+
private notify;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=subagents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagents.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/subagents.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;AACtG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AAElF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,C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K,EAAE,MAAM,GAAG,IAAI;IAC9C,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAE1E,OAAO,CAAC,MAAM;IAYd,QAAQ,IAAI,aAAa,EAAE;IAC3B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAC/C,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAC3C,OAAO,CAAC,MAAM;CACf"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/** Unified subagent activity domain model used by the adapter and every view. */
|
|
2
|
+
const MAX_OUTPUT_EVENTS = 160;
|
|
3
|
+
const MAX_OUTPUT_LINES = 160;
|
|
4
|
+
export class SubagentActivityStore {
|
|
5
|
+
states = new Map();
|
|
6
|
+
sessionToAgent = new Map();
|
|
7
|
+
listeners = new Set();
|
|
8
|
+
commitLine(agentId, kind, text) {
|
|
9
|
+
const state = this.states.get(agentId);
|
|
10
|
+
if (!state)
|
|
11
|
+
return;
|
|
12
|
+
this.pushLine(state, { kind, text, at: Date.now(), settled: true });
|
|
13
|
+
}
|
|
14
|
+
pushLine(state, line) {
|
|
15
|
+
state.outputEvents.push(line);
|
|
16
|
+
if (state.outputEvents.length > MAX_OUTPUT_EVENTS)
|
|
17
|
+
state.outputEvents.splice(0, state.outputEvents.length - MAX_OUTPUT_EVENTS);
|
|
18
|
+
state.output = state.outputEvents.map(entry => entry.text);
|
|
19
|
+
if (state.output.length > MAX_OUTPUT_LINES)
|
|
20
|
+
state.output.splice(0, state.output.length - MAX_OUTPUT_LINES);
|
|
21
|
+
}
|
|
22
|
+
onSpawned(agentId, provider = 'subagent', model, info = {}) {
|
|
23
|
+
const existing = this.states.get(agentId);
|
|
24
|
+
const state = existing ?? {
|
|
25
|
+
agentId,
|
|
26
|
+
runId: info.runId ?? agentId,
|
|
27
|
+
description: info.description ?? 'Subagent task',
|
|
28
|
+
provider,
|
|
29
|
+
model: model ?? info.model ?? provider,
|
|
30
|
+
effort: info.effort,
|
|
31
|
+
status: 'running',
|
|
32
|
+
startedAt: info.startedAt ?? Date.now(),
|
|
33
|
+
local: info.local,
|
|
34
|
+
parentSessionId: info.parentSessionId,
|
|
35
|
+
sessionId: info.sessionId,
|
|
36
|
+
output: [],
|
|
37
|
+
outputEvents: [],
|
|
38
|
+
toolCalls: [],
|
|
39
|
+
};
|
|
40
|
+
if (existing) {
|
|
41
|
+
Object.assign(existing, info, { provider, model: model ?? existing.model, status: existing.status === 'completed' ? existing.status : 'running' });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.states.set(agentId, state);
|
|
45
|
+
}
|
|
46
|
+
this.notify();
|
|
47
|
+
}
|
|
48
|
+
linkSession(agentId, session) {
|
|
49
|
+
if (session !== undefined && session !== null)
|
|
50
|
+
this.sessionToAgent.set(session, agentId);
|
|
51
|
+
const state = this.states.get(agentId);
|
|
52
|
+
if (state && typeof session === 'string')
|
|
53
|
+
state.sessionId = session;
|
|
54
|
+
}
|
|
55
|
+
getSubagentIdBySession(session) { return this.sessionToAgent.get(session); }
|
|
56
|
+
appendOutput(agentId, text, kind = 'text') {
|
|
57
|
+
const state = this.states.get(agentId);
|
|
58
|
+
if (!state || !text)
|
|
59
|
+
return;
|
|
60
|
+
const last = state.outputEvents[state.outputEvents.length - 1];
|
|
61
|
+
if (last === undefined || last.settled || last.kind !== kind) {
|
|
62
|
+
if (last !== undefined && !last.settled)
|
|
63
|
+
last.settled = true;
|
|
64
|
+
this.pushLine(state, { kind, text, at: Date.now(), settled: false });
|
|
65
|
+
this.notify();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
last.text += text;
|
|
69
|
+
const parts = last.text.split('\n');
|
|
70
|
+
if (parts.length > 1) {
|
|
71
|
+
last.text = parts[0];
|
|
72
|
+
last.settled = true;
|
|
73
|
+
for (const middle of parts.slice(1, -1)) {
|
|
74
|
+
this.pushLine(state, { kind, text: middle, at: Date.now(), settled: true });
|
|
75
|
+
}
|
|
76
|
+
const tail = parts[parts.length - 1] ?? '';
|
|
77
|
+
if (tail)
|
|
78
|
+
this.pushLine(state, { kind, text: tail, at: Date.now(), settled: false });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
state.output = state.outputEvents.map(entry => entry.text);
|
|
82
|
+
}
|
|
83
|
+
this.notify();
|
|
84
|
+
}
|
|
85
|
+
/** Mark the streaming tail line complete (run settlement). */
|
|
86
|
+
flushOutput(agentId) {
|
|
87
|
+
const state = this.states.get(agentId);
|
|
88
|
+
const last = state?.outputEvents[state.outputEvents.length - 1];
|
|
89
|
+
if (last !== undefined && !last.settled) {
|
|
90
|
+
last.settled = true;
|
|
91
|
+
this.notify();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
onSessionEvent(agentId, event) {
|
|
95
|
+
if (!event || typeof event !== 'object')
|
|
96
|
+
return;
|
|
97
|
+
const ev = event;
|
|
98
|
+
const data = ev.data ?? {};
|
|
99
|
+
switch (ev.type) {
|
|
100
|
+
case 'assistant/chunk': {
|
|
101
|
+
const chunk = data.chunk ?? {};
|
|
102
|
+
if (chunk.type === 'text-delta' && chunk.text)
|
|
103
|
+
this.appendOutput(agentId, chunk.text, 'text');
|
|
104
|
+
else if (chunk.type === 'reasoning-delta' && chunk.text)
|
|
105
|
+
this.appendOutput(agentId, chunk.text, 'thinking');
|
|
106
|
+
else if (chunk.type === 'usage' && chunk.usage)
|
|
107
|
+
this.setTokens(agentId, chunk.usage);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case 'assistant/message': {
|
|
111
|
+
if (data.usage)
|
|
112
|
+
this.setTokens(agentId, data.usage);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case 'tool/call': {
|
|
116
|
+
this.recordTool(agentId, { id: data.callId, name: data.name, status: 'running', startedAt: Date.now(), argsPreview: data.arguments });
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case 'tool/result': {
|
|
120
|
+
const callId = data?.message?.source?.callId;
|
|
121
|
+
const state = this.states.get(agentId);
|
|
122
|
+
const tool = callId !== undefined ? state?.toolCalls.find(entry => entry.id === callId) : undefined;
|
|
123
|
+
if (tool) {
|
|
124
|
+
tool.status = data.error !== undefined ? 'failed' : 'completed';
|
|
125
|
+
tool.endedAt = Date.now();
|
|
126
|
+
if (data.error !== undefined)
|
|
127
|
+
tool.error = String(data.error);
|
|
128
|
+
else {
|
|
129
|
+
const block = data.message?.content?.[0];
|
|
130
|
+
tool.resultPreview = block !== undefined && block.type === 'tool-result'
|
|
131
|
+
? this.previewOf(block.content)
|
|
132
|
+
: undefined;
|
|
133
|
+
}
|
|
134
|
+
this.notify();
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
default:
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Merge partial updates (model discovery, session id) into one subagent. */
|
|
143
|
+
patch(agentId, partial) {
|
|
144
|
+
const state = this.states.get(agentId);
|
|
145
|
+
if (!state)
|
|
146
|
+
return;
|
|
147
|
+
Object.assign(state, partial);
|
|
148
|
+
this.notify();
|
|
149
|
+
}
|
|
150
|
+
/** One-line preview of a tool-result content block (text or item list). */
|
|
151
|
+
previewOf(content) {
|
|
152
|
+
const text = typeof content === 'string'
|
|
153
|
+
? content
|
|
154
|
+
: Array.isArray(content)
|
|
155
|
+
? content.map(item => (typeof item === 'object' && item !== null && 'text' in item ? String(item.text ?? '') : '')).join(' ')
|
|
156
|
+
: '';
|
|
157
|
+
const flat = text.replace(/\s+/g, ' ').trim();
|
|
158
|
+
return flat ? (flat.length > 80 ? `${flat.slice(0, 80)}…` : flat) : undefined;
|
|
159
|
+
}
|
|
160
|
+
recordTool(agentId, input) {
|
|
161
|
+
const state = this.states.get(agentId);
|
|
162
|
+
if (!state || !input.name)
|
|
163
|
+
return;
|
|
164
|
+
const current = input.id ? state.toolCalls.find(tool => tool.id === input.id) : undefined;
|
|
165
|
+
if (current)
|
|
166
|
+
Object.assign(current, input);
|
|
167
|
+
else
|
|
168
|
+
state.toolCalls.push({ name: input.name, status: input.status ?? 'completed', startedAt: input.startedAt ?? Date.now(), ...input });
|
|
169
|
+
this.notify();
|
|
170
|
+
}
|
|
171
|
+
setTokens(agentId, usage) {
|
|
172
|
+
const state = this.states.get(agentId);
|
|
173
|
+
if (!state)
|
|
174
|
+
return;
|
|
175
|
+
const input = usage.input ?? usage.inputTokens;
|
|
176
|
+
const output = usage.output ?? usage.outputTokens;
|
|
177
|
+
if (input === undefined && output === undefined && usage.total === undefined)
|
|
178
|
+
return;
|
|
179
|
+
state.tokens = { ...state.tokens, input, output, total: usage.total ?? ((input ?? 0) + (output ?? 0) || undefined) };
|
|
180
|
+
this.notify();
|
|
181
|
+
}
|
|
182
|
+
onCompleted(agentId, summary, stopReason = 'completed') { this.finish(agentId, 'completed', stopReason, summary); }
|
|
183
|
+
onFailed(agentId, error) { this.finish(agentId, 'failed', error, undefined); }
|
|
184
|
+
onCancelled(agentId, reason = 'cancelled', summary) { this.finish(agentId, 'cancelled', reason, summary); }
|
|
185
|
+
finish(agentId, status, reason, summary) {
|
|
186
|
+
const state = this.states.get(agentId);
|
|
187
|
+
if (!state || (state.status !== 'running' && state.status !== 'starting'))
|
|
188
|
+
return;
|
|
189
|
+
state.status = status;
|
|
190
|
+
state.completedAt = Date.now();
|
|
191
|
+
state.endedAt = state.completedAt;
|
|
192
|
+
state.stopReason = reason;
|
|
193
|
+
if (summary)
|
|
194
|
+
state.summary = summary;
|
|
195
|
+
if (status === 'failed')
|
|
196
|
+
state.error = reason;
|
|
197
|
+
this.notify();
|
|
198
|
+
}
|
|
199
|
+
snapshot() { return Array.from(this.states.values()).map(state => ({ ...state, output: [...state.output], outputEvents: [...state.outputEvents], toolCalls: state.toolCalls.map(tool => ({ ...tool })), tokens: state.tokens ? { ...state.tokens } : undefined })); }
|
|
200
|
+
get(agentId) { return this.snapshot().find(state => state.agentId === agentId); }
|
|
201
|
+
subscribe(listener) { this.listeners.add(listener); return () => this.listeners.delete(listener); }
|
|
202
|
+
notify() { for (const listener of this.listeners)
|
|
203
|
+
listener(); }
|
|
204
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ExecFileNoThrowResult } from './utils/execFileNoThrow.js';
|
|
2
|
+
interface HerdrChannel {
|
|
3
|
+
readonly working: boolean;
|
|
4
|
+
subscribe(listener: () => void): () => void;
|
|
5
|
+
}
|
|
6
|
+
interface BlockingStore {
|
|
7
|
+
subscribe(listener: () => void): () => void;
|
|
8
|
+
getSnapshot(): unknown | null;
|
|
9
|
+
}
|
|
10
|
+
type RunCommand = (file: string, args: readonly string[]) => Promise<ExecFileNoThrowResult>;
|
|
11
|
+
export interface HerdrIntegration {
|
|
12
|
+
settled(): Promise<void>;
|
|
13
|
+
dispose(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface HerdrIntegrationOptions {
|
|
16
|
+
readonly channel: HerdrChannel;
|
|
17
|
+
readonly questions: BlockingStore;
|
|
18
|
+
readonly approvals: BlockingStore;
|
|
19
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
20
|
+
readonly run?: RunCommand;
|
|
21
|
+
readonly reportTimeoutMs?: number;
|
|
22
|
+
readonly releaseTimeoutMs?: number;
|
|
23
|
+
readonly retryDelaysMs?: readonly number[];
|
|
24
|
+
}
|
|
25
|
+
/** Report this TUI's lifecycle to the owning Herdr pane when Herdr launches it. */
|
|
26
|
+
export declare function attachHerdrIntegration(options: HerdrIntegrationOptions): HerdrIntegration | undefined;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=herdr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herdr.d.ts","sourceRoot":"","sources":["../../src/herdr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAQxF,UAAU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