task-o-matic 0.0.31 → 0.0.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/gemini-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"gemini-proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/gemini-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmBxD,qBAAa,mBAAoB,YAAW,eAAe;IACzD,QAAQ,CAAC,oBAAoB,QAAQ;IACrC,QAAQ,CAAC,QAAQ,YAAY;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,2BAA2B,UAAU;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAM;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAM;IAC7B,OAAO,CAAC,SAAS,CAAgC;gBAErC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;IAKxC,OAAO,CAAC,YAAY;IASd,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAKtC,QAAQ,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAI3C"}
|
|
@@ -1,89 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.GeminiProviderProxy = void 0;
|
|
37
|
-
|
|
38
|
-
|
|
4
|
+
let _createGeminiProvider = null;
|
|
5
|
+
function getCreateGeminiProvider() {
|
|
6
|
+
if (_createGeminiProvider)
|
|
7
|
+
return _createGeminiProvider;
|
|
8
|
+
if (typeof window !== "undefined") {
|
|
9
|
+
throw new Error("GeminiProviderProxy is only available in Node.js CLI environments.");
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
12
|
+
_createGeminiProvider =
|
|
13
|
+
require("ai-sdk-provider-gemini-cli").createGeminiProvider;
|
|
14
|
+
return _createGeminiProvider;
|
|
15
|
+
}
|
|
39
16
|
class GeminiProviderProxy {
|
|
40
17
|
specificationVersion = "v2";
|
|
41
18
|
provider = "gemini";
|
|
42
19
|
modelId;
|
|
43
20
|
defaultObjectGenerationMode = "json";
|
|
44
|
-
supportedUrls = {};
|
|
21
|
+
supportedUrls = {};
|
|
45
22
|
config;
|
|
46
23
|
realModel = null;
|
|
47
24
|
constructor(modelId, config) {
|
|
48
25
|
this.modelId = modelId;
|
|
49
26
|
this.config = config;
|
|
50
27
|
}
|
|
51
|
-
|
|
28
|
+
getRealModel() {
|
|
52
29
|
if (!this.realModel) {
|
|
53
|
-
|
|
54
|
-
// it claims to be ESM ("type": "module") but its "main" points to CJS.
|
|
55
|
-
// This crashes Node.js with "module is not defined".
|
|
56
|
-
// We must load the ESM entry point ("index.mjs") explicitly.
|
|
57
|
-
const projectRoot = process.cwd();
|
|
58
|
-
// Attempt to resolve the path explicitly to dist/index.mjs
|
|
59
|
-
let modulePath = path.join(projectRoot, "node_modules", "ai-sdk-provider-gemini-cli", "dist", "index.mjs");
|
|
60
|
-
if (!fs.existsSync(modulePath)) {
|
|
61
|
-
// Fallback for nested dep or monorepo structures (common in workspaces)
|
|
62
|
-
modulePath = path.join(projectRoot, "..", "..", "node_modules", "ai-sdk-provider-gemini-cli", "dist", "index.mjs");
|
|
63
|
-
if (!fs.existsSync(modulePath)) {
|
|
64
|
-
console.warn("GeminiProxy: Could not locate index.mjs manually. Falling back to default resolution.");
|
|
65
|
-
// Last ditch: try to rely on standard resolution.
|
|
66
|
-
// This will likely crash if the package isn't fixed, but it's the only remaining option.
|
|
67
|
-
const { createGeminiProvider } = await Promise.resolve().then(() => __importStar(require("ai-sdk-provider-gemini-cli")));
|
|
68
|
-
const provider = createGeminiProvider(this.config);
|
|
69
|
-
this.realModel = provider(this.modelId);
|
|
70
|
-
return this.realModel;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Dynamic import of the absolute path bypasses 'exports' restrictions
|
|
74
|
-
// and forces Node to load the correct ESM file.
|
|
75
|
-
const { createGeminiProvider } = await Promise.resolve(`${modulePath}`).then(s => __importStar(require(s)));
|
|
30
|
+
const createGeminiProvider = getCreateGeminiProvider();
|
|
76
31
|
const provider = createGeminiProvider(this.config);
|
|
77
32
|
this.realModel = provider(this.modelId);
|
|
78
33
|
}
|
|
79
34
|
return this.realModel;
|
|
80
35
|
}
|
|
81
36
|
async doGenerate(options) {
|
|
82
|
-
const model =
|
|
37
|
+
const model = this.getRealModel();
|
|
83
38
|
return model.doGenerate(options);
|
|
84
39
|
}
|
|
85
40
|
async doStream(options) {
|
|
86
|
-
const model =
|
|
41
|
+
const model = this.getRealModel();
|
|
87
42
|
return model.doStream(options);
|
|
88
43
|
}
|
|
89
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/model-provider.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,qBAAa,aAAa;IACjB,WAAW,IAAI,QAAQ;IAY9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAqCpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/model-provider.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,qBAAa,aAAa;IACjB,WAAW,IAAI,QAAQ;IAY9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAqCpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe;CA2H9C"}
|
|
@@ -5,8 +5,6 @@ const openai_1 = require("@ai-sdk/openai");
|
|
|
5
5
|
const anthropic_1 = require("@ai-sdk/anthropic");
|
|
6
6
|
const openai_compatible_1 = require("@ai-sdk/openai-compatible");
|
|
7
7
|
const ai_sdk_provider_1 = require("@openrouter/ai-sdk-provider");
|
|
8
|
-
// import { createGeminiProvider } from "ai-sdk-provider-gemini-cli";
|
|
9
|
-
const gemini_proxy_1 = require("./gemini-proxy");
|
|
10
8
|
const config_1 = require("../config");
|
|
11
9
|
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
12
10
|
class ModelProvider {
|
|
@@ -116,11 +114,12 @@ class ModelProvider {
|
|
|
116
114
|
baseURL,
|
|
117
115
|
});
|
|
118
116
|
return customProvider(model);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
// disable for now, import error in the app
|
|
118
|
+
// case "gemini":
|
|
119
|
+
// // Use Gemini CLI provider with OAuth via Proxy to handle lazy loading
|
|
120
|
+
// return new GeminiProviderProxy(model, {
|
|
121
|
+
// authType: "oauth-personal",
|
|
122
|
+
// });
|
|
124
123
|
case "zai":
|
|
125
124
|
if (!apiKey)
|
|
126
125
|
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_CONFIGURATION_ERROR, "Z.AI Coding plan API key is required", {
|