myuru 0.3.1 → 2.0.0-alpha.2

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 (64) hide show
  1. package/README.md +185 -57
  2. package/dist/cli/commands/init.d.ts +4 -0
  3. package/dist/cli/commands/init.d.ts.map +1 -0
  4. package/dist/cli/commands/init.js +87 -0
  5. package/dist/cli/commands/init.js.map +1 -0
  6. package/dist/cli/commands/run.d.ts +13 -0
  7. package/dist/cli/commands/run.d.ts.map +1 -0
  8. package/dist/cli/commands/run.js +69 -0
  9. package/dist/cli/commands/run.js.map +1 -0
  10. package/dist/cli/index.d.ts +3 -0
  11. package/dist/cli/index.d.ts.map +1 -0
  12. package/dist/cli/index.js +28 -0
  13. package/dist/cli/index.js.map +1 -0
  14. package/dist/core/agent.d.ts +53 -0
  15. package/dist/core/agent.d.ts.map +1 -0
  16. package/dist/core/agent.js +217 -0
  17. package/dist/core/agent.js.map +1 -0
  18. package/dist/core/checkpoint.d.ts +31 -0
  19. package/dist/core/checkpoint.d.ts.map +1 -0
  20. package/dist/core/checkpoint.js +79 -0
  21. package/dist/core/checkpoint.js.map +1 -0
  22. package/dist/core/errors.d.ts +31 -0
  23. package/dist/core/errors.d.ts.map +1 -0
  24. package/dist/core/errors.js +61 -0
  25. package/dist/core/errors.js.map +1 -0
  26. package/dist/core/pipeline.d.ts +40 -0
  27. package/dist/core/pipeline.d.ts.map +1 -0
  28. package/dist/core/pipeline.js +180 -0
  29. package/dist/core/pipeline.js.map +1 -0
  30. package/dist/core/router.d.ts +56 -0
  31. package/dist/core/router.d.ts.map +1 -0
  32. package/dist/core/router.js +129 -0
  33. package/dist/core/router.js.map +1 -0
  34. package/dist/core/tool.d.ts +49 -0
  35. package/dist/core/tool.d.ts.map +1 -0
  36. package/dist/core/tool.js +39 -0
  37. package/dist/core/tool.js.map +1 -0
  38. package/dist/core/trace.d.ts +36 -0
  39. package/dist/core/trace.d.ts.map +1 -0
  40. package/dist/core/trace.js +122 -0
  41. package/dist/core/trace.js.map +1 -0
  42. package/dist/index.d.ts +11 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +15 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/types/index.d.ts +154 -0
  47. package/dist/types/index.d.ts.map +1 -0
  48. package/dist/types/index.js +2 -0
  49. package/dist/types/index.js.map +1 -0
  50. package/package.json +64 -13
  51. package/bin/myuru.js +0 -60
  52. package/src/commands/council.js +0 -159
  53. package/src/commands/init.js +0 -67
  54. package/src/commands/run.js +0 -165
  55. package/src/commands/status.js +0 -49
  56. package/src/index.js +0 -15
  57. package/src/lib/agent-runner.js +0 -163
  58. package/src/lib/council-server.js +0 -193
  59. package/src/lib/dashboard.js +0 -111
  60. package/src/lib/task-db.js +0 -218
  61. package/src/providers/claude.js +0 -49
  62. package/src/providers/gemini.js +0 -56
  63. package/src/providers/index.js +0 -19
  64. package/src/providers/openai.js +0 -57
package/README.md CHANGED
@@ -3,98 +3,226 @@
3
3
  [![npm version](https://img.shields.io/npm/v/myuru.svg)](https://www.npmjs.com/package/myuru)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Multi-provider AI agent orchestrator. Coordinate Claude, GPT, and Gemini agents to build software in parallel.
6
+ TypeScript-first multi-agent orchestration framework. Coordinate AI agents across any provider with built-in tracing, intelligent routing, and production-grade reliability.
7
7
 
8
- ## Features
8
+ ## Why MyUru?
9
9
 
10
- - **Multi-Provider**: Claude, OpenAI, Gemini
11
- - **Council Mode**: Agents deliberate in a chatroom, then execute tasks together
12
- - **Session Persistence**: Agents maintain context across invocations
13
- - **Terminal Dashboard**: Real-time ANSI UI showing agent status
14
- - **Concurrent Execution**: Run agents in parallel or sequentially
10
+ - **Provider-agnostic** -- works with Claude, GPT, Gemini, Mistral, and 40+ providers via the Vercel AI SDK
11
+ - **TypeScript-native** -- full type safety, no Python bridge, runs anywhere Node runs
12
+ - **Built-in observability** -- every run produces token counts, cost estimates, and step-by-step traces
13
+ - **Intelligent routing** -- automatically selects the right model for each task based on complexity
14
+ - **Pipeline orchestration** -- chain agents sequentially, in parallel, or in mixed patterns with human approval gates
15
+ - **Checkpoint/resume** -- long-running pipelines survive crashes and can be resumed from disk
15
16
 
16
17
  ## Installation
17
18
 
18
19
  ```bash
19
- npm install -g myuru
20
+ npm install myuru
20
21
  ```
21
22
 
22
- ## Quick Start
23
-
24
- Initialize a project:
23
+ Install at least one provider SDK:
25
24
 
26
25
  ```bash
27
- myuru init
26
+ npm install @ai-sdk/anthropic # or @ai-sdk/openai, @ai-sdk/google
28
27
  ```
29
28
 
30
- Run agents on a task:
29
+ ## Quick Start
31
30
 
32
- ```bash
33
- myuru run --task "Build a login page with JWT auth"
34
- ```
31
+ ### Single Agent
35
32
 
36
- Output:
33
+ ```ts
34
+ import { Agent } from 'myuru';
35
+ import { anthropic } from '@ai-sdk/anthropic';
36
+
37
+ const agent = new Agent({
38
+ name: 'researcher',
39
+ model: anthropic('claude-sonnet-4-5'),
40
+ instructions: 'You are a research assistant. Be concise and accurate.',
41
+ });
42
+
43
+ const result = await agent.run('What are the top TypeScript frameworks in 2026?');
44
+ console.log(result.text);
45
+ console.log(`Cost: $${result.usage.estimatedCostUsd.toFixed(4)}`);
37
46
  ```
38
- [Agent Architect] Designing authentication system...
39
- [Agent Frontend] Building React login form...
40
- [Agent Security] Implementing JWT validation...
41
47
 
42
- Tasks completed: 3/3 | Status: SUCCESS
48
+ ### Agent with Tools
49
+
50
+ ```ts
51
+ import { Agent, defineTool, z } from 'myuru';
52
+ import { openai } from '@ai-sdk/openai';
53
+
54
+ const searchTool = defineTool({
55
+ name: 'web_search',
56
+ description: 'Search the web for information',
57
+ parameters: z.object({
58
+ query: z.string().describe('The search query'),
59
+ }),
60
+ execute: async ({ query }) => {
61
+ // Your search implementation
62
+ return `Results for: ${query}`;
63
+ },
64
+ });
65
+
66
+ const agent = Agent.create({
67
+ name: 'search-agent',
68
+ model: openai('gpt-4o'),
69
+ instructions: 'Use the search tool to find accurate information.',
70
+ tools: [searchTool],
71
+ maxSteps: 5,
72
+ budgetPerRun: 0.50, // USD limit per run
73
+ });
74
+
75
+ const result = await agent.run('Find the latest Node.js LTS version');
43
76
  ```
44
77
 
45
- Start a council discussion:
78
+ ### Streaming
46
79
 
47
- ```bash
48
- myuru council \
49
- --topic "Design auth system" \
50
- --agents "Architect,Security,Frontend"
80
+ ```ts
81
+ const stream = agent.stream('Write a haiku about TypeScript');
82
+
83
+ for await (const chunk of stream) {
84
+ process.stdout.write(chunk);
85
+ }
86
+ // The return value contains the full AgentResult
51
87
  ```
52
88
 
53
- Check task progress:
89
+ ### Pipeline (Multi-Agent)
54
90
 
55
- ```bash
56
- myuru status
91
+ ```ts
92
+ import { Agent, Pipeline, parallel } from 'myuru';
93
+ import { anthropic } from '@ai-sdk/anthropic';
94
+
95
+ const model = anthropic('claude-sonnet-4-5');
96
+
97
+ const pipeline = new Pipeline({
98
+ name: 'research-and-write',
99
+ agents: {
100
+ researcher: { name: 'researcher', model, instructions: 'Find key facts.' },
101
+ writer: { name: 'writer', model, instructions: 'Write clear, engaging content.' },
102
+ editor: { name: 'editor', model, instructions: 'Fix grammar and improve clarity.' },
103
+ },
104
+ steps: [
105
+ { agent: 'researcher', input: (ctx) => `Research: ${ctx.task}` },
106
+ { agent: 'writer', input: (ctx) => `Write an article using these facts:\n${ctx.results.researcher}` },
107
+ { agent: 'editor', input: (ctx) => `Edit this article:\n${ctx.results.writer}` },
108
+ ],
109
+ trace: true,
110
+ });
111
+
112
+ const result = await pipeline.run('The state of TypeScript in 2026');
113
+ console.log(result.finalOutput);
57
114
  ```
58
115
 
59
- ## Commands
116
+ ### Intelligent Model Routing
60
117
 
61
- | Command | Description |
62
- |---------|-------------|
63
- | `myuru init` | Initialize project with config |
64
- | `myuru run --task "..."` | Run agents on a task |
65
- | `myuru council --topic "..." --agents "..." --model sonnet` | Start council deliberation |
66
- | `myuru status` | View task progress |
118
+ ```ts
119
+ import { ModelRouter } from 'myuru';
120
+ import { anthropic } from '@ai-sdk/anthropic';
121
+
122
+ const router = new ModelRouter({
123
+ strategy: 'cost-optimized', // or 'quality-first', 'balanced'
124
+ models: {
125
+ complex: anthropic('claude-opus-4-6'),
126
+ standard: anthropic('claude-sonnet-4-5'),
127
+ simple: anthropic('claude-haiku-4-5'),
128
+ },
129
+ budget: { maxPerDay: 10.00 },
130
+ });
131
+
132
+ // Automatically picks the right model based on input complexity
133
+ const model = router.select('Analyze the architectural trade-offs of...');
134
+ ```
67
135
 
68
- ## Configuration
136
+ ### Human Approval Gates
137
+
138
+ ```ts
139
+ const pipeline = new Pipeline({
140
+ name: 'deploy-pipeline',
141
+ agents: { /* ... */ },
142
+ steps: [
143
+ { agent: 'planner', input: (ctx) => ctx.task },
144
+ { agent: 'deployer', input: (ctx) => ctx.results.planner, needsApproval: true },
145
+ ],
146
+ onApproval: async (step, ctx) => {
147
+ // Your approval logic -- prompt user, check policy, etc.
148
+ return confirm(`Approve ${step.agent}?`);
149
+ },
150
+ });
151
+ ```
69
152
 
70
- Set environment variables:
153
+ ## CLI
71
154
 
72
155
  ```bash
73
- export OPENAI_API_KEY="sk-..."
74
- export ANTHROPIC_API_KEY="sk-ant-..."
75
- export GEMINI_API_KEY="..."
156
+ # Initialize a project
157
+ npx myuru init
158
+
159
+ # Run a task
160
+ npx myuru run --task "Summarize this codebase" --provider anthropic --trace
76
161
  ```
77
162
 
78
- Create `myuru.config.mjs`:
79
-
80
- ```js
81
- export default {
82
- provider: "claude",
83
- model: "sonnet",
84
- agents: 2,
85
- concurrent: false,
86
- roles: {
87
- Builder: "You are a software engineer. Write clean, working code.",
88
- Reviewer: "You review code for bugs, security issues, and quality.",
89
- },
163
+ ## API Reference
164
+
165
+ ### `Agent`
166
+
167
+ | Method | Description |
168
+ |--------|-------------|
169
+ | `new Agent(config)` | Create an agent with name, model, instructions, tools |
170
+ | `Agent.create(config)` | Create from NamedTool array (convenience) |
171
+ | `agent.run(input, options?)` | Run and return full result |
172
+ | `agent.stream(input, options?)` | Stream text chunks as they arrive |
173
+
174
+ ### `Pipeline`
175
+
176
+ | Method | Description |
177
+ |--------|-------------|
178
+ | `new Pipeline(config)` | Create a multi-agent pipeline |
179
+ | `pipeline.run(task)` | Execute the pipeline |
180
+ | `sequential(steps)` | Group steps to run in order |
181
+ | `parallel(steps)` | Group steps to run concurrently |
182
+
183
+ ### `ModelRouter`
184
+
185
+ | Method | Description |
186
+ |--------|-------------|
187
+ | `new ModelRouter(config)` | Create with strategy and model tiers |
188
+ | `router.select(input)` | Get the best model for this input |
189
+ | `router.recordSpend(usd)` | Track spending for budget enforcement |
190
+
191
+ ### `defineTool`
192
+
193
+ | Method | Description |
194
+ |--------|-------------|
195
+ | `defineTool(config)` | Create a type-safe tool with Zod schema |
196
+
197
+ ### Result Types
198
+
199
+ ```ts
200
+ type AgentResult = {
201
+ text: string; // Final text output
202
+ steps: StepResult[]; // Step-by-step execution log
203
+ usage: UsageSummary; // Token counts + cost estimate
204
+ trace?: TraceRecord; // Full trace (if enabled)
205
+ };
206
+
207
+ type UsageSummary = {
208
+ totalInputTokens: number;
209
+ totalOutputTokens: number;
210
+ totalTokens: number;
211
+ estimatedCostUsd: number;
212
+ stepCount: number;
90
213
  };
91
214
  ```
92
215
 
93
216
  ## Requirements
94
217
 
95
- - Node.js >= 18
96
- - Claude CLI (for Claude provider)
97
- - API keys for your chosen providers
218
+ - Node.js >= 20
219
+ - At least one AI provider SDK (`@ai-sdk/anthropic`, `@ai-sdk/openai`, `@ai-sdk/google`)
220
+
221
+ ## Related Tools
222
+
223
+ - **[RulesForge](https://github.com/Wittlesus/rulesforge)** -- Auto-generate AI coding rules for any codebase
224
+ - **[DepScope](https://github.com/Wittlesus/depscope)** -- Check npm dependency health scores
225
+ - **[ScopeGuard](https://github.com/Wittlesus/scopeguard)** -- Prevent AI scope creep with session tracking
98
226
 
99
227
  ## License
100
228
 
@@ -102,4 +230,4 @@ MIT - See LICENSE file
102
230
 
103
231
  ---
104
232
 
105
- Built by Wittlesus | [GitHub](https://github.com/Wittlesus/myuru)
233
+ Built by [@WSDevGuy](https://x.com/WSDevGuy) | [GitHub](https://github.com/Wittlesus/myuru)
@@ -0,0 +1,4 @@
1
+ export declare function initCommand(opts: {
2
+ dir: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CtE"}
@@ -0,0 +1,87 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ export async function initCommand(opts) {
4
+ const dir = path.resolve(opts.dir);
5
+ console.log(`\nMyUru v2 — Initializing project in ${dir}\n`);
6
+ // Create config file
7
+ const configPath = path.join(dir, 'myuru.config.ts');
8
+ if (!fs.existsSync(configPath)) {
9
+ fs.writeFileSync(configPath, CONFIG_TEMPLATE);
10
+ console.log(' Created myuru.config.ts');
11
+ }
12
+ else {
13
+ console.log(' myuru.config.ts already exists, skipping');
14
+ }
15
+ // Create agents directory
16
+ const agentsDir = path.join(dir, 'agents');
17
+ if (!fs.existsSync(agentsDir)) {
18
+ fs.mkdirSync(agentsDir, { recursive: true });
19
+ fs.writeFileSync(path.join(agentsDir, 'researcher.ts'), AGENT_TEMPLATE);
20
+ console.log(' Created agents/researcher.ts');
21
+ }
22
+ // Create .myuru directory for state
23
+ const stateDir = path.join(dir, '.myuru');
24
+ fs.mkdirSync(stateDir, { recursive: true });
25
+ console.log(' Created .myuru/ (state directory)');
26
+ // Add to .gitignore if it exists
27
+ const gitignorePath = path.join(dir, '.gitignore');
28
+ if (fs.existsSync(gitignorePath)) {
29
+ const content = fs.readFileSync(gitignorePath, 'utf-8');
30
+ if (!content.includes('.myuru')) {
31
+ fs.appendFileSync(gitignorePath, '\n# MyUru state\n.myuru/\n');
32
+ console.log(' Added .myuru/ to .gitignore');
33
+ }
34
+ }
35
+ console.log('\nDone! Next steps:');
36
+ console.log(' 1. Set your API key: export ANTHROPIC_API_KEY=sk-ant-...');
37
+ console.log(' 2. Edit myuru.config.ts to configure your agents');
38
+ console.log(' 3. Run: myuru run --task "Your task here"\n');
39
+ }
40
+ const CONFIG_TEMPLATE = `import { type AgentConfig } from 'myuru';
41
+
42
+ // MyUru Configuration
43
+ // Docs: https://github.com/Wittlesus/myuru
44
+
45
+ export default {
46
+ // Default provider and model
47
+ provider: 'anthropic',
48
+ model: 'claude-sonnet-4-5',
49
+
50
+ // Agent definitions
51
+ agents: {
52
+ default: {
53
+ name: 'default',
54
+ instructions: 'You are a helpful AI assistant. Complete tasks efficiently.',
55
+ maxSteps: 10,
56
+ },
57
+ },
58
+
59
+ // Pipeline definitions (optional)
60
+ pipelines: {},
61
+
62
+ // Tracing
63
+ trace: false,
64
+
65
+ // Budget limits (optional)
66
+ budget: {
67
+ maxPerRun: 5.00,
68
+ },
69
+ };
70
+ `;
71
+ const AGENT_TEMPLATE = `import { Agent, defineTool, z } from 'myuru';
72
+
73
+ // Example agent definition
74
+ // Import your provider:
75
+ // import { anthropic } from '@ai-sdk/anthropic';
76
+
77
+ // const researcher = new Agent({
78
+ // name: 'researcher',
79
+ // model: anthropic('claude-sonnet-4-5'),
80
+ // instructions: 'You are a research assistant. Find accurate information.',
81
+ // tools: {},
82
+ // maxSteps: 10,
83
+ // });
84
+ //
85
+ // export default researcher;
86
+ `;
87
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,WAAW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AAE,YAAY,CAAC,CAAC;IACnD,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,4BAA4B,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BvB,CAAC;AAEF,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;CAetB,CAAC"}
@@ -0,0 +1,13 @@
1
+ type RunOpts = {
2
+ task: string;
3
+ config: string;
4
+ model?: string;
5
+ provider: string;
6
+ maxSteps: string;
7
+ budget?: string;
8
+ trace?: boolean;
9
+ dryRun?: boolean;
10
+ };
11
+ export declare function runCommand(opts: RunOpts): Promise<void>;
12
+ export {};
13
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD7D"}
@@ -0,0 +1,69 @@
1
+ import { Agent } from '../../core/agent.js';
2
+ export async function runCommand(opts) {
3
+ const maxSteps = parseInt(opts.maxSteps, 10) || 10;
4
+ const budget = opts.budget ? parseFloat(opts.budget) : undefined;
5
+ console.log(`\nMyUru v2 | ${opts.provider}/${opts.model ?? 'default'}`);
6
+ console.log(`Task: ${opts.task.substring(0, 80)}`);
7
+ console.log(`Max steps: ${maxSteps}${budget ? ` | Budget: $${budget}` : ''}`);
8
+ console.log('─'.repeat(50));
9
+ if (opts.dryRun) {
10
+ console.log('\nDry run — would execute the above. Exiting.\n');
11
+ return;
12
+ }
13
+ // Resolve model
14
+ const model = await resolveModel(opts.provider, opts.model);
15
+ const agent = new Agent({
16
+ name: 'cli-agent',
17
+ model,
18
+ instructions: 'You are a helpful AI assistant. Complete the task efficiently.',
19
+ maxSteps,
20
+ budgetPerRun: budget,
21
+ });
22
+ const startTime = Date.now();
23
+ try {
24
+ const result = await agent.run(opts.task, {
25
+ trace: opts.trace,
26
+ onStep: (step) => {
27
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
28
+ if (step.toolCalls?.length) {
29
+ for (const tc of step.toolCalls) {
30
+ console.log(` [${elapsed}s] Tool: ${tc.name}`);
31
+ }
32
+ }
33
+ else if (step.text) {
34
+ const preview = step.text.substring(0, 100).replace(/\n/g, ' ');
35
+ console.log(` [${elapsed}s] Text: ${preview}...`);
36
+ }
37
+ },
38
+ });
39
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
40
+ console.log('\n' + '─'.repeat(50));
41
+ console.log(result.text);
42
+ console.log('─'.repeat(50));
43
+ console.log(`Steps: ${result.usage.stepCount} | Tokens: ${result.usage.totalTokens} | Cost: $${result.usage.estimatedCostUsd.toFixed(4)} | Time: ${elapsed}s`);
44
+ console.log('');
45
+ }
46
+ catch (error) {
47
+ console.error(`\nError: ${error instanceof Error ? error.message : String(error)}\n`);
48
+ process.exit(1);
49
+ }
50
+ }
51
+ async function resolveModel(provider, modelName) {
52
+ switch (provider) {
53
+ case 'anthropic': {
54
+ const { anthropic } = await import('@ai-sdk/anthropic');
55
+ return anthropic(modelName ?? 'claude-sonnet-4-5');
56
+ }
57
+ case 'openai': {
58
+ const { openai } = await import('@ai-sdk/openai');
59
+ return openai(modelName ?? 'gpt-4o');
60
+ }
61
+ case 'google': {
62
+ const { google } = await import('@ai-sdk/google');
63
+ return google(modelName ?? 'gemini-2.0-flash');
64
+ }
65
+ default:
66
+ throw new Error(`Unknown provider: ${provider}. Use: anthropic, openai, google`);
67
+ }
68
+ }
69
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAc5C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAa;IAC5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,cAAc,QAAQ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E,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACxD,OAAO,SAAS,CAAC,SAAS,IAAI,mBAAmB,CAAqB,CAAC;QACzE,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC,SAAS,IAAI,QAAQ,CAAqB,CAAC;QAC3D,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAqB,CAAC;QACrE,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,kCAAkC,CAAC,CAAC;IACrF,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { initCommand } from './commands/init.js';
4
+ import { runCommand } from './commands/run.js';
5
+ const program = new Command();
6
+ program
7
+ .name('myuru')
8
+ .description('TypeScript-first multi-agent orchestration framework')
9
+ .version('2.0.0-alpha.1');
10
+ program
11
+ .command('init')
12
+ .description('Initialize a new MyUru project')
13
+ .option('-d, --dir <path>', 'Target directory', '.')
14
+ .action(initCommand);
15
+ program
16
+ .command('run')
17
+ .description('Run an agent or pipeline')
18
+ .requiredOption('-t, --task <task>', 'Task description')
19
+ .option('-c, --config <path>', 'Config file path', 'myuru.config.ts')
20
+ .option('-m, --model <model>', 'Model to use (e.g. claude-sonnet-4-5)')
21
+ .option('-p, --provider <provider>', 'Provider (anthropic, openai, google)', 'anthropic')
22
+ .option('--max-steps <n>', 'Maximum agent steps', '10')
23
+ .option('--budget <usd>', 'Max budget in USD')
24
+ .option('--trace', 'Enable tracing output')
25
+ .option('--dry-run', 'Show what would run without executing')
26
+ .action(runCommand);
27
+ program.parse();
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,sDAAsD,CAAC;KACnE,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5B,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,gCAAgC,CAAC;KAC7C,MAAM,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,CAAC;KACnD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,0BAA0B,CAAC;KACvC,cAAc,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;KACvD,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;KACpE,MAAM,CAAC,qBAAqB,EAAE,uCAAuC,CAAC;KACtE,MAAM,CAAC,2BAA2B,EAAE,sCAAsC,EAAE,WAAW,CAAC;KACxF,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,IAAI,CAAC;KACtD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAC7C,MAAM,CAAC,SAAS,EAAE,uBAAuB,CAAC;KAC1C,MAAM,CAAC,WAAW,EAAE,uCAAuC,CAAC;KAC5D,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { Model, AgentConfig, RunOptions, AgentResult } from '../types/index.js';
2
+ import type { NamedTool } from './tool.js';
3
+ /**
4
+ * Agent — the core primitive of MyUru.
5
+ *
6
+ * Wraps an LLM with instructions, tools, and built-in tracing.
7
+ * Uses the Vercel AI SDK under the hood for provider-agnostic model access.
8
+ *
9
+ * ```ts
10
+ * import { Agent } from 'myuru';
11
+ * import { anthropic } from '@ai-sdk/anthropic';
12
+ *
13
+ * const agent = new Agent({
14
+ * name: 'researcher',
15
+ * model: anthropic('claude-sonnet-4-5'),
16
+ * instructions: 'You are a research assistant.',
17
+ * tools: { search: searchTool },
18
+ * });
19
+ *
20
+ * const result = await agent.run('Find info about TypeScript frameworks');
21
+ * console.log(result.text);
22
+ * console.log(result.usage.estimatedCostUsd);
23
+ * ```
24
+ */
25
+ export declare class Agent {
26
+ readonly name: string;
27
+ readonly model: Model;
28
+ readonly instructions: string;
29
+ readonly tools: Record<string, unknown>;
30
+ readonly maxSteps: number;
31
+ readonly budgetPerRun?: number;
32
+ readonly onBeforeToolCall?: (toolName: string, args: unknown) => boolean | Promise<boolean>;
33
+ constructor(config: AgentConfig);
34
+ /**
35
+ * Create an Agent from NamedTool array (convenience).
36
+ */
37
+ static create(config: Omit<AgentConfig, 'tools'> & {
38
+ tools?: NamedTool[];
39
+ }): Agent;
40
+ /**
41
+ * Run the agent on an input. Returns the full result with tracing.
42
+ */
43
+ run(input: string, options?: RunOptions): Promise<AgentResult>;
44
+ /**
45
+ * Stream the agent's response. Yields text chunks as they arrive.
46
+ */
47
+ stream(input: string, options?: RunOptions): AsyncGenerator<string, AgentResult>;
48
+ private buildSystemPrompt;
49
+ private extractModelId;
50
+ private mapStep;
51
+ private summarizeUsage;
52
+ }
53
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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