donobu 5.55.0 → 5.57.0
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/apis/GptConfigsApi.d.ts +5 -5
- package/dist/apis/GptConfigsApi.js +14 -14
- package/dist/bindings/PageInteractionTracker.d.ts +1 -1
- package/dist/bindings/PageInteractionTracker.js +3 -3
- package/dist/bindings/SetDonobuAnnotations.d.ts +1 -1
- package/dist/bindings/SetDonobuAnnotations.js +3 -3
- package/dist/clients/AnthropicGptClient.d.ts +2 -2
- package/dist/clients/AnthropicGptClient.js +77 -77
- package/dist/clients/OpenAiGptClient.d.ts +14 -14
- package/dist/clients/OpenAiGptClient.js +183 -183
- package/dist/esm/apis/GptConfigsApi.d.ts +5 -5
- package/dist/esm/apis/GptConfigsApi.js +14 -14
- package/dist/esm/bindings/PageInteractionTracker.d.ts +1 -1
- package/dist/esm/bindings/PageInteractionTracker.js +3 -3
- package/dist/esm/bindings/SetDonobuAnnotations.d.ts +1 -1
- package/dist/esm/bindings/SetDonobuAnnotations.js +3 -3
- package/dist/esm/clients/AnthropicGptClient.d.ts +2 -2
- package/dist/esm/clients/AnthropicGptClient.js +77 -77
- package/dist/esm/clients/OpenAiGptClient.d.ts +14 -14
- package/dist/esm/clients/OpenAiGptClient.js +183 -183
- package/dist/esm/lib/ai/PageAi.js +2 -1
- package/dist/esm/lib/page/extendPage.js +2 -1
- package/dist/esm/lib/test/utils/TestFileUpdater.d.ts +9 -9
- package/dist/esm/lib/test/utils/TestFileUpdater.js +49 -49
- package/dist/esm/main.d.ts +2 -0
- package/dist/esm/managers/AdminApiController.d.ts +16 -16
- package/dist/esm/managers/AdminApiController.js +35 -35
- package/dist/esm/managers/DonobuFlow.d.ts +57 -36
- package/dist/esm/managers/DonobuFlow.js +489 -564
- package/dist/esm/managers/DonobuFlowsManager.js +13 -17
- package/dist/esm/managers/FlowDependencyAnalyzer.d.ts +12 -12
- package/dist/esm/managers/FlowDependencyAnalyzer.js +77 -77
- package/dist/esm/managers/PageInspector.d.ts +38 -38
- package/dist/esm/managers/PageInspector.js +745 -745
- package/dist/esm/managers/TargetInspector.d.ts +28 -33
- package/dist/esm/managers/TestsManager.d.ts +25 -25
- package/dist/esm/managers/TestsManager.js +74 -74
- package/dist/esm/managers/ToolManager.js +7 -5
- package/dist/esm/managers/ToolRegistry.d.ts +5 -1
- package/dist/esm/managers/WebTargetInspector.d.ts +9 -5
- package/dist/esm/managers/WebTargetInspector.js +45 -47
- package/dist/esm/models/AiQuery.d.ts +29 -15
- package/dist/esm/models/AiQuery.js +31 -0
- package/dist/esm/models/ControlPanel.d.ts +18 -13
- package/dist/esm/models/InteractableElement.d.ts +6 -0
- package/dist/esm/models/InteractableElement.js +7 -1
- package/dist/esm/models/Observation.d.ts +38 -0
- package/dist/esm/models/Observation.js +3 -0
- package/dist/esm/models/ToolCallContext.d.ts +3 -2
- package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
- package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.js +2 -1
- package/dist/esm/targets/TargetProvider.d.ts +110 -0
- package/dist/esm/targets/TargetProvider.js +25 -0
- package/dist/esm/targets/TargetRuntime.d.ts +6 -3
- package/dist/esm/targets/WebDialogHandler.d.ts +14 -0
- package/dist/esm/targets/WebDialogHandler.js +198 -0
- package/dist/esm/targets/WebTargetProvider.d.ts +32 -0
- package/dist/esm/targets/WebTargetProvider.js +136 -0
- package/dist/esm/targets/WebTargetRuntime.d.ts +2 -2
- package/dist/esm/targets/WebTargetRuntime.js +2 -1
- package/dist/esm/tools/AcknowledgeUserInstruction.d.ts +6 -0
- package/dist/esm/tools/AcknowledgeUserInstruction.js +7 -0
- package/dist/esm/tools/AssertPageTool.d.ts +1 -1
- package/dist/esm/tools/AssertPageTool.js +3 -3
- package/dist/esm/tools/DetectBrokenLinksTool.d.ts +2 -2
- package/dist/esm/tools/DetectBrokenLinksTool.js +44 -44
- package/dist/esm/tools/InputFakerTool.d.ts +4 -4
- package/dist/esm/tools/InputFakerTool.js +10 -10
- package/dist/esm/tools/InputTextTool.d.ts +4 -4
- package/dist/esm/tools/InputTextTool.js +7 -7
- package/dist/esm/tools/ReplayableInteraction.d.ts +34 -34
- package/dist/esm/tools/ReplayableInteraction.js +245 -245
- package/dist/esm/tools/Tool.d.ts +6 -3
- package/dist/esm/tools/Tool.js +5 -2
- package/dist/esm/utils/BrowserUtils.d.ts +19 -19
- package/dist/esm/utils/BrowserUtils.js +57 -57
- package/dist/esm/utils/MiscUtils.d.ts +2 -2
- package/dist/esm/utils/MiscUtils.js +16 -16
- package/dist/esm/utils/PlaywrightUtils.d.ts +1 -1
- package/dist/esm/utils/TargetUtils.d.ts +1 -1
- package/dist/esm/utils/TargetUtils.js +15 -13
- package/dist/lib/ai/PageAi.js +2 -1
- package/dist/lib/page/extendPage.js +2 -1
- package/dist/lib/test/utils/TestFileUpdater.d.ts +9 -9
- package/dist/lib/test/utils/TestFileUpdater.js +49 -49
- package/dist/main.d.ts +2 -0
- package/dist/managers/AdminApiController.d.ts +16 -16
- package/dist/managers/AdminApiController.js +35 -35
- package/dist/managers/DonobuFlow.d.ts +57 -36
- package/dist/managers/DonobuFlow.js +489 -564
- package/dist/managers/DonobuFlowsManager.js +13 -17
- package/dist/managers/FlowDependencyAnalyzer.d.ts +12 -12
- package/dist/managers/FlowDependencyAnalyzer.js +77 -77
- package/dist/managers/PageInspector.d.ts +38 -38
- package/dist/managers/PageInspector.js +745 -745
- package/dist/managers/TargetInspector.d.ts +28 -33
- package/dist/managers/TestsManager.d.ts +25 -25
- package/dist/managers/TestsManager.js +74 -74
- package/dist/managers/ToolManager.js +7 -5
- package/dist/managers/ToolRegistry.d.ts +5 -1
- package/dist/managers/WebTargetInspector.d.ts +9 -5
- package/dist/managers/WebTargetInspector.js +45 -47
- package/dist/models/AiQuery.d.ts +29 -15
- package/dist/models/AiQuery.js +31 -0
- package/dist/models/ControlPanel.d.ts +18 -13
- package/dist/models/InteractableElement.d.ts +6 -0
- package/dist/models/InteractableElement.js +7 -1
- package/dist/models/Observation.d.ts +38 -0
- package/dist/models/Observation.js +3 -0
- package/dist/models/ToolCallContext.d.ts +3 -2
- package/dist/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
- package/dist/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
- package/dist/persistence/flows/FlowsPersistenceSqlite.js +2 -1
- package/dist/targets/TargetProvider.d.ts +110 -0
- package/dist/targets/TargetProvider.js +25 -0
- package/dist/targets/TargetRuntime.d.ts +6 -3
- package/dist/targets/WebDialogHandler.d.ts +14 -0
- package/dist/targets/WebDialogHandler.js +198 -0
- package/dist/targets/WebTargetProvider.d.ts +32 -0
- package/dist/targets/WebTargetProvider.js +136 -0
- package/dist/targets/WebTargetRuntime.d.ts +2 -2
- package/dist/targets/WebTargetRuntime.js +2 -1
- package/dist/tools/AcknowledgeUserInstruction.d.ts +6 -0
- package/dist/tools/AcknowledgeUserInstruction.js +7 -0
- package/dist/tools/AssertPageTool.d.ts +1 -1
- package/dist/tools/AssertPageTool.js +3 -3
- package/dist/tools/DetectBrokenLinksTool.d.ts +2 -2
- package/dist/tools/DetectBrokenLinksTool.js +44 -44
- package/dist/tools/InputFakerTool.d.ts +4 -4
- package/dist/tools/InputFakerTool.js +10 -10
- package/dist/tools/InputTextTool.d.ts +4 -4
- package/dist/tools/InputTextTool.js +7 -7
- package/dist/tools/ReplayableInteraction.d.ts +34 -34
- package/dist/tools/ReplayableInteraction.js +245 -245
- package/dist/tools/Tool.d.ts +6 -3
- package/dist/tools/Tool.js +5 -2
- package/dist/utils/BrowserUtils.d.ts +19 -19
- package/dist/utils/BrowserUtils.js +57 -57
- package/dist/utils/MiscUtils.d.ts +2 -2
- package/dist/utils/MiscUtils.js +16 -16
- package/dist/utils/PlaywrightUtils.d.ts +1 -1
- package/dist/utils/TargetUtils.d.ts +1 -1
- package/dist/utils/TargetUtils.js +15 -13
- 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
|
package/dist/esm/main.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
-
*
|
|
117
|
-
*
|
|
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
|
/**
|
|
@@ -134,6 +166,14 @@ export declare class DonobuFlow {
|
|
|
134
166
|
* Note that this *bypasses* the normal state transition logic!
|
|
135
167
|
*/
|
|
136
168
|
private onUserInterruption;
|
|
169
|
+
/**
|
|
170
|
+
* Incorporates the compose-field text from a ▶/⏩ action: if the flow has no
|
|
171
|
+
* standing goal yet, the text becomes the `overallObjective`; otherwise it's
|
|
172
|
+
* added as extra guidance. Either way it's injected into the LLM history (the
|
|
173
|
+
* system prompt was built at init, possibly before any objective existed) and
|
|
174
|
+
* recorded in the timeline. No-op for empty text.
|
|
175
|
+
*/
|
|
176
|
+
private applyComposeInstruction;
|
|
137
177
|
/**
|
|
138
178
|
* Closes out the currently-proposed AI tool call(s) without executing them:
|
|
139
179
|
* emits a `tool_call_result` for each (so the LLM message history stays
|
|
@@ -163,11 +203,16 @@ export declare class DonobuFlow {
|
|
|
163
203
|
private applyRunModeChange;
|
|
164
204
|
/**
|
|
165
205
|
* Whether the flow can hand control to the AI: it needs both a GPT client and
|
|
166
|
-
*
|
|
167
|
-
* `canUseAi`) so the autonomy selector can disable the AI modes when they
|
|
168
|
-
* wouldn't work — e.g. a Playwright-imported test with no objective.
|
|
206
|
+
* a goal to pursue.
|
|
169
207
|
*/
|
|
170
208
|
private canHandOffToAi;
|
|
209
|
+
/**
|
|
210
|
+
* Whether there is a standing goal for the AI to pursue (a non-empty
|
|
211
|
+
* `overallObjective`). Surfaced to the UI as `hasGoal` to drive the
|
|
212
|
+
* transport: ⏩ Fast-forward (autonomous run) is only offered with a goal,
|
|
213
|
+
* and ▶ Play needs either a goal or a typed instruction.
|
|
214
|
+
*/
|
|
215
|
+
private hasGoal;
|
|
171
216
|
/**
|
|
172
217
|
* This method is called if there is an unhandled unexpected exception. This
|
|
173
218
|
* method will mark the flow as a failure.
|
|
@@ -202,13 +247,6 @@ export declare class DonobuFlow {
|
|
|
202
247
|
* propagate.
|
|
203
248
|
*/
|
|
204
249
|
private persistTerminalSessionStateIfNeeded;
|
|
205
|
-
/**
|
|
206
|
-
* Attempt to POST a JSON body containing given flow ID to the given
|
|
207
|
-
* ${@link callbackUrl} if the URL is non-null. Note that there is no retying
|
|
208
|
-
* if the POST fails for any reason; this is a best-effort 1-shot try.
|
|
209
|
-
*/
|
|
210
|
-
private static invokeFlowFinishedCallback;
|
|
211
|
-
private onDialog;
|
|
212
250
|
/**
|
|
213
251
|
* Transitions the flow to its next state. After this method completes, the
|
|
214
252
|
* `this.metadata.state` will have been updated and the
|
|
@@ -282,22 +320,5 @@ export declare class DonobuFlow {
|
|
|
282
320
|
* up to an internally specified maximum number of attempts.
|
|
283
321
|
*/
|
|
284
322
|
private queryGptWithRetry;
|
|
285
|
-
/** Target-agnostic sleep (replaces Playwright's waitForTimeout). */
|
|
286
|
-
private static sleep;
|
|
287
|
-
/**
|
|
288
|
-
* @internal - Exposed for testing purposes only
|
|
289
|
-
*/
|
|
290
|
-
static createSystemMessageForOverallObjective(envVars: string[] | null, overallObjective: string | null, inspector: TargetInspectorBase): SystemMessage;
|
|
291
|
-
/**
|
|
292
|
-
* @internal - Exposed for testing purposes only
|
|
293
|
-
*/
|
|
294
|
-
static createMainUserMessage(inspector: TargetInspectorBase, interactableElements: InteractableElement[]): TextItem;
|
|
295
|
-
/**
|
|
296
|
-
* Returns a size-optimized GPT message history by stripping images and text
|
|
297
|
-
* from old messages.
|
|
298
|
-
*
|
|
299
|
-
* @internal - Exposed for testing purposes only
|
|
300
|
-
*/
|
|
301
|
-
static createOptimizedHistoryForGptCall(currentHistory: GptMessage[]): GptMessage[];
|
|
302
323
|
}
|
|
303
324
|
//# sourceMappingURL=DonobuFlow.d.ts.map
|