⚙️ Morpheus Execution API
The Morpheus Execution API is the runtime implementation of the SODEA Core API. It exposes RESTful endpoints to interact with semantic objects (SOs), trigger behaviors, subscribe to events, and manage execution workflows.
Unlike the SODEA specification, Morpheus defines concrete endpoints and runtime behaviors. It is the engine that brings semantic objects to life.
🔗 Base URL
https://your-morpheus-instance.com/api
📦 Endpoints
GET /objects
List all semantic objects.
-
Query Parameters (optional):
type
: Filter by@type
id
: Filter by@id
pattern
GET /objects/:id
Retrieve a specific semantic object by ID.
:id
is the full@id
, URL-encoded.
POST /objects
Create a new semantic object.
- Body: JSON-LD object
- Returns: Stored object with metadata
PUT /objects/:id
Update an existing semantic object.
- Body: Entire updated object
- Note: Overwrites existing fields
DELETE /objects/:id
Remove an object.
🧠 Execution Hooks
POST /execute/:id/:hook
Run a hook for a specific object.
-
:id
: object@id
-
:hook
:onEvent
,onTick
,mutateWith
, etc. -
Body: Parameters (
{ "eventType": "reset", ... }
) -
Example:
POST /execute/urn:system:counter/onTick
{
"time": "2025-06-04T12:00:00Z"
}
🔔 Events
POST /events
Send an event into the system. Objects with subscriptions will react via onEvent
.
- Body:
{
"eventType": "reset_counter",
"target": "urn:system:counter-a",
"payload": {}
}
Morpheus will:
- Match subscriptions
- Trigger
onEvent
for affected objects
⏱️ Scheduler
Morpheus can automatically call onTick
for objects with _private.schedule.interval
.
Behavior:
- Executes in real time
- Intervals:
"1s"
,"10s"
,"1m"
etc. - Can be disabled via config
📬 Subscriptions
Registered via _private.subscriptions
.
When an event with matching eventType
is received:
- The object’s
onEvent
hook is triggered - Execution may mutate the object or trigger further events
🔒 Authentication & Access Control (Optional)
-
API supports token-based auth
-
Can restrict:
- Object creation
- Hook execution
- Event publishing
Future versions will integrate with _private.policies
.