# laling-account/team-pal architecture

> Architecture diagram of the GitHub repository laling-account/team-pal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/laling-account/team-pal
- Repository: https://github.com/laling-account/team-pal

## Overview

The tree and sampled sources indicate a WordPress installation containing a PHP AI Client SDK; the README instead describes TEAM PAL and a tourism-management project, so it does not substantiate that product workflow. The clearest supported runtime workflow is AI prompt input, model configuration and provider selection, generation, then typed result conversion. WordPress’s admin, content, REST, theme, and style-engine areas are meaningful additional subsystems, but the excerpts do not establish their runtime wiring. The diagram therefore separates these branches and limits edges to relationships visible in the excerpts or source index.

Main entry points: [`wp-includes/php-ai-client/src/Builders/PromptBuilder.php`](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Builders/PromptBuilder.php) (Prompt builder), [`wp-includes/php-ai-client/src/AiClient.php`](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/AiClient.php) (AI client facade), [`wp-includes/ai-client/class-wp-ai-client-prompt-builder.php`](https://github.com/laling-account/team-pal/blob/main/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php) (WordPress AI builder), [`wp-includes/php-ai-client/src/Providers/ProviderRegistry.php`](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/ProviderRegistry.php) (Provider registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ai_api["AI Client API"]
  node_wp_ai_builder["WordPress AI builder"]
  node_ai_client["AI client facade<br/>[AiClient.php]"]
end

subgraph group_ai_runtime["AI Generation Runtime"]
  node_prompt_builder["Prompt builder<br/>[PromptBuilder.php]"]
  node_provider_registry["Provider registry"]
  node_model_contract["Model contract<br/>[ModelInterface.php]"]
  node_model_config["Model configuration<br/>[ModelConfig.php]"]
  node_ai_dtos["AI data types"]
  node_ai_result["Generation result"]
end

subgraph group_wp_content["WordPress Content"]
  node_wp_query["Content querying<br/>[class-wp-query.php]"]
  node_rest_posts["Posts REST API"]
  node_rest_media["Media REST API"]
  node_theme_templates["Theme templates"]
  node_style_engine["Style engine"]
end

subgraph group_wp_admin["WordPress Administration"]
  node_admin_router["Admin router<br/>[admin.php]"]
  node_link_manager["Link management<br/>[link-manager.php]"]
  node_network_admin["Network admin<br/>[admin.php]"]
  node_network_dashboard["Network dashboard<br/>[index.php]"]
end

node_caller(("Application caller"))
node_ai_provider{{"AI provider"}}

node_caller -.->|"invokes"| node_ai_client
node_caller -.->|"invokes"| node_wp_ai_builder
node_ai_client -->|"delegates to"| node_prompt_builder
node_ai_client -->|"creates default"| node_provider_registry
node_ai_client -->|"accepts"| node_model_config
node_wp_ai_builder -->|"wraps"| node_prompt_builder
node_wp_ai_builder -->|"constructs declarations"| node_ai_dtos
node_prompt_builder -->|"configures"| node_model_config
node_prompt_builder -.->|"selects model via"| node_provider_registry
node_prompt_builder -.->|"executes model"| node_model_contract
node_prompt_builder -.->|"returns"| node_ai_result
node_ai_provider -.->|"registers with"| node_provider_registry
node_admin_router -->|"routes to"| node_link_manager
node_network_admin -->|"routes to"| node_network_dashboard

click node_wp_ai_builder "https://github.com/laling-account/team-pal/blob/main/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php"
click node_ai_client "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/AiClient.php"
click node_prompt_builder "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Builders/PromptBuilder.php"
click node_provider_registry "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/ProviderRegistry.php"
click node_model_contract "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/Models/Contracts/ModelInterface.php"
click node_model_config "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php"
click node_ai_dtos "https://github.com/laling-account/team-pal/tree/main/wp-includes/php-ai-client/src"
click node_ai_result "https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php"
click node_wp_query "https://github.com/laling-account/team-pal/blob/main/wp-includes/class-wp-query.php"
click node_rest_posts "https://github.com/laling-account/team-pal/blob/main/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php"
click node_rest_media "https://github.com/laling-account/team-pal/blob/main/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php"
click node_theme_templates "https://github.com/laling-account/team-pal/blob/main/wp-content/themes/twentytwentyfive/patterns/template-query-loop.php"
click node_style_engine "https://github.com/laling-account/team-pal/blob/main/wp-includes/style-engine/class-wp-style-engine.php"
click node_admin_router "https://github.com/laling-account/team-pal/blob/main/wp-admin/admin.php"
click node_link_manager "https://github.com/laling-account/team-pal/blob/main/wp-admin/link-manager.php"
click node_network_admin "https://github.com/laling-account/team-pal/blob/main/wp-admin/network/admin.php"
click node_network_dashboard "https://github.com/laling-account/team-pal/blob/main/wp-admin/network/index.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wp_ai_builder,node_ai_client toneBlue
class node_prompt_builder,node_provider_registry,node_model_contract,node_model_config,node_ai_dtos,node_ai_result toneAmber
class node_wp_query,node_rest_posts,node_rest_media,node_theme_templates,node_style_engine toneMint
class node_admin_router,node_link_manager,node_network_admin,node_network_dashboard toneRose
class node_caller,node_ai_provider toneIndigo
```

## Components

### AI Client API

- [WordPress AI builder](https://github.com/laling-account/team-pal/blob/main/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php): `wp-includes/ai-client/class-wp-ai-client-prompt-builder.php`
- [AI client facade](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/AiClient.php): `wp-includes/php-ai-client/src/AiClient.php`

### AI Generation Runtime

- [Prompt builder](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Builders/PromptBuilder.php): `wp-includes/php-ai-client/src/Builders/PromptBuilder.php`
- [Provider registry](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/ProviderRegistry.php): `wp-includes/php-ai-client/src/Providers/ProviderRegistry.php`
- [Model contract](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/Models/Contracts/ModelInterface.php): `wp-includes/php-ai-client/src/Providers/Models/Contracts/ModelInterface.php`
- [Model configuration](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php): `wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php`
- [AI data types](https://github.com/laling-account/team-pal/tree/main/wp-includes/php-ai-client/src): `wp-includes/php-ai-client/src`
- [Generation result](https://github.com/laling-account/team-pal/blob/main/wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php): `wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php`

### WordPress Content

- [Content querying](https://github.com/laling-account/team-pal/blob/main/wp-includes/class-wp-query.php): `wp-includes/class-wp-query.php`
- [Posts REST API](https://github.com/laling-account/team-pal/blob/main/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php): `wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php`
- [Media REST API](https://github.com/laling-account/team-pal/blob/main/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php): `wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php`
- [Theme templates](https://github.com/laling-account/team-pal/blob/main/wp-content/themes/twentytwentyfive/patterns/template-query-loop.php): `wp-content/themes/twentytwentyfive/patterns/template-query-loop.php`
- [Style engine](https://github.com/laling-account/team-pal/blob/main/wp-includes/style-engine/class-wp-style-engine.php): `wp-includes/style-engine/class-wp-style-engine.php`

### WordPress Administration

- [Admin router](https://github.com/laling-account/team-pal/blob/main/wp-admin/admin.php): `wp-admin/admin.php`
- [Link management](https://github.com/laling-account/team-pal/blob/main/wp-admin/link-manager.php): `wp-admin/link-manager.php`
- [Network admin](https://github.com/laling-account/team-pal/blob/main/wp-admin/network/admin.php): `wp-admin/network/admin.php`
- [Network dashboard](https://github.com/laling-account/team-pal/blob/main/wp-admin/network/index.php): `wp-admin/network/index.php`

### Other components

- **Application caller**
- **AI provider**

## Connections

- Application caller → AI client facade: invokes
- Application caller → WordPress AI builder: invokes
- AI client facade → Prompt builder: delegates to (evidence: `wp-includes/php-ai-client/src/AiClient.php`)
- AI client facade → Provider registry: creates default (evidence: `wp-includes/php-ai-client/src/AiClient.php`)
- AI client facade → Model configuration: accepts (evidence: `wp-includes/php-ai-client/src/AiClient.php`)
- WordPress AI builder → Prompt builder: wraps (evidence: `wp-includes/ai-client/class-wp-ai-client-prompt-builder.php`)
- WordPress AI builder → AI data types: constructs declarations (evidence: `wp-includes/ai-client/class-wp-ai-client-prompt-builder.php`)
- Prompt builder → Model configuration: configures (evidence: `wp-includes/php-ai-client/src/Builders/PromptBuilder.php`)
- Prompt builder → Provider registry: selects model via (evidence: `wp-includes/php-ai-client/src/Builders/PromptBuilder.php`)
- Prompt builder → Model contract: executes model (evidence: `wp-includes/php-ai-client/src/Builders/PromptBuilder.php`)
- Prompt builder → Generation result: returns (evidence: `wp-includes/php-ai-client/src/Builders/PromptBuilder.php`)
- AI provider → Provider registry: registers with
- Admin router → Link management: routes to (evidence: `wp-admin/link-manager.php`)
- Network admin → Network dashboard: routes to (evidence: `wp-admin/network/index.php`)
