monty-autonomous-fullstack-dev-multillm 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 (186) hide show
  1. package/LICENSE +81 -0
  2. package/README.md +608 -0
  3. package/bin/cli.js +448 -0
  4. package/dist/agents/coding.d.ts +15 -0
  5. package/dist/agents/coding.d.ts.map +1 -0
  6. package/dist/agents/coding.js +189 -0
  7. package/dist/agents/coding.js.map +1 -0
  8. package/dist/agents/initializer.d.ts +15 -0
  9. package/dist/agents/initializer.d.ts.map +1 -0
  10. package/dist/agents/initializer.js +87 -0
  11. package/dist/agents/initializer.js.map +1 -0
  12. package/dist/agents/prompts/arbitrator.md +143 -0
  13. package/dist/agents/prompts/coding.md +247 -0
  14. package/dist/agents/prompts/initializer.md +98 -0
  15. package/dist/config/agent-config.d.ts +103 -0
  16. package/dist/config/agent-config.d.ts.map +1 -0
  17. package/dist/config/agent-config.js +138 -0
  18. package/dist/config/agent-config.js.map +1 -0
  19. package/dist/config/auth-config.d.ts +152 -0
  20. package/dist/config/auth-config.d.ts.map +1 -0
  21. package/dist/config/auth-config.js +139 -0
  22. package/dist/config/auth-config.js.map +1 -0
  23. package/dist/config/mcp-config.d.ts +109 -0
  24. package/dist/config/mcp-config.d.ts.map +1 -0
  25. package/dist/config/mcp-config.js +234 -0
  26. package/dist/config/mcp-config.js.map +1 -0
  27. package/dist/config/provider-config.d.ts +139 -0
  28. package/dist/config/provider-config.d.ts.map +1 -0
  29. package/dist/config/provider-config.js +344 -0
  30. package/dist/config/provider-config.js.map +1 -0
  31. package/dist/config/subagents-config.d.ts +85 -0
  32. package/dist/config/subagents-config.d.ts.map +1 -0
  33. package/dist/config/subagents-config.js +430 -0
  34. package/dist/config/subagents-config.js.map +1 -0
  35. package/dist/index.d.ts +14 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +385 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/orchestrator/arbitrator.d.ts +93 -0
  40. package/dist/orchestrator/arbitrator.d.ts.map +1 -0
  41. package/dist/orchestrator/arbitrator.js +330 -0
  42. package/dist/orchestrator/arbitrator.js.map +1 -0
  43. package/dist/orchestrator/index.d.ts +113 -0
  44. package/dist/orchestrator/index.d.ts.map +1 -0
  45. package/dist/orchestrator/index.js +217 -0
  46. package/dist/orchestrator/index.js.map +1 -0
  47. package/dist/orchestrator/review-coordinator.d.ts +143 -0
  48. package/dist/orchestrator/review-coordinator.d.ts.map +1 -0
  49. package/dist/orchestrator/review-coordinator.js +401 -0
  50. package/dist/orchestrator/review-coordinator.js.map +1 -0
  51. package/dist/orchestrator/task-classifier.d.ts +87 -0
  52. package/dist/orchestrator/task-classifier.d.ts.map +1 -0
  53. package/dist/orchestrator/task-classifier.js +250 -0
  54. package/dist/orchestrator/task-classifier.js.map +1 -0
  55. package/dist/providers/anthropic-provider.d.ts +64 -0
  56. package/dist/providers/anthropic-provider.d.ts.map +1 -0
  57. package/dist/providers/anthropic-provider.js +264 -0
  58. package/dist/providers/anthropic-provider.js.map +1 -0
  59. package/dist/providers/base-provider.d.ts +219 -0
  60. package/dist/providers/base-provider.d.ts.map +1 -0
  61. package/dist/providers/base-provider.js +143 -0
  62. package/dist/providers/base-provider.js.map +1 -0
  63. package/dist/providers/cursor-provider.d.ts +82 -0
  64. package/dist/providers/cursor-provider.d.ts.map +1 -0
  65. package/dist/providers/cursor-provider.js +321 -0
  66. package/dist/providers/cursor-provider.js.map +1 -0
  67. package/dist/providers/google-provider.d.ts +75 -0
  68. package/dist/providers/google-provider.d.ts.map +1 -0
  69. package/dist/providers/google-provider.js +274 -0
  70. package/dist/providers/google-provider.js.map +1 -0
  71. package/dist/providers/index.d.ts +92 -0
  72. package/dist/providers/index.d.ts.map +1 -0
  73. package/dist/providers/index.js +233 -0
  74. package/dist/providers/index.js.map +1 -0
  75. package/dist/providers/openai-provider.d.ts +83 -0
  76. package/dist/providers/openai-provider.d.ts.map +1 -0
  77. package/dist/providers/openai-provider.js +295 -0
  78. package/dist/providers/openai-provider.js.map +1 -0
  79. package/dist/templates/feature_list.template.json +66 -0
  80. package/dist/templates/progress.template.txt +51 -0
  81. package/dist/utils/auth-manager.d.ts +121 -0
  82. package/dist/utils/auth-manager.d.ts.map +1 -0
  83. package/dist/utils/auth-manager.js +560 -0
  84. package/dist/utils/auth-manager.js.map +1 -0
  85. package/dist/utils/budget-enforcer.d.ts +181 -0
  86. package/dist/utils/budget-enforcer.d.ts.map +1 -0
  87. package/dist/utils/budget-enforcer.js +386 -0
  88. package/dist/utils/budget-enforcer.js.map +1 -0
  89. package/dist/utils/chatgpt-detector.d.ts +51 -0
  90. package/dist/utils/chatgpt-detector.d.ts.map +1 -0
  91. package/dist/utils/chatgpt-detector.js +274 -0
  92. package/dist/utils/chatgpt-detector.js.map +1 -0
  93. package/dist/utils/claude-code-detector.d.ts +39 -0
  94. package/dist/utils/claude-code-detector.d.ts.map +1 -0
  95. package/dist/utils/claude-code-detector.js +153 -0
  96. package/dist/utils/claude-code-detector.js.map +1 -0
  97. package/dist/utils/code-quality.d.ts +58 -0
  98. package/dist/utils/code-quality.d.ts.map +1 -0
  99. package/dist/utils/code-quality.js +258 -0
  100. package/dist/utils/code-quality.js.map +1 -0
  101. package/dist/utils/context-primer.d.ts +50 -0
  102. package/dist/utils/context-primer.d.ts.map +1 -0
  103. package/dist/utils/context-primer.js +429 -0
  104. package/dist/utils/context-primer.js.map +1 -0
  105. package/dist/utils/dependency-management.d.ts +40 -0
  106. package/dist/utils/dependency-management.d.ts.map +1 -0
  107. package/dist/utils/dependency-management.js +123 -0
  108. package/dist/utils/dependency-management.js.map +1 -0
  109. package/dist/utils/environment-validation.d.ts +33 -0
  110. package/dist/utils/environment-validation.d.ts.map +1 -0
  111. package/dist/utils/environment-validation.js +136 -0
  112. package/dist/utils/environment-validation.js.map +1 -0
  113. package/dist/utils/error-recovery.d.ts +60 -0
  114. package/dist/utils/error-recovery.d.ts.map +1 -0
  115. package/dist/utils/error-recovery.js +183 -0
  116. package/dist/utils/error-recovery.js.map +1 -0
  117. package/dist/utils/feature-list.d.ts +102 -0
  118. package/dist/utils/feature-list.d.ts.map +1 -0
  119. package/dist/utils/feature-list.js +191 -0
  120. package/dist/utils/feature-list.js.map +1 -0
  121. package/dist/utils/gemini-detector.d.ts +65 -0
  122. package/dist/utils/gemini-detector.d.ts.map +1 -0
  123. package/dist/utils/gemini-detector.js +340 -0
  124. package/dist/utils/gemini-detector.js.map +1 -0
  125. package/dist/utils/git-utils.d.ts +48 -0
  126. package/dist/utils/git-utils.d.ts.map +1 -0
  127. package/dist/utils/git-utils.js +110 -0
  128. package/dist/utils/git-utils.js.map +1 -0
  129. package/dist/utils/health-check.d.ts +32 -0
  130. package/dist/utils/health-check.d.ts.map +1 -0
  131. package/dist/utils/health-check.js +152 -0
  132. package/dist/utils/health-check.js.map +1 -0
  133. package/dist/utils/hooks-manager.d.ts +154 -0
  134. package/dist/utils/hooks-manager.d.ts.map +1 -0
  135. package/dist/utils/hooks-manager.js +359 -0
  136. package/dist/utils/hooks-manager.js.map +1 -0
  137. package/dist/utils/multi-auth-manager.d.ts +144 -0
  138. package/dist/utils/multi-auth-manager.d.ts.map +1 -0
  139. package/dist/utils/multi-auth-manager.js +588 -0
  140. package/dist/utils/multi-auth-manager.js.map +1 -0
  141. package/dist/utils/progress.d.ts +49 -0
  142. package/dist/utils/progress.d.ts.map +1 -0
  143. package/dist/utils/progress.js +209 -0
  144. package/dist/utils/progress.js.map +1 -0
  145. package/dist/utils/project-detection.d.ts +40 -0
  146. package/dist/utils/project-detection.d.ts.map +1 -0
  147. package/dist/utils/project-detection.js +230 -0
  148. package/dist/utils/project-detection.js.map +1 -0
  149. package/dist/utils/session-manager.d.ts +119 -0
  150. package/dist/utils/session-manager.d.ts.map +1 -0
  151. package/dist/utils/session-manager.js +389 -0
  152. package/dist/utils/session-manager.js.map +1 -0
  153. package/dist/utils/skills-manager.d.ts +113 -0
  154. package/dist/utils/skills-manager.d.ts.map +1 -0
  155. package/dist/utils/skills-manager.js +332 -0
  156. package/dist/utils/skills-manager.js.map +1 -0
  157. package/dist/utils/structured-output.d.ts +117 -0
  158. package/dist/utils/structured-output.d.ts.map +1 -0
  159. package/dist/utils/structured-output.js +191 -0
  160. package/dist/utils/structured-output.js.map +1 -0
  161. package/dist/utils/subagent-manager.d.ts +143 -0
  162. package/dist/utils/subagent-manager.d.ts.map +1 -0
  163. package/dist/utils/subagent-manager.js +326 -0
  164. package/dist/utils/subagent-manager.js.map +1 -0
  165. package/dist/utils/supabase-setup.d.ts +50 -0
  166. package/dist/utils/supabase-setup.d.ts.map +1 -0
  167. package/dist/utils/supabase-setup.js +151 -0
  168. package/dist/utils/supabase-setup.js.map +1 -0
  169. package/dist/utils/token-refresh.d.ts +21 -0
  170. package/dist/utils/token-refresh.d.ts.map +1 -0
  171. package/dist/utils/token-refresh.js +77 -0
  172. package/dist/utils/token-refresh.js.map +1 -0
  173. package/dist/utils/tos-warning.d.ts +115 -0
  174. package/dist/utils/tos-warning.d.ts.map +1 -0
  175. package/dist/utils/tos-warning.js +304 -0
  176. package/dist/utils/tos-warning.js.map +1 -0
  177. package/dist/utils/usage-monitor.d.ts +156 -0
  178. package/dist/utils/usage-monitor.d.ts.map +1 -0
  179. package/dist/utils/usage-monitor.js +296 -0
  180. package/dist/utils/usage-monitor.js.map +1 -0
  181. package/package.json +105 -0
  182. package/scripts/init.ps1 +73 -0
  183. package/scripts/init.sh +86 -0
  184. package/scripts/test-auth.sh +90 -0
  185. package/templates/feature_list.template.json +66 -0
  186. package/templates/progress.template.txt +51 -0
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Base Provider Interface
3
+ * Abstract class defining the contract for all AI provider implementations.
4
+ * Enables multi-provider orchestration with consistent API.
5
+ *
6
+ * Copyright (c) 2025 Dobeu Tech Solutions LLC
7
+ * Licensed under CC BY-NC 4.0
8
+ */
9
+ import type { ProviderName } from '../config/provider-config.js';
10
+ /**
11
+ * Content block types for normalized messages
12
+ */
13
+ export interface TextContentBlock {
14
+ type: 'text';
15
+ text: string;
16
+ }
17
+ export interface ToolUseContentBlock {
18
+ type: 'tool_use';
19
+ id: string;
20
+ name: string;
21
+ input: Record<string, unknown>;
22
+ }
23
+ export interface ToolResultContentBlock {
24
+ type: 'tool_result';
25
+ tool_use_id: string;
26
+ content: string;
27
+ is_error?: boolean;
28
+ }
29
+ export type ContentBlock = TextContentBlock | ToolUseContentBlock | ToolResultContentBlock;
30
+ /**
31
+ * Normalized message format across all providers
32
+ */
33
+ export interface AgentMessage {
34
+ type: 'assistant' | 'tool_use' | 'tool_result' | 'result' | 'error';
35
+ subtype?: 'success' | 'error' | 'interrupted' | 'error_during_execution';
36
+ content: ContentBlock[];
37
+ metadata?: {
38
+ provider: ProviderName;
39
+ model?: string;
40
+ usage?: {
41
+ input_tokens: number;
42
+ output_tokens: number;
43
+ };
44
+ latency_ms?: number;
45
+ thread_id?: string;
46
+ [key: string]: unknown;
47
+ };
48
+ }
49
+ /**
50
+ * Query options for provider execution
51
+ */
52
+ export interface QueryOptions {
53
+ /** Allowed tools for this query */
54
+ tools?: string[];
55
+ /** Permission mode for file operations */
56
+ permissionMode?: 'acceptEdits' | 'plan' | 'bypassPermissions' | 'default';
57
+ /** Timeout in milliseconds */
58
+ timeout_ms?: number;
59
+ /** Specific model to use (overrides provider default) */
60
+ model?: string;
61
+ /** Environment variables to pass to subprocess */
62
+ env?: Record<string, string | undefined>;
63
+ /** Maximum turns/iterations */
64
+ maxTurns?: number;
65
+ /** Additional provider-specific options */
66
+ providerOptions?: Record<string, unknown>;
67
+ }
68
+ /**
69
+ * Provider capabilities declaration
70
+ */
71
+ export interface ProviderCapabilities {
72
+ /** Supports streaming responses */
73
+ streaming: boolean;
74
+ /** Supports resumable threads/conversations */
75
+ threads: boolean;
76
+ /** Supports browser automation tools */
77
+ browserAutomation: boolean;
78
+ /** Supports sandboxed code execution */
79
+ codeExecution: boolean;
80
+ /** Supports spawning sub-agents */
81
+ multiAgent: boolean;
82
+ /** Supports function/tool calling */
83
+ toolCalling: boolean;
84
+ /** Supports vision/image input */
85
+ vision: boolean;
86
+ }
87
+ /**
88
+ * Provider status for health checks
89
+ */
90
+ export interface ProviderStatus {
91
+ available: boolean;
92
+ authenticated: boolean;
93
+ rateLimited: boolean;
94
+ lastError?: string;
95
+ lastSuccessfulQuery?: Date;
96
+ }
97
+ /**
98
+ * Model information
99
+ */
100
+ export interface ModelInfo {
101
+ id: string;
102
+ name: string;
103
+ contextWindow: number;
104
+ costPerMToken: {
105
+ input: number;
106
+ output: number;
107
+ };
108
+ capabilities: string[];
109
+ }
110
+ /**
111
+ * Abstract base class for AI providers
112
+ * All provider implementations must extend this class
113
+ */
114
+ export declare abstract class BaseProvider {
115
+ /** Unique provider identifier */
116
+ abstract readonly name: ProviderName;
117
+ /** Human-readable display name */
118
+ abstract readonly displayName: string;
119
+ /** NPM package name (null for REST-only providers) */
120
+ abstract readonly packageName: string | null;
121
+ /** Provider status */
122
+ protected status: ProviderStatus;
123
+ /**
124
+ * Execute a query against this provider
125
+ * Returns an async generator yielding normalized messages
126
+ */
127
+ abstract query(prompt: string, options: QueryOptions): AsyncGenerator<AgentMessage, void, unknown>;
128
+ /**
129
+ * Validate that credentials are configured and valid
130
+ */
131
+ abstract validateCredentials(): Promise<boolean>;
132
+ /**
133
+ * List available models for this provider
134
+ */
135
+ abstract listModels(): Promise<ModelInfo[]>;
136
+ /**
137
+ * Get provider capabilities
138
+ */
139
+ abstract getCapabilities(): ProviderCapabilities;
140
+ /**
141
+ * Get list of supported tool names (in standard format)
142
+ */
143
+ abstract getSupportedTools(): string[];
144
+ /**
145
+ * Map a standard tool name to provider-specific name
146
+ * Returns null if tool is not supported
147
+ */
148
+ abstract mapToolName(standardTool: string): string | null;
149
+ /**
150
+ * Get current provider status
151
+ */
152
+ getStatus(): ProviderStatus;
153
+ /**
154
+ * Check if provider supports threads (resumable conversations)
155
+ */
156
+ supportsThreads(): boolean;
157
+ /**
158
+ * Check if provider supports browser automation
159
+ */
160
+ supportsBrowserAutomation(): boolean;
161
+ /**
162
+ * Check if provider supports sandboxed code execution
163
+ */
164
+ supportsCodeExecution(): boolean;
165
+ /**
166
+ * Check if provider supports multi-agent workflows
167
+ */
168
+ supportsMultiAgent(): boolean;
169
+ /**
170
+ * Resume a previous thread/conversation (if supported)
171
+ * Override in providers that support threads
172
+ */
173
+ resumeThread(_threadId: string): Promise<boolean>;
174
+ /**
175
+ * Get the current thread ID (if in a threaded conversation)
176
+ * Override in providers that support threads
177
+ */
178
+ getCurrentThreadId(): string | null;
179
+ /**
180
+ * Normalize provider-specific message to standard format
181
+ * Subclasses should implement this based on their response format
182
+ */
183
+ protected abstract normalizeMessage(rawMessage: unknown): AgentMessage;
184
+ /**
185
+ * Filter tools based on provider capabilities
186
+ * Returns only tools that this provider supports
187
+ */
188
+ filterSupportedTools(requestedTools: string[]): string[];
189
+ /**
190
+ * Map multiple standard tool names to provider-specific names
191
+ */
192
+ mapToolNames(standardTools: string[]): string[];
193
+ /**
194
+ * Calculate cost for a query based on token usage
195
+ */
196
+ calculateCost(inputTokens: number, outputTokens: number): Promise<number>;
197
+ /**
198
+ * Update provider status after a query
199
+ */
200
+ protected updateStatus(success: boolean, error?: string): void;
201
+ }
202
+ /**
203
+ * Type guard for checking if an object is a valid AgentMessage
204
+ */
205
+ export declare function isAgentMessage(obj: unknown): obj is AgentMessage;
206
+ /**
207
+ * Type guard for text content block
208
+ */
209
+ export declare function isTextContentBlock(block: ContentBlock): block is TextContentBlock;
210
+ /**
211
+ * Type guard for tool use content block
212
+ */
213
+ export declare function isToolUseContentBlock(block: ContentBlock): block is ToolUseContentBlock;
214
+ /**
215
+ * Type guard for tool result content block
216
+ */
217
+ export declare function isToolResultContentBlock(block: ContentBlock): block is ToolResultContentBlock;
218
+ export default BaseProvider;
219
+ //# sourceMappingURL=base-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-provider.d.ts","sourceRoot":"","sources":["../../src/providers/base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,EAAE,OAAO,GAAG,YAAY;IAEtE;;;OAGG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAKxD;;OAEG;IACH,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAM/C;;OAEG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/E;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAa/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,YAAY,CAQhE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,gBAAgB,CAEjF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,mBAAmB,CAEvF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,sBAAsB,CAE7F;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Base Provider Interface
3
+ * Abstract class defining the contract for all AI provider implementations.
4
+ * Enables multi-provider orchestration with consistent API.
5
+ *
6
+ * Copyright (c) 2025 Dobeu Tech Solutions LLC
7
+ * Licensed under CC BY-NC 4.0
8
+ */
9
+ /**
10
+ * Abstract base class for AI providers
11
+ * All provider implementations must extend this class
12
+ */
13
+ export class BaseProvider {
14
+ /** Provider status */
15
+ status = {
16
+ available: false,
17
+ authenticated: false,
18
+ rateLimited: false,
19
+ };
20
+ /**
21
+ * Get current provider status
22
+ */
23
+ getStatus() {
24
+ return { ...this.status };
25
+ }
26
+ /**
27
+ * Check if provider supports threads (resumable conversations)
28
+ */
29
+ supportsThreads() {
30
+ return this.getCapabilities().threads;
31
+ }
32
+ /**
33
+ * Check if provider supports browser automation
34
+ */
35
+ supportsBrowserAutomation() {
36
+ return this.getCapabilities().browserAutomation;
37
+ }
38
+ /**
39
+ * Check if provider supports sandboxed code execution
40
+ */
41
+ supportsCodeExecution() {
42
+ return this.getCapabilities().codeExecution;
43
+ }
44
+ /**
45
+ * Check if provider supports multi-agent workflows
46
+ */
47
+ supportsMultiAgent() {
48
+ return this.getCapabilities().multiAgent;
49
+ }
50
+ /**
51
+ * Resume a previous thread/conversation (if supported)
52
+ * Override in providers that support threads
53
+ */
54
+ async resumeThread(_threadId) {
55
+ if (!this.supportsThreads()) {
56
+ throw new Error(`Provider ${this.name} does not support threads`);
57
+ }
58
+ return false;
59
+ }
60
+ /**
61
+ * Get the current thread ID (if in a threaded conversation)
62
+ * Override in providers that support threads
63
+ */
64
+ getCurrentThreadId() {
65
+ return null;
66
+ }
67
+ /**
68
+ * Filter tools based on provider capabilities
69
+ * Returns only tools that this provider supports
70
+ */
71
+ filterSupportedTools(requestedTools) {
72
+ const supported = this.getSupportedTools();
73
+ return requestedTools.filter(tool => supported.includes(tool));
74
+ }
75
+ /**
76
+ * Map multiple standard tool names to provider-specific names
77
+ */
78
+ mapToolNames(standardTools) {
79
+ return standardTools
80
+ .map(tool => this.mapToolName(tool))
81
+ .filter((tool) => tool !== null);
82
+ }
83
+ /**
84
+ * Calculate cost for a query based on token usage
85
+ */
86
+ async calculateCost(inputTokens, outputTokens) {
87
+ const models = await this.listModels();
88
+ const defaultModel = models[0];
89
+ if (!defaultModel)
90
+ return 0;
91
+ const inputCost = (inputTokens / 1_000_000) * defaultModel.costPerMToken.input;
92
+ const outputCost = (outputTokens / 1_000_000) * defaultModel.costPerMToken.output;
93
+ return inputCost + outputCost;
94
+ }
95
+ /**
96
+ * Update provider status after a query
97
+ */
98
+ updateStatus(success, error) {
99
+ if (success) {
100
+ this.status.available = true;
101
+ this.status.lastSuccessfulQuery = new Date();
102
+ this.status.lastError = undefined;
103
+ this.status.rateLimited = false;
104
+ }
105
+ else {
106
+ this.status.lastError = error;
107
+ if (error?.includes('rate limit')) {
108
+ this.status.rateLimited = true;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * Type guard for checking if an object is a valid AgentMessage
115
+ */
116
+ export function isAgentMessage(obj) {
117
+ if (typeof obj !== 'object' || obj === null)
118
+ return false;
119
+ const msg = obj;
120
+ return (typeof msg.type === 'string' &&
121
+ ['assistant', 'tool_use', 'tool_result', 'result', 'error'].includes(msg.type) &&
122
+ Array.isArray(msg.content));
123
+ }
124
+ /**
125
+ * Type guard for text content block
126
+ */
127
+ export function isTextContentBlock(block) {
128
+ return block.type === 'text';
129
+ }
130
+ /**
131
+ * Type guard for tool use content block
132
+ */
133
+ export function isToolUseContentBlock(block) {
134
+ return block.type === 'tool_use';
135
+ }
136
+ /**
137
+ * Type guard for tool result content block
138
+ */
139
+ export function isToolResultContentBlock(block) {
140
+ return block.type === 'tool_result';
141
+ }
142
+ export default BaseProvider;
143
+ //# sourceMappingURL=base-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../../src/providers/base-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiHH;;;GAGG;AACH,MAAM,OAAgB,YAAY;IAUhC,sBAAsB;IACZ,MAAM,GAAmB;QACjC,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;KACnB,CAAC;IAqCF;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,yBAAyB;QACvB,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC,iBAAiB,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,qBAAqB;Q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MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAmB;IAC1D,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Cursor Provider (Cloud Agents API)
3
+ * Wrapper around Cursor's Cloud Agents REST API for multi-provider orchestration.
4
+ * Supports IDE-integrated workflows and rapid prototyping.
5
+ *
6
+ * Copyright (c) 2025 Dobeu Tech Solutions LLC
7
+ * Licensed under CC BY-NC 4.0
8
+ */
9
+ import { BaseProvider, type AgentMessage, type QueryOptions, type ProviderCapabilities, type ModelInfo } from './base-provider.js';
10
+ import { type ProviderName } from '../config/provider-config.js';
11
+ /**
12
+ * Cursor Provider Implementation
13
+ * Wraps the Cursor Cloud Agents API for use in multi-provider orchestration
14
+ */
15
+ export declare class CursorProvider extends BaseProvider {
16
+ readonly name: ProviderName;
17
+ readonly displayName = "Cursor Cloud Agents";
18
+ readonly packageName: null;
19
+ private config;
20
+ private apiKey;
21
+ private baseUrl;
22
+ private currentTaskId;
23
+ constructor(apiKey?: string);
24
+ /**
25
+ * Execute a query using the Cursor Cloud Agents API
26
+ */
27
+ query(prompt: string, options: QueryOptions): AsyncGenerator<AgentMessage, void, unknown>;
28
+ /**
29
+ * Poll for task completion
30
+ */
31
+ private pollForCompletion;
32
+ /**
33
+ * Validate Cursor API credentials
34
+ */
35
+ validateCredentials(): Promise<boolean>;
36
+ /**
37
+ * List available Cursor models
38
+ */
39
+ listModels(): Promise<ModelInfo[]>;
40
+ /**
41
+ * Get Cursor provider capabilities
42
+ */
43
+ getCapabilities(): ProviderCapabilities;
44
+ /**
45
+ * Get list of supported standard tools
46
+ */
47
+ getSupportedTools(): string[];
48
+ /**
49
+ * Map standard tool name to Cursor tool name
50
+ */
51
+ mapToolName(standardTool: string): string | null;
52
+ /**
53
+ * Get current task ID
54
+ */
55
+ getCurrentTaskId(): string | null;
56
+ /**
57
+ * Cancel current task (if running)
58
+ */
59
+ cancelCurrentTask(): Promise<boolean>;
60
+ /**
61
+ * Normalize Cursor response to standard format
62
+ */
63
+ protected normalizeMessage(rawMessage: unknown): AgentMessage;
64
+ /**
65
+ * Set API key at runtime
66
+ */
67
+ setApiKey(key: string): void;
68
+ /**
69
+ * Get the current API key (masked for display)
70
+ */
71
+ getApiKeyPreview(): string | null;
72
+ /**
73
+ * Set custom API endpoint (for self-hosted instances)
74
+ */
75
+ setBaseUrl(url: string): void;
76
+ }
77
+ /**
78
+ * Create a new Cursor provider instance
79
+ */
80
+ export declare function createCursorProvider(apiKey?: string): CursorProvider;
81
+ export default CursorProvider;
82
+ //# sourceMappingURL=cursor-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor-provider.d.ts","sourceRoot":"","sources":["../../src/providers/cursor-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,8BAA8B,CAAC;AAiCtC;;;GAGG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAY;IACvC,QAAQ,CAAC,WAAW,yBAAyB;IAC7C,QAAQ,CAAC,WAAW,OAAQ;IAE5B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,aAAa,CAAuB;gBAEhC,MAAM,CAAC,EAAE,MAAM;IAO3B;;OAEG;IACI,KAAK,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,GACpB,cAA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