@clawpump/claw-agent 0.1.4 → 0.1.6
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/agent/.dockerignore +67 -0
- package/agent/.envrc +1 -1
- package/agent/.gitattributes +8 -0
- package/agent/AGENTS.md +216 -4
- package/agent/CONTRIBUTING.md +46 -8
- package/agent/Dockerfile +78 -35
- package/agent/MANIFEST.in +2 -0
- package/agent/README.md +12 -5
- package/agent/README.ur-pk.md +261 -0
- package/agent/README.zh-CN.md +11 -8
- package/agent/SECURITY.md +5 -4
- package/agent/acp_adapter/provenance.py +127 -0
- package/agent/acp_adapter/server.py +112 -5
- package/agent/acp_adapter/session.py +1 -6
- package/agent/acp_registry/agent.json +2 -2
- package/agent/agent/account_usage.py +313 -1
- package/agent/agent/agent_init.py +140 -37
- package/agent/agent/agent_runtime_helpers.py +342 -83
- package/agent/agent/anthropic_adapter.py +320 -33
- package/agent/agent/auxiliary_client.py +525 -105
- package/agent/agent/background_review.py +157 -19
- package/agent/agent/bedrock_adapter.py +71 -6
- package/agent/agent/billing_view.py +295 -0
- package/agent/agent/chat_completion_helpers.py +229 -4
- package/agent/agent/codex_responses_adapter.py +86 -10
- package/agent/agent/codex_runtime.py +153 -1
- package/agent/agent/coding_context.py +738 -0
- package/agent/agent/context_compressor.py +392 -44
- package/agent/agent/context_references.py +34 -1
- package/agent/agent/conversation_compression.py +159 -22
- package/agent/agent/conversation_loop.py +643 -908
- package/agent/agent/copilot_acp_client.py +4 -11
- package/agent/agent/credential_pool.py +5 -3
- package/agent/agent/credits_tracker.py +794 -0
- package/agent/agent/curator.py +91 -18
- package/agent/agent/curator_backup.py +26 -10
- package/agent/agent/display.py +42 -1
- package/agent/agent/error_classifier.py +52 -3
- package/agent/agent/errors.py +3 -0
- package/agent/agent/file_safety.py +0 -17
- package/agent/agent/gemini_native_adapter.py +31 -1
- package/agent/agent/i18n.py +48 -4
- package/agent/agent/image_gen_provider.py +74 -5
- package/agent/agent/image_routing.py +29 -0
- package/agent/agent/insights.py +8 -17
- package/agent/agent/lsp/install.py +3 -0
- package/agent/agent/memory_manager.py +326 -31
- package/agent/agent/message_content.py +50 -0
- package/agent/agent/model_metadata.py +214 -3
- package/agent/agent/moonshot_schema.py +8 -1
- package/agent/agent/onboarding.py +60 -0
- package/agent/agent/prompt_builder.py +327 -37
- package/agent/agent/redact.py +1 -0
- package/agent/agent/runtime_cwd.py +34 -5
- package/agent/agent/secret_scope.py +205 -0
- package/agent/agent/secret_sources/bitwarden.py +34 -2
- package/agent/agent/skill_commands.py +90 -1
- package/agent/agent/skill_preprocessing.py +1 -0
- package/agent/agent/skill_utils.py +209 -36
- package/agent/agent/ssl_guard.py +94 -0
- package/agent/agent/system_prompt.py +133 -5
- package/agent/agent/tool_executor.py +496 -70
- package/agent/agent/transports/anthropic.py +83 -21
- package/agent/agent/transports/chat_completions.py +94 -5
- package/agent/agent/transports/codex.py +67 -2
- package/agent/agent/transports/codex_app_server.py +1 -0
- package/agent/agent/transports/codex_app_server_session.py +30 -0
- package/agent/agent/transports/types.py +12 -0
- package/agent/agent/turn_context.py +408 -0
- package/agent/agent/turn_finalizer.py +428 -0
- package/agent/agent/turn_retry_state.py +68 -0
- package/agent/agent/usage_pricing.py +3 -0
- package/agent/apps/bootstrap-installer/package.json +6 -5
- package/agent/apps/bootstrap-installer/src/routes/failure.tsx +12 -5
- package/agent/apps/bootstrap-installer/src/routes/progress.tsx +1 -3
- package/agent/apps/bootstrap-installer/src/store.ts +3 -2
- package/agent/apps/bootstrap-installer/src-tauri/src/bootstrap.rs +172 -7
- package/agent/apps/bootstrap-installer/src-tauri/src/events.rs +14 -1
- package/agent/apps/bootstrap-installer/src-tauri/src/paths.rs +29 -0
- package/agent/apps/bootstrap-installer/src-tauri/src/powershell.rs +93 -3
- package/agent/apps/bootstrap-installer/src-tauri/src/update.rs +695 -39
- package/agent/apps/bootstrap-installer/tsconfig.json +3 -4
- package/agent/apps/desktop/DESIGN.md +167 -0
- package/agent/apps/desktop/README.md +20 -16
- package/agent/apps/desktop/assets/icon.icns +0 -0
- package/agent/apps/desktop/assets/icon.ico +0 -0
- package/agent/apps/desktop/assets/icon.png +0 -0
- package/agent/apps/desktop/electron/backend-env.cjs +112 -0
- package/agent/apps/desktop/electron/backend-env.test.cjs +111 -0
- package/agent/apps/desktop/electron/backend-probes.test.cjs +3 -1
- package/agent/apps/desktop/electron/backend-ready.cjs +66 -0
- package/agent/apps/desktop/electron/bootstrap-platform.cjs +52 -0
- package/agent/apps/desktop/electron/bootstrap-platform.test.cjs +59 -1
- package/agent/apps/desktop/electron/bootstrap-runner.cjs +176 -38
- package/agent/apps/desktop/electron/bootstrap-runner.test.cjs +112 -1
- package/agent/apps/desktop/electron/connection-config.cjs +288 -0
- package/agent/apps/desktop/electron/connection-config.test.cjs +396 -0
- package/agent/apps/desktop/electron/dashboard-token.cjs +99 -0
- package/agent/apps/desktop/electron/dashboard-token.test.cjs +142 -0
- package/agent/apps/desktop/electron/desktop-uninstall.cjs +232 -0
- package/agent/apps/desktop/electron/desktop-uninstall.test.cjs +246 -0
- package/agent/apps/desktop/electron/entitlements.mac.inherit.plist +2 -0
- package/agent/apps/desktop/electron/fs-read-dir.cjs +109 -0
- package/agent/apps/desktop/electron/fs-read-dir.test.cjs +364 -0
- package/agent/apps/desktop/electron/gateway-ws-probe.cjs +188 -0
- package/agent/apps/desktop/electron/gateway-ws-probe.test.cjs +122 -0
- package/agent/apps/desktop/electron/git-root.cjs +54 -0
- package/agent/apps/desktop/electron/git-root.test.cjs +40 -0
- package/agent/apps/desktop/electron/git-worktrees.cjs +174 -0
- package/agent/apps/desktop/electron/hardening.cjs +123 -28
- package/agent/apps/desktop/electron/hardening.test.cjs +163 -0
- package/agent/apps/desktop/electron/main.cjs +3121 -331
- package/agent/apps/desktop/electron/oauth-net-request.cjs +20 -0
- package/agent/apps/desktop/electron/oauth-net-request.test.cjs +34 -0
- package/agent/apps/desktop/electron/preload.cjs +52 -2
- package/agent/apps/desktop/electron/session-windows.cjs +124 -0
- package/agent/apps/desktop/electron/session-windows.test.cjs +199 -0
- package/agent/apps/desktop/electron/update-rebuild.cjs +29 -0
- package/agent/apps/desktop/electron/update-rebuild.test.cjs +55 -0
- package/agent/apps/desktop/electron/update-remote.cjs +56 -0
- package/agent/apps/desktop/electron/update-remote.test.cjs +78 -0
- package/agent/apps/desktop/electron/vscode-marketplace.cjs +331 -0
- package/agent/apps/desktop/electron/vscode-marketplace.test.cjs +113 -0
- package/agent/apps/desktop/electron/windows-child-process.test.cjs +57 -0
- package/agent/apps/desktop/electron/windows-user-env.cjs +76 -0
- package/agent/apps/desktop/electron/windows-user-env.test.cjs +90 -0
- package/agent/apps/desktop/electron/workspace-cwd.cjs +38 -0
- package/agent/apps/desktop/electron/workspace-cwd.test.cjs +45 -0
- package/agent/apps/desktop/eslint.config.mjs +0 -3
- package/agent/apps/desktop/index.html +27 -2
- package/agent/apps/desktop/package.json +31 -11
- package/agent/apps/desktop/pr-assets/session-source-folders.png +0 -0
- package/agent/apps/desktop/public/apple-touch-icon.png +0 -0
- package/agent/apps/desktop/public/nous-girl.jpg +0 -0
- package/agent/apps/desktop/scripts/assert-dist-built.cjs +70 -0
- package/agent/apps/desktop/scripts/assert-dist-built.test.cjs +84 -0
- package/agent/apps/desktop/scripts/before-pack.cjs +78 -0
- package/agent/apps/desktop/scripts/before-pack.test.cjs +53 -0
- package/agent/apps/desktop/scripts/diag-scroll-reset.mjs +229 -0
- package/agent/apps/desktop/scripts/patch-electron-builder-mac-binary.cjs +64 -0
- package/agent/apps/desktop/scripts/run-electron-builder.cjs +57 -0
- package/agent/apps/desktop/src/app/agents/index.tsx +53 -45
- package/agent/apps/desktop/src/app/artifacts/index.tsx +102 -83
- package/agent/apps/desktop/src/app/chat/chat-drop-overlay.tsx +29 -8
- package/agent/apps/desktop/src/app/chat/chat-swap-overlay.tsx +47 -0
- package/agent/apps/desktop/src/app/chat/composer/attachments.tsx +81 -45
- package/agent/apps/desktop/src/app/chat/composer/completion-drawer.tsx +13 -24
- package/agent/apps/desktop/src/app/chat/composer/context-menu.tsx +138 -88
- package/agent/apps/desktop/src/app/chat/composer/controls.tsx +138 -90
- package/agent/apps/desktop/src/app/chat/composer/enter-submit-dom-race.test.tsx +218 -0
- package/agent/apps/desktop/src/app/chat/composer/focus.ts +32 -0
- package/agent/apps/desktop/src/app/chat/composer/help-hint.tsx +38 -25
- package/agent/apps/desktop/src/app/chat/composer/hooks/use-live-completion-adapter.ts +7 -0
- package/agent/apps/desktop/src/app/chat/composer/hooks/use-mic-recorder.ts +22 -12
- package/agent/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.ts +142 -14
- package/agent/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts +14 -11
- package/agent/apps/desktop/src/app/chat/composer/hooks/use-voice-recorder.ts +9 -6
- package/agent/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx +108 -0
- package/agent/apps/desktop/src/app/chat/composer/index.tsx +930 -180
- package/agent/apps/desktop/src/app/chat/composer/inline-refs.ts +136 -32
- package/agent/apps/desktop/src/app/chat/composer/model-pill.tsx +86 -0
- package/agent/apps/desktop/src/app/chat/composer/queue-panel.tsx +54 -75
- package/agent/apps/desktop/src/app/chat/composer/rich-editor.test.ts +117 -1
- package/agent/apps/desktop/src/app/chat/composer/rich-editor.ts +117 -6
- package/agent/apps/desktop/src/app/chat/composer/slash-nav-dom-repro.test.tsx +186 -0
- package/agent/apps/desktop/src/app/chat/composer/status-stack/index.tsx +202 -0
- package/agent/apps/desktop/src/app/chat/composer/status-stack/status-row.tsx +155 -0
- package/agent/apps/desktop/src/app/chat/composer/text-utils.test.ts +104 -0
- package/agent/apps/desktop/src/app/chat/composer/text-utils.ts +37 -9
- package/agent/apps/desktop/src/app/chat/composer/trigger-popover.test.tsx +50 -0
- package/agent/apps/desktop/src/app/chat/composer/trigger-popover.tsx +105 -40
- package/agent/apps/desktop/src/app/chat/composer/types.ts +5 -0
- package/agent/apps/desktop/src/app/chat/composer/url-dialog.tsx +11 -15
- package/agent/apps/desktop/src/app/chat/composer/voice-activity.tsx +8 -4
- package/agent/apps/desktop/src/app/chat/hooks/use-composer-actions.test.ts +57 -0
- package/agent/apps/desktop/src/app/chat/hooks/use-composer-actions.ts +70 -16
- package/agent/apps/desktop/src/app/chat/hooks/use-file-drop-zone.ts +52 -16
- package/agent/apps/desktop/src/app/chat/index.tsx +234 -81
- package/agent/apps/desktop/src/app/chat/perf-probe.tsx +69 -21
- package/agent/apps/desktop/src/app/chat/right-rail/preview-console.tsx +44 -40
- package/agent/apps/desktop/src/app/chat/right-rail/preview-file.tsx +71 -25
- package/agent/apps/desktop/src/app/chat/right-rail/preview-pane.test.tsx +40 -1
- package/agent/apps/desktop/src/app/chat/right-rail/preview-pane.tsx +55 -53
- package/agent/apps/desktop/src/app/chat/right-rail/preview.tsx +35 -17
- package/agent/apps/desktop/src/app/chat/scroll-to-bottom-button.test.tsx +67 -0
- package/agent/apps/desktop/src/app/chat/scroll-to-bottom-button.tsx +74 -0
- package/agent/apps/desktop/src/app/chat/sidebar/cron-jobs-section.tsx +356 -0
- package/agent/apps/desktop/src/app/chat/sidebar/index.tsx +1189 -364
- package/agent/apps/desktop/src/app/chat/sidebar/load-more-row.tsx +30 -0
- package/agent/apps/desktop/src/app/chat/sidebar/order.test.ts +21 -0
- package/agent/apps/desktop/src/app/chat/sidebar/order.ts +17 -0
- package/agent/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx +524 -0
- package/agent/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx +80 -45
- package/agent/apps/desktop/src/app/chat/sidebar/session-row.tsx +120 -25
- package/agent/apps/desktop/src/app/chat/sidebar/virtual-session-list.tsx +7 -13
- package/agent/apps/desktop/src/app/chat/sidebar/workspace-groups.test.ts +149 -0
- package/agent/apps/desktop/src/app/chat/sidebar/workspace-groups.ts +326 -0
- package/agent/apps/desktop/src/app/chat/thread-loading.ts +7 -2
- package/agent/apps/desktop/src/app/command-center/index.tsx +320 -581
- package/agent/apps/desktop/src/app/command-palette/index.tsx +681 -0
- package/agent/apps/desktop/src/app/command-palette/marketplace-theme-page.tsx +157 -0
- package/agent/apps/desktop/src/app/cron/index.tsx +392 -324
- package/agent/apps/desktop/src/app/cron/job-state.ts +29 -0
- package/agent/apps/desktop/src/app/desktop-controller.tsx +618 -123
- package/agent/apps/desktop/src/app/floating-hud.ts +22 -0
- package/agent/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx +265 -0
- package/agent/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts +260 -14
- package/agent/apps/desktop/src/app/gateway/hooks/use-gateway-request.ts +48 -4
- package/agent/apps/desktop/src/app/hooks/use-keybinds.ts +270 -0
- package/agent/apps/desktop/src/app/hooks/use-refresh-hotkey.ts +45 -0
- package/agent/apps/desktop/src/app/layout-constants.ts +19 -0
- package/agent/apps/desktop/src/app/messaging/index.tsx +136 -241
- package/agent/apps/desktop/src/app/messaging/platform-icon.tsx +95 -0
- package/agent/apps/desktop/src/app/model-visibility-overlay.tsx +31 -0
- package/agent/apps/desktop/src/app/overlays/overlay-search-input.tsx +18 -62
- package/agent/apps/desktop/src/app/overlays/overlay-split-layout.tsx +59 -7
- package/agent/apps/desktop/src/app/overlays/overlay-view.tsx +9 -5
- package/agent/apps/desktop/src/app/page-search-shell.tsx +42 -20
- package/agent/apps/desktop/src/app/profiles/create-profile-dialog.tsx +165 -0
- package/agent/apps/desktop/src/app/profiles/delete-profile-dialog.tsx +65 -0
- package/agent/apps/desktop/src/app/profiles/index.tsx +174 -199
- package/agent/apps/desktop/src/app/profiles/rename-profile-dialog.tsx +125 -0
- package/agent/apps/desktop/src/app/right-sidebar/files/dnd-manager.ts +27 -0
- package/agent/apps/desktop/src/app/right-sidebar/files/ipc.test.ts +100 -0
- package/agent/apps/desktop/src/app/right-sidebar/files/ipc.ts +12 -18
- package/agent/apps/desktop/src/app/right-sidebar/files/remote-picker.tsx +177 -0
- package/agent/apps/desktop/src/app/right-sidebar/files/tree.tsx +35 -21
- package/agent/apps/desktop/src/app/right-sidebar/files/use-project-tree.test.ts +75 -3
- package/agent/apps/desktop/src/app/right-sidebar/files/use-project-tree.ts +152 -5
- package/agent/apps/desktop/src/app/right-sidebar/index.test.tsx +75 -0
- package/agent/apps/desktop/src/app/right-sidebar/index.tsx +166 -129
- package/agent/apps/desktop/src/app/right-sidebar/store.ts +19 -4
- package/agent/apps/desktop/src/app/right-sidebar/terminal/buffer.ts +65 -0
- package/agent/apps/desktop/src/app/right-sidebar/terminal/index.tsx +29 -34
- package/agent/apps/desktop/src/app/right-sidebar/terminal/persistent.tsx +18 -6
- package/agent/apps/desktop/src/app/right-sidebar/terminal/selection.ts +93 -32
- package/agent/apps/desktop/src/app/right-sidebar/terminal/use-terminal-session.ts +381 -119
- package/agent/apps/desktop/src/app/routes.ts +9 -0
- package/agent/apps/desktop/src/app/session/hooks/use-cwd-actions.ts +17 -7
- package/agent/apps/desktop/src/app/session/hooks/use-message-stream.ts +365 -47
- package/agent/apps/desktop/src/app/session/hooks/use-model-controls.test.tsx +198 -0
- package/agent/apps/desktop/src/app/session/hooks/use-model-controls.ts +70 -34
- package/agent/apps/desktop/src/app/session/hooks/use-prompt-actions.test.tsx +1061 -0
- package/agent/apps/desktop/src/app/session/hooks/use-prompt-actions.ts +1143 -165
- package/agent/apps/desktop/src/app/session/hooks/use-route-resume.test.tsx +341 -2
- package/agent/apps/desktop/src/app/session/hooks/use-route-resume.ts +176 -5
- package/agent/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx +259 -0
- package/agent/apps/desktop/src/app/session/hooks/use-session-actions.ts +452 -149
- package/agent/apps/desktop/src/app/session/hooks/use-session-state-cache.test.tsx +327 -0
- package/agent/apps/desktop/src/app/session/hooks/use-session-state-cache.ts +133 -4
- package/agent/apps/desktop/src/app/session-picker-overlay.tsx +32 -0
- package/agent/apps/desktop/src/app/session-switcher.tsx +107 -0
- package/agent/apps/desktop/src/app/settings/about-settings.tsx +45 -36
- package/agent/apps/desktop/src/app/settings/appearance-settings.tsx +243 -162
- package/agent/apps/desktop/src/app/settings/config-settings.tsx +86 -66
- package/agent/apps/desktop/src/app/settings/constants.ts +459 -122
- package/agent/apps/desktop/src/app/settings/credential-key-ui.tsx +373 -0
- package/agent/apps/desktop/src/app/settings/env-credentials.tsx +198 -0
- package/agent/apps/desktop/src/app/settings/env-var-actions-menu.tsx +136 -0
- package/agent/apps/desktop/src/app/settings/field-copy.ts +56 -0
- package/agent/apps/desktop/src/app/settings/gateway-settings.tsx +385 -72
- package/agent/apps/desktop/src/app/settings/helpers.test.ts +156 -1
- package/agent/apps/desktop/src/app/settings/helpers.ts +30 -2
- package/agent/apps/desktop/src/app/settings/index.tsx +118 -84
- package/agent/apps/desktop/src/app/settings/keys-settings.tsx +62 -419
- package/agent/apps/desktop/src/app/settings/mcp-settings.tsx +65 -60
- package/agent/apps/desktop/src/app/settings/model-settings.test.tsx +129 -5
- package/agent/apps/desktop/src/app/settings/model-settings.tsx +370 -65
- package/agent/apps/desktop/src/app/settings/notifications-settings.tsx +150 -0
- package/agent/apps/desktop/src/app/settings/primitives.tsx +5 -11
- package/agent/apps/desktop/src/app/settings/provider-config-panel.test.tsx +142 -0
- package/agent/apps/desktop/src/app/settings/provider-config-panel.tsx +182 -0
- package/agent/apps/desktop/src/app/settings/providers-settings.test.tsx +171 -0
- package/agent/apps/desktop/src/app/settings/providers-settings.tsx +471 -0
- package/agent/apps/desktop/src/app/settings/sessions-settings.tsx +183 -71
- package/agent/apps/desktop/src/app/settings/toolset-config-panel.test.tsx +135 -1
- package/agent/apps/desktop/src/app/settings/toolset-config-panel.tsx +180 -57
- package/agent/apps/desktop/src/app/settings/types.ts +9 -6
- package/agent/apps/desktop/src/app/settings/uninstall-section.tsx +185 -0
- package/agent/apps/desktop/src/app/settings/use-deep-link-highlight.ts +60 -0
- package/agent/apps/desktop/src/app/shell/app-shell.tsx +59 -13
- package/agent/apps/desktop/src/app/shell/gateway-menu-panel.tsx +37 -32
- package/agent/apps/desktop/src/app/shell/hooks/use-overlay-routing.ts +6 -3
- package/agent/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx +212 -53
- package/agent/apps/desktop/src/app/shell/keybind-panel.tsx +215 -0
- package/agent/apps/desktop/src/app/shell/model-edit-submenu.test.tsx +84 -0
- package/agent/apps/desktop/src/app/shell/model-edit-submenu.tsx +244 -0
- package/agent/apps/desktop/src/app/shell/model-menu-panel.tsx +392 -0
- package/agent/apps/desktop/src/app/shell/statusbar-controls.tsx +23 -33
- package/agent/apps/desktop/src/app/shell/titlebar-controls.tsx +79 -95
- package/agent/apps/desktop/src/app/shell/titlebar.ts +8 -2
- package/agent/apps/desktop/src/app/skills/index.test.tsx +11 -0
- package/agent/apps/desktop/src/app/skills/index.tsx +79 -64
- package/agent/apps/desktop/src/app/types.ts +85 -0
- package/agent/apps/desktop/src/app/updates-overlay.tsx +110 -105
- package/agent/apps/desktop/src/components/assistant-ui/ansi-text.tsx +34 -0
- package/agent/apps/desktop/src/components/assistant-ui/block-direction.test.tsx +129 -0
- package/agent/apps/desktop/src/components/assistant-ui/clarify-tool.tsx +102 -81
- package/agent/apps/desktop/src/components/assistant-ui/directive-text.tsx +92 -15
- package/agent/apps/desktop/src/components/assistant-ui/markdown-text.test.ts +38 -0
- package/agent/apps/desktop/src/components/assistant-ui/markdown-text.tsx +304 -45
- package/agent/apps/desktop/src/components/assistant-ui/message-render-boundary.test.tsx +80 -0
- package/agent/apps/desktop/src/components/assistant-ui/message-render-boundary.tsx +48 -0
- package/agent/apps/desktop/src/components/assistant-ui/streaming.test.tsx +142 -90
- package/agent/apps/desktop/src/components/assistant-ui/thread-list.tsx +337 -0
- package/agent/apps/desktop/src/components/assistant-ui/thread.tsx +667 -190
- package/agent/apps/desktop/src/components/assistant-ui/tool-approval-group.test.tsx +299 -0
- package/agent/apps/desktop/src/components/assistant-ui/tool-approval.test.tsx +133 -0
- package/agent/apps/desktop/src/components/assistant-ui/tool-approval.tsx +239 -0
- package/agent/apps/desktop/src/components/assistant-ui/tool-fallback-model.test.ts +31 -0
- package/agent/apps/desktop/src/components/assistant-ui/tool-fallback-model.ts +152 -134
- package/agent/apps/desktop/src/components/assistant-ui/tool-fallback.tsx +142 -150
- package/agent/apps/desktop/src/components/assistant-ui/tooltip-icon-button.tsx +14 -12
- package/agent/apps/desktop/src/components/assistant-ui/user-message-edit.test.tsx +141 -0
- package/agent/apps/desktop/src/components/assistant-ui/user-message-text.tsx +152 -0
- package/agent/apps/desktop/src/components/boot-failure-overlay.tsx +150 -33
- package/agent/apps/desktop/src/components/boot-failure-reauth.test.ts +100 -0
- package/agent/apps/desktop/src/components/boot-failure-reauth.ts +81 -0
- package/agent/apps/desktop/src/components/brand-mark.tsx +19 -0
- package/agent/apps/desktop/src/components/chat/code-card.tsx +1 -1
- package/agent/apps/desktop/src/components/chat/composer-dock.ts +31 -0
- package/agent/apps/desktop/src/components/chat/diff-lines.tsx +1 -1
- package/agent/apps/desktop/src/components/chat/disclosure-row.tsx +13 -3
- package/agent/apps/desktop/src/components/chat/expandable-block.tsx +52 -0
- package/agent/apps/desktop/src/components/chat/generated-image-result.tsx +174 -0
- package/agent/apps/desktop/src/components/chat/image-generation-placeholder.tsx +70 -37
- package/agent/apps/desktop/src/components/chat/intro.tsx +8 -7
- package/agent/apps/desktop/src/components/chat/preview-attachment.tsx +4 -2
- package/agent/apps/desktop/src/components/chat/shiki-highlighter.test.ts +37 -0
- package/agent/apps/desktop/src/components/chat/shiki-highlighter.tsx +96 -22
- package/agent/apps/desktop/src/components/chat/status-row.tsx +70 -0
- package/agent/apps/desktop/src/components/chat/status-section.tsx +42 -0
- package/agent/apps/desktop/src/components/chat/terminal-output.tsx +54 -0
- package/agent/apps/desktop/src/components/chat/zoomable-image.tsx +70 -109
- package/agent/apps/desktop/src/components/desktop-install-overlay.tsx +154 -84
- package/agent/apps/desktop/src/components/desktop-onboarding-overlay.test.tsx +38 -8
- package/agent/apps/desktop/src/components/desktop-onboarding-overlay.tsx +789 -233
- package/agent/apps/desktop/src/components/error-boundary.tsx +77 -0
- package/agent/apps/desktop/src/components/gateway-connecting-overlay.test.tsx +144 -0
- package/agent/apps/desktop/src/components/gateway-connecting-overlay.tsx +7 -1
- package/agent/apps/desktop/src/components/haptics-provider.tsx +24 -0
- package/agent/apps/desktop/src/components/language-switcher.test.tsx +53 -0
- package/agent/apps/desktop/src/components/language-switcher.tsx +175 -0
- package/agent/apps/desktop/src/components/model-picker.tsx +42 -40
- package/agent/apps/desktop/src/components/model-visibility-dialog.tsx +166 -0
- package/agent/apps/desktop/src/components/notifications.tsx +48 -27
- package/agent/apps/desktop/src/components/pane-shell/index.ts +1 -1
- package/agent/apps/desktop/src/components/pane-shell/pane-shell.tsx +146 -9
- package/agent/apps/desktop/src/components/prompt-overlays.tsx +234 -0
- package/agent/apps/desktop/src/components/session-picker.tsx +108 -0
- package/agent/apps/desktop/src/components/ui/action-status.tsx +25 -0
- package/agent/apps/desktop/src/components/ui/badge.tsx +35 -0
- package/agent/apps/desktop/src/components/ui/button.tsx +37 -13
- package/agent/apps/desktop/src/components/ui/confirm-dialog.tsx +109 -0
- package/agent/apps/desktop/src/components/ui/control.ts +25 -0
- package/agent/apps/desktop/src/components/ui/copy-button.test.tsx +36 -0
- package/agent/apps/desktop/src/components/ui/copy-button.tsx +38 -27
- package/agent/apps/desktop/src/components/ui/dialog.tsx +39 -11
- package/agent/apps/desktop/src/components/ui/dropdown-menu.tsx +98 -24
- package/agent/apps/desktop/src/components/ui/error-state.tsx +50 -0
- package/agent/apps/desktop/src/components/ui/fade-text.tsx +9 -2
- package/agent/apps/desktop/src/components/ui/{braille-spinner.tsx → glyph-spinner.tsx} +15 -13
- package/agent/apps/desktop/src/components/ui/input.tsx +5 -2
- package/agent/apps/desktop/src/components/ui/kbd.tsx +83 -12
- package/agent/apps/desktop/src/components/ui/log-view.tsx +19 -0
- package/agent/apps/desktop/src/components/ui/pagination.tsx +12 -5
- package/agent/apps/desktop/src/components/ui/popover.tsx +44 -0
- package/agent/apps/desktop/src/components/ui/search-field.tsx +80 -0
- package/agent/apps/desktop/src/components/ui/segmented-control.tsx +51 -0
- package/agent/apps/desktop/src/components/ui/select.tsx +10 -3
- package/agent/apps/desktop/src/components/ui/sheet.tsx +8 -2
- package/agent/apps/desktop/src/components/ui/sidebar.tsx +18 -25
- package/agent/apps/desktop/src/components/ui/switch.tsx +38 -15
- package/agent/apps/desktop/src/components/ui/textarea.tsx +4 -11
- package/agent/apps/desktop/src/components/ui/tool-icon.tsx +65 -0
- package/agent/apps/desktop/src/components/ui/tooltip.tsx +31 -4
- package/agent/apps/desktop/src/fonts/JetBrainsMono-Bold.woff2 +0 -0
- package/agent/apps/desktop/src/fonts/JetBrainsMono-Italic.woff2 +0 -0
- package/agent/apps/desktop/src/fonts/JetBrainsMono-Regular.woff2 +0 -0
- package/agent/apps/desktop/src/global.d.ts +181 -4
- package/agent/apps/desktop/src/hermes.test.ts +60 -0
- package/agent/apps/desktop/src/hermes.ts +190 -13
- package/agent/apps/desktop/src/hooks/use-image-download.ts +85 -0
- package/agent/apps/desktop/src/hooks/use-resize-observer.ts +13 -4
- package/agent/apps/desktop/src/hooks/use-worktree-info.ts +68 -0
- package/agent/apps/desktop/src/i18n/catalog.ts +12 -0
- package/agent/apps/desktop/src/i18n/context.test.tsx +232 -0
- package/agent/apps/desktop/src/i18n/context.tsx +183 -0
- package/agent/apps/desktop/src/i18n/define-locale.ts +41 -0
- package/agent/apps/desktop/src/i18n/en.ts +1921 -0
- package/agent/apps/desktop/src/i18n/index.ts +20 -0
- package/agent/apps/desktop/src/i18n/ja.ts +2053 -0
- package/agent/apps/desktop/src/i18n/languages.test.ts +43 -0
- package/agent/apps/desktop/src/i18n/languages.ts +86 -0
- package/agent/apps/desktop/src/i18n/runtime.test.ts +75 -0
- package/agent/apps/desktop/src/i18n/runtime.ts +53 -0
- package/agent/apps/desktop/src/i18n/types.ts +1559 -0
- package/agent/apps/desktop/src/i18n/zh-hant.ts +1992 -0
- package/agent/apps/desktop/src/i18n/zh.ts +2099 -0
- package/agent/apps/desktop/src/lib/ansi.test.ts +123 -0
- package/agent/apps/desktop/src/lib/ansi.ts +186 -0
- package/agent/apps/desktop/src/lib/chat-messages.test.ts +79 -0
- package/agent/apps/desktop/src/lib/chat-messages.ts +68 -29
- package/agent/apps/desktop/src/lib/chat-runtime.test.ts +65 -1
- package/agent/apps/desktop/src/lib/chat-runtime.ts +39 -3
- package/agent/apps/desktop/src/lib/completion-sound.ts +519 -0
- package/agent/apps/desktop/src/lib/desktop-fs.test.ts +116 -0
- package/agent/apps/desktop/src/lib/desktop-fs.ts +113 -0
- package/agent/apps/desktop/src/lib/desktop-slash-commands.test.ts +89 -6
- package/agent/apps/desktop/src/lib/desktop-slash-commands.ts +270 -131
- package/agent/apps/desktop/src/lib/external-link.test.tsx +27 -0
- package/agent/apps/desktop/src/lib/external-link.tsx +9 -2
- package/agent/apps/desktop/src/lib/gateway-events.test.ts +27 -0
- package/agent/apps/desktop/src/lib/gateway-events.ts +16 -0
- package/agent/apps/desktop/src/lib/gateway-ws-url.test.ts +78 -0
- package/agent/apps/desktop/src/lib/gateway-ws-url.ts +91 -0
- package/agent/apps/desktop/src/lib/generated-images.test.ts +97 -0
- package/agent/apps/desktop/src/lib/generated-images.ts +116 -0
- package/agent/apps/desktop/src/lib/haptics.ts +17 -0
- package/agent/apps/desktop/src/lib/icons.ts +10 -2
- package/agent/apps/desktop/src/lib/keybinds/actions.ts +137 -0
- package/agent/apps/desktop/src/lib/keybinds/combo.test.ts +86 -0
- package/agent/apps/desktop/src/lib/keybinds/combo.ts +195 -0
- package/agent/apps/desktop/src/lib/local-preview.ts +23 -2
- package/agent/apps/desktop/src/lib/markdown-preprocess.ts +20 -7
- package/agent/apps/desktop/src/lib/media.remote.test.ts +90 -0
- package/agent/apps/desktop/src/lib/media.ts +40 -1
- package/agent/apps/desktop/src/lib/model-status-label.test.ts +59 -0
- package/agent/apps/desktop/src/lib/model-status-label.ts +122 -0
- package/agent/apps/desktop/src/lib/mutable-ref.ts +6 -0
- package/agent/apps/desktop/src/lib/profile-color.ts +58 -0
- package/agent/apps/desktop/src/lib/query-client.ts +13 -0
- package/agent/apps/desktop/src/lib/remend-tail.test.ts +105 -0
- package/agent/apps/desktop/src/lib/remend-tail.ts +108 -0
- package/agent/apps/desktop/src/lib/session-export.ts +6 -3
- package/agent/apps/desktop/src/lib/session-ids.test.ts +44 -0
- package/agent/apps/desktop/src/lib/session-ids.ts +26 -0
- package/agent/apps/desktop/src/lib/session-search.test.ts +66 -0
- package/agent/apps/desktop/src/lib/session-search.ts +21 -0
- package/agent/apps/desktop/src/lib/session-source.ts +126 -0
- package/agent/apps/desktop/src/lib/storage.test.ts +25 -0
- package/agent/apps/desktop/src/lib/storage.ts +35 -1
- package/agent/apps/desktop/src/lib/todos.test.ts +46 -1
- package/agent/apps/desktop/src/lib/todos.ts +37 -0
- package/agent/apps/desktop/src/lib/tool-result-summary.ts +5 -1
- package/agent/apps/desktop/src/lib/update-copy.test.ts +38 -0
- package/agent/apps/desktop/src/lib/update-copy.ts +44 -0
- package/agent/apps/desktop/src/lib/use-enter-animation.ts +2 -2
- package/agent/apps/desktop/src/lib/yolo-session.ts +50 -0
- package/agent/apps/desktop/src/main.tsx +19 -19
- package/agent/apps/desktop/src/store/boot.ts +4 -3
- package/agent/apps/desktop/src/store/clarify.test.ts +81 -0
- package/agent/apps/desktop/src/store/clarify.ts +50 -13
- package/agent/apps/desktop/src/store/command-palette.ts +20 -0
- package/agent/apps/desktop/src/store/compaction.test.ts +53 -0
- package/agent/apps/desktop/src/store/compaction.ts +38 -0
- package/agent/apps/desktop/src/store/completion-sound.ts +32 -0
- package/agent/apps/desktop/src/store/composer-input-history.test.ts +147 -0
- package/agent/apps/desktop/src/store/composer-input-history.ts +158 -0
- package/agent/apps/desktop/src/store/composer-queue.test.ts +68 -0
- package/agent/apps/desktop/src/store/composer-queue.ts +76 -0
- package/agent/apps/desktop/src/store/composer-status.test.ts +99 -0
- package/agent/apps/desktop/src/store/composer-status.ts +277 -0
- package/agent/apps/desktop/src/store/composer.test.ts +106 -0
- package/agent/apps/desktop/src/store/composer.ts +116 -0
- package/agent/apps/desktop/src/store/cron.ts +19 -0
- package/agent/apps/desktop/src/store/gateway.ts +280 -6
- package/agent/apps/desktop/src/store/keybinds.ts +143 -0
- package/agent/apps/desktop/src/store/layout.ts +107 -9
- package/agent/apps/desktop/src/store/model-presets.test.ts +51 -0
- package/agent/apps/desktop/src/store/model-presets.ts +86 -0
- package/agent/apps/desktop/src/store/model-visibility.test.ts +99 -0
- package/agent/apps/desktop/src/store/model-visibility.ts +161 -0
- package/agent/apps/desktop/src/store/native-notifications.test.ts +192 -0
- package/agent/apps/desktop/src/store/native-notifications.ts +203 -0
- package/agent/apps/desktop/src/store/notifications.ts +10 -7
- package/agent/apps/desktop/src/store/onboarding.test.ts +271 -1
- package/agent/apps/desktop/src/store/onboarding.ts +268 -38
- package/agent/apps/desktop/src/store/preview.ts +10 -1
- package/agent/apps/desktop/src/store/profile.test.ts +89 -0
- package/agent/apps/desktop/src/store/profile.ts +395 -0
- package/agent/apps/desktop/src/store/prompts.test.ts +127 -0
- package/agent/apps/desktop/src/store/prompts.ts +117 -0
- package/agent/apps/desktop/src/store/session-switcher.test.ts +115 -0
- package/agent/apps/desktop/src/store/session-switcher.ts +128 -0
- package/agent/apps/desktop/src/store/session-sync.ts +25 -0
- package/agent/apps/desktop/src/store/session.test.ts +268 -2
- package/agent/apps/desktop/src/store/session.ts +392 -18
- package/agent/apps/desktop/src/store/subagents.ts +3 -0
- package/agent/apps/desktop/src/store/system-actions.ts +48 -0
- package/agent/apps/desktop/src/store/thread-scroll.ts +58 -5
- package/agent/apps/desktop/src/store/todos.test.ts +47 -0
- package/agent/apps/desktop/src/store/todos.ts +64 -0
- package/agent/apps/desktop/src/store/tool-dismiss.ts +45 -0
- package/agent/apps/desktop/src/store/translucency.ts +38 -0
- package/agent/apps/desktop/src/store/updates.test.ts +187 -2
- package/agent/apps/desktop/src/store/updates.ts +268 -18
- package/agent/apps/desktop/src/store/windows.test.ts +143 -0
- package/agent/apps/desktop/src/store/windows.ts +115 -0
- package/agent/apps/desktop/src/styles.css +510 -119
- package/agent/apps/desktop/src/themes/color.ts +142 -0
- package/agent/apps/desktop/src/themes/context.tsx +128 -75
- package/agent/apps/desktop/src/themes/install.test.ts +119 -0
- package/agent/apps/desktop/src/themes/install.ts +95 -0
- package/agent/apps/desktop/src/themes/presets.test.ts +33 -0
- package/agent/apps/desktop/src/themes/presets.ts +13 -4
- package/agent/apps/desktop/src/themes/profile-theme.test.ts +41 -0
- package/agent/apps/desktop/src/themes/types.ts +35 -0
- package/agent/apps/desktop/src/themes/user-themes.test.ts +63 -0
- package/agent/apps/desktop/src/themes/user-themes.ts +122 -0
- package/agent/apps/desktop/src/themes/vscode.test.ts +171 -0
- package/agent/apps/desktop/src/themes/vscode.ts +343 -0
- package/agent/apps/desktop/src/types/hermes.ts +138 -1
- package/agent/apps/desktop/tsconfig.json +2 -2
- package/agent/apps/desktop/vite.config.ts +18 -0
- package/agent/apps/shared/package.json +1 -1
- package/agent/apps/shared/src/json-rpc-gateway.ts +63 -2
- package/agent/apps/shared/tsconfig.json +2 -2
- package/agent/cli-config.yaml.example +78 -1
- package/agent/cli.py +2294 -3146
- package/agent/cron/blueprint_catalog.py +713 -0
- package/agent/cron/jobs.py +226 -110
- package/agent/cron/scheduler.py +468 -193
- package/agent/cron/scheduler_provider.py +177 -0
- package/agent/cron/scripts/__init__.py +1 -0
- package/agent/cron/scripts/classify_items.py +226 -0
- package/agent/cron/suggestion_catalog.py +154 -0
- package/agent/cron/suggestions.py +257 -0
- package/agent/docs/chronos-managed-cron-contract.md +196 -0
- package/agent/docs/design/profile-builder.md +146 -0
- package/agent/docs/middleware/README.md +260 -0
- package/agent/docs/observability/README.md +316 -0
- package/agent/docs/plans/2026-06-09-003-fix-telegram-stream-overflow-continuations-plan.md +240 -0
- package/agent/docs/rca-ssl-cacert-post-git-pull.md +54 -0
- package/agent/docs/relay-connector-contract.md +285 -0
- package/agent/gateway/authz_mixin.py +536 -0
- package/agent/gateway/channel_directory.py +65 -3
- package/agent/gateway/config.py +222 -12
- package/agent/gateway/display_config.py +10 -0
- package/agent/gateway/hooks.py +17 -0
- package/agent/gateway/kanban_watchers.py +1146 -0
- package/agent/gateway/message_timestamps.py +166 -0
- package/agent/gateway/platforms/ADDING_A_PLATFORM.md +29 -0
- package/agent/gateway/platforms/api_server.py +216 -38
- package/agent/gateway/platforms/base.py +210 -58
- package/agent/gateway/platforms/email.py +122 -12
- package/agent/gateway/platforms/feishu.py +80 -11
- package/agent/gateway/platforms/feishu_meeting_invite.py +212 -0
- package/agent/gateway/platforms/matrix.py +1498 -297
- package/agent/gateway/platforms/qqbot/adapter.py +6 -0
- package/agent/gateway/platforms/signal.py +8 -0
- package/agent/gateway/platforms/slack.py +308 -12
- package/agent/gateway/platforms/telegram.py +831 -24
- package/agent/gateway/platforms/webhook.py +109 -21
- package/agent/gateway/platforms/weixin.py +113 -2
- package/agent/gateway/platforms/whatsapp.py +94 -288
- package/agent/gateway/platforms/whatsapp_cloud.py +1956 -0
- package/agent/gateway/platforms/whatsapp_common.py +367 -0
- package/agent/gateway/platforms/yuanbao.py +608 -191
- package/agent/gateway/platforms/yuanbao_proto.py +232 -23
- package/agent/gateway/relay/__init__.py +375 -0
- package/agent/gateway/relay/adapter.py +222 -0
- package/agent/gateway/relay/auth.py +168 -0
- package/agent/gateway/relay/descriptor.py +118 -0
- package/agent/gateway/relay/transport.py +101 -0
- package/agent/gateway/relay/ws_transport.py +327 -0
- package/agent/gateway/response_filters.py +53 -0
- package/agent/gateway/rich_sent_store.py +80 -0
- package/agent/gateway/run.py +2940 -5001
- package/agent/gateway/session.py +109 -8
- package/agent/gateway/session_context.py +22 -4
- package/agent/gateway/slash_commands.py +3854 -0
- package/agent/gateway/status.py +141 -21
- package/agent/gateway/stream_consumer.py +288 -31
- package/agent/hermes-already-has-routines.md +1 -1
- package/agent/hermes_cli/__init__.py +62 -17
- package/agent/hermes_cli/_parser.py +30 -0
- package/agent/hermes_cli/_subprocess_compat.py +61 -0
- package/agent/hermes_cli/active_sessions.py +320 -0
- package/agent/hermes_cli/auth.py +707 -59
- package/agent/hermes_cli/auth_commands.py +39 -22
- package/agent/hermes_cli/backup.py +109 -7
- package/agent/hermes_cli/banner.py +88 -0
- package/agent/hermes_cli/blueprint_cmd.py +318 -0
- package/agent/hermes_cli/clawpump_cli.py +3 -3
- package/agent/hermes_cli/cli_agent_setup_mixin.py +684 -0
- package/agent/hermes_cli/cli_commands_mixin.py +2293 -0
- package/agent/hermes_cli/commands.py +216 -91
- package/agent/hermes_cli/config.py +967 -130
- package/agent/hermes_cli/container_boot.py +76 -11
- package/agent/hermes_cli/cron.py +5 -11
- package/agent/hermes_cli/curator.py +21 -0
- package/agent/hermes_cli/dashboard_auth/__init__.py +2 -0
- package/agent/hermes_cli/dashboard_auth/base.py +62 -0
- package/agent/hermes_cli/dashboard_auth/cookies.py +32 -19
- package/agent/hermes_cli/dashboard_auth/login_page.py +156 -6
- package/agent/hermes_cli/dashboard_auth/middleware.py +28 -4
- package/agent/hermes_cli/dashboard_auth/prefix.py +46 -2
- package/agent/hermes_cli/dashboard_auth/public_paths.py +6 -0
- package/agent/hermes_cli/dashboard_auth/routes.py +158 -2
- package/agent/hermes_cli/dashboard_auth/ws_tickets.py +85 -11
- package/agent/hermes_cli/dashboard_register.py +427 -0
- package/agent/hermes_cli/debug.py +155 -50
- package/agent/hermes_cli/distribution.py +227 -0
- package/agent/hermes_cli/doctor.py +255 -14
- package/agent/hermes_cli/dump.py +60 -6
- package/agent/hermes_cli/env_loader.py +33 -0
- package/agent/hermes_cli/gateway.py +755 -103
- package/agent/hermes_cli/gateway_enroll.py +250 -0
- package/agent/hermes_cli/gateway_windows.py +254 -11
- package/agent/hermes_cli/gui_uninstall.py +285 -0
- package/agent/hermes_cli/inventory.py +105 -4
- package/agent/hermes_cli/kanban.py +58 -71
- package/agent/hermes_cli/kanban_db.py +391 -14
- package/agent/hermes_cli/kanban_decompose.py +2 -2
- package/agent/hermes_cli/kanban_specify.py +3 -1
- package/agent/hermes_cli/logs.py +2 -0
- package/agent/hermes_cli/main.py +2889 -5287
- package/agent/hermes_cli/managed_scope.py +214 -0
- package/agent/hermes_cli/managed_uv.py +254 -0
- package/agent/hermes_cli/mcp_catalog.py +6 -3
- package/agent/hermes_cli/mcp_config.py +145 -21
- package/agent/hermes_cli/mcp_security.py +96 -0
- package/agent/hermes_cli/mcp_startup.py +32 -3
- package/agent/hermes_cli/memory_providers.py +149 -0
- package/agent/hermes_cli/memory_setup.py +97 -42
- package/agent/hermes_cli/middleware.py +313 -0
- package/agent/hermes_cli/model_catalog.py +31 -0
- package/agent/hermes_cli/model_cost_guard.py +134 -0
- package/agent/hermes_cli/model_normalize.py +2 -1
- package/agent/hermes_cli/model_setup_flows.py +2759 -0
- package/agent/hermes_cli/model_switch.py +242 -27
- package/agent/hermes_cli/models.py +284 -44
- package/agent/hermes_cli/nous_account.py +33 -6
- package/agent/hermes_cli/nous_billing.py +406 -0
- package/agent/hermes_cli/nous_subscription.py +202 -5
- package/agent/hermes_cli/platforms.py +1 -0
- package/agent/hermes_cli/plugins.py +218 -18
- package/agent/hermes_cli/plugins_cmd.py +249 -105
- package/agent/hermes_cli/portal_cli.py +56 -16
- package/agent/hermes_cli/profile_distribution.py +6 -1
- package/agent/hermes_cli/profiles.py +283 -32
- package/agent/hermes_cli/provider_catalog.py +170 -0
- package/agent/hermes_cli/providers.py +4 -1
- package/agent/hermes_cli/pty_bridge.py +53 -4
- package/agent/hermes_cli/runtime_provider.py +216 -34
- package/agent/hermes_cli/secret_prompt.py +4 -4
- package/agent/hermes_cli/secrets_cli.py +24 -0
- package/agent/hermes_cli/send_cmd.py +28 -2
- package/agent/hermes_cli/service_manager.py +166 -19
- package/agent/hermes_cli/session_listing.py +97 -0
- package/agent/hermes_cli/setup.py +158 -94
- package/agent/hermes_cli/setup_whatsapp_cloud.py +541 -0
- package/agent/hermes_cli/skills_config.py +8 -2
- package/agent/hermes_cli/skills_hub.py +149 -7
- package/agent/hermes_cli/status.py +2 -2
- package/agent/hermes_cli/subcommands/__init__.py +18 -0
- package/agent/hermes_cli/subcommands/_shared.py +29 -0
- package/agent/hermes_cli/subcommands/acp.py +52 -0
- package/agent/hermes_cli/subcommands/auth.py +109 -0
- package/agent/hermes_cli/subcommands/backup.py +38 -0
- package/agent/hermes_cli/subcommands/claw.py +92 -0
- package/agent/hermes_cli/subcommands/config.py +49 -0
- package/agent/hermes_cli/subcommands/cron.py +163 -0
- package/agent/hermes_cli/subcommands/dashboard.py +143 -0
- package/agent/hermes_cli/subcommands/debug.py +77 -0
- package/agent/hermes_cli/subcommands/doctor.py +35 -0
- package/agent/hermes_cli/subcommands/dump.py +28 -0
- package/agent/hermes_cli/subcommands/gateway.py +332 -0
- package/agent/hermes_cli/subcommands/gui.py +63 -0
- package/agent/hermes_cli/subcommands/hooks.py +77 -0
- package/agent/hermes_cli/subcommands/import_cmd.py +31 -0
- package/agent/hermes_cli/subcommands/insights.py +25 -0
- package/agent/hermes_cli/subcommands/login.py +78 -0
- package/agent/hermes_cli/subcommands/logout.py +28 -0
- package/agent/hermes_cli/subcommands/logs.py +78 -0
- package/agent/hermes_cli/subcommands/mcp.py +108 -0
- package/agent/hermes_cli/subcommands/memory.py +53 -0
- package/agent/hermes_cli/subcommands/model.py +72 -0
- package/agent/hermes_cli/subcommands/pairing.py +36 -0
- package/agent/hermes_cli/subcommands/plugins.py +94 -0
- package/agent/hermes_cli/subcommands/postinstall.py +23 -0
- package/agent/hermes_cli/subcommands/profile.py +203 -0
- package/agent/hermes_cli/subcommands/prompt_size.py +36 -0
- package/agent/hermes_cli/subcommands/security.py +62 -0
- package/agent/hermes_cli/subcommands/setup.py +58 -0
- package/agent/hermes_cli/subcommands/skills.py +298 -0
- package/agent/hermes_cli/subcommands/slack.py +60 -0
- package/agent/hermes_cli/subcommands/status.py +28 -0
- package/agent/hermes_cli/subcommands/tools.py +95 -0
- package/agent/hermes_cli/subcommands/uninstall.py +41 -0
- package/agent/hermes_cli/subcommands/update.py +70 -0
- package/agent/hermes_cli/subcommands/version.py +18 -0
- package/agent/hermes_cli/subcommands/webhook.py +76 -0
- package/agent/hermes_cli/subcommands/whatsapp.py +22 -0
- package/agent/hermes_cli/suggestions_cmd.py +153 -0
- package/agent/hermes_cli/telegram_managed_bot.py +358 -0
- package/agent/hermes_cli/tips.py +3 -4
- package/agent/hermes_cli/tools_config.py +155 -28
- package/agent/hermes_cli/uninstall.py +231 -35
- package/agent/hermes_cli/web_server.py +6188 -975
- package/agent/hermes_cli/win_pty_bridge.py +179 -0
- package/agent/hermes_cli/write_approval_commands.py +209 -0
- package/agent/hermes_constants.py +164 -33
- package/agent/hermes_logging.py +74 -2
- package/agent/hermes_state.py +919 -106
- package/agent/hermes_time.py +20 -0
- package/agent/locales/af.yaml +23 -0
- package/agent/locales/de.yaml +23 -0
- package/agent/locales/en.yaml +20 -0
- package/agent/locales/es.yaml +23 -0
- package/agent/locales/fr.yaml +23 -0
- package/agent/locales/ga.yaml +23 -0
- package/agent/locales/hu.yaml +23 -0
- package/agent/locales/it.yaml +23 -0
- package/agent/locales/ja.yaml +23 -0
- package/agent/locales/ko.yaml +23 -0
- package/agent/locales/pt.yaml +23 -0
- package/agent/locales/ru.yaml +23 -0
- package/agent/locales/tr.yaml +23 -0
- package/agent/locales/uk.yaml +23 -0
- package/agent/locales/zh-hant.yaml +23 -0
- package/agent/locales/zh.yaml +23 -0
- package/agent/model_tools.py +204 -40
- package/agent/optional-mcps/clawpump/manifest.yaml +15 -5
- package/agent/optional-mcps/clawpump-stdio/manifest.yaml +14 -4
- package/agent/optional-mcps/unreal-engine/manifest.yaml +54 -0
- package/agent/optional-skills/blockchain/hyperliquid/SKILL.md +2 -2
- package/agent/optional-skills/blockchain/hyperliquid/scripts/hyperliquid_client.py +1 -1
- package/agent/optional-skills/creative/kanban-video-orchestrator/SKILL.md +1 -1
- package/agent/optional-skills/creative/kanban-video-orchestrator/assets/setup.sh.tmpl +4 -3
- package/agent/optional-skills/creative/kanban-video-orchestrator/references/kanban-setup.md +6 -4
- package/agent/optional-skills/creative/kanban-video-orchestrator/references/tool-matrix.md +2 -2
- package/agent/{skills/software-development → optional-skills/devops}/hermes-s6-container-supervision/SKILL.md +2 -0
- package/agent/optional-skills/devops/watchers/SKILL.md +1 -1
- package/agent/optional-skills/devops/watchers/scripts/watch_github.py +2 -1
- package/agent/optional-skills/payments/mpp-agent/SKILL.md +124 -0
- package/agent/optional-skills/payments/stripe-link-cli/SKILL.md +184 -0
- package/agent/optional-skills/payments/stripe-projects/SKILL.md +120 -0
- package/agent/optional-skills/productivity/canvas/SKILL.md +1 -1
- package/agent/optional-skills/productivity/canvas/scripts/canvas_api.py +4 -1
- package/agent/optional-skills/productivity/shop/SKILL.md +224 -0
- package/agent/optional-skills/productivity/shop/references/catalog-mcp.md +236 -0
- package/agent/optional-skills/productivity/shop/references/direct-api.md +278 -0
- package/agent/optional-skills/productivity/shop/references/legal.md +3 -0
- package/agent/optional-skills/productivity/shop/references/safety.md +36 -0
- package/agent/optional-skills/productivity/shopify/SKILL.md +1 -1
- package/agent/optional-skills/productivity/siyuan/SKILL.md +1 -1
- package/agent/optional-skills/productivity/telephony/SKILL.md +4 -4
- package/agent/optional-skills/productivity/telephony/scripts/telephony.py +15 -15
- package/agent/optional-skills/security/1password/SKILL.md +1 -1
- package/agent/{skills/red-teaming → optional-skills/security}/godmode/SKILL.md +3 -4
- package/agent/{skills/red-teaming → optional-skills/security}/godmode/scripts/auto_jailbreak.py +3 -1
- package/agent/optional-skills/software-development/rest-graphql-debug/SKILL.md +1 -1
- package/agent/{skills → optional-skills}/software-development/subagent-driven-development/SKILL.md +5 -5
- package/agent/package-lock.json +4082 -7907
- package/agent/package.json +18 -3
- package/agent/plugins/browser/firecrawl/provider.py +4 -1
- package/agent/plugins/cron/__init__.py +344 -0
- package/agent/plugins/cron/chronos/__init__.py +241 -0
- package/agent/plugins/cron/chronos/_nas_client.py +123 -0
- package/agent/plugins/cron/chronos/plugin.yaml +9 -0
- package/agent/plugins/cron/chronos/verify.py +103 -0
- package/agent/plugins/dashboard_auth/basic/__init__.py +491 -0
- package/agent/plugins/dashboard_auth/basic/plugin.yaml +7 -0
- package/agent/plugins/dashboard_auth/nous/__init__.py +12 -14
- package/agent/plugins/dashboard_auth/self_hosted/__init__.py +736 -0
- package/agent/plugins/dashboard_auth/self_hosted/plugin.yaml +8 -0
- package/agent/plugins/disk-cleanup/disk_cleanup.py +100 -20
- package/agent/plugins/google_meet/audio_bridge.py +4 -0
- package/agent/plugins/google_meet/meet_bot.py +7 -1
- package/agent/plugins/hermes-achievements/dashboard/dist/index.js +9 -15
- package/agent/plugins/image_gen/fal/__init__.py +35 -6
- package/agent/plugins/image_gen/krea/__init__.py +56 -13
- package/agent/plugins/image_gen/openai/__init__.py +122 -24
- package/agent/plugins/image_gen/openai-codex/__init__.py +28 -2
- package/agent/plugins/image_gen/xai/__init__.py +92 -12
- package/agent/plugins/kanban/dashboard/dist/index.js +63 -48
- package/agent/plugins/kanban/dashboard/plugin_api.py +39 -35
- package/agent/plugins/memory/__init__.py +48 -5
- package/agent/plugins/memory/byterover/__init__.py +1 -0
- package/agent/plugins/memory/hindsight/README.md +1 -1
- package/agent/plugins/memory/hindsight/__init__.py +138 -24
- package/agent/plugins/memory/hindsight/plugin.yaml +1 -1
- package/agent/plugins/memory/honcho/README.md +13 -10
- package/agent/plugins/memory/honcho/cli.py +247 -122
- package/agent/plugins/memory/honcho/client.py +112 -102
- package/agent/plugins/memory/openviking/README.md +12 -1
- package/agent/plugins/memory/openviking/__init__.py +2281 -107
- package/agent/plugins/memory/openviking/plugin.yaml +1 -2
- package/agent/plugins/memory/supermemory/README.md +22 -10
- package/agent/plugins/memory/supermemory/__init__.py +142 -37
- package/agent/plugins/memory/supermemory/plugin.yaml +1 -1
- package/agent/plugins/model-providers/anthropic/__init__.py +1 -0
- package/agent/plugins/model-providers/bedrock/__init__.py +1 -0
- package/agent/plugins/model-providers/copilot-acp/__init__.py +1 -0
- package/agent/plugins/model-providers/custom/__init__.py +8 -2
- package/agent/plugins/model-providers/kimi-coding/__init__.py +16 -7
- package/agent/plugins/model-providers/minimax/__init__.py +60 -8
- package/agent/plugins/model-providers/opencode-zen/__init__.py +12 -3
- package/agent/plugins/model-providers/openrouter/__init__.py +75 -4
- package/agent/plugins/model-providers/xiaomi/__init__.py +2 -0
- package/agent/plugins/model-providers/zai/__init__.py +1 -0
- package/agent/plugins/observability/langfuse/__init__.py +147 -14
- package/agent/plugins/observability/nemo_relay/README.md +559 -0
- package/agent/plugins/observability/nemo_relay/__init__.py +962 -0
- package/agent/plugins/observability/nemo_relay/plugin.yaml +20 -0
- package/agent/plugins/platforms/discord/adapter.py +932 -61
- package/agent/plugins/platforms/discord/voice_mixer.py +379 -0
- package/agent/plugins/platforms/google_chat/adapter.py +9 -3
- package/agent/plugins/platforms/google_chat/oauth.py +1 -1
- package/agent/plugins/platforms/homeassistant/__init__.py +3 -0
- package/agent/{gateway/platforms/homeassistant.py → plugins/platforms/homeassistant/adapter.py} +128 -0
- package/agent/plugins/platforms/homeassistant/plugin.yaml +22 -0
- package/agent/plugins/platforms/irc/adapter.py +4 -1
- package/agent/plugins/platforms/line/adapter.py +16 -1
- package/agent/plugins/platforms/mattermost/adapter.py +100 -24
- package/agent/plugins/platforms/photon/README.md +179 -0
- package/agent/plugins/platforms/photon/__init__.py +4 -0
- package/agent/plugins/platforms/photon/adapter.py +1586 -0
- package/agent/plugins/platforms/photon/auth.py +1046 -0
- package/agent/plugins/platforms/photon/cli.py +439 -0
- package/agent/plugins/platforms/photon/plugin.yaml +88 -0
- package/agent/plugins/platforms/photon/sidecar/README.md +52 -0
- package/agent/plugins/platforms/photon/sidecar/index.mjs +720 -0
- package/agent/plugins/platforms/photon/sidecar/package-lock.json +1730 -0
- package/agent/plugins/platforms/photon/sidecar/package.json +25 -0
- package/agent/plugins/platforms/photon/sidecar/patch-spectrum-mixed-attachments.mjs +155 -0
- package/agent/plugins/platforms/raft/__init__.py +3 -0
- package/agent/plugins/platforms/raft/adapter.py +774 -0
- package/agent/plugins/platforms/raft/plugin.yaml +19 -0
- package/agent/plugins/platforms/simplex/adapter.py +777 -220
- package/agent/plugins/platforms/simplex/plugin.yaml +21 -2
- package/agent/plugins/platforms/teams/adapter.py +175 -5
- package/agent/plugins/plugin_utils.py +135 -0
- package/agent/plugins/video_gen/fal/__init__.py +10 -3
- package/agent/plugins/web/searxng/provider.py +15 -2
- package/agent/plugins/web/xai/provider.py +2 -2
- package/agent/providers/base.py +22 -3
- package/agent/pyproject.toml +115 -21
- package/agent/run_agent.py +733 -39
- package/agent/scripts/build_skills_index.py +51 -19
- package/agent/scripts/check_subprocess_stdin.py +177 -0
- package/agent/scripts/contributor_audit.py +2 -0
- package/agent/scripts/docker_config_migrate.py +67 -0
- package/agent/scripts/install.cmd +3 -3
- package/agent/scripts/install.ps1 +580 -154
- package/agent/scripts/install.sh +402 -185
- package/agent/scripts/lib/node-bootstrap.sh +39 -4
- package/agent/scripts/release.py +183 -0
- package/agent/scripts/run_tests.sh +1 -0
- package/agent/scripts/run_tests_parallel.py +18 -23
- package/agent/scripts/whatsapp-bridge/bridge.js +25 -4
- package/agent/setup.py +59 -0
- package/agent/skills/autonomous-ai-agents/codex/SKILL.md +19 -0
- package/agent/skills/autonomous-ai-agents/hermes-agent/SKILL.md +10 -3
- package/agent/skills/{mcp/native-mcp/SKILL.md → autonomous-ai-agents/hermes-agent/references/native-mcp.md} +0 -13
- package/agent/skills/{devops/webhook-subscriptions/SKILL.md → autonomous-ai-agents/hermes-agent/references/webhooks.md} +1 -11
- package/agent/skills/clawpump/SKILL.md +53 -5
- package/agent/skills/devops/kanban-orchestrator/SKILL.md +1 -0
- package/agent/skills/devops/kanban-worker/SKILL.md +1 -0
- package/agent/skills/github/github-auth/SKILL.md +2 -2
- package/agent/skills/github/github-auth/scripts/gh-env.sh +2 -2
- package/agent/skills/github/github-code-review/SKILL.md +2 -2
- package/agent/skills/github/github-issues/SKILL.md +2 -2
- package/agent/skills/github/github-pr-workflow/SKILL.md +2 -2
- package/agent/skills/github/github-repo-management/SKILL.md +2 -2
- package/agent/skills/media/gif-search/SKILL.md +1 -1
- package/agent/skills/media/youtube-content/SKILL.md +10 -7
- package/agent/skills/media/youtube-content/scripts/fetch_transcript.py +3 -3
- package/agent/skills/note-taking/obsidian/SKILL.md +1 -1
- package/agent/skills/productivity/airtable/SKILL.md +2 -2
- package/agent/skills/productivity/google-workspace/scripts/setup.py +33 -7
- package/agent/skills/productivity/notion/SKILL.md +2 -2
- package/agent/skills/productivity/teams-meeting-pipeline/SKILL.md +1 -1
- package/agent/skills/research/llm-wiki/SKILL.md +1 -1
- package/agent/skills/social-media/xurl/SKILL.md +9 -0
- package/agent/skills/software-development/hermes-agent-skill-authoring/SKILL.md +1 -1
- package/agent/skills/software-development/plan/SKILL.md +285 -5
- package/agent/skills/software-development/requesting-code-review/SKILL.md +2 -2
- package/agent/skills/software-development/simplify-code/SKILL.md +212 -0
- package/agent/skills/software-development/spike/SKILL.md +2 -2
- package/agent/skills/software-development/systematic-debugging/SKILL.md +1 -1
- package/agent/skills/software-development/test-driven-development/SKILL.md +1 -1
- package/agent/tools/approval.py +302 -4
- package/agent/tools/async_delegation.py +386 -0
- package/agent/tools/blueprints.py +325 -0
- package/agent/tools/browser_cdp_tool.py +3 -3
- package/agent/tools/browser_tool.py +34 -6
- package/agent/tools/checkpoint_manager.py +31 -1
- package/agent/tools/clarify_tool.py +55 -5
- package/agent/tools/code_execution_tool.py +31 -14
- package/agent/tools/computer_use/cua_backend.py +81 -3
- package/agent/tools/computer_use/tool.py +79 -5
- package/agent/tools/computer_use/vision_routing.py +55 -3
- package/agent/tools/credential_files.py +31 -12
- package/agent/tools/cronjob_tools.py +30 -20
- package/agent/tools/delegate_tool.py +356 -31
- package/agent/tools/env_probe.py +1 -0
- package/agent/tools/environments/docker.py +163 -8
- package/agent/tools/environments/file_sync.py +2 -1
- package/agent/tools/environments/local.py +74 -23
- package/agent/tools/environments/singularity.py +4 -1
- package/agent/tools/environments/ssh.py +78 -11
- package/agent/tools/file_operations.py +277 -41
- package/agent/tools/file_tools.py +166 -28
- package/agent/tools/image_generation_tool.py +515 -29
- package/agent/tools/kanban_tools.py +99 -0
- package/agent/tools/lazy_deps.py +33 -2
- package/agent/tools/mcp_oauth.py +5 -5
- package/agent/tools/mcp_oauth_manager.py +7 -5
- package/agent/tools/mcp_tool.py +840 -33
- package/agent/tools/memory_tool.py +335 -38
- package/agent/tools/osv_check.py +15 -1
- package/agent/tools/process_registry.py +155 -11
- package/agent/tools/read_extract.py +248 -0
- package/agent/tools/read_terminal_tool.py +93 -0
- package/agent/tools/schema_sanitizer.py +38 -0
- package/agent/tools/send_message_tool.py +163 -49
- package/agent/tools/session_search_tool.py +189 -7
- package/agent/tools/skill_manager_tool.py +202 -3
- package/agent/tools/skill_usage.py +52 -4
- package/agent/tools/skills_hub.py +184 -44
- package/agent/tools/skills_sync.py +232 -5
- package/agent/tools/skills_tool.py +125 -11
- package/agent/tools/terminal_tool.py +148 -26
- package/agent/tools/tirith_security.py +2 -0
- package/agent/tools/todo_tool.py +32 -1
- package/agent/tools/transcription_tools.py +13 -5
- package/agent/tools/tts_tool.py +332 -38
- package/agent/tools/url_safety.py +52 -1
- package/agent/tools/vision_tools.py +124 -39
- package/agent/tools/voice_mode.py +4 -3
- package/agent/tools/web_tools.py +45 -15
- package/agent/tools/write_approval.py +493 -0
- package/agent/toolsets.py +34 -10
- package/agent/trajectory_compressor.py +81 -10
- package/agent/tui_gateway/entry.py +43 -6
- package/agent/tui_gateway/server.py +3335 -330
- package/agent/tui_gateway/slash_worker.py +61 -0
- package/agent/tui_gateway/ws.py +67 -9
- package/agent/ui-tui/eslint.config.mjs +0 -4
- package/agent/ui-tui/package.json +6 -6
- package/agent/ui-tui/packages/hermes-ink/package.json +1 -1
- package/agent/ui-tui/packages/hermes-ink/src/ink/app-mouse.test.ts +34 -1
- package/agent/ui-tui/packages/hermes-ink/src/ink/app-rawmode-mouse.test.ts +91 -0
- package/agent/ui-tui/packages/hermes-ink/src/ink/components/App.tsx +35 -2
- package/agent/ui-tui/packages/hermes-ink/src/ink/events/input-event.ts +4 -11
- package/agent/ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts +23 -57
- package/agent/ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts +11 -135
- package/agent/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.test.ts +185 -0
- package/agent/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.ts +37 -3
- package/agent/ui-tui/packages/hermes-ink/src/utils/execFileNoThrow.ts +5 -5
- package/agent/ui-tui/src/__tests__/appChromeStatusRule.test.tsx +217 -0
- package/agent/ui-tui/src/__tests__/appChromeStatusRuleDevCredits.test.tsx +73 -0
- package/agent/ui-tui/src/__tests__/approvalAction.test.ts +11 -0
- package/agent/ui-tui/src/__tests__/billingCommand.test.ts +301 -0
- package/agent/ui-tui/src/__tests__/blockLayout.test.ts +122 -0
- package/agent/ui-tui/src/__tests__/brandingMcpCount.test.ts +111 -0
- package/agent/ui-tui/src/__tests__/completionApply.test.ts +51 -0
- package/agent/ui-tui/src/__tests__/createGatewayEventHandler.test.ts +487 -2
- package/agent/ui-tui/src/__tests__/createSlashHandler.test.ts +54 -0
- package/agent/ui-tui/src/__tests__/creditsCommand.test.ts +144 -0
- package/agent/ui-tui/src/__tests__/gatewayClient.test.ts +120 -99
- package/agent/ui-tui/src/__tests__/gracefulExit.test.ts +11 -0
- package/agent/ui-tui/src/__tests__/memoryMonitor.test.ts +102 -0
- package/agent/ui-tui/src/__tests__/paths.test.ts +41 -1
- package/agent/ui-tui/src/__tests__/terminalModes.test.ts +22 -0
- package/agent/ui-tui/src/__tests__/text.test.ts +23 -0
- package/agent/ui-tui/src/__tests__/textInputFastEcho.test.ts +37 -0
- package/agent/ui-tui/src/__tests__/turnControllerNotice.test.ts +43 -0
- package/agent/ui-tui/src/__tests__/useInputHandlers.test.ts +38 -1
- package/agent/ui-tui/src/__tests__/virtualHeights.test.ts +8 -0
- package/agent/ui-tui/src/app/createGatewayEventHandler.ts +102 -7
- package/agent/ui-tui/src/app/interfaces.ts +64 -1
- package/agent/ui-tui/src/app/overlayStore.ts +18 -2
- package/agent/ui-tui/src/app/slash/commands/billing.ts +332 -0
- package/agent/ui-tui/src/app/slash/commands/core.ts +31 -2
- package/agent/ui-tui/src/app/slash/commands/credits.ts +57 -0
- package/agent/ui-tui/src/app/slash/commands/ops.ts +28 -0
- package/agent/ui-tui/src/app/slash/commands/session.ts +32 -4
- package/agent/ui-tui/src/app/slash/registry.ts +4 -0
- package/agent/ui-tui/src/app/turnController.ts +145 -2
- package/agent/ui-tui/src/app/uiStore.ts +2 -0
- package/agent/ui-tui/src/app/useInputHandlers.ts +42 -4
- package/agent/ui-tui/src/app/useMainApp.ts +54 -8
- package/agent/ui-tui/src/app/useSessionLifecycle.ts +40 -31
- package/agent/ui-tui/src/app/useSubmission.ts +23 -31
- package/agent/ui-tui/src/components/appChrome.tsx +112 -5
- package/agent/ui-tui/src/components/appLayout.tsx +9 -0
- package/agent/ui-tui/src/components/appOverlays.tsx +25 -1
- package/agent/ui-tui/src/components/billingOverlay.tsx +684 -0
- package/agent/ui-tui/src/components/branding.tsx +15 -3
- package/agent/ui-tui/src/components/messageLine.tsx +25 -3
- package/agent/ui-tui/src/components/pluginsHub.tsx +238 -0
- package/agent/ui-tui/src/components/prompts.tsx +31 -17
- package/agent/ui-tui/src/components/streamingAssistant.tsx +63 -55
- package/agent/ui-tui/src/components/textInput.tsx +16 -0
- package/agent/ui-tui/src/config/env.ts +12 -0
- package/agent/ui-tui/src/config/limits.ts +13 -0
- package/agent/ui-tui/src/domain/blockLayout.ts +146 -0
- package/agent/ui-tui/src/domain/paths.ts +24 -0
- package/agent/ui-tui/src/domain/slash.ts +40 -0
- package/agent/ui-tui/src/entry.tsx +35 -4
- package/agent/ui-tui/src/gatewayClient.ts +22 -10
- package/agent/ui-tui/src/gatewayTypes.ts +130 -1
- package/agent/ui-tui/src/lib/gracefulExit.ts +24 -4
- package/agent/ui-tui/src/lib/memory.test.ts +162 -0
- package/agent/ui-tui/src/lib/memory.ts +60 -1
- package/agent/ui-tui/src/lib/memoryMonitor.ts +79 -4
- package/agent/ui-tui/src/lib/osc52.ts +1 -1
- package/agent/ui-tui/src/lib/text.test.ts +32 -1
- package/agent/ui-tui/src/lib/text.ts +29 -2
- package/agent/ui-tui/src/lib/virtualHeights.ts +13 -0
- package/agent/ui-tui/src/types.ts +5 -0
- package/agent/ui-tui/tsconfig.build.json +0 -1
- package/agent/ui-tui/tsconfig.json +2 -1
- package/agent/utils.py +66 -2
- package/agent/uv.lock +308 -696
- package/agent/web/index.html +2 -2
- package/agent/web/package.json +11 -6
- package/agent/web/public/claw-bg.webp +0 -0
- package/agent/web/public/claw-logo.webp +0 -0
- package/agent/web/src/App.tsx +138 -48
- package/agent/web/src/components/AutomationBlueprints.tsx +225 -0
- package/agent/web/src/components/Backdrop.tsx +15 -0
- package/agent/web/src/components/ChatSessionList.tsx +260 -0
- package/agent/web/src/components/ChatSidebar.tsx +262 -78
- package/agent/web/src/components/ConfirmDialog.tsx +122 -0
- package/agent/web/src/components/ModelPickerDialog.tsx +111 -16
- package/agent/web/src/components/ModelReloadConfirm.tsx +40 -0
- package/agent/web/src/components/ProfileScopeBanner.tsx +30 -0
- package/agent/web/src/components/ProfileSwitcher.tsx +67 -0
- package/agent/web/src/components/ReasoningPicker.tsx +167 -0
- package/agent/web/src/components/SkillEditorDialog.tsx +215 -0
- package/agent/web/src/components/ThemeSwitcher.tsx +119 -4
- package/agent/web/src/components/ToolsetConfigDrawer.tsx +457 -0
- package/agent/web/src/contexts/PageHeaderProvider.tsx +7 -4
- package/agent/web/src/contexts/ProfileProvider.tsx +137 -0
- package/agent/web/src/contexts/SystemActions.tsx +6 -8
- package/agent/web/src/contexts/profile-context.ts +19 -0
- package/agent/web/src/contexts/useProfileScope.ts +6 -0
- package/agent/web/src/i18n/af.ts +5 -4
- package/agent/web/src/i18n/de.ts +5 -4
- package/agent/web/src/i18n/en.ts +58 -4
- package/agent/web/src/i18n/es.ts +5 -3
- package/agent/web/src/i18n/fr.ts +5 -3
- package/agent/web/src/i18n/ga.ts +5 -4
- package/agent/web/src/i18n/hu.ts +5 -4
- package/agent/web/src/i18n/it.ts +5 -4
- package/agent/web/src/i18n/ja.ts +5 -4
- package/agent/web/src/i18n/ko.ts +5 -4
- package/agent/web/src/i18n/pt.ts +5 -3
- package/agent/web/src/i18n/ru.ts +5 -4
- package/agent/web/src/i18n/tr.ts +5 -4
- package/agent/web/src/i18n/types.ts +59 -1
- package/agent/web/src/i18n/uk.ts +5 -3
- package/agent/web/src/i18n/zh-hant.ts +5 -4
- package/agent/web/src/i18n/zh.ts +5 -4
- package/agent/web/src/index.css +2 -2
- package/agent/web/src/lib/api.ts +819 -52
- package/agent/web/src/lib/dashboard-flags.ts +16 -7
- package/agent/web/src/lib/reasoning-effort.test.ts +48 -0
- package/agent/web/src/lib/reasoning-effort.ts +36 -0
- package/agent/web/src/lib/session-refresh.test.ts +21 -0
- package/agent/web/src/lib/session-refresh.ts +26 -0
- package/agent/web/src/pages/ChannelsPage.tsx +529 -68
- package/agent/web/src/pages/ChatPage.tsx +249 -56
- package/agent/web/src/pages/ConfigPage.tsx +11 -1
- package/agent/web/src/pages/CronPage.tsx +219 -31
- package/agent/web/src/pages/EnvPage.tsx +25 -6
- package/agent/web/src/pages/FilesPage.tsx +525 -0
- package/agent/web/src/pages/McpPage.tsx +80 -3
- package/agent/web/src/pages/ModelsPage.tsx +97 -12
- package/agent/web/src/pages/PluginsPage.tsx +1 -1
- package/agent/web/src/pages/ProfileBuilderPage.tsx +611 -0
- package/agent/web/src/pages/ProfilesPage.tsx +1038 -172
- package/agent/web/src/pages/SessionsPage.tsx +144 -13
- package/agent/web/src/pages/SkillsPage.tsx +851 -70
- package/agent/web/src/pages/SystemPage.tsx +340 -4
- package/agent/web/src/pages/WalletPage.tsx +401 -0
- package/agent/web/src/pages/WebhooksPage.tsx +145 -15
- package/agent/web/src/pages/X402Page.tsx +207 -0
- package/agent/web/src/plugins/registry.ts +28 -11
- package/agent/web/src/plugins/sdk.d.ts +160 -0
- package/agent/web/src/themes/context.tsx +112 -5
- package/agent/web/src/themes/fonts.ts +167 -0
- package/agent/web/src/themes/index.ts +7 -0
- package/agent/web/tsconfig.app.json +0 -1
- package/agent/web/vite.config.ts +1 -8
- package/agent/web/vitest.config.ts +16 -0
- package/package.json +1 -1
- package/agent/apps/desktop/package-lock.json +0 -18363
- package/agent/apps/desktop/src/app/chat/composer/skin-slash-popover.tsx +0 -56
- package/agent/apps/desktop/src/components/assistant-ui/thread-virtualizer.tsx +0 -382
- package/agent/apps/desktop/src/components/assistant-ui/todo-tool.tsx +0 -109
- package/agent/apps/desktop/src/components/chat/generated-image-context.tsx +0 -19
- package/agent/optional-skills/productivity/shop-app/SKILL.md +0 -340
- package/agent/skills/autonomous-ai-agents/kanban-codex-lane/SKILL.md +0 -277
- package/agent/skills/autonomous-ai-agents/kanban-codex-lane/templates/pmb-codex-lane-prompt.md +0 -57
- package/agent/skills/diagramming/DESCRIPTION.md +0 -3
- package/agent/skills/domain/DESCRIPTION.md +0 -24
- package/agent/skills/gifs/DESCRIPTION.md +0 -3
- package/agent/skills/inference-sh/DESCRIPTION.md +0 -19
- package/agent/skills/mcp/DESCRIPTION.md +0 -3
- package/agent/skills/media/spotify/SKILL.md +0 -135
- package/agent/skills/mlops/training/DESCRIPTION.md +0 -3
- package/agent/skills/mlops/vector-databases/DESCRIPTION.md +0 -3
- package/agent/skills/productivity/linear/SKILL.md +0 -380
- package/agent/skills/productivity/linear/scripts/linear_api.py +0 -445
- package/agent/skills/software-development/debugging-hermes-tui-commands/SKILL.md +0 -152
- package/agent/skills/software-development/writing-plans/SKILL.md +0 -297
- package/agent/ui-tui/package-lock.json +0 -7449
- package/agent/ui-tui/packages/hermes-ink/package-lock.json +0 -1289
- package/agent/web/package-lock.json +0 -8887
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/PORT_NOTES.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/SKILL.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/prompts/system.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/palettes/macaron.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/palettes/mono-ink.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/palettes/neon.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/palettes/warm.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/prompt-construction.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/style-presets.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/blueprint.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/chalkboard.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/editorial.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/elegant.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/fantasy-animation.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/flat-doodle.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/flat.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/ink-notes.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/intuition-machine.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/minimal.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/nature.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/notion.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/pixel-art.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/playful.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/retro.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/scientific.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/screen-print.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/sketch-notes.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/sketch.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/vector-illustration.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/vintage.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/warm.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles/watercolor.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/styles.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/usage.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-article-illustrator/references/workflow.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/PORT_NOTES.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/SKILL.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/analysis-framework.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/chalk.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/ink-brush.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/ligne-claire.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/manga.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/minimalist.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/art-styles/realistic.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/auto-selection.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/base-prompt.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/character-template.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/cinematic.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/dense.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/four-panel.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/mixed.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/splash.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/standard.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/layouts/webtoon.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/ohmsha-guide.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/partial-workflows.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/presets/concept-story.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/presets/four-panel.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/presets/ohmsha.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/presets/shoujo.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/presets/wuxia.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/storyboard-template.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/action.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/dramatic.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/energetic.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/neutral.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/romantic.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/vintage.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/tones/warm.md +0 -0
- /package/agent/{skills → optional-skills}/creative/baoyu-comic/references/workflow.md +0 -0
- /package/agent/{skills → optional-skills}/creative/creative-ideation/SKILL.md +0 -0
- /package/agent/{skills → optional-skills}/creative/creative-ideation/references/full-prompt-library.md +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/ATTRIBUTION.md +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/SKILL.md +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/references/palettes.md +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/scripts/__init__.py +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/scripts/palettes.py +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/scripts/pixel_art.py +0 -0
- /package/agent/{skills → optional-skills}/creative/pixel-art/scripts/pixel_art_video.py +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/SKILL.md +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/references/analysis-modules.md +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/references/methods-guide.md +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/templates/abliteration-config.yaml +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/templates/analysis-study.yaml +0 -0
- /package/agent/{skills/mlops/inference → optional-skills/mlops}/obliteratus/templates/batch-abliteration.yaml +0 -0
- /package/agent/{skills → optional-skills}/mlops/research/DESCRIPTION.md +0 -0
- /package/agent/{skills → optional-skills}/mlops/research/dspy/SKILL.md +0 -0
- /package/agent/{skills → optional-skills}/mlops/research/dspy/references/examples.md +0 -0
- /package/agent/{skills → optional-skills}/mlops/research/dspy/references/modules.md +0 -0
- /package/agent/{skills → optional-skills}/mlops/research/dspy/references/optimizers.md +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/references/jailbreak-templates.md +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/references/refusal-detection.md +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/scripts/godmode_race.py +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/scripts/load_godmode.py +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/scripts/parseltongue.py +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/templates/prefill-subtle.json +0 -0
- /package/agent/{skills/red-teaming → optional-skills/security}/godmode/templates/prefill.json +0 -0
- /package/agent/{skills → optional-skills}/software-development/subagent-driven-development/references/context-budget-discipline.md +0 -0
- /package/agent/{skills → optional-skills}/software-development/subagent-driven-development/references/gates-taxonomy.md +0 -0
|
@@ -19,7 +19,7 @@ import os
|
|
|
19
19
|
import random
|
|
20
20
|
import threading
|
|
21
21
|
import time
|
|
22
|
-
from typing import Optional
|
|
22
|
+
from typing import Any, Optional
|
|
23
23
|
|
|
24
24
|
from agent.display import (
|
|
25
25
|
KawaiiSpinner,
|
|
@@ -58,6 +58,80 @@ def _ra():
|
|
|
58
58
|
return run_agent
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
def _emit_terminal_post_tool_call(
|
|
62
|
+
agent,
|
|
63
|
+
*,
|
|
64
|
+
function_name: str,
|
|
65
|
+
function_args: dict,
|
|
66
|
+
result: Any,
|
|
67
|
+
effective_task_id: str,
|
|
68
|
+
tool_call_id: str,
|
|
69
|
+
duration_ms: int = 0,
|
|
70
|
+
status: str | None = None,
|
|
71
|
+
error_type: str | None = None,
|
|
72
|
+
error_message: str | None = None,
|
|
73
|
+
middleware_trace: Optional[list[dict[str, Any]]] = None,
|
|
74
|
+
) -> None:
|
|
75
|
+
try:
|
|
76
|
+
from model_tools import _emit_post_tool_call_hook
|
|
77
|
+
_emit_post_tool_call_hook(
|
|
78
|
+
function_name=function_name,
|
|
79
|
+
function_args=function_args,
|
|
80
|
+
result=result,
|
|
81
|
+
task_id=effective_task_id or "",
|
|
82
|
+
session_id=getattr(agent, "session_id", "") or "",
|
|
83
|
+
tool_call_id=tool_call_id or "",
|
|
84
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
85
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
86
|
+
duration_ms=duration_ms,
|
|
87
|
+
status=status,
|
|
88
|
+
error_type=error_type,
|
|
89
|
+
error_message=error_message,
|
|
90
|
+
middleware_trace=list(middleware_trace or []),
|
|
91
|
+
)
|
|
92
|
+
except Exception:
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _cancelled_tool_result(reason: str = "user interrupt") -> str:
|
|
97
|
+
return json.dumps(
|
|
98
|
+
{
|
|
99
|
+
"error": f"Tool execution cancelled by {reason}",
|
|
100
|
+
"status": "cancelled",
|
|
101
|
+
},
|
|
102
|
+
ensure_ascii=False,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _emit_cancelled_terminal_post_tool_call(
|
|
107
|
+
agent,
|
|
108
|
+
*,
|
|
109
|
+
function_name: str,
|
|
110
|
+
function_args: dict,
|
|
111
|
+
effective_task_id: str,
|
|
112
|
+
tool_call_id: str,
|
|
113
|
+
start_time: float,
|
|
114
|
+
reason: str = "user interrupt",
|
|
115
|
+
error_type: str = "keyboard_interrupt",
|
|
116
|
+
middleware_trace: Optional[list[dict[str, Any]]] = None,
|
|
117
|
+
) -> str:
|
|
118
|
+
result = _cancelled_tool_result(reason)
|
|
119
|
+
_emit_terminal_post_tool_call(
|
|
120
|
+
agent,
|
|
121
|
+
function_name=function_name,
|
|
122
|
+
function_args=function_args,
|
|
123
|
+
result=result,
|
|
124
|
+
effective_task_id=effective_task_id,
|
|
125
|
+
tool_call_id=tool_call_id,
|
|
126
|
+
duration_ms=int((time.time() - start_time) * 1000),
|
|
127
|
+
status="cancelled",
|
|
128
|
+
error_type=error_type,
|
|
129
|
+
error_message=f"Tool execution cancelled by {reason}",
|
|
130
|
+
middleware_trace=list(middleware_trace or []),
|
|
131
|
+
)
|
|
132
|
+
return result
|
|
133
|
+
|
|
134
|
+
|
|
61
135
|
def _tool_search_scoped_names(agent) -> frozenset:
|
|
62
136
|
"""Return the deferrable tool names the session may invoke via tool_call.
|
|
63
137
|
|
|
@@ -107,6 +181,65 @@ def _tool_search_scoped_names(agent) -> frozenset:
|
|
|
107
181
|
return names
|
|
108
182
|
|
|
109
183
|
|
|
184
|
+
def _apply_tool_request_middleware_for_agent(
|
|
185
|
+
agent,
|
|
186
|
+
*,
|
|
187
|
+
function_name: str,
|
|
188
|
+
function_args: dict,
|
|
189
|
+
effective_task_id: str,
|
|
190
|
+
tool_call_id: str,
|
|
191
|
+
) -> tuple[dict, list[dict[str, Any]]]:
|
|
192
|
+
try:
|
|
193
|
+
from hermes_cli.middleware import apply_tool_request_middleware
|
|
194
|
+
|
|
195
|
+
result = apply_tool_request_middleware(
|
|
196
|
+
function_name,
|
|
197
|
+
function_args,
|
|
198
|
+
task_id=effective_task_id or "",
|
|
199
|
+
session_id=getattr(agent, "session_id", "") or "",
|
|
200
|
+
tool_call_id=tool_call_id or "",
|
|
201
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
202
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
203
|
+
)
|
|
204
|
+
payload = result.payload if isinstance(result.payload, dict) else function_args
|
|
205
|
+
return payload, list(result.trace)
|
|
206
|
+
except Exception as exc:
|
|
207
|
+
logger.debug("tool_request middleware error: %s", exc)
|
|
208
|
+
return function_args, []
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def _run_agent_tool_execution_middleware(
|
|
212
|
+
agent,
|
|
213
|
+
*,
|
|
214
|
+
function_name: str,
|
|
215
|
+
function_args: dict,
|
|
216
|
+
effective_task_id: str,
|
|
217
|
+
tool_call_id: str,
|
|
218
|
+
execute,
|
|
219
|
+
) -> tuple[Any, dict]:
|
|
220
|
+
observed_args = function_args
|
|
221
|
+
|
|
222
|
+
def _execute(next_args: dict) -> Any:
|
|
223
|
+
nonlocal observed_args
|
|
224
|
+
observed_args = next_args if isinstance(next_args, dict) else function_args
|
|
225
|
+
return execute(observed_args)
|
|
226
|
+
|
|
227
|
+
from hermes_cli.middleware import run_tool_execution_middleware
|
|
228
|
+
|
|
229
|
+
result = run_tool_execution_middleware(
|
|
230
|
+
function_name,
|
|
231
|
+
function_args,
|
|
232
|
+
_execute,
|
|
233
|
+
original_args=function_args,
|
|
234
|
+
task_id=effective_task_id or "",
|
|
235
|
+
session_id=getattr(agent, "session_id", "") or "",
|
|
236
|
+
tool_call_id=tool_call_id or "",
|
|
237
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
238
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
239
|
+
)
|
|
240
|
+
return result, observed_args
|
|
241
|
+
|
|
242
|
+
|
|
110
243
|
def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effective_task_id: str, api_call_count: int = 0) -> None:
|
|
111
244
|
"""Execute multiple tool calls concurrently using a thread pool.
|
|
112
245
|
|
|
@@ -128,7 +261,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
128
261
|
return
|
|
129
262
|
|
|
130
263
|
# ── Parse args + pre-execution bookkeeping ───────────────────────
|
|
131
|
-
parsed_calls = [] # list of (tool_call, function_name, function_args)
|
|
264
|
+
parsed_calls = [] # list of (tool_call, function_name, function_args, middleware_trace, block_result, blocked_by_guardrail)
|
|
132
265
|
for tool_call in tool_calls:
|
|
133
266
|
function_name = tool_call.function.name
|
|
134
267
|
|
|
@@ -180,6 +313,14 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
180
313
|
except Exception:
|
|
181
314
|
pass
|
|
182
315
|
|
|
316
|
+
function_args, middleware_trace = _apply_tool_request_middleware_for_agent(
|
|
317
|
+
agent,
|
|
318
|
+
function_name=function_name,
|
|
319
|
+
function_args=function_args,
|
|
320
|
+
effective_task_id=effective_task_id,
|
|
321
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
322
|
+
)
|
|
323
|
+
|
|
183
324
|
# ── Block evaluation (BEFORE checkpoint preflight) ───────────
|
|
184
325
|
# We must know whether the tool will execute before touching
|
|
185
326
|
# checkpoint state (dedup slot, real snapshots).
|
|
@@ -188,22 +329,65 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
188
329
|
if _ts_scope_block is not None:
|
|
189
330
|
# Out-of-scope tool_call: reject before hooks/guardrails/dispatch.
|
|
190
331
|
block_result = _ts_scope_block
|
|
332
|
+
_emit_terminal_post_tool_call(
|
|
333
|
+
agent,
|
|
334
|
+
function_name=function_name,
|
|
335
|
+
function_args=function_args,
|
|
336
|
+
result=block_result,
|
|
337
|
+
effective_task_id=effective_task_id,
|
|
338
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
339
|
+
status="blocked",
|
|
340
|
+
error_type="tool_scope_block",
|
|
341
|
+
error_message=_ts_scope_block,
|
|
342
|
+
middleware_trace=list(middleware_trace),
|
|
343
|
+
)
|
|
191
344
|
else:
|
|
192
345
|
try:
|
|
193
346
|
from hermes_cli.plugins import get_pre_tool_call_block_message
|
|
194
347
|
block_message = get_pre_tool_call_block_message(
|
|
195
|
-
function_name,
|
|
348
|
+
function_name,
|
|
349
|
+
function_args,
|
|
350
|
+
task_id=effective_task_id or "",
|
|
351
|
+
session_id=getattr(agent, "session_id", "") or "",
|
|
352
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
353
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
354
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
355
|
+
middleware_trace=list(middleware_trace),
|
|
196
356
|
)
|
|
197
357
|
except Exception:
|
|
198
358
|
block_message = None
|
|
199
359
|
|
|
200
360
|
if block_message is not None:
|
|
201
361
|
block_result = json.dumps({"error": block_message}, ensure_ascii=False)
|
|
362
|
+
_emit_terminal_post_tool_call(
|
|
363
|
+
agent,
|
|
364
|
+
function_name=function_name,
|
|
365
|
+
function_args=function_args,
|
|
366
|
+
result=block_result,
|
|
367
|
+
effective_task_id=effective_task_id,
|
|
368
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
369
|
+
status="blocked",
|
|
370
|
+
error_type="plugin_block",
|
|
371
|
+
error_message=block_message,
|
|
372
|
+
middleware_trace=list(middleware_trace),
|
|
373
|
+
)
|
|
202
374
|
else:
|
|
203
375
|
guardrail_decision = agent._tool_guardrails.before_call(function_name, function_args)
|
|
204
376
|
if not guardrail_decision.allows_execution:
|
|
205
377
|
block_result = agent._guardrail_block_result(guardrail_decision)
|
|
206
378
|
blocked_by_guardrail = True
|
|
379
|
+
_emit_terminal_post_tool_call(
|
|
380
|
+
agent,
|
|
381
|
+
function_name=function_name,
|
|
382
|
+
function_args=function_args,
|
|
383
|
+
result=block_result,
|
|
384
|
+
effective_task_id=effective_task_id,
|
|
385
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
386
|
+
status="blocked",
|
|
387
|
+
error_type="guardrail_block",
|
|
388
|
+
error_message=getattr(guardrail_decision, "message", None) or "Tool blocked by guardrail policy",
|
|
389
|
+
middleware_trace=list(middleware_trace),
|
|
390
|
+
)
|
|
207
391
|
|
|
208
392
|
# ── Checkpoint preflight (only for tools that will execute) ──
|
|
209
393
|
if block_result is None:
|
|
@@ -229,13 +413,13 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
229
413
|
except Exception:
|
|
230
414
|
pass
|
|
231
415
|
|
|
232
|
-
parsed_calls.append((tool_call, function_name, function_args, block_result, blocked_by_guardrail))
|
|
416
|
+
parsed_calls.append((tool_call, function_name, function_args, middleware_trace, block_result, blocked_by_guardrail))
|
|
233
417
|
|
|
234
418
|
# ── Logging / callbacks ──────────────────────────────────────────
|
|
235
|
-
tool_names_str = ", ".join(name for _, name, _, _, _ in parsed_calls)
|
|
236
|
-
if not agent.quiet_mode:
|
|
419
|
+
tool_names_str = ", ".join(name for _, name, _, _, _, _ in parsed_calls)
|
|
420
|
+
if not agent.quiet_mode and getattr(agent, "tool_progress_mode", "all") != "off":
|
|
237
421
|
print(f" ⚡ Concurrent: {num_tools} tool calls — {tool_names_str}")
|
|
238
|
-
for i, (tc, name, args, block_result, blocked_by_guardrail) in enumerate(parsed_calls, 1):
|
|
422
|
+
for i, (tc, name, args, middleware_trace, block_result, blocked_by_guardrail) in enumerate(parsed_calls, 1):
|
|
239
423
|
args_str = json.dumps(args, ensure_ascii=False)
|
|
240
424
|
if agent.verbose_logging:
|
|
241
425
|
print(f" 📞 Tool {i}: {name}({list(args.keys())})")
|
|
@@ -244,7 +428,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
244
428
|
args_preview = args_str[:agent.log_prefix_chars] + "..." if len(args_str) > agent.log_prefix_chars else args_str
|
|
245
429
|
print(f" 📞 Tool {i}: {name}({list(args.keys())}) - {args_preview}")
|
|
246
430
|
|
|
247
|
-
for tc, name, args, block_result, blocked_by_guardrail in parsed_calls:
|
|
431
|
+
for tc, name, args, middleware_trace, block_result, blocked_by_guardrail in parsed_calls:
|
|
248
432
|
if block_result is not None:
|
|
249
433
|
continue
|
|
250
434
|
if agent.tool_progress_callback:
|
|
@@ -254,7 +438,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
254
438
|
except Exception as cb_err:
|
|
255
439
|
logging.debug(f"Tool progress callback error: {cb_err}")
|
|
256
440
|
|
|
257
|
-
for tc, name, args, block_result, blocked_by_guardrail in parsed_calls:
|
|
441
|
+
for tc, name, args, middleware_trace, block_result, blocked_by_guardrail in parsed_calls:
|
|
258
442
|
if block_result is not None:
|
|
259
443
|
continue
|
|
260
444
|
if agent.tool_start_callback:
|
|
@@ -264,18 +448,18 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
264
448
|
logging.debug(f"Tool start callback error: {cb_err}")
|
|
265
449
|
|
|
266
450
|
# ── Concurrent execution ─────────────────────────────────────────
|
|
267
|
-
# Each slot holds (function_name, function_args, function_result, duration, error_flag, blocked_flag)
|
|
451
|
+
# Each slot holds (function_name, function_args, function_result, duration, error_flag, blocked_flag, middleware_trace)
|
|
268
452
|
results = [None] * num_tools
|
|
269
|
-
for i, (tc, name, args, block_result, blocked_by_guardrail) in enumerate(parsed_calls):
|
|
453
|
+
for i, (tc, name, args, middleware_trace, block_result, blocked_by_guardrail) in enumerate(parsed_calls):
|
|
270
454
|
if block_result is not None:
|
|
271
|
-
results[i] = (name, args, block_result, 0.0, True, True)
|
|
455
|
+
results[i] = (name, args, block_result, 0.0, True, True, middleware_trace)
|
|
272
456
|
|
|
273
457
|
# Touch activity before launching workers so the gateway knows
|
|
274
458
|
# we're executing tools (not stuck).
|
|
275
459
|
agent._current_tool = tool_names_str
|
|
276
460
|
agent._touch_activity(f"executing {num_tools} tools concurrently: {tool_names_str}")
|
|
277
461
|
|
|
278
|
-
def _run_tool(index, tool_call, function_name, function_args):
|
|
462
|
+
def _run_tool(index, tool_call, function_name, function_args, middleware_trace):
|
|
279
463
|
"""Worker function executed in a thread."""
|
|
280
464
|
# Register this worker tid so the agent can fan out an interrupt
|
|
281
465
|
# to it — see AIAgent.interrupt(). Must happen first thing, and
|
|
@@ -314,7 +498,27 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
314
498
|
tool_call.id,
|
|
315
499
|
messages=messages,
|
|
316
500
|
pre_tool_block_checked=True,
|
|
501
|
+
skip_tool_request_middleware=True,
|
|
502
|
+
tool_request_middleware_trace=list(middleware_trace),
|
|
503
|
+
)
|
|
504
|
+
except KeyboardInterrupt:
|
|
505
|
+
try:
|
|
506
|
+
agent.interrupt("keyboard interrupt")
|
|
507
|
+
except Exception:
|
|
508
|
+
pass
|
|
509
|
+
result = _emit_cancelled_terminal_post_tool_call(
|
|
510
|
+
agent,
|
|
511
|
+
function_name=function_name,
|
|
512
|
+
function_args=function_args,
|
|
513
|
+
effective_task_id=effective_task_id,
|
|
514
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
515
|
+
start_time=start,
|
|
516
|
+
middleware_trace=list(middleware_trace),
|
|
317
517
|
)
|
|
518
|
+
duration = time.time() - start
|
|
519
|
+
logger.info("tool %s cancelled (%.2fs)", function_name, duration)
|
|
520
|
+
results[index] = (function_name, function_args, result, duration, True, False, middleware_trace)
|
|
521
|
+
return
|
|
318
522
|
except Exception as tool_error:
|
|
319
523
|
result = f"Error executing tool '{function_name}': {tool_error}"
|
|
320
524
|
logger.error("_invoke_tool raised for %s: %s", function_name, tool_error, exc_info=True)
|
|
@@ -324,7 +528,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
324
528
|
logger.info("tool %s failed (%.2fs): %s", function_name, duration, result[:200])
|
|
325
529
|
else:
|
|
326
530
|
logger.info("tool %s completed (%.2fs, %d chars)", function_name, duration, len(result))
|
|
327
|
-
results[index] = (function_name, function_args, result, duration, is_error, False)
|
|
531
|
+
results[index] = (function_name, function_args, result, duration, is_error, False, middleware_trace)
|
|
328
532
|
finally:
|
|
329
533
|
# Tear down worker-tid tracking. Clear any interrupt bit we may
|
|
330
534
|
# have set so the next task scheduled onto this recycled tid
|
|
@@ -349,7 +553,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
349
553
|
try:
|
|
350
554
|
runnable_calls = [
|
|
351
555
|
(i, tc, name, args)
|
|
352
|
-
for i, (tc, name, args, block_result, blocked_by_guardrail) in enumerate(parsed_calls)
|
|
556
|
+
for i, (tc, name, args, middleware_trace, block_result, blocked_by_guardrail) in enumerate(parsed_calls)
|
|
353
557
|
if block_result is None
|
|
354
558
|
]
|
|
355
559
|
futures = []
|
|
@@ -361,7 +565,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
361
565
|
# _approval_session_key) AND thread-local approval/sudo
|
|
362
566
|
# callbacks into the worker thread; clears callbacks on exit.
|
|
363
567
|
f = executor.submit(
|
|
364
|
-
propagate_context_to_thread(_run_tool), i, tc, name, args
|
|
568
|
+
propagate_context_to_thread(_run_tool), i, tc, name, args, parsed_calls[i][3]
|
|
365
569
|
)
|
|
366
570
|
futures.append(f)
|
|
367
571
|
|
|
@@ -419,18 +623,42 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
419
623
|
spinner.stop(f"⚡ {completed}/{num_tools} tools completed in {total_dur:.1f}s total")
|
|
420
624
|
|
|
421
625
|
# ── Post-execution: display per-tool results ─────────────────────
|
|
422
|
-
for i, (tc, name, args, block_result, blocked_by_guardrail) in enumerate(parsed_calls):
|
|
626
|
+
for i, (tc, name, args, middleware_trace, block_result, blocked_by_guardrail) in enumerate(parsed_calls):
|
|
423
627
|
r = results[i]
|
|
424
628
|
blocked = False
|
|
425
629
|
if r is None:
|
|
426
630
|
# Tool was cancelled (interrupt) or thread didn't return
|
|
427
631
|
if agent._interrupt_requested:
|
|
428
632
|
function_result = f"[Tool execution cancelled — {name} was skipped due to user interrupt]"
|
|
633
|
+
_emit_terminal_post_tool_call(
|
|
634
|
+
agent,
|
|
635
|
+
function_name=name,
|
|
636
|
+
function_args=args,
|
|
637
|
+
result=function_result,
|
|
638
|
+
effective_task_id=effective_task_id,
|
|
639
|
+
tool_call_id=getattr(tc, "id", "") or "",
|
|
640
|
+
status="cancelled",
|
|
641
|
+
error_type="keyboard_interrupt",
|
|
642
|
+
error_message="Tool execution cancelled by user interrupt",
|
|
643
|
+
middleware_trace=list(middleware_trace),
|
|
644
|
+
)
|
|
429
645
|
else:
|
|
430
646
|
function_result = f"Error executing tool '{name}': thread did not return a result"
|
|
647
|
+
_emit_terminal_post_tool_call(
|
|
648
|
+
agent,
|
|
649
|
+
function_name=name,
|
|
650
|
+
function_args=args,
|
|
651
|
+
result=function_result,
|
|
652
|
+
effective_task_id=effective_task_id,
|
|
653
|
+
tool_call_id=getattr(tc, "id", "") or "",
|
|
654
|
+
status="error",
|
|
655
|
+
error_type="thread_missing_result",
|
|
656
|
+
error_message=function_result,
|
|
657
|
+
middleware_trace=list(middleware_trace),
|
|
658
|
+
)
|
|
431
659
|
tool_duration = 0.0
|
|
432
660
|
else:
|
|
433
|
-
function_name, function_args, function_result, tool_duration, is_error, blocked = r
|
|
661
|
+
function_name, function_args, function_result, tool_duration, is_error, blocked, middleware_trace = r
|
|
434
662
|
|
|
435
663
|
if not blocked:
|
|
436
664
|
function_result = agent._append_guardrail_observation(
|
|
@@ -474,7 +702,7 @@ def execute_tool_calls_concurrent(agent, assistant_message, messages: list, effe
|
|
|
474
702
|
if agent._should_emit_quiet_tool_messages():
|
|
475
703
|
cute_msg = _get_cute_tool_message_impl(name, args, tool_duration, result=function_result)
|
|
476
704
|
agent._safe_print(f" {cute_msg}")
|
|
477
|
-
elif not agent.quiet_mode:
|
|
705
|
+
elif not agent.quiet_mode and getattr(agent, "tool_progress_mode", "all") != "off":
|
|
478
706
|
_preview_str = _multimodal_text_summary(function_result)
|
|
479
707
|
if agent.verbose_logging:
|
|
480
708
|
print(f" ✅ Tool {i+1} completed in {tool_duration:.2f}s")
|
|
@@ -590,15 +818,32 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
590
818
|
except Exception:
|
|
591
819
|
pass
|
|
592
820
|
|
|
821
|
+
function_args, middleware_trace = _apply_tool_request_middleware_for_agent(
|
|
822
|
+
agent,
|
|
823
|
+
function_name=function_name,
|
|
824
|
+
function_args=function_args,
|
|
825
|
+
effective_task_id=effective_task_id,
|
|
826
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
827
|
+
)
|
|
828
|
+
|
|
593
829
|
# Check plugin hooks for a block directive before executing.
|
|
594
830
|
_block_msg: Optional[str] = None
|
|
831
|
+
_block_error_type = "plugin_block"
|
|
595
832
|
if _ts_scope_block is not None:
|
|
596
833
|
_block_msg = _ts_scope_block
|
|
834
|
+
_block_error_type = "tool_scope_block"
|
|
597
835
|
else:
|
|
598
836
|
try:
|
|
599
837
|
from hermes_cli.plugins import get_pre_tool_call_block_message
|
|
600
838
|
_block_msg = get_pre_tool_call_block_message(
|
|
601
|
-
function_name,
|
|
839
|
+
function_name,
|
|
840
|
+
function_args,
|
|
841
|
+
task_id=effective_task_id or "",
|
|
842
|
+
session_id=getattr(agent, "session_id", "") or "",
|
|
843
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
844
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
845
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
846
|
+
middleware_trace=list(middleware_trace),
|
|
602
847
|
)
|
|
603
848
|
except Exception:
|
|
604
849
|
pass
|
|
@@ -621,7 +866,7 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
621
866
|
elif function_name == "skill_manage":
|
|
622
867
|
agent._iters_since_skill = 0
|
|
623
868
|
|
|
624
|
-
if not agent.quiet_mode:
|
|
869
|
+
if not agent.quiet_mode and getattr(agent, "tool_progress_mode", "all") != "off":
|
|
625
870
|
args_str = json.dumps(function_args, ensure_ascii=False)
|
|
626
871
|
if agent.verbose_logging:
|
|
627
872
|
print(f" 📞 Tool {i}: {function_name}({list(function_args.keys())})")
|
|
@@ -687,79 +932,172 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
687
932
|
# Tool blocked by plugin policy — return error without executing.
|
|
688
933
|
function_result = json.dumps({"error": _block_msg}, ensure_ascii=False)
|
|
689
934
|
tool_duration = 0.0
|
|
935
|
+
_emit_terminal_post_tool_call(
|
|
936
|
+
agent,
|
|
937
|
+
function_name=function_name,
|
|
938
|
+
function_args=function_args,
|
|
939
|
+
result=function_result,
|
|
940
|
+
effective_task_id=effective_task_id,
|
|
941
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
942
|
+
status="blocked",
|
|
943
|
+
error_type=_block_error_type,
|
|
944
|
+
error_message=_block_msg,
|
|
945
|
+
middleware_trace=list(middleware_trace),
|
|
946
|
+
)
|
|
690
947
|
elif _guardrail_block_decision is not None:
|
|
691
948
|
# Tool blocked by tool-loop guardrail — synthesize exactly one
|
|
692
949
|
# tool result for the original tool_call_id without executing.
|
|
693
950
|
function_result = agent._guardrail_block_result(_guardrail_block_decision)
|
|
694
951
|
tool_duration = 0.0
|
|
952
|
+
_emit_terminal_post_tool_call(
|
|
953
|
+
agent,
|
|
954
|
+
function_name=function_name,
|
|
955
|
+
function_args=function_args,
|
|
956
|
+
result=function_result,
|
|
957
|
+
effective_task_id=effective_task_id,
|
|
958
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
959
|
+
status="blocked",
|
|
960
|
+
error_type="guardrail_block",
|
|
961
|
+
error_message=getattr(_guardrail_block_decision, "message", None) or "Tool blocked by guardrail policy",
|
|
962
|
+
middleware_trace=list(middleware_trace),
|
|
963
|
+
)
|
|
695
964
|
elif function_name == "todo":
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
965
|
+
def _execute(next_args: dict) -> Any:
|
|
966
|
+
from tools.todo_tool import todo_tool as _todo_tool
|
|
967
|
+
return _todo_tool(
|
|
968
|
+
todos=next_args.get("todos"),
|
|
969
|
+
merge=next_args.get("merge", False),
|
|
970
|
+
store=agent._todo_store,
|
|
971
|
+
)
|
|
972
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
973
|
+
agent,
|
|
974
|
+
function_name=function_name,
|
|
975
|
+
function_args=function_args,
|
|
976
|
+
effective_task_id=effective_task_id,
|
|
977
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
978
|
+
execute=_execute,
|
|
701
979
|
)
|
|
702
980
|
tool_duration = time.time() - tool_start_time
|
|
703
981
|
if agent._should_emit_quiet_tool_messages():
|
|
704
982
|
agent._vprint(f" {_get_cute_tool_message_impl('todo', function_args, tool_duration, result=function_result)}")
|
|
705
983
|
elif function_name == "session_search":
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
984
|
+
def _execute(next_args: dict) -> Any:
|
|
985
|
+
session_db = agent._get_session_db_for_recall()
|
|
986
|
+
if not session_db:
|
|
987
|
+
from hermes_state import format_session_db_unavailable
|
|
988
|
+
return json.dumps({"success": False, "error": format_session_db_unavailable()})
|
|
711
989
|
from tools.session_search_tool import session_search as _session_search
|
|
712
|
-
|
|
713
|
-
query=
|
|
714
|
-
role_filter=
|
|
715
|
-
limit=
|
|
716
|
-
session_id=
|
|
717
|
-
around_message_id=
|
|
718
|
-
window=
|
|
719
|
-
sort=
|
|
990
|
+
return _session_search(
|
|
991
|
+
query=next_args.get("query", ""),
|
|
992
|
+
role_filter=next_args.get("role_filter"),
|
|
993
|
+
limit=next_args.get("limit", 3),
|
|
994
|
+
session_id=next_args.get("session_id"),
|
|
995
|
+
around_message_id=next_args.get("around_message_id"),
|
|
996
|
+
window=next_args.get("window", 5),
|
|
997
|
+
sort=next_args.get("sort"),
|
|
720
998
|
db=session_db,
|
|
721
999
|
current_session_id=agent.session_id,
|
|
722
1000
|
)
|
|
1001
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1002
|
+
agent,
|
|
1003
|
+
function_name=function_name,
|
|
1004
|
+
function_args=function_args,
|
|
1005
|
+
effective_task_id=effective_task_id,
|
|
1006
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1007
|
+
execute=_execute,
|
|
1008
|
+
)
|
|
723
1009
|
tool_duration = time.time() - tool_start_time
|
|
724
1010
|
if agent._should_emit_quiet_tool_messages():
|
|
725
1011
|
agent._vprint(f" {_get_cute_tool_message_impl('session_search', function_args, tool_duration, result=function_result)}")
|
|
726
1012
|
elif function_name == "memory":
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1013
|
+
def _execute(next_args: dict) -> Any:
|
|
1014
|
+
target = next_args.get("target", "memory")
|
|
1015
|
+
operations = next_args.get("operations")
|
|
1016
|
+
from tools.memory_tool import memory_tool as _memory_tool
|
|
1017
|
+
result = _memory_tool(
|
|
1018
|
+
action=next_args.get("action"),
|
|
1019
|
+
target=target,
|
|
1020
|
+
content=next_args.get("content"),
|
|
1021
|
+
old_text=next_args.get("old_text"),
|
|
1022
|
+
operations=operations,
|
|
1023
|
+
store=agent._memory_store,
|
|
1024
|
+
)
|
|
1025
|
+
# Bridge: notify external memory provider of built-in memory writes.
|
|
1026
|
+
# Covers both the single-op shape and each add/replace inside a batch.
|
|
1027
|
+
if agent._memory_manager:
|
|
1028
|
+
if operations:
|
|
1029
|
+
_mem_ops = [
|
|
1030
|
+
op for op in operations
|
|
1031
|
+
if isinstance(op, dict) and op.get("action") in {"add", "replace"}
|
|
1032
|
+
]
|
|
1033
|
+
else:
|
|
1034
|
+
_mem_ops = (
|
|
1035
|
+
[{"action": next_args.get("action"), "content": next_args.get("content")}]
|
|
1036
|
+
if next_args.get("action") in {"add", "replace"} else []
|
|
1037
|
+
)
|
|
1038
|
+
for _op in _mem_ops:
|
|
1039
|
+
try:
|
|
1040
|
+
agent._memory_manager.on_memory_write(
|
|
1041
|
+
_op.get("action", ""),
|
|
1042
|
+
target,
|
|
1043
|
+
_op.get("content", "") or "",
|
|
1044
|
+
metadata=agent._build_memory_write_metadata(
|
|
1045
|
+
task_id=effective_task_id,
|
|
1046
|
+
tool_call_id=getattr(tool_call, "id", None),
|
|
1047
|
+
),
|
|
1048
|
+
)
|
|
1049
|
+
except Exception:
|
|
1050
|
+
pass
|
|
1051
|
+
return result
|
|
1052
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1053
|
+
agent,
|
|
1054
|
+
function_name=function_name,
|
|
1055
|
+
function_args=function_args,
|
|
1056
|
+
effective_task_id=effective_task_id,
|
|
1057
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1058
|
+
execute=_execute,
|
|
735
1059
|
)
|
|
736
|
-
# Bridge: notify external memory provider of built-in memory writes
|
|
737
|
-
if agent._memory_manager and function_args.get("action") in {"add", "replace"}:
|
|
738
|
-
try:
|
|
739
|
-
agent._memory_manager.on_memory_write(
|
|
740
|
-
function_args.get("action", ""),
|
|
741
|
-
target,
|
|
742
|
-
function_args.get("content", ""),
|
|
743
|
-
metadata=agent._build_memory_write_metadata(
|
|
744
|
-
task_id=effective_task_id,
|
|
745
|
-
tool_call_id=getattr(tool_call, "id", None),
|
|
746
|
-
),
|
|
747
|
-
)
|
|
748
|
-
except Exception:
|
|
749
|
-
pass
|
|
750
1060
|
tool_duration = time.time() - tool_start_time
|
|
751
1061
|
if agent._should_emit_quiet_tool_messages():
|
|
752
1062
|
agent._vprint(f" {_get_cute_tool_message_impl('memory', function_args, tool_duration, result=function_result)}")
|
|
753
1063
|
elif function_name == "clarify":
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1064
|
+
def _execute(next_args: dict) -> Any:
|
|
1065
|
+
from tools.clarify_tool import clarify_tool as _clarify_tool
|
|
1066
|
+
return _clarify_tool(
|
|
1067
|
+
question=next_args.get("question", ""),
|
|
1068
|
+
choices=next_args.get("choices"),
|
|
1069
|
+
callback=agent.clarify_callback,
|
|
1070
|
+
)
|
|
1071
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1072
|
+
agent,
|
|
1073
|
+
function_name=function_name,
|
|
1074
|
+
function_args=function_args,
|
|
1075
|
+
effective_task_id=effective_task_id,
|
|
1076
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1077
|
+
execute=_execute,
|
|
759
1078
|
)
|
|
760
1079
|
tool_duration = time.time() - tool_start_time
|
|
761
1080
|
if agent._should_emit_quiet_tool_messages():
|
|
762
1081
|
agent._vprint(f" {_get_cute_tool_message_impl('clarify', function_args, tool_duration, result=function_result)}")
|
|
1082
|
+
elif function_name == "read_terminal":
|
|
1083
|
+
def _execute(next_args: dict) -> Any:
|
|
1084
|
+
from tools.read_terminal_tool import read_terminal_tool as _read_terminal_tool
|
|
1085
|
+
return _read_terminal_tool(
|
|
1086
|
+
start_line=next_args.get("start_line"),
|
|
1087
|
+
count=next_args.get("count"),
|
|
1088
|
+
callback=getattr(agent, "read_terminal_callback", None),
|
|
1089
|
+
)
|
|
1090
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1091
|
+
agent,
|
|
1092
|
+
function_name=function_name,
|
|
1093
|
+
function_args=function_args,
|
|
1094
|
+
effective_task_id=effective_task_id,
|
|
1095
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1096
|
+
execute=_execute,
|
|
1097
|
+
)
|
|
1098
|
+
tool_duration = time.time() - tool_start_time
|
|
1099
|
+
if agent._should_emit_quiet_tool_messages():
|
|
1100
|
+
agent._vprint(f" {_get_cute_tool_message_impl('read_terminal', function_args, tool_duration, result=function_result)}")
|
|
763
1101
|
elif function_name == "delegate_task":
|
|
764
1102
|
tasks_arg = function_args.get("tasks")
|
|
765
1103
|
if tasks_arg and isinstance(tasks_arg, list):
|
|
@@ -779,7 +1117,16 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
779
1117
|
agent._delegate_spinner = spinner
|
|
780
1118
|
_delegate_result = None
|
|
781
1119
|
try:
|
|
782
|
-
|
|
1120
|
+
def _execute(next_args: dict) -> Any:
|
|
1121
|
+
return agent._dispatch_delegate_task(next_args)
|
|
1122
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1123
|
+
agent,
|
|
1124
|
+
function_name=function_name,
|
|
1125
|
+
function_args=function_args,
|
|
1126
|
+
effective_task_id=effective_task_id,
|
|
1127
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1128
|
+
execute=_execute,
|
|
1129
|
+
)
|
|
783
1130
|
_delegate_result = function_result
|
|
784
1131
|
finally:
|
|
785
1132
|
agent._delegate_spinner = None
|
|
@@ -800,7 +1147,16 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
800
1147
|
spinner.start()
|
|
801
1148
|
_ce_result = None
|
|
802
1149
|
try:
|
|
803
|
-
|
|
1150
|
+
def _execute(next_args: dict) -> Any:
|
|
1151
|
+
return agent.context_compressor.handle_tool_call(function_name, next_args, messages=messages)
|
|
1152
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1153
|
+
agent,
|
|
1154
|
+
function_name=function_name,
|
|
1155
|
+
function_args=function_args,
|
|
1156
|
+
effective_task_id=effective_task_id,
|
|
1157
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1158
|
+
execute=_execute,
|
|
1159
|
+
)
|
|
804
1160
|
_ce_result = function_result
|
|
805
1161
|
except Exception as tool_error:
|
|
806
1162
|
function_result = json.dumps({"error": f"Context engine tool '{function_name}' failed: {tool_error}"})
|
|
@@ -824,7 +1180,16 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
824
1180
|
spinner.start()
|
|
825
1181
|
_mem_result = None
|
|
826
1182
|
try:
|
|
827
|
-
|
|
1183
|
+
def _execute(next_args: dict) -> Any:
|
|
1184
|
+
return agent._memory_manager.handle_tool_call(function_name, next_args)
|
|
1185
|
+
function_result, function_args = _run_agent_tool_execution_middleware(
|
|
1186
|
+
agent,
|
|
1187
|
+
function_name=function_name,
|
|
1188
|
+
function_args=function_args,
|
|
1189
|
+
effective_task_id=effective_task_id,
|
|
1190
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1191
|
+
execute=_execute,
|
|
1192
|
+
)
|
|
828
1193
|
_mem_result = function_result
|
|
829
1194
|
except Exception as tool_error:
|
|
830
1195
|
function_result = json.dumps({"error": f"Memory tool '{function_name}' failed: {tool_error}"})
|
|
@@ -850,12 +1215,32 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
850
1215
|
function_name, function_args, effective_task_id,
|
|
851
1216
|
tool_call_id=tool_call.id,
|
|
852
1217
|
session_id=agent.session_id or "",
|
|
1218
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
1219
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
853
1220
|
enabled_tools=list(agent.valid_tool_names) if agent.valid_tool_names else None,
|
|
854
1221
|
skip_pre_tool_call_hook=True,
|
|
1222
|
+
skip_tool_request_middleware=True,
|
|
855
1223
|
enabled_toolsets=getattr(agent, "enabled_toolsets", None),
|
|
856
1224
|
disabled_toolsets=getattr(agent, "disabled_toolsets", None),
|
|
1225
|
+
tool_request_middleware_trace=list(middleware_trace),
|
|
1226
|
+
)
|
|
1227
|
+
_spinner_result = function_result
|
|
1228
|
+
except KeyboardInterrupt:
|
|
1229
|
+
function_result = _emit_cancelled_terminal_post_tool_call(
|
|
1230
|
+
agent,
|
|
1231
|
+
function_name=function_name,
|
|
1232
|
+
function_args=function_args,
|
|
1233
|
+
effective_task_id=effective_task_id,
|
|
1234
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1235
|
+
start_time=tool_start_time,
|
|
1236
|
+
middleware_trace=list(middleware_trace),
|
|
857
1237
|
)
|
|
858
1238
|
_spinner_result = function_result
|
|
1239
|
+
try:
|
|
1240
|
+
agent.interrupt("keyboard interrupt")
|
|
1241
|
+
except Exception:
|
|
1242
|
+
pass
|
|
1243
|
+
raise
|
|
859
1244
|
except Exception as tool_error:
|
|
860
1245
|
function_result = f"Error executing tool '{function_name}': {tool_error}"
|
|
861
1246
|
logger.error("handle_function_call raised for %s: %s", function_name, tool_error, exc_info=True)
|
|
@@ -872,11 +1257,30 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
872
1257
|
function_name, function_args, effective_task_id,
|
|
873
1258
|
tool_call_id=tool_call.id,
|
|
874
1259
|
session_id=agent.session_id or "",
|
|
1260
|
+
turn_id=getattr(agent, "_current_turn_id", "") or "",
|
|
1261
|
+
api_request_id=getattr(agent, "_current_api_request_id", "") or "",
|
|
875
1262
|
enabled_tools=list(agent.valid_tool_names) if agent.valid_tool_names else None,
|
|
876
1263
|
skip_pre_tool_call_hook=True,
|
|
1264
|
+
skip_tool_request_middleware=True,
|
|
877
1265
|
enabled_toolsets=getattr(agent, "enabled_toolsets", None),
|
|
878
1266
|
disabled_toolsets=getattr(agent, "disabled_toolsets", None),
|
|
1267
|
+
tool_request_middleware_trace=list(middleware_trace),
|
|
1268
|
+
)
|
|
1269
|
+
except KeyboardInterrupt:
|
|
1270
|
+
_emit_cancelled_terminal_post_tool_call(
|
|
1271
|
+
agent,
|
|
1272
|
+
function_name=function_name,
|
|
1273
|
+
function_args=function_args,
|
|
1274
|
+
effective_task_id=effective_task_id,
|
|
1275
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1276
|
+
start_time=tool_start_time,
|
|
1277
|
+
middleware_trace=list(middleware_trace),
|
|
879
1278
|
)
|
|
1279
|
+
try:
|
|
1280
|
+
agent.interrupt("keyboard interrupt")
|
|
1281
|
+
except Exception:
|
|
1282
|
+
pass
|
|
1283
|
+
raise
|
|
880
1284
|
except Exception as tool_error:
|
|
881
1285
|
function_result = f"Error executing tool '{function_name}': {tool_error}"
|
|
882
1286
|
logger.error("handle_function_call raised for %s: %s", function_name, tool_error, exc_info=True)
|
|
@@ -895,6 +1299,28 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
895
1299
|
# Log tool errors to the persistent error log so [error] tags
|
|
896
1300
|
# in the UI always have a corresponding detailed entry on disk.
|
|
897
1301
|
_is_error_result, _ = _detect_tool_failure(function_name, function_result)
|
|
1302
|
+
# The agent-runtime tools above (todo, session_search, memory,
|
|
1303
|
+
# context-engine, memory-manager, clarify, delegate_task) are
|
|
1304
|
+
# dispatched inline — they never reach handle_function_call, so the
|
|
1305
|
+
# executor is the one that has to fire post_tool_call. For
|
|
1306
|
+
# registry-dispatched tools the else-branch above invoked
|
|
1307
|
+
# handle_function_call, which already fires the hook.
|
|
1308
|
+
from agent.agent_runtime_helpers import agent_runtime_owns_post_tool_hook
|
|
1309
|
+
_executor_must_emit_post_hook = (
|
|
1310
|
+
not _execution_blocked
|
|
1311
|
+
and agent_runtime_owns_post_tool_hook(agent, function_name)
|
|
1312
|
+
)
|
|
1313
|
+
if _executor_must_emit_post_hook:
|
|
1314
|
+
_emit_terminal_post_tool_call(
|
|
1315
|
+
agent,
|
|
1316
|
+
function_name=function_name,
|
|
1317
|
+
function_args=function_args,
|
|
1318
|
+
result=function_result,
|
|
1319
|
+
effective_task_id=effective_task_id,
|
|
1320
|
+
tool_call_id=getattr(tool_call, "id", "") or "",
|
|
1321
|
+
duration_ms=int(tool_duration * 1000),
|
|
1322
|
+
middleware_trace=list(middleware_trace),
|
|
1323
|
+
)
|
|
898
1324
|
if not _execution_blocked:
|
|
899
1325
|
function_result = agent._append_guardrail_observation(
|
|
900
1326
|
function_name,
|
|
@@ -972,7 +1398,7 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe
|
|
|
972
1398
|
# entire batch. The model sees it on the next API iteration.
|
|
973
1399
|
agent._apply_pending_steer_to_tool_results(messages, 1)
|
|
974
1400
|
|
|
975
|
-
if not agent.quiet_mode:
|
|
1401
|
+
if not agent.quiet_mode and getattr(agent, "tool_progress_mode", "all") != "off":
|
|
976
1402
|
if agent.verbose_logging:
|
|
977
1403
|
print(f" ✅ Tool {i} completed in {tool_duration:.2f}s")
|
|
978
1404
|
print(agent._wrap_verbose("Result: ", function_result))
|