git-coco 0.26.0 → 0.27.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/index.d.ts +8 -0
- package/dist/index.esm.mjs +39 -4
- package/dist/index.js +39 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,14 @@ type OllamaFields = Partial<OllamaInput> & BaseLLMParams;
|
|
|
86
86
|
type OpenAILLMService = BaseLLMService & {
|
|
87
87
|
provider: 'openai';
|
|
88
88
|
model: OpenAIModel;
|
|
89
|
+
/**
|
|
90
|
+
* Custom base URL for OpenAI-compatible APIs (e.g., OpenRouter, Azure OpenAI).
|
|
91
|
+
* If not specified, uses the default OpenAI API endpoint.
|
|
92
|
+
*
|
|
93
|
+
* @example "https://openrouter.ai/api/v1"
|
|
94
|
+
* @example "https://your-resource.openai.azure.com"
|
|
95
|
+
*/
|
|
96
|
+
baseURL?: string;
|
|
89
97
|
fields?: OpenAIFields;
|
|
90
98
|
};
|
|
91
99
|
type OllamaLLMService = BaseLLMService & {
|
package/dist/index.esm.mjs
CHANGED
|
@@ -46,7 +46,7 @@ import { pathToFileURL } from 'url';
|
|
|
46
46
|
/**
|
|
47
47
|
* Current build version from package.json
|
|
48
48
|
*/
|
|
49
|
-
const BUILD_VERSION = "0.
|
|
49
|
+
const BUILD_VERSION = "0.27.0";
|
|
50
50
|
|
|
51
51
|
const isInteractive = (config) => {
|
|
52
52
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -479,6 +479,7 @@ function loadEnvConfig(config) {
|
|
|
479
479
|
'COCO_SERVICE_PROVIDER',
|
|
480
480
|
'COCO_SERVICE_MODEL',
|
|
481
481
|
'OPEN_AI_KEY',
|
|
482
|
+
'COCO_SERVICE_BASE_URL',
|
|
482
483
|
'COCO_SERVICE_ENDPOINT',
|
|
483
484
|
'COCO_SERVICE_REQUEST_OPTIONS_TIMEOUT',
|
|
484
485
|
'COCO_SERVICE_REQUEST_OPTIONS_MAX_RETRIES',
|
|
@@ -493,6 +494,7 @@ function loadEnvConfig(config) {
|
|
|
493
494
|
if (key === 'COCO_SERVICE_PROVIDER' ||
|
|
494
495
|
key === 'COCO_SERVICE_MODEL' ||
|
|
495
496
|
key === 'OPEN_AI_KEY' ||
|
|
497
|
+
key === 'COCO_SERVICE_BASE_URL' ||
|
|
496
498
|
key === 'COCO_SERVICE_ENDPOINT' ||
|
|
497
499
|
key === 'COCO_SERVICE_REQUEST_OPTIONS_TIMEOUT' ||
|
|
498
500
|
key === 'COCO_SERVICE_REQUEST_OPTIONS_MAX_RETRIES' ||
|
|
@@ -531,6 +533,12 @@ function handleServiceEnvVar(service, key, value) {
|
|
|
531
533
|
};
|
|
532
534
|
}
|
|
533
535
|
break;
|
|
536
|
+
case 'COCO_SERVICE_BASE_URL':
|
|
537
|
+
if (service.provider === 'openai') {
|
|
538
|
+
// Cast to OpenAILLMService to access baseURL property
|
|
539
|
+
service.baseURL = value;
|
|
540
|
+
}
|
|
541
|
+
break;
|
|
534
542
|
case 'COCO_SERVICE_ENDPOINT':
|
|
535
543
|
if (service.provider === 'ollama') {
|
|
536
544
|
service.endpoint = value;
|
|
@@ -659,6 +667,7 @@ function loadGitConfig(config) {
|
|
|
659
667
|
maxParsingAttempts: gitConfigParsed.coco?.serviceMaxParsingAttempts
|
|
660
668
|
? Number(gitConfigParsed.coco.serviceMaxParsingAttempts)
|
|
661
669
|
: undefined,
|
|
670
|
+
baseURL: gitConfigParsed.coco?.serviceBaseURL,
|
|
662
671
|
authentication: {
|
|
663
672
|
type: 'APIKey',
|
|
664
673
|
credentials: {
|
|
@@ -738,6 +747,11 @@ const appendToGitConfig = async (filePath, config) => {
|
|
|
738
747
|
if (service.requestOptions?.maxRetries) {
|
|
739
748
|
contentLines.push(` serviceRequestOptionsMaxRetries = ${service.requestOptions.maxRetries}`);
|
|
740
749
|
}
|
|
750
|
+
// Handle baseURL for OpenAI
|
|
751
|
+
if (service.provider === 'openai' && 'baseURL' in service && service.baseURL) {
|
|
752
|
+
contentLines.push(` serviceBaseURL = ${service.baseURL}`);
|
|
753
|
+
}
|
|
754
|
+
// Handle endpoint for Ollama
|
|
741
755
|
if (service.provider === 'ollama') {
|
|
742
756
|
const ollamaService = service;
|
|
743
757
|
if (ollamaService.endpoint) {
|
|
@@ -928,6 +942,14 @@ const schema$1 = {
|
|
|
928
942
|
"model": {
|
|
929
943
|
"$ref": "#/definitions/LLMModel"
|
|
930
944
|
},
|
|
945
|
+
"baseURL": {
|
|
946
|
+
"type": "string",
|
|
947
|
+
"description": "Custom base URL for OpenAI-compatible APIs (e.g., OpenRouter, Azure OpenAI). If not specified, uses the default OpenAI API endpoint.",
|
|
948
|
+
"examples": [
|
|
949
|
+
"https://openrouter.ai/api/v1",
|
|
950
|
+
"https://your-resource.openai.azure.com"
|
|
951
|
+
]
|
|
952
|
+
},
|
|
931
953
|
"fields": {
|
|
932
954
|
"type": "object",
|
|
933
955
|
"additionalProperties": false,
|
|
@@ -2202,12 +2224,14 @@ function parseServiceConfig(service) {
|
|
|
2202
2224
|
return {
|
|
2203
2225
|
provider: 'openai',
|
|
2204
2226
|
model: service.model,
|
|
2227
|
+
baseURL: service.baseURL,
|
|
2205
2228
|
authentication: {
|
|
2206
2229
|
type: 'APIKey',
|
|
2207
2230
|
credentials: {
|
|
2208
2231
|
apiKey: service.apiKey
|
|
2209
2232
|
}
|
|
2210
|
-
}
|
|
2233
|
+
},
|
|
2234
|
+
fields: service.fields
|
|
2211
2235
|
};
|
|
2212
2236
|
case 'anthropic':
|
|
2213
2237
|
return {
|
|
@@ -6302,11 +6326,22 @@ function getLlm(provider, model, config) {
|
|
|
6302
6326
|
model,
|
|
6303
6327
|
});
|
|
6304
6328
|
case 'openai':
|
|
6305
|
-
|
|
6329
|
+
const openaiConfig = {
|
|
6306
6330
|
apiKey: apiKey,
|
|
6307
6331
|
model,
|
|
6308
6332
|
temperature: config.service.temperature || 0.2,
|
|
6309
|
-
}
|
|
6333
|
+
};
|
|
6334
|
+
// Add custom base URL if specified (for OpenRouter, Azure OpenAI, etc.)
|
|
6335
|
+
if ('baseURL' in config.service && config.service.baseURL) {
|
|
6336
|
+
openaiConfig.configuration = {
|
|
6337
|
+
baseURL: config.service.baseURL,
|
|
6338
|
+
};
|
|
6339
|
+
}
|
|
6340
|
+
// Merge any additional fields from config
|
|
6341
|
+
if ('fields' in config.service && config.service.fields) {
|
|
6342
|
+
Object.assign(openaiConfig, config.service.fields);
|
|
6343
|
+
}
|
|
6344
|
+
return new ChatOpenAI(openaiConfig);
|
|
6310
6345
|
default:
|
|
6311
6346
|
throw new LangChainConfigurationError(`getLlm: Unsupported provider '${provider}'`, { provider, model, supportedProviders: ['openai', 'anthropic', 'ollama'] });
|
|
6312
6347
|
}
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
|
|
|
68
68
|
/**
|
|
69
69
|
* Current build version from package.json
|
|
70
70
|
*/
|
|
71
|
-
const BUILD_VERSION = "0.
|
|
71
|
+
const BUILD_VERSION = "0.27.0";
|
|
72
72
|
|
|
73
73
|
const isInteractive = (config) => {
|
|
74
74
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -501,6 +501,7 @@ function loadEnvConfig(config) {
|
|
|
501
501
|
'COCO_SERVICE_PROVIDER',
|
|
502
502
|
'COCO_SERVICE_MODEL',
|
|
503
503
|
'OPEN_AI_KEY',
|
|
504
|
+
'COCO_SERVICE_BASE_URL',
|
|
504
505
|
'COCO_SERVICE_ENDPOINT',
|
|
505
506
|
'COCO_SERVICE_REQUEST_OPTIONS_TIMEOUT',
|
|
506
507
|
'COCO_SERVICE_REQUEST_OPTIONS_MAX_RETRIES',
|
|
@@ -515,6 +516,7 @@ function loadEnvConfig(config) {
|
|
|
515
516
|
if (key === 'COCO_SERVICE_PROVIDER' ||
|
|
516
517
|
key === 'COCO_SERVICE_MODEL' ||
|
|
517
518
|
key === 'OPEN_AI_KEY' ||
|
|
519
|
+
key === 'COCO_SERVICE_BASE_URL' ||
|
|
518
520
|
key === 'COCO_SERVICE_ENDPOINT' ||
|
|
519
521
|
key === 'COCO_SERVICE_REQUEST_OPTIONS_TIMEOUT' ||
|
|
520
522
|
key === 'COCO_SERVICE_REQUEST_OPTIONS_MAX_RETRIES' ||
|
|
@@ -553,6 +555,12 @@ function handleServiceEnvVar(service, key, value) {
|
|
|
553
555
|
};
|
|
554
556
|
}
|
|
555
557
|
break;
|
|
558
|
+
case 'COCO_SERVICE_BASE_URL':
|
|
559
|
+
if (service.provider === 'openai') {
|
|
560
|
+
// Cast to OpenAILLMService to access baseURL property
|
|
561
|
+
service.baseURL = value;
|
|
562
|
+
}
|
|
563
|
+
break;
|
|
556
564
|
case 'COCO_SERVICE_ENDPOINT':
|
|
557
565
|
if (service.provider === 'ollama') {
|
|
558
566
|
service.endpoint = value;
|
|
@@ -681,6 +689,7 @@ function loadGitConfig(config) {
|
|
|
681
689
|
maxParsingAttempts: gitConfigParsed.coco?.serviceMaxParsingAttempts
|
|
682
690
|
? Number(gitConfigParsed.coco.serviceMaxParsingAttempts)
|
|
683
691
|
: undefined,
|
|
692
|
+
baseURL: gitConfigParsed.coco?.serviceBaseURL,
|
|
684
693
|
authentication: {
|
|
685
694
|
type: 'APIKey',
|
|
686
695
|
credentials: {
|
|
@@ -760,6 +769,11 @@ const appendToGitConfig = async (filePath, config) => {
|
|
|
760
769
|
if (service.requestOptions?.maxRetries) {
|
|
761
770
|
contentLines.push(` serviceRequestOptionsMaxRetries = ${service.requestOptions.maxRetries}`);
|
|
762
771
|
}
|
|
772
|
+
// Handle baseURL for OpenAI
|
|
773
|
+
if (service.provider === 'openai' && 'baseURL' in service && service.baseURL) {
|
|
774
|
+
contentLines.push(` serviceBaseURL = ${service.baseURL}`);
|
|
775
|
+
}
|
|
776
|
+
// Handle endpoint for Ollama
|
|
763
777
|
if (service.provider === 'ollama') {
|
|
764
778
|
const ollamaService = service;
|
|
765
779
|
if (ollamaService.endpoint) {
|
|
@@ -950,6 +964,14 @@ const schema$1 = {
|
|
|
950
964
|
"model": {
|
|
951
965
|
"$ref": "#/definitions/LLMModel"
|
|
952
966
|
},
|
|
967
|
+
"baseURL": {
|
|
968
|
+
"type": "string",
|
|
969
|
+
"description": "Custom base URL for OpenAI-compatible APIs (e.g., OpenRouter, Azure OpenAI). If not specified, uses the default OpenAI API endpoint.",
|
|
970
|
+
"examples": [
|
|
971
|
+
"https://openrouter.ai/api/v1",
|
|
972
|
+
"https://your-resource.openai.azure.com"
|
|
973
|
+
]
|
|
974
|
+
},
|
|
953
975
|
"fields": {
|
|
954
976
|
"type": "object",
|
|
955
977
|
"additionalProperties": false,
|
|
@@ -2224,12 +2246,14 @@ function parseServiceConfig(service) {
|
|
|
2224
2246
|
return {
|
|
2225
2247
|
provider: 'openai',
|
|
2226
2248
|
model: service.model,
|
|
2249
|
+
baseURL: service.baseURL,
|
|
2227
2250
|
authentication: {
|
|
2228
2251
|
type: 'APIKey',
|
|
2229
2252
|
credentials: {
|
|
2230
2253
|
apiKey: service.apiKey
|
|
2231
2254
|
}
|
|
2232
|
-
}
|
|
2255
|
+
},
|
|
2256
|
+
fields: service.fields
|
|
2233
2257
|
};
|
|
2234
2258
|
case 'anthropic':
|
|
2235
2259
|
return {
|
|
@@ -6324,11 +6348,22 @@ function getLlm(provider, model, config) {
|
|
|
6324
6348
|
model,
|
|
6325
6349
|
});
|
|
6326
6350
|
case 'openai':
|
|
6327
|
-
|
|
6351
|
+
const openaiConfig = {
|
|
6328
6352
|
apiKey: apiKey,
|
|
6329
6353
|
model,
|
|
6330
6354
|
temperature: config.service.temperature || 0.2,
|
|
6331
|
-
}
|
|
6355
|
+
};
|
|
6356
|
+
// Add custom base URL if specified (for OpenRouter, Azure OpenAI, etc.)
|
|
6357
|
+
if ('baseURL' in config.service && config.service.baseURL) {
|
|
6358
|
+
openaiConfig.configuration = {
|
|
6359
|
+
baseURL: config.service.baseURL,
|
|
6360
|
+
};
|
|
6361
|
+
}
|
|
6362
|
+
// Merge any additional fields from config
|
|
6363
|
+
if ('fields' in config.service && config.service.fields) {
|
|
6364
|
+
Object.assign(openaiConfig, config.service.fields);
|
|
6365
|
+
}
|
|
6366
|
+
return new openai.ChatOpenAI(openaiConfig);
|
|
6332
6367
|
default:
|
|
6333
6368
|
throw new LangChainConfigurationError(`getLlm: Unsupported provider '${provider}'`, { provider, model, supportedProviders: ['openai', 'anthropic', 'ollama'] });
|
|
6334
6369
|
}
|