refactor(ai-autopilot): validate options, isolate onEvent, sharpen docs#30
Merged
Conversation
…docs Code quality + docs pass for @gemstack/ai-autopilot: - Supervisor validates options at construction (plan is a function, workers required, concurrency/maxSubtasks positive integers) and run() rejects an empty task, so misconfiguration fails fast with a clear message instead of deep inside a planner call. - An onEvent callback that throws is now isolated (logged and swallowed) via a makeEmitter wrapper, so an observer bug cannot abort the run. - Corrected SupervisorRun.usage docs: it aggregates dispatched-subtask usage only; the Planner/Synthesizer contracts return data not usage, so planning/synthesis spend is not observable by the supervisor. - Clarified maxSubtasks/budget are optional, marked the internal runPool helper @internal with full JSDoc, added a defaultSynthesize example, and updated the README guardrails section. Added tests for option validation, empty-task rejection, and onEvent isolation. 21 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code quality + docs pass for
@gemstack/ai-autopilot(part of the per-package GemStack quality sweep).Code quality
Supervisorvalidates options at construction (planmust be a function,workersis required,concurrency/maxSubtasksmust be positive integers) andrun()rejects an empty task. Previously bad config surfaced deep inside a planner call with a confusing error.onEventcallback that throws is now logged and swallowed (via amakeEmitterwrapper) so an observer bug can never abort a supervised run.runPoolclarity - marked@internal(used only bySupervisor, not re-exported) with full@param/@returnsJSDoc.Docs
usagesemantics -SupervisorRun.usageaggregates dispatched-subtask usage only. ThePlanner/Synthesizercontracts return data, not usage, so planning/synthesis spend isn't observable. The doc previously over-claimed "across planning, dispatch, and synthesis".maxSubtasks/budgetare optional; added adefaultSynthesizeexample; updated the README guardrails section (incl. observer safety + construction-time validation).Verification
Added tests for option validation, empty-task rejection, and
onEventisolation. Build + 21 tests green. Patch changeset included.