autoclaw 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autoclaw-0.1.0/PKG-INFO +64 -0
- autoclaw-0.1.0/README.md +36 -0
- autoclaw-0.1.0/apps/api/app/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/api/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/api/deps.py +36 -0
- autoclaw-0.1.0/apps/api/app/api/errors.py +71 -0
- autoclaw-0.1.0/apps/api/app/api/router.py +18 -0
- autoclaw-0.1.0/apps/api/app/api/routes/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/api/routes/callback.py +98 -0
- autoclaw-0.1.0/apps/api/app/api/routes/definitions.py +110 -0
- autoclaw-0.1.0/apps/api/app/api/routes/health.py +24 -0
- autoclaw-0.1.0/apps/api/app/api/routes/observability.py +83 -0
- autoclaw-0.1.0/apps/api/app/api/routes/operator.py +51 -0
- autoclaw-0.1.0/apps/api/app/api/routes/runtime.py +116 -0
- autoclaw-0.1.0/apps/api/app/api/routes/tasks.py +40 -0
- autoclaw-0.1.0/apps/api/app/api/runtime_exception_mapping.py +113 -0
- autoclaw-0.1.0/apps/api/app/cli.py +256 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/__init__.py +3 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/bootstrap.py +303 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/definitions.py +183 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/openclaw_support.py +117 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/openclaw_wrapper.py +771 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/operator.py +544 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/service.py +204 -0
- autoclaw-0.1.0/apps/api/app/cli_commands/task_compose.py +46 -0
- autoclaw-0.1.0/apps/api/app/cli_support.py +71 -0
- autoclaw-0.1.0/apps/api/app/compiler/__init__.py +39 -0
- autoclaw-0.1.0/apps/api/app/compiler/compile.py +71 -0
- autoclaw-0.1.0/apps/api/app/compiler/contracts.py +106 -0
- autoclaw-0.1.0/apps/api/app/compiler/normalize.py +399 -0
- autoclaw-0.1.0/apps/api/app/compiler/role_policy_lookup.py +41 -0
- autoclaw-0.1.0/apps/api/app/config.py +194 -0
- autoclaw-0.1.0/apps/api/app/core/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/core/enums.py +8 -0
- autoclaw-0.1.0/apps/api/app/db/__init__.py +81 -0
- autoclaw-0.1.0/apps/api/app/db/base.py +7 -0
- autoclaw-0.1.0/apps/api/app/db/models/__init__.py +81 -0
- autoclaw-0.1.0/apps/api/app/db/models/registry.py +203 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/__init__.py +73 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/assignment/__init__.py +23 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/assignment/artifacts.py +127 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/assignment/execution.py +371 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/common.py +83 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/dispatch/__init__.py +25 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/dispatch/states.py +295 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/dispatch/support.py +126 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/dispatch/turns.py +317 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/flow/__init__.py +17 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/flow/graph.py +308 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/flow/runtime.py +223 -0
- autoclaw-0.1.0/apps/api/app/db/models/runtime/task.py +385 -0
- autoclaw-0.1.0/apps/api/app/db/session.py +384 -0
- autoclaw-0.1.0/apps/api/app/file_entrypoints.py +63 -0
- autoclaw-0.1.0/apps/api/app/main.py +91 -0
- autoclaw-0.1.0/apps/api/app/paths.py +57 -0
- autoclaw-0.1.0/apps/api/app/registry/__init__.py +33 -0
- autoclaw-0.1.0/apps/api/app/registry/current.py +326 -0
- autoclaw-0.1.0/apps/api/app/registry/definition_catalog.py +358 -0
- autoclaw-0.1.0/apps/api/app/registry/definition_history.py +139 -0
- autoclaw-0.1.0/apps/api/app/registry/revisions/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/registry/revisions/ids.py +20 -0
- autoclaw-0.1.0/apps/api/app/registry/revisions/reads.py +216 -0
- autoclaw-0.1.0/apps/api/app/registry/revisions/types.py +70 -0
- autoclaw-0.1.0/apps/api/app/registry/revisions/writes.py +334 -0
- autoclaw-0.1.0/apps/api/app/registry/seeds.py +102 -0
- autoclaw-0.1.0/apps/api/app/registry/task_start.py +83 -0
- autoclaw-0.1.0/apps/api/app/registry/upsert.py +219 -0
- autoclaw-0.1.0/apps/api/app/resources/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/policies/standard_parent_planning.yaml +12 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/policies/standard_release.yaml +10 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/policies/standard_review.yaml +10 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/policies/standard_root_planning.yaml +12 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/policies/standard_worker.yaml +7 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/architect.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/engineer.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/planner.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/planning_lead.yaml +12 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/release_operator.yaml +8 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/researcher.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/reviewer.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/roles/root_planning_lead.yaml +9 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/workflows/maximal_parent_first_release.yaml +144 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/workflows/minimal_implement_change.yaml +32 -0
- autoclaw-0.1.0/apps/api/app/resources/definitions/workflows/normal_parent_first_release.yaml +93 -0
- autoclaw-0.1.0/apps/api/app/resources/systemd/autoclaw.service +20 -0
- autoclaw-0.1.0/apps/api/app/runtime/__init__.py +109 -0
- autoclaw-0.1.0/apps/api/app/runtime/contract_models/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/contract_models/launch.py +84 -0
- autoclaw-0.1.0/apps/api/app/runtime/contract_models/primitives.py +208 -0
- autoclaw-0.1.0/apps/api/app/runtime/contract_models/projection.py +260 -0
- autoclaw-0.1.0/apps/api/app/runtime/contract_models/prompt.py +160 -0
- autoclaw-0.1.0/apps/api/app/runtime/contracts.py +119 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/__init__.py +54 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/assignment/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/assignment/persistence.py +116 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/assignment/service.py +337 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/assignment/staging.py +372 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/assignment/supersession.py +49 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/boundary/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/boundary/relations.py +30 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/boundary/release_descendant_refs.py +172 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/boundary/service.py +385 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/boundary/transitions.py +351 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/budgets.py +109 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/checkpoint/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/checkpoint/artifacts.py +346 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/checkpoint/recording.py +244 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/clock.py +14 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/authority.py +211 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/control.py +336 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/__init__.py +49 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/abort.py +104 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/cleanup.py +127 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/contracts.py +39 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/launch.py +135 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/session.py +130 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway/wait.py +74 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway_launch_state.py +367 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/gateway_observability.py +156 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/openclaw_runtime/__init__.py +27 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/openclaw_runtime/event_ingest.py +400 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/openclaw_runtime/lease.py +17 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/openclaw_runtime/lifecycle.py +149 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/openclaw_runtime/models.py +78 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/opening.py +393 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/dispatch/provider_events.py +67 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/failures.py +299 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/listing.py +183 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/queries.py +142 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/resume.py +156 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/service.py +367 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/flow/timestamps.py +12 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/node_operations.py +220 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/observability.py +389 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/parent_tool_actions.py +279 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/parent_tools.py +173 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/release/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/release/basis.py +162 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/release/guards.py +33 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/release/preconditions.py +305 -0
- autoclaw-0.1.0/apps/api/app/runtime/control/workspace_leases.py +25 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/__init__.py +39 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/cases.py +125 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/dispatch_progression.py +87 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/dispatch_reconcile.py +306 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/keys.py +61 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/queue.py +234 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/task_reconcile.py +159 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/task_reconcile_state.py +132 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/validation.py +87 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/worker.py +322 -0
- autoclaw-0.1.0/apps/api/app/runtime/effects/writes.py +34 -0
- autoclaw-0.1.0/apps/api/app/runtime/ids.py +108 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/__init__.py +15 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/context.py +52 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/criteria.py +48 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/manifest.py +224 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/projection.py +388 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/revisions.py +39 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/rows.py +290 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/bootstrap/workspace.py +62 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/persistence/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/persistence/attempts.py +239 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/persistence/flows.py +154 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/persistence/runtime.py +84 -0
- autoclaw-0.1.0/apps/api/app/runtime/launch/service.py +77 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/__init__.py +59 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/adapter.py +82 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/auth_resolution.py +56 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/auth_state.py +41 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/connection.py +251 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/contracts.py +143 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/discovery.py +237 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/fixtures.py +181 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/gateway_event_normalization.py +92 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/handshake.py +227 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/host_setup.py +435 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/preflight.py +25 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/protocol.py +323 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/request_builders.py +276 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/runtime_handle.py +318 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/session_keys.py +77 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/transport.py +63 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/wait_normalization.py +49 -0
- autoclaw-0.1.0/apps/api/app/runtime/openclaw/wrapper_contract.py +158 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/__init__.py +94 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/attempt_materialization.py +142 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/dispatch/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/dispatch/materialization.py +189 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/dispatch/prompt.py +201 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/checkpoint_handoff.py +125 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/context.py +178 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/current_context_queries.py +337 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/materialization.py +102 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/projection.py +233 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/structural_palette.py +180 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/manifest/tree.py +191 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/projection_mappers.py +129 -0
- autoclaw-0.1.0/apps/api/app/runtime/projection/runtime_state.py +343 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/__init__.py +19 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/asset_catalog.py +55 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/__init__.py +1 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/artifact_render_rule_v1.txt +11 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/autoclaw_parent_worker_split_v1.txt +22 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/autoclaw_provider_continuity_block_v1.txt +14 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/autoclaw_system_block_v1.txt +58 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/current_task_state_frame_v1.txt +12 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/monitoring_not_task_truth_v1.txt +4 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/parent_root_runtime_opening_example_v1.txt +20 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/retry_handover_rule_v1.txt +12 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/runtime_boundary_rule_block_v1.txt +12 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/runtime_legality_block_parent_v1.txt +29 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/runtime_legality_block_worker_v1.txt +25 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/runtime_read_order_rule_v1.txt +8 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/task_memory_rule_v1.txt +3 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/blocks/worker_runtime_opening_example_v1.txt +14 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/assets/catalog.json +75 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/bundle.py +215 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/instructions.py +98 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/sections/__init__.py +15 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/sections/context.py +190 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/sections/primitives.py +44 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/sections/rendering.py +259 -0
- autoclaw-0.1.0/apps/api/app/runtime/prompt/structural_edit_palette.py +43 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/__init__.py +11 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/adopt.py +287 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/defaults.py +164 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/edges.py +146 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/lineage.py +173 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/lookup.py +57 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/revision_state.py +117 -0
- autoclaw-0.1.0/apps/api/app/runtime/replan/service.py +253 -0
- autoclaw-0.1.0/apps/api/app/runtime/task_root/__init__.py +83 -0
- autoclaw-0.1.0/apps/api/app/runtime/task_root/localization.py +223 -0
- autoclaw-0.1.0/apps/api/app/runtime/task_root/paths.py +174 -0
- autoclaw-0.1.0/apps/api/app/runtime/task_root/reads.py +86 -0
- autoclaw-0.1.0/apps/api/app/runtime/task_root/writes.py +143 -0
- autoclaw-0.1.0/apps/api/app/runtime/watchdog/__init__.py +17 -0
- autoclaw-0.1.0/apps/api/app/runtime/watchdog/classification.py +358 -0
- autoclaw-0.1.0/apps/api/app/runtime/watchdog/manager.py +173 -0
- autoclaw-0.1.0/apps/api/app/runtime/watchdog/recovery.py +294 -0
- autoclaw-0.1.0/apps/api/app/runtime/watchdog/service.py +351 -0
- autoclaw-0.1.0/apps/api/app/schemas/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/schemas/definitions/__init__.py +77 -0
- autoclaw-0.1.0/apps/api/app/schemas/definitions/registry.py +268 -0
- autoclaw-0.1.0/apps/api/app/schemas/definitions/validation.py +309 -0
- autoclaw-0.1.0/apps/api/app/schemas/definitions/workflow.py +135 -0
- autoclaw-0.1.0/apps/api/app/schemas/health.py +8 -0
- autoclaw-0.1.0/apps/api/app/schemas/operation_failure.py +35 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/__init__.py +118 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/assignment.py +27 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/boundary.py +22 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/checkpoint.py +79 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/common.py +7 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/flow.py +90 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/observability.py +8 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/operator.py +135 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/parent_tools.py +302 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/refs.py +251 -0
- autoclaw-0.1.0/apps/api/app/schemas/runtime/start.py +25 -0
- autoclaw-0.1.0/apps/api/app/service_managers/__init__.py +21 -0
- autoclaw-0.1.0/apps/api/app/service_managers/base.py +74 -0
- autoclaw-0.1.0/apps/api/app/service_managers/factory.py +20 -0
- autoclaw-0.1.0/apps/api/app/service_managers/launchd.py +41 -0
- autoclaw-0.1.0/apps/api/app/service_managers/schtasks.py +41 -0
- autoclaw-0.1.0/apps/api/app/service_managers/systemd.py +195 -0
- autoclaw-0.1.0/apps/api/app/services/__init__.py +0 -0
- autoclaw-0.1.0/apps/api/app/terminal/__init__.py +3 -0
- autoclaw-0.1.0/apps/api/app/terminal/note.py +57 -0
- autoclaw-0.1.0/apps/api/app/terminal/output.py +5 -0
- autoclaw-0.1.0/apps/api/app/terminal/palette.py +14 -0
- autoclaw-0.1.0/apps/api/app/terminal/prompt_style.py +22 -0
- autoclaw-0.1.0/apps/api/app/terminal/prompts.py +99 -0
- autoclaw-0.1.0/apps/api/app/terminal/theme.py +63 -0
- autoclaw-0.1.0/apps/api/autoclaw/__init__.py +23 -0
- autoclaw-0.1.0/apps/api/autoclaw/__main__.py +5 -0
- autoclaw-0.1.0/apps/api/autoclaw/cli.py +9 -0
- autoclaw-0.1.0/apps/api/autoclaw/main.py +5 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/__init__.py +21 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/bindings.py +59 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/common.py +120 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/mcp_operation_failures.py +114 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_mcp/__init__.py +13 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_mcp/contracts.py +345 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_mcp/definition_tools.py +117 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_mcp/runtime_tools.py +207 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_mcp/server.py +121 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/node_server.py +13 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/__init__.py +11 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/auth.py +35 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/definition_tools.py +187 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/observability_tools.py +68 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/runtime_tools.py +255 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_mcp/server.py +102 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/operator_server.py +11 -0
- autoclaw-0.1.0/apps/api/autoclaw/openclaw/tool_teaching.py +122 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/PKG-INFO +64 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/SOURCES.txt +306 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/dependency_links.txt +1 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/entry_points.txt +2 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/requires.txt +23 -0
- autoclaw-0.1.0/apps/api/autoclaw.egg-info/top_level.txt +2 -0
- autoclaw-0.1.0/pyproject.toml +87 -0
- autoclaw-0.1.0/setup.cfg +4 -0
autoclaw-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autoclaw
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AutoClaw local-first workflow control plane
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: fastapi<1.0.0,>=0.115.12
|
|
8
|
+
Requires-Dist: uvicorn[standard]<1.0.0,>=0.34.0
|
|
9
|
+
Requires-Dist: sqlalchemy<3.0.0,>=2.0.40
|
|
10
|
+
Requires-Dist: pydantic<3.0.0,>=2.11.3
|
|
11
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.8.1
|
|
12
|
+
Requires-Dist: mcp<2.0.0,>=1.27.1
|
|
13
|
+
Requires-Dist: python-dotenv<2.0.0,>=1.1.0
|
|
14
|
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
15
|
+
Requires-Dist: platformdirs<5.0.0,>=4.3.7
|
|
16
|
+
Requires-Dist: aiosqlite<1.0.0,>=0.21.0
|
|
17
|
+
Provides-Extra: postgres
|
|
18
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "postgres"
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest<9.0.0,>=8.3.5; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-asyncio<1.0.0,>=0.26.0; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-cov<7.0.0,>=6.1.1; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff<1.0.0,>=0.11.5; extra == "dev"
|
|
24
|
+
Requires-Dist: mypy<2.0.0,>=1.15.0; extra == "dev"
|
|
25
|
+
Requires-Dist: PyYAML<7.0.0,>=6.0.2; extra == "dev"
|
|
26
|
+
Requires-Dist: types-PyYAML<7.0.0,>=6.0.12.20250326; extra == "dev"
|
|
27
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "dev"
|
|
28
|
+
|
|
29
|
+
# AutoClaw
|
|
30
|
+
|
|
31
|
+
Last verified: 2026-05-07
|
|
32
|
+
|
|
33
|
+
AutoClaw is a controlled agent runtime for multi-step work that must stay auditable, replayable, and operationally recoverable.
|
|
34
|
+
|
|
35
|
+
This root README is a front-door router only. Canonical implementation, redesign, and execution truth lives under `docs/`.
|
|
36
|
+
|
|
37
|
+
## Start here
|
|
38
|
+
|
|
39
|
+
- Current shipped behavior: [docs/current/README.md](docs/current/README.md)
|
|
40
|
+
- Target redesign contract: [docs/redesign/README.md](docs/redesign/README.md)
|
|
41
|
+
- Redesign landing and phase execution: [docs/execution/README.md](docs/execution/README.md)
|
|
42
|
+
- Docs map and reading guide: [docs/README.md](docs/README.md)
|
|
43
|
+
- Coding-agent policy: [AGENTS.md](AGENTS.md)
|
|
44
|
+
- Coding standards: [STYLE.md](STYLE.md)
|
|
45
|
+
|
|
46
|
+
## Repo shape
|
|
47
|
+
|
|
48
|
+
- `apps/api/` - backend API, runtime, DB, CLI, and tests
|
|
49
|
+
- `definitions/` - workflow and definition content used by owning phases
|
|
50
|
+
- `docs/` - current behavior, redesign contract, and execution canon
|
|
51
|
+
- `scripts/` - repo tooling, including docs validation under `scripts/docs/`
|
|
52
|
+
- `examples/` - example workflows and supporting artifacts
|
|
53
|
+
|
|
54
|
+
## Common verification lanes
|
|
55
|
+
|
|
56
|
+
- Local backend suite: `./.venv/bin/pytest -q apps/api/tests`
|
|
57
|
+
- Docker/Postgres verification: `make test-api-db`
|
|
58
|
+
- Docs freeze validation: `./.venv/bin/python scripts/docs/docs_freeze_validate.py`
|
|
59
|
+
|
|
60
|
+
## Surface rule
|
|
61
|
+
|
|
62
|
+
Use this page for fast routing only.
|
|
63
|
+
|
|
64
|
+
Do not treat it as the authoritative source for detailed runtime behavior, redesign contracts, or phase-closeout status.
|
autoclaw-0.1.0/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# AutoClaw
|
|
2
|
+
|
|
3
|
+
Last verified: 2026-05-07
|
|
4
|
+
|
|
5
|
+
AutoClaw is a controlled agent runtime for multi-step work that must stay auditable, replayable, and operationally recoverable.
|
|
6
|
+
|
|
7
|
+
This root README is a front-door router only. Canonical implementation, redesign, and execution truth lives under `docs/`.
|
|
8
|
+
|
|
9
|
+
## Start here
|
|
10
|
+
|
|
11
|
+
- Current shipped behavior: [docs/current/README.md](docs/current/README.md)
|
|
12
|
+
- Target redesign contract: [docs/redesign/README.md](docs/redesign/README.md)
|
|
13
|
+
- Redesign landing and phase execution: [docs/execution/README.md](docs/execution/README.md)
|
|
14
|
+
- Docs map and reading guide: [docs/README.md](docs/README.md)
|
|
15
|
+
- Coding-agent policy: [AGENTS.md](AGENTS.md)
|
|
16
|
+
- Coding standards: [STYLE.md](STYLE.md)
|
|
17
|
+
|
|
18
|
+
## Repo shape
|
|
19
|
+
|
|
20
|
+
- `apps/api/` - backend API, runtime, DB, CLI, and tests
|
|
21
|
+
- `definitions/` - workflow and definition content used by owning phases
|
|
22
|
+
- `docs/` - current behavior, redesign contract, and execution canon
|
|
23
|
+
- `scripts/` - repo tooling, including docs validation under `scripts/docs/`
|
|
24
|
+
- `examples/` - example workflows and supporting artifacts
|
|
25
|
+
|
|
26
|
+
## Common verification lanes
|
|
27
|
+
|
|
28
|
+
- Local backend suite: `./.venv/bin/pytest -q apps/api/tests`
|
|
29
|
+
- Docker/Postgres verification: `make test-api-db`
|
|
30
|
+
- Docs freeze validation: `./.venv/bin/python scripts/docs/docs_freeze_validate.py`
|
|
31
|
+
|
|
32
|
+
## Surface rule
|
|
33
|
+
|
|
34
|
+
Use this page for fast routing only.
|
|
35
|
+
|
|
36
|
+
Do not treat it as the authoritative source for detailed runtime behavior, redesign contracts, or phase-closeout status.
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import Header, status
|
|
6
|
+
|
|
7
|
+
from app.api.errors import raise_operation_failure
|
|
8
|
+
from app.config import get_settings
|
|
9
|
+
from app.schemas.operation_failure import OperationFailureCode
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _require_exact_api_key(
|
|
13
|
+
*,
|
|
14
|
+
provided_key: str | None,
|
|
15
|
+
expected_key: str,
|
|
16
|
+
) -> None:
|
|
17
|
+
if provided_key != expected_key:
|
|
18
|
+
raise_operation_failure(
|
|
19
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
20
|
+
code=OperationFailureCode.ILLEGAL_CALLER,
|
|
21
|
+
summary="missing or invalid API key",
|
|
22
|
+
retryable=False,
|
|
23
|
+
suggested_next_step="Provide the configured X-AutoClaw-API-Key header.",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def require_api_key(
|
|
28
|
+
api_key: Annotated[str | None, Header(alias="X-AutoClaw-API-Key")] = None,
|
|
29
|
+
) -> None:
|
|
30
|
+
_require_exact_api_key(provided_key=api_key, expected_key=get_settings().api_key)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def require_internal_api_key(
|
|
34
|
+
api_key: Annotated[str | None, Header(alias="X-AutoClaw-API-Key")] = None,
|
|
35
|
+
) -> None:
|
|
36
|
+
_require_exact_api_key(provided_key=api_key, expected_key=get_settings().internal_api_key)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import NoReturn
|
|
4
|
+
|
|
5
|
+
from fastapi import HTTPException
|
|
6
|
+
from fastapi.exceptions import RequestValidationError
|
|
7
|
+
|
|
8
|
+
import app.api.runtime_exception_mapping as runtime_exception_mapping
|
|
9
|
+
from app.schemas.operation_failure import OperationFailure, OperationFailureCode
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def operation_failure(
|
|
13
|
+
*,
|
|
14
|
+
code: OperationFailureCode,
|
|
15
|
+
summary: str,
|
|
16
|
+
retryable: bool,
|
|
17
|
+
field_path: str | None = None,
|
|
18
|
+
suggested_next_step: str | None = None,
|
|
19
|
+
) -> OperationFailure:
|
|
20
|
+
return OperationFailure(
|
|
21
|
+
code=code,
|
|
22
|
+
summary=summary,
|
|
23
|
+
retryable=retryable,
|
|
24
|
+
field_path=field_path,
|
|
25
|
+
suggested_next_step=suggested_next_step,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def raise_operation_failure(
|
|
30
|
+
*,
|
|
31
|
+
status_code: int,
|
|
32
|
+
code: OperationFailureCode,
|
|
33
|
+
summary: str,
|
|
34
|
+
retryable: bool,
|
|
35
|
+
field_path: str | None = None,
|
|
36
|
+
suggested_next_step: str | None = None,
|
|
37
|
+
) -> NoReturn:
|
|
38
|
+
raise HTTPException(
|
|
39
|
+
status_code=status_code,
|
|
40
|
+
detail=operation_failure(
|
|
41
|
+
code=code,
|
|
42
|
+
summary=summary,
|
|
43
|
+
retryable=retryable,
|
|
44
|
+
field_path=field_path,
|
|
45
|
+
suggested_next_step=suggested_next_step,
|
|
46
|
+
).model_dump(mode="json"),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def request_validation_failure(exc: RequestValidationError) -> OperationFailure:
|
|
51
|
+
first_error = exc.errors()[0] if exc.errors() else {}
|
|
52
|
+
loc = first_error.get("loc", ())
|
|
53
|
+
field_path = ".".join(str(part) for part in loc if part != "body") or None
|
|
54
|
+
return operation_failure(
|
|
55
|
+
code=OperationFailureCode.INVALID_REQUEST_SHAPE,
|
|
56
|
+
summary="request shape does not match the canonical runtime surface",
|
|
57
|
+
retryable=False,
|
|
58
|
+
field_path=field_path,
|
|
59
|
+
suggested_next_step=(
|
|
60
|
+
"Reread the canonical request shape and resend the request with only the live "
|
|
61
|
+
"required fields."
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def runtime_exception_failure(exc: Exception) -> tuple[int, OperationFailure]:
|
|
67
|
+
return runtime_exception_mapping.runtime_exception_failure(exc)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def raise_runtime_exception(exc: Exception) -> NoReturn:
|
|
71
|
+
runtime_exception_mapping.raise_runtime_exception(exc)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from fastapi import APIRouter
|
|
2
|
+
|
|
3
|
+
from app.api.routes.callback import router as callback_router
|
|
4
|
+
from app.api.routes.definitions import router as definitions_router
|
|
5
|
+
from app.api.routes.health import router as health_router
|
|
6
|
+
from app.api.routes.observability import router as observability_router
|
|
7
|
+
from app.api.routes.operator import router as operator_router
|
|
8
|
+
from app.api.routes.runtime import router as runtime_router
|
|
9
|
+
from app.api.routes.tasks import router as tasks_router
|
|
10
|
+
|
|
11
|
+
api_router = APIRouter()
|
|
12
|
+
api_router.include_router(health_router)
|
|
13
|
+
api_router.include_router(definitions_router)
|
|
14
|
+
api_router.include_router(tasks_router)
|
|
15
|
+
api_router.include_router(runtime_router)
|
|
16
|
+
api_router.include_router(operator_router)
|
|
17
|
+
api_router.include_router(callback_router)
|
|
18
|
+
api_router.include_router(observability_router)
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter, Depends, Query
|
|
6
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
7
|
+
|
|
8
|
+
from app.api.errors import raise_runtime_exception
|
|
9
|
+
from app.db.session import get_db_session
|
|
10
|
+
from app.runtime.contracts import ParentRootToolName
|
|
11
|
+
from app.runtime.control.failures import invalid_request_shape_error
|
|
12
|
+
from app.runtime.control.node_operations import (
|
|
13
|
+
BoundaryNodeOperation,
|
|
14
|
+
CheckpointNodeOperation,
|
|
15
|
+
ParentToolNodeOperation,
|
|
16
|
+
execute_node_operation,
|
|
17
|
+
)
|
|
18
|
+
from app.schemas.runtime import (
|
|
19
|
+
BoundaryRead,
|
|
20
|
+
BoundaryWrite,
|
|
21
|
+
CheckpointRead,
|
|
22
|
+
CheckpointWrite,
|
|
23
|
+
ParentToolCall,
|
|
24
|
+
ParentToolSuccess,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
router = APIRouter(prefix="/callback", tags=["callback"])
|
|
28
|
+
DBSession = Annotated[AsyncSession, Depends(get_db_session)]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _require_callback_session_key(session_key: str | None) -> str:
|
|
32
|
+
if session_key is None:
|
|
33
|
+
raise invalid_request_shape_error("callback session_key is required")
|
|
34
|
+
return session_key
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@router.post("/tasks/{task_id}/checkpoint", response_model=CheckpointRead)
|
|
38
|
+
async def post_checkpoint(
|
|
39
|
+
task_id: str,
|
|
40
|
+
payload: CheckpointWrite,
|
|
41
|
+
session: DBSession,
|
|
42
|
+
session_key: str | None = Query(default=None),
|
|
43
|
+
) -> CheckpointRead:
|
|
44
|
+
try:
|
|
45
|
+
return await execute_node_operation(
|
|
46
|
+
session,
|
|
47
|
+
task_id=task_id,
|
|
48
|
+
session_key=_require_callback_session_key(session_key),
|
|
49
|
+
operation=CheckpointNodeOperation(payload=payload),
|
|
50
|
+
invalid_summary="invalid callback session key",
|
|
51
|
+
stale_summary="stale callback session key",
|
|
52
|
+
inactive_summary="inactive callback session key",
|
|
53
|
+
)
|
|
54
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
55
|
+
raise_runtime_exception(exc)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@router.post("/tasks/{task_id}/boundary", response_model=BoundaryRead)
|
|
59
|
+
async def post_boundary(
|
|
60
|
+
task_id: str,
|
|
61
|
+
payload: BoundaryWrite,
|
|
62
|
+
session: DBSession,
|
|
63
|
+
session_key: str | None = Query(default=None),
|
|
64
|
+
) -> BoundaryRead:
|
|
65
|
+
try:
|
|
66
|
+
return await execute_node_operation(
|
|
67
|
+
session,
|
|
68
|
+
task_id=task_id,
|
|
69
|
+
session_key=_require_callback_session_key(session_key),
|
|
70
|
+
operation=BoundaryNodeOperation(payload=payload),
|
|
71
|
+
invalid_summary="invalid callback session key",
|
|
72
|
+
stale_summary="stale callback session key",
|
|
73
|
+
inactive_summary="inactive callback session key",
|
|
74
|
+
)
|
|
75
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
76
|
+
raise_runtime_exception(exc)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@router.post("/tasks/{task_id}/tools/{tool_name}", response_model=ParentToolSuccess)
|
|
80
|
+
async def post_tool(
|
|
81
|
+
task_id: str,
|
|
82
|
+
tool_name: ParentRootToolName,
|
|
83
|
+
payload: ParentToolCall,
|
|
84
|
+
session: DBSession,
|
|
85
|
+
session_key: str | None = Query(default=None),
|
|
86
|
+
) -> ParentToolSuccess:
|
|
87
|
+
try:
|
|
88
|
+
return await execute_node_operation(
|
|
89
|
+
session,
|
|
90
|
+
task_id=task_id,
|
|
91
|
+
session_key=_require_callback_session_key(session_key),
|
|
92
|
+
operation=ParentToolNodeOperation(tool_name=tool_name, payload=payload),
|
|
93
|
+
invalid_summary="invalid callback session key",
|
|
94
|
+
stale_summary="stale callback session key",
|
|
95
|
+
inactive_summary="inactive callback session key",
|
|
96
|
+
)
|
|
97
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
98
|
+
raise_runtime_exception(exc)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter, Depends, Query, Response, status
|
|
6
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
7
|
+
|
|
8
|
+
from app.api.deps import require_api_key
|
|
9
|
+
from app.api.errors import raise_runtime_exception
|
|
10
|
+
from app.db.session import get_db_session
|
|
11
|
+
from app.registry.definition_catalog import (
|
|
12
|
+
get_definition_detail,
|
|
13
|
+
list_policy_definitions,
|
|
14
|
+
list_role_definitions,
|
|
15
|
+
list_workflow_definitions,
|
|
16
|
+
upload_definition,
|
|
17
|
+
)
|
|
18
|
+
from app.registry.definition_history import get_definition_history
|
|
19
|
+
from app.schemas.definitions import (
|
|
20
|
+
DefinitionKind,
|
|
21
|
+
DefinitionListQuery,
|
|
22
|
+
DefinitionRevisionDetailResponse,
|
|
23
|
+
DefinitionRevisionHistoryQuery,
|
|
24
|
+
DefinitionRevisionHistoryResponse,
|
|
25
|
+
DefinitionSummaryListResponse,
|
|
26
|
+
DefinitionUploadRequest,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
router = APIRouter(
|
|
30
|
+
prefix="/definitions",
|
|
31
|
+
tags=["definitions"],
|
|
32
|
+
dependencies=[Depends(require_api_key)],
|
|
33
|
+
)
|
|
34
|
+
type DBSession = Annotated[AsyncSession, Depends(get_db_session)]
|
|
35
|
+
type DefinitionListParams = Annotated[DefinitionListQuery, Query()]
|
|
36
|
+
type DefinitionHistoryParams = Annotated[DefinitionRevisionHistoryQuery, Query()]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@router.get("/roles", response_model=DefinitionSummaryListResponse)
|
|
40
|
+
async def get_role_definitions(
|
|
41
|
+
session: DBSession,
|
|
42
|
+
query: DefinitionListParams,
|
|
43
|
+
) -> DefinitionSummaryListResponse:
|
|
44
|
+
try:
|
|
45
|
+
return await list_role_definitions(session, query)
|
|
46
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
47
|
+
raise_runtime_exception(exc)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@router.get("/policies", response_model=DefinitionSummaryListResponse)
|
|
51
|
+
async def get_policy_definitions(
|
|
52
|
+
session: DBSession,
|
|
53
|
+
query: DefinitionListParams,
|
|
54
|
+
) -> DefinitionSummaryListResponse:
|
|
55
|
+
try:
|
|
56
|
+
return await list_policy_definitions(session, query)
|
|
57
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
58
|
+
raise_runtime_exception(exc)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@router.get("/workflows", response_model=DefinitionSummaryListResponse)
|
|
62
|
+
async def get_workflow_definitions(
|
|
63
|
+
session: DBSession,
|
|
64
|
+
query: DefinitionListParams,
|
|
65
|
+
) -> DefinitionSummaryListResponse:
|
|
66
|
+
try:
|
|
67
|
+
return await list_workflow_definitions(session, query)
|
|
68
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
69
|
+
raise_runtime_exception(exc)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@router.get("/{kind}/{key}", response_model=DefinitionRevisionDetailResponse)
|
|
73
|
+
async def get_definition(
|
|
74
|
+
kind: DefinitionKind,
|
|
75
|
+
key: str,
|
|
76
|
+
session: DBSession,
|
|
77
|
+
) -> DefinitionRevisionDetailResponse:
|
|
78
|
+
try:
|
|
79
|
+
return await get_definition_detail(session, kind, key)
|
|
80
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
81
|
+
raise_runtime_exception(exc)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@router.get("/{kind}/{key}/versions", response_model=DefinitionRevisionHistoryResponse)
|
|
85
|
+
async def get_definition_versions(
|
|
86
|
+
kind: DefinitionKind,
|
|
87
|
+
key: str,
|
|
88
|
+
session: DBSession,
|
|
89
|
+
query: DefinitionHistoryParams,
|
|
90
|
+
) -> DefinitionRevisionHistoryResponse:
|
|
91
|
+
try:
|
|
92
|
+
return await get_definition_history(session, kind, key, query)
|
|
93
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
94
|
+
raise_runtime_exception(exc)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@router.post("", response_model=DefinitionRevisionDetailResponse)
|
|
98
|
+
async def post_definition(
|
|
99
|
+
request: DefinitionUploadRequest,
|
|
100
|
+
response: Response,
|
|
101
|
+
session: DBSession,
|
|
102
|
+
) -> DefinitionRevisionDetailResponse:
|
|
103
|
+
try:
|
|
104
|
+
result = await upload_definition(session, request)
|
|
105
|
+
await session.commit()
|
|
106
|
+
response.status_code = status.HTTP_201_CREATED if result.created else status.HTTP_200_OK
|
|
107
|
+
return result.detail
|
|
108
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
109
|
+
await session.rollback()
|
|
110
|
+
raise_runtime_exception(exc)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from fastapi import APIRouter, HTTPException, status
|
|
2
|
+
|
|
3
|
+
from app.db.session import ping_database
|
|
4
|
+
from app.schemas.health import HealthResponse
|
|
5
|
+
|
|
6
|
+
router = APIRouter(tags=["health"])
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@router.get("/healthz", response_model=HealthResponse, status_code=status.HTTP_200_OK)
|
|
10
|
+
async def healthz() -> HealthResponse:
|
|
11
|
+
return HealthResponse(status="ok", service="autoclaw-api")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@router.get("/readyz", response_model=HealthResponse, status_code=status.HTTP_200_OK)
|
|
15
|
+
async def readyz() -> HealthResponse:
|
|
16
|
+
try:
|
|
17
|
+
await ping_database()
|
|
18
|
+
except Exception as exc: # pragma: no cover - readiness degrades without DB
|
|
19
|
+
raise HTTPException(
|
|
20
|
+
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
|
21
|
+
detail="database_unavailable",
|
|
22
|
+
) from exc
|
|
23
|
+
|
|
24
|
+
return HealthResponse(status="ready", service="autoclaw-api")
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter, Depends
|
|
6
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
7
|
+
|
|
8
|
+
from app.api.deps import require_api_key
|
|
9
|
+
from app.api.errors import raise_runtime_exception
|
|
10
|
+
from app.db.session import get_db_session
|
|
11
|
+
from app.runtime.control.observability import observability_ref
|
|
12
|
+
from app.schemas.runtime import ObservabilityFileRef
|
|
13
|
+
|
|
14
|
+
router = APIRouter(
|
|
15
|
+
prefix="/observability",
|
|
16
|
+
tags=["observability"],
|
|
17
|
+
dependencies=[Depends(require_api_key)],
|
|
18
|
+
)
|
|
19
|
+
DBSession = Annotated[AsyncSession, Depends(get_db_session)]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@router.get("/tasks/{task_id}/delivery-state", response_model=ObservabilityFileRef)
|
|
23
|
+
async def get_delivery_state(
|
|
24
|
+
task_id: str,
|
|
25
|
+
session: DBSession,
|
|
26
|
+
) -> ObservabilityFileRef:
|
|
27
|
+
try:
|
|
28
|
+
return await observability_ref(
|
|
29
|
+
session,
|
|
30
|
+
task_id,
|
|
31
|
+
"delivery-state.json",
|
|
32
|
+
"Latest task-scoped delivery-state projection.",
|
|
33
|
+
)
|
|
34
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
35
|
+
raise_runtime_exception(exc)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@router.get("/tasks/{task_id}/continuity-state", response_model=ObservabilityFileRef)
|
|
39
|
+
async def get_continuity_state(
|
|
40
|
+
task_id: str,
|
|
41
|
+
session: DBSession,
|
|
42
|
+
) -> ObservabilityFileRef:
|
|
43
|
+
try:
|
|
44
|
+
return await observability_ref(
|
|
45
|
+
session,
|
|
46
|
+
task_id,
|
|
47
|
+
"continuity-state.json",
|
|
48
|
+
"Latest task-scoped continuity-state projection.",
|
|
49
|
+
)
|
|
50
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
51
|
+
raise_runtime_exception(exc)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@router.get("/tasks/{task_id}/watchdog-state", response_model=ObservabilityFileRef)
|
|
55
|
+
async def get_watchdog_state(
|
|
56
|
+
task_id: str,
|
|
57
|
+
session: DBSession,
|
|
58
|
+
) -> ObservabilityFileRef:
|
|
59
|
+
try:
|
|
60
|
+
return await observability_ref(
|
|
61
|
+
session,
|
|
62
|
+
task_id,
|
|
63
|
+
"watchdog-state.json",
|
|
64
|
+
"Latest task-scoped watchdog-state projection.",
|
|
65
|
+
)
|
|
66
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
67
|
+
raise_runtime_exception(exc)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@router.get("/tasks/{task_id}/provider-events", response_model=ObservabilityFileRef)
|
|
71
|
+
async def get_provider_events(
|
|
72
|
+
task_id: str,
|
|
73
|
+
session: DBSession,
|
|
74
|
+
) -> ObservabilityFileRef:
|
|
75
|
+
try:
|
|
76
|
+
return await observability_ref(
|
|
77
|
+
session,
|
|
78
|
+
task_id,
|
|
79
|
+
"provider-events.ndjson",
|
|
80
|
+
"Normalized provider-event history for the selected task.",
|
|
81
|
+
)
|
|
82
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
83
|
+
raise_runtime_exception(exc)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter, Depends, Query
|
|
6
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
7
|
+
|
|
8
|
+
from app.api.deps import require_api_key
|
|
9
|
+
from app.api.errors import raise_runtime_exception
|
|
10
|
+
from app.db.session import get_db_session
|
|
11
|
+
from app.runtime.control.observability import operator_snapshot, operator_trace
|
|
12
|
+
from app.schemas.runtime import (
|
|
13
|
+
OperatorFlowSnapshotResponse,
|
|
14
|
+
OperatorFlowTraceQuery,
|
|
15
|
+
OperatorFlowTraceResponse,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
router = APIRouter(prefix="/operator", tags=["operator"], dependencies=[Depends(require_api_key)])
|
|
19
|
+
type DBSession = Annotated[AsyncSession, Depends(get_db_session)]
|
|
20
|
+
type OperatorTraceParams = Annotated[OperatorFlowTraceQuery, Query()]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@router.get("/tasks/{task_id}/snapshot", response_model=OperatorFlowSnapshotResponse)
|
|
24
|
+
async def get_operator_snapshot(
|
|
25
|
+
task_id: str,
|
|
26
|
+
session: DBSession,
|
|
27
|
+
) -> OperatorFlowSnapshotResponse:
|
|
28
|
+
try:
|
|
29
|
+
return await operator_snapshot(session, task_id)
|
|
30
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
31
|
+
raise_runtime_exception(exc)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@router.get("/tasks/{task_id}/trace", response_model=OperatorFlowTraceResponse)
|
|
35
|
+
async def get_operator_trace(
|
|
36
|
+
task_id: str,
|
|
37
|
+
session: DBSession,
|
|
38
|
+
query: OperatorTraceParams,
|
|
39
|
+
) -> OperatorFlowTraceResponse:
|
|
40
|
+
try:
|
|
41
|
+
return await operator_trace(
|
|
42
|
+
session,
|
|
43
|
+
task_id,
|
|
44
|
+
scope=query.scope,
|
|
45
|
+
q=query.q,
|
|
46
|
+
cursor=query.cursor,
|
|
47
|
+
limit=query.limit,
|
|
48
|
+
sort=query.sort,
|
|
49
|
+
)
|
|
50
|
+
except Exception as exc: # pragma: no cover - thin HTTP wrapper
|
|
51
|
+
raise_runtime_exception(exc)
|