donobu 5.21.6 → 5.21.8

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.
@@ -8,8 +8,9 @@ import { GptClient } from './GptClient';
8
8
  */
9
9
  export declare class DonobuGptClient extends GptClient {
10
10
  private readonly delegate;
11
+ private readonly apiUrl;
11
12
  constructor(donobuGptClientConfig: DonobuGptClientConfig, apiUrl?: string);
12
- ping(_options?: {
13
+ ping(options?: {
13
14
  signal?: AbortSignal;
14
15
  }): Promise<void>;
15
16
  getMessage(messages: GptMessage[], options?: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DonobuGptClient = void 0;
4
4
  const v4_1 = require("zod/v4");
5
5
  const envVars_1 = require("../envVars");
6
+ const GptPlatformAuthenticationFailedException_1 = require("../exceptions/GptPlatformAuthenticationFailedException");
6
7
  const GoogleGenerativeAiGptClient_1 = require("./GoogleGenerativeAiGptClient");
7
8
  const GptClient_1 = require("./GptClient");
8
9
  const OpenAiGptClient_1 = require("./OpenAiGptClient");
@@ -12,14 +13,26 @@ const OpenAiGptClient_1 = require("./OpenAiGptClient");
12
13
  class DonobuGptClient extends GptClient_1.GptClient {
13
14
  constructor(donobuGptClientConfig, apiUrl = envVars_1.env.data.DONOBU_API_BASE_URL) {
14
15
  super(donobuGptClientConfig);
16
+ this.apiUrl = apiUrl;
15
17
  this.delegate = new OpenAiGptClient_1.OpenAiGptClient({
16
18
  type: 'OPENAI',
17
19
  modelName: '',
18
20
  apiKey: donobuGptClientConfig.apiKey,
19
21
  }, apiUrl);
20
22
  }
21
- async ping(_options) {
22
- return;
23
+ async ping(options) {
24
+ const donobuConfig = this.config;
25
+ const resp = await fetch(`${this.apiUrl}/v1/flows?limit=1`, {
26
+ method: 'GET',
27
+ headers: { Authorization: `Bearer ${donobuConfig.apiKey}` },
28
+ signal: options?.signal,
29
+ });
30
+ if (resp.status === 401) {
31
+ throw new GptPlatformAuthenticationFailedException_1.GptPlatformAuthenticationFailedException(this.config.type);
32
+ }
33
+ else if (!resp.ok) {
34
+ throw new Error(`Donobu API ping failed with status ${resp.status}: ${await resp.text()}`);
35
+ }
23
36
  }
24
37
  async getMessage(messages, options) {
25
38
  return this.delegate.getMessage(messages, options);
@@ -8,8 +8,9 @@ import { GptClient } from './GptClient';
8
8
  */
9
9
  export declare class DonobuGptClient extends GptClient {
10
10
  private readonly delegate;
11
+ private readonly apiUrl;
11
12
  constructor(donobuGptClientConfig: DonobuGptClientConfig, apiUrl?: string);
12
- ping(_options?: {
13
+ ping(options?: {
13
14
  signal?: AbortSignal;
14
15
  }): Promise<void>;
15
16
  getMessage(messages: GptMessage[], options?: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DonobuGptClient = void 0;
4
4
  const v4_1 = require("zod/v4");
5
5
  const envVars_1 = require("../envVars");
6
+ const GptPlatformAuthenticationFailedException_1 = require("../exceptions/GptPlatformAuthenticationFailedException");
6
7
  const GoogleGenerativeAiGptClient_1 = require("./GoogleGenerativeAiGptClient");
7
8
  const GptClient_1 = require("./GptClient");
8
9
  const OpenAiGptClient_1 = require("./OpenAiGptClient");
@@ -12,14 +13,26 @@ const OpenAiGptClient_1 = require("./OpenAiGptClient");
12
13
  class DonobuGptClient extends GptClient_1.GptClient {
13
14
  constructor(donobuGptClientConfig, apiUrl = envVars_1.env.data.DONOBU_API_BASE_URL) {
14
15
  super(donobuGptClientConfig);
16
+ this.apiUrl = apiUrl;
15
17
  this.delegate = new OpenAiGptClient_1.OpenAiGptClient({
16
18
  type: 'OPENAI',
17
19
  modelName: '',
18
20
  apiKey: donobuGptClientConfig.apiKey,
19
21
  }, apiUrl);
20
22
  }
21
- async ping(_options) {
22
- return;
23
+ async ping(options) {
24
+ const donobuConfig = this.config;
25
+ const resp = await fetch(`${this.apiUrl}/v1/flows?limit=1`, {
26
+ method: 'GET',
27
+ headers: { Authorization: `Bearer ${donobuConfig.apiKey}` },
28
+ signal: options?.signal,
29
+ });
30
+ if (resp.status === 401) {
31
+ throw new GptPlatformAuthenticationFailedException_1.GptPlatformAuthenticationFailedException(this.config.type);
32
+ }
33
+ else if (!resp.ok) {
34
+ throw new Error(`Donobu API ping failed with status ${resp.status}: ${await resp.text()}`);
35
+ }
23
36
  }
24
37
  async getMessage(messages, options) {
25
38
  return this.delegate.getMessage(messages, options);
@@ -27,7 +27,6 @@ export declare const PlaywrightAssertionStepSchema: z.ZodObject<{
27
27
  toHaveURL: "toHaveURL";
28
28
  }>;
29
29
  attributeValue: z.ZodNullable<z.ZodString>;
30
- useFirst: z.ZodBoolean;
31
30
  }, z.core.$strip>;
32
31
  export type PlaywrightAssertionStep = z.infer<typeof PlaywrightAssertionStepSchema>;
33
32
  export type AssertCacheExecutor = (context: {
@@ -81,10 +81,6 @@ Common roles: 'heading', 'button', 'link', 'tab', 'tabpanel', 'dialog', 'navigat
81
81
  - toHaveAttribute: set to the expected attribute value (e.g. "true" when value="aria-selected")
82
82
  - toContainText: set to the text substring to match within the element
83
83
  - All other assertions: set to null`),
84
- /** Whether to narrow to the first match via .first() when the locator might match multiple elements. */
85
- useFirst: v4_1.z
86
- .boolean()
87
- .describe('Set to true to call .first() on the locator when the selector might match multiple elements.'),
88
84
  });
89
85
  /**
90
86
  * Builds an executor function from structured assertion steps.
@@ -50,17 +50,6 @@ export declare class DonobuFlowsManager {
50
50
  private readonly flowRuntime;
51
51
  private readonly flowCatalog;
52
52
  constructor(deploymentEnvironment: DonobuDeploymentEnvironment, gptClientFactory: GptClientFactory, gptConfigsManager: GptConfigsManager, agentsManager: AgentsManager, flowsPersistenceRegistry: FlowsPersistenceRegistry, envDataManager: EnvDataManager, controlPanelFactory: ControlPanelFactory, environ: EnvPick<typeof env, 'ANTHROPIC_API_KEY' | 'ANTHROPIC_MODEL_NAME' | 'AWS_ACCESS_KEY_ID' | 'AWS_BEDROCK_MODEL_NAME' | 'AWS_SECRET_ACCESS_KEY' | 'BASE64_GPT_CONFIG' | 'BROWSERBASE_API_KEY' | 'BROWSERBASE_PROJECT_ID' | 'DONOBU_API_KEY' | 'GOOGLE_GENERATIVE_AI_API_KEY' | 'GOOGLE_GENERATIVE_AI_MODEL_NAME' | 'OLLAMA_API_URL' | 'OLLAMA_MODEL_NAME' | 'OPENAI_API_KEY' | 'OPENAI_API_MODEL_NAME'>, toolRegistry: ToolRegistry, targetRuntimePlugins: TargetRuntimePluginRegistry);
53
- /**
54
- * Create a flow with the given parameters and invoke its `DonobuFlow#run`
55
- * method, adding it to list of active flows.
56
- *
57
- * @param gptClient If present, will use this as the associated GPT client for
58
- * this flow instead of instantiating a new one. If so, the
59
- * gptConfigNameOverride field will be ignored.
60
- * @param browserContextOverride If present, will use this as the browser
61
- * context instead of instantiating a new one. If so, most browser
62
- * related parameters are will be ignored.
63
- */
64
53
  /**
65
54
  * Create a flow with the given parameters and invoke its `DonobuFlow#run`
66
55
  * method, adding it to list of active flows.
@@ -87,17 +87,6 @@ class DonobuFlowsManager {
87
87
  this.flowRuntime = new FlowRuntime_1.FlowRuntime();
88
88
  this.flowCatalog = new FlowCatalog_1.FlowCatalog(this.flowsPersistenceRegistry, this.flowRuntime, this.deploymentEnvironment);
89
89
  }
90
- /**
91
- * Create a flow with the given parameters and invoke its `DonobuFlow#run`
92
- * method, adding it to list of active flows.
93
- *
94
- * @param gptClient If present, will use this as the associated GPT client for
95
- * this flow instead of instantiating a new one. If so, the
96
- * gptConfigNameOverride field will be ignored.
97
- * @param browserContextOverride If present, will use this as the browser
98
- * context instead of instantiating a new one. If so, most browser
99
- * related parameters are will be ignored.
100
- */
101
90
  /**
102
91
  * Create a flow with the given parameters and invoke its `DonobuFlow#run`
103
92
  * method, adding it to list of active flows.
@@ -69,26 +69,30 @@ checking vibes, tone, relying on screenshots, etc) to express as a combination o
69
69
 
70
70
  Examples of how assertions map to steps:
71
71
  - "Organization Settings heading is visible" →
72
- [{ locator: "role", role: "heading", value: "Organization Settings", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
72
+ [{ locator: "role", role: "heading", value: "Organization Settings", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
73
73
  - "Create Template button is visible" →
74
- [{ locator: "role", role: "button", value: "Create Template", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
74
+ [{ locator: "role", role: "button", value: "Create Template", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
75
75
  - "pagination shows Page 2 of N" →
76
- [{ locator: "text", role: null, value: "Page 2 of \\\\d+", valueIsRegex: true, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
76
+ [{ locator: "text", role: null, value: "Page 2 of \\\\d+", valueIsRegex: true, assertion: "toBeVisible", attributeValue: null }]
77
77
  - "Programs and Templates tabs are visible" →
78
- [{ locator: "role", role: "tab", value: "Programs", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false },
79
- { locator: "role", role: "tab", value: "Templates", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
78
+ [{ locator: "role", role: "tab", value: "Programs", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null },
79
+ { locator: "role", role: "tab", value: "Templates", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
80
80
  - "template X is NOT listed" →
81
- [{ locator: "text", role: null, value: "X", valueIsRegex: false, assertion: "toBeHidden", attributeValue: null, useFirst: false }]
81
+ [{ locator: "text", role: null, value: "X", valueIsRegex: false, assertion: "toBeHidden", attributeValue: null }]
82
82
  - "Next Page is disabled" →
83
- [{ locator: "role", role: "button", value: "Next Page", valueIsRegex: false, assertion: "toBeDisabled", attributeValue: null, useFirst: false }]
83
+ [{ locator: "role", role: "button", value: "Next Page", valueIsRegex: false, assertion: "toBeDisabled", attributeValue: null }]
84
84
  - "The JSON Configuration radio button is selected" →
85
- [{ locator: "role", role: "radio", value: "JSON Configuration", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null, useFirst: false }]
85
+ [{ locator: "role", role: "radio", value: "JSON Configuration", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null }]
86
86
  - "The 'Use installed app' toggle is on" →
87
- [{ locator: "label", role: null, value: "Use installed app", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null, useFirst: false }]
87
+ [{ locator: "label", role: null, value: "Use installed app", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null }]
88
88
  - "The Device Name field contains 'My Device Name'" →
89
- [{ locator: "label", role: null, value: "Device Name", valueIsRegex: false, assertion: "toHaveValue", attributeValue: "My Device Name", useFirst: false }]
89
+ [{ locator: "label", role: null, value: "Device Name", valueIsRegex: false, assertion: "toHaveValue", attributeValue: "My Device Name" }]
90
90
  - "The Assert Page tool is selected" →
91
- [{ locator: "role", role: "tab", value: "Assert Page", valueIsRegex: false, assertion: "toHaveAttribute", attributeValue: "true", useFirst: false }]`),
91
+ [{ locator: "role", role: "tab", value: "Assert Page", valueIsRegex: false, assertion: "toHaveAttribute", attributeValue: "true" }]
92
+ - "The current URL path is the settings page" →
93
+ [{ locator: "text", role: null, value: ".+/settings/general/?$", valueIsRegex: true, assertion: "toHaveURL", attributeValue: null }]
94
+ - "The current URL path is for a user" →
95
+ [{ locator: "text", role: null, value: ".+/users/[\\d]+/?$", valueIsRegex: true, assertion: "toHaveURL", attributeValue: null }]`),
92
96
  });
93
97
  class AssertTool extends Tool_1.Tool {
94
98
  constructor() {
@@ -27,7 +27,6 @@ export declare const PlaywrightAssertionStepSchema: z.ZodObject<{
27
27
  toHaveURL: "toHaveURL";
28
28
  }>;
29
29
  attributeValue: z.ZodNullable<z.ZodString>;
30
- useFirst: z.ZodBoolean;
31
30
  }, z.core.$strip>;
32
31
  export type PlaywrightAssertionStep = z.infer<typeof PlaywrightAssertionStepSchema>;
33
32
  export type AssertCacheExecutor = (context: {
@@ -81,10 +81,6 @@ Common roles: 'heading', 'button', 'link', 'tab', 'tabpanel', 'dialog', 'navigat
81
81
  - toHaveAttribute: set to the expected attribute value (e.g. "true" when value="aria-selected")
82
82
  - toContainText: set to the text substring to match within the element
83
83
  - All other assertions: set to null`),
84
- /** Whether to narrow to the first match via .first() when the locator might match multiple elements. */
85
- useFirst: v4_1.z
86
- .boolean()
87
- .describe('Set to true to call .first() on the locator when the selector might match multiple elements.'),
88
84
  });
89
85
  /**
90
86
  * Builds an executor function from structured assertion steps.
@@ -50,17 +50,6 @@ export declare class DonobuFlowsManager {
50
50
  private readonly flowRuntime;
51
51
  private readonly flowCatalog;
52
52
  constructor(deploymentEnvironment: DonobuDeploymentEnvironment, gptClientFactory: GptClientFactory, gptConfigsManager: GptConfigsManager, agentsManager: AgentsManager, flowsPersistenceRegistry: FlowsPersistenceRegistry, envDataManager: EnvDataManager, controlPanelFactory: ControlPanelFactory, environ: EnvPick<typeof env, 'ANTHROPIC_API_KEY' | 'ANTHROPIC_MODEL_NAME' | 'AWS_ACCESS_KEY_ID' | 'AWS_BEDROCK_MODEL_NAME' | 'AWS_SECRET_ACCESS_KEY' | 'BASE64_GPT_CONFIG' | 'BROWSERBASE_API_KEY' | 'BROWSERBASE_PROJECT_ID' | 'DONOBU_API_KEY' | 'GOOGLE_GENERATIVE_AI_API_KEY' | 'GOOGLE_GENERATIVE_AI_MODEL_NAME' | 'OLLAMA_API_URL' | 'OLLAMA_MODEL_NAME' | 'OPENAI_API_KEY' | 'OPENAI_API_MODEL_NAME'>, toolRegistry: ToolRegistry, targetRuntimePlugins: TargetRuntimePluginRegistry);
53
- /**
54
- * Create a flow with the given parameters and invoke its `DonobuFlow#run`
55
- * method, adding it to list of active flows.
56
- *
57
- * @param gptClient If present, will use this as the associated GPT client for
58
- * this flow instead of instantiating a new one. If so, the
59
- * gptConfigNameOverride field will be ignored.
60
- * @param browserContextOverride If present, will use this as the browser
61
- * context instead of instantiating a new one. If so, most browser
62
- * related parameters are will be ignored.
63
- */
64
53
  /**
65
54
  * Create a flow with the given parameters and invoke its `DonobuFlow#run`
66
55
  * method, adding it to list of active flows.
@@ -87,17 +87,6 @@ class DonobuFlowsManager {
87
87
  this.flowRuntime = new FlowRuntime_1.FlowRuntime();
88
88
  this.flowCatalog = new FlowCatalog_1.FlowCatalog(this.flowsPersistenceRegistry, this.flowRuntime, this.deploymentEnvironment);
89
89
  }
90
- /**
91
- * Create a flow with the given parameters and invoke its `DonobuFlow#run`
92
- * method, adding it to list of active flows.
93
- *
94
- * @param gptClient If present, will use this as the associated GPT client for
95
- * this flow instead of instantiating a new one. If so, the
96
- * gptConfigNameOverride field will be ignored.
97
- * @param browserContextOverride If present, will use this as the browser
98
- * context instead of instantiating a new one. If so, most browser
99
- * related parameters are will be ignored.
100
- */
101
90
  /**
102
91
  * Create a flow with the given parameters and invoke its `DonobuFlow#run`
103
92
  * method, adding it to list of active flows.
@@ -69,26 +69,30 @@ checking vibes, tone, relying on screenshots, etc) to express as a combination o
69
69
 
70
70
  Examples of how assertions map to steps:
71
71
  - "Organization Settings heading is visible" →
72
- [{ locator: "role", role: "heading", value: "Organization Settings", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
72
+ [{ locator: "role", role: "heading", value: "Organization Settings", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
73
73
  - "Create Template button is visible" →
74
- [{ locator: "role", role: "button", value: "Create Template", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
74
+ [{ locator: "role", role: "button", value: "Create Template", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
75
75
  - "pagination shows Page 2 of N" →
76
- [{ locator: "text", role: null, value: "Page 2 of \\\\d+", valueIsRegex: true, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
76
+ [{ locator: "text", role: null, value: "Page 2 of \\\\d+", valueIsRegex: true, assertion: "toBeVisible", attributeValue: null }]
77
77
  - "Programs and Templates tabs are visible" →
78
- [{ locator: "role", role: "tab", value: "Programs", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false },
79
- { locator: "role", role: "tab", value: "Templates", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null, useFirst: false }]
78
+ [{ locator: "role", role: "tab", value: "Programs", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null },
79
+ { locator: "role", role: "tab", value: "Templates", valueIsRegex: false, assertion: "toBeVisible", attributeValue: null }]
80
80
  - "template X is NOT listed" →
81
- [{ locator: "text", role: null, value: "X", valueIsRegex: false, assertion: "toBeHidden", attributeValue: null, useFirst: false }]
81
+ [{ locator: "text", role: null, value: "X", valueIsRegex: false, assertion: "toBeHidden", attributeValue: null }]
82
82
  - "Next Page is disabled" →
83
- [{ locator: "role", role: "button", value: "Next Page", valueIsRegex: false, assertion: "toBeDisabled", attributeValue: null, useFirst: false }]
83
+ [{ locator: "role", role: "button", value: "Next Page", valueIsRegex: false, assertion: "toBeDisabled", attributeValue: null }]
84
84
  - "The JSON Configuration radio button is selected" →
85
- [{ locator: "role", role: "radio", value: "JSON Configuration", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null, useFirst: false }]
85
+ [{ locator: "role", role: "radio", value: "JSON Configuration", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null }]
86
86
  - "The 'Use installed app' toggle is on" →
87
- [{ locator: "label", role: null, value: "Use installed app", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null, useFirst: false }]
87
+ [{ locator: "label", role: null, value: "Use installed app", valueIsRegex: false, assertion: "toBeChecked", attributeValue: null }]
88
88
  - "The Device Name field contains 'My Device Name'" →
89
- [{ locator: "label", role: null, value: "Device Name", valueIsRegex: false, assertion: "toHaveValue", attributeValue: "My Device Name", useFirst: false }]
89
+ [{ locator: "label", role: null, value: "Device Name", valueIsRegex: false, assertion: "toHaveValue", attributeValue: "My Device Name" }]
90
90
  - "The Assert Page tool is selected" →
91
- [{ locator: "role", role: "tab", value: "Assert Page", valueIsRegex: false, assertion: "toHaveAttribute", attributeValue: "true", useFirst: false }]`),
91
+ [{ locator: "role", role: "tab", value: "Assert Page", valueIsRegex: false, assertion: "toHaveAttribute", attributeValue: "true" }]
92
+ - "The current URL path is the settings page" →
93
+ [{ locator: "text", role: null, value: ".+/settings/general/?$", valueIsRegex: true, assertion: "toHaveURL", attributeValue: null }]
94
+ - "The current URL path is for a user" →
95
+ [{ locator: "text", role: null, value: ".+/users/[\\d]+/?$", valueIsRegex: true, assertion: "toHaveURL", attributeValue: null }]`),
92
96
  });
93
97
  class AssertTool extends Tool_1.Tool {
94
98
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "5.21.6",
3
+ "version": "5.21.8",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",