@xopcai/xopc 0.0.124 → 0.0.126
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 +56 -102
- package/README.zh-CN.md +51 -98
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +6 -6
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
- package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B5uSVAyJ.js → agent-avatar-dicebear-C70vgt60.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DRYVahI-.js +2 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-D9-HW6cy.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-BHlahIDL.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BdJ1eQg3.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CXUGRp2i.js → archive-plugin-B-aoIt0w.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Cmiub3Wg.js → attachment-load-BD0G0FD5.js} +1 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-iJRVI7aZ.js +1 -0
- package/dist/gateway/static/root/assets/automations-page-D8hYQbkl.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-0Izz-N3p.js → binary-plugins-B0mNlVSz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1Kv0IkJ.js → block-editor-CJY9Lu5G.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CiWEO-Iy.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-Bgc8ag55.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-B1nIi0TC.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BeA2aVor.js → channel-recipient-api-0sauApoC.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BddPdqVo.js +1 -0
- package/dist/gateway/static/root/assets/code-editor-gbRgS14t.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-Ba2GDhSE.js +2 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-2rjzUu57.js → directory-picker-path-field-CiEc4KmY.js} +1 -1
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +1 -0
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +1 -0
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-4bvpk5wr.js +3 -0
- package/dist/gateway/static/root/assets/extension-debug-page-BbyczVZ3.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-DLN1I3DR.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-D9VGHmYJ.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-BU5S0Sn7.js → fetch-5V96dUz3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BIPGwrl1.js → gateway-config-api-BtIzObwp.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-KFsGGDhg.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cd0Zz30N.js → gateway-startup-retry-DEMad2wt.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-4PcF6Sh6.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-B482PSaG.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-B95KdGMj.js → goals-config-api-CVN7-pdM.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-CUdgJuDn.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-IYCH3-Pi.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-Cf_a2Bmz.js +1 -0
- package/dist/gateway/static/root/assets/{html-workspace-editor-CQLWDiwE.js → html-workspace-editor-DV90ddkE.js} +1 -1
- package/dist/gateway/static/root/assets/index-CA2tR2vm.js +256 -0
- package/dist/gateway/static/root/assets/index-Ds3u0LOk.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-lKTg6St7.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-BCporcNH.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-editor-AssmZFx4.js → markdown-editor-BFOjBBla.js} +2 -2
- package/dist/gateway/static/root/assets/markdown-split-Bv4k6iGJ.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BhIQU5yS.js → media-plugins-Bbi8g3N8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C22hxE1N.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-D68Pyow7.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-CuUMOiyv.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-Dx2N5zTk.js +2 -0
- package/dist/gateway/static/root/assets/page-tabs-Cp395RYD.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DGzet1d7.js → preview-open-alternatives-DqV5OM4m.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-sB8AzZi3.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-LBnJqWK2.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-Dbj0o6SC.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Cqgb-jqa.js → save-bar-controls-BItmzAzI.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DVZcI8Yt.js → schedule-field-BQ8IjjCn.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Bj7sOxC8.js → schema-form-BRpD6x3d.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DhDZKspB.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvXLMNL6.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BmXn-8N6.js → settings-collapsible-section-BKSPQM4R.js} +1 -1
- package/dist/gateway/static/root/assets/settings-form-section-BmyfthNQ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-Cfm9UxAr.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-Bls5tfbH.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-kQEsTGAs.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-IB1v8i86.js → share-preview-page-DbYZNAPb.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BtR4B0kn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CJNVOWoK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DcWDHrt3.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BxQ384RC.js → system-settings-panel-DKDAojWM.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BkcpvFYO.js → typed-models-lib-BCCV4Kkp.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Cd0FaEQ4.js → use-channel-catalog-NBqg3iFY.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DQ7NnRSY.js → user-profile-settings-panel-suQ2x-LB.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-YKhVf7Ka.js → utils-DPGVr3tS.js} +1 -1
- package/dist/gateway/static/root/assets/{vendor-codemirror-CNP1wPe7.js → vendor-codemirror-BvNgyE1Q.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DaJASKFP.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-BrCZpAWh.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BTkRVNAh.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-start-dialog-BNJVCWoS.js → workflow-start-dialog-DAImVtdO.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-vyJ8wSXm.js +18 -0
- package/dist/gateway/static/root/index.html +8 -7
- package/dist/package.js +1 -1
- package/dist/src/activity/context.d.ts +11 -0
- package/dist/src/activity/context.js +36 -0
- package/dist/src/activity/context.js.map +1 -0
- package/dist/src/activity/emitter.d.ts +6 -0
- package/dist/src/activity/emitter.js +43 -0
- package/dist/src/activity/emitter.js.map +1 -0
- package/dist/src/activity/index.d.ts +3 -0
- package/dist/src/activity/index.js +3 -0
- package/dist/src/activity/service.d.ts +12 -0
- package/dist/src/activity/service.js +59 -0
- package/dist/src/activity/service.js.map +1 -0
- package/dist/src/activity/types.d.ts +109 -0
- package/dist/src/activity/types.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +7 -0
- package/dist/src/agent/agent-manager.js +12 -5
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +2 -0
- package/dist/src/agent/child-agent-factory.js +2 -0
- package/dist/src/agent/child-agent-factory.js.map +1 -1
- package/dist/src/agent/coding/index.d.ts +1 -0
- package/dist/src/agent/coding/index.js +2 -0
- package/dist/src/agent/coding/turn-diff-tracker.d.ts +67 -0
- package/dist/src/agent/coding/turn-diff-tracker.js +233 -0
- package/dist/src/agent/coding/turn-diff-tracker.js.map +1 -0
- package/dist/src/agent/context/project-context.js +2 -2
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/dreaming/config.d.ts +2 -2
- package/dist/src/agent/memory/dreaming/config.js +3 -3
- package/dist/src/agent/memory/dreaming/config.js.map +1 -1
- package/dist/src/agent/memory/dreaming/constants.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/constants.js +1 -1
- package/dist/src/agent/memory/dreaming/constants.js.map +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +1 -0
- package/dist/src/agent/memory/dreaming/deep-promotion.js +11 -20
- package/dist/src/agent/memory/dreaming/deep-promotion.js.map +1 -1
- package/dist/src/agent/memory/dreaming/events.d.ts +3 -3
- package/dist/src/agent/memory/dreaming/events.js +6 -6
- package/dist/src/agent/memory/dreaming/events.js.map +1 -1
- package/dist/src/agent/memory/dreaming/last-run.d.ts +2 -2
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js.map +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +3 -3
- package/dist/src/agent/memory/dreaming/light-sweep.js.map +1 -1
- package/dist/src/agent/memory/dreaming/preview.d.ts +1 -0
- package/dist/src/agent/memory/dreaming/preview.js +2 -2
- package/dist/src/agent/memory/dreaming/preview.js.map +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +13 -13
- package/dist/src/agent/memory/dreaming/rem-patterns.js.map +1 -1
- package/dist/src/agent/memory/dreaming/scope.d.ts +14 -0
- package/dist/src/agent/memory/dreaming/scope.js +27 -0
- package/dist/src/agent/memory/dreaming/scope.js.map +1 -0
- package/dist/src/agent/memory/dreaming/short-term-store.d.ts +4 -4
- package/dist/src/agent/memory/dreaming/short-term-store.js +17 -17
- package/dist/src/agent/memory/dreaming/short-term-store.js.map +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +2 -0
- package/dist/src/agent/orchestration/agent-event-handler.js +13 -0
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +22 -12
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/sandbox/command-validator.js +12 -0
- package/dist/src/agent/sandbox/command-validator.js.map +1 -1
- package/dist/src/agent/service.d.ts +2 -1
- package/dist/src/agent/service.js +24 -9
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +7 -0
- package/dist/src/agent/session/session-inspector.d.ts +5 -3
- package/dist/src/agent/session/session-inspector.js +17 -8
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/source-context/types.d.ts +1 -1
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/source-context/types.js.map +1 -1
- package/dist/src/agent/tool-manuals/index.js +15 -6
- package/dist/src/agent/tool-manuals/index.js.map +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -0
- package/dist/src/agent/tool-manuals/xopc-use.js +204 -0
- package/dist/src/agent/tool-manuals/xopc-use.js.map +1 -0
- package/dist/src/agent/tools/apply-patch.js +116 -62
- package/dist/src/agent/tools/apply-patch.js.map +1 -1
- package/dist/src/agent/tools/concurrency.d.ts +8 -0
- package/dist/src/agent/tools/concurrency.js +31 -0
- package/dist/src/agent/tools/concurrency.js.map +1 -0
- package/dist/src/agent/tools/dreaming-tool.d.ts +2 -0
- package/dist/src/agent/tools/dreaming-tool.js +13 -10
- package/dist/src/agent/tools/dreaming-tool.js.map +1 -1
- package/dist/src/agent/tools/exec-command.js +4 -0
- package/dist/src/agent/tools/exec-command.js.map +1 -1
- package/dist/src/agent/tools/executor.d.ts +6 -4
- package/dist/src/agent/tools/executor.js +7 -4
- package/dist/src/agent/tools/executor.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +10 -0
- package/dist/src/agent/tools/factory.js +16 -1
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/find.js +2 -0
- package/dist/src/agent/tools/find.js.map +1 -1
- package/dist/src/agent/tools/goal-tool.js +2 -2
- package/dist/src/agent/tools/grep.js +2 -0
- package/dist/src/agent/tools/grep.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +3 -0
- package/dist/src/agent/tools/index.js +4 -1
- package/dist/src/agent/tools/list-dir.js +2 -0
- package/dist/src/agent/tools/list-dir.js.map +1 -1
- package/dist/src/agent/tools/memory-tool.d.ts +1 -0
- package/dist/src/agent/tools/memory-tool.js +2 -2
- package/dist/src/agent/tools/memory-tool.js.map +1 -1
- package/dist/src/agent/tools/metadata.d.ts +15 -0
- package/dist/src/agent/tools/metadata.js +26 -0
- package/dist/src/agent/tools/metadata.js.map +1 -0
- package/dist/src/agent/tools/read.js +2 -0
- package/dist/src/agent/tools/read.js.map +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +6 -0
- package/dist/src/agent/tools/write.js.map +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +34 -0
- package/dist/src/agent/tools/xopc-use-tool.js +636 -0
- package/dist/src/agent/tools/xopc-use-tool.js.map +1 -0
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +5 -1
- package/dist/src/agent/workflow/subagent-runner.js.map +1 -1
- package/dist/src/agent/workflow/workflow-child-tools.js +5 -0
- package/dist/src/agent/workflow/workflow-child-tools.js.map +1 -1
- package/dist/src/agent-manifest/schema.d.ts +27 -27
- package/dist/src/automations/api/routes.js +1 -1
- package/dist/src/automations/domain/validation.d.ts +55 -55
- package/dist/src/automations/draft/automation-draft-validator.d.ts +25 -25
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/browser/cdp-local-launcher.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +3 -3
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/chat-commands/builtins/goal.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +2 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/goal.js +3 -3
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/project.js +4 -4
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +14 -14
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +60 -60
- package/dist/src/connectors/health.d.ts +2 -1
- package/dist/src/connectors/health.js +59 -1
- package/dist/src/connectors/health.js.map +1 -1
- package/dist/src/connectors/install.d.ts +1 -0
- package/dist/src/connectors/install.js +28 -1
- package/dist/src/connectors/install.js.map +1 -1
- package/dist/src/connectors/instances.js +7 -0
- package/dist/src/connectors/instances.js.map +1 -1
- package/dist/src/connectors/materialize.js +2 -1
- package/dist/src/connectors/materialize.js.map +1 -1
- package/dist/src/connectors/registries/modelscope.js +38 -13
- package/dist/src/connectors/registries/modelscope.js.map +1 -1
- package/dist/src/connectors/types.d.ts +2 -0
- package/dist/src/daemon/launchd.js +1 -1
- package/dist/src/daemon/systemd.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +1 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js +62 -42
- package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -1
- package/dist/src/gateway/hono/app.js +7 -1
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +14 -14
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/middleware/log-context.js +8 -1
- package/dist/src/gateway/hono/middleware/log-context.js.map +1 -1
- package/dist/src/gateway/hono/routes/activity.d.ts +14 -0
- package/dist/src/gateway/hono/routes/activity.js +72 -0
- package/dist/src/gateway/hono/routes/activity.js.map +1 -0
- package/dist/src/gateway/hono/routes/connectors.js +46 -2
- package/dist/src/gateway/hono/routes/connectors.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +111 -66
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/goals.js +1 -1
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/index.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +903 -50
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +102 -2
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +10 -0
- package/dist/src/gateway/service/sessions-api.js +31 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/gateway/service.js +28 -16
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/goals/goal-store.js +1 -1
- package/dist/src/goals/goal-store.js.map +1 -1
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/infra/ports.js +1 -1
- package/dist/src/infra/ssh-tunnel.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media/store.js +1 -1
- package/dist/src/media/store.js.map +1 -1
- package/dist/src/media/types.d.ts +1 -1
- package/dist/src/media/uri.js +2 -1
- package/dist/src/media/uri.js.map +1 -1
- package/dist/src/migrations/runner.js +1 -1
- package/dist/src/notes/service.js +65 -6
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/notes/store.js +1 -1
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +59 -2
- package/dist/src/projects/project-service.js.map +1 -1
- package/dist/src/projects/project-store.d.ts +2 -1
- package/dist/src/projects/project-store.js +43 -0
- package/dist/src/projects/project-store.js.map +1 -1
- package/dist/src/projects/types.d.ts +10 -0
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +24 -9
- package/dist/src/session/client-history.js.map +1 -1
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-context-for-llm.d.ts +2 -0
- package/dist/src/session/session-context-for-llm.js +14 -1
- package/dist/src/session/session-context-for-llm.js.map +1 -1
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/store.js +3 -3
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/session/types.d.ts +4 -0
- package/dist/src/session/types.js.map +1 -1
- package/dist/src/storage/sqlite/activity-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/activity-repository.js +208 -0
- package/dist/src/storage/sqlite/activity-repository.js.map +1 -0
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/022_work_items.sql +61 -0
- package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +15 -0
- package/dist/src/storage/sqlite/migrations/024_activity_events.sql +62 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +141 -0
- package/dist/src/storage/sqlite/session-repository.js +11 -0
- package/dist/src/storage/sqlite/session-repository.js.map +1 -1
- package/dist/src/tui/backends/embedded-backend.d.ts +13 -0
- package/dist/src/tui/backends/embedded-backend.js +76 -7
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/backends/gateway-sse-backend.d.ts +13 -0
- package/dist/src/tui/backends/gateway-sse-backend.js +53 -0
- package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
- package/dist/src/tui/chat-history.js +16 -3
- package/dist/src/tui/chat-history.js.map +1 -1
- package/dist/src/tui/clipboard-image.js +1 -1
- package/dist/src/tui/components/assistant-message.js +12 -2
- package/dist/src/tui/components/assistant-message.js.map +1 -1
- package/dist/src/tui/components/chat-log.d.ts +23 -3
- package/dist/src/tui/components/chat-log.js +68 -9
- package/dist/src/tui/components/chat-log.js.map +1 -1
- package/dist/src/tui/components/tool-execution.d.ts +8 -0
- package/dist/src/tui/components/tool-execution.js +87 -77
- package/dist/src/tui/components/tool-execution.js.map +1 -1
- package/dist/src/tui/components/tui-bottom-bar.js +9 -5
- package/dist/src/tui/components/tui-bottom-bar.js.map +1 -1
- package/dist/src/tui/components/visual-truncate.d.ts +1 -0
- package/dist/src/tui/components/visual-truncate.js +28 -1
- package/dist/src/tui/components/visual-truncate.js.map +1 -1
- package/dist/src/tui/tool-summary.d.ts +22 -0
- package/dist/src/tui/tool-summary.js +212 -0
- package/dist/src/tui/tool-summary.js.map +1 -0
- package/dist/src/tui/tui-backend.d.ts +16 -0
- package/dist/src/tui/tui-command-formatters.js +2 -2
- package/dist/src/tui/tui-commands.d.ts +9 -0
- package/dist/src/tui/tui-commands.js +95 -6
- package/dist/src/tui/tui-commands.js.map +1 -1
- package/dist/src/tui/tui-picker-overlay.d.ts +1 -0
- package/dist/src/tui/tui-picker-overlay.js +36 -1
- package/dist/src/tui/tui-picker-overlay.js.map +1 -1
- package/dist/src/tui/tui-picker-services.d.ts +13 -0
- package/dist/src/tui/tui-run-state.js +11 -0
- package/dist/src/tui/tui-run-state.js.map +1 -1
- package/dist/src/tui/tui-run-status-format.d.ts +3 -0
- package/dist/src/tui/tui-run-status-format.js +33 -0
- package/dist/src/tui/tui-run-status-format.js.map +1 -0
- package/dist/src/tui/tui-session-actions.d.ts +5 -0
- package/dist/src/tui/tui-session-actions.js +24 -0
- package/dist/src/tui/tui-session-actions.js.map +1 -1
- package/dist/src/tui/tui-timeline-picker.d.ts +19 -0
- package/dist/src/tui/tui-timeline-picker.js +81 -0
- package/dist/src/tui/tui-timeline-picker.js.map +1 -0
- package/dist/src/tui/tui-timeline.d.ts +15 -0
- package/dist/src/tui/tui-timeline.js +65 -0
- package/dist/src/tui/tui-timeline.js.map +1 -0
- package/dist/src/tui/tui-tool-diff.d.ts +15 -0
- package/dist/src/tui/tui-tool-diff.js +178 -7
- package/dist/src/tui/tui-tool-diff.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui-types.js +1 -0
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +31 -25
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +1 -1
- package/dist/src/utils/logger/stats.d.ts +3 -3
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/work-items/agent-context.d.ts +7 -0
- package/dist/src/work-items/agent-context.js +75 -0
- package/dist/src/work-items/agent-context.js.map +1 -0
- package/dist/src/work-items/index.d.ts +4 -0
- package/dist/src/work-items/index.js +4 -0
- package/dist/src/work-items/types.d.ts +112 -0
- package/dist/src/work-items/types.js +1 -0
- package/dist/src/work-items/work-item-service.d.ts +35 -0
- package/dist/src/work-items/work-item-service.js +277 -0
- package/dist/src/work-items/work-item-service.js.map +1 -0
- package/dist/src/work-items/work-item-store.d.ts +21 -0
- package/dist/src/work-items/work-item-store.js +302 -0
- package/dist/src/work-items/work-item-store.js.map +1 -0
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -3
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +4 -1
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +0 -41
- package/dist/gateway/static/root/assets/agents-BjIxt67Z.js +0 -2
- package/dist/gateway/static/root/assets/app-management-settings-panel-CYCONLIL.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-Clw3ryKg.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-QICTeGjX.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-CU0-4nQ-.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Car-jtiz.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-CMeBJzlS.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-BmQTM9Il.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DZEJEoCF.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-kkW-xFau.js +0 -1
- package/dist/gateway/static/root/assets/code-editor-dZTY2dRW.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BvaQvO5F.js +0 -2
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +0 -1
- package/dist/gateway/static/root/assets/dist-wO9a2_ID.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-DnHO686d.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-BGLRuWVN.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-D978ePp9.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B6Ih4Swx.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CMEA3r5u.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-B-KHKeXN.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-BxrSoWdj.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-BTJzIl28.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-BJyEuLLm.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-wkOjYNQT.js +0 -1
- package/dist/gateway/static/root/assets/index-BLaXr6Ev.css +0 -1
- package/dist/gateway/static/root/assets/index-c_9TVr_C.js +0 -191
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BT8T4DyC.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CrxBJUgI.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-Dv66bO2b.js +0 -1
- package/dist/gateway/static/root/assets/messages-O6TAtdFC.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-DOOpz6y1.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-Br16pK9v.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-PSJAi0ZC.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-CIGGgKuw.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B2grhsBt.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CXMORxBD.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-Bi2wkBzU.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B1L3G4IA.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-BnqYMWHR.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BfRSHJmO.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-CdWZU1hd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CWtPM7RK.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-ngbsBgij.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BIe442Gv.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BfchZRVa.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-C5Ov8Uk_.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BYD9BtOq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BYF29ANm.js +0 -18
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { basename, dirname } from "node:path";
|
|
2
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
3
|
+
//#region src/tui/tool-summary.ts
|
|
4
|
+
const MAX_ARG_VALUE_LENGTH = 120;
|
|
5
|
+
const MAX_PATH_LABEL_LENGTH = 72;
|
|
6
|
+
function formatArgsSummary(args, toolName) {
|
|
7
|
+
if (!args || typeof args !== "object") return "";
|
|
8
|
+
const compactRead = isReadStyleTool(toolName) ? formatCompactReadArgs(args) : null;
|
|
9
|
+
if (compactRead) return compactRead;
|
|
10
|
+
const command = isExecStyleTool(toolName) ? commandFromArgs(args) : null;
|
|
11
|
+
if (command) return command;
|
|
12
|
+
const entries = Object.entries(args);
|
|
13
|
+
if (entries.length === 0) return "";
|
|
14
|
+
return entries.map(([key, value]) => {
|
|
15
|
+
const stringValue = formatArgValue(value);
|
|
16
|
+
return `${key}=${stringValue.length > MAX_ARG_VALUE_LENGTH ? `${stringValue.slice(0, MAX_ARG_VALUE_LENGTH - 3)}...` : stringValue}`;
|
|
17
|
+
}).join(", ");
|
|
18
|
+
}
|
|
19
|
+
function getToolSummaryKind(toolName) {
|
|
20
|
+
if (isReadStyleTool(toolName)) return "read";
|
|
21
|
+
if (isSearchStyleTool(toolName)) return "search";
|
|
22
|
+
if (isExecStyleTool(toolName)) return "exec";
|
|
23
|
+
if (isMcpStyleTool(toolName)) return "mcp";
|
|
24
|
+
return "generic";
|
|
25
|
+
}
|
|
26
|
+
function isReadStyleTool(toolName) {
|
|
27
|
+
const base = baseToolName(toolName);
|
|
28
|
+
return [
|
|
29
|
+
"read",
|
|
30
|
+
"read_file",
|
|
31
|
+
"memory_get"
|
|
32
|
+
].includes(base);
|
|
33
|
+
}
|
|
34
|
+
function isSearchStyleTool(toolName) {
|
|
35
|
+
const base = baseToolName(toolName);
|
|
36
|
+
return [
|
|
37
|
+
"search",
|
|
38
|
+
"grep",
|
|
39
|
+
"rg",
|
|
40
|
+
"ripgrep",
|
|
41
|
+
"search_code",
|
|
42
|
+
"file_search",
|
|
43
|
+
"list_files"
|
|
44
|
+
].includes(base);
|
|
45
|
+
}
|
|
46
|
+
function isExecStyleTool(toolName) {
|
|
47
|
+
const base = baseToolName(toolName);
|
|
48
|
+
return [
|
|
49
|
+
"bash",
|
|
50
|
+
"shell",
|
|
51
|
+
"exec",
|
|
52
|
+
"run_command",
|
|
53
|
+
"exec_command",
|
|
54
|
+
"terminal"
|
|
55
|
+
].includes(base);
|
|
56
|
+
}
|
|
57
|
+
function isMcpStyleTool(toolName) {
|
|
58
|
+
return toolName.includes("__");
|
|
59
|
+
}
|
|
60
|
+
function displayToolName(toolName) {
|
|
61
|
+
const parts = toolName.split("__");
|
|
62
|
+
if (parts.length === 2 && parts[0] && parts[1]) return `${parts[0]}.${parts[1]}`;
|
|
63
|
+
return toolName;
|
|
64
|
+
}
|
|
65
|
+
function compactPath(path, maxLength = MAX_PATH_LABEL_LENGTH) {
|
|
66
|
+
const normalized = path.replace(/\\/g, "/");
|
|
67
|
+
if (normalized.length <= maxLength) return normalized;
|
|
68
|
+
const base = basename(normalized);
|
|
69
|
+
const parent = basename(dirname(normalized));
|
|
70
|
+
const suffix = parent ? `${parent}/${base}` : base;
|
|
71
|
+
if (suffix.length + 2 <= maxLength) return `.../${suffix}`;
|
|
72
|
+
return `.../${base.slice(Math.max(0, base.length - maxLength + 3))}`;
|
|
73
|
+
}
|
|
74
|
+
function formatCollapsedToolSummary(ctx) {
|
|
75
|
+
if (ctx.isError) {
|
|
76
|
+
const rows = nonBlankLines(ctx.output).length;
|
|
77
|
+
return `error; ${rows === 1 ? "1 error line" : `${rows} error lines`}; ${ctx.expandKey} to expand`;
|
|
78
|
+
}
|
|
79
|
+
switch (getToolSummaryKind(ctx.toolName)) {
|
|
80
|
+
case "read": {
|
|
81
|
+
const rows = new Text(ctx.output, 1, 0).render(80).length;
|
|
82
|
+
return ` ${rows} ${rows === 1 ? "row" : "rows"}; ${ctx.expandKey} to expand`;
|
|
83
|
+
}
|
|
84
|
+
case "search": return formatSearchSummary(ctx.output, ctx.expandKey);
|
|
85
|
+
case "exec": return formatExecSummary(ctx.output, ctx.details, ctx.isError, ctx.expandKey);
|
|
86
|
+
case "mcp": return formatMcpSummary(ctx.output, ctx.content, ctx.expandKey);
|
|
87
|
+
case "generic": return "";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function formatExecExpandedOutput(output, details) {
|
|
91
|
+
const parsed = parseExecDetails(details);
|
|
92
|
+
const sections = [];
|
|
93
|
+
const stdout = parsed.stdout ?? output;
|
|
94
|
+
if (stdout.trim()) sections.push(`stdout\n${stdout}`);
|
|
95
|
+
if (parsed.stderr?.trim()) sections.push(`stderr\n${parsed.stderr}`);
|
|
96
|
+
if (parsed.exitCode !== void 0) sections.push(`exit ${parsed.exitCode}`);
|
|
97
|
+
return sections.join("\n");
|
|
98
|
+
}
|
|
99
|
+
function extractExitCode(details) {
|
|
100
|
+
return parseExecDetails(details).exitCode;
|
|
101
|
+
}
|
|
102
|
+
function formatCompactReadArgs(args) {
|
|
103
|
+
if (!args || typeof args !== "object") return null;
|
|
104
|
+
const record = args;
|
|
105
|
+
const rawPath = typeof record.path === "string" ? record.path : typeof record.file_path === "string" ? record.file_path : void 0;
|
|
106
|
+
if (!rawPath) return null;
|
|
107
|
+
const normalized = rawPath.replace(/\\/g, "/");
|
|
108
|
+
const base = basename(normalized);
|
|
109
|
+
let label;
|
|
110
|
+
if (base === "SKILL.md") {
|
|
111
|
+
const parent = basename(dirname(normalized));
|
|
112
|
+
label = parent ? `[skill] ${parent}` : "[skill]";
|
|
113
|
+
} else if (base === "AGENTS.md") label = `read resource ${compactPath(normalized)}`;
|
|
114
|
+
else label = compactPath(normalized);
|
|
115
|
+
const start = firstFiniteNumber(record.offset, record.from, record.start, record.line);
|
|
116
|
+
const count = firstFiniteNumber(record.limit, record.lines, record.count);
|
|
117
|
+
if (start != null && count != null && count > 0) label += `:${start}-${start + count - 1}`;
|
|
118
|
+
return label;
|
|
119
|
+
}
|
|
120
|
+
function commandFromArgs(args) {
|
|
121
|
+
if (!args || typeof args !== "object") return null;
|
|
122
|
+
const record = args;
|
|
123
|
+
const raw = record.command ?? record.cmd ?? record.script;
|
|
124
|
+
if (Array.isArray(raw)) return raw.map(String).join(" ");
|
|
125
|
+
if (typeof raw === "string" && raw.trim()) return raw.trim();
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
function baseToolName(toolName) {
|
|
129
|
+
return toolName.split("__").pop()?.toLowerCase() ?? toolName.toLowerCase();
|
|
130
|
+
}
|
|
131
|
+
function firstFiniteNumber(...values) {
|
|
132
|
+
for (const value of values) {
|
|
133
|
+
if (typeof value === "number" && Number.isFinite(value)) return Math.floor(value);
|
|
134
|
+
if (typeof value === "string" && value.trim()) {
|
|
135
|
+
const parsed = Number(value);
|
|
136
|
+
if (Number.isFinite(parsed)) return Math.floor(parsed);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
function formatArgValue(value) {
|
|
142
|
+
if (typeof value === "string") return value;
|
|
143
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
144
|
+
if (typeof value === "function") return "[function]";
|
|
145
|
+
if (typeof value === "symbol") return String(value);
|
|
146
|
+
if (value instanceof Error) return value.message || value.name;
|
|
147
|
+
try {
|
|
148
|
+
const json = JSON.stringify(value);
|
|
149
|
+
return json === void 0 ? String(value) : json;
|
|
150
|
+
} catch {
|
|
151
|
+
return String(value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function formatSearchSummary(output, expandKey) {
|
|
155
|
+
const lines = nonBlankLines(output);
|
|
156
|
+
const paths = /* @__PURE__ */ new Set();
|
|
157
|
+
let matchCount = 0;
|
|
158
|
+
for (const line of lines) {
|
|
159
|
+
const path = extractResultPath(line);
|
|
160
|
+
if (path) paths.add(compactPath(path, 48));
|
|
161
|
+
if (line.trim()) matchCount += 1;
|
|
162
|
+
}
|
|
163
|
+
const matchLabel = matchCount === 1 ? "1 result" : `${matchCount} results`;
|
|
164
|
+
const fileLabel = paths.size === 0 ? "" : paths.size === 1 ? ` in ${[...paths][0]}` : ` in ${paths.size} files`;
|
|
165
|
+
const samples = [...paths].slice(0, 3).join(", ");
|
|
166
|
+
return `${matchLabel}${fileLabel}${samples && paths.size > 1 ? `: ${samples}` : ""}; ${expandKey} to expand`;
|
|
167
|
+
}
|
|
168
|
+
function formatExecSummary(output, details, isError, expandKey) {
|
|
169
|
+
const parsed = parseExecDetails(details);
|
|
170
|
+
const rows = nonBlankLines([parsed.stdout, parsed.stderr].filter(Boolean).join("\n") || output).length;
|
|
171
|
+
return `${parsed.exitCode === void 0 ? isError ? "failed" : "completed" : `exit ${parsed.exitCode}`}; ${rows === 1 ? "1 output line" : `${rows} output lines`}; ${expandKey} to expand`;
|
|
172
|
+
}
|
|
173
|
+
function formatMcpSummary(output, content, expandKey) {
|
|
174
|
+
if (content?.length) {
|
|
175
|
+
const counts = /* @__PURE__ */ new Map();
|
|
176
|
+
for (const block of content) counts.set(block.type, (counts.get(block.type) ?? 0) + 1);
|
|
177
|
+
return `${[...counts.entries()].map(([type, count]) => `${count} ${type}`).join(", ")}; ${expandKey} to expand`;
|
|
178
|
+
}
|
|
179
|
+
const rows = nonBlankLines(output).length;
|
|
180
|
+
return `${rows === 1 ? "1 result line" : `${rows} result lines`}; ${expandKey} to expand`;
|
|
181
|
+
}
|
|
182
|
+
function parseExecDetails(details) {
|
|
183
|
+
if (!details || typeof details !== "object") return {};
|
|
184
|
+
const record = details;
|
|
185
|
+
return {
|
|
186
|
+
exitCode: numberValue(record.exitCode ?? record.exit_code ?? record.code ?? record.status),
|
|
187
|
+
stdout: stringValue(record.stdout ?? record.output),
|
|
188
|
+
stderr: stringValue(record.stderr ?? record.errorOutput ?? record.error_output)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function numberValue(value) {
|
|
192
|
+
if (typeof value === "number" && Number.isFinite(value)) return Math.trunc(value);
|
|
193
|
+
if (typeof value === "string" && /^-?\d+$/.test(value)) return Number(value);
|
|
194
|
+
}
|
|
195
|
+
function stringValue(value) {
|
|
196
|
+
return typeof value === "string" ? value : void 0;
|
|
197
|
+
}
|
|
198
|
+
function nonBlankLines(text) {
|
|
199
|
+
return text.split("\n").filter((line) => line.trim().length > 0);
|
|
200
|
+
}
|
|
201
|
+
function extractResultPath(line) {
|
|
202
|
+
const trimmed = line.trim();
|
|
203
|
+
const colonPath = trimmed.match(/^(.+?):\d+(?::\d+)?:/);
|
|
204
|
+
if (colonPath?.[1]) return colonPath[1];
|
|
205
|
+
const jsonPath = trimmed.match(/"?(?:path|file|file_path)"?\s*[:=]\s*"([^"]+)"/i);
|
|
206
|
+
if (jsonPath?.[1]) return jsonPath[1];
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
export { compactPath, displayToolName, extractExitCode, formatArgsSummary, formatCollapsedToolSummary, formatExecExpandedOutput, getToolSummaryKind, isExecStyleTool, isMcpStyleTool, isReadStyleTool, isSearchStyleTool };
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=tool-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-summary.js","names":[],"sources":["../../../src/tui/tool-summary.ts"],"sourcesContent":["import { basename, dirname } from 'node:path';\n\nimport { Text } from '@earendil-works/pi-tui';\n\nimport type { TuiToolContentBlock } from './tui-tool-result.js';\n\nconst MAX_ARG_VALUE_LENGTH = 120;\nconst MAX_PATH_LABEL_LENGTH = 72;\n\nexport type ToolSummaryKind = 'read' | 'search' | 'exec' | 'mcp' | 'generic';\n\nexport interface ToolSummaryContext {\n toolName: string;\n args: unknown;\n output: string;\n content?: TuiToolContentBlock[];\n details: unknown;\n isError: boolean;\n expandKey: string;\n}\n\nexport function formatArgsSummary(args: unknown, toolName: string): string {\n if (!args || typeof args !== 'object') return '';\n const compactRead = isReadStyleTool(toolName) ? formatCompactReadArgs(args) : null;\n if (compactRead) return compactRead;\n const command = isExecStyleTool(toolName) ? commandFromArgs(args) : null;\n if (command) return command;\n const entries = Object.entries(args as Record<string, unknown>);\n if (entries.length === 0) return '';\n return entries\n .map(([key, value]) => {\n const stringValue = formatArgValue(value);\n const truncated =\n stringValue.length > MAX_ARG_VALUE_LENGTH\n ? `${stringValue.slice(0, MAX_ARG_VALUE_LENGTH - 3)}...`\n : stringValue;\n return `${key}=${truncated}`;\n })\n .join(', ');\n}\n\nexport function getToolSummaryKind(toolName: string): ToolSummaryKind {\n if (isReadStyleTool(toolName)) return 'read';\n if (isSearchStyleTool(toolName)) return 'search';\n if (isExecStyleTool(toolName)) return 'exec';\n if (isMcpStyleTool(toolName)) return 'mcp';\n return 'generic';\n}\n\nexport function isReadStyleTool(toolName: string): boolean {\n const base = baseToolName(toolName);\n return ['read', 'read_file', 'memory_get'].includes(base);\n}\n\nexport function isSearchStyleTool(toolName: string): boolean {\n const base = baseToolName(toolName);\n return [\n 'search',\n 'grep',\n 'rg',\n 'ripgrep',\n 'search_code',\n 'file_search',\n 'list_files',\n ].includes(base);\n}\n\nexport function isExecStyleTool(toolName: string): boolean {\n const base = baseToolName(toolName);\n return [\n 'bash',\n 'shell',\n 'exec',\n 'run_command',\n 'exec_command',\n 'terminal',\n ].includes(base);\n}\n\nexport function isMcpStyleTool(toolName: string): boolean {\n return toolName.includes('__');\n}\n\nexport function displayToolName(toolName: string): string {\n const parts = toolName.split('__');\n if (parts.length === 2 && parts[0] && parts[1]) {\n return `${parts[0]}.${parts[1]}`;\n }\n return toolName;\n}\n\nexport function compactPath(path: string, maxLength = MAX_PATH_LABEL_LENGTH): string {\n const normalized = path.replace(/\\\\/g, '/');\n if (normalized.length <= maxLength) return normalized;\n const base = basename(normalized);\n const parent = basename(dirname(normalized));\n const suffix = parent ? `${parent}/${base}` : base;\n if (suffix.length + 2 <= maxLength) return `.../${suffix}`;\n return `.../${base.slice(Math.max(0, base.length - maxLength + 3))}`;\n}\n\nexport function formatCollapsedToolSummary(ctx: ToolSummaryContext): string {\n if (ctx.isError) {\n const rows = nonBlankLines(ctx.output).length;\n const rowLabel = rows === 1 ? '1 error line' : `${rows} error lines`;\n return `error; ${rowLabel}; ${ctx.expandKey} to expand`;\n }\n\n switch (getToolSummaryKind(ctx.toolName)) {\n case 'read': {\n const rows = new Text(ctx.output, 1, 0).render(80).length;\n const plural = rows === 1 ? 'row' : 'rows';\n return ` ${rows} ${plural}; ${ctx.expandKey} to expand`;\n }\n case 'search':\n return formatSearchSummary(ctx.output, ctx.expandKey);\n case 'exec':\n return formatExecSummary(ctx.output, ctx.details, ctx.isError, ctx.expandKey);\n case 'mcp':\n return formatMcpSummary(ctx.output, ctx.content, ctx.expandKey);\n case 'generic':\n return '';\n }\n}\n\nexport function formatExecExpandedOutput(output: string, details: unknown): string {\n const parsed = parseExecDetails(details);\n const sections: string[] = [];\n const stdout = parsed.stdout ?? output;\n if (stdout.trim()) {\n sections.push(`stdout\\n${stdout}`);\n }\n if (parsed.stderr?.trim()) {\n sections.push(`stderr\\n${parsed.stderr}`);\n }\n if (parsed.exitCode !== undefined) {\n sections.push(`exit ${parsed.exitCode}`);\n }\n return sections.join('\\n');\n}\n\nexport function extractExitCode(details: unknown): number | undefined {\n return parseExecDetails(details).exitCode;\n}\n\nfunction formatCompactReadArgs(args: unknown): string | null {\n if (!args || typeof args !== 'object') return null;\n const record = args as Record<string, unknown>;\n const rawPath = typeof record.path === 'string'\n ? record.path\n : typeof record.file_path === 'string'\n ? record.file_path\n : undefined;\n if (!rawPath) return null;\n\n const normalized = rawPath.replace(/\\\\/g, '/');\n const base = basename(normalized);\n let label: string;\n if (base === 'SKILL.md') {\n const parent = basename(dirname(normalized));\n label = parent ? `[skill] ${parent}` : '[skill]';\n } else if (base === 'AGENTS.md') {\n label = `read resource ${compactPath(normalized)}`;\n } else {\n label = compactPath(normalized);\n }\n\n const start = firstFiniteNumber(record.offset, record.from, record.start, record.line);\n const count = firstFiniteNumber(record.limit, record.lines, record.count);\n if (start != null && count != null && count > 0) {\n label += `:${start}-${start + count - 1}`;\n }\n return label;\n}\n\nfunction commandFromArgs(args: unknown): string | null {\n if (!args || typeof args !== 'object') return null;\n const record = args as Record<string, unknown>;\n const raw = record.command ?? record.cmd ?? record.script;\n if (Array.isArray(raw)) return raw.map(String).join(' ');\n if (typeof raw === 'string' && raw.trim()) return raw.trim();\n return null;\n}\n\nfunction baseToolName(toolName: string): string {\n return toolName.split('__').pop()?.toLowerCase() ?? toolName.toLowerCase();\n}\n\nfunction firstFiniteNumber(...values: unknown[]): number | null {\n for (const value of values) {\n if (typeof value === 'number' && Number.isFinite(value)) return Math.floor(value);\n if (typeof value === 'string' && value.trim()) {\n const parsed = Number(value);\n if (Number.isFinite(parsed)) return Math.floor(parsed);\n }\n }\n return null;\n}\n\nfunction formatArgValue(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'bigint') return `${value.toString()}n`;\n if (typeof value === 'function') return '[function]';\n if (typeof value === 'symbol') return String(value);\n if (value instanceof Error) return value.message || value.name;\n try {\n const json = JSON.stringify(value);\n return json === undefined ? String(value) : json;\n } catch {\n return String(value);\n }\n}\n\nfunction formatSearchSummary(output: string, expandKey: string): string {\n const lines = nonBlankLines(output);\n const paths = new Set<string>();\n let matchCount = 0;\n for (const line of lines) {\n const path = extractResultPath(line);\n if (path) paths.add(compactPath(path, 48));\n if (line.trim()) matchCount += 1;\n }\n\n const matchLabel = matchCount === 1 ? '1 result' : `${matchCount} results`;\n const fileLabel = paths.size === 0\n ? ''\n : paths.size === 1\n ? ` in ${[...paths][0]}`\n : ` in ${paths.size} files`;\n const samples = [...paths].slice(0, 3).join(', ');\n const sampleSuffix = samples && paths.size > 1 ? `: ${samples}` : '';\n return `${matchLabel}${fileLabel}${sampleSuffix}; ${expandKey} to expand`;\n}\n\nfunction formatExecSummary(\n output: string,\n details: unknown,\n isError: boolean,\n expandKey: string,\n): string {\n const parsed = parseExecDetails(details);\n const outputText = [parsed.stdout, parsed.stderr].filter(Boolean).join('\\n') || output;\n const rows = nonBlankLines(outputText).length;\n const exit = parsed.exitCode === undefined\n ? isError ? 'failed' : 'completed'\n : `exit ${parsed.exitCode}`;\n const rowLabel = rows === 1 ? '1 output line' : `${rows} output lines`;\n return `${exit}; ${rowLabel}; ${expandKey} to expand`;\n}\n\nfunction formatMcpSummary(\n output: string,\n content: TuiToolContentBlock[] | undefined,\n expandKey: string,\n): string {\n if (content?.length) {\n const counts = new Map<string, number>();\n for (const block of content) {\n counts.set(block.type, (counts.get(block.type) ?? 0) + 1);\n }\n const label = [...counts.entries()]\n .map(([type, count]) => `${count} ${type}`)\n .join(', ');\n return `${label}; ${expandKey} to expand`;\n }\n const rows = nonBlankLines(output).length;\n const rowLabel = rows === 1 ? '1 result line' : `${rows} result lines`;\n return `${rowLabel}; ${expandKey} to expand`;\n}\n\nfunction parseExecDetails(details: unknown): {\n exitCode?: number;\n stdout?: string;\n stderr?: string;\n} {\n if (!details || typeof details !== 'object') return {};\n const record = details as Record<string, unknown>;\n return {\n exitCode: numberValue(record.exitCode ?? record.exit_code ?? record.code ?? record.status),\n stdout: stringValue(record.stdout ?? record.output),\n stderr: stringValue(record.stderr ?? record.errorOutput ?? record.error_output),\n };\n}\n\nfunction numberValue(value: unknown): number | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) return Math.trunc(value);\n if (typeof value === 'string' && /^-?\\d+$/.test(value)) return Number(value);\n return undefined;\n}\n\nfunction stringValue(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction nonBlankLines(text: string): string[] {\n return text.split('\\n').filter((line) => line.trim().length > 0);\n}\n\nfunction extractResultPath(line: string): string | null {\n const trimmed = line.trim();\n const colonPath = trimmed.match(/^(.+?):\\d+(?::\\d+)?:/);\n if (colonPath?.[1]) return colonPath[1];\n const jsonPath = trimmed.match(/\"?(?:path|file|file_path)\"?\\s*[:=]\\s*\"([^\"]+)\"/i);\n if (jsonPath?.[1]) return jsonPath[1];\n return null;\n}\n"],"mappings":";;;AAMA,MAAM,uBAAuB;AAC7B,MAAM,wBAAwB;AAc9B,SAAgB,kBAAkB,MAAe,UAA0B;AACzE,KAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;CAC9C,MAAM,cAAc,gBAAgB,SAAS,GAAG,sBAAsB,KAAK,GAAG;AAC9E,KAAI,YAAa,QAAO;CACxB,MAAM,UAAU,gBAAgB,SAAS,GAAG,gBAAgB,KAAK,GAAG;AACpE,KAAI,QAAS,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,KAAgC;AAC/D,KAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAO,QACJ,KAAK,CAAC,KAAK,WAAW;EACrB,MAAM,cAAc,eAAe,MAAM;AAKzC,SAAO,GAAG,IAAI,GAHZ,YAAY,SAAS,uBACjB,GAAG,YAAY,MAAM,GAAG,uBAAuB,EAAE,CAAC,OAClD;GAEN,CACD,KAAK,KAAK;;AAGf,SAAgB,mBAAmB,UAAmC;AACpE,KAAI,gBAAgB,SAAS,CAAE,QAAO;AACtC,KAAI,kBAAkB,SAAS,CAAE,QAAO;AACxC,KAAI,gBAAgB,SAAS,CAAE,QAAO;AACtC,KAAI,eAAe,SAAS,CAAE,QAAO;AACrC,QAAO;;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../session/transcript-outline.js';
|
|
2
3
|
import type { ExportFormat } from '../session/types.js';
|
|
3
4
|
import type { ReviewContext } from '../review/review-git.js';
|
|
4
5
|
import type { SessionInfo, TuiEventSource } from './tui-types.js';
|
|
@@ -62,6 +63,12 @@ export interface TuiSessionStats {
|
|
|
62
63
|
total: number;
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
export interface TuiHistoryWindow {
|
|
67
|
+
messages: HistoryMessage[];
|
|
68
|
+
startRowNumber: number;
|
|
69
|
+
endRowNumber: number;
|
|
70
|
+
totalRows: number;
|
|
71
|
+
}
|
|
65
72
|
export type TuiExportFormat = ExportFormat | 'html';
|
|
66
73
|
export interface TuiCompactionResult {
|
|
67
74
|
compacted: boolean;
|
|
@@ -223,8 +230,17 @@ export interface TuiBackend {
|
|
|
223
230
|
}): Promise<{
|
|
224
231
|
messages: HistoryMessage[];
|
|
225
232
|
}>;
|
|
233
|
+
/** Load a bounded transcript window around a persisted row number. */
|
|
234
|
+
loadHistoryWindow?(opts: {
|
|
235
|
+
sessionKey: string;
|
|
236
|
+
rowNumber: number;
|
|
237
|
+
before?: number;
|
|
238
|
+
after?: number;
|
|
239
|
+
}): Promise<TuiHistoryWindow>;
|
|
226
240
|
/** Load current transcript rows as a tree-shaped list. */
|
|
227
241
|
loadTranscriptTree(sessionKey: string): Promise<TuiTranscriptTreeEntry[]>;
|
|
242
|
+
/** Load current transcript rows as timeline items for turn navigation. */
|
|
243
|
+
loadTimeline(sessionKey: string): Promise<SessionTimelineItem[]>;
|
|
228
244
|
/** Compute transcript message/token statistics. */
|
|
229
245
|
getSessionStats(sessionKey: string): Promise<TuiSessionStats>;
|
|
230
246
|
/** List sessions. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { parseAgentSessionKey } from "../routing/session-key-utils.js";
|
|
2
|
-
import { init_agent_session_key } from "../routing/agent-session-key.js";
|
|
3
1
|
import { getLogDir } from "../utils/logger/config.js";
|
|
4
2
|
import { getRuntimeLogStats } from "../utils/logger/stats.js";
|
|
5
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
+
import { parseAgentSessionKey } from "../routing/session-key-utils.js";
|
|
5
|
+
import { init_agent_session_key } from "../routing/agent-session-key.js";
|
|
6
6
|
import { resolveConfigPath } from "../config/paths.js";
|
|
7
7
|
import { getProviderDisplayName, getSortedProviders, init_providers, providerSupportsApiKey, providerSupportsOAuth } from "../providers/index.js";
|
|
8
8
|
import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KeybindingsManager, TUI } from '@earendil-works/pi-tui';
|
|
2
2
|
import type { TuiCompactionResult, TuiModelChoice, TuiShareRequest, TuiSessionStats, TuiSessionItem, TuiStartupResources, TuiTranscriptTreeEntry, TuiAgentInfo } from './tui-backend.js';
|
|
3
3
|
import type { ChatLog } from './components/chat-log.js';
|
|
4
|
+
import type { SessionTimelineItem } from '../session/transcript-outline.js';
|
|
4
5
|
import { type TuiHotkeyExtensionShortcut } from './format-tui-hotkeys.js';
|
|
5
6
|
import type { TuiState } from './tui-types.js';
|
|
6
7
|
import { type ReasoningLevel, type ThinkLevel, type VerboseLevel } from '../agent/transcript/thinking-types.js';
|
|
@@ -37,6 +38,7 @@ export type CommandHandlerDeps = {
|
|
|
37
38
|
openSessionPicker: () => void;
|
|
38
39
|
openSessionTree: () => void;
|
|
39
40
|
openTranscriptTree: () => void;
|
|
41
|
+
openTimeline: (initialSearch?: string) => void;
|
|
40
42
|
openUserMessageFork: () => void;
|
|
41
43
|
openScopedModels: () => void;
|
|
42
44
|
openThinkingSelector: () => void;
|
|
@@ -63,6 +65,13 @@ export type CommandHandlerDeps = {
|
|
|
63
65
|
getSessionStats?: () => TuiSessionStats | Promise<TuiSessionStats>;
|
|
64
66
|
getStartupResources?: () => TuiStartupResources | undefined;
|
|
65
67
|
loadTranscriptTree?: () => TuiTranscriptTreeEntry[] | Promise<TuiTranscriptTreeEntry[]>;
|
|
68
|
+
loadTimeline?: () => SessionTimelineItem[] | Promise<SessionTimelineItem[]>;
|
|
69
|
+
loadHistoryWindow?: (opts: {
|
|
70
|
+
rowNumber: number;
|
|
71
|
+
before?: number;
|
|
72
|
+
after?: number;
|
|
73
|
+
}) => boolean | Promise<boolean>;
|
|
74
|
+
loadSessionHistory?: () => void | Promise<void>;
|
|
66
75
|
exportSession?: (request: TuiExportRequest) => void | Promise<void>;
|
|
67
76
|
importSession?: (request: TuiImportRequest) => void | Promise<void>;
|
|
68
77
|
createShare?: (request: TuiShareRequest) => void | Promise<void>;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
+
import { closeXopcDatabase, isXopcDatabaseOpen, openXopcDatabase } from "../storage/sqlite/connection.js";
|
|
1
2
|
import { parseAgentSessionKey } from "../routing/session-key-utils.js";
|
|
2
3
|
import { init_agent_session_key, isValidAgentId, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
4
|
+
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
5
|
+
import "../storage/sqlite/index.js";
|
|
3
6
|
import { resolveConfigPath } from "../config/paths.js";
|
|
4
7
|
import { loadConfig } from "../config/loader.js";
|
|
5
8
|
import { init_providers, providerSupportsOAuth } from "../providers/index.js";
|
|
6
|
-
import { closeXopcDatabase, isXopcDatabaseOpen, openXopcDatabase } from "../storage/sqlite/connection.js";
|
|
7
9
|
import { GoalService } from "../goals/goal-service.js";
|
|
8
10
|
import "../goals/index.js";
|
|
9
|
-
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
10
|
-
import "../storage/sqlite/index.js";
|
|
11
11
|
import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
|
|
12
|
-
import { normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel } from "../agent/transcript/thinking-types.js";
|
|
13
|
-
import { provenanceTracker } from "../extensions/security.js";
|
|
14
|
-
import "../config/index.js";
|
|
15
12
|
import { ProjectService } from "../projects/project-service.js";
|
|
16
13
|
import { isValidProjectAgentId, normalizeProjectAgentId } from "../projects/project-agent.js";
|
|
17
14
|
import { inferSuggestedProjectDefaultAgentId } from "../projects/project-agent-suggestion.js";
|
|
18
15
|
import "../projects/index.js";
|
|
16
|
+
import { normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel } from "../agent/transcript/thinking-types.js";
|
|
17
|
+
import { provenanceTracker } from "../extensions/security.js";
|
|
18
|
+
import "../config/index.js";
|
|
19
|
+
import { theme } from "./theme.js";
|
|
19
20
|
import { getTuiKeybindingsPath } from "./tui-keybindings-file.js";
|
|
20
21
|
import { formatKeyIds, formatXopcTuiHotkeys } from "./format-tui-hotkeys.js";
|
|
21
22
|
import { formatTuiConfigInfo, formatTuiContextInfo, formatTuiLoginInfo, formatTuiModelsInfo, formatTuiSessionInfo, formatTuiSessionListInfo, formatTuiSessionTreeInfo, formatTuiStoredAuthProfilesInfo, formatTuiTranscriptTreeInfo, formatTuiTrustInfo, formatTuiUsageInfo, formatTuiWorkflowDetail, formatTuiWorkflowsInfo, loadTuiChangelogInfo, nextVerboseLevel, parseTuiExportRequest, parseTuiImportRequest, parseTuiShareRequest, writeTuiDebugInfo } from "./tui-command-formatters.js";
|
|
23
|
+
import { buildTuiTimelineTurns, findNearestTimelineTurnByDisplayIndex, findTimelineTurnByNumber } from "./tui-timeline.js";
|
|
22
24
|
import { getAuthStorePath, listAllProfiles, listProfilesForProvider, removeAuthProfile } from "../auth/profiles/profiles.js";
|
|
23
25
|
import { rewriteUnknownSlashAsWorkflow } from "./tui-workflow-slash.js";
|
|
24
26
|
import { formatTuiStartupText } from "./tui-startup-text.js";
|
|
@@ -160,6 +162,10 @@ function getSlashCommands(_isLocal, keybindings) {
|
|
|
160
162
|
name: "tree",
|
|
161
163
|
description: "Show grouped session tree"
|
|
162
164
|
},
|
|
165
|
+
{
|
|
166
|
+
name: "timeline",
|
|
167
|
+
description: "Jump to a previous turn in the current session"
|
|
168
|
+
},
|
|
163
169
|
{
|
|
164
170
|
name: "scoped-models",
|
|
165
171
|
description: `Choose models for ${modelCycleKey} cycling`
|
|
@@ -332,6 +338,82 @@ function defaultAuthProfiles() {
|
|
|
332
338
|
getStorePath: () => getAuthStorePath()
|
|
333
339
|
};
|
|
334
340
|
}
|
|
341
|
+
function timelineUsage() {
|
|
342
|
+
return ["Usage: /timeline [turn|latest|prev|next|search <text>]", "Examples: /timeline, /timeline 12, /timeline prev, /timeline search deploy"].join("\n");
|
|
343
|
+
}
|
|
344
|
+
function currentTimelineTurnIndex(turns, chatLog) {
|
|
345
|
+
const viewState = chatLog.getTimelineViewportState();
|
|
346
|
+
if (viewState.mode === "history") {
|
|
347
|
+
const current = findNearestTimelineTurnByDisplayIndex(turns, viewState.displayIndex);
|
|
348
|
+
const index = current ? turns.findIndex((turn) => turn.id === current.id) : -1;
|
|
349
|
+
return index >= 0 ? index : turns.length - 1;
|
|
350
|
+
}
|
|
351
|
+
return turns.length - 1;
|
|
352
|
+
}
|
|
353
|
+
async function runTimelineCommand(commandArgs, deps) {
|
|
354
|
+
const raw = commandArgs.trim();
|
|
355
|
+
if (!raw) {
|
|
356
|
+
if (deps.uiOverlays?.openTimeline) deps.uiOverlays.openTimeline();
|
|
357
|
+
else {
|
|
358
|
+
deps.chatLog.addSystem("Timeline picker is not available in this mode.");
|
|
359
|
+
deps.tui.requestRender();
|
|
360
|
+
}
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const [subcommandRaw, ...rest] = raw.split(/\s+/);
|
|
364
|
+
const subcommand = (subcommandRaw ?? "").toLowerCase();
|
|
365
|
+
if (subcommand === "search" || subcommand === "find") {
|
|
366
|
+
if (deps.uiOverlays?.openTimeline) deps.uiOverlays.openTimeline(rest.join(" ").trim());
|
|
367
|
+
else {
|
|
368
|
+
deps.chatLog.addSystem("Timeline picker is not available in this mode.");
|
|
369
|
+
deps.tui.requestRender();
|
|
370
|
+
}
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (subcommand === "latest" || subcommand === "live" || subcommand === "end") {
|
|
374
|
+
await deps.loadSessionHistory?.();
|
|
375
|
+
deps.chatLog.jumpToLatest();
|
|
376
|
+
deps.chatLog.addSystem(theme.dim("Returned to latest transcript view."));
|
|
377
|
+
deps.tui.requestRender();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (!deps.loadTimeline) {
|
|
381
|
+
deps.chatLog.addSystem("Timeline is not available in this mode.");
|
|
382
|
+
deps.tui.requestRender();
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const turns = buildTuiTimelineTurns(await Promise.resolve(deps.loadTimeline()));
|
|
386
|
+
if (turns.length === 0) {
|
|
387
|
+
deps.chatLog.addSystem("No timeline turns found.");
|
|
388
|
+
deps.tui.requestRender();
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
let target;
|
|
392
|
+
if (subcommand === "prev" || subcommand === "previous") target = turns[Math.max(0, currentTimelineTurnIndex(turns, deps.chatLog) - 1)];
|
|
393
|
+
else if (subcommand === "next") target = turns[Math.min(turns.length - 1, currentTimelineTurnIndex(turns, deps.chatLog) + 1)];
|
|
394
|
+
else {
|
|
395
|
+
const turnNumber = Number.parseInt(subcommand, 10);
|
|
396
|
+
if (!Number.isFinite(turnNumber) || String(turnNumber) !== subcommand) {
|
|
397
|
+
deps.chatLog.addSystem(timelineUsage());
|
|
398
|
+
deps.tui.requestRender();
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
target = findTimelineTurnByNumber(turns, turnNumber);
|
|
402
|
+
}
|
|
403
|
+
if (!target) {
|
|
404
|
+
deps.chatLog.addSystem(`Timeline turn not found: ${raw}`);
|
|
405
|
+
deps.tui.requestRender();
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (!deps.chatLog.jumpToDisplayIndex(target.displayIndex)) {
|
|
409
|
+
if ((target.rowNumber !== void 0 && deps.loadHistoryWindow ? await deps.loadHistoryWindow({ rowNumber: target.rowNumber }) : false) && deps.chatLog.jumpToDisplayIndex(target.displayIndex)) {
|
|
410
|
+
deps.tui.requestRender();
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
deps.chatLog.addSystem(`Turn ${target.turn} is outside loaded history.`);
|
|
414
|
+
}
|
|
415
|
+
deps.tui.requestRender();
|
|
416
|
+
}
|
|
335
417
|
function formatAgentsList(agents, currentAgentId) {
|
|
336
418
|
if (agents.length === 0) return "No agents available.";
|
|
337
419
|
const current = currentAgentId?.trim().toLowerCase();
|
|
@@ -910,6 +992,13 @@ function createTuiCommandHandler(deps) {
|
|
|
910
992
|
tui.requestRender();
|
|
911
993
|
});
|
|
912
994
|
return;
|
|
995
|
+
case "timeline":
|
|
996
|
+
runTimelineCommand(commandArgs, deps).catch((err) => {
|
|
997
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
998
|
+
chatLog.addSystem(`Timeline failed: ${errorMessage}`);
|
|
999
|
+
tui.requestRender();
|
|
1000
|
+
});
|
|
1001
|
+
return;
|
|
913
1002
|
case "switch": {
|
|
914
1003
|
const modelRef = commandArgs.trim();
|
|
915
1004
|
if (!modelRef) {
|