{
  "name": "PhotoLM Agent API",
  "apiVersion": "1.2.2",
  "description": "Automation metadata for controlling PhotoLM through the browser.",
  "preferredEntrypoint": "navigation",
  "docs": {
    "siteSkill": "site-skill.md",
    "agentApi": "photolm-agent-api.js",
    "llms": "llms.txt"
  },
  "entrypoints": {
    "navigationTask": "/?photolmAgentTask=agent-tasks/agent-smoke.json",
    "navigationPreset": "/?photolmAgentPreset=swiftui-tuition-post",
    "directWindow": "window.PhotoLM",
    "directAlias": "window.photolm"
  },
  "status": {
    "selector": "#photolm-agent-state",
    "dataset": "document.documentElement.dataset.photolmAgentStatus",
    "event": "photolm:agent-state",
    "doneValue": "done",
    "errorValue": "error"
  },
  "recommendedPolling": {
    "selector": "#photolm-agent-state",
    "previewSelector": "#photolm-agent-export-preview",
    "metadata": "JSON.parse(document.querySelector(\"#photolm-agent-state\").textContent).polling",
    "intervalMs": 500,
    "timeoutMs": 120000,
    "doneValue": "done",
    "errorValue": "error",
    "failOnlyOn": [
      "state.status === \"error\"",
      "polling timeout exceeded"
    ]
  },
  "preview": {
    "selector": "#photolm-agent-export-preview",
    "metadata": "#photolm-agent-export-preview.dataset.meta",
    "visualReviewRequired": true
  },
  "automationRecovery": {
    "blockedDocs": "If Chrome reports ERR_BLOCKED_BY_CLIENT for raw docs, fetch the docs with a terminal/http client.",
    "staleTab": "After interruption or browser session changes, discard old tab handles and reacquire a fresh Chrome tab.",
    "pageWorldIsolation": "If window.PhotoLM is unavailable from automation, use the navigation task URL and poll hidden DOM state.",
    "launchTimeout": "If a navigation/evaluate command times out while launching a task, poll #photolm-agent-state before treating it as failure.",
    "preferredLaunch": "Use browser navigation or the address bar for URL autorun. Avoid long Runtime.evaluate launches when possible."
  },
  "humanoidPacing": {
    "defaultLayerDelayMs": 220,
    "defaultLayerDelayJitterMs": 140,
    "description": "Layer-like agent steps pause briefly before adding or moving layers so visible builds feel human-paced instead of robotic.",
    "disable": "Set layerDelayMs or photolmAgentLayerDelay to 0 for fastest execution."
  },
  "helpers": [
    "PhotoLM.agent.status()",
    "PhotoLM.agent.preview()",
    "PhotoLM.agent.waitForDone({ timeout: 120000 })",
    "PhotoLM.agent.manifest()",
    "PhotoLM.agent.runFromUrl(url, options)",
    "PhotoLM.agent.runTask(task, options)"
  ],
  "sampleTasks": [
    "agent-tasks/agent-smoke.json",
    "agent-tasks/swiftui-tuition-post.json",
    "agent-tasks/imagegen-upload-sample.json"
  ],
  "urlParameters": {
    "photolmAgentTask": "Path to a JSON or text task that should run after page load.",
    "photolmAgentPreset": "Preset name to run after page load.",
    "photolmAgentTimeout": "Command timeout in milliseconds.",
    "photolmAgentExport": "Set false to suppress task export.",
    "photolmAgentPreview": "Set false to suppress the hidden export preview.",
    "photolmAgentDownload": "Set true to trigger a browser download.",
    "photolmAgentFormat": "Export format such as png, jpg, webp, or psd.",
    "photolmAgentExportName": "Export filename used by downloads and metadata.",
    "photolmAgentStepDelay": "Delay between visible task steps in milliseconds.",
    "photolmAgentLayerDelay": "Small delay before layer-like steps in milliseconds; defaults to 220 for human-paced visual builds.",
    "photolmAgentLayerDelayJitter": "Random jitter range for layer-like step delay in milliseconds; defaults to 140.",
    "photolmAgentSettleMs": "Delay before export in milliseconds."
  },
  "constraints": [
    "Navigation task URLs are the most reliable route for sandboxed browser agents.",
    "Direct window.PhotoLM access is supported when the automation context can reach page-world globals.",
    "A short browser automation launch timeout is not a task failure until hidden DOM state reports error or polling times out.",
    "Export success means a file was generated; agents must inspect the preview before finalizing visual deliverables.",
    "Local filesystem paths are not readable by the web page unless an agent provides browser-available bytes, a same-origin URL, a CORS-readable URL, or a data URL."
  ]
}
