micro-models-agent 0.3.0 → 0.4.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/README.md +436 -436
- package/dist/agent/loop.d.ts +5 -5
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +421 -246
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +3 -3
- package/dist/agent/system-prompt.d.ts.map +1 -1
- package/dist/agent/system-prompt.js +383 -278
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +53 -28
- package/dist/cli/config.js.map +1 -1
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +75 -54
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +3 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/plugins/builtin/lint-on-write/index.ts +96 -96
- package/dist/plugins/builtin/notify/index.js +6 -6
- package/dist/plugins/builtin/notify/index.ts +104 -104
- package/dist/setup-wizard.d.ts +1 -1
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +137 -105
- package/dist/setup-wizard.js.map +1 -1
- package/dist/skills/builtin/agent-test/SKILL.md +68 -68
- package/dist/skills/builtin/grill-me/SKILL.md +46 -46
- package/dist/skills/builtin/web-scraping/SKILL.md +422 -422
- package/dist/tools/native/project-map.d.ts +2 -2
- package/dist/tools/native/project-map.d.ts.map +1 -1
- package/dist/tools/native/project-map.js +85 -57
- package/dist/tools/native/project-map.js.map +1 -1
- package/dist/tools/native/scaffold.js +113 -113
- package/dist/tools/web-browse.js +7 -7
- package/dist/ui/ink/components/App.d.ts +0 -1
- package/dist/ui/ink/components/App.d.ts.map +1 -1
- package/dist/ui/ink/components/App.js +2 -8
- package/dist/ui/ink/components/App.js.map +1 -1
- package/dist/ui/ink/components/Conversation.d.ts +1 -2
- package/dist/ui/ink/components/Conversation.d.ts.map +1 -1
- package/dist/ui/ink/components/Conversation.js +8 -2
- package/dist/ui/ink/components/Conversation.js.map +1 -1
- package/dist/ui/ink/components/MessageBlock.d.ts +13 -1
- package/dist/ui/ink/components/MessageBlock.d.ts.map +1 -1
- package/dist/ui/ink/components/MessageBlock.js +15 -27
- package/dist/ui/ink/components/MessageBlock.js.map +1 -1
- package/dist/ui/ink/components/PromptInput.d.ts +11 -0
- package/dist/ui/ink/components/PromptInput.d.ts.map +1 -1
- package/dist/ui/ink/components/PromptInput.js +18 -141
- package/dist/ui/ink/components/PromptInput.js.map +1 -1
- package/dist/ui/ink/components/SelectInput.d.ts.map +1 -1
- package/dist/ui/ink/components/SelectInput.js +3 -2
- package/dist/ui/ink/components/SelectInput.js.map +1 -1
- package/dist/ui/ink/components/StatusBar.d.ts.map +1 -1
- package/dist/ui/ink/components/StatusBar.js +14 -6
- package/dist/ui/ink/components/StatusBar.js.map +1 -1
- package/dist/ui/ink/components/StreamBlock.d.ts.map +1 -1
- package/dist/ui/ink/components/StreamBlock.js +3 -3
- package/dist/ui/ink/components/StreamBlock.js.map +1 -1
- package/dist/ui/ink/components/Tags.d.ts +8 -11
- package/dist/ui/ink/components/Tags.d.ts.map +1 -1
- package/dist/ui/ink/components/Tags.js +4 -16
- package/dist/ui/ink/components/Tags.js.map +1 -1
- package/dist/ui/ink/components/ToolCallBlock.d.ts +12 -0
- package/dist/ui/ink/components/ToolCallBlock.d.ts.map +1 -1
- package/dist/ui/ink/components/ToolCallBlock.js +8 -24
- package/dist/ui/ink/components/ToolCallBlock.js.map +1 -1
- package/dist/ui/ink/renderer.d.ts +0 -1
- package/dist/ui/ink/renderer.d.ts.map +1 -1
- package/dist/ui/ink/renderer.js +1 -4
- package/dist/ui/ink/renderer.js.map +1 -1
- package/package.json +47 -47
- package/dist/async-map.d.ts +0 -6
- package/dist/async-map.d.ts.map +0 -1
- package/dist/async-map.js +0 -16
- package/dist/async-map.js.map +0 -1
- package/dist/blog-api/types/index.d.ts +0 -2
- package/dist/blog-api/types/index.d.ts.map +0 -1
- package/dist/blog-api/types/index.js +0 -2
- package/dist/blog-api/types/index.js.map +0 -1
- package/dist/examples.d.ts +0 -22
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -45
- package/dist/examples.js.map +0 -1
- package/dist/fibonacci.d.ts +0 -19
- package/dist/fibonacci.d.ts.map +0 -1
- package/dist/fibonacci.js +0 -61
- package/dist/fibonacci.js.map +0 -1
- package/dist/parfymerie-landing/src/App.d.ts +0 -4
- package/dist/parfymerie-landing/src/App.d.ts.map +0 -1
- package/dist/parfymerie-landing/src/App.js +0 -12
- package/dist/parfymerie-landing/src/App.js.map +0 -1
- package/dist/parfymerie-landing/src/main.d.ts +0 -2
- package/dist/parfymerie-landing/src/main.d.ts.map +0 -1
- package/dist/parfymerie-landing/src/main.js +0 -7
- package/dist/parfymerie-landing/src/main.js.map +0 -1
- package/dist/parfymerie-landing/vite.config.d.ts +0 -3
- package/dist/parfymerie-landing/vite.config.d.ts.map +0 -1
- package/dist/parfymerie-landing/vite.config.js +0 -7
- package/dist/parfymerie-landing/vite.config.js.map +0 -1
- package/dist/repl.d.ts +0 -5
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -472
- package/dist/repl.js.map +0 -1
- package/dist/sort.d.ts +0 -8
- package/dist/sort.d.ts.map +0 -1
- package/dist/sort.js +0 -36
- package/dist/sort.js.map +0 -1
- package/dist/stack.d.ts +0 -9
- package/dist/stack.d.ts.map +0 -1
- package/dist/stack.js +0 -22
- package/dist/stack.js.map +0 -1
- package/dist/test-run.d.ts +0 -2
- package/dist/test-run.d.ts.map +0 -1
- package/dist/test-run.js +0 -13
- package/dist/test-run.js.map +0 -1
- package/dist/ui/components/diff-view.d.ts +0 -8
- package/dist/ui/components/diff-view.d.ts.map +0 -1
- package/dist/ui/components/diff-view.js +0 -25
- package/dist/ui/components/diff-view.js.map +0 -1
- package/dist/ui/double-press.d.ts +0 -9
- package/dist/ui/double-press.d.ts.map +0 -1
- package/dist/ui/double-press.js +0 -18
- package/dist/ui/double-press.js.map +0 -1
- package/dist/ui/ink/components/ActivityLog.d.ts +0 -12
- package/dist/ui/ink/components/ActivityLog.d.ts.map +0 -1
- package/dist/ui/ink/components/ActivityLog.js +0 -11
- package/dist/ui/ink/components/ActivityLog.js.map +0 -1
- package/dist/ui/ink/components/AgentStatus.d.ts +0 -13
- package/dist/ui/ink/components/AgentStatus.d.ts.map +0 -1
- package/dist/ui/ink/components/AgentStatus.js +0 -20
- package/dist/ui/ink/components/AgentStatus.js.map +0 -1
- package/dist/ui/ink/components/BottomBar.d.ts +0 -12
- package/dist/ui/ink/components/BottomBar.d.ts.map +0 -1
- package/dist/ui/ink/components/BottomBar.js +0 -22
- package/dist/ui/ink/components/BottomBar.js.map +0 -1
- package/dist/ui/ink/components/CheckboxInput.d.ts +0 -21
- package/dist/ui/ink/components/CheckboxInput.d.ts.map +0 -1
- package/dist/ui/ink/components/CheckboxInput.js +0 -36
- package/dist/ui/ink/components/CheckboxInput.js.map +0 -1
- package/dist/ui/ink/components/InputBox.d.ts +0 -25
- package/dist/ui/ink/components/InputBox.d.ts.map +0 -1
- package/dist/ui/ink/components/InputBox.js +0 -91
- package/dist/ui/ink/components/InputBox.js.map +0 -1
- package/dist/ui/ink/components/ModeSelector.d.ts +0 -8
- package/dist/ui/ink/components/ModeSelector.d.ts.map +0 -1
- package/dist/ui/ink/components/ModeSelector.js +0 -13
- package/dist/ui/ink/components/ModeSelector.js.map +0 -1
- package/dist/ui/ink/components/QuestionBox.d.ts +0 -14
- package/dist/ui/ink/components/QuestionBox.d.ts.map +0 -1
- package/dist/ui/ink/components/QuestionBox.js +0 -35
- package/dist/ui/ink/components/QuestionBox.js.map +0 -1
- package/dist/ui/ink/components/RadioInput.d.ts +0 -17
- package/dist/ui/ink/components/RadioInput.d.ts.map +0 -1
- package/dist/ui/ink/components/RadioInput.js +0 -30
- package/dist/ui/ink/components/RadioInput.js.map +0 -1
- package/dist/ui/ink/components/SliderInput.d.ts +0 -20
- package/dist/ui/ink/components/SliderInput.d.ts.map +0 -1
- package/dist/ui/ink/components/SliderInput.js +0 -40
- package/dist/ui/ink/components/SliderInput.js.map +0 -1
- package/dist/ui/ink/components/StartupScreen.d.ts +0 -19
- package/dist/ui/ink/components/StartupScreen.d.ts.map +0 -1
- package/dist/ui/ink/components/StartupScreen.js +0 -9
- package/dist/ui/ink/components/StartupScreen.js.map +0 -1
- package/dist/ui/ink/components/WelcomeScreen.d.ts +0 -10
- package/dist/ui/ink/components/WelcomeScreen.d.ts.map +0 -1
- package/dist/ui/ink/components/WelcomeScreen.js +0 -8
- package/dist/ui/ink/components/WelcomeScreen.js.map +0 -1
- package/dist/ui/ink/components/Window.d.ts +0 -30
- package/dist/ui/ink/components/Window.d.ts.map +0 -1
- package/dist/ui/ink/components/Window.js +0 -9
- package/dist/ui/ink/components/Window.js.map +0 -1
- package/dist/ui/ink/components/ui/_core.d.ts +0 -113
- package/dist/ui/ink/components/ui/_core.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/_core.js +0 -83
- package/dist/ui/ink/components/ui/_core.js.map +0 -1
- package/dist/ui/ink/components/ui/autocomplete/Autocomplete.d.ts +0 -23
- package/dist/ui/ink/components/ui/autocomplete/Autocomplete.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/autocomplete/Autocomplete.js +0 -56
- package/dist/ui/ink/components/ui/autocomplete/Autocomplete.js.map +0 -1
- package/dist/ui/ink/components/ui/autocomplete/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/autocomplete/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/autocomplete/index.js +0 -2
- package/dist/ui/ink/components/ui/autocomplete/index.js.map +0 -1
- package/dist/ui/ink/components/ui/badge/Badge.d.ts +0 -13
- package/dist/ui/ink/components/ui/badge/Badge.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/badge/Badge.js +0 -17
- package/dist/ui/ink/components/ui/badge/Badge.js.map +0 -1
- package/dist/ui/ink/components/ui/badge/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/badge/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/badge/index.js +0 -2
- package/dist/ui/ink/components/ui/badge/index.js.map +0 -1
- package/dist/ui/ink/components/ui/divider/Divider.d.ts +0 -12
- package/dist/ui/ink/components/ui/divider/Divider.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/divider/Divider.js +0 -27
- package/dist/ui/ink/components/ui/divider/Divider.js.map +0 -1
- package/dist/ui/ink/components/ui/divider/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/divider/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/divider/index.js +0 -2
- package/dist/ui/ink/components/ui/divider/index.js.map +0 -1
- package/dist/ui/ink/components/ui/header/Header.d.ts +0 -13
- package/dist/ui/ink/components/ui/header/Header.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/header/Header.js +0 -33
- package/dist/ui/ink/components/ui/header/Header.js.map +0 -1
- package/dist/ui/ink/components/ui/header/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/header/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/header/index.js +0 -2
- package/dist/ui/ink/components/ui/header/index.js.map +0 -1
- package/dist/ui/ink/components/ui/json-viewer/JSONViewer.d.ts +0 -14
- package/dist/ui/ink/components/ui/json-viewer/JSONViewer.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/json-viewer/JSONViewer.js +0 -144
- package/dist/ui/ink/components/ui/json-viewer/JSONViewer.js.map +0 -1
- package/dist/ui/ink/components/ui/json-viewer/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/json-viewer/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/json-viewer/index.js +0 -2
- package/dist/ui/ink/components/ui/json-viewer/index.js.map +0 -1
- package/dist/ui/ink/components/ui/key-hint/KeyHint.d.ts +0 -14
- package/dist/ui/ink/components/ui/key-hint/KeyHint.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/key-hint/KeyHint.js +0 -5
- package/dist/ui/ink/components/ui/key-hint/KeyHint.js.map +0 -1
- package/dist/ui/ink/components/ui/key-hint/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/key-hint/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/key-hint/index.js +0 -2
- package/dist/ui/ink/components/ui/key-hint/index.js.map +0 -1
- package/dist/ui/ink/components/ui/markdown/Markdown.d.ts +0 -11
- package/dist/ui/ink/components/ui/markdown/Markdown.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/markdown/Markdown.js +0 -129
- package/dist/ui/ink/components/ui/markdown/Markdown.js.map +0 -1
- package/dist/ui/ink/components/ui/markdown/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/markdown/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/markdown/index.js +0 -2
- package/dist/ui/ink/components/ui/markdown/index.js.map +0 -1
- package/dist/ui/ink/components/ui/scroll-area/ScrollArea.d.ts +0 -21
- package/dist/ui/ink/components/ui/scroll-area/ScrollArea.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/scroll-area/ScrollArea.js +0 -42
- package/dist/ui/ink/components/ui/scroll-area/ScrollArea.js.map +0 -1
- package/dist/ui/ink/components/ui/scroll-area/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/scroll-area/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/scroll-area/index.js +0 -2
- package/dist/ui/ink/components/ui/scroll-area/index.js.map +0 -1
- package/dist/ui/ink/components/ui/select/Select.d.ts +0 -19
- package/dist/ui/ink/components/ui/select/Select.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/select/Select.js +0 -73
- package/dist/ui/ink/components/ui/select/Select.js.map +0 -1
- package/dist/ui/ink/components/ui/select/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/select/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/select/index.js +0 -2
- package/dist/ui/ink/components/ui/select/index.js.map +0 -1
- package/dist/ui/ink/components/ui/spinner/Spinner.d.ts +0 -14
- package/dist/ui/ink/components/ui/spinner/Spinner.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/spinner/Spinner.js +0 -16
- package/dist/ui/ink/components/ui/spinner/Spinner.js.map +0 -1
- package/dist/ui/ink/components/ui/spinner/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/spinner/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/spinner/index.js +0 -2
- package/dist/ui/ink/components/ui/spinner/index.js.map +0 -1
- package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.d.ts +0 -12
- package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.js +0 -39
- package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.js.map +0 -1
- package/dist/ui/ink/components/ui/status-indicator/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/status-indicator/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/status-indicator/index.js +0 -2
- package/dist/ui/ink/components/ui/status-indicator/index.js.map +0 -1
- package/dist/ui/ink/components/ui/streaming-text/StreamingText.d.ts +0 -13
- package/dist/ui/ink/components/ui/streaming-text/StreamingText.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/streaming-text/StreamingText.js +0 -22
- package/dist/ui/ink/components/ui/streaming-text/StreamingText.js.map +0 -1
- package/dist/ui/ink/components/ui/streaming-text/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/streaming-text/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/streaming-text/index.js +0 -2
- package/dist/ui/ink/components/ui/streaming-text/index.js.map +0 -1
- package/dist/ui/ink/components/ui/tabs/Tabs.d.ts +0 -20
- package/dist/ui/ink/components/ui/tabs/Tabs.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/tabs/Tabs.js +0 -53
- package/dist/ui/ink/components/ui/tabs/Tabs.js.map +0 -1
- package/dist/ui/ink/components/ui/tabs/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/tabs/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/tabs/index.js +0 -2
- package/dist/ui/ink/components/ui/tabs/index.js.map +0 -1
- package/dist/ui/ink/components/ui/text-input/TextInput.d.ts +0 -22
- package/dist/ui/ink/components/ui/text-input/TextInput.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/text-input/TextInput.js +0 -57
- package/dist/ui/ink/components/ui/text-input/TextInput.js.map +0 -1
- package/dist/ui/ink/components/ui/text-input/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/text-input/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/text-input/index.js +0 -2
- package/dist/ui/ink/components/ui/text-input/index.js.map +0 -1
- package/dist/ui/ink/components/ui/token-counter/TokenCounter.d.ts +0 -17
- package/dist/ui/ink/components/ui/token-counter/TokenCounter.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/token-counter/TokenCounter.js +0 -38
- package/dist/ui/ink/components/ui/token-counter/TokenCounter.js.map +0 -1
- package/dist/ui/ink/components/ui/token-counter/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/token-counter/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/token-counter/index.js +0 -2
- package/dist/ui/ink/components/ui/token-counter/index.js.map +0 -1
- package/dist/ui/ink/components/ui/typewriter/Typewriter.d.ts +0 -14
- package/dist/ui/ink/components/ui/typewriter/Typewriter.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/typewriter/Typewriter.js +0 -57
- package/dist/ui/ink/components/ui/typewriter/Typewriter.js.map +0 -1
- package/dist/ui/ink/components/ui/typewriter/index.d.ts +0 -3
- package/dist/ui/ink/components/ui/typewriter/index.d.ts.map +0 -1
- package/dist/ui/ink/components/ui/typewriter/index.js +0 -2
- package/dist/ui/ink/components/ui/typewriter/index.js.map +0 -1
- package/dist/ui/opentui-renderer.d.ts +0 -53
- package/dist/ui/opentui-renderer.d.ts.map +0 -1
- package/dist/ui/opentui-renderer.js +0 -463
- package/dist/ui/opentui-renderer.js.map +0 -1
- package/dist/utils/memoize.d.ts +0 -14
- package/dist/utils/memoize.d.ts.map +0 -1
- package/dist/utils/memoize.js +0 -51
- package/dist/utils/memoize.js.map +0 -1
- package/dist/utils/types.d.ts +0 -6
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.js.map +0 -1
- package/dist/utils.d.ts +0 -22
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -81
- package/dist/utils.js.map +0 -1
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import type { AgentPlugin, PluginContext } from '../../types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Плагин lint-on-write.
|
|
8
|
-
*
|
|
9
|
-
* После каждого write_file/edit_file запускает линтер
|
|
10
|
-
* и добавляет ошибки в tool result (модель видит их сразу).
|
|
11
|
-
*
|
|
12
|
-
* Линтер определяется автоматически (eslint → biome → prettier).
|
|
13
|
-
*
|
|
14
|
-
* @module plugins/builtin/lint-on-write
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const LINTER_DETECT_COMMANDS = [
|
|
18
|
-
{ name: 'eslint', cmd: 'npx eslint --version' },
|
|
19
|
-
{ name: 'biome', cmd: 'npx @biomejs/biome --version' },
|
|
20
|
-
{ name: 'prettier', cmd: 'npx prettier --version' },
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
function detectLinter(cwd: string, cacheFile: string): string | null {
|
|
24
|
-
const cachePath = join(cwd, cacheFile);
|
|
25
|
-
if (existsSync(cachePath)) {
|
|
26
|
-
try {
|
|
27
|
-
const cached = readFileSync(cachePath, 'utf-8').trim();
|
|
28
|
-
if (cached) return cached;
|
|
29
|
-
} catch { /* ignore */ }
|
|
30
|
-
}
|
|
31
|
-
for (const { name, cmd } of LINTER_DETECT_COMMANDS) {
|
|
32
|
-
try {
|
|
33
|
-
execSync(cmd, { cwd, timeout: 5000, windowsHide: true, stdio: 'pipe' });
|
|
34
|
-
try { writeFileSync(cachePath, name, 'utf-8'); } catch { /* ignore */ }
|
|
35
|
-
return name;
|
|
36
|
-
} catch { /* not found */ }
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function runLinter(linter: string, filePath: string, cwd: string): string | null {
|
|
42
|
-
try {
|
|
43
|
-
let cmd: string;
|
|
44
|
-
switch (linter) {
|
|
45
|
-
case 'eslint': cmd = `npx eslint "${filePath}" --format compact`; break;
|
|
46
|
-
case 'biome': cmd = `npx @biomejs/biome check "${filePath}"`; break;
|
|
47
|
-
case 'prettier': cmd = `npx prettier --check "${filePath}"`; break;
|
|
48
|
-
default: return null;
|
|
49
|
-
}
|
|
50
|
-
execSync(cmd, { cwd, timeout: 15000, windowsHide: true, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
51
|
-
return null;
|
|
52
|
-
} catch (e: any) {
|
|
53
|
-
const output = e.stdout?.toString() || e.stderr?.toString() || '';
|
|
54
|
-
return output ? output.slice(0, 1000) : null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Module-level linter cache
|
|
59
|
-
let cachedLinter: string | null = null;
|
|
60
|
-
|
|
61
|
-
export default function createLintOnWrite(): AgentPlugin {
|
|
62
|
-
return {
|
|
63
|
-
name: 'lint-on-write',
|
|
64
|
-
version: '1.0.0',
|
|
65
|
-
description: 'Auto-run linter after write_file/edit_file',
|
|
66
|
-
onActivate(ctx: PluginContext) {
|
|
67
|
-
ctx.logger.info('lint-on-write: active (linter detected on first file write)');
|
|
68
|
-
},
|
|
69
|
-
on(_event: string, _handler: any) { /* via PluginManager.on() */ },
|
|
70
|
-
onDeactivate() { cachedLinter = null; },
|
|
71
|
-
getPromptSection() {
|
|
72
|
-
return '## Lint-on-Write Plugin\nAfter writing/editing .ts/.tsx/.js/.jsx files, lint errors (if any) are automatically appended to the tool result.';
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Обработчик tool:after — вызывается через PluginManager.on().
|
|
79
|
-
* Экспортируется для регистрации в loop.ts.
|
|
80
|
-
*/
|
|
81
|
-
export function handleToolAfter(
|
|
82
|
-
toolName: string,
|
|
83
|
-
args: Record<string, unknown>,
|
|
84
|
-
_result: { stdout: string; stderr: string; exitCode: number },
|
|
85
|
-
cwd: string,
|
|
86
|
-
cacheFile: string,
|
|
87
|
-
): string | null {
|
|
88
|
-
if (toolName !== 'write_file' && toolName !== 'edit_file') return null;
|
|
89
|
-
const filePath = String(args.path ?? '');
|
|
90
|
-
if (!filePath || !/\.(ts|tsx|js|jsx|mjs|cjs)$/.test(filePath)) return null;
|
|
91
|
-
|
|
92
|
-
const linter = cachedLinter ?? detectLinter(cwd, cacheFile);
|
|
93
|
-
if (!linter) return null;
|
|
94
|
-
cachedLinter = linter;
|
|
95
|
-
|
|
96
|
-
return runLinter(linter, filePath, cwd);
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import type { AgentPlugin, PluginContext } from '../../types.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Плагин lint-on-write.
|
|
8
|
+
*
|
|
9
|
+
* После каждого write_file/edit_file запускает линтер
|
|
10
|
+
* и добавляет ошибки в tool result (модель видит их сразу).
|
|
11
|
+
*
|
|
12
|
+
* Линтер определяется автоматически (eslint → biome → prettier).
|
|
13
|
+
*
|
|
14
|
+
* @module plugins/builtin/lint-on-write
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const LINTER_DETECT_COMMANDS = [
|
|
18
|
+
{ name: 'eslint', cmd: 'npx eslint --version' },
|
|
19
|
+
{ name: 'biome', cmd: 'npx @biomejs/biome --version' },
|
|
20
|
+
{ name: 'prettier', cmd: 'npx prettier --version' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
function detectLinter(cwd: string, cacheFile: string): string | null {
|
|
24
|
+
const cachePath = join(cwd, cacheFile);
|
|
25
|
+
if (existsSync(cachePath)) {
|
|
26
|
+
try {
|
|
27
|
+
const cached = readFileSync(cachePath, 'utf-8').trim();
|
|
28
|
+
if (cached) return cached;
|
|
29
|
+
} catch { /* ignore */ }
|
|
30
|
+
}
|
|
31
|
+
for (const { name, cmd } of LINTER_DETECT_COMMANDS) {
|
|
32
|
+
try {
|
|
33
|
+
execSync(cmd, { cwd, timeout: 5000, windowsHide: true, stdio: 'pipe' });
|
|
34
|
+
try { writeFileSync(cachePath, name, 'utf-8'); } catch { /* ignore */ }
|
|
35
|
+
return name;
|
|
36
|
+
} catch { /* not found */ }
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function runLinter(linter: string, filePath: string, cwd: string): string | null {
|
|
42
|
+
try {
|
|
43
|
+
let cmd: string;
|
|
44
|
+
switch (linter) {
|
|
45
|
+
case 'eslint': cmd = `npx eslint "${filePath}" --format compact`; break;
|
|
46
|
+
case 'biome': cmd = `npx @biomejs/biome check "${filePath}"`; break;
|
|
47
|
+
case 'prettier': cmd = `npx prettier --check "${filePath}"`; break;
|
|
48
|
+
default: return null;
|
|
49
|
+
}
|
|
50
|
+
execSync(cmd, { cwd, timeout: 15000, windowsHide: true, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
51
|
+
return null;
|
|
52
|
+
} catch (e: any) {
|
|
53
|
+
const output = e.stdout?.toString() || e.stderr?.toString() || '';
|
|
54
|
+
return output ? output.slice(0, 1000) : null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Module-level linter cache
|
|
59
|
+
let cachedLinter: string | null = null;
|
|
60
|
+
|
|
61
|
+
export default function createLintOnWrite(): AgentPlugin {
|
|
62
|
+
return {
|
|
63
|
+
name: 'lint-on-write',
|
|
64
|
+
version: '1.0.0',
|
|
65
|
+
description: 'Auto-run linter after write_file/edit_file',
|
|
66
|
+
onActivate(ctx: PluginContext) {
|
|
67
|
+
ctx.logger.info('lint-on-write: active (linter detected on first file write)');
|
|
68
|
+
},
|
|
69
|
+
on(_event: string, _handler: any) { /* via PluginManager.on() */ },
|
|
70
|
+
onDeactivate() { cachedLinter = null; },
|
|
71
|
+
getPromptSection() {
|
|
72
|
+
return '## Lint-on-Write Plugin\nAfter writing/editing .ts/.tsx/.js/.jsx files, lint errors (if any) are automatically appended to the tool result.';
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Обработчик tool:after — вызывается через PluginManager.on().
|
|
79
|
+
* Экспортируется для регистрации в loop.ts.
|
|
80
|
+
*/
|
|
81
|
+
export function handleToolAfter(
|
|
82
|
+
toolName: string,
|
|
83
|
+
args: Record<string, unknown>,
|
|
84
|
+
_result: { stdout: string; stderr: string; exitCode: number },
|
|
85
|
+
cwd: string,
|
|
86
|
+
cacheFile: string,
|
|
87
|
+
): string | null {
|
|
88
|
+
if (toolName !== 'write_file' && toolName !== 'edit_file') return null;
|
|
89
|
+
const filePath = String(args.path ?? '');
|
|
90
|
+
if (!filePath || !/\.(ts|tsx|js|jsx|mjs|cjs)$/.test(filePath)) return null;
|
|
91
|
+
|
|
92
|
+
const linter = cachedLinter ?? detectLinter(cwd, cacheFile);
|
|
93
|
+
if (!linter) return null;
|
|
94
|
+
cachedLinter = linter;
|
|
95
|
+
|
|
96
|
+
return runLinter(linter, filePath, cwd);
|
|
97
97
|
}
|
|
@@ -22,12 +22,12 @@ function sendNotification(title, body) {
|
|
|
22
22
|
// Write temp .ps1 file to avoid $ escaping issues in shell
|
|
23
23
|
const safeTitle = title.replace(/'/g, "''");
|
|
24
24
|
const safeBody = body.replace(/'/g, "''");
|
|
25
|
-
const psScript = `Add-Type -AssemblyName System.Windows.Forms
|
|
26
|
-
$n = New-Object System.Windows.Forms.NotifyIcon
|
|
27
|
-
$n.Icon = [System.Drawing.SystemIcons]::Information
|
|
28
|
-
$n.Visible = $true
|
|
29
|
-
$n.ShowBalloonTip(5000, '${safeTitle}', '${safeBody}', [System.Windows.Forms.ToolTipIcon]::Info)
|
|
30
|
-
Start-Sleep -Seconds 2
|
|
25
|
+
const psScript = `Add-Type -AssemblyName System.Windows.Forms
|
|
26
|
+
$n = New-Object System.Windows.Forms.NotifyIcon
|
|
27
|
+
$n.Icon = [System.Drawing.SystemIcons]::Information
|
|
28
|
+
$n.Visible = $true
|
|
29
|
+
$n.ShowBalloonTip(5000, '${safeTitle}', '${safeBody}', [System.Windows.Forms.ToolTipIcon]::Info)
|
|
30
|
+
Start-Sleep -Seconds 2
|
|
31
31
|
$n.Dispose()`;
|
|
32
32
|
const tmpFile = join(tmpdir(), `mma-notify-${Date.now()}.ps1`);
|
|
33
33
|
writeFileSync(tmpFile, psScript, 'utf-8');
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { writeFileSync, unlinkSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { platform } from 'node:os';
|
|
6
|
-
import type { AgentPlugin, PluginContext } from '../../types.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Плагин notify — OS desktop-уведомления.
|
|
10
|
-
*
|
|
11
|
-
* Отправляет toast-уведомление при:
|
|
12
|
-
* - agent:done — задача выполнена
|
|
13
|
-
* - tool:blocked — агент заблокирован
|
|
14
|
-
* - tool:after (question) — агент ждёт ответа
|
|
15
|
-
*
|
|
16
|
-
* Zero-dependency: shell-out по платформе.
|
|
17
|
-
*
|
|
18
|
-
* @module plugins/builtin/notify
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function sendNotification(title: string, body: string): void {
|
|
22
|
-
const p = platform();
|
|
23
|
-
try {
|
|
24
|
-
if (p === 'win32') {
|
|
25
|
-
// Write temp .ps1 file to avoid $ escaping issues in shell
|
|
26
|
-
const safeTitle = title.replace(/'/g, "''");
|
|
27
|
-
const safeBody = body.replace(/'/g, "''");
|
|
28
|
-
const psScript = `Add-Type -AssemblyName System.Windows.Forms
|
|
29
|
-
$n = New-Object System.Windows.Forms.NotifyIcon
|
|
30
|
-
$n.Icon = [System.Drawing.SystemIcons]::Information
|
|
31
|
-
$n.Visible = $true
|
|
32
|
-
$n.ShowBalloonTip(5000, '${safeTitle}', '${safeBody}', [System.Windows.Forms.ToolTipIcon]::Info)
|
|
33
|
-
Start-Sleep -Seconds 2
|
|
34
|
-
$n.Dispose()`;
|
|
35
|
-
const tmpFile = join(tmpdir(), `mma-notify-${Date.now()}.ps1`);
|
|
36
|
-
writeFileSync(tmpFile, psScript, 'utf-8');
|
|
37
|
-
try {
|
|
38
|
-
execSync(`powershell -ExecutionPolicy Bypass -File "${tmpFile}"`, {
|
|
39
|
-
timeout: 8000,
|
|
40
|
-
windowsHide: true,
|
|
41
|
-
stdio: 'pipe',
|
|
42
|
-
});
|
|
43
|
-
} finally {
|
|
44
|
-
try { unlinkSync(tmpFile); } catch { /* ignore */ }
|
|
45
|
-
}
|
|
46
|
-
} else if (p === 'darwin') {
|
|
47
|
-
execSync(`osascript -e 'display notification "${body.replace(/"/g, '\\"')}" with title "${title.replace(/"/g, '\\"')}"'`, {
|
|
48
|
-
timeout: 5000,
|
|
49
|
-
stdio: 'pipe',
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
// Linux
|
|
53
|
-
execSync(`notify-send "${title.replace(/"/g, '\\"')}" "${body.replace(/"/g, '\\"')}"`, {
|
|
54
|
-
timeout: 5000,
|
|
55
|
-
stdio: 'pipe',
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
} catch {
|
|
59
|
-
// Best-effort
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default function createNotify(): AgentPlugin {
|
|
64
|
-
let ctx: PluginContext | null = null;
|
|
65
|
-
let config = { onDone: true, onBlocked: true, onQuestion: true };
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
name: 'notify',
|
|
69
|
-
version: '1.0.0',
|
|
70
|
-
description: 'OS desktop notifications for agent events',
|
|
71
|
-
|
|
72
|
-
onActivate(pluginCtx: PluginContext) {
|
|
73
|
-
ctx = pluginCtx;
|
|
74
|
-
if (pluginCtx.config) {
|
|
75
|
-
config = { ...config, ...pluginCtx.config as Record<string, unknown> } as typeof config;
|
|
76
|
-
}
|
|
77
|
-
pluginCtx.logger.info(`notify: active (done=${config.onDone}, blocked=${config.onBlocked}, question=${config.onQuestion})`);
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
onDeactivate() {
|
|
81
|
-
ctx = null;
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
getPromptSection() {
|
|
85
|
-
return '## Notify Plugin\nDesktop notifications are enabled. You don\'t need to notify the user about completion — it happens automatically.';
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Обработчики событий — вызываются извне через PluginManager.on().
|
|
92
|
-
*/
|
|
93
|
-
export function handleAgentDone(): void {
|
|
94
|
-
sendNotification('MMA', 'Agent finished the task');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function handleToolBlocked(toolName: string, _args: unknown): void {
|
|
98
|
-
sendNotification('MMA', `Tool blocked: ${toolName}`);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function handleToolAfter(toolName: string, _args: unknown, result: { exitCode: number }): void {
|
|
102
|
-
if (toolName === 'question') {
|
|
103
|
-
sendNotification('MMA', 'Agent needs your answer');
|
|
104
|
-
}
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { writeFileSync, unlinkSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { platform } from 'node:os';
|
|
6
|
+
import type { AgentPlugin, PluginContext } from '../../types.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Плагин notify — OS desktop-уведомления.
|
|
10
|
+
*
|
|
11
|
+
* Отправляет toast-уведомление при:
|
|
12
|
+
* - agent:done — задача выполнена
|
|
13
|
+
* - tool:blocked — агент заблокирован
|
|
14
|
+
* - tool:after (question) — агент ждёт ответа
|
|
15
|
+
*
|
|
16
|
+
* Zero-dependency: shell-out по платформе.
|
|
17
|
+
*
|
|
18
|
+
* @module plugins/builtin/notify
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function sendNotification(title: string, body: string): void {
|
|
22
|
+
const p = platform();
|
|
23
|
+
try {
|
|
24
|
+
if (p === 'win32') {
|
|
25
|
+
// Write temp .ps1 file to avoid $ escaping issues in shell
|
|
26
|
+
const safeTitle = title.replace(/'/g, "''");
|
|
27
|
+
const safeBody = body.replace(/'/g, "''");
|
|
28
|
+
const psScript = `Add-Type -AssemblyName System.Windows.Forms
|
|
29
|
+
$n = New-Object System.Windows.Forms.NotifyIcon
|
|
30
|
+
$n.Icon = [System.Drawing.SystemIcons]::Information
|
|
31
|
+
$n.Visible = $true
|
|
32
|
+
$n.ShowBalloonTip(5000, '${safeTitle}', '${safeBody}', [System.Windows.Forms.ToolTipIcon]::Info)
|
|
33
|
+
Start-Sleep -Seconds 2
|
|
34
|
+
$n.Dispose()`;
|
|
35
|
+
const tmpFile = join(tmpdir(), `mma-notify-${Date.now()}.ps1`);
|
|
36
|
+
writeFileSync(tmpFile, psScript, 'utf-8');
|
|
37
|
+
try {
|
|
38
|
+
execSync(`powershell -ExecutionPolicy Bypass -File "${tmpFile}"`, {
|
|
39
|
+
timeout: 8000,
|
|
40
|
+
windowsHide: true,
|
|
41
|
+
stdio: 'pipe',
|
|
42
|
+
});
|
|
43
|
+
} finally {
|
|
44
|
+
try { unlinkSync(tmpFile); } catch { /* ignore */ }
|
|
45
|
+
}
|
|
46
|
+
} else if (p === 'darwin') {
|
|
47
|
+
execSync(`osascript -e 'display notification "${body.replace(/"/g, '\\"')}" with title "${title.replace(/"/g, '\\"')}"'`, {
|
|
48
|
+
timeout: 5000,
|
|
49
|
+
stdio: 'pipe',
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
// Linux
|
|
53
|
+
execSync(`notify-send "${title.replace(/"/g, '\\"')}" "${body.replace(/"/g, '\\"')}"`, {
|
|
54
|
+
timeout: 5000,
|
|
55
|
+
stdio: 'pipe',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
} catch {
|
|
59
|
+
// Best-effort
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default function createNotify(): AgentPlugin {
|
|
64
|
+
let ctx: PluginContext | null = null;
|
|
65
|
+
let config = { onDone: true, onBlocked: true, onQuestion: true };
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
name: 'notify',
|
|
69
|
+
version: '1.0.0',
|
|
70
|
+
description: 'OS desktop notifications for agent events',
|
|
71
|
+
|
|
72
|
+
onActivate(pluginCtx: PluginContext) {
|
|
73
|
+
ctx = pluginCtx;
|
|
74
|
+
if (pluginCtx.config) {
|
|
75
|
+
config = { ...config, ...pluginCtx.config as Record<string, unknown> } as typeof config;
|
|
76
|
+
}
|
|
77
|
+
pluginCtx.logger.info(`notify: active (done=${config.onDone}, blocked=${config.onBlocked}, question=${config.onQuestion})`);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
onDeactivate() {
|
|
81
|
+
ctx = null;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getPromptSection() {
|
|
85
|
+
return '## Notify Plugin\nDesktop notifications are enabled. You don\'t need to notify the user about completion — it happens automatically.';
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Обработчики событий — вызываются извне через PluginManager.on().
|
|
92
|
+
*/
|
|
93
|
+
export function handleAgentDone(): void {
|
|
94
|
+
sendNotification('MMA', 'Agent finished the task');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function handleToolBlocked(toolName: string, _args: unknown): void {
|
|
98
|
+
sendNotification('MMA', `Tool blocked: ${toolName}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function handleToolAfter(toolName: string, _args: unknown, result: { exitCode: number }): void {
|
|
102
|
+
if (toolName === 'question') {
|
|
103
|
+
sendNotification('MMA', 'Agent needs your answer');
|
|
104
|
+
}
|
|
105
105
|
}
|
package/dist/setup-wizard.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-wizard.d.ts","sourceRoot":"","sources":["../src/setup-wizard.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup-wizard.d.ts","sourceRoot":"","sources":["../src/setup-wizard.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAqbnD,wBAAsB,cAAc,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAgFtE"}
|