Files
osmedeus/test/testdata/workflows/events/simple-emitter.yaml
T
j3ssie f5840272c5 feat: add run cancellation, event enhancements, and performance optimizations
Major features:
- Add run registry for tracking active runs with PID management
- Add API-based run cancellation with process termination
- Add event trigger input vars syntax for multi-variable extraction
- Add filter_functions with utility function support in triggers
- Add event envelope injection for full event context in workflows
- Add write coordinator for batched database operations

API improvements:
- Add logout endpoint and diffs endpoints for assets/vulnerabilities
- Add step-results listing endpoint
- Update schedule model with target, workspace, params fields
- Change run_id to run_uuid across API responses

Performance:
- Add compiled JS program caching for 60-80% faster loop conditions
- Add parallel shard rendering for 20-40% faster workflow startup
- Add memory-mapped I/O for large file line counting
- Add efficient output buffer combining in runners
- Add mtime-based cache invalidation for workflow loader

Other changes:
- Rename trigger field from trigger to triggers in workflow YAML
- Disable pongo2 HTML autoescape for shell command templates
- Update JWT expiration default to 1440 minutes (1 day)
- Change CORS default to reflect-origin for credentials support
- Add source_type field to events (run, eval, api)
- Skip copying core Unix tools to external-binaries
2026-01-24 01:11:33 +08:00

53 lines
1.7 KiB
YAML

# Simple Event Emitter Workflow
# This workflow demonstrates how to emit events that can trigger other workflows
name: simple-emitter
kind: module
description: Simple workflow that emits events for discovered assets
tags: event,emitter,example
params:
- name: target
required: true
steps:
- name: log-start
type: function
functions:
- 'print_green("Starting discovery for {{target}}")'
- name: discover-assets
type: bash
command: |
echo "api.{{target}}" > {{Output}}/assets.txt
echo "www.{{target}}" >> {{Output}}/assets.txt
echo "mail.{{target}}" >> {{Output}}/assets.txt
- name: emit-single-event
type: function
description: Emit a single event for a specific asset
functions:
- 'generate_event("{{TargetSpace}}", "discovery.asset", "simple-emitter", "subdomain", "new.{{target}}")'
- 'print_blue("Emitted single event for new.{{target}}")'
- name: emit-events-from-file
type: function
description: Emit events for each line in a file
functions:
- 'set_var("count", generate_event_from_file("{{TargetSpace}}", "discovery.asset", "simple-emitter", "subdomain", "{{Output}}/assets.txt"))'
- 'print_green("Emitted " + get_var("count") + " events from file")'
- name: emit-structured-event
type: function
description: Emit an event with structured JSON data
function: |
generate_event("{{TargetSpace}}", "discovery.complete", "simple-emitter", "summary", {
target: "{{target}}",
asset_count: 3,
status: "completed"
})
- name: log-complete
type: function
functions:
- 'print_green("Discovery complete for {{target}}")'