@edwardlee5423/magi 0.1.0-alpha.0
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/LICENSE +21 -0
- package/README.md +184 -0
- package/dist/agent/headless-agent.d.ts +15 -0
- package/dist/agent/headless-agent.js +105 -0
- package/dist/agent/headless-agent.js.map +1 -0
- package/dist/agent/local-plan.d.ts +20 -0
- package/dist/agent/local-plan.js +30 -0
- package/dist/agent/local-plan.js.map +1 -0
- package/dist/agent/query-engine.d.ts +71 -0
- package/dist/agent/query-engine.js +938 -0
- package/dist/agent/query-engine.js.map +1 -0
- package/dist/agent/query.d.ts +128 -0
- package/dist/agent/query.js +674 -0
- package/dist/agent/query.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +12 -0
- package/dist/agent/system-prompt.js +104 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/agent/tools.d.ts +71 -0
- package/dist/agent/tools.js +37 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agents/roles.d.ts +9 -0
- package/dist/agents/roles.js +18 -0
- package/dist/agents/roles.js.map +1 -0
- package/dist/agents/task-queue.d.ts +13 -0
- package/dist/agents/task-queue.js +50 -0
- package/dist/agents/task-queue.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +1540 -0
- package/dist/cli.js.map +1 -0
- package/dist/colors.d.ts +20 -0
- package/dist/colors.js +92 -0
- package/dist/colors.js.map +1 -0
- package/dist/commands/agents.d.ts +9 -0
- package/dist/commands/agents.js +37 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/clear.d.ts +9 -0
- package/dist/commands/clear.js +20 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/commit.d.ts +8 -0
- package/dist/commands/commit.js +35 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/compact.d.ts +8 -0
- package/dist/commands/compact.js +29 -0
- package/dist/commands/compact.js.map +1 -0
- package/dist/commands/copy.d.ts +8 -0
- package/dist/commands/copy.js +49 -0
- package/dist/commands/copy.js.map +1 -0
- package/dist/commands/cost.d.ts +8 -0
- package/dist/commands/cost.js +94 -0
- package/dist/commands/cost.js.map +1 -0
- package/dist/commands/diff.d.ts +8 -0
- package/dist/commands/diff.js +38 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.js +23 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export.d.ts +8 -0
- package/dist/commands/export.js +42 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/fork.d.ts +8 -0
- package/dist/commands/fork.js +20 -0
- package/dist/commands/fork.js.map +1 -0
- package/dist/commands/goal.d.ts +9 -0
- package/dist/commands/goal.js +54 -0
- package/dist/commands/goal.js.map +1 -0
- package/dist/commands/help.d.ts +8 -0
- package/dist/commands/help.js +65 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/hooks.d.ts +8 -0
- package/dist/commands/hooks.js +56 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/image.d.ts +17 -0
- package/dist/commands/image.js +74 -0
- package/dist/commands/image.js.map +1 -0
- package/dist/commands/init.d.ts +26 -0
- package/dist/commands/init.js +214 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.js +217 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/memory.d.ts +8 -0
- package/dist/commands/memory.js +79 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/model.d.ts +8 -0
- package/dist/commands/model.js +21 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/permissions.d.ts +9 -0
- package/dist/commands/permissions.js +30 -0
- package/dist/commands/permissions.js.map +1 -0
- package/dist/commands/proactive.d.ts +9 -0
- package/dist/commands/proactive.js +24 -0
- package/dist/commands/proactive.js.map +1 -0
- package/dist/commands/register-all.d.ts +1 -0
- package/dist/commands/register-all.js +68 -0
- package/dist/commands/register-all.js.map +1 -0
- package/dist/commands/registry.d.ts +64 -0
- package/dist/commands/registry.js +235 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/rename.d.ts +8 -0
- package/dist/commands/rename.js +16 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/review.d.ts +8 -0
- package/dist/commands/review.js +13 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/rewind.d.ts +8 -0
- package/dist/commands/rewind.js +45 -0
- package/dist/commands/rewind.js.map +1 -0
- package/dist/commands/route.d.ts +9 -0
- package/dist/commands/route.js +83 -0
- package/dist/commands/route.js.map +1 -0
- package/dist/commands/sessions.d.ts +9 -0
- package/dist/commands/sessions.js +25 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/skill.d.ts +9 -0
- package/dist/commands/skill.js +46 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.js +41 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/summary.d.ts +8 -0
- package/dist/commands/summary.js +39 -0
- package/dist/commands/summary.js.map +1 -0
- package/dist/commands/tasks.d.ts +9 -0
- package/dist/commands/tasks.js +70 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/todos.d.ts +9 -0
- package/dist/commands/todos.js +27 -0
- package/dist/commands/todos.js.map +1 -0
- package/dist/commands/tutorial.d.ts +8 -0
- package/dist/commands/tutorial.js +159 -0
- package/dist/commands/tutorial.js.map +1 -0
- package/dist/commands/upgrade.d.ts +9 -0
- package/dist/commands/upgrade.js +73 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/usage.d.ts +8 -0
- package/dist/commands/usage.js +54 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/vim.d.ts +10 -0
- package/dist/commands/vim.js +34 -0
- package/dist/commands/vim.js.map +1 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.js +533 -0
- package/dist/config.js.map +1 -0
- package/dist/context/compaction.d.ts +66 -0
- package/dist/context/compaction.js +353 -0
- package/dist/context/compaction.js.map +1 -0
- package/dist/context/layers.d.ts +32 -0
- package/dist/context/layers.js +114 -0
- package/dist/context/layers.js.map +1 -0
- package/dist/context/token-budget.d.ts +21 -0
- package/dist/context/token-budget.js +70 -0
- package/dist/context/token-budget.js.map +1 -0
- package/dist/control/auth.d.ts +17 -0
- package/dist/control/auth.js +31 -0
- package/dist/control/auth.js.map +1 -0
- package/dist/control/daemon.d.ts +38 -0
- package/dist/control/daemon.js +135 -0
- package/dist/control/daemon.js.map +1 -0
- package/dist/control/mdns.d.ts +51 -0
- package/dist/control/mdns.js +344 -0
- package/dist/control/mdns.js.map +1 -0
- package/dist/control/peer-client.d.ts +49 -0
- package/dist/control/peer-client.js +170 -0
- package/dist/control/peer-client.js.map +1 -0
- package/dist/control/server.d.ts +30 -0
- package/dist/control/server.js +887 -0
- package/dist/control/server.js.map +1 -0
- package/dist/cost.d.ts +23 -0
- package/dist/cost.js +80 -0
- package/dist/cost.js.map +1 -0
- package/dist/doctor.d.ts +8 -0
- package/dist/doctor.js +22 -0
- package/dist/doctor.js.map +1 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.js +70 -0
- package/dist/env.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +19 -0
- package/dist/events.js +236 -0
- package/dist/events.js.map +1 -0
- package/dist/fs-utils.d.ts +21 -0
- package/dist/fs-utils.js +48 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/goal.d.ts +32 -0
- package/dist/goal.js +172 -0
- package/dist/goal.js.map +1 -0
- package/dist/headless.d.ts +38 -0
- package/dist/headless.js +547 -0
- package/dist/headless.js.map +1 -0
- package/dist/history.d.ts +8 -0
- package/dist/history.js +77 -0
- package/dist/history.js.map +1 -0
- package/dist/hooks/events.d.ts +14 -0
- package/dist/hooks/events.js +37 -0
- package/dist/hooks/events.js.map +1 -0
- package/dist/hooks/runner.d.ts +73 -0
- package/dist/hooks/runner.js +256 -0
- package/dist/hooks/runner.js.map +1 -0
- package/dist/hooks/trigger.d.ts +9 -0
- package/dist/hooks/trigger.js +18 -0
- package/dist/hooks/trigger.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/interactions.d.ts +102 -0
- package/dist/interactions.js +250 -0
- package/dist/interactions.js.map +1 -0
- package/dist/logger.d.ts +32 -0
- package/dist/logger.js +115 -0
- package/dist/logger.js.map +1 -0
- package/dist/markdown.d.ts +18 -0
- package/dist/markdown.js +293 -0
- package/dist/markdown.js.map +1 -0
- package/dist/mcp/approval.d.ts +9 -0
- package/dist/mcp/approval.js +27 -0
- package/dist/mcp/approval.js.map +1 -0
- package/dist/mcp/client.d.ts +61 -0
- package/dist/mcp/client.js +276 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/connection-manager.d.ts +30 -0
- package/dist/mcp/connection-manager.js +126 -0
- package/dist/mcp/connection-manager.js.map +1 -0
- package/dist/mcp/oauth-callback.d.ts +23 -0
- package/dist/mcp/oauth-callback.js +108 -0
- package/dist/mcp/oauth-callback.js.map +1 -0
- package/dist/mcp/oauth-flow.d.ts +45 -0
- package/dist/mcp/oauth-flow.js +145 -0
- package/dist/mcp/oauth-flow.js.map +1 -0
- package/dist/mcp/oauth.d.ts +82 -0
- package/dist/mcp/oauth.js +169 -0
- package/dist/mcp/oauth.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +29 -0
- package/dist/mcp/tool-registry.js +207 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/transport.d.ts +33 -0
- package/dist/mcp/transport.js +493 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/types.d.ts +57 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/memdir.d.ts +58 -0
- package/dist/memdir.js +219 -0
- package/dist/memdir.js.map +1 -0
- package/dist/memory-selection.d.ts +30 -0
- package/dist/memory-selection.js +102 -0
- package/dist/memory-selection.js.map +1 -0
- package/dist/memory.d.ts +85 -0
- package/dist/memory.js +259 -0
- package/dist/memory.js.map +1 -0
- package/dist/paths.d.ts +25 -0
- package/dist/paths.js +99 -0
- package/dist/paths.js.map +1 -0
- package/dist/permissions.d.ts +17 -0
- package/dist/permissions.js +72 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugins/manifest.d.ts +17 -0
- package/dist/plugins/manifest.js +98 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/marketplace.d.ts +22 -0
- package/dist/plugins/marketplace.js +98 -0
- package/dist/plugins/marketplace.js.map +1 -0
- package/dist/proactive.d.ts +15 -0
- package/dist/proactive.js +49 -0
- package/dist/proactive.js.map +1 -0
- package/dist/providers/errors.d.ts +14 -0
- package/dist/providers/errors.js +66 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/format-proxy.d.ts +100 -0
- package/dist/providers/format-proxy.js +235 -0
- package/dist/providers/format-proxy.js.map +1 -0
- package/dist/providers/http.d.ts +4 -0
- package/dist/providers/http.js +21 -0
- package/dist/providers/http.js.map +1 -0
- package/dist/providers/ir.d.ts +84 -0
- package/dist/providers/ir.js +76 -0
- package/dist/providers/ir.js.map +1 -0
- package/dist/providers/messages-compatible.d.ts +19 -0
- package/dist/providers/messages-compatible.js +592 -0
- package/dist/providers/messages-compatible.js.map +1 -0
- package/dist/providers/openai.d.ts +18 -0
- package/dist/providers/openai.js +430 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/registry.d.ts +10 -0
- package/dist/providers/registry.js +16 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/sse.d.ts +6 -0
- package/dist/providers/sse.js +104 -0
- package/dist/providers/sse.js.map +1 -0
- package/dist/routing/model-alias.d.ts +8 -0
- package/dist/routing/model-alias.js +23 -0
- package/dist/routing/model-alias.js.map +1 -0
- package/dist/routing/model-router.d.ts +55 -0
- package/dist/routing/model-router.js +233 -0
- package/dist/routing/model-router.js.map +1 -0
- package/dist/routing/router.d.ts +26 -0
- package/dist/routing/router.js +63 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/rules/agents-loader.d.ts +12 -0
- package/dist/rules/agents-loader.js +61 -0
- package/dist/rules/agents-loader.js.map +1 -0
- package/dist/runner/client.d.ts +67 -0
- package/dist/runner/client.js +175 -0
- package/dist/runner/client.js.map +1 -0
- package/dist/session-store.d.ts +250 -0
- package/dist/session-store.js +629 -0
- package/dist/session-store.js.map +1 -0
- package/dist/skills/bundled.d.ts +14 -0
- package/dist/skills/bundled.js +148 -0
- package/dist/skills/bundled.js.map +1 -0
- package/dist/skills/loader.d.ts +11 -0
- package/dist/skills/loader.js +73 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/slash-menu.d.ts +14 -0
- package/dist/slash-menu.js +166 -0
- package/dist/slash-menu.js.map +1 -0
- package/dist/slash.d.ts +75 -0
- package/dist/slash.js +126 -0
- package/dist/slash.js.map +1 -0
- package/dist/spinner.d.ts +27 -0
- package/dist/spinner.js +68 -0
- package/dist/spinner.js.map +1 -0
- package/dist/ssh/exec.d.ts +20 -0
- package/dist/ssh/exec.js +39 -0
- package/dist/ssh/exec.js.map +1 -0
- package/dist/ssh/file.d.ts +32 -0
- package/dist/ssh/file.js +60 -0
- package/dist/ssh/file.js.map +1 -0
- package/dist/syntax-highlight.d.ts +19 -0
- package/dist/syntax-highlight.js +181 -0
- package/dist/syntax-highlight.js.map +1 -0
- package/dist/tools/agent-tool.d.ts +53 -0
- package/dist/tools/agent-tool.js +62 -0
- package/dist/tools/agent-tool.js.map +1 -0
- package/dist/tools/archive-create.d.ts +35 -0
- package/dist/tools/archive-create.js +37 -0
- package/dist/tools/archive-create.js.map +1 -0
- package/dist/tools/archive-extract.d.ts +28 -0
- package/dist/tools/archive-extract.js +36 -0
- package/dist/tools/archive-extract.js.map +1 -0
- package/dist/tools/base64.d.ts +27 -0
- package/dist/tools/base64.js +19 -0
- package/dist/tools/base64.js.map +1 -0
- package/dist/tools/browser.d.ts +125 -0
- package/dist/tools/browser.js +241 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/config-tool.d.ts +31 -0
- package/dist/tools/config-tool.js +167 -0
- package/dist/tools/config-tool.js.map +1 -0
- package/dist/tools/cron.d.ts +110 -0
- package/dist/tools/cron.js +299 -0
- package/dist/tools/cron.js.map +1 -0
- package/dist/tools/date.d.ts +24 -0
- package/dist/tools/date.js +26 -0
- package/dist/tools/date.js.map +1 -0
- package/dist/tools/dir-create.d.ts +21 -0
- package/dist/tools/dir-create.js +19 -0
- package/dist/tools/dir-create.js.map +1 -0
- package/dist/tools/dir-list.d.ts +36 -0
- package/dist/tools/dir-list.js +47 -0
- package/dist/tools/dir-list.js.map +1 -0
- package/dist/tools/disk-usage.d.ts +30 -0
- package/dist/tools/disk-usage.js +22 -0
- package/dist/tools/disk-usage.js.map +1 -0
- package/dist/tools/download-file.d.ts +28 -0
- package/dist/tools/download-file.js +42 -0
- package/dist/tools/download-file.js.map +1 -0
- package/dist/tools/environment.d.ts +31 -0
- package/dist/tools/environment.js +33 -0
- package/dist/tools/environment.js.map +1 -0
- package/dist/tools/errors.d.ts +5 -0
- package/dist/tools/errors.js +9 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/file-copy.d.ts +34 -0
- package/dist/tools/file-copy.js +45 -0
- package/dist/tools/file-copy.js.map +1 -0
- package/dist/tools/file-delete.d.ts +34 -0
- package/dist/tools/file-delete.js +42 -0
- package/dist/tools/file-delete.js.map +1 -0
- package/dist/tools/file-find.d.ts +46 -0
- package/dist/tools/file-find.js +33 -0
- package/dist/tools/file-find.js.map +1 -0
- package/dist/tools/file-move.d.ts +33 -0
- package/dist/tools/file-move.js +32 -0
- package/dist/tools/file-move.js.map +1 -0
- package/dist/tools/files.d.ts +38 -0
- package/dist/tools/files.js +123 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/git-branch-delete.d.ts +27 -0
- package/dist/tools/git-branch-delete.js +25 -0
- package/dist/tools/git-branch-delete.js.map +1 -0
- package/dist/tools/git-reset.d.ts +30 -0
- package/dist/tools/git-reset.js +28 -0
- package/dist/tools/git-reset.js.map +1 -0
- package/dist/tools/git-stash.d.ts +28 -0
- package/dist/tools/git-stash.js +24 -0
- package/dist/tools/git-stash.js.map +1 -0
- package/dist/tools/git.d.ts +77 -0
- package/dist/tools/git.js +300 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/github.d.ts +68 -0
- package/dist/tools/github.js +77 -0
- package/dist/tools/github.js.map +1 -0
- package/dist/tools/head-tail.d.ts +34 -0
- package/dist/tools/head-tail.js +23 -0
- package/dist/tools/head-tail.js.map +1 -0
- package/dist/tools/http-request.d.ts +44 -0
- package/dist/tools/http-request.js +57 -0
- package/dist/tools/http-request.js.map +1 -0
- package/dist/tools/json-query.d.ts +27 -0
- package/dist/tools/json-query.js +90 -0
- package/dist/tools/json-query.js.map +1 -0
- package/dist/tools/kill-process.d.ts +32 -0
- package/dist/tools/kill-process.js +51 -0
- package/dist/tools/kill-process.js.map +1 -0
- package/dist/tools/lsp.d.ts +98 -0
- package/dist/tools/lsp.js +398 -0
- package/dist/tools/lsp.js.map +1 -0
- package/dist/tools/monitor.d.ts +29 -0
- package/dist/tools/monitor.js +78 -0
- package/dist/tools/monitor.js.map +1 -0
- package/dist/tools/network-check.d.ts +34 -0
- package/dist/tools/network-check.js +57 -0
- package/dist/tools/network-check.js.map +1 -0
- package/dist/tools/notebook.d.ts +63 -0
- package/dist/tools/notebook.js +158 -0
- package/dist/tools/notebook.js.map +1 -0
- package/dist/tools/plan-mode.d.ts +48 -0
- package/dist/tools/plan-mode.js +57 -0
- package/dist/tools/plan-mode.js.map +1 -0
- package/dist/tools/process-list.d.ts +35 -0
- package/dist/tools/process-list.js +42 -0
- package/dist/tools/process-list.js.map +1 -0
- package/dist/tools/registry.d.ts +132 -0
- package/dist/tools/registry.js +2262 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/search.d.ts +38 -0
- package/dist/tools/search.js +327 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/shell.d.ts +18 -0
- package/dist/tools/shell.js +249 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/tools/skill-tool.d.ts +22 -0
- package/dist/tools/skill-tool.js +66 -0
- package/dist/tools/skill-tool.js.map +1 -0
- package/dist/tools/sleep.d.ts +16 -0
- package/dist/tools/sleep.js +24 -0
- package/dist/tools/sleep.js.map +1 -0
- package/dist/tools/snip.d.ts +26 -0
- package/dist/tools/snip.js +95 -0
- package/dist/tools/snip.js.map +1 -0
- package/dist/tools/system-info.d.ts +17 -0
- package/dist/tools/system-info.js +33 -0
- package/dist/tools/system-info.js.map +1 -0
- package/dist/tools/tasks.d.ts +191 -0
- package/dist/tools/tasks.js +348 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/text-stats.d.ts +25 -0
- package/dist/tools/text-stats.js +25 -0
- package/dist/tools/text-stats.js.map +1 -0
- package/dist/tools/todo.d.ts +69 -0
- package/dist/tools/todo.js +197 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/tool-search.d.ts +29 -0
- package/dist/tools/tool-search.js +114 -0
- package/dist/tools/tool-search.js.map +1 -0
- package/dist/tools/tree-view.d.ts +34 -0
- package/dist/tools/tree-view.js +39 -0
- package/dist/tools/tree-view.js.map +1 -0
- package/dist/tools/user-message.d.ts +39 -0
- package/dist/tools/user-message.js +70 -0
- package/dist/tools/user-message.js.map +1 -0
- package/dist/tools/user-question.d.ts +88 -0
- package/dist/tools/user-question.js +236 -0
- package/dist/tools/user-question.js.map +1 -0
- package/dist/tools/web-browser.d.ts +53 -0
- package/dist/tools/web-browser.js +373 -0
- package/dist/tools/web-browser.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +22 -0
- package/dist/tools/web-fetch.js +146 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +51 -0
- package/dist/tools/web-search.js +198 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/which.d.ts +22 -0
- package/dist/tools/which.js +21 -0
- package/dist/tools/which.js.map +1 -0
- package/dist/tools/whoami.d.ts +17 -0
- package/dist/tools/whoami.js +24 -0
- package/dist/tools/whoami.js.map +1 -0
- package/dist/tools/workspace-diagnostics.d.ts +62 -0
- package/dist/tools/workspace-diagnostics.js +421 -0
- package/dist/tools/workspace-diagnostics.js.map +1 -0
- package/dist/tools/workspace.d.ts +14 -0
- package/dist/tools/workspace.js +65 -0
- package/dist/tools/workspace.js.map +1 -0
- package/dist/tools/worktree.d.ts +70 -0
- package/dist/tools/worktree.js +150 -0
- package/dist/tools/worktree.js.map +1 -0
- package/dist/tui/interactions.d.ts +25 -0
- package/dist/tui/interactions.js +232 -0
- package/dist/tui/interactions.js.map +1 -0
- package/dist/tui/multiline-input.d.ts +14 -0
- package/dist/tui/multiline-input.js +550 -0
- package/dist/tui/multiline-input.js.map +1 -0
- package/dist/tui/paste.d.ts +40 -0
- package/dist/tui/paste.js +113 -0
- package/dist/tui/paste.js.map +1 -0
- package/dist/tui/prompt-reader.d.ts +26 -0
- package/dist/tui/prompt-reader.js +553 -0
- package/dist/tui/prompt-reader.js.map +1 -0
- package/dist/tui/transcript.d.ts +34 -0
- package/dist/tui/transcript.js +275 -0
- package/dist/tui/transcript.js.map +1 -0
- package/dist/tui.d.ts +53 -0
- package/dist/tui.js +669 -0
- package/dist/tui.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/vim/lineEditor.d.ts +18 -0
- package/dist/vim/lineEditor.js +420 -0
- package/dist/vim/lineEditor.js.map +1 -0
- package/dist/web/panel-html.d.ts +1 -0
- package/dist/web/panel-html.js +532 -0
- package/dist/web/panel-html.js.map +1 -0
- package/dist/web/panel.d.ts +4 -0
- package/dist/web/panel.js +121 -0
- package/dist/web/panel.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, statSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { ToolError } from "./errors.js";
|
|
5
|
+
import { resolveWorkspacePath } from "./workspace.js";
|
|
6
|
+
export const ArchiveCreateInputSchema = { type: "object", properties: { source: { type: "string" }, output: { type: "string" }, format: { type: "string", enum: ["tar.gz", "zip"] } }, required: ["source", "output"], additionalProperties: false };
|
|
7
|
+
export function parseArchiveCreateInput(input) {
|
|
8
|
+
return {
|
|
9
|
+
source: typeof input.source === "string" ? input.source : "",
|
|
10
|
+
output: typeof input.output === "string" ? input.output : "",
|
|
11
|
+
format: input.format === "zip" ? "zip" : "tar.gz"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function executeArchiveCreate(input) {
|
|
15
|
+
const src = resolveWorkspacePath(input.cwd, input.source).absolutePath;
|
|
16
|
+
const dst = resolveWorkspacePath(input.cwd, input.output).absolutePath;
|
|
17
|
+
if (!existsSync(src))
|
|
18
|
+
throw new ToolError(`Source not found: ${input.source}`, "not-found");
|
|
19
|
+
if (input.format === "zip") {
|
|
20
|
+
const result = spawnSync("zip", ["-r", dst, ".", "-i", src], { cwd: input.cwd, encoding: "utf8" });
|
|
21
|
+
if (result.status !== 0)
|
|
22
|
+
throw new ToolError(`zip failed: ${result.stderr}`, "command-failed");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const parent = input.source.endsWith("/") ? input.source : path.dirname(input.source);
|
|
26
|
+
const base = path.basename(src);
|
|
27
|
+
const result = spawnSync("tar", ["-czf", dst, "-C", parent === "." ? input.cwd : path.resolve(input.cwd, parent), base], { encoding: "utf8" });
|
|
28
|
+
if (result.status !== 0)
|
|
29
|
+
throw new ToolError(`tar failed: ${result.stderr}`, "command-failed");
|
|
30
|
+
}
|
|
31
|
+
const stat = statSync(dst);
|
|
32
|
+
return { path: input.output, format: input.format, sizeBytes: stat.size, fileCount: -1 };
|
|
33
|
+
}
|
|
34
|
+
export function formatArchiveCreateResult(result) {
|
|
35
|
+
return `Created ${result.path} (${result.format}, ${result.sizeBytes} bytes)`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=archive-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-create.js","sourceRoot":"","sources":["../../src/tools/archive-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAoC,CAAC;AAEvR,MAAM,UAAU,uBAAuB,CAAC,KAA8B;IACpE,OAAO;QACL,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC5D,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC5D,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC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C,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/I,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,eAAe,MAAM,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACjG,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAA2B;IACnE,OAAO,WAAW,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,SAAS,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ArchiveExtractResult {
|
|
2
|
+
path: string;
|
|
3
|
+
outputDir: string;
|
|
4
|
+
succeeded: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const ArchiveExtractInputSchema: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
archive: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
output: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
required: string[];
|
|
17
|
+
additionalProperties: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function parseArchiveExtractInput(input: Record<string, unknown>): {
|
|
20
|
+
archive: string;
|
|
21
|
+
output?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function executeArchiveExtract(input: {
|
|
24
|
+
archive: string;
|
|
25
|
+
output?: string;
|
|
26
|
+
cwd: string;
|
|
27
|
+
}): ArchiveExtractResult;
|
|
28
|
+
export declare function formatArchiveExtractResult(result: ArchiveExtractResult): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolveWorkspacePath } from "./workspace.js";
|
|
5
|
+
import { ToolError } from "./errors.js";
|
|
6
|
+
export const ArchiveExtractInputSchema = { type: "object", properties: { archive: { type: "string" }, output: { type: "string" } }, required: ["archive"], additionalProperties: false };
|
|
7
|
+
export function parseArchiveExtractInput(input) {
|
|
8
|
+
return {
|
|
9
|
+
archive: typeof input.archive === "string" ? input.archive : "",
|
|
10
|
+
output: typeof input.output === "string" ? input.output : undefined
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function executeArchiveExtract(input) {
|
|
14
|
+
const arcPath = resolveWorkspacePath(input.cwd, input.archive).absolutePath;
|
|
15
|
+
if (!existsSync(arcPath))
|
|
16
|
+
throw new ToolError(`Archive not found: ${input.archive}`, "not-found");
|
|
17
|
+
const outDir = input.output ? resolveWorkspacePath(input.cwd, input.output).absolutePath : path.dirname(arcPath);
|
|
18
|
+
mkdirSync(outDir, { recursive: true });
|
|
19
|
+
const isZip = input.archive.endsWith(".zip");
|
|
20
|
+
const cmd = isZip ? "unzip" : "tar";
|
|
21
|
+
// For zip: use -d to extract to directory, -o to overwrite
|
|
22
|
+
// For tar: use -C to extract to directory
|
|
23
|
+
// Both commands will respect the output directory and prevent path traversal
|
|
24
|
+
// by default when using -d/-C flags
|
|
25
|
+
const args = isZip
|
|
26
|
+
? ["-o", arcPath, "-d", outDir]
|
|
27
|
+
: ["-xzf", arcPath, "-C", outDir];
|
|
28
|
+
const result = spawnSync(cmd, args, { encoding: "utf8", timeout: 30_000, maxBuffer: 10 * 1024 * 1024 });
|
|
29
|
+
if (result.status !== 0)
|
|
30
|
+
throw new ToolError(`${cmd} failed: ${result.stderr}`, "command-failed");
|
|
31
|
+
return { path: input.archive, outputDir: input.output ?? path.dirname(input.archive), succeeded: true };
|
|
32
|
+
}
|
|
33
|
+
export function formatArchiveExtractResult(result) {
|
|
34
|
+
return `Extracted ${result.path} → ${result.outputDir}`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=archive-extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-extract.js","sourceRoot":"","sources":["../../src/tools/archive-extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAoC,CAAC;AAE3N,MAAM,UAAU,wBAAwB,CAAC,KAA8B;IACrE,OAAO;QACL,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC/D,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACpE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAwD;IAC5F,MAAM,OAAO,GAAG,o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E,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC1G,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAA4B;IACrE,OAAO,aAAa,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Base64Result {
|
|
2
|
+
action: string;
|
|
3
|
+
output: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const Base64InputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
action: {
|
|
9
|
+
type: string;
|
|
10
|
+
enum: string[];
|
|
11
|
+
};
|
|
12
|
+
text: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
required: string[];
|
|
17
|
+
additionalProperties: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function parseBase64Input(input: Record<string, unknown>): {
|
|
20
|
+
action: "encode" | "decode";
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function executeBase64(input: {
|
|
24
|
+
action: "encode" | "decode";
|
|
25
|
+
text: string;
|
|
26
|
+
}): Base64Result;
|
|
27
|
+
export declare function formatBase64Result(result: Base64Result): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ToolError } from "./errors.js";
|
|
2
|
+
export const Base64InputSchema = { type: "object", properties: { action: { type: "string", enum: ["encode", "decode"] }, text: { type: "string" } }, required: ["action", "text"], additionalProperties: false };
|
|
3
|
+
export function parseBase64Input(input) {
|
|
4
|
+
const action = input.action === "decode" ? "decode" : "encode";
|
|
5
|
+
const text = typeof input.text === "string" ? input.text : "";
|
|
6
|
+
if (!text)
|
|
7
|
+
throw new ToolError("text is required", "bad-input");
|
|
8
|
+
return { action, text };
|
|
9
|
+
}
|
|
10
|
+
export function executeBase64(input) {
|
|
11
|
+
const output = input.action === "encode"
|
|
12
|
+
? Buffer.from(input.text, "utf8").toString("base64")
|
|
13
|
+
: Buffer.from(input.text, "base64").toString("utf8");
|
|
14
|
+
return { action: input.action, output };
|
|
15
|
+
}
|
|
16
|
+
export function formatBase64Result(result) {
|
|
17
|
+
return result.output;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=base64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/tools/base64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAoC,CAAC;AAEnP,MAAM,UAAU,gBAAgB,CAAC,KAA8B;IAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAiB,CAAC,CAAC,CAAC,QAAiB,CAAC;IACjF,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAChE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAoD;IAChF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,QAAQ;QACtC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACpD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export interface BrowserNavigateInput {
|
|
2
|
+
url: string;
|
|
3
|
+
}
|
|
4
|
+
export interface BrowserClickInput {
|
|
5
|
+
selector?: string;
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface BrowserTypeInput {
|
|
10
|
+
selector: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
export interface BrowserScrollInput {
|
|
14
|
+
direction: "up" | "down" | "left" | "right";
|
|
15
|
+
amount?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BrowserScreenshotInput {
|
|
18
|
+
fullPage?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface BrowserExtractTextInput {
|
|
21
|
+
selector?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BrowserWaitInput {
|
|
24
|
+
ms: number;
|
|
25
|
+
}
|
|
26
|
+
export interface BrowserEvaluateInput {
|
|
27
|
+
script: string;
|
|
28
|
+
}
|
|
29
|
+
export type BrowserAction = {
|
|
30
|
+
action: "navigate";
|
|
31
|
+
url: string;
|
|
32
|
+
} | {
|
|
33
|
+
action: "click";
|
|
34
|
+
selector?: string;
|
|
35
|
+
x?: number;
|
|
36
|
+
y?: number;
|
|
37
|
+
} | {
|
|
38
|
+
action: "type";
|
|
39
|
+
selector: string;
|
|
40
|
+
text: string;
|
|
41
|
+
} | {
|
|
42
|
+
action: "scroll";
|
|
43
|
+
direction: "up" | "down" | "left" | "right";
|
|
44
|
+
amount?: number;
|
|
45
|
+
} | {
|
|
46
|
+
action: "screenshot";
|
|
47
|
+
fullPage?: boolean;
|
|
48
|
+
} | {
|
|
49
|
+
action: "extract_text";
|
|
50
|
+
selector?: string;
|
|
51
|
+
} | {
|
|
52
|
+
action: "wait";
|
|
53
|
+
ms: number;
|
|
54
|
+
} | {
|
|
55
|
+
action: "evaluate";
|
|
56
|
+
script: string;
|
|
57
|
+
} | {
|
|
58
|
+
action: "close";
|
|
59
|
+
};
|
|
60
|
+
export declare const BrowserNavigateInputSchema: {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
url: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
required: string[];
|
|
69
|
+
additionalProperties: boolean;
|
|
70
|
+
};
|
|
71
|
+
export declare const BrowserActionInputSchema: {
|
|
72
|
+
type: string;
|
|
73
|
+
properties: {
|
|
74
|
+
action: {
|
|
75
|
+
type: string;
|
|
76
|
+
enum: string[];
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
url: {
|
|
80
|
+
type: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
selector: {
|
|
84
|
+
type: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
text: {
|
|
88
|
+
type: string;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
direction: {
|
|
92
|
+
type: string;
|
|
93
|
+
enum: string[];
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
amount: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
x: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
y: {
|
|
105
|
+
type: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
fullPage: {
|
|
109
|
+
type: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
ms: {
|
|
113
|
+
type: string;
|
|
114
|
+
description: string;
|
|
115
|
+
};
|
|
116
|
+
script: {
|
|
117
|
+
type: string;
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
required: string[];
|
|
122
|
+
additionalProperties: boolean;
|
|
123
|
+
};
|
|
124
|
+
export declare function executeBrowserAction(input: Record<string, unknown>): Promise<string>;
|
|
125
|
+
export declare function formatBrowserActionResult(result: string): string;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { chromium } from "playwright";
|
|
2
|
+
import { ToolError } from "./errors.js";
|
|
3
|
+
// --- Singleton browser ---
|
|
4
|
+
let browserInstance = null;
|
|
5
|
+
let pageInstance = null;
|
|
6
|
+
async function getBrowser() {
|
|
7
|
+
if (!browserInstance || !browserInstance.isConnected()) {
|
|
8
|
+
browserInstance = await chromium.launch({
|
|
9
|
+
headless: false, // headed mode — the user can see what magi is doing
|
|
10
|
+
args: [
|
|
11
|
+
"--start-maximized",
|
|
12
|
+
"--no-sandbox",
|
|
13
|
+
"--disable-blink-features=AutomationControlled", // hide automation flags
|
|
14
|
+
"--disable-automation", // suppress automation infobar
|
|
15
|
+
`--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
process.on("exit", () => { browserInstance?.close().catch(() => { }); });
|
|
19
|
+
}
|
|
20
|
+
return browserInstance;
|
|
21
|
+
}
|
|
22
|
+
async function getPage() {
|
|
23
|
+
const browser = await getBrowser();
|
|
24
|
+
if (!pageInstance || pageInstance.isClosed()) {
|
|
25
|
+
const context = await browser.newContext({
|
|
26
|
+
viewport: { width: 1280, height: 800 },
|
|
27
|
+
locale: "zh-CN",
|
|
28
|
+
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
|
29
|
+
});
|
|
30
|
+
pageInstance = await context.newPage();
|
|
31
|
+
// Stealth: inject anti-detection scripts BEFORE any page navigation.
|
|
32
|
+
// These run in the browser context, not Node.js — no TS types available.
|
|
33
|
+
await pageInstance.addInitScript(`(() => {
|
|
34
|
+
Object.defineProperty(navigator, "webdriver", { get: () => false });
|
|
35
|
+
Object.defineProperty(window, "chrome", {
|
|
36
|
+
get: () => ({
|
|
37
|
+
runtime: { connect: () => ({ onMessage: { addListener: () => {} } }) },
|
|
38
|
+
loadTimes: () => ({}),
|
|
39
|
+
csi: () => ({}),
|
|
40
|
+
app: { isInstalled: false }
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
const originalQuery = window.navigator.permissions?.query?.bind(window.navigator.permissions);
|
|
44
|
+
if (originalQuery) {
|
|
45
|
+
window.navigator.permissions.query = (params) => {
|
|
46
|
+
if (params.name === "notifications") {
|
|
47
|
+
return Promise.resolve({ state: "denied", onchange: null });
|
|
48
|
+
}
|
|
49
|
+
return originalQuery(params);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
Object.defineProperty(navigator, "plugins", { get: () => [1, 2, 3, 4, 5] });
|
|
53
|
+
Object.defineProperty(navigator, "hardwareConcurrency", { get: () => 8 });
|
|
54
|
+
})();`);
|
|
55
|
+
}
|
|
56
|
+
return pageInstance;
|
|
57
|
+
}
|
|
58
|
+
async function closeBrowser() {
|
|
59
|
+
if (pageInstance && !pageInstance.isClosed()) {
|
|
60
|
+
await pageInstance.close();
|
|
61
|
+
pageInstance = null;
|
|
62
|
+
}
|
|
63
|
+
if (browserInstance && browserInstance.isConnected()) {
|
|
64
|
+
await browserInstance.close();
|
|
65
|
+
browserInstance = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// --- Input schemas (for the model to call) ---
|
|
69
|
+
export const BrowserNavigateInputSchema = {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
url: { type: "string", description: "Full URL to navigate to (including protocol, e.g. https://www.zhihu.com)" }
|
|
73
|
+
},
|
|
74
|
+
required: ["url"],
|
|
75
|
+
additionalProperties: false
|
|
76
|
+
};
|
|
77
|
+
export const BrowserActionInputSchema = {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
action: {
|
|
81
|
+
type: "string",
|
|
82
|
+
enum: ["navigate", "click", "type", "scroll", "screenshot", "extract_text", "wait", "evaluate", "close"],
|
|
83
|
+
description: "Browser action to perform"
|
|
84
|
+
},
|
|
85
|
+
url: { type: "string", description: "URL for the navigate action" },
|
|
86
|
+
selector: { type: "string", description: "CSS selector (for click, type, extract_text)" },
|
|
87
|
+
text: { type: "string", description: "Text to type (for the type action)" },
|
|
88
|
+
direction: {
|
|
89
|
+
type: "string",
|
|
90
|
+
enum: ["up", "down", "left", "right"],
|
|
91
|
+
description: "Scroll direction (for scroll action)"
|
|
92
|
+
},
|
|
93
|
+
amount: { type: "number", description: "Pixels to scroll (for scroll action, default: window height)" },
|
|
94
|
+
x: { type: "number", description: "X coordinate to click (for click action without selector)" },
|
|
95
|
+
y: { type: "number", description: "Y coordinate to click (for click action without selector)" },
|
|
96
|
+
fullPage: { type: "boolean", description: "Capture full page (for screenshot action, default: false)" },
|
|
97
|
+
ms: { type: "number", description: "Milliseconds to wait (for wait action)" },
|
|
98
|
+
script: { type: "string", description: "JavaScript to execute (for evaluate action)" }
|
|
99
|
+
},
|
|
100
|
+
required: ["action"],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
};
|
|
103
|
+
// --- Main tool executor ---
|
|
104
|
+
export async function executeBrowserAction(input) {
|
|
105
|
+
const action = input.action;
|
|
106
|
+
if (!action)
|
|
107
|
+
throw new ToolError("Browser action is required", "bad-input");
|
|
108
|
+
switch (action) {
|
|
109
|
+
case "navigate": return navigate(typeof input.url === "string" ? input.url : "");
|
|
110
|
+
case "click": return click(input.selector, input.x, input.y);
|
|
111
|
+
case "type": return typeText(input.selector, input.text);
|
|
112
|
+
case "scroll": return scroll(input.direction, input.amount);
|
|
113
|
+
case "screenshot": return screenshot(input.fullPage);
|
|
114
|
+
case "extract_text": return extractText(input.selector);
|
|
115
|
+
case "wait": return waitMs(input.ms);
|
|
116
|
+
case "evaluate": return evaluate(input.script);
|
|
117
|
+
case "close": return closeAction();
|
|
118
|
+
default:
|
|
119
|
+
throw new ToolError(`Unknown browser action: ${action}`, "bad-input");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function navigate(url) {
|
|
123
|
+
if (!url)
|
|
124
|
+
throw new ToolError("URL is required for navigate action", "bad-input");
|
|
125
|
+
const page = await getPage();
|
|
126
|
+
try {
|
|
127
|
+
await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30_000 });
|
|
128
|
+
// Wait a bit for heavy pages (social media) to finish rendering
|
|
129
|
+
await page.waitForTimeout(2000);
|
|
130
|
+
const title = await page.title();
|
|
131
|
+
return `Navigated to ${url}\nPage title: ${title}\nURL: ${page.url()}`;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
135
|
+
throw new ToolError(`Navigation failed: ${msg}`, "command-failed");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function click(selector, x, y) {
|
|
139
|
+
const page = await getPage();
|
|
140
|
+
try {
|
|
141
|
+
if (selector) {
|
|
142
|
+
const el = await page.waitForSelector(selector, { timeout: 5_000 });
|
|
143
|
+
if (!el)
|
|
144
|
+
throw new ToolError(`Element not found: ${selector}`, "not-found");
|
|
145
|
+
await el.click();
|
|
146
|
+
await page.waitForTimeout(1000);
|
|
147
|
+
return `Clicked element: ${selector}`;
|
|
148
|
+
}
|
|
149
|
+
if (x !== undefined && y !== undefined) {
|
|
150
|
+
await page.mouse.click(x, y);
|
|
151
|
+
await page.waitForTimeout(1000);
|
|
152
|
+
return `Clicked at (${x}, ${y})`;
|
|
153
|
+
}
|
|
154
|
+
throw new ToolError("Provide either selector or (x, y) coordinates", "bad-input");
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if (error instanceof ToolError)
|
|
158
|
+
throw error;
|
|
159
|
+
throw new ToolError(`Click failed: ${error.message}`, "command-failed");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function typeText(selector, text) {
|
|
163
|
+
if (!selector)
|
|
164
|
+
throw new ToolError("Selector is required for type action", "bad-input");
|
|
165
|
+
const page = await getPage();
|
|
166
|
+
try {
|
|
167
|
+
const el = await page.waitForSelector(selector, { timeout: 5_000 });
|
|
168
|
+
if (!el)
|
|
169
|
+
throw new ToolError(`Element not found: ${selector}`, "not-found");
|
|
170
|
+
await el.fill("");
|
|
171
|
+
await el.type(text, { delay: 50 });
|
|
172
|
+
return `Typed "${text.slice(0, 100)}${text.length > 100 ? "..." : ""}" into ${selector}`;
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (error instanceof ToolError)
|
|
176
|
+
throw error;
|
|
177
|
+
throw new ToolError(`Type failed: ${error.message}`, "command-failed");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function scroll(direction, amount) {
|
|
181
|
+
const page = await getPage();
|
|
182
|
+
const delta = amount ?? 600;
|
|
183
|
+
const deltas = {
|
|
184
|
+
up: { x: 0, y: -delta },
|
|
185
|
+
down: { x: 0, y: delta },
|
|
186
|
+
left: { x: -delta, y: 0 },
|
|
187
|
+
right: { x: delta, y: 0 }
|
|
188
|
+
};
|
|
189
|
+
const d = deltas[direction] ?? deltas.down;
|
|
190
|
+
await page.mouse.wheel(d.x, d.y);
|
|
191
|
+
await page.waitForTimeout(500);
|
|
192
|
+
return `Scrolled ${direction}${amount ? ` ${amount}px` : ""}`;
|
|
193
|
+
}
|
|
194
|
+
async function screenshot(fullPage) {
|
|
195
|
+
const page = await getPage();
|
|
196
|
+
const screenshotBuffer = await page.screenshot({ type: "png", fullPage: fullPage ?? false });
|
|
197
|
+
const base64 = screenshotBuffer.toString("base64");
|
|
198
|
+
return `[screenshot: data:image/png;base64,${base64}]`;
|
|
199
|
+
}
|
|
200
|
+
async function extractText(selector) {
|
|
201
|
+
const page = await getPage();
|
|
202
|
+
try {
|
|
203
|
+
if (selector) {
|
|
204
|
+
const el = await page.$(selector);
|
|
205
|
+
if (!el)
|
|
206
|
+
throw new ToolError(`Element not found: ${selector}`, "not-found");
|
|
207
|
+
const text = await el.innerText();
|
|
208
|
+
return text.slice(0, 50_000);
|
|
209
|
+
}
|
|
210
|
+
const text = await page.innerText("body");
|
|
211
|
+
return text.slice(0, 50_000);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
if (error instanceof ToolError)
|
|
215
|
+
throw error;
|
|
216
|
+
throw new ToolError(`Extract text failed: ${error.message}`, "command-failed");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function waitMs(ms) {
|
|
220
|
+
const timeout = ms ?? 2000;
|
|
221
|
+
await new Promise((resolve) => setTimeout(resolve, timeout));
|
|
222
|
+
return `Waited ${timeout}ms`;
|
|
223
|
+
}
|
|
224
|
+
async function evaluate(script) {
|
|
225
|
+
const page = await getPage();
|
|
226
|
+
try {
|
|
227
|
+
const result = await page.evaluate(script);
|
|
228
|
+
return `Result: ${JSON.stringify(result, null, 2)}`;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
throw new ToolError(`Evaluate failed: ${error.message}`, "command-failed");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function closeAction() {
|
|
235
|
+
await closeBrowser();
|
|
236
|
+
return "Browser closed";
|
|
237
|
+
}
|
|
238
|
+
export function formatBrowserActionResult(result) {
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/tools/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAwBxC,4BAA4B;AAE5B,IAAI,eAAe,GAAmB,IAAI,CAAC;AAC3C,IAAI,YAAY,GAAgB,IAAI,CAAC;AAErC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,CAAC;QACvD,eAAe,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACtC,QAAQ,EAAE,KAAK,EAAU,oDAAoD;YAC7E,IAAI,EAAE;gBACJ,mBAAmB;gBACnB,cAAc;gBACd,+CAA+C,EAAG,wBAAwB;gBAC1E,sBAAsB,EAA6B,8BAA8B;gBACjF,oIAAoI;aACrI;SACF,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,eAAe,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,OAAO;IACpB,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IACnC,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;YACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;YACtC,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,uHAAuH;SACnI,CAAC,CAAC;QACH,YA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AED,KAAK,UAAU,WAAW;IACxB,MAAM,YAAY,EAAE,CAAC;IACrB,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HookDefinition } from "../config.js";
|
|
2
|
+
export type ConfigToolValue = string | number | boolean;
|
|
3
|
+
export interface ConfigToolRequest {
|
|
4
|
+
setting: string;
|
|
5
|
+
value?: ConfigToolValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const ConfigToolInputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
setting: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
value: {
|
|
14
|
+
anyOf: {
|
|
15
|
+
type: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
20
|
+
additionalProperties: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare function parseConfigToolInput(input: Record<string, unknown>): ConfigToolRequest;
|
|
23
|
+
export declare function executeConfigTool(input: {
|
|
24
|
+
request: ConfigToolRequest;
|
|
25
|
+
configFile: string;
|
|
26
|
+
env?: NodeJS.ProcessEnv;
|
|
27
|
+
hooks?: HookDefinition[];
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
cwd?: string;
|
|
30
|
+
}): Promise<string>;
|
|
31
|
+
export declare function safeConfigSettings(): string[];
|