Skip to content

Feature/experimental - #593

Open
leopiccionia wants to merge 419 commits into
developfrom
feature/experimental
Open

leopiccionia wants to merge 419 commits into
developfrom
feature/experimental

Conversation

@leopiccionia

Copy link
Copy Markdown
Collaborator

No description provided.

leopiccionia and others added 30 commits May 19, 2026 13:58
…dary point limits

- Replace static default system prompt with dynamic calibration-aware builder
  (AI_Adapter::get_calibration_aware_prompt) that reads active calibration
  settings (granularity, confidence, title weight, thresholds, max points)
  and injects them into the prompt when no custom prompt is used.

- Add adaptive precision instruction in build_enforced_schema() so the
  confidence calibration rule does not conflict with the JSON schema block.

- Add new calibration controls: Primary Points and Secondary Points
  (ai_cal_primary_max / ai_cal_secondary_max, 1-100, toggle-enabled).
  UI uses single range sliders positioned below their respective thresholds.

- Propagate max-point rules through the AI Prompt Assistant meta-prompt
  so generated custom prompts also respect the configured limits.

- Enforce max limits in post-processing:
  - Frontend sidebar: applyPointLimits() truncates after threshold scoring
  - Bulk processor: array_slice() after relevance classification

- Ensure full compatibility with NeuronAI Structured Output:
  - Update Georeference_Result schema description to be neutral and not
    contradict calibration filtering rules.
  - Fix missing max-point rules in prompt generator calibration block.
  - Remove duplicate boolean sanitization entries for new toggles.

- Update .architecture/ai/README.md to document calibration-aware prompt
  and max-point enforcement.

Files changed:
- class-ai-adapter.php
- class-ai-handler.php
- class-jeo.php
- class-settings.php
- class-bulk-processor.php
- class-georeference-result.php
- tab-provider.php
- settings-page.js
- posts-sidebar/index.js
- .architecture/ai/README.md
Add convention entry explaining that the default AI system prompt is
calibration-aware and listing the 5 locations that must be updated when
adding new calibration controls (adapter, handler, frontend, bulk, schema).
Resolved conflict in class-georeference-result.php:
- Kept remote's array() syntax for consistency
- Kept HEAD's neutral schema description to avoid contradicting
  calibration filtering rules
…d robustness

- Replace hardcoded FileVectorStore topK=3 with configurable ai_rag_topk
  setting (default 10, range 1-50) in JEO AI Settings > Knowledge Base.
  RAG_Agent::vectorStore() reads the setting and falls back to 10.

- Add layer deduplication in RAG_Worker::on_layer_save():
  Layer_Data_Loader now sets Document sourceType='layer' and
  sourceName={post_ID}. Before adding on save, deleteBy() removes
  previous embeddings for the same layer_id.

- Fix minimap-editor.js frontend issues:
  - loadedLayers.length > 0 guard prevents empty-map flash during load
  - Debounce onMove/onZoom (300ms) with lodash to reduce re-renders
  - Simplify layerIds useMemo dependency from JSON.stringify to allLayers

All changes pass PHPCS and PHP syntax checks.
…nd robustness

- Add RAG Vector Store Configuration section to .architecture/ai/README.md
  documenting ai_rag_topk setting and layer deduplication strategy.

- Update .architecture/minimap/README.md conventions with debounced
  map interaction and layer render guard notes.

- Add ai_rag_topk validation note to AGENTS.md Settings Validation.
… recreation

- Add validate_layers() and is_valid_layer() to Minimap class to filter
  out layer IDs returned by the agent that no longer exist or are not
  published map-layer CPTs. Prevents 'ghost' layers in the block.

- Also validate base_layer->id in run_agent() and null it if invalid.

- Remove Map key={key} and the useEffect that recreated the Map on
  align/screen-width changes. The ResizeObserver in maplibregl-react
  already handles container resize, so forced recreation was causing
  unnecessary state loss (pan/zoom reset).

PHPCS clean, PHP syntax verified.
…d.sh

Adds ensure_node_24() that:
- Checks current node -v for v24
- Falls back to NVM (/home/diegosanches/.nvm, ~/.nvm, or shell function)
- Auto-installs Node 24 via nvm if not present
- Fails gracefully with clear message if neither works

Prevents build failures when the shell default Node is not 24.
Introduces foundational infrastructure for converging all AI features
onto the hacklabr/ai-assistant library:

- JEO_AI_Factory: central Assistant builder with shared config,
  provider resolution, storage adapters, and tool wiring.
- Tool_Registry: singleton registering all NeuronAI tools
  (search_layers, geocode, generate_layer, get_post_content).
- AI_REST_Permissions: reusable permission callbacks replacing
  12 inline closures in AI_Handler.
- REST args schemas: added validation to ai-georeference,
  ai-test-key, ai-get-models, ai-test-retrieval, ai-clear-store,
  ai-delete-backup endpoints.
- Minimap_Agent: now consumes tools via Tool_Registry instead
  of hardcoding class names.

All new files pass PHPCS and php -l.
…rsations

Phase 2 of the AI architecture convergence (minilayer excluded per request):

- System_Prompt_Builder: extracts calibration-aware prompt construction,
  schema blocks, and prompt sanitization from AI_Adapter into a reusable,
  testable static class. AI_Adapter methods now delegate to the builder
  and are marked @deprecated.

- AI_Handler::api_test_key: now uses System_Prompt_Builder::for_test_connection()
  instead of a hardcoded prompt string.

- Georeferencing_Conversation: new class managing multi-turn georeferencing
  sessions via ConversationStore + WP_Storage. Supports start, user messages,
  assistant responses, thread trimming (max 20 messages), and session listing.

- REST endpoint: POST /jeo/v1/ai-georeference-chat with full args schema
  (post_id, conversation_id, message, title, content). Enables future
  frontend chat refinement of AI-suggested locations.

- Neuron_Adapter migration to JEO_AI_Factory: deferred to Phase 3 due to
  token-tracking compatibility risks. The infrastructure (factory, registry,
  builder) is now in place to support it safely.

All files pass PHPCS and php -l. Production build verified.
Replaces the direct NeuronAI Agent extension with the unified
hacklabr/ai-assistant Assistant model using declarative MCP config:

- JEO_AI_Factory: added  param to create_assistant() and new
  create_minilayer_assistant() method that passes Mapbox DevKit MCP
  config declaratively to AssistantConfig.

- Minilayer_Agent: refactored from  to a static factory
  that creates Assistant via JEO_AI_Factory. generate() now calls
  Assistant::chat() instead of Agent::chat(). MCP tools are discovered
  automatically by the library via McpConfigBridge.

- Minilayer_Handler: updated to use AI_REST_Permissions::edit_posts()
  and added REST args schema for prompt + layer_name.

- Minilayer_Service: updated to call Minilayer_Agent::generate() static
  method. No behavioral changes.

- Generate_Layer_Tool: unchanged — still delegates to Minilayer_Service.

- AGENTS.md + .architecture/ai/README.md + .architecture/minilayer/README.md:
  updated to document the unified architecture, new files, and MCP
  integration pattern.

All files pass PHPCS and php -l. Production build verified.
PHPCBF auto-fix for spacing and alignment issues.
- Change ai_use_structured_output default from false to true
- Add warning notice listing limitations (no token tracking, auto-fallback, internal tool bypass)
- Add info notice with per-provider recommendations (OpenAI/Gemini/Anthropic = full support; Ollama/HuggingFace = variable)
- Update AGENTS.md with structured output conventions, fallback behavior, Prompt Assistant interaction, and token tracking caveat
…ayer_Handler

The file is in namespace Jeo\AI, so AI\AI_REST_Permissions resolved to
Jeo\AI\AI\AI_REST_Permissions (non-existent). Use unqualified
AI_REST_Permissions instead, which correctly resolves to Jeo\AI\AI_REST_Permissions.

This was causing a fatal error on rest_api_init, breaking all REST endpoints.
Adds a Gutenberg sidebar plugin that suggests new paragraphs for posts
using the site's RAG vector store (jeo_knowledge) and multi-turn AI chat.

Backend:
- Retrieve_Knowledge_Tool: semantic search against jeo_knowledge
- Context_Generation_Output: structured output DTO (paragraphs, references)
- Context_Agent: Assistant factory with post_analyzer sub-agent
- Context_Handler: REST endpoints /context/setup, /chat, /state
- Persist conversation state in post meta for session restoration
- Customizable system prompt via ai_context_prompt setting

Frontend:
- contextSidebar webpack entry with PluginDocumentSettingPanel
- Chat UI with textarea, expand modal, and suggestion cards
- Inline linkify for referenced articles within paragraph text
- Insert (core/paragraph block) and Copy (rich text) actions

Docs:
- Update .architecture/ai/README.md and AGENTS.md
…ettings

- Add ai_use_context_custom_prompt checkbox to enable/disable custom prompt
- Show built-in default prompt as read-only reference when custom is disabled
- Toggle visibility between custom textarea and default reference via JS
- Respect ai_use_context_custom_prompt flag in Context_Agent::system_prompt()
- Update tab-context.php, class-settings.php, and class-context-agent.php
leopiccionia and others added 30 commits September 15, 2026 11:27
Enter submit the chat form. Shift+Enter add a line break
- New sections: navbar, hero, resource slider, features showcase,
  how it works, live demo, workshops, footer
- PT-BR/EN i18n
- Official Lottie animations + code-rebuilt ones
- Hero background video
- Performance optimizations
- Mobile tab UX
- Docs updated
…r fixes — issue #669

- Official photo masters for Mapas and layers: permuted, full-PNG render
  without mattes, 75% glass opacity on upper layers, shadow removal
- Hero mobile order + 32px gap
- Footer responsive below 1400px
- Tab centering on auto-advance
- Disabled workshop form button
- i18n and docs updates
- VitePress 1.6 with brand theme (JEO Maps palette, Open Sans, light/dark logos)
- Directory URL parity with MkDocs via rewrites + cleanUrls
- Internal links migrated to absolute routes
- docs/index.md redirects to the landing (React, outside VitePress)
- docs-site.yml builds with Node and keeps the site/ bot commit
- Remove mkdocs.yml and requirements-docs.txt
- Merge feat/landing-redesign (site-novo/www React landing)
- build:site builds the landing into site/ (base /) and the docs into
  site/docs/; order matters because the landing build empties site/
- Landing docs links point to /docs/
- Remove docs pages that were not in the MkDocs nav (usability-issues)
- docs-site.yml runs the single command and commits site/
Design references (site-novo/figma-ref, CLAUDE.md) stay in site-novo/.
The landing build now outputs to ../site from the new location.
Works in every environment: local preview stays on localhost, production
lands on jeowp.org/. Nav and sidebar Home links point at /docs/ (base
applied) and follow the same redirect.
- Site name is JEO Maps; navbar shows the wordmark logo alone with
  alt text, 40px on mobile and 50px on desktop
- Home links point at the landing page (same tab)
- New Download item in the navbar
- /docs/ redirects to /docs/index-plugin/
- Drop the wordpress.org compliance/audit dev pages
Also point the documentation CTAs at /docs/index-plugin/.
The landing dev server proxies /docs to the VitePress dev server so
both halves of the site share one origin (http://localhost:5173) with
live reload on each side.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants