@waq666/pneuma 0.7.1 → 0.8.1
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 +242 -206
- package/bin/dsc.js +9 -3
- package/bin/headless.cjs +1 -1
- package/lib/adapter/transcript.d.ts +19 -2
- package/lib/adapter/transcript.js +71 -14
- package/lib/app/AgentsOverlay.js +7 -6
- package/lib/app/App.js +1 -1
- package/lib/app/ApprovalCard.js +15 -9
- package/lib/app/ChatView.d.ts +3 -1
- package/lib/app/ChatView.js +21 -17
- package/lib/app/Composer.js +22 -4
- package/lib/app/MarkdownView.js +2 -1
- package/lib/app/ModelPicker.js +7 -6
- package/lib/app/PickerFrame.d.ts +4 -0
- package/lib/app/PickerFrame.js +18 -0
- package/lib/app/PlanReviewCard.js +2 -1
- package/lib/app/PresetPicker.js +8 -7
- package/lib/app/SessionPicker.js +21 -20
- package/lib/app/SettingsOverlay.js +1 -1
- package/lib/app/SkillsPicker.js +7 -6
- package/lib/app/StatusBar.js +3 -15
- package/lib/app/TaskStrips.js +1 -4
- package/lib/app/TimelineRail.js +2 -1
- package/lib/app/ToolCard.js +2 -6
- package/lib/app/Welcome.d.ts +1 -0
- package/lib/app/Welcome.js +1 -4
- package/lib/app/click.d.ts +0 -2
- package/lib/app/click.js +2 -21
- package/lib/app/display-width.d.ts +16 -0
- package/lib/app/display-width.js +33 -0
- package/lib/app/markdown.d.ts +1 -3
- package/lib/app/markdown.js +2 -19
- package/lib/app/scroll-model.js +1 -1
- package/lib/contract/approval.d.ts +91 -0
- package/lib/contract/approval.js +1 -0
- package/lib/contract/mode.d.ts +69 -0
- package/lib/contract/mode.js +1 -0
- package/lib/contract/plugin.d.ts +240 -0
- package/lib/contract/plugin.js +1 -0
- package/lib/contract/runtime.d.ts +282 -0
- package/lib/contract/runtime.js +1 -0
- package/lib/contract/session.d.ts +208 -0
- package/lib/contract/session.js +36 -0
- package/lib/contract/settings.d.ts +242 -0
- package/lib/contract/settings.js +1 -0
- package/lib/contract/snapshot.d.ts +453 -0
- package/lib/contract/snapshot.js +1 -0
- package/lib/contract/task.d.ts +189 -0
- package/lib/contract/task.js +10 -0
- package/lib/contract/transcript.d.ts +358 -0
- package/lib/contract/transcript.js +1 -0
- package/lib/contract/usage.d.ts +132 -0
- package/lib/contract/usage.js +10 -0
- package/lib/contract.d.ts +20 -1968
- package/lib/contract.js +19 -30
- package/lib/core/agent-roles.d.ts +1 -1
- package/lib/core/agent-roles.js +6 -5
- package/lib/core/approval-floor.d.ts +9 -0
- package/lib/core/approval-floor.js +152 -25
- package/lib/core/attachments.d.ts +185 -0
- package/lib/core/attachments.js +425 -0
- package/lib/core/bytes.d.ts +14 -0
- package/lib/core/bytes.js +28 -0
- package/lib/core/call-meaning.d.ts +20 -0
- package/lib/core/call-meaning.js +347 -0
- package/lib/core/cdp/actions.js +6 -0
- package/lib/core/cdp/launch.js +2 -2
- package/lib/core/cdp/report.d.ts +27 -0
- package/lib/core/cdp/report.js +50 -0
- package/lib/core/cdp/ring-buffer.d.ts +25 -0
- package/lib/core/cdp/ring-buffer.js +44 -0
- package/lib/core/cdp/snapshot.js +5 -9
- package/lib/core/cdp/transport.js +1 -1
- package/lib/core/clamp.d.ts +20 -0
- package/lib/core/clamp.js +24 -0
- package/lib/core/clock.d.ts +16 -0
- package/lib/core/clock.js +20 -0
- package/lib/core/command-policy.js +33 -1
- package/lib/core/commands-completion.d.ts +28 -0
- package/lib/core/commands-completion.js +108 -30
- package/lib/core/compact.d.ts +36 -6
- package/lib/core/compact.js +89 -17
- package/lib/core/desktop-control.js +1 -3
- package/lib/core/dsh-compat/llm-usage-event.d.ts +78 -0
- package/lib/core/dsh-compat/llm-usage-event.js +91 -0
- package/lib/core/dsh-compat/presentation.d.ts +84 -0
- package/lib/core/dsh-compat/presentation.js +105 -0
- package/lib/core/dsh-compat/resolve-hook.d.ts +3 -3
- package/lib/core/dsh-compat/resolve-hook.js +41 -13
- package/lib/core/dsh-compat/service-map.d.ts +52 -0
- package/lib/core/dsh-compat/service-map.js +87 -0
- package/lib/core/dsh-compat/session-bridge.d.ts +107 -0
- package/lib/core/dsh-compat/session-bridge.js +376 -0
- package/lib/core/dsh-compat/session-events.d.ts +54 -0
- package/lib/core/dsh-compat/session-events.js +297 -0
- package/lib/core/dsh-compat/shims/credentials.d.ts +62 -0
- package/lib/core/dsh-compat/shims/credentials.js +86 -0
- package/lib/core/dsh-compat/shims/home-paths.d.ts +77 -0
- package/lib/core/dsh-compat/shims/home-paths.js +143 -0
- package/lib/core/dsh-compat/tools-facade.d.ts +31 -1
- package/lib/core/dsh-compat/tools-facade.js +207 -3
- package/lib/core/err-text.d.ts +5 -0
- package/lib/core/err-text.js +5 -0
- package/lib/core/events.d.ts +31 -2
- package/lib/core/git-info.d.ts +127 -15
- package/lib/core/git-info.js +315 -34
- package/lib/core/git-surface.d.ts +17 -0
- package/lib/core/git-surface.js +7 -0
- package/lib/core/hooks.d.ts +19 -2
- package/lib/core/hooks.js +57 -13
- package/lib/core/host-methods.d.ts +1 -1
- package/lib/core/host-methods.js +4 -0
- package/lib/core/image-diet.js +1 -4
- package/lib/core/json-text.d.ts +11 -0
- package/lib/core/json-text.js +18 -0
- package/lib/core/learnings/skill-write.d.ts +1 -7
- package/lib/core/learnings/skill-write.js +3 -37
- package/lib/core/lifecycle-hooks.d.ts +11 -3
- package/lib/core/lifecycle-hooks.js +33 -42
- package/lib/core/llm.d.ts +42 -0
- package/lib/core/llm.js +40 -25
- package/lib/core/loop.d.ts +11 -1
- package/lib/core/loop.js +95 -28
- package/lib/core/lsp/client.js +30 -17
- package/lib/core/lsp/normalize.d.ts +0 -2
- package/lib/core/lsp/normalize.js +1 -6
- package/lib/core/lsp/servers.js +1 -4
- package/lib/core/mcp.d.ts +18 -0
- package/lib/core/mcp.js +60 -16
- package/lib/core/microcompact.d.ts +45 -0
- package/lib/core/microcompact.js +128 -0
- package/lib/core/native-bridge.js +2 -10
- package/lib/core/path-policy.d.ts +13 -1
- package/lib/core/path-policy.js +87 -18
- package/lib/core/permission-presets.d.ts +9 -5
- package/lib/core/permission-presets.js +14 -7
- package/lib/core/permission-scope.d.ts +65 -0
- package/lib/core/permission-scope.js +109 -0
- package/lib/core/plugin-bundle.d.ts +95 -0
- package/lib/core/plugin-bundle.js +137 -0
- package/lib/core/plugin-loader.d.ts +36 -1
- package/lib/core/plugin-loader.js +336 -12
- package/lib/core/plugin-patch.d.ts +64 -0
- package/lib/core/plugin-patch.js +146 -0
- package/lib/core/plugin-registry.d.ts +14 -0
- package/lib/core/plugin-registry.js +2 -0
- package/lib/core/prefs.js +40 -2
- package/lib/core/presets.d.ts +11 -0
- package/lib/core/presets.js +61 -22
- package/lib/core/profile-dir.d.ts +5 -0
- package/lib/core/profile-dir.js +40 -0
- package/lib/core/prompt.js +55 -19
- package/lib/core/ptc.d.ts +8 -2
- package/lib/core/ptc.js +18 -4
- package/lib/core/records.d.ts +16 -0
- package/lib/core/records.js +22 -0
- package/lib/core/remote/notify.js +1 -3
- package/lib/core/remote/push.js +2 -6
- package/lib/core/sandbox/execpolicy.js +27 -3
- package/lib/core/sandbox/net-proxy.js +2 -2
- package/lib/core/sandbox/policy.d.ts +1 -1
- package/lib/core/sandbox/policy.js +21 -15
- package/lib/core/sandbox/win/account.js +1 -4
- package/lib/core/sandbox/win/acl.js +1 -6
- package/lib/core/sandbox/win/backend.d.ts +24 -3
- package/lib/core/sandbox/win/backend.js +73 -23
- package/lib/core/sandbox/win/doctor.js +1 -4
- package/lib/core/sandbox/win/runner-entry.js +1 -6
- package/lib/core/sandbox/win/setup.js +1 -4
- package/lib/core/sandbox/win/utf16.d.ts +11 -0
- package/lib/core/sandbox/win/utf16.js +15 -0
- package/lib/core/sandbox/win/wfp.js +1 -4
- package/lib/core/schedule/rule.d.ts +0 -17
- package/lib/core/schedule/rule.js +1 -3
- package/lib/core/schedule/runner.d.ts +5 -2
- package/lib/core/schedule/runner.js +32 -9
- package/lib/core/schedule/store.d.ts +0 -2
- package/lib/core/schedule/store.js +2 -9
- package/lib/core/session-index.d.ts +50 -0
- package/lib/core/session-index.js +169 -3
- package/lib/core/session.d.ts +89 -13
- package/lib/core/session.js +385 -32
- package/lib/core/shell-quote.d.ts +21 -0
- package/lib/core/shell-quote.js +24 -0
- package/lib/core/side-ask.d.ts +52 -0
- package/lib/core/side-ask.js +89 -0
- package/lib/core/skills.d.ts +16 -0
- package/lib/core/skills.js +45 -8
- package/lib/core/snapshot-throttle.d.ts +8 -0
- package/lib/core/snapshot-throttle.js +24 -0
- package/lib/core/spill.d.ts +11 -5
- package/lib/core/spill.js +35 -36
- package/lib/core/strings.d.ts +21 -0
- package/lib/core/strings.js +33 -0
- package/lib/core/terminal-env.d.ts +61 -0
- package/lib/core/terminal-env.js +327 -0
- package/lib/core/text-format.d.ts +17 -0
- package/lib/core/text-format.js +26 -0
- package/lib/core/todo-reminder.d.ts +19 -14
- package/lib/core/todo-reminder.js +14 -23
- package/lib/core/token-estimate.d.ts +18 -2
- package/lib/core/token-estimate.js +10 -2
- package/lib/core/tool-result-prune.d.ts +42 -0
- package/lib/core/tool-result-prune.js +47 -0
- package/lib/core/tool-search.d.ts +3 -2
- package/lib/core/tool-search.js +3 -2
- package/lib/core/tools/bash.d.ts +35 -3
- package/lib/core/tools/bash.js +168 -41
- package/lib/core/tools/fs-tools.js +18 -17
- package/lib/core/tools/image-tool.d.ts +2 -0
- package/lib/core/tools/image-tool.js +59 -0
- package/lib/core/tools/path-args.d.ts +4 -0
- package/lib/core/tools/path-args.js +22 -0
- package/lib/core/tools/search-tools.d.ts +30 -0
- package/lib/core/tools/search-tools.js +321 -34
- package/lib/core/tools.d.ts +82 -0
- package/lib/core/tools.js +21 -0
- package/lib/core/transcript-text.d.ts +19 -0
- package/lib/core/transcript-text.js +44 -0
- package/lib/core/ui-boot-source.d.ts +5 -0
- package/lib/core/ui-boot-source.js +10 -3
- package/lib/core/ui-bundles.d.ts +80 -6
- package/lib/core/ui-bundles.js +700 -76
- package/lib/core/ui-events.d.ts +10 -0
- package/lib/core/ui-events.js +25 -0
- package/lib/core/ui-methods.d.ts +1 -1
- package/lib/core/ui-methods.js +42 -13
- package/lib/core/ui-route.js +11 -7
- package/lib/core/ui-server.d.ts +6 -0
- package/lib/core/ui-server.js +106 -1
- package/lib/core/unified-diff.d.ts +35 -0
- package/lib/core/unified-diff.js +86 -0
- package/lib/core/usage-log.js +39 -0
- package/lib/core/web-http.d.ts +1 -1
- package/lib/core/web-http.js +1 -3
- package/lib/host/kernel.js +57 -41
- package/lib/plugins/agent.js +101 -20
- package/lib/plugins/approval-floor.js +12 -8
- package/lib/plugins/approval.js +252 -80
- package/lib/plugins/ask.js +60 -8
- package/lib/plugins/browser.js +32 -84
- package/lib/plugins/commands.js +167 -57
- package/lib/plugins/compact.d.ts +2 -2
- package/lib/plugins/compact.js +200 -30
- package/lib/plugins/computer-use.js +34 -18
- package/lib/plugins/dock-browser.js +24 -65
- package/lib/plugins/dsh-compat.js +7 -0
- package/lib/plugins/file-review.js +59 -15
- package/lib/plugins/git.js +16 -8
- package/lib/plugins/goal.js +9 -8
- package/lib/plugins/hooks.js +4 -2
- package/lib/plugins/host-stdio.js +14 -16
- package/lib/plugins/lifecycle-hooks.d.ts +5 -4
- package/lib/plugins/lifecycle-hooks.js +12 -10
- package/lib/plugins/llm.js +74 -33
- package/lib/plugins/lsp.js +22 -27
- package/lib/plugins/mcp.js +16 -17
- package/lib/plugins/memory.js +3 -24
- package/lib/plugins/microcompact.d.ts +4 -1
- package/lib/plugins/microcompact.js +117 -19
- package/lib/plugins/mode.js +30 -11
- package/lib/plugins/permission-presets.d.ts +2 -1
- package/lib/plugins/permission-presets.js +55 -35
- package/lib/plugins/plugin-manager.js +4 -6
- package/lib/plugins/presets.js +56 -27
- package/lib/plugins/prompt.js +54 -11
- package/lib/plugins/ptc.d.ts +13 -0
- package/lib/plugins/ptc.js +121 -24
- package/lib/plugins/remote/types.d.ts +1 -1
- package/lib/plugins/remote/types.js +11 -0
- package/lib/plugins/remote.js +14 -15
- package/lib/plugins/runtime.js +91 -14
- package/lib/plugins/sandbox.js +181 -60
- package/lib/plugins/schedule.js +12 -11
- package/lib/plugins/self-improve.js +28 -18
- package/lib/plugins/session-search.js +18 -13
- package/lib/plugins/session-title.js +1 -1
- package/lib/plugins/session.js +103 -25
- package/lib/plugins/settings.js +16 -40
- package/lib/plugins/skills.js +18 -1
- package/lib/plugins/spill.js +18 -11
- package/lib/plugins/subagent.js +208 -42
- package/lib/plugins/team.js +11 -5
- package/lib/plugins/todo.d.ts +1 -1
- package/lib/plugins/todo.js +25 -19
- package/lib/plugins/tool-search.js +47 -28
- package/lib/plugins/tools-default.js +89 -5
- package/lib/plugins/tools.js +3 -3
- package/lib/plugins/transcript.js +116 -9
- package/lib/plugins/web-search.d.ts +1 -1
- package/lib/plugins/web-search.js +25 -16
- package/lib/plugins/webserver.js +40 -7
- package/lib/remote/assets/app-B3Id1EBq.js +14 -0
- package/lib/remote/assets/index.html +2 -2
- package/lib/remote/assets/{style-DIB6729x.css → style-NtlpbKOI.css} +1 -1
- package/lib/services/types.d.ts +247 -29
- package/lib/tools/plugin-cli.d.ts +1 -0
- package/lib/tools/plugin-cli.js +209 -0
- package/lib/ui/assets/app-B-Jx5dnh.js +90 -0
- package/lib/ui/assets/{chunk-BajyYBss.js → chunk-Bfdlo8Me.js} +1 -1
- package/lib/ui/assets/chunk-DGX-i4eb.js +12 -0
- package/lib/ui/assets/index.html +62 -14
- package/lib/ui/assets/style-WzxwEPaE.css +1 -0
- package/lib/ui/frames.js +1 -3
- package/lib/ui/index.d.ts +30 -1
- package/lib/ui/index.js +29 -0
- package/lib/ui/manifest.d.ts +24 -6
- package/lib/ui/manifest.js +3 -2
- package/lib/ui/plugins/actions/bundle.json +8 -0
- package/lib/ui/plugins/actions/client.js +43 -0
- package/lib/ui/plugins/ask/bundle.json +8 -0
- package/lib/ui/plugins/ask/client.js +415 -0
- package/lib/ui/plugins/browser/bundle.json +8 -0
- package/lib/ui/plugins/composer/bundle.json +9 -0
- package/lib/ui/plugins/composer/client.js +1806 -1087
- package/lib/ui/plugins/files/bundle.json +8 -0
- package/lib/ui/plugins/files/client.js +13 -98
- package/lib/ui/plugins/manifest.json +1 -104
- package/lib/ui/plugins/palette/bundle.json +8 -0
- package/lib/ui/plugins/palette/client.js +360 -0
- package/lib/ui/plugins/plugins/bundle.json +8 -0
- package/lib/ui/plugins/plugins/client.js +116 -38
- package/lib/ui/plugins/preview/bundle.json +8 -0
- package/lib/ui/plugins/preview/client.js +6 -16
- package/lib/ui/plugins/prompt/bundle.json +8 -0
- package/lib/ui/plugins/prompt/client.js +81 -47
- package/lib/ui/plugins/sessions/bundle.json +8 -0
- package/lib/ui/plugins/sessions/client.js +157 -111
- package/lib/ui/plugins/settings/bundle.json +8 -0
- package/lib/ui/plugins/settings/client.js +184 -170
- package/lib/ui/plugins/skills/bundle.json +8 -0
- package/lib/ui/plugins/skills/client.js +161 -79
- package/lib/ui/plugins/status/bundle.json +8 -0
- package/lib/ui/plugins/status/client.js +165 -26
- package/lib/ui/plugins/statusbar/bundle.json +9 -0
- package/lib/ui/plugins/statusbar/client.js +100 -144
- package/lib/ui/plugins/tasks/bundle.json +8 -0
- package/lib/ui/plugins/team/bundle.json +8 -0
- package/lib/ui/plugins/team/client.js +60 -58
- package/lib/ui/plugins/terminal/bundle.json +8 -0
- package/lib/ui/plugins/terminal/client.js +1 -7
- package/lib/ui/plugins/trace/bundle.json +11 -0
- package/lib/ui/plugins/trace/client.js +86 -179
- package/lib/ui/plugins/transcript/bundle.json +8 -0
- package/lib/ui/plugins/transcript/client.js +1608 -1243
- package/lib/ui/sdk/@dsc/ui/index.d.ts +54 -16
- package/lib/ui/sdk/@dsc/ui/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-core/contract.d.ts +20 -1968
- package/lib/ui/sdk/@dsc/ui-core/core/attachments.d.ts +185 -0
- package/lib/ui/sdk/@dsc/ui-core/core/bytes.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-core/core/err-text.d.ts +18 -0
- package/lib/ui/sdk/@dsc/ui-core/core/git-surface.d.ts +17 -0
- package/lib/ui/sdk/@dsc/ui-core/core/json-text.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-core/core/path-policy.d.ts +44 -0
- package/lib/ui/sdk/@dsc/ui-core/core/records.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-core/core/throughput.d.ts +46 -0
- package/lib/ui/sdk/@dsc/ui-core/core/token-estimate.d.ts +18 -2
- package/lib/ui/sdk/@dsc/ui-core/core/unified-diff.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-core/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-core/ui/index.d.ts +30 -1
- package/lib/ui/sdk/@dsc/ui-core/ui/manifest.d.ts +24 -6
- package/lib/ui/sdk/@dsc/ui-core/ui/services.d.ts +19 -8
- package/lib/ui/sdk/@dsc/ui-core/ui/signal.d.ts +49 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-model.d.ts +17 -3
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-state.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-dockkit/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/app.d.ts +4 -0
- package/lib/ui/sdk/@dsc/ui-layout/appearance.d.ts +6 -1
- package/lib/ui/sdk/@dsc/ui-layout/host-channel.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-layout/index.d.ts +1 -0
- package/lib/ui/sdk/@dsc/ui-layout/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/page-state.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/runtime-context.d.ts +10 -1
- package/lib/ui/sdk/@dsc/ui-layout/thread-view.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/usage-today.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-primitives/dialog-focus.d.ts +30 -0
- package/lib/ui/sdk/@dsc/ui-primitives/error-text.d.ts +12 -0
- package/lib/ui/sdk/@dsc/ui-primitives/git-surface.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/highlight.d.ts +23 -0
- package/lib/ui/sdk/@dsc/ui-primitives/humanize-error.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons-workspace.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +21 -3
- package/lib/ui/sdk/@dsc/ui-primitives/image-lightbox.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/markdown.d.ts +10 -14
- package/lib/ui/sdk/@dsc/ui-primitives/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-primitives/panels.d.ts +31 -8
- package/lib/ui/sdk/@dsc/ui-primitives/paths.d.ts +2 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-findings-card.d.ts +25 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-findings.d.ts +64 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-notice-card.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-notice.d.ts +80 -0
- package/lib/ui/sdk/@dsc/ui-primitives/signal.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/sizes.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/skeleton.d.ts +39 -0
- package/lib/ui/sdk/@dsc/ui-primitives/snapshot.d.ts +46 -0
- package/lib/ui/sdk/@dsc/ui-primitives/thread-resizer.d.ts +3 -3
- package/lib/ui/sdk/@dsc/ui-primitives/throughput.d.ts +13 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tokens.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-args.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-primitives/tool-summary.d.ts +30 -6
- package/lib/ui/sdk/@dsc/ui-primitives/unified-diff.d.ts +10 -0
- package/lib/ui/sdk/@dsc/ui-renderer/boot.d.ts +10 -1
- package/lib/ui/sdk/@dsc/ui-renderer/cordis-host.d.ts +113 -0
- package/lib/ui/sdk/@dsc/ui-renderer/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-slots/package.json +1 -1
- package/lib/ui/services.d.ts +19 -8
- package/lib/ui/services.js +20 -12
- package/lib/ui/signal.d.ts +49 -0
- package/lib/ui/signal.js +57 -0
- package/lib/ui/tui-plugins.js +36 -16
- package/package.json +71 -58
- package/lib/remote/assets/app-DAcUCOEn.js +0 -14
- package/lib/ui/assets/app-B70nVIKd.js +0 -69
- package/lib/ui/assets/chunk-BGcgwlCI.js +0 -12
- package/lib/ui/assets/style-Bq01xH_b.css +0 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const react = require("react");
|
|
6
|
+
const uiPrimitives = require("@dsc/ui-primitives");
|
|
6
7
|
const ui$1 = require("@dsc/ui");
|
|
7
8
|
const ui = ui$1.defineUiPlugin({
|
|
8
9
|
name: "状态栏",
|
|
@@ -20,9 +21,10 @@ const TURN_TEXT = {
|
|
|
20
21
|
const EMPTY_STATUS = Object.freeze({});
|
|
21
22
|
function StatusSegments() {
|
|
22
23
|
const turnState = useStatusField(readTurnState);
|
|
24
|
+
const turnStartedAt = useStatusField(readTurnStartedAt);
|
|
23
25
|
const model = useStatusField(readModel);
|
|
24
26
|
const sessionId = useStatusField(readSessionId);
|
|
25
|
-
const tally = ui$1.useHostSelector(
|
|
27
|
+
const tally = ui$1.useHostSelector(readProgress);
|
|
26
28
|
const [rounds, steps] = tally.split("/");
|
|
27
29
|
const inputTokens = useStatusField(readUsageInput);
|
|
28
30
|
const outputTokens = useStatusField(readUsageOutput);
|
|
@@ -35,15 +37,14 @@ function StatusSegments() {
|
|
|
35
37
|
const segAssistant = useStatusField(readSegment("assistant"));
|
|
36
38
|
const segThinking = useStatusField(readSegment("thinking"));
|
|
37
39
|
const segTools = useStatusField(readSegment("tools"));
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
+
const segSchema = useStatusField(readSegment("schema"));
|
|
41
|
+
ui$1.useHostSelector(readActivityKey);
|
|
40
42
|
const settledTokens = (inputTokens ?? 0) + (outputTokens ?? 0);
|
|
41
43
|
const logged = useSessionUsage(sessionId, turnState, settledTokens);
|
|
42
|
-
const
|
|
43
|
-
const speed = logged === null ? null : tokensPerSecond(logged);
|
|
44
|
+
const speed = logged === null ? null : uiPrimitives.tokensPerSecond(logged);
|
|
44
45
|
const total = logged === null ? settledTokens : logged.inputTokens + logged.outputTokens;
|
|
45
46
|
const parts = [];
|
|
46
|
-
if (turnState !== null) {
|
|
47
|
+
if (turnState !== null && (Number(steps) > 0 || turnStartedAt !== null)) {
|
|
47
48
|
parts.push(
|
|
48
49
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
50
|
TurnSegment,
|
|
@@ -54,8 +55,8 @@ function StatusSegments() {
|
|
|
54
55
|
rounds: Number(rounds),
|
|
55
56
|
steps: Number(steps),
|
|
56
57
|
speed,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
startedAt: turnStartedAt,
|
|
59
|
+
logged
|
|
59
60
|
},
|
|
60
61
|
"turn"
|
|
61
62
|
)
|
|
@@ -75,7 +76,8 @@ function StatusSegments() {
|
|
|
75
76
|
)
|
|
76
77
|
);
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
const hasContextSample = logged !== null || settledTokens > 0 || contextUsed > 0;
|
|
80
|
+
if (contextWindow > 0 && hasContextSample) {
|
|
79
81
|
parts.push(
|
|
80
82
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
81
83
|
ContextSegment,
|
|
@@ -87,7 +89,8 @@ function StatusSegments() {
|
|
|
87
89
|
prompt: segPrompt,
|
|
88
90
|
assistant: segAssistant,
|
|
89
91
|
thinking: segThinking,
|
|
90
|
-
tools: segTools
|
|
92
|
+
tools: segTools,
|
|
93
|
+
schema: segSchema
|
|
91
94
|
}
|
|
92
95
|
},
|
|
93
96
|
"context"
|
|
@@ -99,13 +102,20 @@ function StatusSegments() {
|
|
|
99
102
|
}
|
|
100
103
|
function TurnSegment(props) {
|
|
101
104
|
const stateText = TURN_TEXT[props.turnState];
|
|
102
|
-
const startedAt = props.clock?.startedAt ?? null;
|
|
103
|
-
const lastActiveAt = props.clock?.lastActiveAt ?? null;
|
|
104
105
|
const logged = props.logged;
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const running = props.turnState !== "idle" && props.startedAt !== null;
|
|
107
|
+
const [now, setNow] = react.useState(() => Date.now());
|
|
108
|
+
react.useEffect(() => {
|
|
109
|
+
if (!running) return void 0;
|
|
110
|
+
setNow(Date.now());
|
|
111
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
112
|
+
return () => clearInterval(timer);
|
|
113
|
+
}, [running]);
|
|
114
|
+
const elapsed = running && props.startedAt !== null ? uiPrimitives.formatTraceDuration(Math.max(0, now - props.startedAt)) : null;
|
|
115
|
+
const ttft = logged === null ? null : uiPrimitives.averageTtftMs(logged);
|
|
116
|
+
const ttftText = ttft === null ? null : uiPrimitives.formatTraceDuration(ttft);
|
|
117
|
+
const toolText = logged === null || logged.toolCalls === 0 ? null : uiPrimitives.formatTraceDuration(logged.toolMs);
|
|
118
|
+
const llmText = logged === null || !(logged.llmMs > 0) ? null : uiPrimitives.formatTraceDuration(logged.llmMs);
|
|
109
119
|
const hint = [
|
|
110
120
|
`当前状态:${stateText}`,
|
|
111
121
|
props.sessionId === null ? null : `会话 ${props.sessionId.slice(0, 8)}`,
|
|
@@ -114,19 +124,21 @@ function TurnSegment(props) {
|
|
|
114
124
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "segment seg-turn seg-hover", children: [
|
|
115
125
|
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "ctx-trigger", title: `${hint};点开看轮次、步骤、速度与时间`, children: [
|
|
116
126
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `seg-icon state-${props.turnState}`, children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconActivity, { size: 12 }) }),
|
|
117
|
-
props.rounds,
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
props.steps > 0 ? `${String(props.rounds)} 轮 ${String(props.steps)} 步` : null,
|
|
128
|
+
elapsed !== null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "seg-dim", children: [
|
|
129
|
+
props.steps > 0 ? " · " : "",
|
|
130
|
+
"用时 ",
|
|
131
|
+
elapsed
|
|
132
|
+
] }),
|
|
121
133
|
props.speed !== null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "seg-dim", children: [
|
|
122
134
|
" · ",
|
|
123
|
-
formatTokensPerSecond(props.speed),
|
|
135
|
+
uiPrimitives.formatTokensPerSecond(props.speed),
|
|
124
136
|
" tok/s"
|
|
125
137
|
] })
|
|
126
138
|
] }),
|
|
127
139
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-card", role: "note", children: [
|
|
128
140
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-head", children: [
|
|
129
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-title", children: "
|
|
141
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-title", children: "会话统计" }),
|
|
130
142
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-numbers", children: [
|
|
131
143
|
props.rounds,
|
|
132
144
|
" 轮 · ",
|
|
@@ -136,14 +148,11 @@ function TurnSegment(props) {
|
|
|
136
148
|
] }),
|
|
137
149
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ctx-rule" }),
|
|
138
150
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-rows", children: [
|
|
139
|
-
/* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "
|
|
140
|
-
/* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "
|
|
141
|
-
|
|
142
|
-
ttftText !== null &&
|
|
143
|
-
|
|
144
|
-
toolText !== null && logged !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "工具耗时", value: `${toolText} · ${String(logged.toolCalls)} 次` }),
|
|
145
|
-
startedAt !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "会话开始", value: clockText(startedAt) }),
|
|
146
|
-
lastActiveAt !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "最近活动", value: `${clockText(lastActiveAt)}(${agoText(lastActiveAt)})` })
|
|
151
|
+
elapsed !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "本轮用时(进行中)", value: elapsed }),
|
|
152
|
+
llmText !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "模型用时", value: llmText }),
|
|
153
|
+
toolText !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "工具调用用时", value: toolText }),
|
|
154
|
+
ttftText !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "首 token 平均(TTFT)", value: ttftText }),
|
|
155
|
+
props.speed !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "输出速度(TPS)", value: `${uiPrimitives.formatTokensPerSecond(props.speed)} tok/s` })
|
|
147
156
|
] })
|
|
148
157
|
] })
|
|
149
158
|
] });
|
|
@@ -152,45 +161,48 @@ function TokenSegment(props) {
|
|
|
152
161
|
const logged = props.logged;
|
|
153
162
|
const input = logged?.inputTokens ?? props.snapshot.input;
|
|
154
163
|
const output = logged?.outputTokens ?? props.snapshot.output;
|
|
155
|
-
const requests = logged?.requests ?? null;
|
|
156
|
-
const lastAt = logged !== null && logged.lastAt > 0 ? logged.lastAt : null;
|
|
157
164
|
const cacheHit = logged !== null ? logged.cacheHitTokens : props.speedContext.cacheHit;
|
|
158
165
|
const cacheMiss = logged !== null ? logged.cacheMissTokens : props.speedContext.cacheMiss;
|
|
159
166
|
const cachePrompt = cacheHit === null || cacheMiss === null ? 0 : cacheHit + cacheMiss;
|
|
160
167
|
const hitPercent = formatCacheHitPercent(cacheHit ?? 0, cachePrompt);
|
|
168
|
+
const hint = hitPercent === null ? `这个会话累计 ${formatExactTokens(props.total)} tok;点开看输入/输出明细` : `这个会话累计 ${formatExactTokens(props.total)} tok,前缀缓存命中 ${hitPercent}%;点开看输入/输出明细`;
|
|
161
169
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "segment seg-tokens seg-hover", children: [
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "ctx-trigger", title:
|
|
170
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "ctx-trigger", title: hint, children: [
|
|
163
171
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "seg-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconDatabase, { size: 12 }) }),
|
|
164
|
-
formatTokens(props.total),
|
|
165
|
-
" tok"
|
|
172
|
+
uiPrimitives.formatTokens(props.total),
|
|
173
|
+
" tok",
|
|
174
|
+
hitPercent !== null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "seg-dim", children: [
|
|
175
|
+
" · 缓存命中 ",
|
|
176
|
+
hitPercent,
|
|
177
|
+
"%"
|
|
178
|
+
] })
|
|
166
179
|
] }),
|
|
167
180
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-card", role: "note", children: [
|
|
168
181
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-head", children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-title", children: "
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-numbers", children: [
|
|
171
|
-
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-title", children: "Token 用量" }),
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-numbers", title: `${formatExactTokens(props.total)} tok`, children: [
|
|
184
|
+
uiPrimitives.formatTokens(props.total),
|
|
172
185
|
" tok"
|
|
173
186
|
] })
|
|
174
187
|
] }),
|
|
175
188
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ctx-rule" }),
|
|
176
189
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-rows", children: [
|
|
177
|
-
requests !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "模型请求", value: `${String(requests)} 次` }),
|
|
178
190
|
hitPercent !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "缓存命中", value: `${hitPercent}%` }),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "输出", value: formatExactTokens(output) }),
|
|
183
|
-
lastAt !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "最近请求", value: `${clockText(lastAt)}(${agoText(lastAt)})` })
|
|
191
|
+
cacheMiss !== null ? /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "未缓存输入", value: uiPrimitives.formatTokens(cacheMiss), title: `${formatExactTokens(cacheMiss)} tok` }) : /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "输入", value: uiPrimitives.formatTokens(input), title: `${formatExactTokens(input)} tok` }),
|
|
192
|
+
cacheHit !== null && /* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "缓存读取", value: uiPrimitives.formatTokens(cacheHit), title: `${formatExactTokens(cacheHit)} tok` }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardRow, { label: "输出", value: uiPrimitives.formatTokens(output), title: `${formatExactTokens(output)} tok` })
|
|
184
194
|
] })
|
|
185
195
|
] })
|
|
186
196
|
] });
|
|
187
197
|
}
|
|
188
198
|
function ContextSegment(props) {
|
|
189
|
-
const percent = Math.round(props.used / props.windowTokens * 100);
|
|
199
|
+
const percent = Math.min(100, Math.round(props.used / props.windowTokens * 100));
|
|
190
200
|
const shown = Math.min(Math.max(percent, 0), 100);
|
|
201
|
+
const system = props.segments.system;
|
|
202
|
+
const schema = props.segments.schema ?? 0;
|
|
203
|
+
const tools = props.segments.tools;
|
|
191
204
|
const messages = props.segments.prompt + props.segments.assistant + props.segments.thinking;
|
|
192
|
-
|
|
193
|
-
const split = messages > 0 && messages < props.used;
|
|
205
|
+
const breakdown = system + schema + tools + messages;
|
|
194
206
|
const widthOf = (tokens) => `${(Math.min(tokens, props.windowTokens) / props.windowTokens * 100).toFixed(2)}%`;
|
|
195
207
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "segment seg-context seg-hover", children: [
|
|
196
208
|
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "ctx-trigger", "aria-label": `上下文已用 ${String(percent)}%`, children: [
|
|
@@ -207,30 +219,48 @@ function ContextSegment(props) {
|
|
|
207
219
|
] }),
|
|
208
220
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-numbers", children: [
|
|
209
221
|
"~",
|
|
210
|
-
formatTokens(props.used),
|
|
222
|
+
uiPrimitives.formatTokens(props.used),
|
|
211
223
|
" / ",
|
|
212
|
-
formatTokens(props.windowTokens)
|
|
224
|
+
uiPrimitives.formatTokens(props.windowTokens)
|
|
213
225
|
] })
|
|
214
226
|
] }),
|
|
215
|
-
/* @__PURE__ */ jsxRuntime.
|
|
216
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
227
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ctx-bar", children: breakdown > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
228
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-seg ctx-bar-system", style: { width: widthOf(system) } }),
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-seg ctx-bar-schema", style: { width: widthOf(schema) } }),
|
|
230
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-seg ctx-bar-tools", style: { width: widthOf(tools) } }),
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-seg ctx-bar-messages", style: { width: widthOf(messages) } })
|
|
232
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-bar-fill", style: { width: widthOf(props.used) } }) }),
|
|
233
|
+
breakdown > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-legend", children: [
|
|
220
234
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-legend-row", children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-system" }),
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "系统提示词" }),
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-legend-value", children: [
|
|
238
|
+
"~",
|
|
239
|
+
uiPrimitives.formatTokens(system)
|
|
240
|
+
] })
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-legend-row", children: [
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-schema" }),
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "工具定义" }),
|
|
223
245
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-legend-value", children: [
|
|
224
246
|
"~",
|
|
225
|
-
formatTokens(
|
|
247
|
+
uiPrimitives.formatTokens(schema)
|
|
226
248
|
] })
|
|
227
249
|
] }),
|
|
228
250
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-legend-row", children: [
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-
|
|
230
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "
|
|
251
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-tools" }),
|
|
252
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "工具结果" }),
|
|
231
253
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-legend-value", children: [
|
|
232
254
|
"~",
|
|
233
|
-
formatTokens(
|
|
255
|
+
uiPrimitives.formatTokens(tools)
|
|
256
|
+
] })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-legend-row", children: [
|
|
259
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "ctx-dot ctx-dot-messages" }),
|
|
260
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-legend-label", children: "对话消息" }),
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ctx-legend-value", children: [
|
|
262
|
+
"~",
|
|
263
|
+
uiPrimitives.formatTokens(messages)
|
|
234
264
|
] })
|
|
235
265
|
] })
|
|
236
266
|
] })
|
|
@@ -238,7 +268,7 @@ function ContextSegment(props) {
|
|
|
238
268
|
] });
|
|
239
269
|
}
|
|
240
270
|
function CardRow(props) {
|
|
241
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-row", children: [
|
|
271
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ctx-row", title: props.title, children: [
|
|
242
272
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-label", children: props.label }),
|
|
243
273
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ctx-value", children: props.value })
|
|
244
274
|
] });
|
|
@@ -281,6 +311,9 @@ function readNumber(record, key) {
|
|
|
281
311
|
const value = record[key];
|
|
282
312
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
283
313
|
}
|
|
314
|
+
function readTurnStartedAt(status) {
|
|
315
|
+
return readNumber(status, "turnStartedAt");
|
|
316
|
+
}
|
|
284
317
|
function readTurnState(status) {
|
|
285
318
|
const raw = status["turnState"];
|
|
286
319
|
return typeof raw === "string" && TURN_STATES.includes(raw) ? raw : null;
|
|
@@ -327,18 +360,12 @@ function readSegment(key) {
|
|
|
327
360
|
return segments === null ? 0 : readNumber(segments, key) ?? 0;
|
|
328
361
|
};
|
|
329
362
|
}
|
|
330
|
-
function
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (typeof entry !== "object" || entry === null) continue;
|
|
337
|
-
const record = entry;
|
|
338
|
-
if (record["kind"] === "user" && record["steering"] !== true) rounds += 1;
|
|
339
|
-
else if (record["kind"] === "tool") steps += 1;
|
|
340
|
-
}
|
|
341
|
-
return `${String(rounds)}/${String(steps)}`;
|
|
363
|
+
function readProgress(snapshot) {
|
|
364
|
+
const status = statusOf(snapshot);
|
|
365
|
+
const progress = status === null ? null : asRecord(status["progress"]);
|
|
366
|
+
const turns = progress === null ? 0 : readNumber(progress, "turns") ?? 0;
|
|
367
|
+
const steps = progress === null ? 0 : readNumber(progress, "steps") ?? 0;
|
|
368
|
+
return `${String(turns)}/${String(steps)}`;
|
|
342
369
|
}
|
|
343
370
|
function readActivityKey(snapshot) {
|
|
344
371
|
const entries = snapshot?.["entries"];
|
|
@@ -349,18 +376,6 @@ function readActivityKey(snapshot) {
|
|
|
349
376
|
const output = usage === null ? 0 : readNumber(usage, "outputTokens") ?? 0;
|
|
350
377
|
return `${String(count)}:${readText(status, "turnState")}:${String(input)}:${String(output)}`;
|
|
351
378
|
}
|
|
352
|
-
function readHasContent(snapshot) {
|
|
353
|
-
const status = statusOf(snapshot);
|
|
354
|
-
if (status !== null) {
|
|
355
|
-
const usage = usageOf(status);
|
|
356
|
-
if (usage !== null && (readNumber(usage, "inputTokens") ?? 0) + (readNumber(usage, "outputTokens") ?? 0) > 0) {
|
|
357
|
-
return true;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
const entries = snapshot?.["entries"];
|
|
361
|
-
if (!Array.isArray(entries)) return false;
|
|
362
|
-
return entries.some((entry) => entry["kind"] !== "system");
|
|
363
|
-
}
|
|
364
379
|
function useSessionUsage(sessionId, turnState, settledTokens) {
|
|
365
380
|
const [bag, setBag] = react.useState(null);
|
|
366
381
|
const busy = turnState !== null && turnState !== "idle";
|
|
@@ -389,68 +404,9 @@ function useSessionUsage(sessionId, turnState, settledTokens) {
|
|
|
389
404
|
}, [sessionId, busy, settledTokens]);
|
|
390
405
|
return bag !== null && bag.id === sessionId ? bag.view : null;
|
|
391
406
|
}
|
|
392
|
-
function useSessionClock(sessionId, activity, content) {
|
|
393
|
-
const [clock, setClock] = react.useState(null);
|
|
394
|
-
react.useEffect(() => {
|
|
395
|
-
if (sessionId === null) {
|
|
396
|
-
setClock(null);
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const now = Date.now();
|
|
400
|
-
setClock(
|
|
401
|
-
(current) => current === null || current.sessionId !== sessionId ? { sessionId, startedAt: content ? now : null, lastActiveAt: now } : { ...current, startedAt: current.startedAt ?? (content ? now : null), lastActiveAt: now }
|
|
402
|
-
);
|
|
403
|
-
}, [sessionId, activity, content]);
|
|
404
|
-
return clock !== null && clock.sessionId === sessionId ? clock : null;
|
|
405
|
-
}
|
|
406
|
-
function clockText(at) {
|
|
407
|
-
const date = new Date(at);
|
|
408
|
-
return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
409
|
-
}
|
|
410
|
-
function agoText(at) {
|
|
411
|
-
const minutes = Math.floor((Date.now() - at) / 6e4);
|
|
412
|
-
if (minutes < 1) return "刚刚";
|
|
413
|
-
if (minutes < 60) return `${String(minutes)} 分钟前`;
|
|
414
|
-
const hours = Math.floor(minutes / 60);
|
|
415
|
-
if (hours < 24) return `${String(hours)} 小时前`;
|
|
416
|
-
return `${String(Math.floor(hours / 24))} 天前`;
|
|
417
|
-
}
|
|
418
|
-
function trimZero(value) {
|
|
419
|
-
const text = value >= 100 ? value.toFixed(0) : value.toFixed(1);
|
|
420
|
-
return text.endsWith(".0") ? text.slice(0, -2) : text;
|
|
421
|
-
}
|
|
422
|
-
function formatTokens(count) {
|
|
423
|
-
if (count < 1e3) return String(Math.round(count));
|
|
424
|
-
if (count < 1e6) return `${trimZero(count / 1e3)}K`;
|
|
425
|
-
return `${trimZero(count / 1e6)}M`;
|
|
426
|
-
}
|
|
427
407
|
function formatExactTokens(count) {
|
|
428
408
|
return Math.round(count).toLocaleString("en-US");
|
|
429
409
|
}
|
|
430
|
-
function tokensPerSecond(totals) {
|
|
431
|
-
if (!(totals.decodeMs > 0)) return null;
|
|
432
|
-
return totals.decodeTokens / (totals.decodeMs / 1e3);
|
|
433
|
-
}
|
|
434
|
-
function averageTtftMs(totals) {
|
|
435
|
-
if (!(totals.ttftSteps > 0)) return null;
|
|
436
|
-
return totals.ttftMs / totals.ttftSteps;
|
|
437
|
-
}
|
|
438
|
-
function formatTokensPerSecond(tps) {
|
|
439
|
-
const clamped = Math.max(0, tps);
|
|
440
|
-
return clamped >= 10 ? String(Math.round(clamped)) : String(Math.round(clamped * 10) / 10);
|
|
441
|
-
}
|
|
442
|
-
function formatDuration(ms) {
|
|
443
|
-
if (!Number.isFinite(ms) || ms < 0) return null;
|
|
444
|
-
const tenths = Math.round(ms / 100) / 10;
|
|
445
|
-
if (tenths < 60) return `${tenths.toFixed(1)}s`;
|
|
446
|
-
const total = Math.round(ms / 1e3);
|
|
447
|
-
const pad = (value) => String(value).padStart(2, "0");
|
|
448
|
-
const seconds = total % 60;
|
|
449
|
-
const minutes = Math.floor(total / 60) % 60;
|
|
450
|
-
const hours = Math.floor(total / 3600);
|
|
451
|
-
if (hours > 0) return `${String(hours)}h${pad(minutes)}m`;
|
|
452
|
-
return `${String(minutes)}m${pad(seconds)}s`;
|
|
453
|
-
}
|
|
454
410
|
function roundedPercentUnits(cacheReadTokens, denominator, decimalPlaces) {
|
|
455
411
|
const unitsPerPercent = decimalPlaces === 0 ? 1 : 10;
|
|
456
412
|
const scale = unitsPerPercent * 100;
|
|
@@ -3,18 +3,8 @@
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const react = require("react");
|
|
6
|
+
const uiPrimitives = require("@dsc/ui-primitives");
|
|
6
7
|
const ui$1 = require("@dsc/ui");
|
|
7
|
-
function formatDuration(ms) {
|
|
8
|
-
if (ms === null || !Number.isFinite(ms) || ms < 0) return null;
|
|
9
|
-
const total = Math.max(1, Math.round(ms / 1e3));
|
|
10
|
-
const seconds = total % 60;
|
|
11
|
-
const minutes = Math.floor(total / 60) % 60;
|
|
12
|
-
const hours = Math.floor(total / 3600);
|
|
13
|
-
const pad = (value) => String(value).padStart(2, "0");
|
|
14
|
-
if (hours > 0) return `${String(hours)}时${pad(minutes)}分${pad(seconds)}秒`;
|
|
15
|
-
if (minutes > 0) return `${String(minutes)}分${String(seconds)}秒`;
|
|
16
|
-
return `${String(seconds)}秒`;
|
|
17
|
-
}
|
|
18
8
|
const STATE_LABEL = {
|
|
19
9
|
working: "运行中",
|
|
20
10
|
idle: "已完成",
|
|
@@ -25,31 +15,23 @@ function matesOf(mates, sessionId) {
|
|
|
25
15
|
if (sessionId === null || sessionId === "") return [];
|
|
26
16
|
return mates.filter((mate) => mate.sessionId === sessionId);
|
|
27
17
|
}
|
|
28
|
-
|
|
29
|
-
const status = snapshot?.["status"];
|
|
30
|
-
if (typeof status !== "object" || status === null) return null;
|
|
31
|
-
const path = status["sessionPath"];
|
|
32
|
-
if (typeof path !== "string" || path === "") return null;
|
|
33
|
-
const base = path.replace(/\\/g, "/").split("/").pop() ?? "";
|
|
34
|
-
return base.endsWith(".jsonl") ? base.slice(0, -6) : base;
|
|
35
|
-
}
|
|
36
|
-
let panelOpen = false;
|
|
37
|
-
let peekWanted = null;
|
|
38
|
-
const openListeners = /* @__PURE__ */ new Set();
|
|
18
|
+
const panel = ui$1.createSignal({ open: false, peek: null });
|
|
39
19
|
function setPanelOpen(next, peek = null) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
const current = panel.get();
|
|
21
|
+
if (next === current.open && peek === current.peek) return;
|
|
22
|
+
panel.set({ open: next, peek });
|
|
23
|
+
}
|
|
24
|
+
function takePeekWant() {
|
|
25
|
+
const current = panel.get();
|
|
26
|
+
if (current.peek === null) return null;
|
|
27
|
+
panel.set({ open: current.open, peek: null });
|
|
28
|
+
return current.peek;
|
|
44
29
|
}
|
|
45
30
|
function subscribePanelOpen(listener) {
|
|
46
|
-
|
|
47
|
-
return () => {
|
|
48
|
-
openListeners.delete(listener);
|
|
49
|
-
};
|
|
31
|
+
return panel.subscribe(listener);
|
|
50
32
|
}
|
|
51
33
|
function usePanelOpen() {
|
|
52
|
-
return react.useSyncExternalStore(subscribePanelOpen, () =>
|
|
34
|
+
return react.useSyncExternalStore(subscribePanelOpen, () => panel.get().open, () => false);
|
|
53
35
|
}
|
|
54
36
|
const makeMateSeat = () => ui$1.defineStore({
|
|
55
37
|
init: () => ({ list: [] }),
|
|
@@ -101,9 +83,36 @@ function SubagentMenu(props) {
|
|
|
101
83
|
};
|
|
102
84
|
}, [channel, actions]);
|
|
103
85
|
const mates = props.useStore((state) => state.list);
|
|
104
|
-
const sessionId = ui$1.useHostSelector(readSessionId);
|
|
86
|
+
const sessionId = ui$1.useHostSelector(uiPrimitives.readSessionId);
|
|
105
87
|
const [menuOpen, setMenuOpen] = react.useState(false);
|
|
106
88
|
const mine = matesOf(mates, sessionId);
|
|
89
|
+
const menuRef = react.useRef(null);
|
|
90
|
+
react.useEffect(() => {
|
|
91
|
+
if (!menuOpen) return void 0;
|
|
92
|
+
const el = menuRef.current;
|
|
93
|
+
if (el === null) return void 0;
|
|
94
|
+
const place = () => {
|
|
95
|
+
el.style.left = "0px";
|
|
96
|
+
el.style.maxHeight = "";
|
|
97
|
+
const margin = 12;
|
|
98
|
+
const rect = el.getBoundingClientRect();
|
|
99
|
+
const overflowRight = rect.right - (window.innerWidth - margin);
|
|
100
|
+
if (overflowRight > 0) {
|
|
101
|
+
const shift = Math.min(overflowRight, Math.max(0, rect.left - margin));
|
|
102
|
+
el.style.left = `${String(-shift)}px`;
|
|
103
|
+
}
|
|
104
|
+
const after = el.getBoundingClientRect();
|
|
105
|
+
const room = window.innerHeight - margin - after.top;
|
|
106
|
+
if (after.bottom > window.innerHeight - margin && room > 120) {
|
|
107
|
+
el.style.maxHeight = `${String(Math.round(room))}px`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
place();
|
|
111
|
+
window.addEventListener("resize", place);
|
|
112
|
+
return () => {
|
|
113
|
+
window.removeEventListener("resize", place);
|
|
114
|
+
};
|
|
115
|
+
}, [menuOpen, mine.length]);
|
|
107
116
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
108
117
|
mine.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sub-open", children: [
|
|
109
118
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -133,7 +142,7 @@ function SubagentMenu(props) {
|
|
|
133
142
|
}
|
|
134
143
|
}
|
|
135
144
|
),
|
|
136
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row-menu sub-menu", role: "menu", "aria-label": "本会话的子智能体", children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row-menu sub-menu", role: "menu", "aria-label": "本会话的子智能体", ref: menuRef, children: [
|
|
137
146
|
mine.map((mate) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
147
|
TeamRow,
|
|
139
148
|
{
|
|
@@ -167,25 +176,19 @@ function SubagentMenu(props) {
|
|
|
167
176
|
}
|
|
168
177
|
function TeamPanel({ useStore }) {
|
|
169
178
|
const mates = useStore((state) => state.list);
|
|
170
|
-
const sessionId = ui$1.useHostSelector(readSessionId);
|
|
179
|
+
const sessionId = ui$1.useHostSelector(uiPrimitives.readSessionId);
|
|
171
180
|
const [othersOpen, setOthersOpen] = react.useState(false);
|
|
172
181
|
const [peeking, setPeeking] = react.useState(null);
|
|
173
182
|
react.useEffect(() => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
const want = takePeekWant();
|
|
184
|
+
if (want === null) return;
|
|
185
|
+
const wanted = mates.find((mate) => mate.name === want);
|
|
177
186
|
if (wanted !== void 0) setPeeking({ name: wanted.name, file: wanted.file });
|
|
178
187
|
}, [mates]);
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (peeking !== null) setPeeking(null);
|
|
184
|
-
else setPanelOpen(false);
|
|
185
|
-
};
|
|
186
|
-
window.addEventListener("keydown", onKey);
|
|
187
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
188
|
-
}, [peeking]);
|
|
188
|
+
const dialog = uiPrimitives.useDialogFocus(true, () => {
|
|
189
|
+
if (peeking !== null) setPeeking(null);
|
|
190
|
+
else setPanelOpen(false);
|
|
191
|
+
});
|
|
189
192
|
const mine = matesOf(mates, sessionId);
|
|
190
193
|
const others = mates.filter((mate) => !mine.includes(mate));
|
|
191
194
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -195,7 +198,7 @@ function TeamPanel({ useStore }) {
|
|
|
195
198
|
onMouseDown: (event) => {
|
|
196
199
|
if (event.target === event.currentTarget) setPanelOpen(false);
|
|
197
200
|
},
|
|
198
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings team-panel", role: "dialog", "aria-modal": "true", "aria-label": "智能体团队", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-main", children: [
|
|
201
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings team-panel", role: "dialog", "aria-modal": "true", "aria-label": "智能体团队", ref: dialog.ref, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-main", children: [
|
|
199
202
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-head", children: [
|
|
200
203
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-head-text", children: [
|
|
201
204
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: peeking === null ? "智能体团队" : `队友 ${peeking.name} 的运行记录` }),
|
|
@@ -299,7 +302,7 @@ function TeamRow({
|
|
|
299
302
|
{
|
|
300
303
|
type: "button",
|
|
301
304
|
className: "text-btn danger",
|
|
302
|
-
"data-tip": "
|
|
305
|
+
"data-tip": "叫停这个队友(停当前这一轮,保留可续:传话就能接着干;要清掉用「移除」)",
|
|
303
306
|
onClick: () => {
|
|
304
307
|
void act("stopTeammate", [mate.name], `已叫停 ${mate.name}`);
|
|
305
308
|
},
|
|
@@ -393,7 +396,7 @@ function UsedTime({ mate }) {
|
|
|
393
396
|
window.clearInterval(timer);
|
|
394
397
|
};
|
|
395
398
|
}, [running]);
|
|
396
|
-
const used = mate.startedAt > 0 ? formatDuration((running ? now : mate.finishedAt ?? mate.startedAt) - mate.startedAt) : null;
|
|
399
|
+
const used = mate.startedAt > 0 ? uiPrimitives.formatDuration((running ? now : mate.finishedAt ?? mate.startedAt) - mate.startedAt) : null;
|
|
397
400
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tm-time", "data-tip": running ? "已经跑了多久(每秒刷新)" : "从派活到收工的总耗时", children: used ?? "" });
|
|
398
401
|
}
|
|
399
402
|
const PEEK_POLL_MS = 2500;
|
|
@@ -437,7 +440,9 @@ function PeekView({ file, working = false }) {
|
|
|
437
440
|
"读不了运行记录:",
|
|
438
441
|
error
|
|
439
442
|
] });
|
|
440
|
-
if (entries === null)
|
|
443
|
+
if (entries === null) {
|
|
444
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-loading", role: "status", "aria-label": "正在读运行记录", children: /* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.SkeletonText, { lines: 5 }) });
|
|
445
|
+
}
|
|
441
446
|
if (entries.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "它还没开始干活。" });
|
|
442
447
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "peek-flow", children: entries.map((entry) => {
|
|
443
448
|
if (entry.kind === "text") {
|
|
@@ -447,7 +452,7 @@ function PeekView({ file, working = false }) {
|
|
|
447
452
|
return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "peek-tool", children: [
|
|
448
453
|
/* @__PURE__ */ jsxRuntime.jsx("code", { children: entry.call.name }),
|
|
449
454
|
" ",
|
|
450
|
-
oneLine(entry.call.argsText, 60),
|
|
455
|
+
uiPrimitives.oneLine(entry.call.argsText, 60),
|
|
451
456
|
entry.call.status === "failed" ? " · 失败" : ""
|
|
452
457
|
] }, entry.id);
|
|
453
458
|
}
|
|
@@ -469,7 +474,9 @@ function FlowHost({ flow, file, working }) {
|
|
|
469
474
|
"读不了运行记录:",
|
|
470
475
|
error
|
|
471
476
|
] });
|
|
472
|
-
if (entries === null)
|
|
477
|
+
if (entries === null) {
|
|
478
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-loading", role: "status", "aria-label": "正在读运行记录", children: /* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.SkeletonText, { lines: 5 }) });
|
|
479
|
+
}
|
|
473
480
|
if (entries.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "它还没开始干活。" });
|
|
474
481
|
return /* @__PURE__ */ jsxRuntime.jsx(flow.Component, { entries, sessionKey: file });
|
|
475
482
|
}
|
|
@@ -518,10 +525,5 @@ function basename(path) {
|
|
|
518
525
|
const cut = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
519
526
|
return cut === -1 ? path : path.slice(cut + 1).replace(/\.jsonl$/, "");
|
|
520
527
|
}
|
|
521
|
-
function oneLine(text, max) {
|
|
522
|
-
const flat = text.replace(/\s+/g, " ").trim();
|
|
523
|
-
const chars = Array.from(flat);
|
|
524
|
-
return chars.length > max ? `${chars.slice(0, max).join("")}…` : flat;
|
|
525
|
-
}
|
|
526
528
|
exports.default = ui;
|
|
527
529
|
};
|