@neovate/code 0.14.0 → 0.16.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.
- package/dist/cli.mjs +1155 -1384
- package/dist/index.d.ts +147 -125
- package/dist/index.mjs +1155 -1384
- package/dist/mcps/chrome-devtools-mcp.mjs +196 -195
- package/package.json +47 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,98 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { LanguageModelV1 } from '@openrouter/ai-sdk-provider';
|
|
4
|
-
import type { LanguageModelV1 as LanguageModelV1_2 } from '@ai-sdk/provider';
|
|
5
|
-
import { LanguageModelV1CallWarning } from '@ai-sdk/provider';
|
|
6
|
-
import { LanguageModelV1FinishReason } from '@ai-sdk/provider';
|
|
7
|
-
import { LanguageModelV1FunctionToolCall } from '@ai-sdk/provider';
|
|
8
|
-
import { LanguageModelV1LogProbs } from '@ai-sdk/provider';
|
|
9
|
-
import { LanguageModelV1ProviderMetadata } from '@ai-sdk/provider';
|
|
10
|
-
import { LanguageModelV1Source } from '@ai-sdk/provider';
|
|
11
|
-
import { LoopResult as LoopResult_2 } from './loop';
|
|
12
|
-
import { MCPServer } from '@openai/agents';
|
|
13
|
-
import { Model as Model_2 } from '@openai/agents';
|
|
14
|
-
import { ModelRequest } from '@openai/agents';
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import { LanguageModelV2 } from '@openrouter/ai-sdk-provider';
|
|
15
3
|
import type { OpenAIProvider } from '@ai-sdk/openai';
|
|
16
|
-
import
|
|
17
|
-
import { Usage as Usage_2 } from '@openai/agents';
|
|
4
|
+
import * as z from 'zod';
|
|
18
5
|
import { z as _zod } from 'zod';
|
|
19
6
|
|
|
20
|
-
/**
|
|
21
|
-
* Wraps a model from the AI SDK that adheres to the LanguageModelV1 spec to be used used as a model
|
|
22
|
-
* in the OpenAI Agents SDK to use other models.
|
|
23
|
-
*
|
|
24
|
-
* While you can use this with the OpenAI models, it is recommended to use the default OpenAI model
|
|
25
|
-
* provider instead.
|
|
26
|
-
*
|
|
27
|
-
* If tracing is enabled, the model will send generation spans to your traces processor.
|
|
28
|
-
*
|
|
29
|
-
* ```ts
|
|
30
|
-
* import { aisdk } from '@openai/agents-extensions';
|
|
31
|
-
* import { openai } from '@ai-sdk/openai';
|
|
32
|
-
*
|
|
33
|
-
* const model = aisdk(openai('gpt-4o'));
|
|
34
|
-
*
|
|
35
|
-
* const agent = new Agent({
|
|
36
|
-
* name: 'My Agent',
|
|
37
|
-
* model
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @param model - The Vercel AI SDK model to wrap.
|
|
42
|
-
* @returns The wrapped model.
|
|
43
|
-
*/
|
|
44
|
-
declare class AiSdkModel implements Model_2 {
|
|
45
|
-
#private;
|
|
46
|
-
constructor(model: LanguageModelV1_2);
|
|
47
|
-
getResponse(request: ModelRequest): Promise<{
|
|
48
|
-
responseId: string;
|
|
49
|
-
usage: Usage_2;
|
|
50
|
-
output: AgentOutputItem[];
|
|
51
|
-
providerData: {
|
|
52
|
-
text?: string;
|
|
53
|
-
reasoning?: string | Array<{
|
|
54
|
-
type: "text";
|
|
55
|
-
text: string;
|
|
56
|
-
signature?: string;
|
|
57
|
-
} | {
|
|
58
|
-
type: "redacted";
|
|
59
|
-
data: string;
|
|
60
|
-
}>;
|
|
61
|
-
files?: Array<{
|
|
62
|
-
data: string | Uint8Array;
|
|
63
|
-
mimeType: string;
|
|
64
|
-
}>;
|
|
65
|
-
toolCalls?: Array<LanguageModelV1FunctionToolCall>;
|
|
66
|
-
finishReason: LanguageModelV1FinishReason;
|
|
67
|
-
usage: {
|
|
68
|
-
promptTokens: number;
|
|
69
|
-
completionTokens: number;
|
|
70
|
-
};
|
|
71
|
-
rawCall: {
|
|
72
|
-
rawPrompt: unknown;
|
|
73
|
-
rawSettings: Record<string, unknown>;
|
|
74
|
-
};
|
|
75
|
-
rawResponse?: {
|
|
76
|
-
headers?: Record<string, string>;
|
|
77
|
-
body?: unknown;
|
|
78
|
-
};
|
|
79
|
-
request?: {
|
|
80
|
-
body?: string;
|
|
81
|
-
};
|
|
82
|
-
response?: {
|
|
83
|
-
id?: string;
|
|
84
|
-
timestamp?: Date;
|
|
85
|
-
modelId?: string;
|
|
86
|
-
};
|
|
87
|
-
warnings?: LanguageModelV1CallWarning[];
|
|
88
|
-
providerMetadata?: LanguageModelV1ProviderMetadata;
|
|
89
|
-
sources?: LanguageModelV1Source[];
|
|
90
|
-
logprobs?: LanguageModelV1LogProbs;
|
|
91
|
-
};
|
|
92
|
-
}>;
|
|
93
|
-
getStreamedResponse(request: ModelRequest): AsyncIterable<ResponseStreamEvent>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
7
|
declare type ApprovalCategory = 'read' | 'write' | 'command' | 'network';
|
|
97
8
|
|
|
98
9
|
declare type ApprovalContext = {
|
|
@@ -119,6 +30,34 @@ declare type AssistantMessage = {
|
|
|
119
30
|
};
|
|
120
31
|
};
|
|
121
32
|
|
|
33
|
+
declare interface BackgroundTask {
|
|
34
|
+
id: string;
|
|
35
|
+
command: string;
|
|
36
|
+
pid: number;
|
|
37
|
+
pgid?: number;
|
|
38
|
+
status: 'running' | 'completed' | 'killed' | 'failed';
|
|
39
|
+
createdAt: number;
|
|
40
|
+
output: string;
|
|
41
|
+
exitCode: number | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare class BackgroundTaskManager {
|
|
45
|
+
private tasks;
|
|
46
|
+
createTask(input: CreateTaskInput): string;
|
|
47
|
+
getTask(id: string): BackgroundTask | null;
|
|
48
|
+
getAllTasks(): BackgroundTask[];
|
|
49
|
+
appendOutput(id: string, output: string): void;
|
|
50
|
+
updateTaskStatus(id: string, status: BackgroundTask['status'], exitCode?: number | null): void;
|
|
51
|
+
deleteTask(id: string): void;
|
|
52
|
+
private isProcessAlive;
|
|
53
|
+
killTask(id: string): Promise<boolean>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare type BaseMessage = {
|
|
57
|
+
id: MessageId;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
};
|
|
60
|
+
|
|
122
61
|
declare interface BaseSlashCommand {
|
|
123
62
|
name: string;
|
|
124
63
|
description: string;
|
|
@@ -127,11 +66,13 @@ declare interface BaseSlashCommand {
|
|
|
127
66
|
|
|
128
67
|
declare type CommitConfig = {
|
|
129
68
|
language: string;
|
|
69
|
+
systemPrompt?: string;
|
|
130
70
|
};
|
|
131
71
|
|
|
132
72
|
declare type Config = {
|
|
133
73
|
model: string;
|
|
134
74
|
planModel: string;
|
|
75
|
+
smallModel?: string;
|
|
135
76
|
language: string;
|
|
136
77
|
quiet: boolean;
|
|
137
78
|
approvalMode: ApprovalMode;
|
|
@@ -179,6 +120,8 @@ export declare class Context {
|
|
|
179
120
|
paths: Paths;
|
|
180
121
|
argvConfig: Record<string, any>;
|
|
181
122
|
mcpManager: MCPManager;
|
|
123
|
+
backgroundTaskManager: BackgroundTaskManager;
|
|
124
|
+
messageBus?: MessageBus;
|
|
182
125
|
constructor(opts: ContextOpts);
|
|
183
126
|
apply(applyOpts: Omit<PluginApplyOpts, 'pluginContext'>): Promise<any>;
|
|
184
127
|
destroy(): Promise<void>;
|
|
@@ -192,6 +135,7 @@ declare type ContextCreateOpts = {
|
|
|
192
135
|
version: string;
|
|
193
136
|
argvConfig: Record<string, any>;
|
|
194
137
|
plugins: (string | Plugin_2)[];
|
|
138
|
+
messageBus?: MessageBus;
|
|
195
139
|
};
|
|
196
140
|
|
|
197
141
|
declare type ContextOpts = {
|
|
@@ -204,19 +148,27 @@ declare type ContextOpts = {
|
|
|
204
148
|
paths: Paths;
|
|
205
149
|
argvConfig: Record<string, any>;
|
|
206
150
|
mcpManager: MCPManager;
|
|
151
|
+
backgroundTaskManager: BackgroundTaskManager;
|
|
152
|
+
messageBus?: MessageBus;
|
|
207
153
|
};
|
|
208
154
|
|
|
209
|
-
|
|
155
|
+
declare interface CreateTaskInput {
|
|
156
|
+
command: string;
|
|
157
|
+
pid: number;
|
|
158
|
+
pgid?: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare function createTool<TSchema extends z.ZodTypeAny>(config: {
|
|
210
162
|
name: string;
|
|
211
163
|
description: string;
|
|
212
164
|
parameters: TSchema;
|
|
213
|
-
execute: (params:
|
|
165
|
+
execute: (params: z.output<TSchema>) => Promise<ToolResult> | ToolResult;
|
|
214
166
|
approval?: ToolApprovalInfo;
|
|
215
167
|
getDescription?: ({ params, cwd, }: {
|
|
216
|
-
params:
|
|
168
|
+
params: z.output<TSchema>;
|
|
217
169
|
cwd: string;
|
|
218
170
|
}) => string;
|
|
219
|
-
}): Tool<
|
|
171
|
+
}): Tool<TSchema>;
|
|
220
172
|
|
|
221
173
|
declare type DiffViewerReturnDisplay = {
|
|
222
174
|
type: 'diff_viewer';
|
|
@@ -232,6 +184,14 @@ declare type DiffViewerReturnDisplay = {
|
|
|
232
184
|
|
|
233
185
|
declare type Enforce = 'pre' | 'post';
|
|
234
186
|
|
|
187
|
+
declare type EventHandler = (data: any) => void;
|
|
188
|
+
|
|
189
|
+
declare type EventMessage = BaseMessage & {
|
|
190
|
+
type: 'event';
|
|
191
|
+
event: string;
|
|
192
|
+
data: any;
|
|
193
|
+
};
|
|
194
|
+
|
|
235
195
|
declare type ImagePart = {
|
|
236
196
|
type: 'image';
|
|
237
197
|
data: string;
|
|
@@ -312,8 +272,8 @@ declare class MCPManager {
|
|
|
312
272
|
isReady(): boolean;
|
|
313
273
|
isLoading(): boolean;
|
|
314
274
|
retryConnection(serverName: string): Promise<void>;
|
|
315
|
-
|
|
316
|
-
|
|
275
|
+
private _createClient;
|
|
276
|
+
private _testConnectionAndFetchTools;
|
|
317
277
|
private _isTemporaryError;
|
|
318
278
|
}
|
|
319
279
|
|
|
@@ -336,7 +296,45 @@ declare type McpStdioServerConfig = {
|
|
|
336
296
|
disable?: boolean;
|
|
337
297
|
};
|
|
338
298
|
|
|
339
|
-
declare type Message =
|
|
299
|
+
declare type Message = RequestMessage | ResponseMessage | EventMessage;
|
|
300
|
+
|
|
301
|
+
declare type Message_2 = SystemMessage | UserMessage | AssistantMessage | ToolMessage | ToolMessage2;
|
|
302
|
+
|
|
303
|
+
declare class MessageBus extends EventEmitter {
|
|
304
|
+
private transport?;
|
|
305
|
+
private pendingRequests;
|
|
306
|
+
private messageHandlers;
|
|
307
|
+
private eventHandlers;
|
|
308
|
+
constructor();
|
|
309
|
+
setTransport(transport: MessageTransport): void;
|
|
310
|
+
isConnected(): boolean;
|
|
311
|
+
request(method: string, params: any, options?: {
|
|
312
|
+
timeout?: number;
|
|
313
|
+
}): Promise<any>;
|
|
314
|
+
registerHandler(method: string, handler: MessageHandler): void;
|
|
315
|
+
unregisterHandler(method: string): void;
|
|
316
|
+
emitEvent(event: string, data: any): Promise<void>;
|
|
317
|
+
onEvent(event: string, handler: EventHandler): void;
|
|
318
|
+
offEvent(event: string, handler: EventHandler): void;
|
|
319
|
+
private handleIncomingMessage;
|
|
320
|
+
private handleRequest;
|
|
321
|
+
private handleResponse;
|
|
322
|
+
private handleEvent;
|
|
323
|
+
private sendResponse;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare type MessageHandler = (data: any) => Promise<any>;
|
|
327
|
+
|
|
328
|
+
declare type MessageId = string;
|
|
329
|
+
|
|
330
|
+
declare interface MessageTransport {
|
|
331
|
+
send: (message: Message) => Promise<void>;
|
|
332
|
+
onMessage: (handler: (message: Message) => void) => void;
|
|
333
|
+
onError: (handler: (error: Error) => void) => void;
|
|
334
|
+
onClose: (handler: () => void) => void;
|
|
335
|
+
close: () => Promise<void>;
|
|
336
|
+
isConnected: () => boolean;
|
|
337
|
+
}
|
|
340
338
|
|
|
341
339
|
declare interface Model {
|
|
342
340
|
id: string;
|
|
@@ -367,7 +365,8 @@ declare interface ModelCost {
|
|
|
367
365
|
declare type ModelInfo = {
|
|
368
366
|
provider: Provider;
|
|
369
367
|
model: Omit<Model, 'cost'>;
|
|
370
|
-
|
|
368
|
+
m: LanguageModelV2;
|
|
369
|
+
thinkingConfig?: Record<string, any>;
|
|
371
370
|
};
|
|
372
371
|
|
|
373
372
|
declare interface ModelLimit {
|
|
@@ -382,7 +381,7 @@ declare interface ModelModalities {
|
|
|
382
381
|
output: ('text' | 'audio' | 'image')[];
|
|
383
382
|
}
|
|
384
383
|
|
|
385
|
-
declare type NormalizedMessage =
|
|
384
|
+
declare type NormalizedMessage = Message_2 & {
|
|
386
385
|
type: 'message';
|
|
387
386
|
timestamp: string;
|
|
388
387
|
uuid: string;
|
|
@@ -437,7 +436,7 @@ declare type Plugin_2 = {
|
|
|
437
436
|
outputStyle?: (this: PluginContext) => Promise<OutputStyle[]> | OutputStyle[];
|
|
438
437
|
provider?: (this: PluginContext, providers: ProvidersMap, opts: {
|
|
439
438
|
models: ModelMap;
|
|
440
|
-
defaultModelCreator: (name: string, provider: Provider) =>
|
|
439
|
+
defaultModelCreator: (name: string, provider: Provider) => LanguageModelV2;
|
|
441
440
|
createOpenAI: (options: any) => OpenAIProvider;
|
|
442
441
|
}) => Promise<ProvidersMap> | ProvidersMap;
|
|
443
442
|
modelAlias?: (this: PluginContext, modelAlias: ModelAlias) => Promise<ModelAlias> | ModelAlias;
|
|
@@ -554,7 +553,7 @@ declare interface Provider {
|
|
|
554
553
|
api?: string;
|
|
555
554
|
doc: string;
|
|
556
555
|
models: Record<string, string | Omit<Model, 'id' | 'cost'>>;
|
|
557
|
-
createModel(name: string, provider: Provider, globalConfigDir: string): Promise<
|
|
556
|
+
createModel(name: string, provider: Provider, globalConfigDir: string): Promise<LanguageModelV2> | LanguageModelV2;
|
|
558
557
|
options?: {
|
|
559
558
|
baseURL?: string;
|
|
560
559
|
apiKey?: string;
|
|
@@ -573,13 +572,27 @@ export declare function _query(opts: {
|
|
|
573
572
|
model?: ModelInfo;
|
|
574
573
|
systemPrompt?: string;
|
|
575
574
|
onMessage?: (message: NormalizedMessage) => Promise<void>;
|
|
576
|
-
}): Promise<
|
|
575
|
+
}): Promise<LoopResult>;
|
|
577
576
|
|
|
578
577
|
declare type ReasoningPart = {
|
|
579
578
|
type: 'reasoning';
|
|
580
579
|
text: string;
|
|
581
580
|
};
|
|
582
581
|
|
|
582
|
+
declare type RequestMessage = BaseMessage & {
|
|
583
|
+
type: 'request';
|
|
584
|
+
method: string;
|
|
585
|
+
params: any;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
declare type ResponseMessage = BaseMessage & {
|
|
589
|
+
type: 'response';
|
|
590
|
+
result?: any;
|
|
591
|
+
error?: any;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
declare type ReturnDisplay = string | DiffViewerReturnDisplay | TodoReadReturnDisplay | TodoWriteReturnDisplay;
|
|
595
|
+
|
|
583
596
|
export declare function runNeovate(opts: {
|
|
584
597
|
productName: string;
|
|
585
598
|
productASCIIArt?: string;
|
|
@@ -616,19 +629,17 @@ declare type TodoItem = _zod.infer<typeof TodoItemSchema>;
|
|
|
616
629
|
declare const TodoItemSchema: _zod.ZodObject<{
|
|
617
630
|
id: _zod.ZodString;
|
|
618
631
|
content: _zod.ZodString;
|
|
619
|
-
status: _zod.ZodEnum<
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
priority: "low" | "medium" | "high";
|
|
631
|
-
}>;
|
|
632
|
+
status: _zod.ZodEnum<{
|
|
633
|
+
completed: "completed";
|
|
634
|
+
pending: "pending";
|
|
635
|
+
in_progress: "in_progress";
|
|
636
|
+
}>;
|
|
637
|
+
priority: _zod.ZodEnum<{
|
|
638
|
+
low: "low";
|
|
639
|
+
medium: "medium";
|
|
640
|
+
high: "high";
|
|
641
|
+
}>;
|
|
642
|
+
}, _zod.core.$strip>;
|
|
632
643
|
|
|
633
644
|
declare type TodoReadReturnDisplay = {
|
|
634
645
|
type: 'todo_read';
|
|
@@ -641,17 +652,17 @@ declare type TodoWriteReturnDisplay = {
|
|
|
641
652
|
newTodos: TodoItem[];
|
|
642
653
|
};
|
|
643
654
|
|
|
644
|
-
declare interface Tool<
|
|
655
|
+
declare interface Tool<TSchema extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
645
656
|
name: string;
|
|
646
657
|
description: string;
|
|
647
|
-
getDescription?: ({ params, cwd }: {
|
|
648
|
-
params:
|
|
658
|
+
getDescription?: ({ params, cwd, }: {
|
|
659
|
+
params: z.output<TSchema>;
|
|
649
660
|
cwd: string;
|
|
650
661
|
}) => string;
|
|
651
662
|
displayName?: string;
|
|
652
|
-
execute: (params:
|
|
663
|
+
execute: (params: z.output<TSchema>) => Promise<ToolResult> | ToolResult;
|
|
653
664
|
approval?: ToolApprovalInfo;
|
|
654
|
-
parameters:
|
|
665
|
+
parameters: TSchema;
|
|
655
666
|
}
|
|
656
667
|
|
|
657
668
|
declare type ToolApprovalInfo = {
|
|
@@ -666,9 +677,14 @@ declare type ToolMessage = {
|
|
|
666
677
|
content: ToolContent;
|
|
667
678
|
};
|
|
668
679
|
|
|
680
|
+
declare type ToolMessage2 = {
|
|
681
|
+
role: 'tool';
|
|
682
|
+
content: ToolResultPart2[];
|
|
683
|
+
};
|
|
684
|
+
|
|
669
685
|
declare type ToolResult = {
|
|
670
686
|
llmContent: string | (TextPart | ImagePart)[];
|
|
671
|
-
returnDisplay?:
|
|
687
|
+
returnDisplay?: ReturnDisplay;
|
|
672
688
|
isError?: boolean;
|
|
673
689
|
};
|
|
674
690
|
|
|
@@ -680,6 +696,14 @@ declare type ToolResultPart = {
|
|
|
680
696
|
result: ToolResult;
|
|
681
697
|
};
|
|
682
698
|
|
|
699
|
+
declare type ToolResultPart2 = {
|
|
700
|
+
type: 'tool-result';
|
|
701
|
+
toolCallId: string;
|
|
702
|
+
toolName: string;
|
|
703
|
+
input: Record<string, any>;
|
|
704
|
+
result: ToolResult;
|
|
705
|
+
};
|
|
706
|
+
|
|
683
707
|
declare type ToolUse = {
|
|
684
708
|
name: string;
|
|
685
709
|
params: Record<string, any>;
|
|
@@ -695,8 +719,6 @@ declare type ToolUsePart = {
|
|
|
695
719
|
description?: string;
|
|
696
720
|
};
|
|
697
721
|
|
|
698
|
-
declare type UnknownContext = unknown;
|
|
699
|
-
|
|
700
722
|
declare type UpgradeOptions = {
|
|
701
723
|
registryBase: string;
|
|
702
724
|
name: string;
|