# OEDTP v0.1 Walkthrough

This walkthrough takes an independent organization, Example Org on `example.org`, through the whole v0.1 loop: publish
identity, describe capabilities, register, discover and validate. It needs a static file host with HTTPS, `curl`, and Node
18 or newer. No account, key or service from any particular company is required. Replace `example.org` with your own
domain throughout.

## 1. Publish identity

Create `/.well-known/open-edge.json` on your domain. Name the network, the domain it lives on and who operates it.

```json
{
  "protocol_version": "0.1.0",
  "name": "Example Network",
  "domain": "example.org",
  "operator": { "name": "Example Org", "url": "https://example.org", "contact": "mailto:ops@example.org" },
  "capabilities": [],
  "discovery": {
    "openapi": "https://example.org/openapi.json",
    "llms_txt": "https://example.org/llms.txt"
  }
}
```

Serve it with a JSON media type and open cross-origin access. On most hosts this is a headers file or a server rule:

```
/.well-known/open-edge.json
  Content-Type: application/json
  Access-Control-Allow-Origin: *
```

Check it:

```
curl -si https://example.org/.well-known/open-edge.json | head -n 20
```

`domain` must be exactly the host that serves the file. Use the bare host (no scheme, path or port).

## 2. Describe capabilities

Add one descriptor per capability to `capabilities`. Each says what goes in, what comes out, its version and where to
call it. A descriptor has no pricing or execution fields; add your own under names beginning with `x-` if you want them.

```json
{
  "id": "org.example.translate",
  "version": "1.0.0",
  "summary": "Translate short text between languages",
  "input": {
    "media_type": "application/json",
    "schema": { "type": "object", "required": ["text", "to"], "properties": { "text": { "type": "string" }, "to": { "type": "string" } } }
  },
  "output": { "media_type": "application/json" },
  "interfaces": [
    { "type": "openapi", "url": "https://example.org/openapi.json", "operation_id": "translate" },
    { "type": "http", "url": "https://example.org/v1/translate", "method": "POST" }
  ]
}
```

Interface types are `openapi` (with `operation_id`), `mcp` (with `tool`), `a2a` (with `skill`) and `http` (with
`method`). Every URL your document declares, including those under `discovery`, must answer over HTTPS. For a large
catalog, serve `{ "capabilities": [...] }` at another URL and point to it with `capabilities_url` instead.

## 3. Validate before you register

Run the independent validator. It talks only to your domain:

```
npx oedtp-verify example.org
```

It prints a JSON report and exits with code 0 when every required check passes:

```json
{
  "protocol_version": "0.1.0",
  "suite_version": "0.1.0",
  "target": "https://example.org",
  "result": "pass",
  "summary": { "pass": 17, "fail": 0, "warn": 0, "skip": 2 },
  "checks": [
    { "id": "I-1", "requirement": "The identity document is served over HTTPS at /.well-known/open-edge.json with HTTP 200", "result": "pass", "detail": "HTTP 200" }
  ],
  "endorsement": false,
  "security_certification": false
}
```

Each check `id` is a requirement identifier in the specification. Fix any `fail`; a `warn` is a recommendation. Running
the validator twice against the same unchanged site prints the same bytes, so you can keep the report in version control
and compare. Add `--timestamp` to record when it ran.

## 4. Register

Submit your domain to any registry that implements the OEDTP v0.1 registry interface (`registry-openapi.json`). No
account is needed. The registry fetches your identity document from your domain, so you never upload it.

```
curl -s -X POST https://<registry>/v0.1/registry/networks \
  -H "Content-Type: application/json" \
  -d '{"domain":"example.org"}'
```

The answer is your record. `registered` and `validated` are separate: a registry lists you as soon as you register, and
marks you validated only when its validator run passes. Neither means the registry endorses you.

```json
{
  "domain": "example.org",
  "registered": true,
  "validated": true,
  "state": "validated",
  "endorsement": false,
  "validation": { "protocol_version": "0.1.0", "suite_version": "0.1.0", "result": "pass", "failed_checks": [] }
}
```

After you change your document, ask the registry to check again:

```
curl -s -X POST https://<registry>/v0.1/registry/networks/example.org/validate
```

You can register with as many registries as you like, and run your own: the reference registry is in the `oedtp-verify`
package (`createRegistry`), with an in-memory store you can replace with any database.

## 5. Discover

Clients search a registry by capability, state or text:

```
curl -s "https://<registry>/v0.1/registry/networks?capability=org.example.*&state=validated"
```

Or they skip registries and go straight to a domain they already know:

```
curl -s https://example.org/.well-known/open-edge.json
```

Before relying on a registry record, a client fetches the identity document from the domain itself, and can run
`npx oedtp-verify example.org` to repeat the check.

## The reference implementation

Open Edge Network runs the same loop on its own domain:

```
curl -s https://open-edge-network.pages.dev/.well-known/open-edge.json
npx oedtp-verify open-edge-network.pages.dev
```

Its reference registry accepts registrations at `https://api.caelaralabs.com/v0.1/registry/networks`. Using it is
optional. Everything above works with any registry, or none.

Reference implementation powered by Caelara Labs · https://caelaralabs.com
