cmdr-agent 1.0.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.
Files changed (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +238 -0
  3. package/dist/bin/cmdr.d.ts +9 -0
  4. package/dist/bin/cmdr.d.ts.map +1 -0
  5. package/dist/bin/cmdr.js +49 -0
  6. package/dist/bin/cmdr.js.map +1 -0
  7. package/dist/src/cli/args.d.ts +19 -0
  8. package/dist/src/cli/args.d.ts.map +1 -0
  9. package/dist/src/cli/args.js +89 -0
  10. package/dist/src/cli/args.js.map +1 -0
  11. package/dist/src/cli/commands.d.ts +12 -0
  12. package/dist/src/cli/commands.d.ts.map +1 -0
  13. package/dist/src/cli/commands.js +400 -0
  14. package/dist/src/cli/commands.js.map +1 -0
  15. package/dist/src/cli/renderer.d.ts +8 -0
  16. package/dist/src/cli/renderer.d.ts.map +1 -0
  17. package/dist/src/cli/renderer.js +47 -0
  18. package/dist/src/cli/renderer.js.map +1 -0
  19. package/dist/src/cli/repl.d.ts +18 -0
  20. package/dist/src/cli/repl.d.ts.map +1 -0
  21. package/dist/src/cli/repl.js +751 -0
  22. package/dist/src/cli/repl.js.map +1 -0
  23. package/dist/src/cli/spinner.d.ts +16 -0
  24. package/dist/src/cli/spinner.d.ts.map +1 -0
  25. package/dist/src/cli/spinner.js +233 -0
  26. package/dist/src/cli/spinner.js.map +1 -0
  27. package/dist/src/cli/theme.d.ts +95 -0
  28. package/dist/src/cli/theme.d.ts.map +1 -0
  29. package/dist/src/cli/theme.js +178 -0
  30. package/dist/src/cli/theme.js.map +1 -0
  31. package/dist/src/communication/message-bus.d.ts +35 -0
  32. package/dist/src/communication/message-bus.d.ts.map +1 -0
  33. package/dist/src/communication/message-bus.js +60 -0
  34. package/dist/src/communication/message-bus.js.map +1 -0
  35. package/dist/src/communication/shared-memory.d.ts +19 -0
  36. package/dist/src/communication/shared-memory.d.ts.map +1 -0
  37. package/dist/src/communication/shared-memory.js +37 -0
  38. package/dist/src/communication/shared-memory.js.map +1 -0
  39. package/dist/src/communication/task-queue.d.ts +50 -0
  40. package/dist/src/communication/task-queue.d.ts.map +1 -0
  41. package/dist/src/communication/task-queue.js +158 -0
  42. package/dist/src/communication/task-queue.js.map +1 -0
  43. package/dist/src/config/config-loader.d.ts +23 -0
  44. package/dist/src/config/config-loader.d.ts.map +1 -0
  45. package/dist/src/config/config-loader.js +91 -0
  46. package/dist/src/config/config-loader.js.map +1 -0
  47. package/dist/src/config/defaults.d.ts +6 -0
  48. package/dist/src/config/defaults.d.ts.map +1 -0
  49. package/dist/src/config/defaults.js +21 -0
  50. package/dist/src/config/defaults.js.map +1 -0
  51. package/dist/src/config/schema.d.ts +135 -0
  52. package/dist/src/config/schema.d.ts.map +1 -0
  53. package/dist/src/config/schema.js +35 -0
  54. package/dist/src/config/schema.js.map +1 -0
  55. package/dist/src/config/telemetry.d.ts +41 -0
  56. package/dist/src/config/telemetry.d.ts.map +1 -0
  57. package/dist/src/config/telemetry.js +57 -0
  58. package/dist/src/config/telemetry.js.map +1 -0
  59. package/dist/src/core/agent-pool.d.ts +40 -0
  60. package/dist/src/core/agent-pool.d.ts.map +1 -0
  61. package/dist/src/core/agent-pool.js +66 -0
  62. package/dist/src/core/agent-pool.js.map +1 -0
  63. package/dist/src/core/agent-runner.d.ts +51 -0
  64. package/dist/src/core/agent-runner.d.ts.map +1 -0
  65. package/dist/src/core/agent-runner.js +251 -0
  66. package/dist/src/core/agent-runner.js.map +1 -0
  67. package/dist/src/core/agent.d.ts +34 -0
  68. package/dist/src/core/agent.d.ts.map +1 -0
  69. package/dist/src/core/agent.js +143 -0
  70. package/dist/src/core/agent.js.map +1 -0
  71. package/dist/src/core/intent.d.ts +33 -0
  72. package/dist/src/core/intent.d.ts.map +1 -0
  73. package/dist/src/core/intent.js +91 -0
  74. package/dist/src/core/intent.js.map +1 -0
  75. package/dist/src/core/orchestrator.d.ts +43 -0
  76. package/dist/src/core/orchestrator.d.ts.map +1 -0
  77. package/dist/src/core/orchestrator.js +115 -0
  78. package/dist/src/core/orchestrator.js.map +1 -0
  79. package/dist/src/core/permissions.d.ts +36 -0
  80. package/dist/src/core/permissions.d.ts.map +1 -0
  81. package/dist/src/core/permissions.js +129 -0
  82. package/dist/src/core/permissions.js.map +1 -0
  83. package/dist/src/core/presets.d.ts +12 -0
  84. package/dist/src/core/presets.d.ts.map +1 -0
  85. package/dist/src/core/presets.js +148 -0
  86. package/dist/src/core/presets.js.map +1 -0
  87. package/dist/src/core/team.d.ts +44 -0
  88. package/dist/src/core/team.d.ts.map +1 -0
  89. package/dist/src/core/team.js +156 -0
  90. package/dist/src/core/team.js.map +1 -0
  91. package/dist/src/core/types.d.ts +257 -0
  92. package/dist/src/core/types.d.ts.map +1 -0
  93. package/dist/src/core/types.js +7 -0
  94. package/dist/src/core/types.js.map +1 -0
  95. package/dist/src/index.d.ts +44 -0
  96. package/dist/src/index.d.ts.map +1 -0
  97. package/dist/src/index.js +45 -0
  98. package/dist/src/index.js.map +1 -0
  99. package/dist/src/llm/adapter.d.ts +5 -0
  100. package/dist/src/llm/adapter.d.ts.map +1 -0
  101. package/dist/src/llm/adapter.js +5 -0
  102. package/dist/src/llm/adapter.js.map +1 -0
  103. package/dist/src/llm/model-registry.d.ts +14 -0
  104. package/dist/src/llm/model-registry.d.ts.map +1 -0
  105. package/dist/src/llm/model-registry.js +30 -0
  106. package/dist/src/llm/model-registry.js.map +1 -0
  107. package/dist/src/llm/ollama.d.ts +26 -0
  108. package/dist/src/llm/ollama.d.ts.map +1 -0
  109. package/dist/src/llm/ollama.js +375 -0
  110. package/dist/src/llm/ollama.js.map +1 -0
  111. package/dist/src/llm/token-counter.d.ts +11 -0
  112. package/dist/src/llm/token-counter.d.ts.map +1 -0
  113. package/dist/src/llm/token-counter.js +35 -0
  114. package/dist/src/llm/token-counter.js.map +1 -0
  115. package/dist/src/plugins/mcp-client.d.ts +38 -0
  116. package/dist/src/plugins/mcp-client.d.ts.map +1 -0
  117. package/dist/src/plugins/mcp-client.js +113 -0
  118. package/dist/src/plugins/mcp-client.js.map +1 -0
  119. package/dist/src/plugins/plugin-manager.d.ts +37 -0
  120. package/dist/src/plugins/plugin-manager.d.ts.map +1 -0
  121. package/dist/src/plugins/plugin-manager.js +146 -0
  122. package/dist/src/plugins/plugin-manager.js.map +1 -0
  123. package/dist/src/scheduling/semaphore.d.ts +20 -0
  124. package/dist/src/scheduling/semaphore.d.ts.map +1 -0
  125. package/dist/src/scheduling/semaphore.js +52 -0
  126. package/dist/src/scheduling/semaphore.js.map +1 -0
  127. package/dist/src/scheduling/strategies.d.ts +39 -0
  128. package/dist/src/scheduling/strategies.d.ts.map +1 -0
  129. package/dist/src/scheduling/strategies.js +88 -0
  130. package/dist/src/scheduling/strategies.js.map +1 -0
  131. package/dist/src/session/compaction.d.ts +32 -0
  132. package/dist/src/session/compaction.d.ts.map +1 -0
  133. package/dist/src/session/compaction.js +172 -0
  134. package/dist/src/session/compaction.js.map +1 -0
  135. package/dist/src/session/cost-tracker.d.ts +41 -0
  136. package/dist/src/session/cost-tracker.d.ts.map +1 -0
  137. package/dist/src/session/cost-tracker.js +76 -0
  138. package/dist/src/session/cost-tracker.js.map +1 -0
  139. package/dist/src/session/project-context.d.ts +6 -0
  140. package/dist/src/session/project-context.d.ts.map +1 -0
  141. package/dist/src/session/project-context.js +147 -0
  142. package/dist/src/session/project-context.js.map +1 -0
  143. package/dist/src/session/prompt-builder.d.ts +11 -0
  144. package/dist/src/session/prompt-builder.d.ts.map +1 -0
  145. package/dist/src/session/prompt-builder.js +30 -0
  146. package/dist/src/session/prompt-builder.js.map +1 -0
  147. package/dist/src/session/session-manager.d.ts +32 -0
  148. package/dist/src/session/session-manager.d.ts.map +1 -0
  149. package/dist/src/session/session-manager.js +84 -0
  150. package/dist/src/session/session-manager.js.map +1 -0
  151. package/dist/src/session/session-persistence.d.ts +44 -0
  152. package/dist/src/session/session-persistence.d.ts.map +1 -0
  153. package/dist/src/session/session-persistence.js +150 -0
  154. package/dist/src/session/session-persistence.js.map +1 -0
  155. package/dist/src/session/undo-manager.d.ts +35 -0
  156. package/dist/src/session/undo-manager.d.ts.map +1 -0
  157. package/dist/src/session/undo-manager.js +79 -0
  158. package/dist/src/session/undo-manager.js.map +1 -0
  159. package/dist/src/tools/built-in/ask-user.d.ts +7 -0
  160. package/dist/src/tools/built-in/ask-user.d.ts.map +1 -0
  161. package/dist/src/tools/built-in/ask-user.js +28 -0
  162. package/dist/src/tools/built-in/ask-user.js.map +1 -0
  163. package/dist/src/tools/built-in/bash.d.ts +9 -0
  164. package/dist/src/tools/built-in/bash.d.ts.map +1 -0
  165. package/dist/src/tools/built-in/bash.js +67 -0
  166. package/dist/src/tools/built-in/bash.js.map +1 -0
  167. package/dist/src/tools/built-in/file-edit.d.ts +9 -0
  168. package/dist/src/tools/built-in/file-edit.d.ts.map +1 -0
  169. package/dist/src/tools/built-in/file-edit.js +39 -0
  170. package/dist/src/tools/built-in/file-edit.js.map +1 -0
  171. package/dist/src/tools/built-in/file-read.d.ts +9 -0
  172. package/dist/src/tools/built-in/file-read.d.ts.map +1 -0
  173. package/dist/src/tools/built-in/file-read.js +41 -0
  174. package/dist/src/tools/built-in/file-read.js.map +1 -0
  175. package/dist/src/tools/built-in/file-write.d.ts +8 -0
  176. package/dist/src/tools/built-in/file-write.d.ts.map +1 -0
  177. package/dist/src/tools/built-in/file-write.js +29 -0
  178. package/dist/src/tools/built-in/file-write.js.map +1 -0
  179. package/dist/src/tools/built-in/git-commit.d.ts +12 -0
  180. package/dist/src/tools/built-in/git-commit.d.ts.map +1 -0
  181. package/dist/src/tools/built-in/git-commit.js +96 -0
  182. package/dist/src/tools/built-in/git-commit.js.map +1 -0
  183. package/dist/src/tools/built-in/git-diff.d.ts +8 -0
  184. package/dist/src/tools/built-in/git-diff.d.ts.map +1 -0
  185. package/dist/src/tools/built-in/git-diff.js +43 -0
  186. package/dist/src/tools/built-in/git-diff.js.map +1 -0
  187. package/dist/src/tools/built-in/git-log.d.ts +8 -0
  188. package/dist/src/tools/built-in/git-log.d.ts.map +1 -0
  189. package/dist/src/tools/built-in/git-log.js +39 -0
  190. package/dist/src/tools/built-in/git-log.js.map +1 -0
  191. package/dist/src/tools/built-in/glob.d.ts +8 -0
  192. package/dist/src/tools/built-in/glob.d.ts.map +1 -0
  193. package/dist/src/tools/built-in/glob.js +60 -0
  194. package/dist/src/tools/built-in/glob.js.map +1 -0
  195. package/dist/src/tools/built-in/grep.d.ts +9 -0
  196. package/dist/src/tools/built-in/grep.d.ts.map +1 -0
  197. package/dist/src/tools/built-in/grep.js +115 -0
  198. package/dist/src/tools/built-in/grep.js.map +1 -0
  199. package/dist/src/tools/built-in/index.d.ts +21 -0
  200. package/dist/src/tools/built-in/index.d.ts.map +1 -0
  201. package/dist/src/tools/built-in/index.js +30 -0
  202. package/dist/src/tools/built-in/index.js.map +1 -0
  203. package/dist/src/tools/built-in/think.d.ts +7 -0
  204. package/dist/src/tools/built-in/think.d.ts.map +1 -0
  205. package/dist/src/tools/built-in/think.js +18 -0
  206. package/dist/src/tools/built-in/think.js.map +1 -0
  207. package/dist/src/tools/built-in/web-fetch.d.ts +11 -0
  208. package/dist/src/tools/built-in/web-fetch.d.ts.map +1 -0
  209. package/dist/src/tools/built-in/web-fetch.js +70 -0
  210. package/dist/src/tools/built-in/web-fetch.js.map +1 -0
  211. package/dist/src/tools/executor.d.ts +25 -0
  212. package/dist/src/tools/executor.d.ts.map +1 -0
  213. package/dist/src/tools/executor.js +61 -0
  214. package/dist/src/tools/executor.js.map +1 -0
  215. package/dist/src/tools/registry.d.ts +25 -0
  216. package/dist/src/tools/registry.d.ts.map +1 -0
  217. package/dist/src/tools/registry.js +135 -0
  218. package/dist/src/tools/registry.js.map +1 -0
  219. package/package.json +63 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Team — multi-agent collaboration unit.
3
+ *
4
+ * A team owns agents, a shared memory, a message bus, and a task queue.
5
+ * The Orchestrator uses teams to decompose and execute complex goals.
6
+ */
7
+ import { AgentPool } from './agent-pool.js';
8
+ import { MessageBus } from '../communication/message-bus.js';
9
+ import { SharedMemory } from '../communication/shared-memory.js';
10
+ import { TaskQueue } from '../communication/task-queue.js';
11
+ import { selectAgent } from '../scheduling/strategies.js';
12
+ const ZERO_USAGE = { input_tokens: 0, output_tokens: 0 };
13
+ export class Team {
14
+ config;
15
+ messageBus;
16
+ sharedMemory;
17
+ taskQueue;
18
+ pool;
19
+ taskCounter = 0;
20
+ onProgress;
21
+ constructor(config, adapter, toolRegistry, cwd, permissionManager) {
22
+ this.config = config;
23
+ this.messageBus = new MessageBus();
24
+ this.sharedMemory = new SharedMemory();
25
+ this.taskQueue = new TaskQueue();
26
+ this.pool = new AgentPool(adapter, toolRegistry, {
27
+ maxConcurrency: config.maxConcurrency ?? 2,
28
+ cwd,
29
+ }, permissionManager);
30
+ // Initialize agents in the pool
31
+ for (const agentConfig of config.agents) {
32
+ this.pool.getOrCreate(agentConfig);
33
+ }
34
+ }
35
+ /** Set a progress callback for orchestration events. */
36
+ setProgressHandler(handler) {
37
+ this.onProgress = handler;
38
+ }
39
+ /**
40
+ * Run a goal by decomposing it into tasks and assigning to agents.
41
+ * The first agent in the config is the "planner" that decomposes the goal.
42
+ */
43
+ async run(goal) {
44
+ const agentResults = new Map();
45
+ let totalUsage = ZERO_USAGE;
46
+ // If only one agent, just run it directly
47
+ if (this.config.agents.length === 1) {
48
+ const agentName = this.config.agents[0].name;
49
+ this.emit({ type: 'agent_start', agent: agentName });
50
+ const result = await this.pool.runTask(agentName, goal);
51
+ agentResults.set(agentName, result);
52
+ totalUsage = addUsage(totalUsage, result.tokenUsage);
53
+ this.emit({ type: 'agent_complete', agent: agentName });
54
+ return {
55
+ success: result.success,
56
+ agentResults,
57
+ totalTokenUsage: totalUsage,
58
+ };
59
+ }
60
+ // Multi-agent: run each agent's specialty in dependency order
61
+ // Create one task per agent with the goal
62
+ const tasks = this.config.agents.map((agent, i) => ({
63
+ id: `task-${++this.taskCounter}`,
64
+ title: `${agent.name}: ${goal.slice(0, 80)}`,
65
+ description: goal,
66
+ status: 'pending',
67
+ assignee: agent.name,
68
+ dependsOn: i > 0 ? [`task-${this.taskCounter - 1}`] : undefined,
69
+ createdAt: new Date(),
70
+ updatedAt: new Date(),
71
+ }));
72
+ this.taskQueue.addAll(tasks);
73
+ // Execute in topological order
74
+ const sorted = this.taskQueue.topologicalSort();
75
+ for (const taskId of sorted) {
76
+ const task = this.taskQueue.get(taskId);
77
+ if (!task || task.status === 'failed')
78
+ continue;
79
+ const agentName = task.assignee ?? this.selectAgent(task);
80
+ this.taskQueue.start(taskId);
81
+ this.emit({ type: 'task_start', task: taskId, agent: agentName });
82
+ this.emit({ type: 'agent_start', agent: agentName });
83
+ try {
84
+ // Build a context-aware prompt including shared memory
85
+ const contextEntries = await this.sharedMemory.list();
86
+ let prompt = task.description;
87
+ if (contextEntries.length > 0) {
88
+ const memoryContext = contextEntries
89
+ .map(e => `[${e.key}]: ${e.value}`)
90
+ .join('\n');
91
+ prompt = `Previous agent context:\n${memoryContext}\n\nTask: ${task.description}`;
92
+ }
93
+ const result = await this.pool.runTask(agentName, prompt);
94
+ agentResults.set(agentName, result);
95
+ totalUsage = addUsage(totalUsage, result.tokenUsage);
96
+ // Store result in shared memory for downstream agents
97
+ await this.sharedMemory.set(`${agentName}-output`, result.output.slice(0, 2000), { agent: agentName, task: taskId });
98
+ this.taskQueue.complete(taskId, result.output.slice(0, 500));
99
+ this.emit({ type: 'agent_complete', agent: agentName });
100
+ this.emit({ type: 'task_complete', task: taskId, agent: agentName });
101
+ }
102
+ catch (err) {
103
+ const error = err instanceof Error ? err : new Error(String(err));
104
+ this.taskQueue.fail(taskId, error);
105
+ this.emit({ type: 'error', agent: agentName, task: taskId, data: error.message });
106
+ agentResults.set(agentName, {
107
+ success: false,
108
+ output: error.message,
109
+ messages: [],
110
+ tokenUsage: ZERO_USAGE,
111
+ toolCalls: [],
112
+ });
113
+ }
114
+ }
115
+ const summary = this.taskQueue.summary();
116
+ return {
117
+ success: summary.failed === 0,
118
+ agentResults,
119
+ totalTokenUsage: totalUsage,
120
+ };
121
+ }
122
+ /** Select the best agent for a task using the configured strategy. */
123
+ selectAgent(task) {
124
+ const strategy = this.config.schedulingStrategy ?? 'capability-match';
125
+ const loads = this.pool.getLoads().map(l => ({
126
+ name: l.name,
127
+ activeTasks: l.status === 'running' ? 1 : 0,
128
+ completedTasks: 0,
129
+ }));
130
+ return selectAgent(strategy, this.config.agents, task, {
131
+ counter: this.taskCounter,
132
+ loads,
133
+ });
134
+ }
135
+ emit(event) {
136
+ this.onProgress?.(event);
137
+ }
138
+ /** Get the agent pool for direct access. */
139
+ getPool() {
140
+ return this.pool;
141
+ }
142
+ /** Get status of all agents and tasks. */
143
+ getStatus() {
144
+ return {
145
+ agents: this.pool.getLoads(),
146
+ tasks: this.taskQueue.summary(),
147
+ };
148
+ }
149
+ }
150
+ function addUsage(a, b) {
151
+ return {
152
+ input_tokens: a.input_tokens + b.input_tokens,
153
+ output_tokens: a.output_tokens + b.output_tokens,
154
+ };
155
+ }
156
+ //# sourceMappingURL=team.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.js","sourceRoot":"","sources":["../../../src/core/team.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAkB,MAAM,6BAA6B,CAAA;AAEzE,MAAM,UAAU,GAAe,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAA;AAEpE,MAAM,OAAO,IAAI;IACN,MAAM,CAAY;IAClB,UAAU,CAAY;IACtB,YAAY,CAA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AC,CAAC,aAAa;KACjD,CAAA;AACH,CAAC"}
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Core type definitions for cmdr.
3
+ *
4
+ * All public types are defined here to keep the dependency graph acyclic.
5
+ */
6
+ import type { ZodSchema } from 'zod';
7
+ export interface TextBlock {
8
+ readonly type: 'text';
9
+ readonly text: string;
10
+ }
11
+ export interface ToolUseBlock {
12
+ readonly type: 'tool_use';
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly input: Record<string, unknown>;
16
+ }
17
+ export interface ToolResultBlock {
18
+ readonly type: 'tool_result';
19
+ readonly tool_use_id: string;
20
+ readonly content: string;
21
+ readonly is_error?: boolean;
22
+ }
23
+ export type ContentBlock = TextBlock | ToolUseBlock | ToolResultBlock;
24
+ export interface LLMMessage {
25
+ readonly role: 'user' | 'assistant';
26
+ readonly content: ContentBlock[];
27
+ }
28
+ export interface TokenUsage {
29
+ readonly input_tokens: number;
30
+ readonly output_tokens: number;
31
+ }
32
+ export interface LLMResponse {
33
+ readonly id: string;
34
+ readonly content: ContentBlock[];
35
+ readonly model: string;
36
+ readonly stop_reason: string;
37
+ readonly usage: TokenUsage;
38
+ }
39
+ export interface StreamEvent {
40
+ readonly type: 'text' | 'tool_use' | 'tool_result' | 'done' | 'error';
41
+ readonly data: unknown;
42
+ }
43
+ export interface LLMToolDef {
44
+ readonly name: string;
45
+ readonly description: string;
46
+ readonly inputSchema: Record<string, unknown>;
47
+ }
48
+ export interface ToolUseContext {
49
+ readonly agent: AgentInfo;
50
+ readonly team?: TeamInfo;
51
+ readonly abortSignal?: AbortSignal;
52
+ readonly abortController?: AbortController;
53
+ readonly cwd?: string;
54
+ readonly metadata?: Readonly<Record<string, unknown>>;
55
+ }
56
+ export interface AgentInfo {
57
+ readonly name: string;
58
+ readonly role: string;
59
+ readonly model: string;
60
+ }
61
+ export interface TeamInfo {
62
+ readonly name: string;
63
+ readonly agents: readonly string[];
64
+ readonly sharedMemory: MemoryStore;
65
+ }
66
+ export interface ToolResult {
67
+ readonly data: string;
68
+ readonly isError?: boolean;
69
+ }
70
+ export interface ToolDefinition<TInput = Record<string, unknown>> {
71
+ readonly name: string;
72
+ readonly description: string;
73
+ readonly inputSchema: ZodSchema<TInput>;
74
+ execute(input: TInput, context: ToolUseContext): Promise<ToolResult>;
75
+ }
76
+ export interface AgentConfig {
77
+ readonly name: string;
78
+ readonly model?: string;
79
+ readonly provider?: 'ollama' | 'openai' | 'anthropic';
80
+ readonly systemPrompt?: string;
81
+ readonly tools?: readonly string[];
82
+ readonly maxTurns?: number;
83
+ readonly maxTokens?: number;
84
+ readonly temperature?: number;
85
+ }
86
+ export interface AgentState {
87
+ status: 'idle' | 'running' | 'completed' | 'error';
88
+ messages: LLMMessage[];
89
+ tokenUsage: TokenUsage;
90
+ error?: Error;
91
+ }
92
+ export interface ToolCallRecord {
93
+ readonly toolName: string;
94
+ readonly input: Record<string, unknown>;
95
+ readonly output: string;
96
+ readonly duration: number;
97
+ }
98
+ export interface AgentRunResult {
99
+ readonly success: boolean;
100
+ readonly output: string;
101
+ readonly messages: LLMMessage[];
102
+ readonly tokenUsage: TokenUsage;
103
+ readonly toolCalls: ToolCallRecord[];
104
+ }
105
+ export interface TeamConfig {
106
+ readonly name: string;
107
+ readonly agents: readonly AgentConfig[];
108
+ readonly sharedMemory?: boolean;
109
+ readonly maxConcurrency?: number;
110
+ readonly schedulingStrategy?: 'round-robin' | 'least-busy' | 'capability-match' | 'dependency-first';
111
+ }
112
+ export interface TeamRunResult {
113
+ readonly success: boolean;
114
+ readonly agentResults: Map<string, AgentRunResult>;
115
+ readonly totalTokenUsage: TokenUsage;
116
+ }
117
+ export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'blocked';
118
+ export interface Task {
119
+ readonly id: string;
120
+ readonly title: string;
121
+ readonly description: string;
122
+ status: TaskStatus;
123
+ assignee?: string;
124
+ dependsOn?: readonly string[];
125
+ result?: string;
126
+ readonly createdAt: Date;
127
+ updatedAt: Date;
128
+ }
129
+ export interface SessionState {
130
+ id: string;
131
+ messages: LLMMessage[];
132
+ tokenCount: number;
133
+ maxContextTokens: number;
134
+ projectContext: ProjectContext;
135
+ createdAt: Date;
136
+ lastActivity: Date;
137
+ }
138
+ export interface ProjectContext {
139
+ rootDir: string;
140
+ language: string;
141
+ framework?: string;
142
+ packageManager?: string;
143
+ gitBranch?: string;
144
+ relevantFiles: string[];
145
+ /** Contents of CMDR.md from the project root, if present. */
146
+ cmdrInstructions?: string;
147
+ }
148
+ export interface CmdrPlugin {
149
+ name: string;
150
+ version: string;
151
+ hooks?: {
152
+ beforePrompt?: (params: LLMChatOptions) => LLMChatOptions | Promise<LLMChatOptions>;
153
+ afterResponse?: (result: LLMResponse) => LLMResponse | Promise<LLMResponse>;
154
+ beforeToolExec?: (tool: string, input: unknown) => unknown | Promise<unknown>;
155
+ afterToolExec?: (tool: string, result: ToolResult) => ToolResult | Promise<ToolResult>;
156
+ onError?: (error: Error) => void | Promise<void>;
157
+ onSessionStart?: (session: SessionState) => void | Promise<void>;
158
+ onSessionEnd?: (session: SessionState) => void | Promise<void>;
159
+ };
160
+ tools?: ToolDefinition[];
161
+ commands?: SlashCommand[];
162
+ }
163
+ export interface SlashCommand {
164
+ name: string;
165
+ description: string;
166
+ execute: (args: string, context: CommandContext) => Promise<string | void>;
167
+ }
168
+ export interface CommandContext {
169
+ session: SessionState;
170
+ switchModel: (model: string) => void;
171
+ clearHistory: () => void;
172
+ ollamaUrl: string;
173
+ adapter: LLMAdapter;
174
+ model: string;
175
+ agentTokenUsage: TokenUsage;
176
+ permissionManager?: import('./permissions.js').PermissionManager;
177
+ }
178
+ /** Permission mode controls how tool calls are approved. */
179
+ export type PermissionMode = 'normal' | 'yolo' | 'strict';
180
+ /** Tools classified as read-only are auto-approved in 'normal' mode. */
181
+ export type ToolRiskLevel = 'read-only' | 'write' | 'dangerous';
182
+ /**
183
+ * User's approval decision for a tool call.
184
+ * - 'allow' — run this one call
185
+ * - 'deny' — skip this call, return an error to the model
186
+ * - 'allow-always' — auto-approve all future calls to this tool for the session
187
+ */
188
+ export type ApprovalDecision = 'allow' | 'deny' | 'allow-always';
189
+ /**
190
+ * Callback the REPL provides so the runner can ask for user approval
191
+ * before executing a dangerous / write tool.
192
+ */
193
+ export type ApprovalCallback = (toolName: string, input: Record<string, unknown>, riskLevel: ToolRiskLevel) => Promise<ApprovalDecision>;
194
+ export interface CmdrConfig {
195
+ ollamaUrl: string;
196
+ defaultModel: string;
197
+ defaultProvider: 'ollama' | 'openai' | 'anthropic';
198
+ maxConcurrency: number;
199
+ contextBudget: number;
200
+ autoCompact: boolean;
201
+ permissions: {
202
+ allowBash: boolean;
203
+ allowFileWrite: boolean;
204
+ allowNetwork: boolean;
205
+ sandboxDir?: string;
206
+ };
207
+ mcp: {
208
+ servers: McpServerConfig[];
209
+ };
210
+ plugins: string[];
211
+ }
212
+ export interface McpServerConfig {
213
+ name: string;
214
+ url: string;
215
+ apiKey?: string;
216
+ }
217
+ export interface MemoryEntry {
218
+ readonly key: string;
219
+ readonly value: string;
220
+ readonly metadata?: Readonly<Record<string, unknown>>;
221
+ readonly createdAt: Date;
222
+ }
223
+ export interface MemoryStore {
224
+ get(key: string): Promise<MemoryEntry | null>;
225
+ set(key: string, value: string, metadata?: Record<string, unknown>): Promise<void>;
226
+ list(): Promise<MemoryEntry[]>;
227
+ delete(key: string): Promise<void>;
228
+ clear(): Promise<void>;
229
+ }
230
+ export interface LLMChatOptions {
231
+ readonly model: string;
232
+ readonly tools?: readonly LLMToolDef[];
233
+ readonly maxTokens?: number;
234
+ readonly temperature?: number;
235
+ readonly systemPrompt?: string;
236
+ readonly abortSignal?: AbortSignal;
237
+ }
238
+ export interface LLMStreamOptions extends LLMChatOptions {
239
+ }
240
+ export interface LLMAdapter {
241
+ readonly name: string;
242
+ chat(messages: LLMMessage[], options: LLMChatOptions): Promise<LLMResponse>;
243
+ stream(messages: LLMMessage[], options: LLMStreamOptions): AsyncIterable<StreamEvent>;
244
+ }
245
+ export interface OrchestratorEvent {
246
+ readonly type: 'agent_start' | 'agent_complete' | 'task_start' | 'task_complete' | 'message' | 'error';
247
+ readonly agent?: string;
248
+ readonly task?: string;
249
+ readonly data?: unknown;
250
+ }
251
+ export interface OrchestratorConfig {
252
+ readonly maxConcurrency?: number;
253
+ readonly defaultModel?: string;
254
+ readonly defaultProvider?: 'ollama' | 'openai' | 'anthropic';
255
+ onProgress?: (event: OrchestratorEvent) => void;
256
+ }
257
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAMpC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,eAAe,CAAA;AAMrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAA;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CAAA;IACX,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAA;IAC5D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;CAChD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Core type definitions for cmdr.
3
+ *
4
+ * All public types are defined here to keep the dependency graph acyclic.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * cmdr — public API exports.
3
+ *
4
+ * Import from 'cmdr-agent' for programmatic usage.
5
+ */
6
+ export { Agent } from './core/agent.js';
7
+ export { AgentRunner } from './core/agent-runner.js';
8
+ export { AgentPool } from './core/agent-pool.js';
9
+ export { Team } from './core/team.js';
10
+ export { Orchestrator } from './core/orchestrator.js';
11
+ export { SOLO_CODER, CODE_REVIEW_TEAM, FULL_STACK_TEAM, SECURITY_AUDIT_TEAM, getPreset, getTeamPreset, listTeamPresets, } from './core/presets.js';
12
+ export type { AgentConfig, AgentState, AgentRunResult, LLMAdapter, LLMMessage, LLMResponse, LLMChatOptions, StreamEvent, ContentBlock, TextBlock, ToolUseBlock, ToolResultBlock, TokenUsage, ToolCallRecord, ToolDefinition, ToolResult, ToolUseContext, TeamConfig, TeamRunResult, Task, TaskStatus, SessionState, ProjectContext, CmdrPlugin, SlashCommand, CmdrConfig, OrchestratorConfig, OrchestratorEvent, } from './core/types.js';
13
+ export { MessageBus } from './communication/message-bus.js';
14
+ export type { BusMessage } from './communication/message-bus.js';
15
+ export { SharedMemory } from './communication/shared-memory.js';
16
+ export { TaskQueue } from './communication/task-queue.js';
17
+ export { Semaphore } from './scheduling/semaphore.js';
18
+ export { selectAgent } from './scheduling/strategies.js';
19
+ export type { SchedulingStrategy } from './scheduling/strategies.js';
20
+ export { defineTool, ToolRegistry, zodToJsonSchema } from './tools/registry.js';
21
+ export { ToolExecutor } from './tools/executor.js';
22
+ export { registerBuiltInTools, BUILT_IN_TOOLS } from './tools/built-in/index.js';
23
+ export { OllamaAdapter } from './llm/ollama.js';
24
+ export { getModelInfo, getDefaultContextLength, getRecommendedModel } from './llm/model-registry.js';
25
+ export { countTokens, countMessageTokens } from './llm/token-counter.js';
26
+ export { SessionManager } from './session/session-manager.js';
27
+ export { discoverProject } from './session/project-context.js';
28
+ export { buildSystemPrompt } from './session/prompt-builder.js';
29
+ export { compactHistory, shouldCompact, DEFAULT_COMPACTION_CONFIG } from './session/compaction.js';
30
+ export type { CompactionConfig } from './session/compaction.js';
31
+ export { saveSession, loadSession, listSessions, findRecentSession, DebouncedSaver } from './session/session-persistence.js';
32
+ export type { SavedSession } from './session/session-persistence.js';
33
+ export { CostTracker } from './session/cost-tracker.js';
34
+ export type { CostEntry, CostSummary } from './session/cost-tracker.js';
35
+ export { UndoManager } from './session/undo-manager.js';
36
+ export type { FileChange } from './session/undo-manager.js';
37
+ export { PluginManager } from './plugins/plugin-manager.js';
38
+ export { McpClient } from './plugins/mcp-client.js';
39
+ export { loadConfig, getUserConfigPath, getProjectConfigPath } from './config/config-loader.js';
40
+ export { DEFAULT_CONFIG } from './config/defaults.js';
41
+ export { Telemetry } from './config/telemetry.js';
42
+ export type { TelemetryEvent } from './config/telemetry.js';
43
+ export { startRepl } from './cli/repl.js';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+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E,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * cmdr — public API exports.
3
+ *
4
+ * Import from 'cmdr-agent' for programmatic usage.
5
+ */
6
+ // Core
7
+ export { Agent } from './core/agent.js';
8
+ export { AgentRunner } from './core/agent-runner.js';
9
+ export { AgentPool } from './core/agent-pool.js';
10
+ export { Team } from './core/team.js';
11
+ export { Orchestrator } from './core/orchestrator.js';
12
+ export { SOLO_CODER, CODE_REVIEW_TEAM, FULL_STACK_TEAM, SECURITY_AUDIT_TEAM, getPreset, getTeamPreset, listTeamPresets, } from './core/presets.js';
13
+ // Communication
14
+ export { MessageBus } from './communication/message-bus.js';
15
+ export { SharedMemory } from './communication/shared-memory.js';
16
+ export { TaskQueue } from './communication/task-queue.js';
17
+ // Scheduling
18
+ export { Semaphore } from './scheduling/semaphore.js';
19
+ export { selectAgent } from './scheduling/strategies.js';
20
+ // Tools
21
+ export { defineTool, ToolRegistry, zodToJsonSchema } from './tools/registry.js';
22
+ export { ToolExecutor } from './tools/executor.js';
23
+ export { registerBuiltInTools, BUILT_IN_TOOLS } from './tools/built-in/index.js';
24
+ // LLM
25
+ export { OllamaAdapter } from './llm/ollama.js';
26
+ export { getModelInfo, getDefaultContextLength, getRecommendedModel } from './llm/model-registry.js';
27
+ export { countTokens, countMessageTokens } from './llm/token-counter.js';
28
+ // Session
29
+ export { SessionManager } from './session/session-manager.js';
30
+ export { discoverProject } from './session/project-context.js';
31
+ export { buildSystemPrompt } from './session/prompt-builder.js';
32
+ export { compactHistory, shouldCompact, DEFAULT_COMPACTION_CONFIG } from './session/compaction.js';
33
+ export { saveSession, loadSession, listSessions, findRecentSession, DebouncedSaver } from './session/session-persistence.js';
34
+ export { CostTracker } from './session/cost-tracker.js';
35
+ export { UndoManager } from './session/undo-manager.js';
36
+ // Plugins & MCP
37
+ export { PluginManager } from './plugins/plugin-manager.js';
38
+ export { McpClient } from './plugins/mcp-client.js';
39
+ // Config
40
+ export { loadConfig, getUserConfigPath, getProjectConfigPath } from './config/config-loader.js';
41
+ export { DEFAULT_CONFIG } from './config/defaults.js';
42
+ export { Telemetry } from './config/telemetry.js';
43
+ // CLI
44
+ export { startRepl } from './cli/repl.js';
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO;AACP,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAClE,SAAS,EAAE,aAAa,EAAE,eAAe,GAC1C,MAAM,mBAAmB,CAAA;AAa1B,gBAAgB;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAEzD,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,QAAQ;AACR,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAEhF,MAAM;AACN,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AACpG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAExE,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAElG,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAE5H,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAGvD,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,SAAS;AACT,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGjD,MAAM;AACN,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * LLM Adapter interface — re-exported from types for convenience.
3
+ */
4
+ export type { LLMAdapter, LLMChatOptions, LLMStreamOptions, LLMMessage, LLMResponse, StreamEvent, LLMToolDef, TokenUsage, } from '../core/types.js';
5
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/llm/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,GACX,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * LLM Adapter interface — re-exported from types for convenience.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/llm/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Model registry — known models and their capabilities.
3
+ */
4
+ export interface ModelInfo {
5
+ name: string;
6
+ contextLength: number;
7
+ supportsTools: boolean;
8
+ parameterSize: string;
9
+ recommended: 'lightweight' | 'midrange' | 'heavy';
10
+ }
11
+ export declare function getModelInfo(name: string): ModelInfo | undefined;
12
+ export declare function getDefaultContextLength(model: string): number;
13
+ export declare function getRecommendedModel(tier: 'lightweight' | 'midrange' | 'heavy'): string;
14
+ //# sourceMappingURL=model-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../src/llm/model-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;CAClD;AAkBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEhE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAGtF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Model registry — known models and their capabilities.
3
+ */
4
+ const KNOWN_MODELS = [
5
+ { name: 'qwen2.5-coder:7b', contextLength: 32768, supportsTools: true, parameterSize: '7B', recommended: 'lightweight' },
6
+ { name: 'qwen2.5-coder:14b', contextLength: 32768, supportsTools: true, parameterSize: '14B', recommended: 'midrange' },
7
+ { name: 'qwen2.5-coder:32b', contextLength: 32768, supportsTools: true, parameterSize: '32B', recommended: 'heavy' },
8
+ { name: 'qwen3-coder:latest', contextLength: 65536, supportsTools: true, parameterSize: '30.5B', recommended: 'heavy' },
9
+ { name: 'qwen2.5:7b', contextLength: 32768, supportsTools: true, parameterSize: '7B', recommended: 'lightweight' },
10
+ { name: 'qwen2.5:14b', contextLength: 32768, supportsTools: true, parameterSize: '14B', recommended: 'midrange' },
11
+ { name: 'qwen2.5:32b', contextLength: 32768, supportsTools: true, parameterSize: '32B', recommended: 'heavy' },
12
+ { name: 'llama3.1:8b', contextLength: 131072, supportsTools: true, parameterSize: '8B', recommended: 'lightweight' },
13
+ { name: 'llama3.1:70b', contextLength: 131072, supportsTools: true, parameterSize: '70B', recommended: 'heavy' },
14
+ { name: 'llama3.2:3b', contextLength: 131072, supportsTools: true, parameterSize: '3B', recommended: 'lightweight' },
15
+ { name: 'mistral-nemo:12b', contextLength: 128000, supportsTools: true, parameterSize: '12B', recommended: 'midrange' },
16
+ { name: 'deepseek-coder-v2:16b', contextLength: 65536, supportsTools: false, parameterSize: '16B', recommended: 'midrange' },
17
+ { name: 'codellama:34b', contextLength: 16384, supportsTools: false, parameterSize: '34B', recommended: 'heavy' },
18
+ ];
19
+ export function getModelInfo(name) {
20
+ return KNOWN_MODELS.find(m => m.name === name || name.startsWith(m.name.split(':')[0]));
21
+ }
22
+ export function getDefaultContextLength(model) {
23
+ const info = getModelInfo(model);
24
+ return info?.contextLength ?? 8192;
25
+ }
26
+ export function getRecommendedModel(tier) {
27
+ const model = KNOWN_MODELS.find(m => m.recommended === tier && m.name.includes('coder'));
28
+ return model?.name ?? 'qwen2.5-coder:14b';
29
+ }
30
+ //# sourceMappingURL=model-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../../src/llm/model-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,MAAM,YAAY,GAAgB;IAChC,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE;IACxH,EAAE,IAAI,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE;IACvH,EAAE,IAAI,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;IACpH,EAAE,IAAI,EAAE,oBAAoB,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE;IACvH,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE;IAClH,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE;IACjH,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE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