[AlertZero] Expose action input schemas in the action catalog - #291094
patrykkopycinski wants to merge 3 commits into
Conversation
Follow-up to elastic#290705: catalog entries now also carry inputSchema, the JSON Schema the workflow declares on its manual trigger (triggers[type=manual].inputs), so an agent knows the inputs each action accepts without reading the workflow YAML. Requested in Slack by Sergi (feedback on the merged catalog PR).
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
Selected for Libra reviewThis PR was selected for Libra review as part of the temporary 50% trial. To opt out permanently, remove the |
kibanamachine
left a comment
There was a problem hiding this comment.
Libra found 1 issue.
Generated by Libra
…ishing inputSchema Address review feedback on elastic#291094: key-presence ('properties' in inputs) does not ensure inputs is a JSON Schema — { properties: [] } or { properties: null } would still be published. Parse the trigger with the workflow's own ManualTriggerSchema and return the original value only when it parses and is not the legacy array format; otherwise omit inputSchema.
|
Addressed in b09f36c: |
kibanamachine
left a comment
There was a problem hiding this comment.
Libra found 1 issue.
Generated by Libra
Address second review comment on elastic#291094: the contract type was imported only for the interface. Re-export it from action_catalog_types.ts and the package root so consumers can import it alongside ActionCatalogEntry.
|
Addressed in e4bd1a6: |
|
The red kibana-ci run (build 501962) failed on a single job: FTR Configs #54 — Serverless Security Functional Tests, Common Group 6, test |
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]
Test Failures
History
|
Summary
Follow-up to #290705 ([AlertZero] Action catalog), addressing Sergi's feedback: the agent needs to know the
inputsschema of each action, so catalog entries now also carryinputSchema.ActionCatalogEntrygains an optionalinputSchema: JsonSchemafield (type re-exported from@kbn/workflows).ActionsService.toEntryreads the JSON Schema the workflow declares on its manual trigger (triggers[type=manual].inputs) — the jsonSchema defined in the manual trigger of the workflow action — and projects it verbatim onto the catalog entry.inputSchemarather than a malformed entry.inputSchemaabsent.security.alertzero.actions.listAgent Builder tool description now documentsinputSchemaso the agent fills the action's inputs when proposing it.The API (
GET /internal/alertzero/actions) returns the new field automatically — its response type isListActionsResponse, whose entries areActionCatalogEntry.Test plan
node scripts/jest x-pack/solutions/security/plugins/alertzero/server/services/actions/actions_service.test.ts— new tests:inputSchemaprojected verbatim from the manual trigger inputs;inputSchemaomitted for definitions with no triggers / manual trigger without inputs / non-manual triggers carrying inputs;inputSchemaomitted for legacy array-format inputs.node scripts/jest x-pack/solutions/security/plugins/alertzero/server/agent_builder_tools/list_actions_tool.test.ts— assertsinputSchemaflows through to the tool result.node scripts/type_check --project x-pack/solutions/security/plugins/alertzero/tsconfig.json --cleanupnode scripts/type_check --project x-pack/solutions/security/packages/kbn-alertzero-common/tsconfig.json --cleanup