-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add awaitingUserInput flag for multi-step loop control #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -317,7 +317,7 @@ export const createWorkflowAction: Action = { | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good addition: The |
||
| } | ||
|
|
||
| await runtime.deleteCache(cacheKey); | ||
|
|
@@ -372,7 +372,7 @@ export const createWorkflowAction: Action = { | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct placement: Adding the flag here is right - when clarification questions are returned after a modification, the loop should pause and wait for the user's answers. ✅ |
||
| } | ||
|
|
||
| const text = await formatActionResponse( | ||
|
|
@@ -383,7 +383,7 @@ export const createWorkflowAction: Action = { | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consistent pattern: The modified workflow preview correctly includes the flag. This ensures the user sees the updated draft and must confirm before deployment. ✅ |
||
| } | ||
|
|
||
| case 'new': { | ||
|
|
@@ -419,7 +419,7 @@ export const createWorkflowAction: Action = { | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -436,7 +436,7 @@ export const createWorkflowAction: Action = { | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edge case handling: When a "new" workflow generation fails and the previous draft is restored, the |
||
| } | ||
| } | ||
| } | ||
|
|
@@ -516,12 +516,12 @@ async function generateAndPreview( | |
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarification flow: Correctly returns |
||
| } | ||
|
|
||
| const text = await formatActionResponse(runtime, 'PREVIEW', buildPreviewData(workflow)); | ||
| if (callback) { | ||
| await callback({ text, success: true }); | ||
| } | ||
| return { success: true }; | ||
| return { success: true, data: { awaitingUserInput: true } }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preview generation: The initial workflow preview correctly includes the flag. This is the core use case - after generating a draft, the system waits for user confirmation before deploying. ✅ |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good test practice: Using optional chaining (`result?.data`) prevents tests from failing with null reference errors if the action handler has issues. The assertion verifies both the structure and the specific flag value. ✅
Consider: You might also want to add a test that explicitly verifies the flag is NOT present (or is false) in terminal states like deployment success or cancellation, to ensure the behavior is complete.