create-windy 0.6.12 → 0.6.15
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.
- package/dist/cli.js +785 -291
- package/package.json +1 -1
- package/template/.agents/skills/windy-business-module/SKILL.md +148 -70
- package/template/.windy-template.json +3 -3
- package/template/AGENTS.md +3 -6
- package/template/apps/agent-server/Dockerfile +2 -3
- package/template/apps/agent-server/README.md +38 -54
- package/template/apps/agent-server/pyproject.toml +0 -1
- package/template/apps/agent-server/src/southwind_agent_server/app.py +4 -2
- package/template/apps/agent-server/src/southwind_agent_server/attempt_context.py +191 -0
- package/template/apps/agent-server/src/southwind_agent_server/attempt_context_projection.py +203 -0
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_contracts.py +61 -0
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_governance.py +82 -0
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_routes.py +121 -0
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_runtime.py +158 -0
- package/template/apps/agent-server/src/southwind_agent_server/context_message_digest.py +24 -0
- package/template/apps/agent-server/src/southwind_agent_server/context_version_contracts.py +71 -0
- package/template/apps/agent-server/src/southwind_agent_server/context_version_port.py +307 -0
- package/template/apps/agent-server/src/southwind_agent_server/contracts.py +39 -0
- package/template/apps/agent-server/src/southwind_agent_server/deterministic.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/engine.py +9 -1
- package/template/apps/agent-server/src/southwind_agent_server/engine_identity.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/fingerprint.py +15 -0
- package/template/apps/agent-server/src/southwind_agent_server/health_routes.py +37 -3
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +46 -26
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine_validation.py +32 -0
- package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +7 -0
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_insert.py +5 -2
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_queries.py +1 -0
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_store.py +6 -1
- package/template/apps/agent-server/src/southwind_agent_server/postgres_store.py +3 -2
- package/template/apps/agent-server/src/southwind_agent_server/postgres_store_backend.py +1 -0
- package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +21 -0
- package/template/apps/agent-server/src/southwind_agent_server/report_lifecycle.py +2 -1
- package/template/apps/agent-server/src/southwind_agent_server/report_presenter.py +1 -0
- package/template/apps/agent-server/src/southwind_agent_server/report_routes.py +7 -1
- package/template/apps/agent-server/src/southwind_agent_server/report_store.py +10 -56
- package/template/apps/agent-server/src/southwind_agent_server/report_store_protocol.py +75 -0
- package/template/apps/agent-server/src/southwind_agent_server/report_types.py +9 -2
- package/template/apps/agent-server/src/southwind_agent_server/runtime_budget.py +74 -0
- package/template/apps/agent-server/src/southwind_agent_server/runtime_factory.py +11 -3
- package/template/apps/agent-server/src/southwind_agent_server/service.py +41 -65
- package/template/apps/agent-server/src/southwind_agent_server/service_control.py +64 -0
- package/template/apps/agent-server/src/southwind_agent_server/service_execution.py +3 -0
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_errors.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_schema.py +9 -1
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_store.py +6 -5
- package/template/apps/agent-server/src/southwind_agent_server/store.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/trajectory.py +137 -0
- package/template/apps/agent-server/src/southwind_agent_server/unavailable_engine.py +58 -0
- package/template/apps/agent-server/tests/test_api.py +30 -11
- package/template/apps/agent-server/tests/test_client_completion.py +230 -0
- package/template/apps/agent-server/tests/test_provider_attempt_reporting.py +12 -24
- package/template/apps/agent-server/tests/test_report_resilience.py +2 -0
- package/template/apps/agent-server/tests/test_report_routes.py +58 -1
- package/template/apps/agent-server/tests/test_report_summary_parity.py +1 -0
- package/template/apps/agent-server/tests/test_run_capacity.py +2 -0
- package/template/apps/agent-server/tests/test_runtime_factory_readiness.py +18 -3
- package/template/apps/agent-server/tests/test_trajectory.py +91 -0
- package/template/apps/agent-server/uv.lock +0 -259
- package/template/apps/server/Dockerfile +9 -4
- package/template/apps/server/src/agent/actor-projection-audit.ts +6 -0
- package/template/apps/server/src/agent/agent-run-delegation-policy.ts +115 -0
- package/template/apps/server/src/agent/agent-session-bootstrap.ts +23 -0
- package/template/apps/server/src/agent/{debug-session-facade-provider-failure.test.ts → agent-session-facade-provider-failure.test.ts} +24 -33
- package/template/apps/server/src/agent/{debug-session-facade.test.ts → agent-session-facade.test.ts} +34 -45
- package/template/apps/server/src/agent/{debug-session-facade.ts → agent-session-facade.ts} +50 -57
- package/template/apps/server/src/agent/{debug-session-id.test.ts → agent-session-id.test.ts} +5 -5
- package/template/apps/server/src/agent/{debug-session-id.ts → agent-session-id.ts} +7 -7
- package/template/apps/server/src/agent/{debug-session-provider-reader.ts → agent-session-provider-reader.ts} +18 -15
- package/template/apps/server/src/agent/{debug-session-routes.test.ts → agent-session-routes.test.ts} +16 -16
- package/template/apps/server/src/agent/{debug-session-routes.ts → agent-session-routes.ts} +12 -12
- package/template/apps/server/src/agent/{debug-session-validation.ts → agent-session-validation.ts} +13 -11
- package/template/apps/server/src/agent/client-session/attempt-authority.test.ts +162 -0
- package/template/apps/server/src/agent/client-session/attempt-authority.ts +191 -0
- package/template/apps/server/src/agent/client-session/authorization.ts +47 -0
- package/template/apps/server/src/agent/client-session/bootstrap.ts +112 -0
- package/template/apps/server/src/agent/client-session/capabilities.ts +19 -0
- package/template/apps/server/src/agent/client-session/completion.ts +350 -0
- package/template/apps/server/src/agent/client-session/contracts.ts +159 -0
- package/template/apps/server/src/agent/client-session/creation.ts +103 -0
- package/template/apps/server/src/agent/client-session/digest.ts +49 -0
- package/template/apps/server/src/agent/client-session/drizzle-records.ts +150 -0
- package/template/apps/server/src/agent/client-session/drizzle-repository.integration.test.ts +197 -0
- package/template/apps/server/src/agent/client-session/drizzle-repository.ts +236 -0
- package/template/apps/server/src/agent/client-session/errors.ts +28 -0
- package/template/apps/server/src/agent/client-session/finalization.ts +99 -0
- package/template/apps/server/src/agent/client-session/fixtures/page-agent-1.12.2-request.json +52 -0
- package/template/apps/server/src/agent/client-session/host-auth.test.ts +144 -0
- package/template/apps/server/src/agent/client-session/host-auth.ts +122 -0
- package/template/apps/server/src/agent/client-session/host-revocation-composition.test.ts +77 -0
- package/template/apps/server/src/agent/client-session/host-revocation-composition.ts +28 -0
- package/template/apps/server/src/agent/client-session/launch-authority.contract.test.ts +21 -0
- package/template/apps/server/src/agent/client-session/manifest-admission.ts +251 -0
- package/template/apps/server/src/agent/client-session/openai-stream.ts +123 -0
- package/template/apps/server/src/agent/client-session/presentation.ts +46 -0
- package/template/apps/server/src/agent/client-session/remote-provider.test.ts +144 -0
- package/template/apps/server/src/agent/client-session/remote-provider.ts +216 -0
- package/template/apps/server/src/agent/client-session/repository.ts +225 -0
- package/template/apps/server/src/agent/client-session/request.test.ts +69 -0
- package/template/apps/server/src/agent/client-session/request.ts +289 -0
- package/template/apps/server/src/agent/client-session/revocation.ts +23 -0
- package/template/apps/server/src/agent/client-session/routes.ts +315 -0
- package/template/apps/server/src/agent/client-session/runtime-audit.ts +42 -0
- package/template/apps/server/src/agent/client-session/service.test-support.ts +248 -0
- package/template/apps/server/src/agent/client-session/service.test.ts +268 -0
- package/template/apps/server/src/agent/client-session/service.ts +316 -0
- package/template/apps/server/src/agent/client-session/terminal-digest.test.ts +23 -0
- package/template/apps/server/src/agent/client-workflow-artifact/active-blob-references.ts +8 -0
- package/template/apps/server/src/agent/client-workflow-artifact/artifact-builder.ts +60 -0
- package/template/apps/server/src/agent/client-workflow-artifact/authority-current.ts +59 -0
- package/template/apps/server/src/agent/client-workflow-artifact/binding-registry.test.ts +189 -0
- package/template/apps/server/src/agent/client-workflow-artifact/binding-registry.ts +153 -0
- package/template/apps/server/src/agent/client-workflow-artifact/bootstrap.ts +77 -0
- package/template/apps/server/src/agent/client-workflow-artifact/cancellation.ts +47 -0
- package/template/apps/server/src/agent/client-workflow-artifact/completed-recovery.ts +31 -0
- package/template/apps/server/src/agent/client-workflow-artifact/contracts.ts +104 -0
- package/template/apps/server/src/agent/client-workflow-artifact/drizzle-locks.ts +30 -0
- package/template/apps/server/src/agent/client-workflow-artifact/drizzle-mapper.ts +138 -0
- package/template/apps/server/src/agent/client-workflow-artifact/drizzle-repository.ts +346 -0
- package/template/apps/server/src/agent/client-workflow-artifact/error.ts +21 -0
- package/template/apps/server/src/agent/client-workflow-artifact/handler.ts +167 -0
- package/template/apps/server/src/agent/client-workflow-artifact/host-revocation.ts +29 -0
- package/template/apps/server/src/agent/client-workflow-artifact/in-memory-repository.ts +232 -0
- package/template/apps/server/src/agent/client-workflow-artifact/job-port.ts +101 -0
- package/template/apps/server/src/agent/client-workflow-artifact/presentation.ts +41 -0
- package/template/apps/server/src/agent/client-workflow-artifact/recovery.contract.test.ts +253 -0
- package/template/apps/server/src/agent/client-workflow-artifact/release-binding.ts +85 -0
- package/template/apps/server/src/agent/client-workflow-artifact/repository.test.ts +204 -0
- package/template/apps/server/src/agent/client-workflow-artifact/repository.ts +97 -0
- package/template/apps/server/src/agent/client-workflow-artifact/routes-handler.contract.test.ts +201 -0
- package/template/apps/server/src/agent/client-workflow-artifact/routes.ts +161 -0
- package/template/apps/server/src/agent/client-workflow-artifact/runtime-composition.ts +101 -0
- package/template/apps/server/src/agent/client-workflow-artifact/scope-authority.ts +39 -0
- package/template/apps/server/src/agent/client-workflow-artifact/service-authorization.ts +117 -0
- package/template/apps/server/src/agent/client-workflow-artifact/service-support.ts +28 -0
- package/template/apps/server/src/agent/client-workflow-artifact/service.contract.test.ts +345 -0
- package/template/apps/server/src/agent/client-workflow-artifact/service.ts +350 -0
- package/template/apps/server/src/agent/client-workflow-artifact/session-boundary.ts +39 -0
- package/template/apps/server/src/agent/client-workflow-artifact/source-access.contract.test.ts +98 -0
- package/template/apps/server/src/agent/client-workflow-artifact/source-access.ts +80 -0
- package/template/apps/server/src/agent/client-workflow-artifact/takeover.ts +122 -0
- package/template/apps/server/src/agent/client-workflow-artifact/task-authority.contract.test.ts +97 -0
- package/template/apps/server/src/agent/client-workflow-artifact/task-authority.ts +147 -0
- package/template/apps/server/src/agent/client-workflow-artifact/terminal-authority.contract.test.ts +100 -0
- package/template/apps/server/src/agent/client-workflow-artifact/terminal-replay.ts +31 -0
- package/template/apps/server/src/agent/client-workflow-artifact/terminal-seal.ts +211 -0
- package/template/apps/server/src/agent/client-workflow-artifact/workflow-artifact.test-support.ts +173 -0
- package/template/apps/server/src/agent/client-workflow-artifact/workflow-loader.contract.test.ts +254 -0
- package/template/apps/server/src/agent/client-workflow-artifact/workflow-loader.ts +285 -0
- package/template/apps/server/src/agent/context-memory/attempt-context-contracts.ts +60 -0
- package/template/apps/server/src/agent/context-memory/authoritative-source-registry.ts +127 -0
- package/template/apps/server/src/agent/context-memory/context-builder.test.ts +160 -0
- package/template/apps/server/src/agent/context-memory/context-builder.ts +184 -0
- package/template/apps/server/src/agent/context-memory/contracts.ts +284 -0
- package/template/apps/server/src/agent/context-memory/digest.ts +22 -0
- package/template/apps/server/src/agent/context-memory/memory-authorization.ts +82 -0
- package/template/apps/server/src/agent/context-memory/memory-content.ts +69 -0
- package/template/apps/server/src/agent/context-memory/memory-object-registry.ts +87 -0
- package/template/apps/server/src/agent/context-memory/memory-projector-contracts.ts +121 -0
- package/template/apps/server/src/agent/context-memory/memory-projector-validation.ts +155 -0
- package/template/apps/server/src/agent/context-memory/memory-projector.test.ts +19 -0
- package/template/apps/server/src/agent/context-memory/memory-projector.ts +259 -0
- package/template/apps/server/src/agent/context-memory/memory-retrieval-policy.ts +195 -0
- package/template/apps/server/src/agent/context-memory/memory-retriever.test.ts +339 -0
- package/template/apps/server/src/agent/context-memory/memory-retriever.ts +184 -0
- package/template/apps/server/src/agent/context-memory/search-provider-port.test.ts +62 -0
- package/template/apps/server/src/agent/context-memory/search-provider-port.ts +75 -0
- package/template/apps/server/src/agent/context-memory/working-context-expiry.ts +95 -0
- package/template/apps/server/src/agent/context-message-recovery.ts +23 -0
- package/template/apps/server/src/agent/context-version-routes.ts +241 -0
- package/template/apps/server/src/agent/context-version-runtime.ts +332 -0
- package/template/apps/server/src/agent/context-version-support.ts +93 -0
- package/template/apps/server/src/agent/context-version-validation.ts +118 -0
- package/template/apps/server/src/agent/drizzle-run-binding-repository.ts +11 -0
- package/template/apps/server/src/agent/idempotency-key.ts +9 -1
- package/template/apps/server/src/agent/memory-runtime-adapters.ts +266 -0
- package/template/apps/server/src/agent/memory-scope-binding.ts +14 -0
- package/template/apps/server/src/agent/module-ai-port-factory.ts +41 -0
- package/template/apps/server/src/agent/provider-input-governance.ts +19 -0
- package/template/apps/server/src/agent/remote-runtime-response.ts +162 -0
- package/template/apps/server/src/agent/remote-runtime.ts +53 -153
- package/template/apps/server/src/agent/run-audit.ts +2 -2
- package/template/apps/server/src/agent/run-authorization.test.ts +27 -0
- package/template/apps/server/src/agent/run-authorization.ts +60 -1
- package/template/apps/server/src/agent/run-binding-repository.ts +9 -0
- package/template/apps/server/src/agent/run-browser-authorization.ts +79 -0
- package/template/apps/server/src/agent/run-contracts.ts +23 -0
- package/template/apps/server/src/agent/run-facade.test-support.ts +17 -4
- package/template/apps/server/src/agent/run-facade.test.ts +16 -0
- package/template/apps/server/src/agent/run-facade.ts +139 -139
- package/template/apps/server/src/agent/run-failure-cleanup.ts +58 -0
- package/template/apps/server/src/agent/run-operation-policy.ts +20 -0
- package/template/apps/server/src/agent/run-route-input.ts +19 -1
- package/template/apps/server/src/agent/run-routes.ts +133 -5
- package/template/apps/server/src/agent/run-runtime-request.ts +89 -0
- package/template/apps/server/src/agent/run-session-authorization.ts +97 -0
- package/template/apps/server/src/agent/run-start-preparation.ts +71 -0
- package/template/apps/server/src/agent/runtime-bootstrap-input.ts +46 -0
- package/template/apps/server/src/agent/runtime-bootstrap-report.test.ts +53 -1
- package/template/apps/server/src/agent/runtime-bootstrap.ts +115 -112
- package/template/apps/server/src/agent/runtime-public-ports.ts +40 -0
- package/template/apps/server/src/agent/runtime-tool-composition.ts +38 -0
- package/template/apps/server/src/agent/session-context-source-support.ts +38 -0
- package/template/apps/server/src/agent/session-context-source.ts +346 -0
- package/template/apps/server/src/agent/session-invalidation/contracts.ts +216 -0
- package/template/apps/server/src/agent/session-invalidation/dispatcher.contract.test.ts +333 -0
- package/template/apps/server/src/agent/session-invalidation/dispatcher.ts +205 -0
- package/template/apps/server/src/agent/session-invalidation/module-authoritative-producer.test.ts +127 -0
- package/template/apps/server/src/agent/session-invalidation/module-authoritative-producer.ts +202 -0
- package/template/apps/server/src/agent/session-invalidation/read-guard.ts +39 -0
- package/template/apps/server/src/agent/session-invalidation/runtime.ts +69 -0
- package/template/apps/server/src/agent/session-invalidation/test-envelopes.ts +24 -0
- package/template/apps/server/src/agent/session-invalidation/worker.contract.test.ts +135 -0
- package/template/apps/server/src/agent/session-invalidation/worker.ts +76 -0
- package/template/apps/server/src/agent/session-log/checkpoint-digest.ts +36 -0
- package/template/apps/server/src/agent/session-log/domain.ts +123 -0
- package/template/apps/server/src/agent/session-log/events.ts +229 -0
- package/template/apps/server/src/agent/session-log/history.ts +143 -0
- package/template/apps/server/src/agent/session-log/in-memory-repository.ts +340 -0
- package/template/apps/server/src/agent/session-log/lifecycle.ts +67 -0
- package/template/apps/server/src/agent/session-log/replay-policy.ts +76 -0
- package/template/apps/server/src/agent/session-log/repository.ts +103 -0
- package/template/apps/server/src/agent/session-log/service.ts +349 -0
- package/template/apps/server/src/agent/session-log/session-log.test.ts +282 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-context-memory.ts +348 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-governed-context.ts +328 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-invalidation-outbox.ts +260 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-memory-projection-deletion.ts +56 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-run-projection-receipt.ts +80 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-session-fork.ts +147 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-session-list.ts +24 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-session-mapping.ts +154 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-session-mutations.ts +64 -0
- package/template/apps/server/src/agent/session-persistence/drizzle-session-repository.ts +335 -0
- package/template/apps/server/src/agent/session-persistence/invalidation-projections.ts +229 -0
- package/template/apps/server/src/agent/session-persistence/payload-codec.ts +90 -0
- package/template/apps/server/src/agent/session-projection-access.ts +167 -0
- package/template/apps/server/src/agent/session-projection-bootstrap.ts +87 -0
- package/template/apps/server/src/agent/session-projection-errors.ts +22 -0
- package/template/apps/server/src/agent/session-projection-facade.ts +349 -0
- package/template/apps/server/src/agent/session-projection-routes.ts +215 -0
- package/template/apps/server/src/agent/session-projection-view.ts +137 -0
- package/template/apps/server/src/agent/session-result-memory.ts +228 -0
- package/template/apps/server/src/agent/session-run-lifecycle.ts +85 -0
- package/template/apps/server/src/agent/session-run-link-contracts.ts +56 -0
- package/template/apps/server/src/agent/session-run-link.ts +343 -0
- package/template/apps/server/src/agent/session-run-recovery.ts +16 -0
- package/template/apps/server/src/agent/session-runtime-composition.ts +265 -0
- package/template/apps/server/src/agent/session-source-chain-authorizer.ts +141 -0
- package/template/apps/server/src/agent/session-terminal-reconciler.ts +100 -0
- package/template/apps/server/src/agent/session-turn-state.ts +49 -0
- package/template/apps/server/src/agent/tool-audit.ts +3 -3
- package/template/apps/server/src/agent/tool-execution-receipt.ts +13 -0
- package/template/apps/server/src/agent/tool-host.ts +41 -4
- package/template/apps/server/src/agent/tool-registry-composition.ts +52 -0
- package/template/apps/server/src/agent/tool-registry.test.ts +5 -5
- package/template/apps/server/src/agent/tool-registry.ts +53 -59
- package/template/apps/server/src/agent/unavailable-routes.ts +70 -5
- package/template/apps/server/src/agent/workflow-durable-runtime-input.ts +32 -0
- package/template/apps/server/src/agent/workflow-runtime-bootstrap.ts +61 -0
- package/template/apps/server/src/agent-workflow/adapter-dispatch.ts +148 -0
- package/template/apps/server/src/agent-workflow/approval-node-adapter.ts +77 -0
- package/template/apps/server/src/agent-workflow/artifact-access-error.ts +9 -0
- package/template/apps/server/src/agent-workflow/artifact-node-adapter.ts +67 -0
- package/template/apps/server/src/agent-workflow/artifact-policy.ts +71 -0
- package/template/apps/server/src/agent-workflow/artifact-source-authorization.ts +91 -0
- package/template/apps/server/src/agent-workflow/authorization.ts +238 -0
- package/template/apps/server/src/agent-workflow/budget-ledger.ts +118 -0
- package/template/apps/server/src/agent-workflow/budget-validation.ts +305 -0
- package/template/apps/server/src/agent-workflow/canonical-agent-run-binding.ts +17 -0
- package/template/apps/server/src/agent-workflow/canonical-agent-run-evidence.ts +142 -0
- package/template/apps/server/src/agent-workflow/canonical-agent-run-port.ts +304 -0
- package/template/apps/server/src/agent-workflow/canonical-agent-run-remote.ts +64 -0
- package/template/apps/server/src/agent-workflow/canonical-json.ts +16 -0
- package/template/apps/server/src/agent-workflow/command-drive.ts +195 -0
- package/template/apps/server/src/agent-workflow/command-error.ts +9 -0
- package/template/apps/server/src/agent-workflow/command-facade.ts +349 -0
- package/template/apps/server/src/agent-workflow/command-input.ts +133 -0
- package/template/apps/server/src/agent-workflow/condition-node-adapter.ts +69 -0
- package/template/apps/server/src/agent-workflow/definition-budget-validation.ts +41 -0
- package/template/apps/server/src/agent-workflow/definition-node-validation.ts +197 -0
- package/template/apps/server/src/agent-workflow/definition-validation.ts +198 -0
- package/template/apps/server/src/agent-workflow/delegated-tool-authorization.ts +15 -0
- package/template/apps/server/src/agent-workflow/delegation-child-delivery.ts +129 -0
- package/template/apps/server/src/agent-workflow/delegation-execution-authorization.ts +218 -0
- package/template/apps/server/src/agent-workflow/delegation-policy-validation.ts +253 -0
- package/template/apps/server/src/agent-workflow/delegation-policy.ts +179 -0
- package/template/apps/server/src/agent-workflow/drizzle-artifact-port.ts +211 -0
- package/template/apps/server/src/agent-workflow/drizzle-artifact-support.ts +152 -0
- package/template/apps/server/src/agent-workflow/drizzle-budget-ledger-settlement.ts +271 -0
- package/template/apps/server/src/agent-workflow/drizzle-budget-ledger-support.ts +226 -0
- package/template/apps/server/src/agent-workflow/drizzle-budget-ledger.ts +189 -0
- package/template/apps/server/src/agent-workflow/drizzle-cancellation-reconcile.ts +177 -0
- package/template/apps/server/src/agent-workflow/drizzle-delegated-tool-authorization.ts +155 -0
- package/template/apps/server/src/agent-workflow/drizzle-delegation-completion.ts +84 -0
- package/template/apps/server/src/agent-workflow/drizzle-delegation-lifecycle.ts +139 -0
- package/template/apps/server/src/agent-workflow/drizzle-delegation-port.ts +288 -0
- package/template/apps/server/src/agent-workflow/drizzle-effect-command-fence.ts +333 -0
- package/template/apps/server/src/agent-workflow/drizzle-evaluation-repository.ts +214 -0
- package/template/apps/server/src/agent-workflow/drizzle-event-validation.ts +43 -0
- package/template/apps/server/src/agent-workflow/drizzle-recovery-admission.ts +115 -0
- package/template/apps/server/src/agent-workflow/drizzle-repository-lineage.ts +103 -0
- package/template/apps/server/src/agent-workflow/drizzle-repository-mappers.ts +317 -0
- package/template/apps/server/src/agent-workflow/drizzle-repository-write.ts +311 -0
- package/template/apps/server/src/agent-workflow/drizzle-repository.ts +285 -0
- package/template/apps/server/src/agent-workflow/drizzle-side-effect-repository.ts +83 -0
- package/template/apps/server/src/agent-workflow/drizzle-write-support.ts +101 -0
- package/template/apps/server/src/agent-workflow/durable-continuation-authorization.ts +109 -0
- package/template/apps/server/src/agent-workflow/durable-continuation-driver.ts +97 -0
- package/template/apps/server/src/agent-workflow/durable-continuation-runtime.ts +173 -0
- package/template/apps/server/src/agent-workflow/durable-job-node-adapter.ts +106 -0
- package/template/apps/server/src/agent-workflow/effect-command-fence.ts +250 -0
- package/template/apps/server/src/agent-workflow/evaluation-evidence-coordinates.ts +225 -0
- package/template/apps/server/src/agent-workflow/evaluation-evidence-metrics.ts +280 -0
- package/template/apps/server/src/agent-workflow/evaluation-evidence-reader.ts +326 -0
- package/template/apps/server/src/agent-workflow/evaluation-metrics-validation.ts +85 -0
- package/template/apps/server/src/agent-workflow/evaluation-projection.ts +70 -0
- package/template/apps/server/src/agent-workflow/evaluation-repository.ts +134 -0
- package/template/apps/server/src/agent-workflow/evaluation-service.ts +292 -0
- package/template/apps/server/src/agent-workflow/evaluation-tool-registration.ts +95 -0
- package/template/apps/server/src/agent-workflow/evaluation-validation.ts +331 -0
- package/template/apps/server/src/agent-workflow/event-validation.ts +277 -0
- package/template/apps/server/src/agent-workflow/governed-tool-schema.ts +55 -0
- package/template/apps/server/src/agent-workflow/in-memory-evaluation-repository.ts +123 -0
- package/template/apps/server/src/agent-workflow/in-memory-mutation-validation.ts +154 -0
- package/template/apps/server/src/agent-workflow/in-memory-repository-support.ts +277 -0
- package/template/apps/server/src/agent-workflow/in-memory-repository.ts +339 -0
- package/template/apps/server/src/agent-workflow/in-memory-side-effect-store.ts +78 -0
- package/template/apps/server/src/agent-workflow/input-receipt.ts +55 -0
- package/template/apps/server/src/agent-workflow/model-node-adapter.ts +86 -0
- package/template/apps/server/src/agent-workflow/model-pricing-catalog.ts +215 -0
- package/template/apps/server/src/agent-workflow/node-adapter-factory.ts +83 -0
- package/template/apps/server/src/agent-workflow/node-adapters.ts +50 -0
- package/template/apps/server/src/agent-workflow/node-execution-ports.ts +185 -0
- package/template/apps/server/src/agent-workflow/node-input-receipt-port.ts +42 -0
- package/template/apps/server/src/agent-workflow/node-result-receipt.ts +50 -0
- package/template/apps/server/src/agent-workflow/platform-node-adapter-support.ts +185 -0
- package/template/apps/server/src/agent-workflow/platform-node-adapters.ts +264 -0
- package/template/apps/server/src/agent-workflow/platform-node-approval.ts +146 -0
- package/template/apps/server/src/agent-workflow/platform-node-direct-adapters.ts +65 -0
- package/template/apps/server/src/agent-workflow/production-delegation-scope.ts +58 -0
- package/template/apps/server/src/agent-workflow/production-node-policies.ts +62 -0
- package/template/apps/server/src/agent-workflow/project-launch-authority.contract.test.ts +53 -0
- package/template/apps/server/src/agent-workflow/project-launch-authority.ts +92 -0
- package/template/apps/server/src/agent-workflow/query-service.ts +198 -0
- package/template/apps/server/src/agent-workflow/release.ts +96 -0
- package/template/apps/server/src/agent-workflow/repository.ts +157 -0
- package/template/apps/server/src/agent-workflow/routes.ts +307 -0
- package/template/apps/server/src/agent-workflow/runtime-composition.ts +324 -0
- package/template/apps/server/src/agent-workflow/scheduler-cancellation-reconcile.ts +253 -0
- package/template/apps/server/src/agent-workflow/scheduler-cancellation-support.ts +145 -0
- package/template/apps/server/src/agent-workflow/scheduler-cancellation.ts +2 -0
- package/template/apps/server/src/agent-workflow/scheduler-context.ts +85 -0
- package/template/apps/server/src/agent-workflow/scheduler-deadline.ts +65 -0
- package/template/apps/server/src/agent-workflow/scheduler-effect-result.ts +205 -0
- package/template/apps/server/src/agent-workflow/scheduler-execution-convergence.ts +174 -0
- package/template/apps/server/src/agent-workflow/scheduler-execution.ts +211 -0
- package/template/apps/server/src/agent-workflow/scheduler-failure.ts +102 -0
- package/template/apps/server/src/agent-workflow/scheduler-join-cancellation.ts +282 -0
- package/template/apps/server/src/agent-workflow/scheduler-mutation-queue.ts +13 -0
- package/template/apps/server/src/agent-workflow/scheduler-node-timeout.ts +139 -0
- package/template/apps/server/src/agent-workflow/scheduler-parallel-dispatch.ts +99 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-activation.ts +63 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-budget.ts +41 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-effect.ts +331 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-event-time.ts +26 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-failed-policy.ts +129 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-node.ts +208 -0
- package/template/apps/server/src/agent-workflow/scheduler-recovery-policy-convergence.ts +140 -0
- package/template/apps/server/src/agent-workflow/scheduler-reservation-convergence.ts +40 -0
- package/template/apps/server/src/agent-workflow/scheduler-side-effect-execution.ts +249 -0
- package/template/apps/server/src/agent-workflow/scheduler-support.ts +235 -0
- package/template/apps/server/src/agent-workflow/scheduler-workflow-cancellation.ts +296 -0
- package/template/apps/server/src/agent-workflow/scheduler.ts +289 -0
- package/template/apps/server/src/agent-workflow/service-completion.ts +102 -0
- package/template/apps/server/src/agent-workflow/service-mutation-identity.ts +94 -0
- package/template/apps/server/src/agent-workflow/service-node-admission.ts +36 -0
- package/template/apps/server/src/agent-workflow/service-node-run-update.ts +55 -0
- package/template/apps/server/src/agent-workflow/service-recovery-events.ts +38 -0
- package/template/apps/server/src/agent-workflow/service-recovery.ts +264 -0
- package/template/apps/server/src/agent-workflow/service-retry.ts +86 -0
- package/template/apps/server/src/agent-workflow/service-run-command.ts +131 -0
- package/template/apps/server/src/agent-workflow/service-state-error.ts +21 -0
- package/template/apps/server/src/agent-workflow/service-state-invariants.ts +44 -0
- package/template/apps/server/src/agent-workflow/service-support.ts +152 -0
- package/template/apps/server/src/agent-workflow/service.ts +307 -0
- package/template/apps/server/src/agent-workflow/side-effect-state.ts +226 -0
- package/template/apps/server/src/agent-workflow/state-machine.ts +321 -0
- package/template/apps/server/src/agent-workflow/subagent-node-adapter.ts +229 -0
- package/template/apps/server/src/agent-workflow/tool-node-adapter.ts +259 -0
- package/template/apps/server/src/agent-workflow/usage.ts +149 -0
- package/template/apps/server/src/agent-workflow/wait-signal-service.ts +147 -0
- package/template/apps/server/src/agent-workflow/workflow-artifact-token.ts +109 -0
- package/template/apps/server/src/agent-workflow/workflow-value-validation.ts +101 -0
- package/template/apps/server/src/agent-workflow/workspace-policy.ts +109 -0
- package/template/apps/server/src/ai-runtime-report/remote-parser.ts +41 -0
- package/template/apps/server/src/ai-runtime-report/service.test.ts +2 -0
- package/template/apps/server/src/app/agent-runtime-composition.ts +43 -0
- package/template/apps/server/src/app/client-agent-host-auth-binding.ts +10 -0
- package/template/apps/server/src/app/client-agent-workflow-artifact-binding.ts +14 -0
- package/template/apps/server/src/application-services.ts +6 -0
- package/template/apps/server/src/auth/actor-resolver.test.ts +33 -0
- package/template/apps/server/src/auth/actor-resolver.ts +6 -1
- package/template/apps/server/src/auth/composition.ts +36 -0
- package/template/apps/server/src/auth/routes.test-support.ts +2 -0
- package/template/apps/server/src/auth/routes.test.ts +18 -0
- package/template/apps/server/src/auth/runtime.ts +2 -0
- package/template/apps/server/src/auth/service-options.ts +16 -0
- package/template/apps/server/src/auth/service.ts +7 -12
- package/template/apps/server/src/data-access/scope-containment.test.ts +31 -0
- package/template/apps/server/src/data-access/scope-containment.ts +48 -0
- package/template/apps/server/src/index.ts +35 -37
- package/template/apps/server/src/jobs/artifact-publication.test.ts +192 -0
- package/template/apps/server/src/jobs/artifact-publication.ts +56 -0
- package/template/apps/server/src/jobs/artifact-publisher.ts +101 -0
- package/template/apps/server/src/jobs/drizzle-artifact.ts +73 -1
- package/template/apps/server/src/jobs/drizzle-execution-repository.ts +14 -1
- package/template/apps/server/src/jobs/drizzle-execution.integration.test.ts +65 -0
- package/template/apps/server/src/jobs/drizzle-repository.integration.test.ts +1 -0
- package/template/apps/server/src/jobs/execution-repository.ts +28 -0
- package/template/apps/server/src/jobs/execution.test.ts +3 -1
- package/template/apps/server/src/jobs/in-memory-execution.ts +16 -0
- package/template/apps/server/src/jobs/in-memory-lease.ts +45 -1
- package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +2 -0
- package/template/apps/server/src/jobs/postgres-cleanup-contract.test.ts +58 -0
- package/template/apps/server/src/jobs/worker.ts +8 -14
- package/template/apps/server/src/license/pairing-service.test.ts +1 -1
- package/template/apps/server/src/module-host/agent-session-memory-port.ts +91 -0
- package/template/apps/server/src/module-host/{debug-session-provider-registration.test.ts → agent-session-provider-registration.test.ts} +42 -17
- package/template/apps/server/src/module-host/{debug-session-provider-registration.ts → agent-session-provider-registration.ts} +18 -18
- package/template/apps/server/src/module-host/agent-source-invalidation-port.ts +53 -0
- package/template/apps/server/src/module-host/background-ai-unavailable.ts +18 -0
- package/template/apps/server/src/module-host/durable-context.ts +19 -22
- package/template/apps/server/src/module-host/http-runtime.ts +14 -0
- package/template/apps/server/src/module-host/implementation-completeness.test.ts +80 -1
- package/template/apps/server/src/module-host/implementation-completeness.ts +28 -1
- package/template/apps/server/src/module-host/initialize-contracts.ts +4 -5
- package/template/apps/server/src/module-host/initialize.ts +4 -4
- package/template/apps/server/src/module-host/request-context.test.ts +5 -5
- package/template/apps/server/src/module-host/request-context.ts +40 -8
- package/template/apps/server/src/module-host/route-install-context.ts +65 -0
- package/template/apps/server/src/module-host/route-installer.ts +11 -56
- package/template/apps/server/src/module-host/scoped-host.ts +17 -12
- package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +3 -3
- package/template/apps/server/src/module-host/storage-port.ts +3 -0
- package/template/apps/server/src/module-host/workflow-input-artifact-port.test.ts +104 -0
- package/template/apps/server/src/module-host/workflow-input-artifact-port.ts +229 -0
- package/template/apps/server/src/module-host/workflow-input-materialization.test.ts +163 -0
- package/template/apps/server/src/module-host/workflow-input-materialization.ts +161 -0
- package/template/apps/server/src/module-host.ts +3 -5
- package/template/apps/server/src/runtime.ts +3 -36
- package/template/apps/server/src/storage/routes-stream-cancellation.test.ts +19 -0
- package/template/apps/server/src/storage/routes.ts +3 -1
- package/template/apps/server/src/system/actor.ts +15 -2
- package/template/apps/server/src/system/authorization-invalidation-bridge.ts +30 -0
- package/template/apps/server/src/system/authorization-invalidation-composition.ts +36 -0
- package/template/apps/server/src/system/drizzle-system.ts +8 -1
- package/template/apps/server/src/system/identity-route-config.ts +9 -1
- package/template/apps/server/src/system/routes.ts +3 -0
- package/template/apps/server/src/system/seed.ts +3 -0
- package/template/apps/server/src/system/user-account-policy.ts +91 -0
- package/template/apps/server/src/workflow/drizzle-repository.integration.test.ts +1 -0
- package/template/apps/web/package.json +1 -0
- package/template/apps/web/src/layout/AppSidebar.vue +2 -0
- package/template/apps/web/src/pages/system/AgentSessionPage.vue +73 -0
- package/template/apps/web/src/pages/system/AgentSessionPage.webtest.ts +66 -0
- package/template/apps/web/src/pages/system/AgentWorkflowPage.vue +69 -0
- package/template/apps/web/src/pages/system/components/agent-session/AgentSessionDetail.vue +114 -0
- package/template/apps/web/src/pages/system/components/agent-session/AgentSessionList.vue +84 -0
- package/template/apps/web/src/pages/system/components/agent-session/ContextVersionPanel.vue +119 -0
- package/template/apps/web/src/pages/system/components/agent-session/ContextVersionPanel.webtest.ts +46 -0
- package/template/apps/web/src/pages/system/components/agent-session/MemoryProjectionPanel.vue +163 -0
- package/template/apps/web/src/pages/system/components/agent-session/MemoryProjectionPanel.webtest.ts +62 -0
- package/template/apps/web/src/pages/system/components/agent-session/SessionTimeline.vue +71 -0
- package/template/apps/web/src/pages/system/components/agent-session/SessionTimeline.webtest.ts +34 -0
- package/template/apps/web/src/pages/system/components/agent-session/agent-session-presenter.ts +56 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowNodeCard.vue +39 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowNodeDetail.vue +172 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunDetail.vue +151 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunGraph.vue +96 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunList.vue +100 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunSummary.vue +148 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/agent-workflow-presenter.ts +74 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/workflow-graph-layout.ts +108 -0
- package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.vue +9 -0
- package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.webtest.ts +22 -0
- package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunTable.webtest.ts +2 -0
- package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeTrajectory.vue +118 -0
- package/template/apps/web/src/pages/system/composables/useAgentSessions.ts +209 -0
- package/template/apps/web/src/pages/system/composables/useAgentSessions.webtest.ts +138 -0
- package/template/apps/web/src/pages/system/composables/useAgentWorkflowRuns.ts +173 -0
- package/template/apps/web/src/router/index.ts +4 -0
- package/template/apps/web/src/router/platform-admin-route-bindings.ts +6 -0
- package/template/apps/web/src/services/agent-session-api.ts +159 -0
- package/template/apps/web/src/services/agent-session-api.webtest.ts +65 -0
- package/template/apps/web/src/services/agent-workflow-api.ts +181 -0
- package/template/apps/web/src/services/ai-runtime-api.ts +4 -0
- package/template/docker-compose.yml +11 -8
- package/template/docs/adr/0003-agent-session-event-source.md +3 -0
- package/template/docs/architecture/agent-harness.md +464 -0
- package/template/docs/architecture/agent-workflow.md +110 -0
- package/template/docs/architecture/ai-runtime.md +55 -47
- package/template/docs/architecture/durable-jobs.md +7 -0
- package/template/docs/architecture/module-host.md +4 -3
- package/template/docs/operations/adk-retirement.md +98 -0
- package/template/docs/operations/agent-session-memory.md +163 -0
- package/template/docs/operations/agent-session-troubleshooting.md +281 -0
- package/template/docs/operations/agent-workflow-recovery.md +85 -0
- package/template/docs/operations/incremental-delivery.md +1 -1
- package/template/docs/platform/agent-production-store.md +82 -0
- package/template/docs/platform/agent-run-reattachment.md +52 -0
- package/template/docs/platform/agent-runtime-observability.md +4 -3
- package/template/docs/platform/agent-runtime.md +116 -281
- package/template/docs/platform/agent-tool-approval.md +61 -0
- package/template/docs/platform/background-ai-operations.md +50 -0
- package/template/docs/platform/client-agent-session.md +319 -0
- package/template/docs/platform/embedding-ai-runtime.md +94 -0
- package/template/docs/platform/platform-authentication.md +5 -8
- package/template/package.json +0 -1
- package/template/packages/ai-client/index.ts +1 -0
- package/template/packages/ai-client/package.json +3 -1
- package/template/packages/ai-client/src/agent/client/client.ts +15 -2
- package/template/packages/ai-client/src/agent/client/run-protocol.test.ts +39 -25
- package/template/packages/ai-client/src/agent/client/types.ts +4 -0
- package/template/packages/ai-client/src/agent/contracts/contracts.test.ts +49 -7
- package/template/packages/ai-client/src/agent/contracts/events.ts +61 -0
- package/template/packages/ai-client/src/agent/contracts/runs.ts +1 -0
- package/template/packages/ai-client/src/client-agent/contracts.ts +131 -0
- package/template/packages/ai-client/src/client-agent/http.test.ts +60 -0
- package/template/packages/ai-client/src/client-agent/http.ts +66 -0
- package/template/packages/ai-client/src/client-agent/index.ts +4 -0
- package/template/packages/ai-client/src/client-agent/validation.test.ts +57 -0
- package/template/packages/ai-client/src/client-agent/validation.ts +152 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/contracts.ts +85 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/http.test.ts +49 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/http.ts +82 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/index.ts +3 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/validation.test.ts +154 -0
- package/template/packages/ai-client/src/client-agent/workflow-artifact/validation.ts +332 -0
- package/template/packages/config/index.test.ts +18 -0
- package/template/packages/config/package.json +1 -1
- package/template/packages/config/src/platform-validation.ts +8 -0
- package/template/packages/config/src/platform.ts +22 -9
- package/template/packages/database/drizzle/0055_square_yellowjacket.sql +47 -0
- package/template/packages/database/drizzle/0056_tricky_living_mummy.sql +2 -0
- package/template/packages/database/drizzle/0057_mature_doomsday.sql +4 -0
- package/template/packages/database/drizzle/0058_agent_session_memory.sql +159 -0
- package/template/packages/database/drizzle/0059_agent_source_module_key.sql +16 -0
- package/template/packages/database/drizzle/0060_slimy_rocket_raccoon.sql +43 -0
- package/template/packages/database/drizzle/0061_agent_workflow.sql +303 -0
- package/template/packages/database/drizzle/0062_client_agent_workflow_artifact.sql +63 -0
- package/template/packages/database/drizzle/meta/0055_snapshot.json +11071 -0
- package/template/packages/database/drizzle/meta/0056_snapshot.json +11098 -0
- package/template/packages/database/drizzle/meta/0057_snapshot.json +10878 -0
- package/template/packages/database/drizzle/meta/0058_snapshot.json +12294 -0
- package/template/packages/database/drizzle/meta/0059_snapshot.json +12344 -0
- package/template/packages/database/drizzle/meta/0060_snapshot.json +12326 -0
- package/template/packages/database/drizzle/meta/0061_snapshot.json +14395 -0
- package/template/packages/database/drizzle/meta/0062_snapshot.json +14839 -0
- package/template/packages/database/drizzle/meta/_journal.json +56 -0
- package/template/packages/database/package.json +1 -1
- package/template/packages/database/src/agent-runtime-schema.test.ts +203 -0
- package/template/packages/database/src/schema/agent-context-message.ts +38 -0
- package/template/packages/database/src/schema/agent-runtime.ts +7 -0
- package/template/packages/database/src/schema/agent-session-receipt.ts +36 -0
- package/template/packages/database/src/schema/agent-session.ts +344 -0
- package/template/packages/database/src/schema/agent-workflow-delegation.ts +126 -0
- package/template/packages/database/src/schema/agent-workflow-effects.ts +213 -0
- package/template/packages/database/src/schema/agent-workflow-evaluation.ts +67 -0
- package/template/packages/database/src/schema/agent-workflow.ts +270 -0
- package/template/packages/database/src/schema/client-agent-workflow-artifact.ts +158 -0
- package/template/packages/database/src/schema/client-agent.ts +95 -0
- package/template/packages/database/src/schema/index.ts +9 -0
- package/template/packages/jobs/package.json +1 -1
- package/template/packages/jobs/src/handlers.test.ts +10 -0
- package/template/packages/jobs/src/handlers.ts +28 -11
- package/template/packages/modules/index.ts +2 -0
- package/template/packages/modules/package.json +1 -1
- package/template/packages/modules/src/ai-client-execution-composition.test.ts +98 -0
- package/template/packages/modules/src/ai-client-execution-policy.ts +60 -0
- package/template/packages/modules/src/ai-operation-composition.ts +2 -0
- package/template/packages/modules/src/manifest.ts +17 -0
- package/template/packages/modules/src/system-admin-routes.ts +16 -0
- package/template/packages/modules/src/system-admin-ui-catalog.ts +4 -1
- package/template/packages/modules/src/system-agent-audit-actions.ts +29 -0
- package/template/packages/modules/src/system-ai-api-bindings.ts +277 -0
- package/template/packages/modules/src/system-api-control-plane.ts +4 -78
- package/template/packages/modules/src/system-audit-actions.ts +128 -0
- package/template/packages/modules/src/system-features.ts +17 -0
- package/template/packages/modules/src/system-module-catalog.ts +21 -11
- package/template/packages/modules/src/system-modules.ts +22 -0
- package/template/packages/modules/src/system-permissions.ts +8 -0
- package/template/packages/server-sdk/index.ts +95 -0
- package/template/packages/server-sdk/package.json +9 -1
- package/template/packages/server-sdk/src/agent-session-memory-port.ts +64 -0
- package/template/packages/server-sdk/src/agent-session-provider.ts +63 -0
- package/template/packages/server-sdk/src/agent-source-invalidation-port.ts +54 -0
- package/template/packages/server-sdk/src/ai-operation-registration.ts +2 -0
- package/template/packages/server-sdk/src/client-agent-session.ts +107 -0
- package/template/packages/server-sdk/src/client-agent-workflow-artifact.contract.test.ts +113 -0
- package/template/packages/server-sdk/src/client-agent-workflow-artifact.ts +183 -0
- package/template/packages/server-sdk/src/debug-session-provider.ts +14 -63
- package/template/packages/server-sdk/src/durable-handler.ts +7 -0
- package/template/packages/server-sdk/src/module-host.ts +7 -3
- package/template/packages/server-sdk/src/request-context.ts +13 -0
- package/template/packages/server-sdk/src/workflow-input-artifact-port.ts +104 -0
- package/template/packages/server-sdk/src/workflow-input-artifact-validation.contract.test.ts +124 -0
- package/template/packages/server-sdk/src/workflow-input-artifact-validation.ts +347 -0
- package/template/packages/server-sdk/src/workflow-input-materialization-handler.ts +43 -0
- package/template/packages/shared/index.ts +3 -0
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/agent-workflow-definition.ts +113 -0
- package/template/packages/shared/src/agent-workflow-delegation.ts +123 -0
- package/template/packages/shared/src/agent-workflow-evaluation.ts +159 -0
- package/template/packages/shared/src/agent-workflow-events.ts +99 -0
- package/template/packages/shared/src/agent-workflow-run.ts +259 -0
- package/template/packages/shared/src/agent-workflow.ts +3 -0
- package/template/packages/shared/src/ai-runtime-report.ts +25 -0
- package/template/packages/shared/src/rbac.ts +24 -0
- package/template/packages/storage/package.json +1 -1
- package/template/packages/storage/src/blob-store-put-once.test.ts +70 -0
- package/template/packages/storage/src/blob-store.ts +9 -0
- package/template/packages/storage/src/local-file-blob-put-once.ts +120 -0
- package/template/packages/storage/src/local-file-blob-store.ts +53 -1
- package/template/packages/storage/src/memory-blob-store.ts +73 -33
- package/template/packages/storage/src/upload-streams.test.ts +31 -0
- package/template/packages/storage/src/upload-streams.ts +20 -6
- package/template/apps/agent-server/adk_web_agents/__init__.py +0 -1
- package/template/apps/agent-server/adk_web_agents/canonical_debug/__init__.py +0 -1
- package/template/apps/agent-server/adk_web_agents/canonical_debug/agent.py +0 -145
- package/template/apps/agent-server/adk_web_agents/safe_debug/__init__.py +0 -3
- package/template/apps/agent-server/adk_web_agents/safe_debug/agent.py +0 -40
- package/template/apps/agent-server/adk_web_agents/services.py +0 -25
- package/template/apps/agent-server/project/adk-web-debug.json +0 -4
- package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +0 -333
- package/template/apps/agent-server/src/southwind_agent_server/adk_debug.py +0 -348
- package/template/apps/agent-server/src/southwind_agent_server/adk_debug_sessions.py +0 -325
- package/template/apps/agent-server/src/southwind_agent_server/adk_failure.py +0 -13
- package/template/apps/agent-server/src/southwind_agent_server/adk_model.py +0 -304
- package/template/apps/agent-server/src/southwind_agent_server/adk_tools.py +0 -143
- package/template/apps/agent-server/tests/test_adk_adapter.py +0 -307
- package/template/apps/agent-server/tests/test_adk_debug_result_polling.py +0 -139
- package/template/apps/agent-server/tests/test_adk_debug_sessions.py +0 -215
- package/template/apps/agent-server/tests/test_adk_web_agent.py +0 -12
- package/template/apps/agent-server/tests/test_adk_web_canonical_debug.py +0 -282
- package/template/apps/server/src/agent/run-debug-authorization.ts +0 -27
- package/template/apps/server/src/agent/run-facade-adk-debug.test.ts +0 -95
- package/template/apps/server/src/runtime-adk-debug.test.ts +0 -270
- package/template/apps/server/src/runtime-adk-debug.ts +0 -164
- package/template/apps/server/src/runtime-request-actor.test.ts +0 -55
- package/template/apps/server/src/runtime-request-actor.ts +0 -22
- package/template/docker-compose.agent-debug.yml +0 -58
- package/template/scripts/dev-adk-web.ts +0 -107
|
@@ -1,325 +1,160 @@
|
|
|
1
|
-
# Agent Runtime
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Windy
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## 当前可用边界
|
|
11
|
-
|
|
12
|
-
- 真实业务 Run 使用 Google ADK 2.5 `Runner`、`InMemorySessionService`、`LlmAgent`
|
|
13
|
-
与 `Event`;ADK 类型只存在于 Python Adapter 内,外部 HTTP/SSE 契约不变。
|
|
14
|
-
- OpenAI-compatible `/chat/completions` Provider,支持流式文本和 function calling。
|
|
15
|
-
- `QWEN_API_KEY` 使用服务端 `SecretRef`,只在 Provider Adapter 发请求前解析。
|
|
16
|
-
- 公网 Endpoint 必须为 HTTPS,并精确命中
|
|
17
|
-
`AI_PROVIDER_HTTPS_HOST_ALLOWLIST`;`localhost`、容器服务名、RFC 1918 地址和
|
|
18
|
-
`.internal`/`.local` 主机可使用 HTTP。URL 禁止内嵌凭据、query、fragment 和云
|
|
19
|
-
metadata 地址。
|
|
20
|
-
- Provider 有连接/请求超时、响应大小上限、安全错误映射和 `/models` readiness 检查。
|
|
21
|
-
- Run 支持幂等创建、canonical SSE、cursor/`Last-Event-ID` 重放、取消和唯一终态。
|
|
22
|
-
- SQLite Store 为单副本有界持久化:默认最多 10,000 个 Run、每个 Run 2,000 个事件、
|
|
23
|
-
16 MiB 输出、终态保留 7 天。它不保存原始输入,只保存请求指纹;进程重启会把未完成
|
|
24
|
-
Run 收敛为一个可重试失败终态。
|
|
25
|
-
|
|
26
|
-
SQLite 模式不能作为多副本共享 Store。需要水平扩容时,必须先提供实现同一 `RunStore`
|
|
27
|
-
契约的外部持久化 Adapter。
|
|
28
|
-
|
|
29
|
-
## Module 接入
|
|
30
|
-
|
|
31
|
-
Manifest 的 `aiOperations` 是声明事实。每个 Operation 必须声明自己的 Feature、
|
|
32
|
-
Permission、可选 Entitlement、输入/输出 schema 和 `allowedToolKeys`。模型只会收到该
|
|
33
|
-
集合内的 Tool 定义。
|
|
34
|
-
|
|
35
|
-
Provider 与 Tool 网络策略必须分开声明。旧 `publicNetworkAccess` 不会开启 Provider:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
providerEgress: {
|
|
39
|
-
mode: "configured-endpoint",
|
|
40
|
-
deploymentKey: "ai.openai-compatible",
|
|
41
|
-
},
|
|
42
|
-
providerDataPolicy: {
|
|
43
|
-
inputFields: [
|
|
44
|
-
{
|
|
45
|
-
jsonPointer: "/content",
|
|
46
|
-
classification: "internal",
|
|
47
|
-
dlpAction: "redact",
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
envelopeFields: [
|
|
51
|
-
{
|
|
52
|
-
field: "instructions",
|
|
53
|
-
classification: "internal",
|
|
54
|
-
dlpAction: "reject",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
field: "user-prompt",
|
|
58
|
-
classification: "internal",
|
|
59
|
-
dlpAction: "redact",
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
toolNetworkPolicy: {
|
|
64
|
-
mode: "forbidden",
|
|
65
|
-
},
|
|
66
|
-
```
|
|
1
|
+
# Agent Runtime 接入
|
|
2
|
+
|
|
3
|
+
## 当前基线
|
|
4
|
+
|
|
5
|
+
Windy 的服务端 Agent Runtime 由独立 Python Agent Server 承载,生产默认 Engine 是
|
|
6
|
+
`OpenAiCompatibleEngineAdapter`。它直接把 Windy 类型化 Operation、模型轮次和 Tool Host
|
|
7
|
+
组合成受治理 Loop,不依赖第三方 Agent 框架。
|
|
8
|
+
|
|
9
|
+
外部只依赖 canonical 契约:
|
|
67
10
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
模块在 `setup(host)` 中注册模型无关的输入准备器:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
host.registerAiOperationHandlers([
|
|
78
|
-
{
|
|
79
|
-
operationKey: "example.summary.generate",
|
|
80
|
-
prepare(input, context) {
|
|
81
|
-
return {
|
|
82
|
-
instructions: "只根据用户提供的数据生成简洁摘要。",
|
|
83
|
-
userPrompt: JSON.stringify({
|
|
84
|
-
input,
|
|
85
|
-
actorId: context.actor.id,
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
11
|
+
```text
|
|
12
|
+
POST /api/agent/runs
|
|
13
|
+
GET /api/agent/runs/:runId/events
|
|
14
|
+
GET /api/agent/runs/:runId/result
|
|
15
|
+
POST /api/agent/runs/:runId/cancel
|
|
91
16
|
```
|
|
92
17
|
|
|
93
|
-
|
|
94
|
-
|
|
18
|
+
创建 Run 必须携带幂等键;SSE 支持 cursor 重放和 heartbeat。Engine 切换不改变 Run DTO、
|
|
19
|
+
canonical Event、唯一终态、取消或 Tool 授权语义。
|
|
20
|
+
|
|
21
|
+
## 能力与治理边界
|
|
95
22
|
|
|
96
|
-
|
|
97
|
-
携带短时 opaque grant 回调 Windy Server;受限 Tool Host 会验证:
|
|
23
|
+
Direct Engine 已覆盖:
|
|
98
24
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
25
|
+
- 文本 delta 与最终文本;
|
|
26
|
+
- JSON Schema 结构化输出;
|
|
27
|
+
- Citation/Source 归一化;
|
|
28
|
+
- Image Artifact 输入与 Vision readiness;
|
|
29
|
+
- 单 Tool、多 Tool和有界多轮 Tool;
|
|
30
|
+
- Tool allowlist、参数校验、Execution Grant 与二次授权;
|
|
31
|
+
- 审批 pending、approved、rejected 与恢复;
|
|
32
|
+
- 用户取消、deadline、Provider/Tool 失败和任务取消;
|
|
33
|
+
- Provider Attempt、Usage、容量与 deployment attestation。
|
|
103
34
|
|
|
104
|
-
|
|
105
|
-
|
|
35
|
+
业务模块只能声明稳定 Operation Key、输入/输出 Schema、Feature、Permission、可用 Tool 和
|
|
36
|
+
Provider Data Policy。业务代码不持有 Provider Key,不导入 Runtime 私有类型,也不能直接
|
|
37
|
+
访问 Agent Server。
|
|
106
38
|
|
|
107
|
-
|
|
39
|
+
Provider 调用前会执行:
|
|
108
40
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
41
|
+
1. 当前 Actor、Feature、License、RBAC 与数据范围 Guard;
|
|
42
|
+
2. Operation Release、Schema、输入 commitment 与 Artifact 授权;
|
|
43
|
+
3. Provider readiness、capacity 和部署事实校验;
|
|
44
|
+
4. outbound envelope DLP 与 Host allowlist;
|
|
45
|
+
5. append-only 出网审计,审计失败则禁止出网。
|
|
114
46
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
真实 HTTP 序列化测试中确认请求体。
|
|
47
|
+
Tool 调用继续由 Windy Server 执行。Agent Server 只收到 opaque Execution Grant;每次 Tool
|
|
48
|
+
都重新校验当前权限、Scope、审批和 receipt,不把 Run 创建时的权限快照当长期授权。
|
|
118
49
|
|
|
119
|
-
##
|
|
50
|
+
## 配置
|
|
120
51
|
|
|
121
|
-
选择 `system.agent`
|
|
122
|
-
在 `.env` 中填写:
|
|
52
|
+
选择 `system.agent` 的项目在本机 `.env` 配置:
|
|
123
53
|
|
|
124
54
|
```dotenv
|
|
125
55
|
PLATFORM_ENABLE_AI=true
|
|
126
|
-
AGENT_SERVER_INTERNAL_TOKEN=<至少 32
|
|
127
|
-
|
|
128
|
-
AGENT_RUN_ENCRYPTION_SECRET=<至少 32 字符的独立随机值>
|
|
129
|
-
AI_ARTIFACT_ENCRYPTION_SECRET=<至少 32 字符的随机值>
|
|
56
|
+
AGENT_SERVER_INTERNAL_TOKEN=<至少 32 字符随机值>
|
|
57
|
+
AGENT_RUN_ENCRYPTION_SECRET=<至少 32 字符随机值>
|
|
130
58
|
QWEN_API_URL=https://dashscope-intl.aliyuncs.com/compatible-mode/v1
|
|
131
|
-
QWEN_API_KEY
|
|
59
|
+
QWEN_API_KEY=<server-only secret>
|
|
132
60
|
QWEN_MODEL=qwen-plus
|
|
133
61
|
AI_PROVIDER_HTTPS_HOST_ALLOWLIST=dashscope-intl.aliyuncs.com
|
|
134
62
|
AI_PROVIDER_CAPABILITIES=text-generation
|
|
135
63
|
AI_PROVIDER_INPUT_MODALITIES=text
|
|
136
|
-
AI_PROVIDER_AUDIT_RETENTION_DAYS=90
|
|
137
|
-
|
|
138
|
-
# 可选安全上限
|
|
139
|
-
# AI_PROVIDER_CONNECT_TIMEOUT_MS=5000
|
|
140
|
-
# AI_PROVIDER_REQUEST_TIMEOUT_MS=60000
|
|
141
|
-
# AI_PROVIDER_MAX_RESPONSE_BYTES=2097152
|
|
142
64
|
```
|
|
143
65
|
|
|
144
|
-
|
|
66
|
+
运行:
|
|
145
67
|
|
|
146
68
|
```bash
|
|
147
69
|
bun run dev:agent
|
|
148
70
|
```
|
|
149
71
|
|
|
150
|
-
`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
缺失的 `.env` 会停止自动修复并由 `windy doctor` 报告,避免覆盖外部 Secret Store 或
|
|
154
|
-
已有部署配置。
|
|
155
|
-
`AI_ARTIFACT_ENCRYPTION_SECRET` 只用于平台签发短时 opaque ArtifactRef,不得复用
|
|
156
|
-
Provider Key。Vision Deployment 需把能力与输入模态显式扩展为
|
|
157
|
-
`text-generation,vision` 和 `text,image`,详见
|
|
158
|
-
[Vision AI Runtime](./vision-ai-runtime.md)。Document profile 的配置与调用链见
|
|
159
|
-
[Document AI Runtime](./document-ai-runtime.md)。
|
|
72
|
+
`QWEN_*`、allowlist 和 Provider deployment facts 只进入 Agent Server,不进入 Web、浏览器
|
|
73
|
+
Bundle、业务 Tool 或更新报告。缺少 URL、Key 或 Model 时,Runtime 使用
|
|
74
|
+
`UnavailableEngineAdapter` 返回稳定 unavailable,不尝试猜测 Provider 或降级到其它 Engine。
|
|
160
75
|
|
|
161
|
-
|
|
162
|
-
|
|
76
|
+
公网 Provider 必须是 HTTPS 且 Host 精确命中 allowlist。本机、Compose 服务名和私有网络
|
|
77
|
+
Endpoint 可以使用 HTTP;重定向、DNS 解析和最终连接仍受网络策略约束。
|
|
163
78
|
|
|
164
|
-
|
|
79
|
+
## Vision
|
|
165
80
|
|
|
166
|
-
|
|
167
|
-
GET http://agent-server:8080/health/live
|
|
168
|
-
GET http://agent-server:8080/health/ready
|
|
169
|
-
GET http://agent-server:8080/health/provider-governance
|
|
170
|
-
```
|
|
81
|
+
Vision 不能只根据模型名称或 Endpoint 可达性开启。部署必须声明:
|
|
171
82
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
`providerDataPolicy`。升级后缺少策略会在 Manifest Composition 阶段以
|
|
181
|
-
`Provider 字段发送 allowlist 缺失` fail fast,不会静默发送或降级放行。
|
|
182
|
-
|
|
183
|
-
迁移时先枚举业务 input schema 中确实需要出境的最小 JSON Pointer;为每个字段声明
|
|
184
|
-
分类与 `reject/redact`。再枚举 outbound envelope:无 Tool 的单轮问答通常只需要
|
|
185
|
-
`instructions` 和 `user-prompt`;Tool schema、模型上一轮 Tool Call 和 Tool result
|
|
186
|
-
分别需要 `tool-definitions`、`provider-output`、`tool-results`。不要为消除启动错误
|
|
187
|
-
一次性允许全部字段。原始 input 会在进入 `prepare` 前裁剪,因此 Handler 必须只依赖
|
|
188
|
-
allowlist 中的字段。
|
|
189
|
-
|
|
190
|
-
Agent profile 还必须挂载 `AI_PROVIDER_AUDIT_STORE_PATH`。create-windy Starter 使用
|
|
191
|
-
`/app/data/agent/provider-audit.sqlite3` 并复用单副本持久卷;自行维护 Compose 的项目
|
|
192
|
-
需要显式补齐该变量。未配置时 Provider 启动 fail closed,并给出缺失变量名。
|
|
193
|
-
|
|
194
|
-
## Developer-only ADK Web
|
|
195
|
-
|
|
196
|
-
ADK Web 使用独立 profile 调试真实 canonical Run。项目先在 project-owned 的
|
|
197
|
-
`apps/agent-server/project/adk-web-debug.json` 选择一个文本 Operation:
|
|
198
|
-
|
|
199
|
-
```json
|
|
200
|
-
{
|
|
201
|
-
"schemaVersion": 1,
|
|
202
|
-
"textOperation": {
|
|
203
|
-
"key": "your-module.copilot.global",
|
|
204
|
-
"dataActorId": "user_dev_admin"
|
|
205
|
-
}
|
|
206
|
-
}
|
|
83
|
+
```dotenv
|
|
84
|
+
AI_PROVIDER_CAPABILITIES=text-generation,vision
|
|
85
|
+
AI_PROVIDER_INPUT_MODALITIES=text,image
|
|
86
|
+
AI_PROVIDER_DEPLOYMENT_IDENTITY=windy-deployment-v1_<uuid-v4>
|
|
87
|
+
AI_PROVIDER_RELEASE_DIGEST=sha256:<64-lowercase-hex>
|
|
88
|
+
AI_PROVIDER_READINESS_TTL_SECONDS=60
|
|
89
|
+
AI_PROVIDER_MAX_CONCURRENT_RUNS=1
|
|
90
|
+
AI_PROVIDER_MAX_QUEUE_DEPTH=0
|
|
207
91
|
```
|
|
208
92
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
当前 Scope。Windy 不接受第二份权限、Scope 或 Tool 列表。用户不存在、权限闭包不足、
|
|
213
|
-
Operation 未知或不符合文本契约时明确拒绝,不回退成伪造回答。
|
|
93
|
+
Agent Server 以固定合成图片执行 bounded readiness,不读取客户 Artifact。实际 Run 只接受平台
|
|
94
|
+
签发、当前 Actor 仍可访问的 ArtifactRef;浏览器不能提交任意 URL、宿主路径或 Base64 来绕过
|
|
95
|
+
存储授权。Vision 输入模态和 Artifact 数量会进入脱敏 Trajectory,图片内容不会进入报表。
|
|
214
96
|
|
|
215
|
-
|
|
97
|
+
## 持久化与 Engine 兼容
|
|
216
98
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
```
|
|
99
|
+
生产 Run 必须使用持久 Store。SQLite 仅支持单副本;多副本必须配置共享 PostgreSQL Store。
|
|
100
|
+
每个 Run 和 Runtime Report 保存稳定 Engine ID:
|
|
220
101
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
`safe_debug` 仍保留为不接业务的纯 ADK UI smoke。`canonical_debug` 能验证真实数据、
|
|
249
|
-
模型与 Tool 链,但 ADK Web 显示的是“dispatcher → canonical Run”,不是另一进程内部
|
|
250
|
-
完整的 Prompt/Agent/Workflow 节点图。完整 workflow replay 需要另行定义版本化调试
|
|
251
|
-
协议,不能从当前事件摘要推断。
|
|
252
|
-
|
|
253
|
-
### 业务调试会话 V1
|
|
254
|
-
|
|
255
|
-
业务模块可通过 `ModuleHost.registerDebugSessionProviders()` 把已有会话投影到
|
|
256
|
-
`canonical_debug` 的原生 ADK Web 会话列表。该能力是 developer-only 的通用只读
|
|
257
|
-
接缝,不是业务会话 Repository,也不定义 Copilot、案件或其它领域 DTO:
|
|
258
|
-
|
|
259
|
-
- Provider 必须以本模块命名空间注册,并绑定至少一个本模块 Agent Operation;
|
|
260
|
-
`featureKey` 与 `permissionKey` 必须与绑定 Operation 完全一致,`auditAction` 必须
|
|
261
|
-
已在同一 Manifest 声明。
|
|
262
|
-
- `list()` 和 `get()` 只接收 Host 投影的当前业务用户、当前配置的唯一 Operation、
|
|
263
|
-
分页上限、不透明 cursor 与 `AbortSignal`。Provider 应使用稳定 keyset 分页,并在
|
|
264
|
-
自身 Service/Repository 边界内再次执行对象级授权,只返回完成态的 `user` /
|
|
265
|
-
`assistant` 文本。
|
|
266
|
-
- Server 只向 ADK Web 暴露
|
|
267
|
-
`GET /api/agent/debug/sessions/v1` 与
|
|
268
|
-
`GET /api/agent/debug/sessions/v1/:sessionId`。两条路径复用专用 Debug Bearer,
|
|
269
|
-
每次请求都重做 License、Feature 与 RBAC Guard;其它 Method 不在 Token 白名单。
|
|
270
|
-
- 业务 `sourceId` 只用于 Provider 回查。Host 签发绑定“投影业务用户 + Operation +
|
|
271
|
-
Provider + sourceId”的 HMAC 不透明 ID;详情读取先重新 list 并重新授权,再调用
|
|
272
|
-
`get()`,不会把可逆 ID、Actor ID、Operation Key、Provider Key 或业务范围 ID
|
|
273
|
-
返回 ADK。
|
|
274
|
-
- Provider 每页最多返回 100 个会话,Host 会沿不透明 cursor 读取完成后再交给原生
|
|
275
|
-
ADK 列表,不静默丢弃第 101 条及更旧会话;任一分页或 Provider 失败都会拒绝整份
|
|
276
|
-
业务列表,避免把 partial 结果伪装成完整结果。详情最多 64 条消息,单条最多
|
|
277
|
-
16,000 字符,总计最多 128,000 字符。重复条目、循环游标、超界、乱序、未知角色、
|
|
278
|
-
非法时间或 Provider 异常均安全拒绝。
|
|
279
|
-
|
|
280
|
-
ADK 2.5 通过官方 `services.py` Service Registry 加载 `windy-debug://v1` composite
|
|
281
|
-
Session Service。普通 ADK session 继续保存在进程内 `InMemorySessionService`;业务
|
|
282
|
-
会话在每次详情读取时重新授权并转换为 ADK `Session/Event` 的实时只读投影,不在
|
|
283
|
-
ADK 本地固化,也不复制 Tool、Citation、Run ID、内部
|
|
284
|
-
Operation 或业务对象标识。平台列表暂时不可用时仍返回普通本地 session;已选择的导入
|
|
285
|
-
session 详情不可用时明确失败。
|
|
286
|
-
|
|
287
|
-
导入 session 在 V1 中严格只读:PATCH/rename 与新消息都会在 `append_event()` 拒绝,
|
|
288
|
-
在 canonical Tool 再做一次防御性拒绝;DELETE 只在当前 ADK Web 进程创建本地 tombstone,
|
|
289
|
-
不会删除业务历史。刷新进程后 tombstone 消失。要继续提问必须新建普通本地 ADK
|
|
290
|
-
session;由于当前 canonical bridge 输入仍只有 `{ question }`,平台不会把历史文本冒充
|
|
291
|
-
成业务 continuation。真正的历史续问需要后续版本定义通用、受权限治理的高层
|
|
292
|
-
Operation 契约。
|
|
293
|
-
|
|
294
|
-
## 客户端协议
|
|
295
|
-
|
|
296
|
-
浏览器继续使用 `@southwind-ai/ai-client` 访问同源 Windy Server:
|
|
102
|
+
- 新 Run:`windy.direct.openai-compatible.v1`;
|
|
103
|
+
- 历史 Run:保留原始 `google.adk.v2` 值,只读兼容。
|
|
104
|
+
|
|
105
|
+
历史 Run/Event/Result/Report、业务会话和 Client Agent Session 不会因 Engine 迁移而重写。
|
|
106
|
+
已终止历史 Run 可继续读取。旧 Engine 的中断 Run 不允许由 Direct Engine 从内部状态续跑,
|
|
107
|
+
会稳定失败并要求创建新 Run,避免跨实现重复执行 Tool 副作用。
|
|
108
|
+
|
|
109
|
+
## 主站 Run 与 Trajectory
|
|
110
|
+
|
|
111
|
+
统一入口为 `/admin/system/ai-runtime`。列表、详情和脱敏 Trajectory 同时要求 Feature
|
|
112
|
+
`system.ai-runtime` 与 Permission `system.ai-runtime.read`,并按当前 Actor 数据范围过滤。
|
|
113
|
+
|
|
114
|
+
Trajectory 从 canonical Event 投影,只展示:
|
|
115
|
+
|
|
116
|
+
- Run 开始、Engine ID 和输入模态;
|
|
117
|
+
- Model Attempt/Usage 的安全汇总;
|
|
118
|
+
- Tool Key、审批状态和受控 Artifact 数量;
|
|
119
|
+
- 失败码、取消和唯一终态。
|
|
120
|
+
|
|
121
|
+
它不展示输入输出正文、Prompt、chain-of-thought、完整 Tool 参数、Secret、内部 Actor ID 或
|
|
122
|
+
Provider 原始 body。越权与不存在统一返回 404,读取会写入关键审计。
|
|
123
|
+
|
|
124
|
+
## 历史业务会话
|
|
125
|
+
|
|
126
|
+
业务模块通过 `ModuleHost.registerAgentSessionProviders()` 注册 V1 只读投影。Provider 必须
|
|
127
|
+
绑定本模块 Manifest 已声明的 Agent Operation;Host 复用该 Operation 的 Feature、Permission
|
|
128
|
+
和数据范围。主站接口:
|
|
297
129
|
|
|
298
130
|
```text
|
|
299
|
-
|
|
300
|
-
GET
|
|
301
|
-
GET /api/agent/runs/:runId/result
|
|
302
|
-
POST /api/agent/runs/:runId/cancel
|
|
131
|
+
GET /api/agent/sessions/v1
|
|
132
|
+
GET /api/agent/sessions/v1/:sessionId
|
|
303
133
|
```
|
|
304
134
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
135
|
+
接口使用当前登录身份,不接受专用服务 Token。Session ID 是 Host 生成的 opaque HMAC ID,
|
|
136
|
+
不会暴露 Provider Key 或业务 `sourceId`。列表有界分页,详情每次重新授权;Provider 失败时
|
|
137
|
+
整份结果 fail closed,不返回可能不完整或跨范围的混合列表。
|
|
308
138
|
|
|
309
|
-
|
|
310
|
-
|
|
139
|
+
旧 `registerDebugSessionProviders()` 仅作为一个兼容发布周期的 deprecated alias,内部调用
|
|
140
|
+
同一注册表,不再有独立调试语义。
|
|
311
141
|
|
|
312
|
-
##
|
|
142
|
+
## Client Agent Session 与 PageAgent
|
|
313
143
|
|
|
314
|
-
|
|
315
|
-
|
|
144
|
+
服务端 Engine 迁移不改变 Client Agent Session。PageAgent 仍通过
|
|
145
|
+
`/api/agent/client-sessions/**` 的短时能力与 Host Auth Adapter 工作,Provider 凭据留在服务端,
|
|
146
|
+
客户端只获得受当前 Actor、Operation、Tool 和 origin 约束的会话。Client receipt、取消、
|
|
147
|
+
Usage、审计和历史读取继续使用既有 canonical DTO。
|
|
316
148
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
149
|
+
PageAgent 是浏览器宿主本地 Loop,不会被服务端 Direct Engine 接管,也不能借此扩展
|
|
150
|
+
Server Operation 的 Tool、Scope 或 Secret。完整契约见
|
|
151
|
+
[Client Agent Session](./client-agent-session.md)。
|
|
152
|
+
|
|
153
|
+
## 迁移与故障恢复
|
|
154
|
+
|
|
155
|
+
从 `create-windy@0.6.13` 更新到 `0.6.14` 时,updater 删除未漂移的 Windy-managed ADK
|
|
156
|
+
Compose/脚本;客户修改过的 managed 文件形成冲突。project-owned debug JSON 和普通 `.env`
|
|
157
|
+
只进入不含值的人工清理报告,不自动删除或改写。
|
|
322
158
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
的本机调试。自动化部署应把已审阅的 `latest` 替换为精确版本。
|
|
159
|
+
详细操作、重复故障和快速恢复见
|
|
160
|
+
[ADK 退役与 Direct Engine 恢复](../operations/adk-retirement.md)。
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agent 写 Tool 审批与恢复
|
|
2
|
+
|
|
3
|
+
`approval: "required"` 是执行协议,不是 Prompt 提示。模型请求写 Tool 后,平台先重新校验当前 Actor、Operation、Feature、Permission、License、Scope 和输入 Schema,再创建 Workflow Work Item;Handler 在审批通过前不会收到调用。
|
|
4
|
+
|
|
5
|
+
## Manifest
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
{
|
|
9
|
+
key: "case.finding.merge",
|
|
10
|
+
operation: "command",
|
|
11
|
+
approval: "required",
|
|
12
|
+
approvalRoles: [{ code: "case-reviewer", name: "案件审核员" }],
|
|
13
|
+
approvalTimeoutSeconds: 86_400,
|
|
14
|
+
idempotency: "required",
|
|
15
|
+
// permissionKey / featureKey / auditAction / schema / limits ...
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
审批 Tool 必须显式声明非空候选角色、正整数等待上限和
|
|
20
|
+
`idempotency: "required"`;查询 Tool 不能要求审批。
|
|
21
|
+
|
|
22
|
+
## 运行语义
|
|
23
|
+
|
|
24
|
+
1. Provider 发起 Tool Call。Agent Runtime 以 Run、Tool Key 和规范化参数生成稳定
|
|
25
|
+
`toolCallId`,Provider 重试或 Runtime 恢复不会改变该标识。
|
|
26
|
+
2. Tool Host 只接受内部认证与平台签发的 Execution Grant,并使用当前服务端 Actor
|
|
27
|
+
重新执行 Operation 与 Tool Guard。
|
|
28
|
+
3. `approval=required` 创建持久化 Work Item。Run 发出
|
|
29
|
+
`approval.required(workItemId, toolCallId)` 并进入 `awaiting-approval`。
|
|
30
|
+
4. Runtime 轮询同一 Tool Call。批准后再次执行全部 Guard 与 Schema 校验;拒绝、取消
|
|
31
|
+
和超时发出 `approval.resolved`,随后 Run 安全失败,不执行副作用。
|
|
32
|
+
5. 批准后 Handler 收到 `context.idempotencyKey === toolCallId`。业务写入必须同时使用该
|
|
33
|
+
键与领域 `expectedVersion`,不能信任模型或浏览器传入的 `approved=true`。
|
|
34
|
+
|
|
35
|
+
Tool Host 对同一进程内的相同 Run/Tool Call 做 single-flight 和结果复用。Agent Run Store
|
|
36
|
+
加密保存未完成调用上下文;服务重启时以 `run.resumed` 恢复,稳定 Tool Call 标识保证
|
|
37
|
+
同一审批与业务幂等键被复用。终态后立即清除加密调用上下文。
|
|
38
|
+
|
|
39
|
+
## 事件与错误
|
|
40
|
+
|
|
41
|
+
- `approval.required`
|
|
42
|
+
- `approval.resolved`,`outcome` 为 `approved`、`rejected`、`cancelled` 或
|
|
43
|
+
`timed-out`
|
|
44
|
+
- `tool.completed`
|
|
45
|
+
- 唯一 `run.completed`、`run.failed` 或 `run.cancelled`
|
|
46
|
+
|
|
47
|
+
内部审批响应使用稳定代码 `APPROVAL_REQUIRED`、`APPROVAL_REJECTED`、
|
|
48
|
+
`APPROVAL_CANCELLED`、`APPROVAL_TIMED_OUT` 和 `APPROVAL_UNAVAILABLE`,不透传
|
|
49
|
+
Workflow 或业务异常正文。
|
|
50
|
+
|
|
51
|
+
## 部署
|
|
52
|
+
|
|
53
|
+
生产 Agent Store 必须配置独立的至少 32 字节密钥:
|
|
54
|
+
|
|
55
|
+
```dotenv
|
|
56
|
+
AGENT_RUN_STORE_PATH=/app/data/agent/runs.sqlite3
|
|
57
|
+
AGENT_RUN_ENCRYPTION_SECRET=
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
密钥丢失时未完成 Run fail closed,不能以明文回退。当前 SQLite Store 是单副本恢复面;
|
|
61
|
+
多副本共享 Store、不可变 Release、评估和完整观测关联见 Agent 生产运行文档。
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Actor-aware 后台 AI Operation
|
|
2
|
+
|
|
3
|
+
## 适用范围
|
|
4
|
+
|
|
5
|
+
业务模块可以在 Durable Handler 中调用本模块 Manifest 已声明的、无 Tool 的 Agent
|
|
6
|
+
Operation。首个用例是浏览器关闭后继续生成 Copilot 滚动摘要。该 Port 不替代业务会话、
|
|
7
|
+
消息、摘要版本或结果写入 Repository。
|
|
8
|
+
|
|
9
|
+
`system.agent` 因此依赖 `system.scheduler`。没有启用 AI Runtime 时,普通业务和任务
|
|
10
|
+
Worker 仍可启动;调用后台 AI Port 会得到稳定的
|
|
11
|
+
`AI_OPERATION_UNAVAILABLE`。
|
|
12
|
+
|
|
13
|
+
## SDK
|
|
14
|
+
|
|
15
|
+
`ModuleDurableHandlerContext.ai.enqueueOperation()` 只接受:
|
|
16
|
+
|
|
17
|
+
- `operationKey`:必须属于当前模块;
|
|
18
|
+
- `input`:最小 JSON 输入,仍执行 Manifest allowlist 与 DLP;
|
|
19
|
+
- `idempotencyKey`:由业务来源和版本组成的稳定幂等键;
|
|
20
|
+
- 可选 `timeoutSeconds`:1 至 900 秒。
|
|
21
|
+
|
|
22
|
+
返回 `{ runId, output }`。业务应在同一事务中用会话或摘要的 expected-version 写入结果,
|
|
23
|
+
防止较旧任务覆盖用户已经更新的摘要。
|
|
24
|
+
|
|
25
|
+
## 授权和恢复
|
|
26
|
+
|
|
27
|
+
Job 提交时,宿主保存当前 Actor 与授权范围快照。每次执行、重试和租约恢复都会重新解析
|
|
28
|
+
当前 Actor,并检查范围未变化。实际创建或重新连接 Run 时还会重新执行 Operation 的
|
|
29
|
+
Feature、Permission、License、Provider 数据策略、出网策略、输入/输出上限和审计。
|
|
30
|
+
|
|
31
|
+
业务模块不能传入 Actor,不能跨模块调用 Operation,也不能接触 Provider Secret、
|
|
32
|
+
Execution Grant、Remote Runtime 或平台 Repository。
|
|
33
|
+
|
|
34
|
+
后台 Operation 必须声明 `allowedToolKeys: []`。这样租约丢失或任务重试只会通过相同
|
|
35
|
+
幂等键恢复同一个 Run,不会扩大写 Tool 的重复副作用窗口。
|
|
36
|
+
|
|
37
|
+
## 状态与错误
|
|
38
|
+
|
|
39
|
+
Durable Handler 等待同一 Run 的终态:
|
|
40
|
+
|
|
41
|
+
- `completed`:读取受控 JSON 结果;
|
|
42
|
+
- `failed`:返回 `AI_OPERATION_FAILED`,保留安全的 retryable 语义;
|
|
43
|
+
- `cancelled`:返回不可重试的 `AI_OPERATION_CANCELLED`;
|
|
44
|
+
- 超时:请求取消远端 Run,返回可重试的 `AI_OPERATION_TIMEOUT`;
|
|
45
|
+
- 权限、模块或 Tool 约束不满足:返回不可重试的
|
|
46
|
+
`AI_OPERATION_DENIED`。
|
|
47
|
+
|
|
48
|
+
平台服务重启后,Run 授权绑定和 Agent Store 都从 PostgreSQL 恢复。Worker 重试使用相同
|
|
49
|
+
幂等键,因此不会新建 Run。租约丢失时不主动取消远端 Run,后继 Worker 可以继续恢复;
|
|
50
|
+
用户取消或显式超时才请求远端取消。
|