donobu 5.53.0 → 5.55.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/FlowsApi.d.ts +95 -7
- package/dist/apis/FlowsApi.js +139 -11
- package/dist/apis/TestsApi.js +4 -3
- package/dist/codegen/CodeGenerator.js +4 -2
- package/dist/esm/apis/FlowsApi.d.ts +95 -7
- package/dist/esm/apis/FlowsApi.js +139 -11
- package/dist/esm/apis/TestsApi.js +4 -3
- package/dist/esm/codegen/CodeGenerator.js +4 -2
- package/dist/esm/lib/test/testExtension.js +34 -29
- package/dist/esm/managers/AdminApiController.js +4 -0
- package/dist/esm/managers/DonobuFlow.d.ts +98 -1
- package/dist/esm/managers/DonobuFlow.js +345 -21
- package/dist/esm/managers/DonobuFlowsManager.d.ts +14 -1
- package/dist/esm/managers/DonobuFlowsManager.js +20 -2
- package/dist/esm/models/ControlPanel.d.ts +22 -0
- package/dist/esm/models/CreateDonobuFlow.d.ts +1 -0
- package/dist/esm/models/CreateTest.d.ts +1 -0
- package/dist/esm/models/FlowMetadata.d.ts +6 -0
- package/dist/esm/models/FlowMetadata.js +3 -1
- package/dist/esm/models/RunMode.d.ts +1 -0
- package/dist/esm/models/RunMode.js +7 -1
- package/dist/esm/models/TestMetadata.d.ts +9 -0
- package/dist/esm/persistence/DonobuSqliteDb.js +3 -2
- package/dist/esm/tools/ReplayableInteraction.d.ts +20 -0
- package/dist/esm/tools/ReplayableInteraction.js +63 -0
- package/dist/esm/tools/SetRunModeTool.d.ts +2 -0
- package/dist/esm/tools/Tool.d.ts +16 -0
- package/dist/esm/tools/Tool.js +16 -0
- package/dist/esm/tools/TriggerDonobuFlowTool.d.ts +2 -0
- package/dist/lib/test/testExtension.js +34 -29
- package/dist/managers/AdminApiController.js +4 -0
- package/dist/managers/DonobuFlow.d.ts +98 -1
- package/dist/managers/DonobuFlow.js +345 -21
- package/dist/managers/DonobuFlowsManager.d.ts +14 -1
- package/dist/managers/DonobuFlowsManager.js +20 -2
- package/dist/models/ControlPanel.d.ts +22 -0
- package/dist/models/CreateDonobuFlow.d.ts +1 -0
- package/dist/models/CreateTest.d.ts +1 -0
- package/dist/models/FlowMetadata.d.ts +6 -0
- package/dist/models/FlowMetadata.js +3 -1
- package/dist/models/RunMode.d.ts +1 -0
- package/dist/models/RunMode.js +7 -1
- package/dist/models/TestMetadata.d.ts +9 -0
- package/dist/persistence/DonobuSqliteDb.js +3 -2
- package/dist/tools/ReplayableInteraction.d.ts +20 -0
- package/dist/tools/ReplayableInteraction.js +63 -0
- package/dist/tools/SetRunModeTool.d.ts +2 -0
- package/dist/tools/Tool.d.ts +16 -0
- package/dist/tools/Tool.js +16 -0
- package/dist/tools/TriggerDonobuFlowTool.d.ts +2 -0
- package/package.json +1 -1
package/dist/apis/FlowsApi.d.ts
CHANGED
|
@@ -230,9 +230,11 @@ export declare class FlowsApi {
|
|
|
230
230
|
/**
|
|
231
231
|
* Pauses execution of an active flow.
|
|
232
232
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
233
|
+
* Submits a PAUSE user action; the flow's run loop applies it after its
|
|
234
|
+
* current action, transitioning to PAUSED. Like the desktop control panel's
|
|
235
|
+
* pause, this goes through the single user-action channel
|
|
236
|
+
* ({@link DonobuFlow.submitUserAction}) rather than mutating flow state
|
|
237
|
+
* directly.
|
|
236
238
|
*
|
|
237
239
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
238
240
|
*
|
|
@@ -240,7 +242,8 @@ export declare class FlowsApi {
|
|
|
240
242
|
* ```http
|
|
241
243
|
* POST /api/flows/abc123/pause
|
|
242
244
|
*
|
|
243
|
-
* Response: FlowMetadata
|
|
245
|
+
* Response: the flow's FlowMetadata (the pause is applied asynchronously by
|
|
246
|
+
* the run loop, so the returned metadata may not yet show PAUSED)
|
|
244
247
|
* ```
|
|
245
248
|
*
|
|
246
249
|
* @remarks
|
|
@@ -251,8 +254,10 @@ export declare class FlowsApi {
|
|
|
251
254
|
/**
|
|
252
255
|
* Resumes execution of a paused flow.
|
|
253
256
|
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
257
|
+
* Submits a RESUME user action (only when the flow is currently PAUSED); the
|
|
258
|
+
* run loop transitions PAUSED → RESUMING → normal operation. Like the desktop
|
|
259
|
+
* control panel's resume, this goes through the single user-action channel
|
|
260
|
+
* ({@link DonobuFlow.submitUserAction}).
|
|
256
261
|
*
|
|
257
262
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
258
263
|
*
|
|
@@ -260,7 +265,8 @@ export declare class FlowsApi {
|
|
|
260
265
|
* ```http
|
|
261
266
|
* POST /api/flows/abc123/resume
|
|
262
267
|
*
|
|
263
|
-
* Response: FlowMetadata
|
|
268
|
+
* Response: the flow's FlowMetadata (the resume is applied asynchronously by
|
|
269
|
+
* the run loop, so the returned metadata may not yet show RESUMING)
|
|
264
270
|
* ```
|
|
265
271
|
*
|
|
266
272
|
* @remarks
|
|
@@ -268,6 +274,88 @@ export declare class FlowsApi {
|
|
|
268
274
|
* Only works on flows currently in PAUSED state.
|
|
269
275
|
*/
|
|
270
276
|
resumeFlow(req: Request, res: Response): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Approves the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
279
|
+
*
|
|
280
|
+
* The flow leaves WAITING_FOR_APPROVAL and executes the proposed action(s)
|
|
281
|
+
* as-is, then continues (proposing its next action for approval).
|
|
282
|
+
*
|
|
283
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```http
|
|
287
|
+
* POST /api/flows/abc123/approve
|
|
288
|
+
*
|
|
289
|
+
* Response: FlowMetadata
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
294
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
295
|
+
*/
|
|
296
|
+
approveProposal(req: Request, res: Response): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Rejects the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
299
|
+
*
|
|
300
|
+
* The proposed action(s) are discarded and the optional feedback is fed back
|
|
301
|
+
* to the AI, which then proposes a different next action (again awaiting
|
|
302
|
+
* approval).
|
|
303
|
+
*
|
|
304
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```http
|
|
308
|
+
* POST /api/flows/abc123/reject
|
|
309
|
+
* { "feedback": "Use the search box instead of the menu." }
|
|
310
|
+
*
|
|
311
|
+
* Response: FlowMetadata
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
316
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
317
|
+
*/
|
|
318
|
+
rejectProposal(req: Request, res: Response): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Returns the AI-proposed tool call(s) a SUPERVISED flow is currently waiting
|
|
321
|
+
* on for approval. Empty when the flow is not active locally or is not in the
|
|
322
|
+
* WAITING_FOR_APPROVAL state. Polled by the UI to render what the user is
|
|
323
|
+
* being asked to approve or reject.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```http
|
|
327
|
+
* GET /api/flows/abc123/pending-tool-calls
|
|
328
|
+
*
|
|
329
|
+
* Response: { pendingToolCalls: ProposedToolCall[] }
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
334
|
+
*/
|
|
335
|
+
getPendingToolCalls(req: Request, res: Response): Promise<void>;
|
|
336
|
+
/**
|
|
337
|
+
* Changes the run mode of an active flow at runtime — the autonomy selector.
|
|
338
|
+
*
|
|
339
|
+
* This is the general primitive behind "start asking me each step"
|
|
340
|
+
* (→ SUPERVISED), "go fully autonomous" (→ AUTONOMOUS), and "I'll take over"
|
|
341
|
+
* (→ INSTRUCT). When switching to AUTONOMOUS with `approvePending: true` and a
|
|
342
|
+
* proposal is awaiting approval, that proposal is approved and run as part of
|
|
343
|
+
* the switch (the "approve & let it run" shortcut).
|
|
344
|
+
*
|
|
345
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```http
|
|
349
|
+
* POST /api/flows/abc123/run-mode
|
|
350
|
+
* { "runMode": "AUTONOMOUS", "approvePending": true }
|
|
351
|
+
*
|
|
352
|
+
* Response: FlowMetadata
|
|
353
|
+
* ```
|
|
354
|
+
*
|
|
355
|
+
* @remarks
|
|
356
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
357
|
+
*/
|
|
358
|
+
setRunMode(req: Request, res: Response): Promise<void>;
|
|
271
359
|
/**
|
|
272
360
|
* Cancels and terminates an active flow.
|
|
273
361
|
*
|
package/dist/apis/FlowsApi.js
CHANGED
|
@@ -5,6 +5,16 @@ const v4_1 = require("zod/v4");
|
|
|
5
5
|
const CodeGenerationOptions_1 = require("../models/CodeGenerationOptions");
|
|
6
6
|
const CreateDonobuFlow_1 = require("../models/CreateDonobuFlow");
|
|
7
7
|
const FlowMetadata_1 = require("../models/FlowMetadata");
|
|
8
|
+
const RunMode_1 = require("../models/RunMode");
|
|
9
|
+
/** Body schema for the reject-proposal endpoint (SUPERVISED mode). */
|
|
10
|
+
const RejectProposalBodySchema = v4_1.z.object({
|
|
11
|
+
feedback: v4_1.z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
/** Body schema for the set-run-mode endpoint (live autonomy switching). */
|
|
14
|
+
const SetRunModeBodySchema = v4_1.z.object({
|
|
15
|
+
runMode: RunMode_1.RunModeSchema,
|
|
16
|
+
approvePending: v4_1.z.boolean().optional(),
|
|
17
|
+
});
|
|
8
18
|
/**
|
|
9
19
|
* API controller for managing Donobu flows throughout their lifecycle.
|
|
10
20
|
*
|
|
@@ -284,9 +294,11 @@ class FlowsApi {
|
|
|
284
294
|
/**
|
|
285
295
|
* Pauses execution of an active flow.
|
|
286
296
|
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
297
|
+
* Submits a PAUSE user action; the flow's run loop applies it after its
|
|
298
|
+
* current action, transitioning to PAUSED. Like the desktop control panel's
|
|
299
|
+
* pause, this goes through the single user-action channel
|
|
300
|
+
* ({@link DonobuFlow.submitUserAction}) rather than mutating flow state
|
|
301
|
+
* directly.
|
|
290
302
|
*
|
|
291
303
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
292
304
|
*
|
|
@@ -294,7 +306,8 @@ class FlowsApi {
|
|
|
294
306
|
* ```http
|
|
295
307
|
* POST /api/flows/abc123/pause
|
|
296
308
|
*
|
|
297
|
-
* Response: FlowMetadata
|
|
309
|
+
* Response: the flow's FlowMetadata (the pause is applied asynchronously by
|
|
310
|
+
* the run loop, so the returned metadata may not yet show PAUSED)
|
|
298
311
|
* ```
|
|
299
312
|
*
|
|
300
313
|
* @remarks
|
|
@@ -304,16 +317,18 @@ class FlowsApi {
|
|
|
304
317
|
async pauseFlow(req, res) {
|
|
305
318
|
const flowId = String(req.params.flowId);
|
|
306
319
|
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
307
|
-
if
|
|
308
|
-
|
|
309
|
-
}
|
|
320
|
+
// The PAUSE handler in onUserInterruption no-ops if the flow is already
|
|
321
|
+
// complete, so no guard is needed here.
|
|
322
|
+
flow.submitUserAction({ type: 'PAUSE' });
|
|
310
323
|
res.json(flow.metadata);
|
|
311
324
|
}
|
|
312
325
|
/**
|
|
313
326
|
* Resumes execution of a paused flow.
|
|
314
327
|
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
328
|
+
* Submits a RESUME user action (only when the flow is currently PAUSED); the
|
|
329
|
+
* run loop transitions PAUSED → RESUMING → normal operation. Like the desktop
|
|
330
|
+
* control panel's resume, this goes through the single user-action channel
|
|
331
|
+
* ({@link DonobuFlow.submitUserAction}).
|
|
317
332
|
*
|
|
318
333
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
319
334
|
*
|
|
@@ -321,7 +336,8 @@ class FlowsApi {
|
|
|
321
336
|
* ```http
|
|
322
337
|
* POST /api/flows/abc123/resume
|
|
323
338
|
*
|
|
324
|
-
* Response: FlowMetadata
|
|
339
|
+
* Response: the flow's FlowMetadata (the resume is applied asynchronously by
|
|
340
|
+
* the run loop, so the returned metadata may not yet show RESUMING)
|
|
325
341
|
* ```
|
|
326
342
|
*
|
|
327
343
|
* @remarks
|
|
@@ -332,8 +348,120 @@ class FlowsApi {
|
|
|
332
348
|
const flowId = String(req.params.flowId);
|
|
333
349
|
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
334
350
|
if (flow.metadata.state === 'PAUSED') {
|
|
335
|
-
flow.
|
|
351
|
+
flow.submitUserAction({ type: 'RESUME' });
|
|
352
|
+
}
|
|
353
|
+
res.json(flow.metadata);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Approves the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
357
|
+
*
|
|
358
|
+
* The flow leaves WAITING_FOR_APPROVAL and executes the proposed action(s)
|
|
359
|
+
* as-is, then continues (proposing its next action for approval).
|
|
360
|
+
*
|
|
361
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```http
|
|
365
|
+
* POST /api/flows/abc123/approve
|
|
366
|
+
*
|
|
367
|
+
* Response: FlowMetadata
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
372
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
373
|
+
*/
|
|
374
|
+
async approveProposal(req, res) {
|
|
375
|
+
const flowId = String(req.params.flowId);
|
|
376
|
+
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
377
|
+
flow.submitUserAction({ type: 'APPROVE' });
|
|
378
|
+
res.json(flow.metadata);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Rejects the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
382
|
+
*
|
|
383
|
+
* The proposed action(s) are discarded and the optional feedback is fed back
|
|
384
|
+
* to the AI, which then proposes a different next action (again awaiting
|
|
385
|
+
* approval).
|
|
386
|
+
*
|
|
387
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```http
|
|
391
|
+
* POST /api/flows/abc123/reject
|
|
392
|
+
* { "feedback": "Use the search box instead of the menu." }
|
|
393
|
+
*
|
|
394
|
+
* Response: FlowMetadata
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* @remarks
|
|
398
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
399
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
400
|
+
*/
|
|
401
|
+
async rejectProposal(req, res) {
|
|
402
|
+
const flowId = String(req.params.flowId);
|
|
403
|
+
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
404
|
+
const { feedback } = RejectProposalBodySchema.parse(req.body ?? {});
|
|
405
|
+
flow.submitUserAction({ type: 'REJECT', feedback });
|
|
406
|
+
res.json(flow.metadata);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Returns the AI-proposed tool call(s) a SUPERVISED flow is currently waiting
|
|
410
|
+
* on for approval. Empty when the flow is not active locally or is not in the
|
|
411
|
+
* WAITING_FOR_APPROVAL state. Polled by the UI to render what the user is
|
|
412
|
+
* being asked to approve or reject.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```http
|
|
416
|
+
* GET /api/flows/abc123/pending-tool-calls
|
|
417
|
+
*
|
|
418
|
+
* Response: { pendingToolCalls: ProposedToolCall[] }
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* @remarks
|
|
422
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
423
|
+
*/
|
|
424
|
+
async getPendingToolCalls(req, res) {
|
|
425
|
+
const flowId = String(req.params.flowId);
|
|
426
|
+
let pendingToolCalls = [];
|
|
427
|
+
try {
|
|
428
|
+
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
429
|
+
if (flow.metadata.state === 'WAITING_FOR_APPROVAL') {
|
|
430
|
+
pendingToolCalls = [...flow.proposedToolCalls];
|
|
431
|
+
}
|
|
336
432
|
}
|
|
433
|
+
catch {
|
|
434
|
+
// Flow isn't active locally — nothing is pending approval.
|
|
435
|
+
}
|
|
436
|
+
res.json({ pendingToolCalls });
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Changes the run mode of an active flow at runtime — the autonomy selector.
|
|
440
|
+
*
|
|
441
|
+
* This is the general primitive behind "start asking me each step"
|
|
442
|
+
* (→ SUPERVISED), "go fully autonomous" (→ AUTONOMOUS), and "I'll take over"
|
|
443
|
+
* (→ INSTRUCT). When switching to AUTONOMOUS with `approvePending: true` and a
|
|
444
|
+
* proposal is awaiting approval, that proposal is approved and run as part of
|
|
445
|
+
* the switch (the "approve & let it run" shortcut).
|
|
446
|
+
*
|
|
447
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```http
|
|
451
|
+
* POST /api/flows/abc123/run-mode
|
|
452
|
+
* { "runMode": "AUTONOMOUS", "approvePending": true }
|
|
453
|
+
*
|
|
454
|
+
* Response: FlowMetadata
|
|
455
|
+
* ```
|
|
456
|
+
*
|
|
457
|
+
* @remarks
|
|
458
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
459
|
+
*/
|
|
460
|
+
async setRunMode(req, res) {
|
|
461
|
+
const flowId = String(req.params.flowId);
|
|
462
|
+
const flow = this.donobuFlowsManager.getActiveFlow(flowId);
|
|
463
|
+
const { runMode, approvePending } = SetRunModeBodySchema.parse(req.body ?? {});
|
|
464
|
+
flow.submitUserAction({ type: 'SET_RUN_MODE', runMode, approvePending });
|
|
337
465
|
res.json(flow.metadata);
|
|
338
466
|
}
|
|
339
467
|
/**
|
package/dist/apis/TestsApi.js
CHANGED
|
@@ -70,9 +70,10 @@ class TestsApi {
|
|
|
70
70
|
const testId = String(req.params.testId);
|
|
71
71
|
const newFlowConfig = await this.testsManager.getNewFlowFromTest(testId);
|
|
72
72
|
const flowHandle = await this.flowsManager.createFlow(newFlowConfig);
|
|
73
|
-
// After starting an autonomous
|
|
74
|
-
// so subsequent runs replay the recorded actions.
|
|
75
|
-
if (newFlowConfig.initialRunMode === 'AUTONOMOUS'
|
|
73
|
+
// After starting an AI-driven run (autonomous or supervised), switch the
|
|
74
|
+
// test to deterministic so subsequent runs replay the recorded actions.
|
|
75
|
+
if (newFlowConfig.initialRunMode === 'AUTONOMOUS' ||
|
|
76
|
+
newFlowConfig.initialRunMode === 'SUPERVISED') {
|
|
76
77
|
const test = await this.testsManager.getTestById(testId);
|
|
77
78
|
await this.testsManager.updateTest({
|
|
78
79
|
...test,
|
|
@@ -480,7 +480,9 @@ async function buildCacheContents(flowsWithToolCalls, toolRegistry) {
|
|
|
480
480
|
const minimalToolNames = new Set(toolRegistry.minimalTools().map((t) => t.name));
|
|
481
481
|
const entries = flowsWithToolCalls
|
|
482
482
|
// We can only create page.ai caches for flows that have an objective.
|
|
483
|
-
.filter(({ metadata }) => metadata.overallObjective?.trim() &&
|
|
483
|
+
.filter(({ metadata }) => metadata.overallObjective?.trim() &&
|
|
484
|
+
(metadata.runMode === 'AUTONOMOUS' ||
|
|
485
|
+
metadata.runMode === 'SUPERVISED'))
|
|
484
486
|
.map(({ metadata, toolCalls }) => {
|
|
485
487
|
const [firstToolCall, ...remaingToolCalls] = toolCalls;
|
|
486
488
|
// If the first tool call is "GoToWebpage", then we peel it off and treat it
|
|
@@ -805,7 +807,7 @@ async function generateTestFiles(flowsWithToolCalls, options, toolRegistry) {
|
|
|
805
807
|
const fileName = getTestFileName(metadata);
|
|
806
808
|
const content = scriptVariant === 'classic' ||
|
|
807
809
|
!metadata.overallObjective?.trim() ||
|
|
808
|
-
metadata.runMode !== 'AUTONOMOUS'
|
|
810
|
+
(metadata.runMode !== 'AUTONOMOUS' && metadata.runMode !== 'SUPERVISED')
|
|
809
811
|
? await getFlowAsPlaywrightScript(metadata, toolCalls, options, toolRegistry)
|
|
810
812
|
: await getFlowAsAiPlaywrightScript(metadata, toolCalls, options, toolRegistry);
|
|
811
813
|
files.push({
|
|
@@ -230,9 +230,11 @@ export declare class FlowsApi {
|
|
|
230
230
|
/**
|
|
231
231
|
* Pauses execution of an active flow.
|
|
232
232
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
233
|
+
* Submits a PAUSE user action; the flow's run loop applies it after its
|
|
234
|
+
* current action, transitioning to PAUSED. Like the desktop control panel's
|
|
235
|
+
* pause, this goes through the single user-action channel
|
|
236
|
+
* ({@link DonobuFlow.submitUserAction}) rather than mutating flow state
|
|
237
|
+
* directly.
|
|
236
238
|
*
|
|
237
239
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
238
240
|
*
|
|
@@ -240,7 +242,8 @@ export declare class FlowsApi {
|
|
|
240
242
|
* ```http
|
|
241
243
|
* POST /api/flows/abc123/pause
|
|
242
244
|
*
|
|
243
|
-
* Response: FlowMetadata
|
|
245
|
+
* Response: the flow's FlowMetadata (the pause is applied asynchronously by
|
|
246
|
+
* the run loop, so the returned metadata may not yet show PAUSED)
|
|
244
247
|
* ```
|
|
245
248
|
*
|
|
246
249
|
* @remarks
|
|
@@ -251,8 +254,10 @@ export declare class FlowsApi {
|
|
|
251
254
|
/**
|
|
252
255
|
* Resumes execution of a paused flow.
|
|
253
256
|
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
257
|
+
* Submits a RESUME user action (only when the flow is currently PAUSED); the
|
|
258
|
+
* run loop transitions PAUSED → RESUMING → normal operation. Like the desktop
|
|
259
|
+
* control panel's resume, this goes through the single user-action channel
|
|
260
|
+
* ({@link DonobuFlow.submitUserAction}).
|
|
256
261
|
*
|
|
257
262
|
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
258
263
|
*
|
|
@@ -260,7 +265,8 @@ export declare class FlowsApi {
|
|
|
260
265
|
* ```http
|
|
261
266
|
* POST /api/flows/abc123/resume
|
|
262
267
|
*
|
|
263
|
-
* Response: FlowMetadata
|
|
268
|
+
* Response: the flow's FlowMetadata (the resume is applied asynchronously by
|
|
269
|
+
* the run loop, so the returned metadata may not yet show RESUMING)
|
|
264
270
|
* ```
|
|
265
271
|
*
|
|
266
272
|
* @remarks
|
|
@@ -268,6 +274,88 @@ export declare class FlowsApi {
|
|
|
268
274
|
* Only works on flows currently in PAUSED state.
|
|
269
275
|
*/
|
|
270
276
|
resumeFlow(req: Request, res: Response): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Approves the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
279
|
+
*
|
|
280
|
+
* The flow leaves WAITING_FOR_APPROVAL and executes the proposed action(s)
|
|
281
|
+
* as-is, then continues (proposing its next action for approval).
|
|
282
|
+
*
|
|
283
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```http
|
|
287
|
+
* POST /api/flows/abc123/approve
|
|
288
|
+
*
|
|
289
|
+
* Response: FlowMetadata
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
294
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
295
|
+
*/
|
|
296
|
+
approveProposal(req: Request, res: Response): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Rejects the AI-proposed action(s) a SUPERVISED flow is waiting on.
|
|
299
|
+
*
|
|
300
|
+
* The proposed action(s) are discarded and the optional feedback is fed back
|
|
301
|
+
* to the AI, which then proposes a different next action (again awaiting
|
|
302
|
+
* approval).
|
|
303
|
+
*
|
|
304
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```http
|
|
308
|
+
* POST /api/flows/abc123/reject
|
|
309
|
+
* { "feedback": "Use the search box instead of the menu." }
|
|
310
|
+
*
|
|
311
|
+
* Response: FlowMetadata
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* This endpoint is only available in LOCAL deployment environments for security.
|
|
316
|
+
* Only has an effect on flows currently in WAITING_FOR_APPROVAL state.
|
|
317
|
+
*/
|
|
318
|
+
rejectProposal(req: Request, res: Response): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Returns the AI-proposed tool call(s) a SUPERVISED flow is currently waiting
|
|
321
|
+
* on for approval. Empty when the flow is not active locally or is not in the
|
|
322
|
+
* WAITING_FOR_APPROVAL state. Polled by the UI to render what the user is
|
|
323
|
+
* being asked to approve or reject.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```http
|
|
327
|
+
* GET /api/flows/abc123/pending-tool-calls
|
|
328
|
+
*
|
|
329
|
+
* Response: { pendingToolCalls: ProposedToolCall[] }
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
334
|
+
*/
|
|
335
|
+
getPendingToolCalls(req: Request, res: Response): Promise<void>;
|
|
336
|
+
/**
|
|
337
|
+
* Changes the run mode of an active flow at runtime — the autonomy selector.
|
|
338
|
+
*
|
|
339
|
+
* This is the general primitive behind "start asking me each step"
|
|
340
|
+
* (→ SUPERVISED), "go fully autonomous" (→ AUTONOMOUS), and "I'll take over"
|
|
341
|
+
* (→ INSTRUCT). When switching to AUTONOMOUS with `approvePending: true` and a
|
|
342
|
+
* proposal is awaiting approval, that proposal is approved and run as part of
|
|
343
|
+
* the switch (the "approve & let it run" shortcut).
|
|
344
|
+
*
|
|
345
|
+
* @throws {@link ActiveFlowNotFoundException} When the flow is not active locally
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```http
|
|
349
|
+
* POST /api/flows/abc123/run-mode
|
|
350
|
+
* { "runMode": "AUTONOMOUS", "approvePending": true }
|
|
351
|
+
*
|
|
352
|
+
* Response: FlowMetadata
|
|
353
|
+
* ```
|
|
354
|
+
*
|
|
355
|
+
* @remarks
|
|
356
|
+
* This endpoint is only available in LOCAL deployment environments.
|
|
357
|
+
*/
|
|
358
|
+
setRunMode(req: Request, res: Response): Promise<void>;
|
|
271
359
|
/**
|
|
272
360
|
* Cancels and terminates an active flow.
|
|
273
361
|
*
|