SOCIAL MEDIA MANAGER (Phase 3)
================================

Upload to:
- studio1live.com/ashley/media/socialmediamanager/

Open:
- https://studio1live.com/ashley/media/socialmediamanager/public/

What's new in Phase 3:
- Bulk import multiple drafts
- Queue + scheduling via publish_at
- Publish Now (single article) and Publish Due (all due queued items)
- Writes:
  publish_dir/<slug>/index.html
  and updates posts_index_path (posts.json)

IMPORTANT: Site paths
- publish_dir and posts_index_path should be absolute server paths.
  Example (cPanel): /home/YOURCPANELUSER/public_html/blog
  Example posts index: /home/YOURCPANELUSER/public_html/blog/posts.json

Cron (optional):
- Add a cron job to hit:
  https://.../api/publish_due.php
  every 5-15 minutes.

OpenAI draft generator (optional):
- Set openai_api_key in app/config.php

DB:
- storage/app.sqlite


PHASE 4A1 ADD-ON: SHARE PACKS
============================

- Share Packs are auto-created after an article is published (or via cron).
- Each Share Pack contains: caption + link + hashtags (TagX output).
- Use Share Packs tab to copy/paste to your social pages.

Cron endpoint:
- /api/share_due.php

Settings:
- Use Settings tab to enable/disable auto-creation and default platforms.


PHASE 5: JacAI Router Commands + Voice
=====================================

New tab: JacAI Console
- Type: "write post about ..." to create a draft (uses OpenAI if configured)
- Type: "publish latest" to publish
- Type: "make share pack for latest" to generate a social share pack
- Type: "tagx latest" to extract hashtags/keywords

Voice:
- Mic button uses browser SpeechRecognition (if supported)
- Speak button reads JacAI replies aloud (SpeechSynthesis)

API endpoint:
- /api/jacai.php

Cron (optional):
- Use /api/publish_due.php and /api/share_due.php as before.


PHASE 6: TOOL REGISTRY + MEDIA ASSETS
====================================

Tool Registry:
- App -> Tools tab
- Add tools like openai_text, openai_image, openai_video, webhook.
- Store base_url, model, api_key in tool config.

Media Assets:
- In Article Editor, use Media section:
  - Generate Image (requires openai_image tool with API key)
  - Upload Image/Video (works now)
- Media files stored in /storage/media/

Security:
- storage/media/.htaccess blocks PHP execution and indexing.



PHASE 7A + 7B: IMAGE EDITOR + VIDEO GENERATOR (OPENAI)
======================================================

Image AI Edit
- Tool: openai_image
- Edits endpoint: https://api.openai.com/v1/images/edits
- In Article Editor -> Media list -> click "AI Edit" on an image.

Crop/Resize
- In Article Editor -> Media list -> click "Crop/Resize"
- Saves a new image in /storage/media/ (keeps original too).

Video Generation (Sora)
- Tool: openai_video
- Create job: POST https://api.openai.com/v1/videos (async)
- Status: GET https://api.openai.com/v1/videos/{video_id}
- In Article Editor -> click Generate Video -> it creates a pending media item.
- Click Refresh Status on that video until it downloads to /storage/media/.

Docs:
- Images API: https://platform.openai.com/docs/api-reference/images
- Videos API: https://platform.openai.com/docs/api-reference/videos

