byterover-cli 2.3.3 → 2.3.4
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.
|
@@ -51,8 +51,6 @@ export declare class ByteRoverLlmHttpService {
|
|
|
51
51
|
* Call ByteRover REST LLM service to generate content.
|
|
52
52
|
*
|
|
53
53
|
* Simple forward to remote REST API - delegates all formatting to backend.
|
|
54
|
-
* Supports both Gemini and Claude formats - the correct format is determined
|
|
55
|
-
* automatically based on the model name.
|
|
56
54
|
*
|
|
57
55
|
* Parameter structure differs by provider:
|
|
58
56
|
* - Gemini: contents = Content[], config = GenerateContentConfig
|
|
@@ -60,27 +58,22 @@ export declare class ByteRoverLlmHttpService {
|
|
|
60
58
|
*
|
|
61
59
|
* @param contents - For Gemini: Content[]. For Claude: MessageCreateParamsNonStreaming (complete body)
|
|
62
60
|
* @param config - For Gemini: GenerateContentConfig. For Claude: RequestOptions (optional HTTP options)
|
|
63
|
-
* @param model - Model to use (detects provider from model name)
|
|
64
61
|
* @param executionMetadata - Optional execution metadata (mode, executionContext)
|
|
65
62
|
* @returns Response in GenerateContentResponse format
|
|
66
63
|
*/
|
|
67
|
-
generateContent(contents: Content[] | MessageCreateParamsNonStreaming, config: GenerateContentConfig | RequestOptions,
|
|
64
|
+
generateContent(contents: Content[] | MessageCreateParamsNonStreaming, config: GenerateContentConfig | RequestOptions, executionMetadata?: Record<string, unknown>): Promise<GenerateContentResponse>;
|
|
68
65
|
/**
|
|
69
66
|
* Call ByteRover REST LLM service to generate content with streaming.
|
|
70
67
|
*
|
|
71
|
-
* Currently falls back to non-streaming endpoint
|
|
72
|
-
*
|
|
73
|
-
* response and yields them as separate chunks.
|
|
74
|
-
*
|
|
75
|
-
* When backend streaming is available, this will use SSE for true streaming.
|
|
68
|
+
* Currently falls back to non-streaming endpoint. Extracts thinking/reasoning
|
|
69
|
+
* from the complete response and yields them as separate chunks.
|
|
76
70
|
*
|
|
77
71
|
* @param contents - For Gemini: Content[]. For Claude: MessageCreateParamsNonStreaming (complete body)
|
|
78
72
|
* @param config - For Gemini: GenerateContentConfig. For Claude: RequestOptions (optional HTTP options)
|
|
79
|
-
* @param model - Model to use (detects provider from model name)
|
|
80
73
|
* @param executionMetadata - Optional execution metadata (mode, executionContext)
|
|
81
74
|
* @yields GenerateContentChunk objects as they are generated
|
|
82
75
|
*/
|
|
83
|
-
generateContentStream(contents: Content[] | MessageCreateParamsNonStreaming, config: GenerateContentConfig | RequestOptions,
|
|
76
|
+
generateContentStream(contents: Content[] | MessageCreateParamsNonStreaming, config: GenerateContentConfig | RequestOptions, executionMetadata?: Record<string, unknown>): AsyncGenerator<GenerateContentChunk>;
|
|
84
77
|
/**
|
|
85
78
|
* Call the ByteRover REST Generate endpoint.
|
|
86
79
|
*
|
|
@@ -91,26 +84,6 @@ export declare class ByteRoverLlmHttpService {
|
|
|
91
84
|
* @throws Error if the request fails
|
|
92
85
|
*/
|
|
93
86
|
private callHttpGenerate;
|
|
94
|
-
/**
|
|
95
|
-
* Detect LLM provider from model identifier.
|
|
96
|
-
*
|
|
97
|
-
* Determines which provider (Claude or Gemini) to use based on the model name.
|
|
98
|
-
* Defaults to Gemini if the model doesn't match Claude patterns.
|
|
99
|
-
*
|
|
100
|
-
* @param model - Model identifier (e.g., 'claude-3-5-sonnet', 'gemini-2.5-flash')
|
|
101
|
-
* @returns Provider name: 'claude' or 'gemini'
|
|
102
|
-
*/
|
|
103
|
-
private detectProviderFromModel;
|
|
104
|
-
/**
|
|
105
|
-
* Detect appropriate GCP region from model identifier.
|
|
106
|
-
*
|
|
107
|
-
* Routes Claude models to us-east5 and Gemini models to global.
|
|
108
|
-
* This ensures compatibility with the provider's available regions on Vertex AI.
|
|
109
|
-
*
|
|
110
|
-
* @param model - Model identifier (e.g., 'claude-3-5-sonnet', 'gemini-2.5-flash')
|
|
111
|
-
* @returns GCP region identifier ('us-east5' or 'global')
|
|
112
|
-
*/
|
|
113
|
-
private detectRegionFromModel;
|
|
114
87
|
/**
|
|
115
88
|
* Extract content chunks from a complete response.
|
|
116
89
|
*
|
|
@@ -33,7 +33,7 @@ export class ByteRoverLlmHttpService {
|
|
|
33
33
|
this.config = {
|
|
34
34
|
apiBaseUrl: config.apiBaseUrl,
|
|
35
35
|
projectId: config.projectId ?? 'byterover',
|
|
36
|
-
region: config.region ?? '
|
|
36
|
+
region: config.region ?? 'global',
|
|
37
37
|
sessionKey: config.sessionKey,
|
|
38
38
|
spaceId: config.spaceId,
|
|
39
39
|
teamId: config.teamId,
|
|
@@ -44,8 +44,6 @@ export class ByteRoverLlmHttpService {
|
|
|
44
44
|
* Call ByteRover REST LLM service to generate content.
|
|
45
45
|
*
|
|
46
46
|
* Simple forward to remote REST API - delegates all formatting to backend.
|
|
47
|
-
* Supports both Gemini and Claude formats - the correct format is determined
|
|
48
|
-
* automatically based on the model name.
|
|
49
47
|
*
|
|
50
48
|
* Parameter structure differs by provider:
|
|
51
49
|
* - Gemini: contents = Content[], config = GenerateContentConfig
|
|
@@ -53,21 +51,18 @@ export class ByteRoverLlmHttpService {
|
|
|
53
51
|
*
|
|
54
52
|
* @param contents - For Gemini: Content[]. For Claude: MessageCreateParamsNonStreaming (complete body)
|
|
55
53
|
* @param config - For Gemini: GenerateContentConfig. For Claude: RequestOptions (optional HTTP options)
|
|
56
|
-
* @param model - Model to use (detects provider from model name)
|
|
57
54
|
* @param executionMetadata - Optional execution metadata (mode, executionContext)
|
|
58
55
|
* @returns Response in GenerateContentResponse format
|
|
59
56
|
*/
|
|
60
|
-
async generateContent(contents, config,
|
|
57
|
+
async generateContent(contents, config, executionMetadata) {
|
|
61
58
|
const request = {
|
|
62
59
|
executionMetadata: JSON.stringify(executionMetadata ?? {}),
|
|
63
60
|
params: {
|
|
64
61
|
config,
|
|
65
62
|
contents,
|
|
66
|
-
model,
|
|
67
63
|
},
|
|
68
64
|
project_id: typeof this.config.projectId === 'function' ? this.config.projectId() : this.config.projectId,
|
|
69
|
-
|
|
70
|
-
region: this.detectRegionFromModel(model),
|
|
65
|
+
region: this.config.region,
|
|
71
66
|
spaceId: typeof this.config.spaceId === 'function' ? this.config.spaceId() : this.config.spaceId,
|
|
72
67
|
teamId: typeof this.config.teamId === 'function' ? this.config.teamId() : this.config.teamId,
|
|
73
68
|
};
|
|
@@ -76,22 +71,18 @@ export class ByteRoverLlmHttpService {
|
|
|
76
71
|
/**
|
|
77
72
|
* Call ByteRover REST LLM service to generate content with streaming.
|
|
78
73
|
*
|
|
79
|
-
* Currently falls back to non-streaming endpoint
|
|
80
|
-
*
|
|
81
|
-
* response and yields them as separate chunks.
|
|
82
|
-
*
|
|
83
|
-
* When backend streaming is available, this will use SSE for true streaming.
|
|
74
|
+
* Currently falls back to non-streaming endpoint. Extracts thinking/reasoning
|
|
75
|
+
* from the complete response and yields them as separate chunks.
|
|
84
76
|
*
|
|
85
77
|
* @param contents - For Gemini: Content[]. For Claude: MessageCreateParamsNonStreaming (complete body)
|
|
86
78
|
* @param config - For Gemini: GenerateContentConfig. For Claude: RequestOptions (optional HTTP options)
|
|
87
|
-
* @param model - Model to use (detects provider from model name)
|
|
88
79
|
* @param executionMetadata - Optional execution metadata (mode, executionContext)
|
|
89
80
|
* @yields GenerateContentChunk objects as they are generated
|
|
90
81
|
*/
|
|
91
|
-
async *generateContentStream(contents, config,
|
|
82
|
+
async *generateContentStream(contents, config, executionMetadata) {
|
|
92
83
|
// Fall back to non-streaming endpoint and simulate streaming
|
|
93
84
|
// by extracting thinking from the complete response
|
|
94
|
-
const response = await this.generateContent(contents, config,
|
|
85
|
+
const response = await this.generateContent(contents, config, executionMetadata);
|
|
95
86
|
// Extract and yield thinking/reasoning chunks first
|
|
96
87
|
yield* this.extractThinkingFromResponse(response);
|
|
97
88
|
// Then yield the final content
|
|
@@ -115,30 +106,6 @@ export class ByteRoverLlmHttpService {
|
|
|
115
106
|
});
|
|
116
107
|
return httpResponse.data;
|
|
117
108
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Detect LLM provider from model identifier.
|
|
120
|
-
*
|
|
121
|
-
* Determines which provider (Claude or Gemini) to use based on the model name.
|
|
122
|
-
* Defaults to Gemini if the model doesn't match Claude patterns.
|
|
123
|
-
*
|
|
124
|
-
* @param model - Model identifier (e.g., 'claude-3-5-sonnet', 'gemini-2.5-flash')
|
|
125
|
-
* @returns Provider name: 'claude' or 'gemini'
|
|
126
|
-
*/
|
|
127
|
-
detectProviderFromModel(model) {
|
|
128
|
-
return model.toLowerCase().startsWith('claude') ? 'claude' : 'gemini';
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Detect appropriate GCP region from model identifier.
|
|
132
|
-
*
|
|
133
|
-
* Routes Claude models to us-east5 and Gemini models to global.
|
|
134
|
-
* This ensures compatibility with the provider's available regions on Vertex AI.
|
|
135
|
-
*
|
|
136
|
-
* @param model - Model identifier (e.g., 'claude-3-5-sonnet', 'gemini-2.5-flash')
|
|
137
|
-
* @returns GCP region identifier ('us-east5' or 'global')
|
|
138
|
-
*/
|
|
139
|
-
detectRegionFromModel(model) {
|
|
140
|
-
return model.toLowerCase().startsWith('claude') ? 'us-east5' : 'global';
|
|
141
|
-
}
|
|
142
109
|
/**
|
|
143
110
|
* Extract content chunks from a complete response.
|
|
144
111
|
*
|
|
@@ -87,7 +87,7 @@ export class ByteRoverContentGenerator {
|
|
|
87
87
|
};
|
|
88
88
|
// // Debug: Log taskId for tracking
|
|
89
89
|
// appendFileSync('debug-taskid.log', `[${new Date().toISOString()}] taskId from request: "${request.taskId}"\n`)
|
|
90
|
-
const rawResponse = await this.httpService.generateContent(contents, config,
|
|
90
|
+
const rawResponse = await this.httpService.generateContent(contents, config, executionMetadata);
|
|
91
91
|
// Parse response to internal format
|
|
92
92
|
const messages = this.formatter.parseResponse(rawResponse);
|
|
93
93
|
const lastMessage = messages.at(-1);
|
|
@@ -143,7 +143,7 @@ export class ByteRoverContentGenerator {
|
|
|
143
143
|
const contents = this.providerType === 'claude' ? genConfig : formattedMessages;
|
|
144
144
|
const config = this.providerType === 'claude' ? {} : genConfig;
|
|
145
145
|
// Stream from HTTP service
|
|
146
|
-
yield* this.httpService.generateContentStream(contents, config,
|
|
146
|
+
yield* this.httpService.generateContentStream(contents, config, executionMetadata);
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* Build Claude-specific generation configuration.
|
package/oclif.manifest.json
CHANGED