Initial TrueGrowth source import

This commit is contained in:
2026-07-07 09:36:36 +08:00
commit 3b6781d695
2283 changed files with 691996 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
## ADDED Requirements
### Requirement: Preserve Generic GPT Image Basic Compatibility
The system SHALL preserve the existing default image adapter path only for GPT Image requests that resolve to the generic basic image compatibility mode.
#### Scenario: Generic GPT Image generation stays on default adapter
- **GIVEN** a provider profile resolves image API compatibility to `openai-compatible-basic`
- **AND** the selected model is `gpt-image-2`
- **WHEN** the user submits a text-to-image request
- **THEN** the request SHALL use the `openai.image.basic-json` schema
- **AND** SHALL continue to use the existing default image adapter compatibility behavior
#### Scenario: Tuzi GPT Image uses dedicated adapter ownership
- **GIVEN** a provider profile resolves image API compatibility to `tuzi-gpt-image`
- **AND** the user submits an image generation request with reference images
- **WHEN** the request is serialized
- **THEN** the system SHALL route through the dedicated Tuzi GPT Image adapter boundary
- **AND** SHALL NOT hide Tuzi GPT-specific request translation inside the generic default adapter
### Requirement: Support Official GPT Image Generation Adapter
The system SHALL provide a dedicated GPT Image adapter for provider profiles that resolve to the official GPT Image format.
#### Scenario: Official GPT Image text-to-image request
- **GIVEN** a provider profile resolves image API compatibility to `openai-gpt-image`
- **AND** the selected image model is a GPT Image model
- **WHEN** the user submits a text-to-image request
- **THEN** the system SHALL route the request to the GPT Image adapter
- **AND** SHALL send a generation request to `/images/generations`
- **AND** SHALL NOT default `response_format` to `url`
#### Scenario: Official GPT Image response parsing
- **GIVEN** the GPT Image adapter receives a response containing `data[].b64_json`
- **WHEN** the response is parsed
- **THEN** the system SHALL normalize the image into the existing image result shape
- **AND** SHALL support URL-based gateway variants without failing valid responses
### Requirement: Keep Image Generation Task Surface Stable
The system SHALL keep the current image task and tool surface stable for this change.
#### Scenario: GPT Image compatibility does not create a new task type
- **GIVEN** a user submits a GPT Image generation request
- **WHEN** the task is created
- **THEN** it SHALL remain a `TaskType.IMAGE` task
- **AND** SHALL continue through the existing task queue, media library, and canvas insertion flows
#### Scenario: GPT Image compatibility does not require a new tool name
- **GIVEN** an agent or workflow invokes image generation
- **WHEN** GPT Image compatibility routing is applied
- **THEN** the invocation SHALL continue to use the existing image generation tool surface
- **AND** SHALL NOT require a new public `edit_image` tool for this change

View File

@@ -0,0 +1,67 @@
## ADDED Requirements
### Requirement: Resolve Image API Compatibility Per Provider Profile
The system SHALL resolve image API compatibility from the selected provider profile before inferring an image request schema.
#### Scenario: Same GPT Image model uses different contracts by profile
- **GIVEN** two enabled provider profiles both expose `gpt-image-2`
- **AND** the first profile has image API compatibility `tuzi-gpt-image`
- **AND** the second profile has image API compatibility `openai-gpt-image`
- **WHEN** the user invokes image generation with a `ModelRef` pointing to either profile
- **THEN** the system SHALL resolve the image compatibility from that profile
- **AND** SHALL allow the same `modelId` to produce different request schemas by `profileId`
#### Scenario: Manual compatibility overrides automatic inference
- **GIVEN** a provider profile has image API compatibility set to a non-`auto` value
- **WHEN** image binding inference runs for that profile
- **THEN** the system SHALL use the manually selected compatibility mode
- **AND** SHALL NOT replace it with an automatically inferred mode
### Requirement: Infer Automatic Image Compatibility Conservatively
The system SHALL support an `auto` image API compatibility mode that infers a compatibility mode from provider profile metadata and the selected model.
#### Scenario: Official OpenAI GPT Image auto inference
- **GIVEN** a provider profile uses an `api.openai.com` base URL
- **AND** the selected image model ID starts with `gpt-image`
- **AND** the profile image API compatibility is `auto`
- **WHEN** the system infers image compatibility
- **THEN** it SHALL resolve to the OpenAI GPT Image format
#### Scenario: Tuzi auto inference selects dedicated Tuzi GPT mode
- **GIVEN** a provider profile uses an `api.tu-zi.com` base URL
- **AND** the profile image API compatibility is `auto`
- **WHEN** the system infers image compatibility
- **THEN** it SHALL resolve to the Tuzi GPT image format
- **AND** SHALL keep the request eligible for the dedicated Tuzi GPT Image adapter path
#### Scenario: Generic OpenAI-compatible auto inference
- **GIVEN** a provider profile is `openai-compatible` or `custom`
- **AND** it is not recognized as official OpenAI or Tuzi
- **AND** the profile image API compatibility is `auto`
- **WHEN** the system infers image compatibility
- **THEN** it SHALL resolve to the generic OpenAI-compatible image format
### Requirement: Map Image Compatibility To Request Schema
The system SHALL map the resolved image API compatibility mode to the request schema used by provider routing.
#### Scenario: OpenAI GPT Image compatibility selects GPT schema
- **GIVEN** a GPT Image model invocation resolves to OpenAI GPT Image compatibility
- **WHEN** the provider binding is inferred
- **THEN** the binding SHALL use `openai.image.gpt-generation-json`
- **AND** SHALL be eligible for the GPT Image adapter
#### Scenario: Basic compatibility selects existing schema
- **GIVEN** a GPT Image model invocation resolves to generic OpenAI-compatible image compatibility
- **WHEN** the provider binding is inferred
- **THEN** the binding SHALL use `openai.image.basic-json`
- **AND** SHALL be eligible for the existing default image adapter