micro-models-agent 0.2.63 → 0.2.64
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 +354 -354
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +119 -3
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/tool-executor.d.ts +2 -10
- package/dist/agent/tool-executor.d.ts.map +1 -1
- package/dist/agent/tool-executor.js +92 -1
- package/dist/agent/tool-executor.js.map +1 -1
- package/dist/async-map.d.ts +6 -0
- package/dist/async-map.d.ts.map +1 -0
- package/dist/async-map.js +16 -0
- package/dist/async-map.js.map +1 -0
- package/dist/blog-api/types/index.d.ts +2 -0
- package/dist/blog-api/types/index.d.ts.map +1 -0
- package/dist/blog-api/types/index.js +2 -0
- package/dist/blog-api/types/index.js.map +1 -0
- package/dist/cli/config.js +1 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +29 -2
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +16 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/examples.d.ts +22 -0
- package/dist/examples.d.ts.map +1 -0
- package/dist/examples.js +45 -0
- package/dist/examples.js.map +1 -0
- package/dist/fibonacci.d.ts +19 -0
- package/dist/fibonacci.d.ts.map +1 -0
- package/dist/fibonacci.js +61 -0
- package/dist/fibonacci.js.map +1 -0
- 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/repl.d.ts +5 -0
- package/dist/repl.d.ts.map +1 -0
- package/dist/repl.js +472 -0
- package/dist/repl.js.map +1 -0
- package/dist/skills/builtin/agent-test/SKILL.md +68 -68
- package/dist/skills/builtin/grill-me/SKILL.md +46 -46
- package/dist/sort.d.ts +8 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +36 -0
- package/dist/sort.js.map +1 -0
- package/dist/stack.d.ts +9 -0
- package/dist/stack.d.ts.map +1 -0
- package/dist/stack.js +22 -0
- package/dist/stack.js.map +1 -0
- package/dist/test-run.d.ts +2 -0
- package/dist/test-run.d.ts.map +1 -0
- package/dist/test-run.js +13 -0
- package/dist/test-run.js.map +1 -0
- package/dist/tools/subagent.d.ts +16 -1
- package/dist/tools/subagent.d.ts.map +1 -1
- package/dist/tools/subagent.js +84 -9
- package/dist/tools/subagent.js.map +1 -1
- package/dist/ui/components/diff-view.d.ts +8 -0
- package/dist/ui/components/diff-view.d.ts.map +1 -0
- package/dist/ui/components/diff-view.js +25 -0
- package/dist/ui/components/diff-view.js.map +1 -0
- package/dist/ui/double-press.d.ts +9 -0
- package/dist/ui/double-press.d.ts.map +1 -0
- package/dist/ui/double-press.js +18 -0
- package/dist/ui/double-press.js.map +1 -0
- package/dist/ui/opentui-renderer.d.ts +53 -0
- package/dist/ui/opentui-renderer.d.ts.map +1 -0
- package/dist/ui/opentui-renderer.js +463 -0
- package/dist/ui/opentui-renderer.js.map +1 -0
- package/dist/utils/memoize.d.ts +14 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/memoize.js +51 -0
- package/dist/utils/memoize.js.map +1 -0
- package/dist/utils/types.d.ts +6 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils.d.ts +22 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +81 -0
- package/dist/utils.js.map +1 -0
- package/package.json +2 -2
|
@@ -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/repl.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LLMProvider } from './llm/provider.js';
|
|
2
|
+
import { ToolRegistry } from './tools/registry.js';
|
|
3
|
+
import type { OutputRenderer } from './ui/renderer.js';
|
|
4
|
+
export declare function runRepl(provider: LLMProvider, registry: ToolRegistry, modelLabel: string, renderer: OutputRenderer): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=repl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA4SvD,wBAAsB,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA8KxI"}
|