{
  "publication": {
    "publicationId": "geoffreylitt-field-guide",
    "interfaceVersion": "1.0.0",
    "contentVersion": "1.0.0",
    "fixtureVersion": "1.0.0",
    "rootId": "geoffreylitt-guide",
    "name": "Geoffrey Litt field guide",
    "namespace": "GeoffreyLittGuide"
  },
  "transport": "browser-main-realm",
  "namespace": "window.GeoffreyLittGuide",
  "methods": {
    "discover": {
      "args": [],
      "returns": "identity, revision, ready, targets"
    },
    "inspect": {
      "args": {
        "targetId": "optional string"
      },
      "returns": "identity, revision, data including state"
    },
    "query": {
      "args": {
        "within": "optional string",
        "role": "optional string",
        "name": "optional string"
      },
      "returns": "matchCount, matches"
    },
    "act": {
      "args": {
        "type": "object",
        "required": [
          "publicationId",
          "interfaceVersion",
          "contentVersion",
          "fixtureVersion",
          "pageInstanceId",
          "requestId",
          "expectedRevision",
          "target",
          "action",
          "args"
        ],
        "additionalProperties": false,
        "properties": {
          "publicationId": {
            "const": "geoffreylitt-field-guide"
          },
          "interfaceVersion": {
            "const": "1.0.0"
          },
          "contentVersion": {
            "const": "1.0.0"
          },
          "fixtureVersion": {
            "const": "1.0.0"
          },
          "pageInstanceId": {
            "type": "string"
          },
          "requestId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,80}$"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "match": {
                    "type": "object",
                    "properties": {
                      "within": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "within",
                      "role",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "match"
                ],
                "additionalProperties": false
              }
            ]
          },
          "action": {
            "type": "string"
          },
          "args": {
            "type": "object"
          }
        }
      },
      "returns": "{replayed,receipt}"
    },
    "wait": {
      "args": {
        "type": "object",
        "properties": {
          "pageInstanceId": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "pageInstanceId",
          "requestId"
        ],
        "additionalProperties": false
      },
      "returns": "receipt directly"
    },
    "diagnose": {
      "args": [],
      "returns": "healthy, checks"
    }
  },
  "actionEnvelope": {
    "type": "object",
    "required": [
      "publicationId",
      "interfaceVersion",
      "contentVersion",
      "fixtureVersion",
      "pageInstanceId",
      "requestId",
      "expectedRevision",
      "target",
      "action",
      "args"
    ],
    "additionalProperties": false,
    "properties": {
      "publicationId": {
        "const": "geoffreylitt-field-guide"
      },
      "interfaceVersion": {
        "const": "1.0.0"
      },
      "contentVersion": {
        "const": "1.0.0"
      },
      "fixtureVersion": {
        "const": "1.0.0"
      },
      "pageInstanceId": {
        "type": "string"
      },
      "requestId": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._:-]{1,80}$"
      },
      "expectedRevision": {
        "type": "integer",
        "minimum": 0
      },
      "target": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "match": {
                "type": "object",
                "properties": {
                  "within": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "within",
                  "role",
                  "name"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "match"
            ],
            "additionalProperties": false
          }
        ]
      },
      "action": {
        "type": "string"
      },
      "args": {
        "type": "object"
      }
    }
  },
  "controls": [
    {
      "id": "enrich-note",
      "module": "enrich",
      "role": "textbox",
      "name": "Agenda note",
      "action": "note",
      "event": "input",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "maxLength": 160
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "note"
    },
    {
      "id": "enrich-start",
      "module": "enrich",
      "role": "combobox",
      "name": "Agenda start",
      "action": "start",
      "event": "change",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "09:00",
              "10:00"
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "start"
    },
    {
      "id": "enrich-compute",
      "module": "enrich",
      "role": "button",
      "name": "Compute local agenda",
      "action": "compute",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "enrich-reset",
      "module": "enrich",
      "role": "button",
      "name": "Reset lesson",
      "action": "reset",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "trace-path",
      "module": "trace",
      "role": "combobox",
      "name": "Trace fixture",
      "action": "path",
      "event": "change",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "terminating",
              "repeat"
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "path"
    },
    {
      "id": "trace-next",
      "module": "trace",
      "role": "button",
      "name": "Inspect next trace frame",
      "action": "next",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "trace-diagnosis",
      "module": "trace",
      "role": "combobox",
      "name": "Diagnosis from inspected frames",
      "action": "diagnosis",
      "event": "change",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "finished",
              "cycle"
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "diagnosis"
    },
    {
      "id": "trace-explain",
      "module": "trace",
      "role": "button",
      "name": "Check local diagnosis",
      "action": "explain",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "trace-reset",
      "module": "trace",
      "role": "button",
      "name": "Reset lesson",
      "action": "reset",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "quiz-low",
      "module": "quiz",
      "role": "combobox",
      "name": "Subtotal 46 plus shipping 5",
      "action": "low",
      "event": "change",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "eligible",
              "not-eligible"
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "low"
    },
    {
      "id": "quiz-edge",
      "module": "quiz",
      "role": "combobox",
      "name": "Subtotal exactly 50",
      "action": "edge",
      "event": "change",
      "argsSchema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "not-eligible",
              "eligible"
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "field": "edge"
    },
    {
      "id": "quiz-check",
      "module": "quiz",
      "role": "button",
      "name": "Check both predictions",
      "action": "check",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    },
    {
      "id": "quiz-reset",
      "module": "quiz",
      "role": "button",
      "name": "Reset lesson",
      "action": "reset",
      "event": "click",
      "argsSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      }
    }
  ],
  "modules": [
    {
      "id": "geoffrey-enrich",
      "key": "enrich",
      "name": "Enrich an existing note",
      "sources": [
        "G01",
        "G03",
        "G08"
      ]
    },
    {
      "id": "geoffrey-trace",
      "key": "trace",
      "name": "Inspect a tiny execution world",
      "sources": [
        "G02",
        "G04"
      ]
    },
    {
      "id": "geoffrey-quiz",
      "key": "quiz",
      "name": "Predict before accepting",
      "sources": [
        "G02",
        "G06"
      ]
    }
  ],
  "outputs": [
    {
      "id": "enrich-status",
      "module": "enrich",
      "role": "status",
      "field": "status"
    },
    {
      "id": "enrich-result",
      "module": "enrich",
      "role": "log",
      "field": "result",
      "empty": "No local result yet."
    },
    {
      "id": "trace-status",
      "module": "trace",
      "role": "status",
      "field": "status"
    },
    {
      "id": "trace-result",
      "module": "trace",
      "role": "log",
      "field": "result",
      "empty": "No local result yet."
    },
    {
      "id": "quiz-status",
      "module": "quiz",
      "role": "status",
      "field": "status"
    },
    {
      "id": "quiz-result",
      "module": "quiz",
      "role": "log",
      "field": "result",
      "empty": "No local result yet."
    }
  ],
  "errors": {
    "INVALID_REQUEST": "Use the exact JSON-shaped envelope and no extra keys.",
    "WRONG_PUBLICATION": "Discover the correct guide.",
    "WRONG_INSTANCE": "Rediscover after reload.",
    "REQUEST_ID_REUSE": "Use a new request ID for changed data.",
    "REQUEST_LIMIT": "Reload after 4096 retained IDs; exact replays still work.",
    "VERSION_MISMATCH": "Use discovered versions.",
    "UNKNOWN_TARGET": "Use an ID from discovery.",
    "AMBIGUOUS_TARGET": "Reset lesson exists in three regions. Choose an exact ID or module scope.",
    "UNKNOWN_ACTION": "Use the action declared for this control.",
    "INVALID_ARGUMENTS": "Use exact args schema, without coercion.",
    "STALE_REVISION": "Inspect and submit a fresh request ID at the current revision.",
    "CONTROL_UNAVAILABLE": "Read availability reason; change the relevant lesson state.",
    "UNKNOWN_REQUEST": "Wait only for a retained request on this page.",
    "DISPATCH_FAILED": "Inspect diagnostics and reload; no successful effect is claimed.",
    "RENDER_FAILED": "State may have changed; inspect and reload. No rollback is promised.",
    "EMPTY_NOTE": "Write a supported minute-and-label agenda line.",
    "UNPARSED_LINE": "Use a positive integer from 1 to 120 followed by m, a space and a label.",
    "TRACE_END": "Reset or check the completed trace.",
    "INSUFFICIENT_TRACE": "Inspect all three frames.",
    "WRONG_DIAGNOSIS": "Compare the last frame with the earlier goal, stack and bindings.",
    "PREDICTION_MISMATCH": "Exclude shipping and retain the inclusive threshold."
  },
  "receiptLimit": 4096,
  "example": "const api = window.GeoffreyLittGuide;\nconst d = api.discover();\nif (!d.ready) throw new Error('Guide is not ready');\nconst identity = { publicationId: d.publicationId, interfaceVersion: d.interfaceVersion,\n  contentVersion: d.contentVersion, fixtureVersion: d.fixtureVersion, pageInstanceId: d.pageInstanceId };\nconst current = api.inspect({ targetId: 'geoffrey-enrich' });\nconst request = { ...identity, requestId: 'example.reset.1', expectedRevision: current.revision,\n  target: { id: 'enrich-reset' }, action: 'reset', args: {} };\nconst { replayed, receipt } = api.act(request);\nconst settled = api.wait({ pageInstanceId: identity.pageInstanceId, requestId: request.requestId });\n// settled is the receipt directly, not { receipt }. Inspect receipt.ok and receipt.error.\napi.inspect({ targetId: 'geoffrey-enrich' });",
  "limitations": [
    "All exercises are deterministic, synchronous page-memory examples, with no real models, interpreters, network calls or persistence.",
    "The agenda grammar and trace are deliberately bounded; they do not reproduce Potluck or a Prolog implementation.",
    "A two-question prediction exercise is not evidence of durable learning or safe production deployment.",
    "Research prototypes and team products are credited to their authors and organizations, not assigned to Litt alone."
  ]
}
