Loading...
Loading...
Creates and maintains Sorcha blueprint JSON templates and workflow definitions. Use when: Building new blueprints, creating template JSON files, defining participants/actions/routes/schemas, configuring cycle detection, or troubleshooting blueprint publishing.
npx skill4agent add stuartf303/sorcha blueprint-builder{
"id": "my-blueprint",
"title": "My Workflow",
"description": "A simple two-participant workflow (min 5 chars)",
"version": 1,
"metadata": { "category": "demo" },
"participants": [
{ "id": "sender", "name": "Sender", "description": "Initiates the workflow" },
{ "id": "receiver", "name": "Receiver", "description": "Receives and completes" }
],
"actions": [
{
"id": 0,
"title": "Submit",
"sender": "sender",
"isStartingAction": true,
"dataSchemas": [
{
"type": "object",
"properties": {
"message": { "type": "string", "minLength": 1 }
},
"required": ["message"]
}
],
"routes": [
{ "id": "to-receiver", "nextActionIds": [1], "isDefault": true }
]
},
{
"id": 1,
"title": "Complete",
"sender": "receiver",
"dataSchemas": [
{
"type": "object",
"properties": {
"status": { "type": "string", "enum": ["accepted", "rejected"] }
},
"required": ["status"]
}
],
"routes": []
}
]
}{
"metadata": { "hasCycles": "true" },
"actions": [
{
"id": 0, "title": "Ping", "sender": "ping", "isStartingAction": true,
"routes": [{ "id": "ping-to-pong", "nextActionIds": [1], "isDefault": true }]
},
{
"id": 1, "title": "Pong", "sender": "pong",
"routes": [{ "id": "pong-to-ping", "nextActionIds": [0], "isDefault": true }]
}
]
}metadata["hasCycles"] = "true"| Concept | Details |
|---|---|
| Participants | Min 2 required. Each has |
| Actions | Sequential IDs starting at 0. One must have |
| Routes | Define flow between actions. |
| DataSchemas | JSON Schema for action payload. |
| Conditions | JSON Logic expressions for conditional routing |
| Calculations | JSON Logic for computed values (e.g., |
| Cycles | Allowed with warning. Set |
action.senderparticipant.idBlueprintBuilder.Build(){ "id": "always", "nextActionIds": [1], "isDefault": true }{
"id": "approve-route",
"nextActionIds": [2],
"condition": { "==": [{ "var": "decision" }, "approved"] }
}{ "id": "complete", "nextActionIds": [], "isDefault": true }{
"id": "parallel-review",
"nextActionIds": [2, 3],
"isDefault": true,
"branchDeadline": "P7D"
}Action.RoutesAction.Participantsroutes{ "type": "string", "minLength": 1, "maxLength": 500, "title": "Message" }{ "type": "integer", "minimum": 1, "title": "Counter" }{ "type": "string", "enum": ["approved", "rejected", "escalate"], "title": "Decision" }{ "type": "number", "minimum": 0, "title": "Amount" }{
"id": "template-id",
"title": "Template Title",
"description": "What this template does (min 5 chars)",
"version": 1,
"category": "demo|approval|finance|supply-chain",
"tags": ["tag1", "tag2"],
"author": "Sorcha Team",
"published": true,
"template": { /* raw blueprint JSON or JSON-e template */ },
"parameterSchema": null,
"defaultParameters": null,
"examples": []
}parameterSchema: nulltemplate$eval$if$flattenDeeptemplateparameterSchemadefaultParametersexamples{ "$eval": "paramName" }{ "$if": "condition", "then": ..., "else": ... }{ "$flattenDeep": [...] }POST /api/blueprints/POST /api/blueprints/{id}/publishPOST /api/instances/{
"blueprintId": "...",
"version": 1,
"publishedAt": "...",
"warnings": ["Cyclic route detected: action 0 → action 1 → action 0. This blueprint will loop indefinitely unless routing conditions provide a termination path."]
}POST /api/instances/{id}/actions/{actionId}/execute
Headers: Authorization: Bearer <token>, X-Delegation-Token: <token>
Body: {
"blueprintId": "string",
"actionId": "string",
"instanceId": "string",
"senderWallet": "string",
"registerAddress": "string",
"payloadData": { "message": "hello", "counter": 1 }
}Submit(requester) → Review(manager) → Approve(director) → CompletePing(A) → Pong(B) → Ping(A) → Pong(B) → ... (indefinite)Submit → [amount > 10000] → Director Approval
Submit → [amount <= 10000] → Manager Approval
Both → Complete| File | Purpose |
|---|---|
| Built-in template JSON files |
| Blueprint, Action, Route, Participant models |
| Template model |
| Execution engine (validate/calculate/route/disclose) |
| Fluent API for programmatic blueprint creation |
| PublishService, ValidateBlueprint, DetectCycles |
| Startup seeding |