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,21 @@
## ADDED Requirements
### Requirement: AI JSON responses must use shared candidate extraction
When parsing JSON returned by AI/LLM text generation, the system SHALL use a shared candidate extraction utility that supports object and array contracts, Markdown code fences, `<think>` blocks, surrounding prose, and multiple JSON candidates.
#### Scenario: Thinking text contains a mismatched JSON candidate
- **GIVEN** an AI response contains a `<think>` block with a JSON-like candidate that does not match the business schema
- **AND** the final response body contains a valid JSON object that matches the schema predicate
- **WHEN** the business parser extracts the AI JSON response
- **THEN** it selects the matching final JSON object instead of the thinking candidate
#### Scenario: JSON strings contain bracket characters
- **GIVEN** an AI response contains JSON with string values that include `{`, `}`, `[`, or `]`
- **WHEN** the shared extractor scans for balanced candidates
- **THEN** bracket characters inside strings do not terminate or corrupt the candidate
#### Scenario: Non-AI JSON parsing remains unchanged
- **GIVEN** code parses stored settings, backups, sync payloads, or HTTP API bodies
- **WHEN** those payloads are not AI/LLM free-text responses
- **THEN** the system may continue using direct JSON parsing and does not route them through the AI JSON extractor