feat(cloud): add targeted task governance foundation
Tests / Test passed: 659

This commit is contained in:
2026-07-13 22:21:12 +08:00
parent a3ba94be04
commit 2cd314b183
41 changed files with 2099 additions and 15 deletions
@@ -0,0 +1,50 @@
## MODIFIED Requirements
### Requirement: Pluggable dual-provider tool-calling abstraction
The system SHALL support at least two interchangeable LLM providers
(Anthropic native tool use and OpenAI function calling) for the AI Planner's
decision calls, selectable via configuration, with both providers constrained
to return exactly one tool call per request. Independently of provider
selection, the system SHALL support at least two transports for making that
decision call -- direct-to-provider (the tool-calling client calls the
provider's SDK itself, using locally configured credentials) and cloud-proxy
(the tool-calling client calls the Cloud Control Plane's planner-decision
endpoint, which calls the provider using cloud-held credentials) -- selectable
via configuration without requiring any change to `AIPlanner`'s own decision
logic. A provider decision result SHALL also carry available non-secret
provider token-usage metadata so outer Cloud adapters can meter calls without
changing that decision logic.
#### Scenario: Provider selected via configuration
- **WHEN** the AI Planner is configured with a given provider identifier
- **THEN** it constructs and uses the tool-calling client for that provider
without requiring any change to `AIPlanner`'s own decision logic
#### Scenario: Provider response resolves to a single decision
- **WHEN** either supported provider returns a response to a tool-calling
request
- **THEN** the response is parsed into exactly one tool name and one arguments
object, regardless of which provider produced it
#### Scenario: Transport selected via configuration
- **WHEN** the Host Agent is configured with a given transport (direct or
cloud-proxy)
- **THEN** `AIPlanner` is constructed with the tool-calling client for that
transport, and its own decision logic is unchanged regardless of which
transport is in effect
#### Scenario: Direct transport remains available and default
- **WHEN** no transport is explicitly configured
- **THEN** the AI Planner uses the direct-to-provider transport, matching its
behavior before the cloud-proxy transport existed
#### Scenario: Cloud-proxy transport resolves a decision without a local provider client
- **WHEN** the Host Agent is configured with the cloud-proxy transport
- **THEN** its tool-calling client sends the decision request to the Cloud
Control Plane's planner-decision endpoint instead of constructing a local
Anthropic or OpenAI SDK client
#### Scenario: Provider reports token usage
- **WHEN** a provider response includes input or output token counts
- **THEN** the tool-calling result makes those non-secret counts available to
its outer adapter while `AIPlanner` selects the same single decision