donobu 5.19.0 → 5.20.1
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/clients/OllamaGptClient.d.ts +1 -1
- package/dist/clients/OllamaGptClient.js +19 -10
- package/dist/esm/clients/OllamaGptClient.d.ts +1 -1
- package/dist/esm/clients/OllamaGptClient.js +19 -10
- package/dist/esm/exceptions/GptModelCapabilityException.d.ts +12 -0
- package/dist/esm/exceptions/GptModelCapabilityException.js +19 -0
- package/dist/esm/lib/test/testExtension.js +2 -0
- package/dist/exceptions/GptModelCapabilityException.d.ts +12 -0
- package/dist/exceptions/GptModelCapabilityException.js +19 -0
- package/dist/lib/test/testExtension.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ZodType } from 'zod/v4';
|
|
2
2
|
import type { OllamaConfig } from '../models/GptConfig';
|
|
3
3
|
import type { AssistantMessage, GptMessage, ProposedToolCallsMessage, StructuredOutputMessage } from '../models/GptMessage';
|
|
4
4
|
import type { ToolOption } from './GptClient';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OllamaGptClient = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const GptModelCapabilityException_1 = require("../exceptions/GptModelCapabilityException");
|
|
4
6
|
const GptModelNotFoundException_1 = require("../exceptions/GptModelNotFoundException");
|
|
5
7
|
const GptPlatformNotReachableException_1 = require("../exceptions/GptPlatformNotReachableException");
|
|
6
8
|
const Logger_1 = require("../utils/Logger");
|
|
@@ -23,9 +25,15 @@ class OllamaGptClient extends GptClient_1.GptClient {
|
|
|
23
25
|
}
|
|
24
26
|
async ping(options) {
|
|
25
27
|
const signal = options?.signal ?? AbortSignal.timeout(10_000);
|
|
28
|
+
const modelName = this.config.modelName;
|
|
26
29
|
let resp;
|
|
27
30
|
try {
|
|
28
|
-
resp = await fetch(`${this.apiUrl}/api/
|
|
31
|
+
resp = await fetch(`${this.apiUrl}/api/show`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: { 'Content-Type': 'application/json' },
|
|
34
|
+
body: JSON.stringify({ model: modelName }),
|
|
35
|
+
signal,
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
catch (error) {
|
|
31
39
|
if (error instanceof TypeError) {
|
|
@@ -34,18 +42,19 @@ class OllamaGptClient extends GptClient_1.GptClient {
|
|
|
34
42
|
}
|
|
35
43
|
throw error;
|
|
36
44
|
}
|
|
45
|
+
if (resp.status === 404) {
|
|
46
|
+
throw new GptModelNotFoundException_1.GptModelNotFoundException(this.config.type, modelName);
|
|
47
|
+
}
|
|
37
48
|
if (!resp.ok) {
|
|
38
49
|
throw new GptPlatformNotReachableException_1.GptPlatformNotReachableException(this.config.type);
|
|
39
50
|
}
|
|
40
|
-
const data =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!found) {
|
|
48
|
-
throw new GptModelNotFoundException_1.GptModelNotFoundException(this.config.type, modelName);
|
|
51
|
+
const data = v4_1.z
|
|
52
|
+
.object({ capabilities: v4_1.z.array(v4_1.z.string()).default([]) })
|
|
53
|
+
.parse(await resp.json());
|
|
54
|
+
const requiredCapabilities = ['completion', 'tools', 'vision'];
|
|
55
|
+
const missingCapabilities = requiredCapabilities.filter((cap) => !data.capabilities.includes(cap));
|
|
56
|
+
if (missingCapabilities.length > 0) {
|
|
57
|
+
throw new GptModelCapabilityException_1.GptModelCapabilityException(this.config.type, modelName, missingCapabilities);
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
async getMessage(messages, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ZodType } from 'zod/v4';
|
|
2
2
|
import type { OllamaConfig } from '../models/GptConfig';
|
|
3
3
|
import type { AssistantMessage, GptMessage, ProposedToolCallsMessage, StructuredOutputMessage } from '../models/GptMessage';
|
|
4
4
|
import type { ToolOption } from './GptClient';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OllamaGptClient = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const GptModelCapabilityException_1 = require("../exceptions/GptModelCapabilityException");
|
|
4
6
|
const GptModelNotFoundException_1 = require("../exceptions/GptModelNotFoundException");
|
|
5
7
|
const GptPlatformNotReachableException_1 = require("../exceptions/GptPlatformNotReachableException");
|
|
6
8
|
const Logger_1 = require("../utils/Logger");
|
|
@@ -23,9 +25,15 @@ class OllamaGptClient extends GptClient_1.GptClient {
|
|
|
23
25
|
}
|
|
24
26
|
async ping(options) {
|
|
25
27
|
const signal = options?.signal ?? AbortSignal.timeout(10_000);
|
|
28
|
+
const modelName = this.config.modelName;
|
|
26
29
|
let resp;
|
|
27
30
|
try {
|
|
28
|
-
resp = await fetch(`${this.apiUrl}/api/
|
|
31
|
+
resp = await fetch(`${this.apiUrl}/api/show`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: { 'Content-Type': 'application/json' },
|
|
34
|
+
body: JSON.stringify({ model: modelName }),
|
|
35
|
+
signal,
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
catch (error) {
|
|
31
39
|
if (error instanceof TypeError) {
|
|
@@ -34,18 +42,19 @@ class OllamaGptClient extends GptClient_1.GptClient {
|
|
|
34
42
|
}
|
|
35
43
|
throw error;
|
|
36
44
|
}
|
|
45
|
+
if (resp.status === 404) {
|
|
46
|
+
throw new GptModelNotFoundException_1.GptModelNotFoundException(this.config.type, modelName);
|
|
47
|
+
}
|
|
37
48
|
if (!resp.ok) {
|
|
38
49
|
throw new GptPlatformNotReachableException_1.GptPlatformNotReachableException(this.config.type);
|
|
39
50
|
}
|
|
40
|
-
const data =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!found) {
|
|
48
|
-
throw new GptModelNotFoundException_1.GptModelNotFoundException(this.config.type, modelName);
|
|
51
|
+
const data = v4_1.z
|
|
52
|
+
.object({ capabilities: v4_1.z.array(v4_1.z.string()).default([]) })
|
|
53
|
+
.parse(await resp.json());
|
|
54
|
+
const requiredCapabilities = ['completion', 'tools', 'vision'];
|
|
55
|
+
const missingCapabilities = requiredCapabilities.filter((cap) => !data.capabilities.includes(cap));
|
|
56
|
+
if (missingCapabilities.length > 0) {
|
|
57
|
+
throw new GptModelCapabilityException_1.GptModelCapabilityException(this.config.type, modelName, missingCapabilities);
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
async getMessage(messages, options) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DonobuException } from './DonobuException';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a model exists but lacks required capabilities
|
|
4
|
+
* (e.g. completion, tools, or vision).
|
|
5
|
+
*/
|
|
6
|
+
export declare class GptModelCapabilityException extends DonobuException {
|
|
7
|
+
readonly platform: string;
|
|
8
|
+
readonly gptModel: string;
|
|
9
|
+
readonly missingCapabilities: string[];
|
|
10
|
+
constructor(platform: string, gptModel: string, missingCapabilities: string[]);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=GptModelCapabilityException.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GptModelCapabilityException = void 0;
|
|
4
|
+
const DonobuException_1 = require("./DonobuException");
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when a model exists but lacks required capabilities
|
|
7
|
+
* (e.g. completion, tools, or vision).
|
|
8
|
+
*/
|
|
9
|
+
class GptModelCapabilityException extends DonobuException_1.DonobuException {
|
|
10
|
+
constructor(platform, gptModel, missingCapabilities) {
|
|
11
|
+
super(`The model '${gptModel}' on '${platform}' is missing required capabilities: ${missingCapabilities.join(', ')}. ` +
|
|
12
|
+
`Please choose a model that supports completion, tools, and vision.`);
|
|
13
|
+
this.platform = platform;
|
|
14
|
+
this.gptModel = gptModel;
|
|
15
|
+
this.missingCapabilities = missingCapabilities;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GptModelCapabilityException = GptModelCapabilityException;
|
|
19
|
+
//# sourceMappingURL=GptModelCapabilityException.js.map
|
|
@@ -82,6 +82,7 @@ exports.test = test_1.test.extend({
|
|
|
82
82
|
],
|
|
83
83
|
// Override the default page fixture
|
|
84
84
|
page: async ({ page, gptClient, headless, flowLoggingContext }, use, testInfo) => {
|
|
85
|
+
Logger_1.appLogger.info(`Test started: "${testInfo.title}"`);
|
|
85
86
|
const overallObjective = testInfo.annotations.find((v) => v.type === 'objective')?.description ??
|
|
86
87
|
null;
|
|
87
88
|
const visualCueDurationMs = v4_1.z
|
|
@@ -338,6 +339,7 @@ async function finalizeTest(page, testInfo, logBuffer) {
|
|
|
338
339
|
Logger_1.appLogger.error('tbd: failed to flush replacements', error);
|
|
339
340
|
}
|
|
340
341
|
}
|
|
342
|
+
Logger_1.appLogger.info(`Test ended: "${testInfo.title}" — status: ${testInfo.status}`);
|
|
341
343
|
}
|
|
342
344
|
/**
|
|
343
345
|
* A "v1" test is one that was generated by the Donobu app and
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DonobuException } from './DonobuException';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a model exists but lacks required capabilities
|
|
4
|
+
* (e.g. completion, tools, or vision).
|
|
5
|
+
*/
|
|
6
|
+
export declare class GptModelCapabilityException extends DonobuException {
|
|
7
|
+
readonly platform: string;
|
|
8
|
+
readonly gptModel: string;
|
|
9
|
+
readonly missingCapabilities: string[];
|
|
10
|
+
constructor(platform: string, gptModel: string, missingCapabilities: string[]);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=GptModelCapabilityException.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GptModelCapabilityException = void 0;
|
|
4
|
+
const DonobuException_1 = require("./DonobuException");
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when a model exists but lacks required capabilities
|
|
7
|
+
* (e.g. completion, tools, or vision).
|
|
8
|
+
*/
|
|
9
|
+
class GptModelCapabilityException extends DonobuException_1.DonobuException {
|
|
10
|
+
constructor(platform, gptModel, missingCapabilities) {
|
|
11
|
+
super(`The model '${gptModel}' on '${platform}' is missing required capabilities: ${missingCapabilities.join(', ')}. ` +
|
|
12
|
+
`Please choose a model that supports completion, tools, and vision.`);
|
|
13
|
+
this.platform = platform;
|
|
14
|
+
this.gptModel = gptModel;
|
|
15
|
+
this.missingCapabilities = missingCapabilities;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GptModelCapabilityException = GptModelCapabilityException;
|
|
19
|
+
//# sourceMappingURL=GptModelCapabilityException.js.map
|
|
@@ -82,6 +82,7 @@ exports.test = test_1.test.extend({
|
|
|
82
82
|
],
|
|
83
83
|
// Override the default page fixture
|
|
84
84
|
page: async ({ page, gptClient, headless, flowLoggingContext }, use, testInfo) => {
|
|
85
|
+
Logger_1.appLogger.info(`Test started: "${testInfo.title}"`);
|
|
85
86
|
const overallObjective = testInfo.annotations.find((v) => v.type === 'objective')?.description ??
|
|
86
87
|
null;
|
|
87
88
|
const visualCueDurationMs = v4_1.z
|
|
@@ -338,6 +339,7 @@ async function finalizeTest(page, testInfo, logBuffer) {
|
|
|
338
339
|
Logger_1.appLogger.error('tbd: failed to flush replacements', error);
|
|
339
340
|
}
|
|
340
341
|
}
|
|
342
|
+
Logger_1.appLogger.info(`Test ended: "${testInfo.title}" — status: ${testInfo.status}`);
|
|
341
343
|
}
|
|
342
344
|
/**
|
|
343
345
|
* A "v1" test is one that was generated by the Donobu app and
|