Four example workflow packages proving the engine end-to-end: - Bug Report Triage: public entry, branch routing, SLA timer - Employee Onboarding: Starlark automated stages, signoff gate - Content Approval: multi-party signoff, revision cycle loop - Webhook Notifier: http.post, connections fallback, delivery logging Demo surface at /s/workflow-demo with cards, stage diagrams, Starlark viewer, API examples, active/published status, and copyable public links. Engine fixes: started_by in automated context, sla_seconds in package installer, parseSnapshotStages for wrapped/legacy formats. Platform fixes: extension SDK boot in base.html (Preact globals + boot()), admin teams paginated response extraction, workflow adoption endpoint (POST /teams/:teamId/workflows/:id/adopt), team-admin copyable link. Review pass remains on roadmap for remaining UI polish. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
def on_provision(ctx):
|
|
"""Automated provisioning: record in ext_data, notify HR."""
|
|
data = ctx["stage_data"]
|
|
name = data.get("full_name", "unknown")
|
|
dept = data.get("department", "general")
|
|
|
|
# Record provision in ext_data table
|
|
db.insert("provisions", {
|
|
"employee_name": name,
|
|
"department": dept,
|
|
"needs_vpn": str(data.get("needs_vpn", "false")),
|
|
"needs_admin": str(data.get("needs_admin", "false")),
|
|
"equipment": data.get("equipment", "standard laptop"),
|
|
"status": "provisioned",
|
|
})
|
|
|
|
# Notify the HR user who started this workflow
|
|
notifications.send(
|
|
ctx["started_by"],
|
|
"Accounts provisioned for " + name,
|
|
"Department: " + dept + ". Ready for manager review.",
|
|
)
|
|
|
|
return {"advance": True, "data": {
|
|
"provision_status": "complete",
|
|
"provisioned_for": name,
|
|
}}
|
|
|
|
|
|
def on_welcome(ctx):
|
|
"""Completion logging: record onboarding and send welcome."""
|
|
data = ctx["stage_data"]
|
|
name = data.get("full_name", "")
|
|
dept = data.get("department", "")
|
|
|
|
db.insert("onboarding_log", {
|
|
"employee_name": name,
|
|
"department": dept,
|
|
"completed_by": ctx["started_by"],
|
|
"status": "complete",
|
|
})
|
|
|
|
notifications.send(
|
|
ctx["started_by"],
|
|
"Onboarding complete: " + name,
|
|
"All stages finished. Welcome aboard!",
|
|
)
|
|
|
|
return {"advance": True, "data": {"onboarding_complete": True}}
|