donobu 5.56.0 → 5.57.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.
Files changed (139) hide show
  1. package/dist/apis/GptConfigsApi.d.ts +5 -5
  2. package/dist/apis/GptConfigsApi.js +14 -14
  3. package/dist/bindings/PageInteractionTracker.d.ts +1 -1
  4. package/dist/bindings/PageInteractionTracker.js +3 -3
  5. package/dist/bindings/SetDonobuAnnotations.d.ts +1 -1
  6. package/dist/bindings/SetDonobuAnnotations.js +3 -3
  7. package/dist/cli/donobu-cli.d.ts +8 -0
  8. package/dist/cli/donobu-cli.js +23 -0
  9. package/dist/clients/AnthropicGptClient.d.ts +2 -2
  10. package/dist/clients/AnthropicGptClient.js +77 -77
  11. package/dist/clients/OpenAiGptClient.d.ts +14 -14
  12. package/dist/clients/OpenAiGptClient.js +183 -183
  13. package/dist/esm/apis/GptConfigsApi.d.ts +5 -5
  14. package/dist/esm/apis/GptConfigsApi.js +14 -14
  15. package/dist/esm/bindings/PageInteractionTracker.d.ts +1 -1
  16. package/dist/esm/bindings/PageInteractionTracker.js +3 -3
  17. package/dist/esm/bindings/SetDonobuAnnotations.d.ts +1 -1
  18. package/dist/esm/bindings/SetDonobuAnnotations.js +3 -3
  19. package/dist/esm/cli/donobu-cli.d.ts +8 -0
  20. package/dist/esm/cli/donobu-cli.js +23 -0
  21. package/dist/esm/clients/AnthropicGptClient.d.ts +2 -2
  22. package/dist/esm/clients/AnthropicGptClient.js +77 -77
  23. package/dist/esm/clients/OpenAiGptClient.d.ts +14 -14
  24. package/dist/esm/clients/OpenAiGptClient.js +183 -183
  25. package/dist/esm/lib/ai/PageAi.js +2 -1
  26. package/dist/esm/lib/page/extendPage.js +2 -1
  27. package/dist/esm/lib/test/utils/TestFileUpdater.d.ts +9 -9
  28. package/dist/esm/lib/test/utils/TestFileUpdater.js +49 -49
  29. package/dist/esm/main.d.ts +2 -0
  30. package/dist/esm/managers/AdminApiController.d.ts +16 -16
  31. package/dist/esm/managers/AdminApiController.js +35 -35
  32. package/dist/esm/managers/DonobuFlow.d.ts +41 -33
  33. package/dist/esm/managers/DonobuFlow.js +362 -532
  34. package/dist/esm/managers/DonobuFlowsManager.js +2 -10
  35. package/dist/esm/managers/FlowDependencyAnalyzer.d.ts +12 -12
  36. package/dist/esm/managers/FlowDependencyAnalyzer.js +77 -77
  37. package/dist/esm/managers/PageInspector.d.ts +38 -38
  38. package/dist/esm/managers/PageInspector.js +745 -745
  39. package/dist/esm/managers/TargetInspector.d.ts +28 -33
  40. package/dist/esm/managers/TestsManager.d.ts +25 -25
  41. package/dist/esm/managers/TestsManager.js +74 -74
  42. package/dist/esm/managers/ToolManager.js +7 -5
  43. package/dist/esm/managers/ToolRegistry.d.ts +5 -1
  44. package/dist/esm/managers/WebTargetInspector.d.ts +9 -5
  45. package/dist/esm/managers/WebTargetInspector.js +45 -47
  46. package/dist/esm/models/AiQuery.d.ts +29 -15
  47. package/dist/esm/models/AiQuery.js +31 -0
  48. package/dist/esm/models/InteractableElement.d.ts +6 -0
  49. package/dist/esm/models/InteractableElement.js +7 -1
  50. package/dist/esm/models/Observation.d.ts +38 -0
  51. package/dist/esm/models/Observation.js +3 -0
  52. package/dist/esm/models/ToolCallContext.d.ts +3 -2
  53. package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
  54. package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
  55. package/dist/esm/persistence/flows/FlowsPersistenceSqlite.js +2 -1
  56. package/dist/esm/targets/TargetProvider.d.ts +110 -0
  57. package/dist/esm/targets/TargetProvider.js +25 -0
  58. package/dist/esm/targets/TargetRuntime.d.ts +6 -3
  59. package/dist/esm/targets/WebDialogHandler.d.ts +14 -0
  60. package/dist/esm/targets/WebDialogHandler.js +198 -0
  61. package/dist/esm/targets/WebTargetProvider.d.ts +32 -0
  62. package/dist/esm/targets/WebTargetProvider.js +136 -0
  63. package/dist/esm/targets/WebTargetRuntime.d.ts +2 -2
  64. package/dist/esm/targets/WebTargetRuntime.js +2 -1
  65. package/dist/esm/tools/AssertPageTool.d.ts +1 -1
  66. package/dist/esm/tools/AssertPageTool.js +3 -3
  67. package/dist/esm/tools/DetectBrokenLinksTool.d.ts +2 -2
  68. package/dist/esm/tools/DetectBrokenLinksTool.js +44 -44
  69. package/dist/esm/tools/InputFakerTool.d.ts +4 -4
  70. package/dist/esm/tools/InputFakerTool.js +10 -10
  71. package/dist/esm/tools/InputTextTool.d.ts +4 -4
  72. package/dist/esm/tools/InputTextTool.js +7 -7
  73. package/dist/esm/tools/ReplayableInteraction.d.ts +34 -34
  74. package/dist/esm/tools/ReplayableInteraction.js +245 -245
  75. package/dist/esm/utils/BrowserUtils.d.ts +19 -19
  76. package/dist/esm/utils/BrowserUtils.js +57 -57
  77. package/dist/esm/utils/MiscUtils.d.ts +2 -2
  78. package/dist/esm/utils/MiscUtils.js +16 -16
  79. package/dist/esm/utils/PlaywrightUtils.d.ts +1 -1
  80. package/dist/esm/utils/TargetUtils.d.ts +1 -1
  81. package/dist/esm/utils/TargetUtils.js +15 -13
  82. package/dist/lib/ai/PageAi.js +2 -1
  83. package/dist/lib/page/extendPage.js +2 -1
  84. package/dist/lib/test/utils/TestFileUpdater.d.ts +9 -9
  85. package/dist/lib/test/utils/TestFileUpdater.js +49 -49
  86. package/dist/main.d.ts +2 -0
  87. package/dist/managers/AdminApiController.d.ts +16 -16
  88. package/dist/managers/AdminApiController.js +35 -35
  89. package/dist/managers/DonobuFlow.d.ts +41 -33
  90. package/dist/managers/DonobuFlow.js +362 -532
  91. package/dist/managers/DonobuFlowsManager.js +2 -10
  92. package/dist/managers/FlowDependencyAnalyzer.d.ts +12 -12
  93. package/dist/managers/FlowDependencyAnalyzer.js +77 -77
  94. package/dist/managers/PageInspector.d.ts +38 -38
  95. package/dist/managers/PageInspector.js +745 -745
  96. package/dist/managers/TargetInspector.d.ts +28 -33
  97. package/dist/managers/TestsManager.d.ts +25 -25
  98. package/dist/managers/TestsManager.js +74 -74
  99. package/dist/managers/ToolManager.js +7 -5
  100. package/dist/managers/ToolRegistry.d.ts +5 -1
  101. package/dist/managers/WebTargetInspector.d.ts +9 -5
  102. package/dist/managers/WebTargetInspector.js +45 -47
  103. package/dist/models/AiQuery.d.ts +29 -15
  104. package/dist/models/AiQuery.js +31 -0
  105. package/dist/models/InteractableElement.d.ts +6 -0
  106. package/dist/models/InteractableElement.js +7 -1
  107. package/dist/models/Observation.d.ts +38 -0
  108. package/dist/models/Observation.js +3 -0
  109. package/dist/models/ToolCallContext.d.ts +3 -2
  110. package/dist/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
  111. package/dist/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
  112. package/dist/persistence/flows/FlowsPersistenceSqlite.js +2 -1
  113. package/dist/targets/TargetProvider.d.ts +110 -0
  114. package/dist/targets/TargetProvider.js +25 -0
  115. package/dist/targets/TargetRuntime.d.ts +6 -3
  116. package/dist/targets/WebDialogHandler.d.ts +14 -0
  117. package/dist/targets/WebDialogHandler.js +198 -0
  118. package/dist/targets/WebTargetProvider.d.ts +32 -0
  119. package/dist/targets/WebTargetProvider.js +136 -0
  120. package/dist/targets/WebTargetRuntime.d.ts +2 -2
  121. package/dist/targets/WebTargetRuntime.js +2 -1
  122. package/dist/tools/AssertPageTool.d.ts +1 -1
  123. package/dist/tools/AssertPageTool.js +3 -3
  124. package/dist/tools/DetectBrokenLinksTool.d.ts +2 -2
  125. package/dist/tools/DetectBrokenLinksTool.js +44 -44
  126. package/dist/tools/InputFakerTool.d.ts +4 -4
  127. package/dist/tools/InputFakerTool.js +10 -10
  128. package/dist/tools/InputTextTool.d.ts +4 -4
  129. package/dist/tools/InputTextTool.js +7 -7
  130. package/dist/tools/ReplayableInteraction.d.ts +34 -34
  131. package/dist/tools/ReplayableInteraction.js +245 -245
  132. package/dist/utils/BrowserUtils.d.ts +19 -19
  133. package/dist/utils/BrowserUtils.js +57 -57
  134. package/dist/utils/MiscUtils.d.ts +2 -2
  135. package/dist/utils/MiscUtils.js +16 -16
  136. package/dist/utils/PlaywrightUtils.d.ts +1 -1
  137. package/dist/utils/TargetUtils.d.ts +1 -1
  138. package/dist/utils/TargetUtils.js +15 -13
  139. package/package.json +2 -1
@@ -91,6 +91,55 @@ class TestFileUpdater {
91
91
  return false;
92
92
  }
93
93
  }
94
+ /**
95
+ * Updates a test file based on a Playwright JSON reporter output.
96
+ *
97
+ * @param jsonReportPath Path to the Playwright JSON report
98
+ * @param testFilePath Path to the test file to update (if not specified, will be extracted from the report)
99
+ * @param newTestCode The new test code
100
+ * @returns True if the update was successful, false otherwise
101
+ */
102
+ static async updateFromPlaywrightReport(jsonReportPath, newTestCode, testFilePath) {
103
+ try {
104
+ // Read and parse the Playwright report
105
+ const reportContent = await fs.promises.readFile(jsonReportPath, 'utf8');
106
+ const testResults = JSON.parse(reportContent);
107
+ // Extract failed test information
108
+ const failedTests = [];
109
+ for (const suite of testResults.suites || []) {
110
+ const file = suite.file;
111
+ for (const spec of suite.specs || []) {
112
+ if (!spec.ok) {
113
+ for (const test of spec.tests || []) {
114
+ if (!test.ok) {
115
+ failedTests.push({
116
+ file,
117
+ title: `${spec.title} ${test.title}`.trim(),
118
+ });
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ if (failedTests.length === 0) {
125
+ Logger_1.appLogger.warn('No failed tests found in the report');
126
+ return false;
127
+ }
128
+ // If test file path is not specified, use the first failed test's file
129
+ const targetTestFilePath = testFilePath || failedTests[0].file;
130
+ const targetTestName = failedTests[0].title;
131
+ if (!targetTestFilePath) {
132
+ Logger_1.appLogger.error('Could not determine test file path from report');
133
+ return false;
134
+ }
135
+ // Update the test file
136
+ return await this.updateTestCase(targetTestFilePath, targetTestName, newTestCode);
137
+ }
138
+ catch (error) {
139
+ Logger_1.appLogger.error(`Error updating from Playwright report:`, error);
140
+ return false;
141
+ }
142
+ }
94
143
  /**
95
144
  * Extracts a specific test case from source code.
96
145
  *
@@ -173,55 +222,6 @@ class TestFileUpdater {
173
222
  static testTitleMatches(title, testName) {
174
223
  return (title === testName || testName.includes(title) || title.includes(testName));
175
224
  }
176
- /**
177
- * Updates a test file based on a Playwright JSON reporter output.
178
- *
179
- * @param jsonReportPath Path to the Playwright JSON report
180
- * @param testFilePath Path to the test file to update (if not specified, will be extracted from the report)
181
- * @param newTestCode The new test code
182
- * @returns True if the update was successful, false otherwise
183
- */
184
- static async updateFromPlaywrightReport(jsonReportPath, newTestCode, testFilePath) {
185
- try {
186
- // Read and parse the Playwright report
187
- const reportContent = await fs.promises.readFile(jsonReportPath, 'utf8');
188
- const testResults = JSON.parse(reportContent);
189
- // Extract failed test information
190
- const failedTests = [];
191
- for (const suite of testResults.suites || []) {
192
- const file = suite.file;
193
- for (const spec of suite.specs || []) {
194
- if (!spec.ok) {
195
- for (const test of spec.tests || []) {
196
- if (!test.ok) {
197
- failedTests.push({
198
- file,
199
- title: `${spec.title} ${test.title}`.trim(),
200
- });
201
- }
202
- }
203
- }
204
- }
205
- }
206
- if (failedTests.length === 0) {
207
- Logger_1.appLogger.warn('No failed tests found in the report');
208
- return false;
209
- }
210
- // If test file path is not specified, use the first failed test's file
211
- const targetTestFilePath = testFilePath || failedTests[0].file;
212
- const targetTestName = failedTests[0].title;
213
- if (!targetTestFilePath) {
214
- Logger_1.appLogger.error('Could not determine test file path from report');
215
- return false;
216
- }
217
- // Update the test file
218
- return await this.updateTestCase(targetTestFilePath, targetTestName, newTestCode);
219
- }
220
- catch (error) {
221
- Logger_1.appLogger.error(`Error updating from Playwright report:`, error);
222
- return false;
223
- }
224
- }
225
225
  }
226
226
  exports.TestFileUpdater = TestFileUpdater;
227
227
  //# sourceMappingURL=TestFileUpdater.js.map
@@ -43,6 +43,7 @@ export * from './models/FlowMetadata';
43
43
  export type * from './models/FocusedTarget';
44
44
  export type * from './models/GptMessage';
45
45
  export * from './models/InteractableElement';
46
+ export type * from './models/Observation';
46
47
  export type { PaginatedResult } from './models/PaginatedResult';
47
48
  export * from './models/ProposedToolCall';
48
49
  export * from './models/Provenance';
@@ -61,6 +62,7 @@ export type { FlowsPersistence } from './persistence/flows/FlowsPersistence';
61
62
  export { type PersistencePlugin, PersistencePluginRegistry, } from './persistence/PersistencePlugin';
62
63
  export type { SuitesPersistence } from './persistence/suites/SuitesPersistence';
63
64
  export type { TestsPersistence } from './persistence/tests/TestsPersistence';
65
+ export type * from './targets/TargetProvider';
64
66
  export type { TargetRuntime } from './targets/TargetRuntime';
65
67
  export { type TargetRuntimeParams, type TargetRuntimePlugin, TargetRuntimePluginRegistry, } from './targets/TargetRuntimePlugin';
66
68
  export * from './tools/ReplayableInteraction';
@@ -43,6 +43,7 @@ import type { DonobuDeploymentEnvironment } from '../models/DonobuDeploymentEnvi
43
43
  export declare class AdminApiController {
44
44
  private readonly app;
45
45
  private server?;
46
+ private constructor();
46
47
  /**
47
48
  * Creates a new instance.
48
49
  *
@@ -60,22 +61,6 @@ export declare class AdminApiController {
60
61
  * local environment.
61
62
  */
62
63
  static create(donobuDeploymentEnvironment: DonobuDeploymentEnvironment, 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_BASE_URL' | 'DONOBU_API_KEY' | 'DONOBU_PERSISTENCE_API_KEY' | 'DONOBU_UPLOADS_OWNED_BY_PARENT' | 'GOOGLE_GENERATIVE_AI_API_KEY' | 'GOOGLE_GENERATIVE_AI_MODEL_NAME' | 'OLLAMA_API_URL' | 'OLLAMA_MODEL_NAME' | 'OPENAI_API_KEY' | 'OPENAI_API_MODEL_NAME' | 'PERSISTENCE_PRIORITY'>): Promise<AdminApiController>;
63
- private constructor();
64
- /**
65
- * Binds the API/web-asset server to `port` and resolves once the socket is
66
- * listening. If the given port is 0, a random port is assigned. Rejects on
67
- * bind errors (e.g. EADDRINUSE) so callers — particularly those doing a
68
- * stop/start bounce — can recover instead of crashing on an uncaught
69
- * 'error' event.
70
- */
71
- start(port: number): Promise<void>;
72
- /**
73
- * Stops accepting new connections and forcibly tears down any in-flight
74
- * ones, then resolves. Forceful close keeps bounces predictable — a slow
75
- * or stuck client request can't hold the port open. Callers that want to
76
- * let in-flight work drain should do so before invoking stop().
77
- */
78
- stop(): Promise<void>;
79
64
  private static setupExpressFramework;
80
65
  /**
81
66
  * Sets up URL error handler middleware to catch URL parsing/decoding errors.
@@ -124,5 +109,20 @@ export declare class AdminApiController {
124
109
  */
125
110
  private static registerUtilityRoutes;
126
111
  private static asyncHandler;
112
+ /**
113
+ * Binds the API/web-asset server to `port` and resolves once the socket is
114
+ * listening. If the given port is 0, a random port is assigned. Rejects on
115
+ * bind errors (e.g. EADDRINUSE) so callers — particularly those doing a
116
+ * stop/start bounce — can recover instead of crashing on an uncaught
117
+ * 'error' event.
118
+ */
119
+ start(port: number): Promise<void>;
120
+ /**
121
+ * Stops accepting new connections and forcibly tears down any in-flight
122
+ * ones, then resolves. Forceful close keeps bounces predictable — a slow
123
+ * or stuck client request can't hold the port open. Callers that want to
124
+ * let in-flight work drain should do so before invoking stop().
125
+ */
126
+ stop(): Promise<void>;
127
127
  }
128
128
  //# sourceMappingURL=AdminApiController.d.ts.map
@@ -63,6 +63,9 @@ const DonobuStack_1 = require("./DonobuStack");
63
63
  * - **Development vs Production**: Enhanced error details in development environments
64
64
  */
65
65
  class AdminApiController {
66
+ constructor(app) {
67
+ this.app = app;
68
+ }
66
69
  /**
67
70
  * Creates a new instance.
68
71
  *
@@ -83,41 +86,6 @@ class AdminApiController {
83
86
  const expressApp = await this.setupExpressFramework(donobuDeploymentEnvironment, controlPanelFactory, environ);
84
87
  return new AdminApiController(expressApp);
85
88
  }
86
- constructor(app) {
87
- this.app = app;
88
- }
89
- /**
90
- * Binds the API/web-asset server to `port` and resolves once the socket is
91
- * listening. If the given port is 0, a random port is assigned. Rejects on
92
- * bind errors (e.g. EADDRINUSE) so callers — particularly those doing a
93
- * stop/start bounce — can recover instead of crashing on an uncaught
94
- * 'error' event.
95
- */
96
- async start(port) {
97
- Logger_1.appLogger.debug(`Starting AdminController on port ${port}`);
98
- await new Promise((resolve, reject) => {
99
- this.server = this.app.listen(port, () => resolve());
100
- this.server.once('error', reject);
101
- });
102
- }
103
- /**
104
- * Stops accepting new connections and forcibly tears down any in-flight
105
- * ones, then resolves. Forceful close keeps bounces predictable — a slow
106
- * or stuck client request can't hold the port open. Callers that want to
107
- * let in-flight work drain should do so before invoking stop().
108
- */
109
- async stop() {
110
- if (this.server) {
111
- const address = this.server.address();
112
- const port = typeof address === 'string' ? address : address?.port;
113
- Logger_1.appLogger.debug(`Stopping AdminController on port ${port}`);
114
- const server = this.server;
115
- await new Promise((resolve, reject) => {
116
- server.close((err) => (err ? reject(err) : resolve()));
117
- server.closeAllConnections();
118
- });
119
- }
120
- }
121
89
  static async setupExpressFramework(donobuDeploymentEnvironment, controlPanelFactory, environ) {
122
90
  const app = (0, express_1.default)();
123
91
  const donobuStack = await (0, DonobuStack_1.setupDonobuStack)(donobuDeploymentEnvironment, controlPanelFactory, undefined, environ);
@@ -377,6 +345,38 @@ class AdminApiController {
377
345
  Promise.resolve(fn(req, res, next)).catch(next);
378
346
  };
379
347
  }
348
+ /**
349
+ * Binds the API/web-asset server to `port` and resolves once the socket is
350
+ * listening. If the given port is 0, a random port is assigned. Rejects on
351
+ * bind errors (e.g. EADDRINUSE) so callers — particularly those doing a
352
+ * stop/start bounce — can recover instead of crashing on an uncaught
353
+ * 'error' event.
354
+ */
355
+ async start(port) {
356
+ Logger_1.appLogger.debug(`Starting AdminController on port ${port}`);
357
+ await new Promise((resolve, reject) => {
358
+ this.server = this.app.listen(port, () => resolve());
359
+ this.server.once('error', reject);
360
+ });
361
+ }
362
+ /**
363
+ * Stops accepting new connections and forcibly tears down any in-flight
364
+ * ones, then resolves. Forceful close keeps bounces predictable — a slow
365
+ * or stuck client request can't hold the port open. Callers that want to
366
+ * let in-flight work drain should do so before invoking stop().
367
+ */
368
+ async stop() {
369
+ if (this.server) {
370
+ const address = this.server.address();
371
+ const port = typeof address === 'string' ? address : address?.port;
372
+ Logger_1.appLogger.debug(`Stopping AdminController on port ${port}`);
373
+ const server = this.server;
374
+ await new Promise((resolve, reject) => {
375
+ server.close((err) => (err ? reject(err) : resolve()));
376
+ server.closeAllConnections();
377
+ });
378
+ }
379
+ }
380
380
  }
381
381
  exports.AdminApiController = AdminApiController;
382
382
  //# sourceMappingURL=AdminApiController.js.map
@@ -3,16 +3,14 @@ import type { GptClient } from '../clients/GptClient';
3
3
  import type { AiQuery } from '../models/AiQuery';
4
4
  import type { ControlPanel, UserAction } from '../models/ControlPanel';
5
5
  import type { FlowMetadata } from '../models/FlowMetadata';
6
- import type { GptMessage, StructuredOutputMessage, TextItem } from '../models/GptMessage';
6
+ import type { GptMessage, StructuredOutputMessage } from '../models/GptMessage';
7
7
  import type { SystemMessage } from '../models/GptMessage';
8
- import type { InteractableElement } from '../models/InteractableElement';
9
8
  import type { ProposedToolCall } from '../models/ProposedToolCall';
10
9
  import type { ToolCall } from '../models/ToolCall';
11
10
  import type { FlowsPersistence } from '../persistence/flows/FlowsPersistence';
11
+ import type { TargetProvider } from '../targets/TargetProvider';
12
12
  import type { DonobuFlowsManager } from './DonobuFlowsManager';
13
13
  import type { InteractionVisualizer } from './InteractionVisualizer';
14
- import type { TargetInspectorBase } from './TargetInspector';
15
- import type { TargetInspector } from './TargetInspector';
16
14
  import type { ToolManager } from './ToolManager';
17
15
  /**
18
16
  * Return an object conforming to the given JSON-schema. The object will be
@@ -35,10 +33,9 @@ export declare class DonobuFlow {
35
33
  readonly proposedToolCalls: ProposedToolCall[];
36
34
  readonly invokedToolCalls: ToolCall[];
37
35
  readonly gptMessages: GptMessage[];
38
- readonly targetInspector: TargetInspector;
36
+ readonly provider: TargetProvider | null;
39
37
  readonly metadata: FlowMetadata;
40
38
  readonly controlPanel: ControlPanel;
41
- private static readonly MAIN_MESSAGE_ELEMENT_LIST_MARKER;
42
39
  static readonly USER_INTERRUPT_MARKER = "[User interruption while flow was paused, this MUST be acknowledged]";
43
40
  static readonly REJECTION_MARKER = "[The user rejected your previously proposed action(s). Do NOT repeat them. Propose a different next action, taking the following feedback into account]";
44
41
  inProgressToolCall: ToolCall | null;
@@ -57,7 +54,38 @@ export declare class DonobuFlow {
57
54
  * panel, so both surfaces drive the flow through the same code path.
58
55
  */
59
56
  private readonly userActionInbox;
60
- constructor(flowsManager: DonobuFlowsManager, envData: Record<string, string>, persistence: FlowsPersistence, gptClient: GptClient | null, toolManager: ToolManager, interactionVisualizer: InteractionVisualizer, proposedToolCalls: ProposedToolCall[], invokedToolCalls: ToolCall[], gptMessages: GptMessage[], targetInspector: TargetInspector, metadata: FlowMetadata, controlPanel: ControlPanel);
57
+ /** The target's lifecycle capability (connection/recovery/session), if any. */
58
+ private get lifecycle();
59
+ /** The target's per-turn observer, if any. */
60
+ private get observer();
61
+ /** Whether the attached target's connection is currently alive. */
62
+ private get anyConnected();
63
+ constructor(flowsManager: DonobuFlowsManager, envData: Record<string, string>, persistence: FlowsPersistence, gptClient: GptClient | null, toolManager: ToolManager, interactionVisualizer: InteractionVisualizer, proposedToolCalls: ProposedToolCall[], invokedToolCalls: ToolCall[], gptMessages: GptMessage[], provider: TargetProvider | null, metadata: FlowMetadata, controlPanel: ControlPanel);
64
+ /**
65
+ * @internal - Exposed for testing purposes only
66
+ */
67
+ static createSystemMessageForOverallObjective(envVars: string[] | null, overallObjective: string | null, provider: TargetProvider | null): SystemMessage;
68
+ /**
69
+ * Returns a size-optimized GPT message history by stripping images and text
70
+ * from old messages.
71
+ *
72
+ * @internal - Exposed for testing purposes only
73
+ */
74
+ static createOptimizedHistoryForGptCall(currentHistory: GptMessage[]): GptMessage[];
75
+ /**
76
+ * Attempt to POST a JSON body containing given flow ID to the given
77
+ * ${@link callbackUrl} if the URL is non-null. Note that there is no retying
78
+ * if the POST fails for any reason; this is a best-effort 1-shot try.
79
+ */
80
+ private static invokeFlowFinishedCallback;
81
+ /** Target-agnostic sleep (replaces Playwright's waitForTimeout). */
82
+ private static sleep;
83
+ /**
84
+ * Cancel the flow: mark it for failure and interrupt any in-flight target
85
+ * operation so the run loop observes the cancellation at once. This does not
86
+ * release target resources — that happens during the flow's normal teardown.
87
+ */
88
+ cancel(): Promise<void>;
61
89
  /**
62
90
  * Drives the entire Donobu flow state-machine until it reaches a
63
91
  * terminal state.
@@ -106,6 +134,10 @@ export declare class DonobuFlow {
106
134
  * docs.)
107
135
  */
108
136
  submitUserAction(action: UserAction): void;
137
+ /** Whether a thrown error means the attached target closed. */
138
+ private isTargetClosedError;
139
+ /** Location recorded on tool calls — the target's location. */
140
+ private getCurrentLocation;
109
141
  /**
110
142
  * Returns and clears the next pending user action, preferring out-of-band
111
143
  * actions (REST) over the control panel. Both sources feed the same
@@ -113,8 +145,8 @@ export declare class DonobuFlow {
113
145
  */
114
146
  private popUserAction;
115
147
  /**
116
- * Delegates to the inspector to attempt recovery after the target is
117
- * closed. If recovery fails, the flow is marked as failed.
148
+ * Attempt to recover after a target's connection closes. If any attached
149
+ * target cannot recover, the flow is marked as failed.
118
150
  */
119
151
  private onTargetClosed;
120
152
  /**
@@ -215,13 +247,6 @@ export declare class DonobuFlow {
215
247
  * propagate.
216
248
  */
217
249
  private persistTerminalSessionStateIfNeeded;
218
- /**
219
- * Attempt to POST a JSON body containing given flow ID to the given
220
- * ${@link callbackUrl} if the URL is non-null. Note that there is no retying
221
- * if the POST fails for any reason; this is a best-effort 1-shot try.
222
- */
223
- private static invokeFlowFinishedCallback;
224
- private onDialog;
225
250
  /**
226
251
  * Transitions the flow to its next state. After this method completes, the
227
252
  * `this.metadata.state` will have been updated and the
@@ -295,22 +320,5 @@ export declare class DonobuFlow {
295
320
  * up to an internally specified maximum number of attempts.
296
321
  */
297
322
  private queryGptWithRetry;
298
- /** Target-agnostic sleep (replaces Playwright's waitForTimeout). */
299
- private static sleep;
300
- /**
301
- * @internal - Exposed for testing purposes only
302
- */
303
- static createSystemMessageForOverallObjective(envVars: string[] | null, overallObjective: string | null, inspector: TargetInspectorBase): SystemMessage;
304
- /**
305
- * @internal - Exposed for testing purposes only
306
- */
307
- static createMainUserMessage(inspector: TargetInspectorBase, interactableElements: InteractableElement[]): TextItem;
308
- /**
309
- * Returns a size-optimized GPT message history by stripping images and text
310
- * from old messages.
311
- *
312
- * @internal - Exposed for testing purposes only
313
- */
314
- static createOptimizedHistoryForGptCall(currentHistory: GptMessage[]): GptMessage[];
315
323
  }
316
324
  //# sourceMappingURL=DonobuFlow.d.ts.map