{
  "contractType": "agent-runtime-contract",
  "status": "ready",
  "version": "0.1.0",
  "states": [
    {
      "state": "intake",
      "terminal": false,
      "nextStates": [
        "discover",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "discover",
      "terminal": false,
      "nextStates": [
        "baseline",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "baseline",
      "terminal": false,
      "nextStates": [
        "plan",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "plan",
      "terminal": false,
      "nextStates": [
        "review",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "review",
      "terminal": false,
      "nextStates": [
        "verify",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "verify",
      "terminal": false,
      "nextStates": [
        "promote",
        "plan",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "promote",
      "terminal": false,
      "nextStates": [
        "completed",
        "plan",
        "stopped",
        "failed"
      ]
    },
    {
      "state": "completed",
      "terminal": true,
      "nextStates": []
    },
    {
      "state": "stopped",
      "terminal": true,
      "nextStates": []
    },
    {
      "state": "failed",
      "terminal": true,
      "nextStates": []
    }
  ],
  "approvalGates": [
    {
      "from": "review",
      "to": "verify",
      "approval": "human-approved"
    },
    {
      "from": "promote",
      "to": "completed",
      "approval": "human-approved"
    }
  ],
  "toolCallRecord": {
    "required": [
      "id",
      "toolName",
      "status",
      "inputDigest"
    ],
    "stored": "Only compact tool metadata and a digest of caller input are stored; raw tool input and output are excluded."
  },
  "evidenceReference": {
    "required": [
      "id",
      "type",
      "sourceTool",
      "contractType"
    ],
    "stored": "Only compact evidence references and seller-approved summaries are stored; raw HTML, prompts, responses, and private exports are excluded."
  },
  "endpoints": {
    "runtime": "https://www.sellermind.asia/api/agent/runtime",
    "skills": "https://www.sellermind.asia/api/agent/skills",
    "nextAction": "https://www.sellermind.asia/api/agent/runs/{runId}/next-action",
    "createRun": "https://www.sellermind.asia/api/agent/runs",
    "listRuns": "https://www.sellermind.asia/api/agent/runs",
    "advanceRun": "https://www.sellermind.asia/api/agent/runs/{runId}/transitions"
  },
  "skillContract": {
    "catalog": "https://www.sellermind.asia/api/agent/skills",
    "requiredFields": [
      "skillId",
      "version",
      "allowedTools",
      "requiredInputs",
      "approvalPoints",
      "successEvidence",
      "rollbackOrStopRule"
    ],
    "runBinding": "Create a run with skillId to bind the versioned workflow. Explicit allowedTools must be a subset of the skill allowlist."
  },
  "frameworkBoundary": {
    "current": "Zero-dependency Node state machine with NDJSON snapshots and official MCP transport.",
    "futureCandidates": [
      {
        "name": "LangGraph JS",
        "source": "https://github.com/langchain-ai/langgraphjs",
        "fit": "Durable graph checkpoints, retries, and human-in-the-loop when the current state machine needs them."
      },
      {
        "name": "Temporal TypeScript",
        "source": "https://github.com/temporalio/sdk-typescript",
        "fit": "Durable workflow execution when queued scans and long-running external jobs become product requirements."
      },
      {
        "name": "OpenAI Agents JS",
        "source": "https://github.com/openai/openai-agents-js",
        "fit": "Model-backed operator adapter that calls these contracts without owning business rules."
      }
    ],
    "adoptionGate": "Add a heavier framework only after restart-safe multi-step runs, human approval, or queued work exceed the native state machine's operational boundary."
  },
  "quickChallenge": {
    "feasible": "Yes. Existing scan, experiment, and MCP builders can be referenced by opaque tool-call and evidence IDs without duplicating business logic.",
    "necessary": "Yes. An agent needs resumable state, approval gates, and before/after evidence references to avoid repeating scans without proving a change.",
    "rightNow": "Yes for a bounded test environment. Keep the run store compact and single-tenant until authentication, tenant isolation, and retention controls are implemented."
  },
  "dataBoundary": "The run-state contract stores only a bounded goal, public target URL, declared authorization scope, allowed tool names, compact tool-call metadata, evidence references, transition records, and approval decisions. It does not store credentials, raw page HTML, raw prompts, AI responses, uploaded files, cookies, user identifiers, or private ecommerce data."
}