{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "metadata": {
    "appName": "ForgeCurves by Forgeboro",
    "version": "1.0.0",
    "description": "ForgeCurves: The browser-native computational notebook for matrix math, curve fitting, and machine learning.",
    "website": "https://forgecurves.com",
    "support_email": "support@forgeboro.com",
    "documentation_url": "https://forgecurves.com/help.html",
    "specVersion": "1.0.0"
  },
  "runtime_bridge": {
    "window_attachment": "window.__FORGECURVES_AGENT_SPEC__",
    "methods": [
      {
        "name": "getSpec",
        "description": "Returns the full machine-readable agent specification."
      },
      {
        "name": "listActions",
        "description": "Returns list of supported DOM actions with selectors."
      },
      {
        "name": "triggerAction",
        "description": "Dispatches synthetic click or event targeting a data-action element.",
        "parameters": {
          "action": "string (e.g. 'run-all', 'add-code-cell', 'open-help', 'open-about')",
          "details": "optional object with action-specific payload"
        }
      },
      {
        "name": "getShortcuts",
        "description": "Returns list of registered keyboard shortcuts."
      }
    ]
  },
  "dom_hooks": {
    "tools": [
      {
        "id": "header-bar",
        "selector": "[data-tool=\"header-bar\"]",
        "description": "Top application header housing branding, theme toggle, help, and about triggers."
      },
      {
        "id": "notebook-sidebar",
        "selector": "[data-tool=\"notebook-sidebar\"]",
        "description": "Left library sidebar managing notebook files, state backup, and restoration."
      },
      {
        "id": "notebook-canvas",
        "selector": "[data-tool=\"notebook-canvas\"]",
        "description": "Central interactive notebook workspace displaying sequential code and markdown cells."
      },
      {
        "id": "variable-inspector",
        "selector": "[data-tool=\"variable-inspector\"]",
        "description": "Right sidebar listing active workspace variables, matrices, dimensions, and memory size."
      },
      {
        "id": "code-cell",
        "selector": "[data-tool=\"code-cell\"]",
        "description": "Interactive Octave script execution cell with syntax highlighting and output console."
      },
      {
        "id": "markdown-cell",
        "selector": "[data-tool=\"markdown-cell\"]",
        "description": "Rich narrative documentation cell with live KaTeX math formula rendering."
      },
      {
        "id": "matrix-viewer",
        "selector": "[data-tool=\"matrix-viewer\"]",
        "description": "Modal grid inspector for 2D matrices, heatmaps, and numerical exports."
      },
      {
        "id": "help-modal",
        "selector": "[data-tool=\"help-modal\"]",
        "description": "In-app documentation and keyboard shortcut cheat sheet dialog."
      },
      {
        "id": "about-modal",
        "selector": "[data-tool=\"about-modal\"]",
        "description": "Forgeboro Foundry About page dialog with canonical brand tokens and shown version."
      },
      {
        "id": "model-card-modal",
        "selector": "[data-tool=\"model-card-modal\"]",
        "description": "Trained Machine Learning model inspector dialog showing architecture metadata, hyperparameters, confusion matrix, loss curves, and export actions."
      }
    ],
    "actions": [
      {
        "id": "open-help",
        "selector": "[data-action=\"open-help\"]",
        "category": "navigation",
        "description": "Opens the in-app interactive documentation and keyboard shortcut modal."
      },
      {
        "id": "open-about",
        "selector": "[data-action=\"open-about\"]",
        "category": "navigation",
        "description": "Opens the Forgeboro Foundry About page modal."
      },
      {
        "id": "toggle-left-sidebar",
        "selector": "[data-action=\"toggle-left-sidebar\"]",
        "category": "navigation",
        "description": "Toggles visibility of the notebook library sidebar."
      },
      {
        "id": "toggle-right-sidebar",
        "selector": "[data-action=\"toggle-right-sidebar\"]",
        "category": "navigation",
        "description": "Toggles visibility of the workspace variable inspector."
      },
      {
        "id": "toggle-theme",
        "selector": "[data-action=\"toggle-theme\"]",
        "category": "navigation",
        "description": "Switches between light and dark visual themes."
      },
      {
        "id": "run-all",
        "selector": "[data-action=\"run-all\"]",
        "category": "execution",
        "description": "Sequentially executes all executable code cells in the active notebook."
      },
      {
        "id": "interrupt-kernel",
        "selector": "[data-action=\"interrupt-kernel\"]",
        "category": "execution",
        "description": "Halts running computational tasks in the current Octave session."
      },
      {
        "id": "restart-kernel",
        "selector": "[data-action=\"restart-kernel\"]",
        "category": "execution",
        "description": "Clears kernel session memory and re-initializes workspace variables."
      },
      {
        "id": "clear-outputs",
        "selector": "[data-action=\"clear-outputs\"]",
        "category": "execution",
        "description": "Clears standard output streams and rendered SVG plots across all cells."
      },
      {
        "id": "add-code-cell",
        "selector": "[data-action=\"add-code-cell\"]",
        "category": "authoring",
        "description": "Appends a new Octave executable code cell to the active notebook."
      },
      {
        "id": "add-markdown-cell",
        "selector": "[data-action=\"add-markdown-cell\"]",
        "category": "authoring",
        "description": "Appends a new Markdown text cell with KaTeX math rendering support."
      },
      {
        "id": "export-backup",
        "selector": "[data-action=\"export-backup\"]",
        "category": "transfer",
        "description": "Generates and downloads a cryptographically signed HMAC backup file (HMAC-SHA256)."
      },
      {
        "id": "restore-backup",
        "selector": "[data-action=\"restore-backup\"]",
        "category": "transfer",
        "description": "Triggers file input to restore and verify an HMAC-signed backup archive."
      },
      {
        "id": "new-notebook",
        "selector": "[data-action=\"new-notebook\"]",
        "category": "authoring",
        "description": "Creates a new empty Octave notebook in the library."
      },
      {
        "id": "export-m",
        "selector": "[data-action=\"export-m\"]",
        "category": "transfer",
        "description": "Exports a trained Machine Learning model as an executable standalone GNU Octave/MATLAB .m script function."
      },
      {
        "id": "export-onnx",
        "selector": "[data-action=\"export-onnx\"]",
        "category": "transfer",
        "description": "Exports a trained Machine Learning model definition as a standard portable ONNX JSON specification."
      },
      {
        "id": "open-privacy",
        "selector": "[data-action=\"open-privacy\"]",
        "category": "compliance",
        "description": "Opens the AdSense-compliant Privacy Policy dialog."
      },
      {
        "id": "open-terms",
        "selector": "[data-action=\"open-terms\"]",
        "category": "compliance",
        "description": "Opens the Terms of Service & Computational Sandbox Disclaimer modal."
      },
      {
        "id": "open-cookie-preferences",
        "selector": "[data-action=\"open-cookie-preferences\"]",
        "category": "compliance",
        "description": "Opens the Cookie Consent & Preferences Management dialog."
      }
    ]
  },
  "shortcuts": [
    {
      "combo": "Shift + Enter",
      "description": "Run selected cell and advance to next cell",
      "context": "Editor"
    },
    {
      "combo": "Ctrl + Enter",
      "description": "Run selected cell in place",
      "context": "Editor"
    },
    {
      "combo": "Alt + Enter",
      "description": "Run selected cell and insert new cell below",
      "context": "Editor"
    },
    {
      "combo": "?",
      "description": "Open interactive Help & Shortcuts modal",
      "context": "Global"
    },
    {
      "combo": "Escape",
      "description": "Close modals or blur cell editor",
      "context": "Global"
    }
  ],
  "dataSchemas": {
    "OctaveNotebook": {
      "type": "object",
      "required": ["id", "title", "cells"],
      "properties": {
        "id": { "type": "string" },
        "title": { "type": "string" },
        "cells": { "type": "array" },
        "createdAt": { "type": "string" },
        "updatedAt": { "type": "string" }
      }
    },
    "WorkspaceVariable": {
      "type": "object",
      "required": ["name", "type", "dimensions", "sizeBytes"],
      "properties": {
        "name": { "type": "string" },
        "type": { "type": "string" },
        "dimensions": { "type": "string" },
        "sizeBytes": { "type": "number" },
        "summary": { "type": "string" }
      }
    }
  }
}

