donobu 5.60.6 → 5.60.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.
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
2
  import type { ToolCallContext } from '../models/ToolCallContext';
3
- import type { ToolCallResult } from '../models/ToolCallResult';
3
+ import { ToolCallResult } from '../models/ToolCallResult';
4
4
  import { Tool } from './Tool';
5
5
  export declare const HandleBrowserDialogCoreSchema: z.ZodObject<{
6
6
  text: z.ZodNullable<z.ZodString>;
@@ -16,7 +16,7 @@ export declare const HandleBrowserDialogGptSchema: z.ZodObject<{
16
16
  export declare class HandleBrowserDialogTool extends Tool<typeof HandleBrowserDialogCoreSchema, typeof HandleBrowserDialogGptSchema> {
17
17
  static readonly NAME = "handleBrowserDialog";
18
18
  constructor();
19
- call(context: ToolCallContext, parameters: z.infer<typeof HandleBrowserDialogCoreSchema>): Promise<ToolCallResult>;
19
+ call(_context: ToolCallContext, _parameters: z.infer<typeof HandleBrowserDialogCoreSchema>): Promise<ToolCallResult>;
20
20
  callFromGpt(context: ToolCallContext, parameters: z.infer<typeof HandleBrowserDialogGptSchema>): Promise<ToolCallResult>;
21
21
  }
22
22
  //# sourceMappingURL=HandleBrowserDialogTool.d.ts.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HandleBrowserDialogTool = exports.HandleBrowserDialogGptSchema = exports.HandleBrowserDialogCoreSchema = void 0;
4
4
  const v4_1 = require("zod/v4");
5
+ const ToolCallResult_1 = require("../models/ToolCallResult");
5
6
  const ToolSchema_1 = require("../models/ToolSchema");
6
7
  const Tool_1 = require("./Tool");
7
8
  exports.HandleBrowserDialogCoreSchema = v4_1.z.object({
@@ -22,8 +23,13 @@ class HandleBrowserDialogTool extends Tool_1.Tool {
22
23
  constructor() {
23
24
  super(HandleBrowserDialogTool.NAME, 'Handle a browser Window:confirm() or Window:prompt().', exports.HandleBrowserDialogCoreSchema, exports.HandleBrowserDialogGptSchema, false, undefined, ['web']);
24
25
  }
25
- async call(context, parameters) {
26
- return this.call(context, parameters);
26
+ async call(_context, _parameters) {
27
+ // No-op. The dialog is actually accepted/dismissed by the Playwright dialog
28
+ // handler (see createWebDialogHandler), which also records this tool's
29
+ // outcome as a successful ToolCall. This class exists only as a
30
+ // schema/marker the LLM proposes; invoking it directly is a successful
31
+ // no-op.
32
+ return ToolCallResult_1.ToolCallResult.successful();
27
33
  }
28
34
  async callFromGpt(context, parameters) {
29
35
  return this.call(context, parameters);
@@ -204,25 +204,21 @@ class MiscUtils {
204
204
  * Merges adjacent user messages (some LLMs like Gemini's or Anthropic's require this).
205
205
  */
206
206
  static mergeAdjacentUserMessages(messages) {
207
- let updatedMessages = [];
208
- for (let i = 0; i < messages.length; ++i) {
209
- if (i === messages.length - 1) {
210
- updatedMessages.push(messages[i]);
211
- break;
212
- }
213
- const message = messages[i];
214
- const adjacentMessage = messages[i + 1];
215
- if (message.type === 'user' && adjacentMessage.type === 'user') {
216
- const mergedMessage = {
207
+ const updatedMessages = [];
208
+ // Fold each user message into the previously emitted one when that is also
209
+ // a user message. Folding into the accumulated result (rather than
210
+ // consuming pairs) collapses runs of any length — pair-consuming would
211
+ // leave the 3rd, 5th, ... message in a run un-merged.
212
+ for (const message of messages) {
213
+ const last = updatedMessages[updatedMessages.length - 1];
214
+ if (message.type === 'user' && last?.type === 'user') {
215
+ updatedMessages[updatedMessages.length - 1] = {
217
216
  type: 'user',
218
- items: [...message.items, ...adjacentMessage.items],
217
+ items: [...last.items, ...message.items],
219
218
  };
220
- updatedMessages.push(mergedMessage);
221
- // Skip the next message.
222
- ++i;
223
219
  }
224
220
  else {
225
- updatedMessages.push(messages[i]);
221
+ updatedMessages.push(message);
226
222
  }
227
223
  }
228
224
  return updatedMessages;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
2
  import type { ToolCallContext } from '../models/ToolCallContext';
3
- import type { ToolCallResult } from '../models/ToolCallResult';
3
+ import { ToolCallResult } from '../models/ToolCallResult';
4
4
  import { Tool } from './Tool';
5
5
  export declare const HandleBrowserDialogCoreSchema: z.ZodObject<{
6
6
  text: z.ZodNullable<z.ZodString>;
@@ -16,7 +16,7 @@ export declare const HandleBrowserDialogGptSchema: z.ZodObject<{
16
16
  export declare class HandleBrowserDialogTool extends Tool<typeof HandleBrowserDialogCoreSchema, typeof HandleBrowserDialogGptSchema> {
17
17
  static readonly NAME = "handleBrowserDialog";
18
18
  constructor();
19
- call(context: ToolCallContext, parameters: z.infer<typeof HandleBrowserDialogCoreSchema>): Promise<ToolCallResult>;
19
+ call(_context: ToolCallContext, _parameters: z.infer<typeof HandleBrowserDialogCoreSchema>): Promise<ToolCallResult>;
20
20
  callFromGpt(context: ToolCallContext, parameters: z.infer<typeof HandleBrowserDialogGptSchema>): Promise<ToolCallResult>;
21
21
  }
22
22
  //# sourceMappingURL=HandleBrowserDialogTool.d.ts.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HandleBrowserDialogTool = exports.HandleBrowserDialogGptSchema = exports.HandleBrowserDialogCoreSchema = void 0;
4
4
  const v4_1 = require("zod/v4");
5
+ const ToolCallResult_1 = require("../models/ToolCallResult");
5
6
  const ToolSchema_1 = require("../models/ToolSchema");
6
7
  const Tool_1 = require("./Tool");
7
8
  exports.HandleBrowserDialogCoreSchema = v4_1.z.object({
@@ -22,8 +23,13 @@ class HandleBrowserDialogTool extends Tool_1.Tool {
22
23
  constructor() {
23
24
  super(HandleBrowserDialogTool.NAME, 'Handle a browser Window:confirm() or Window:prompt().', exports.HandleBrowserDialogCoreSchema, exports.HandleBrowserDialogGptSchema, false, undefined, ['web']);
24
25
  }
25
- async call(context, parameters) {
26
- return this.call(context, parameters);
26
+ async call(_context, _parameters) {
27
+ // No-op. The dialog is actually accepted/dismissed by the Playwright dialog
28
+ // handler (see createWebDialogHandler), which also records this tool's
29
+ // outcome as a successful ToolCall. This class exists only as a
30
+ // schema/marker the LLM proposes; invoking it directly is a successful
31
+ // no-op.
32
+ return ToolCallResult_1.ToolCallResult.successful();
27
33
  }
28
34
  async callFromGpt(context, parameters) {
29
35
  return this.call(context, parameters);
@@ -204,25 +204,21 @@ class MiscUtils {
204
204
  * Merges adjacent user messages (some LLMs like Gemini's or Anthropic's require this).
205
205
  */
206
206
  static mergeAdjacentUserMessages(messages) {
207
- let updatedMessages = [];
208
- for (let i = 0; i < messages.length; ++i) {
209
- if (i === messages.length - 1) {
210
- updatedMessages.push(messages[i]);
211
- break;
212
- }
213
- const message = messages[i];
214
- const adjacentMessage = messages[i + 1];
215
- if (message.type === 'user' && adjacentMessage.type === 'user') {
216
- const mergedMessage = {
207
+ const updatedMessages = [];
208
+ // Fold each user message into the previously emitted one when that is also
209
+ // a user message. Folding into the accumulated result (rather than
210
+ // consuming pairs) collapses runs of any length — pair-consuming would
211
+ // leave the 3rd, 5th, ... message in a run un-merged.
212
+ for (const message of messages) {
213
+ const last = updatedMessages[updatedMessages.length - 1];
214
+ if (message.type === 'user' && last?.type === 'user') {
215
+ updatedMessages[updatedMessages.length - 1] = {
217
216
  type: 'user',
218
- items: [...message.items, ...adjacentMessage.items],
217
+ items: [...last.items, ...message.items],
219
218
  };
220
- updatedMessages.push(mergedMessage);
221
- // Skip the next message.
222
- ++i;
223
219
  }
224
220
  else {
225
- updatedMessages.push(messages[i]);
221
+ updatedMessages.push(message);
226
222
  }
227
223
  }
228
224
  return updatedMessages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "5.60.6",
3
+ "version": "5.60.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",