refactor(semantics): migrate TIER system to adaptive COMPLEXITY 1-5 scale
- Replaced rigid TIERs with continuous COMPLEXITY 1-5 scale in semantics.md - Updated generate_semantic_map.py to parse and score based on Complexity - Added backward compatibility mapping for legacy TIERs - Migrated all .ai/shots examples to use @COMPLEXITY and updated relation syntax - Added trivial_utility.py shot to demonstrate implicit Complexity 1 token savings
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#[DEF:BackendRouteShot:Module]
|
||||
# @TIER: STANDARD
|
||||
# @COMPLEXITY: 3
|
||||
# @SEMANTICS: Route, Task, API, Async
|
||||
# @PURPOSE: Reference implementation of a task-based route using GRACE-Poly.
|
||||
# @LAYER: Interface (API)
|
||||
# @RELATION: IMPLEMENTS -> [DEF:Std:API_FastAPI]
|
||||
# @INVARIANT: TaskManager must be available in dependency graph.
|
||||
# @RELATION: [IMPLEMENTS] ->[API_FastAPI]
|
||||
|
||||
from typing import Dict, Any
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
@@ -25,15 +24,13 @@ class CreateTaskRequest(BaseModel):
|
||||
# [/DEF:CreateTaskRequest:Class]
|
||||
|
||||
# [DEF:create_task:Function]
|
||||
# @COMPLEXITY: 4
|
||||
# @PURPOSE: Create and start a new task using TaskManager. Non-blocking.
|
||||
# @DATA_CONTRACT: Input -> CreateTaskRequest, Output -> Task
|
||||
# @RELATION: [CALLS] ->[task_manager.create_task]
|
||||
# @PRE: plugin_id must match a registered plugin.
|
||||
# @POST: A new task is spawned; Task object returned immediately.
|
||||
# @SIDE_EFFECT: Writes to DB, Triggers background worker.
|
||||
#
|
||||
# @UX_STATE: Success -> 201 Created
|
||||
# @UX_STATE: Error(Validation) -> 400 Bad Request
|
||||
# @UX_STATE: Error(System) -> 500 Internal Server Error
|
||||
# @DATA_CONTRACT: Input -> CreateTaskRequest, Output -> Task
|
||||
@router.post("/tasks", response_model=Task, status_code=status.HTTP_201_CREATED)
|
||||
async def create_task(
|
||||
request: CreateTaskRequest,
|
||||
|
||||
Reference in New Issue
Block a user