{
  "description": "Two synthetic mailboxes, one deterministic HTTP client, three drills.",
  "package": {
    "name": "@firedrill-tools/tool-gmail",
    "version": "0.1.0",
    "sha256": "sha256:a4cefb1295f8a71115441199f272781159046209aaa974ae4a3851c1275b3ef2"
  },
  "files": {
    "firedrill/baseline.scenario.json": {
      "schemaVersion": 1,
      "id": "baseline",
      "title": "Two empty synthetic mailboxes"
    },
    "firedrill/client.target.json": {
      "schemaVersion": 1,
      "target": {
        "id": "deterministic-email-client",
        "kind": "command",
        "bindings": [
          "http"
        ],
        "executable": "node",
        "arguments": [
          "client.mjs"
        ],
        "workingDirectory": ".",
        "timeoutMs": 10000
      }
    },
    "firedrill/rate-limit-safety.drill.json": {
      "schemaVersion": 1,
      "id": "rate-limit-safety",
      "title": "A rejected send leaves the synthetic inbox unchanged",
      "targetId": "deterministic-email-client",
      "scenarioId": "rate-limited",
      "actorId": "email-client",
      "task": {
        "instruction": "Send one email to sam@example.test with the subject Invoice received.",
        "input": {
          "to": [
            "sam@example.test"
          ],
          "subject": "Invoice received",
          "body": "I received the invoice. Thank you."
        }
      },
      "assertions": [
        {
          "id": "send-was-rejected",
          "kind": "operation.count",
          "operation": {
            "packageId": "gmail",
            "operationId": "messages.send"
          },
          "outcomes": [
            "tool_error"
          ],
          "comparison": {
            "operator": "equals",
            "value": 1
          }
        },
        {
          "id": "recipient-message-count",
          "kind": "state.value",
          "packageId": "gmail",
          "namespace": "mailboxes",
          "rowId": "sam@example.test",
          "path": [
            "messagesTotal"
          ],
          "comparison": {
            "operator": "equals",
            "value": 0
          }
        }
      ]
    },
    "firedrill/rate-limited.scenario.json": {
      "schemaVersion": 1,
      "id": "rate-limited",
      "title": "Sending returns a rate limit",
      "faults": [
        {
          "packageId": "gmail",
          "faultId": "send-rate-limited"
        }
      ]
    },
    "firedrill/send-note-rate-limited.drill.json": {
      "schemaVersion": 1,
      "id": "send-note-rate-limited",
      "title": "A rate limit prevents the requested delivery",
      "targetId": "deterministic-email-client",
      "scenarioId": "rate-limited",
      "actorId": "email-client",
      "task": {
        "instruction": "Send one email to sam@example.test with the subject Invoice received.",
        "input": {
          "to": [
            "sam@example.test"
          ],
          "subject": "Invoice received",
          "body": "I received the invoice. Thank you."
        }
      },
      "assertions": [
        {
          "id": "one-send-succeeded",
          "kind": "operation.count",
          "operation": {
            "packageId": "gmail",
            "operationId": "messages.send"
          },
          "outcomes": [
            "ok"
          ],
          "comparison": {
            "operator": "equals",
            "value": 1
          }
        },
        {
          "id": "recipient-message-count",
          "kind": "state.value",
          "packageId": "gmail",
          "namespace": "mailboxes",
          "rowId": "sam@example.test",
          "path": [
            "messagesTotal"
          ],
          "comparison": {
            "operator": "equals",
            "value": 1
          }
        }
      ]
    },
    "firedrill/send-note.drill.json": {
      "schemaVersion": 1,
      "id": "send-note",
      "title": "One send reaches the synthetic inbox",
      "targetId": "deterministic-email-client",
      "scenarioId": "baseline",
      "actorId": "email-client",
      "task": {
        "instruction": "Send one email to sam@example.test with the subject Invoice received.",
        "input": {
          "to": [
            "sam@example.test"
          ],
          "subject": "Invoice received",
          "body": "I received the invoice. Thank you."
        }
      },
      "assertions": [
        {
          "id": "one-send-succeeded",
          "kind": "operation.count",
          "operation": {
            "packageId": "gmail",
            "operationId": "messages.send"
          },
          "outcomes": [
            "ok"
          ],
          "comparison": {
            "operator": "equals",
            "value": 1
          }
        },
        {
          "id": "recipient-message-count",
          "kind": "state.value",
          "packageId": "gmail",
          "namespace": "mailboxes",
          "rowId": "sam@example.test",
          "path": [
            "messagesTotal"
          ],
          "comparison": {
            "operator": "equals",
            "value": 1
          }
        }
      ]
    },
    "firedrill/world.json": {
      "schemaVersion": 1,
      "id": "email-delivery-example",
      "virtualTimeUs": 1789376400000000,
      "actors": [
        {
          "id": "email-client",
          "attributes": {
            "email": "alex@example.test",
            "displayName": "Alex"
          },
          "grants": [
            {
              "packageId": "gmail",
              "operationId": "messages.send"
            }
          ]
        }
      ],
      "state": [
        {
          "action": "upsert",
          "packageId": "gmail",
          "namespace": "mailboxes",
          "rowId": "alex@example.test",
          "value": {
            "emailAddress": "alex@example.test",
            "displayName": "Alex",
            "historyId": 1,
            "messagesTotal": 0,
            "threadsTotal": 0,
            "sequence": 0
          }
        },
        {
          "action": "upsert",
          "packageId": "gmail",
          "namespace": "mailboxes",
          "rowId": "sam@example.test",
          "value": {
            "emailAddress": "sam@example.test",
            "displayName": "Sam",
            "historyId": 1,
            "messagesTotal": 0,
            "threadsTotal": 0,
            "sequence": 0
          }
        }
      ]
    },
    "firedrill.json": {
      "schemaVersion": 1,
      "sourceRoot": "firedrill",
      "world": "world.json",
      "toolPackages": [
        "@firedrill-tools/tool-gmail"
      ]
    },
    "client.mjs": "// Deterministic fixture client. This sample makes one real HTTP call and uses no model.\nlet input = '';\nfor await (const chunk of process.stdin) input += chunk;\nconst invocation = JSON.parse(input);\nconst response = await fetch(`${process.env.FIREDRILL_HTTP_URL}/gmail/v1/users/me/messages/send`, {\n  method: 'POST',\n  headers: { 'content-type': 'application/json', authorization: `Bearer ${process.env.FIREDRILL_HTTP_TOKEN}`, 'idempotency-key': `${invocation.runId}-${invocation.interactionId}` },\n  body: JSON.stringify(invocation.input),\n});\nconst body = await response.json();\nprocess.stdout.write(JSON.stringify({ httpStatus: response.status, response: body }));\n"
  }
}
