micro-models-agent 0.2.62 → 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.
Files changed (100) hide show
  1. package/README.md +354 -354
  2. package/dist/agent/loop.d.ts.map +1 -1
  3. package/dist/agent/loop.js +125 -3
  4. package/dist/agent/loop.js.map +1 -1
  5. package/dist/agent/tool-executor.d.ts +2 -10
  6. package/dist/agent/tool-executor.d.ts.map +1 -1
  7. package/dist/agent/tool-executor.js +92 -1
  8. package/dist/agent/tool-executor.js.map +1 -1
  9. package/dist/async-map.d.ts +6 -0
  10. package/dist/async-map.d.ts.map +1 -0
  11. package/dist/async-map.js +16 -0
  12. package/dist/async-map.js.map +1 -0
  13. package/dist/blog-api/types/index.d.ts +2 -0
  14. package/dist/blog-api/types/index.d.ts.map +1 -0
  15. package/dist/blog-api/types/index.js +2 -0
  16. package/dist/blog-api/types/index.js.map +1 -0
  17. package/dist/cli/config.js +1 -1
  18. package/dist/cli/config.js.map +1 -1
  19. package/dist/config/config.d.ts +10 -0
  20. package/dist/config/config.d.ts.map +1 -1
  21. package/dist/config/config.js +29 -2
  22. package/dist/config/config.js.map +1 -1
  23. package/dist/config/types.d.ts +16 -1
  24. package/dist/config/types.d.ts.map +1 -1
  25. package/dist/examples.d.ts +22 -0
  26. package/dist/examples.d.ts.map +1 -0
  27. package/dist/examples.js +45 -0
  28. package/dist/examples.js.map +1 -0
  29. package/dist/fibonacci.d.ts +19 -0
  30. package/dist/fibonacci.d.ts.map +1 -0
  31. package/dist/fibonacci.js +61 -0
  32. package/dist/fibonacci.js.map +1 -0
  33. package/dist/plugins/builtin/lint-on-write/index.ts +96 -96
  34. package/dist/plugins/builtin/notify/index.js +6 -6
  35. package/dist/plugins/builtin/notify/index.ts +104 -104
  36. package/dist/repl.d.ts +5 -0
  37. package/dist/repl.d.ts.map +1 -0
  38. package/dist/repl.js +472 -0
  39. package/dist/repl.js.map +1 -0
  40. package/dist/skills/builtin/agent-test/SKILL.md +68 -68
  41. package/dist/skills/builtin/grill-me/SKILL.md +46 -46
  42. package/dist/sort.d.ts +8 -0
  43. package/dist/sort.d.ts.map +1 -0
  44. package/dist/sort.js +36 -0
  45. package/dist/sort.js.map +1 -0
  46. package/dist/stack.d.ts +9 -0
  47. package/dist/stack.d.ts.map +1 -0
  48. package/dist/stack.js +22 -0
  49. package/dist/stack.js.map +1 -0
  50. package/dist/test-run.d.ts +2 -0
  51. package/dist/test-run.d.ts.map +1 -0
  52. package/dist/test-run.js +13 -0
  53. package/dist/test-run.js.map +1 -0
  54. package/dist/tools/subagent.d.ts +16 -1
  55. package/dist/tools/subagent.d.ts.map +1 -1
  56. package/dist/tools/subagent.js +84 -9
  57. package/dist/tools/subagent.js.map +1 -1
  58. package/dist/ui/components/diff-view.d.ts +8 -0
  59. package/dist/ui/components/diff-view.d.ts.map +1 -0
  60. package/dist/ui/components/diff-view.js +25 -0
  61. package/dist/ui/components/diff-view.js.map +1 -0
  62. package/dist/ui/double-press.d.ts +9 -0
  63. package/dist/ui/double-press.d.ts.map +1 -0
  64. package/dist/ui/double-press.js +18 -0
  65. package/dist/ui/double-press.js.map +1 -0
  66. package/dist/ui/ink/components/App.d.ts +2 -0
  67. package/dist/ui/ink/components/App.d.ts.map +1 -1
  68. package/dist/ui/ink/components/App.js +12 -0
  69. package/dist/ui/ink/components/App.js.map +1 -1
  70. package/dist/ui/ink/renderer.d.ts +1 -0
  71. package/dist/ui/ink/renderer.d.ts.map +1 -1
  72. package/dist/ui/ink/renderer.js +3 -0
  73. package/dist/ui/ink/renderer.js.map +1 -1
  74. package/dist/ui/opentui-renderer.d.ts +53 -0
  75. package/dist/ui/opentui-renderer.d.ts.map +1 -0
  76. package/dist/ui/opentui-renderer.js +463 -0
  77. package/dist/ui/opentui-renderer.js.map +1 -0
  78. package/dist/ui/readline-renderer.d.ts +1 -0
  79. package/dist/ui/readline-renderer.d.ts.map +1 -1
  80. package/dist/ui/readline-renderer.js +3 -0
  81. package/dist/ui/readline-renderer.js.map +1 -1
  82. package/dist/ui/renderer.d.ts +1 -0
  83. package/dist/ui/renderer.d.ts.map +1 -1
  84. package/dist/ui/subagent-renderer.d.ts +1 -0
  85. package/dist/ui/subagent-renderer.d.ts.map +1 -1
  86. package/dist/ui/subagent-renderer.js +3 -0
  87. package/dist/ui/subagent-renderer.js.map +1 -1
  88. package/dist/utils/memoize.d.ts +14 -0
  89. package/dist/utils/memoize.d.ts.map +1 -0
  90. package/dist/utils/memoize.js +51 -0
  91. package/dist/utils/memoize.js.map +1 -0
  92. package/dist/utils/types.d.ts +6 -0
  93. package/dist/utils/types.d.ts.map +1 -0
  94. package/dist/utils/types.js +2 -0
  95. package/dist/utils/types.js.map +1 -0
  96. package/dist/utils.d.ts +22 -0
  97. package/dist/utils.d.ts.map +1 -0
  98. package/dist/utils.js +81 -0
  99. package/dist/utils.js.map +1 -0
  100. 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"}