Different pipes. One standard.

Начните вводить запрос.

Поиск работает прямо в браузере по статическому индексу, собранному вместе с сайтом (Pagefind). Ваш запрос никуда не отправляется.

Протокол HTTP Pipe

Описывает, как удалённый сервис работает в роли пайпа (шага обработки данных): клиент узнаёт контракт, открывает сессию, а затем отправляет входы и читает выходы обычными параллельными HTTP-запросами. Итог определяется статусом сессии, а не кодом ответа.

Коротко

Идентификатор
openflange.org/http/v0.1 — открывается по адресу https://openflange.org/http/v0.1/
Статус
Экспериментально
Версия
v0.1 (документ 0.1.0-draft), последняя · все версии
Обновлено
Схемы
Связанные
Пайп · CLI
Форматы
HTML (эта страница) · Открыть в формате Markdown (на английском) · лицензия CC BY 4.0

Нормативным является английский текст

Ниже приведена спецификация «OpenFlange HTTP Pipe Protocol» на языке оригинала — английском. Нормативную силу имеет только английский текст; краткое описание и подписи на этой странице носят справочный характер.

This specification defines how an OpenFlange pipe is offered and used as a remote HTTP service: clients discover pipe definitions, open an execution session, POST each input stream and GET each output stream as independent concurrent requests. It also defines the session status resource that is the authoritative outcome, and the rules for expiry, cancellation and credentials.

This document is published at https://openflange.org/http/v0.1. Its identifier, openflange.org/http/v0.1, is that URL without the scheme, and is the value documents of this kind carry in spec:.

At a glance #

Minimal example #

Open a session, then stream. The smallest session request and a sufficient response:

json
{"inputs": ["records"], "outputs": ["valid", "rejected"], "parameters": {}}
json
{"sessionId": "example-session", "expiresAt": "2026-12-03T10:16:00Z"}

Then, concurrently: POST {base}/sessions/example-session/inputs/records (the request body is the stream), GET {base}/sessions/example-session/outputs/valid and …/outputs/rejected (the response bodies are the streams), and finally GET {base}/sessions/example-session for the outcome.

1. Introduction #

The HTTP Pipe Protocol lets a pipe run as an independent service. A client — normally a runner executing a node with implementation.type: http — discovers the pipe's contract, opens an execution session, and then streams each input as the body of a POST and reads each output as the body of a GET. Every port is its own ordinary HTTP request; requests overlap in time. There is no WebSocket, no custom framing and no multiplexing beyond what HTTP itself provides, so the protocol can be exercised with curl.

Discovery (what pipes exist, what their contracts are) is deliberately separate from execution (sessions).

1.1 Conventions #

The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY and OPTIONAL are to be interpreted as described in RFC 2119 and RFC 8174 when, and only when, they appear in capitals.

Fenced examples whose info string contains openflange:<kind> are normative and machine-checked against the schemas in schemas/: http-pipe-list-v0.1, http-pipe-definition-v0.1, http-session-request-v0.1, http-session-response-v0.1, http-session-status-v0.1 and error-v0.1.

1.2 Citing this document #

Normative statements are cited by section number, for example http/v0.1 §4.2, and numbered or bulleted rules within a section by their position, for example http/v0.1 §4.2(3). Section numbers are stable within v0.1: sections are appended, never renumbered. Every heading has a stable fragment identifier derived from its text (lower-cased; characters other than letters, digits, spaces, hyphens and underscores removed; spaces replaced by hyphens), so a section is addressable as https://openflange.org/http/v0.1#<fragment>. Cross-references to other OpenFlange specifications are absolute URLs of that form. This document does not rely on images; its diagrams are text.

2. Terminology and maturity #

The terms pipe, source, sink, pipeline, subpipeline, node, port, stream, run and dataset are defined in the Pipe specification, section 2; workflow is reserved and not used here. In this document:

  • server — the HTTP service hosting one or more pipes.
  • client — the party opening sessions; the Go runner is the primary client for v0.1.
  • base ({base}) — the URL prefix under which a server exposes the protocol, without a trailing slash, for example https://pipes.example.com/v1.
  • session — one execution of one pipe on the server: the remote counterpart of a node execution.
  • attachment — one HTTP request bound to one port of a session.
Feature Maturity
Discovery: pipe list and definition (4) experimental
Sessions: creation, negotiation, static ports (5) experimental
Streaming inputs and outputs over independent requests (6) experimental
Session status as authoritative outcome; OpenFlange-Status trailer (7) experimental
Expiry, cleanup, cancellation (8) experimental
Session tokens and inherited authentication (9) experimental
windows streams proposed (window framing)
Reconnect / resume, dynamic ports, WebSocket transport deferred

Nothing is stable or deprecated in v0.1.

3. Resources #

text
GET    {base}/pipes                                 list pipes
GET    {base}/pipes/{pipeId}                        pipe definition
POST   {base}/pipes/{pipeId}/sessions               open a session
POST   {base}/sessions/{sessionId}/inputs/{port}    stream one input   (request body)
GET    {base}/sessions/{sessionId}/outputs/{port}   stream one output  (response body)
GET    {base}/sessions/{sessionId}                  session status
DELETE {base}/sessions/{sessionId}                  cancel and clean up

Canonical URL construction is normative. A client constructs every URL from {base}, the pipe id, the session id and the port name exactly as shown. The urls object returned at session creation is an informative convenience (useful to humans and to generic tools); a server MUST serve the canonical URLs, and a client MUST NOT depend on urls differing from them.

The session id travels in the path. Credentials travel only in the Authorization header and never in query strings (section 9). The protocol defines no query parameters.

All JSON bodies are UTF-8 application/json. Every response MUST carry Cache-Control: no-store; streaming responses MUST additionally carry X-Accel-Buffering: no (section 6.5).

4. Discovery #

4.1 List #

GET {base}/pipes → 200:

json
{
  "spec": "openflange.org/http/v0.1",
  "pipes": [
    {"id": "validate-email", "version": "0.1.0", "title": "Validate email", "url": "https://pipes.example.com/v1/pipes/validate-email"}
  ]
}

url is the definition URL; it MAY be relative to the list URL. A server exposes one version of each pipe id per base in v0.1; to offer several versions, use several bases.

4.2 Definition #

GET {base}/pipes/{pipeId} → 200: the pipe's definition — the manifest frontmatter as JSON, plus revision.

json
{
  "spec": "openflange.org/pipe/v0.1",
  "id": "validate-email",
  "version": "0.1.0",
  "title": "Validate email",
  "inputs": {
    "records": {"kind": "records"},
    "lookup": {"kind": "records", "required": false}
  },
  "outputs": {
    "valid": {"kind": "records"},
    "rejected": {"kind": "records"},
    "stats": {"kind": "records", "required": false}
  },
  "implementation": {"type": "builtin", "name": "builtin:example/validate-email"},
  "revision": "9f2c1e7"
}
  • The definition is the contract a client compiles against. Its implementation describes the pipe as the server sees it and is informative for clients; a server MAY replace it by an opaque {"type": "builtin", "name": "builtin:<server>/<id>"} so as not to disclose internals. permissions in a definition describe what the server-side pipe needs and are likewise informative: the client-side requirement is network and remoteData for the server's host.
  • revision identifies the deployed implementation (a commit, a build id). A contract version does not guarantee an immutable implementation behind it: the server can redeploy. A server SHOULD report a revision that changes whenever behaviour may have changed, or null when it cannot; clients record it in the lockfile and in run reports.
  • A server SHOULD serve a byte-stable body for an unchanged pipe, because lockfile integrity for remote pipes is computed over this response body.
  • Definitions are not repeated in session responses.

404 if the pipe id is unknown.

5. Sessions #

5.1 Opening a session #

POST {base}/pipes/{pipeId}/sessions with a JSON body:

json
{
  "version": "0.1.0",
  "inputs": ["records"],
  "outputs": ["valid", "rejected"],
  "parameters": {},
  "formats": {
    "inputs": {"records": ["application/x-ndjson"]},
    "outputs": {"valid": ["application/x-ndjson"], "rejected": ["application/x-ndjson"]}
  }
}
Member Meaning
version The exact pipe version, or a SemVer range, the client was compiled against. Optional; when present and not satisfied by the served version the server replies 409.
inputs The input ports the client will attach — the enabled inputs. If omitted: all required inputs.
outputs The output ports the client will read — the enabled outputs. If omitted: all required outputs.
parameters Resolved parameter values. Validated against the definition; a violation is 400 with E_PARAM.
formats Per port, the media types the client can send (inputs) or accept (outputs), in order of preference. A port not mentioned uses the default for its kind.

Ports are static: the set of ports is fixed by the definition, and the enabled subset is fixed at session creation. Every required port of the pipe MUST be listed (or covered by the default); omitting one is 422. The pipe is told the enabled-port set before it processes anything, and an optional port that is not listed needs no attachment — the client never has to read an output it did not ask for.

A client that will not consume a required output still lists it and drains the response (that is what a runner's discard does remotely).

201 Created:

json
{
  "sessionId": "example-session",
  "sessionToken": "c2Vzc2lvbi10b2tlbi1leGFtcGxl",
  "expiresAt": "2026-12-03T10:16:00Z",
  "urls": {
    "self": "https://pipes.example.com/v1/sessions/example-session",
    "inputs": {"records": "https://pipes.example.com/v1/sessions/example-session/inputs/records"},
    "outputs": {
      "valid": "https://pipes.example.com/v1/sessions/example-session/outputs/valid",
      "rejected": "https://pipes.example.com/v1/sessions/example-session/outputs/rejected"
    }
  },
  "formats": {
    "inputs": {"records": "application/x-ndjson"},
    "outputs": {"valid": "application/x-ndjson", "rejected": "application/x-ndjson"}
  }
}
Member Meaning
sessionId Unguessable, URL-safe identifier ([A-Za-z0-9._~-]{1,128}); at least 128 bits of entropy unless a sessionToken is issued.
sessionToken OPTIONAL. A short-lived, opaque bearer token scoped to this session (section 9).
expiresAt RFC 3339 time at which the session expires if it stays idle (section 8).
urls Informative: the canonical URLs, spelled out.
formats The negotiated media type of each enabled port.

The session is pending. The server SHOULD NOT start the pipe until at least one port is attached (a source with no inputs starts on the first output attachment).

5.2 Media negotiation #

For each enabled port the server picks the first media type in the client's list (or the kind's default) that the pipe supports; application/jsonl is an alias of application/x-ndjson. If there is none, session creation fails with 406 (an output) or 415 (an input) and E_MEDIA. Afterwards:

  • an input POST MUST carry the negotiated type in Content-Type (415 otherwise);
  • an output GET MAY carry Accept; if present it MUST admit the negotiated type (406 otherwise). The response Content-Type is the negotiated type.

Servers do not convert between formats on the client's behalf beyond what they advertise; lossy conversion is never implicit.

6. Streaming #

6.1 Inputs #

POST {base}/sessions/{sessionId}/inputs/{port} — the request body is the stream, sent with chunked transfer encoding (HTTP/1.1) or as an open-ended body (HTTP/2). End of the body is end of the stream. The server reads the body as the pipe consumes it; it replies 204 No Content at EOF, once the whole body has been received.

An input with no data is a request with an empty body: a valid, empty, completed stream. This is different from an optional input that was not enabled.

6.2 Outputs #

GET {base}/sessions/{sessionId}/outputs/{port} → 200 with a streaming response body. The response ends normally at end of stream. An output with no data is a 200 with an empty body.

6.3 Concurrency #

Inputs and outputs are attached concurrently, with independent requests.

  • A client MUST NOT wait for the response to an input POST before attaching outputs. The 204 arrives only at input EOF; a pipe that streams needs its outputs read while its inputs are still being written. A correct client opens every enabled output and every enabled input without ordering dependencies between them.
  • A server MUST start streaming outputs before input EOF whenever the pipe produces them (a record-scope pipe emits as it reads). It MUST NOT buffer a whole input, or a whole output, as a matter of protocol.
  • A server MUST accept attachments in any order and MUST hold an early attachment open until the pipe needs it.

6.4 One attachment per port #

Each enabled input has exactly one producer and each enabled output exactly one consumer, for the life of the session. A second attachment to a port — concurrent or subsequent, including after a dropped connection — is rejected with 409. There is no reconnect or resume in v0.1: a broken stream ends the session (8.3).

Attaching to a port that the pipe does not have, or that was not enabled for this session, is 404.

6.5 Buffers, backpressure and intermediaries #

  • Server-side buffers are bounded. A client that reads an output slowly back-pressures the pipe (the server stops writing, the pipe blocks), and through it the inputs (the server stops reading request bodies). Nothing is dropped.
  • Servers MUST flush output data promptly rather than waiting to fill a buffer, so that a slow trickle of records is delivered.
  • Reverse proxies and CDNs commonly buffer responses and sometimes requests, which destroys streaming and backpressure. Responses therefore carry Cache-Control: no-store and X-Accel-Buffering: no, and operators MUST disable request and response buffering for these paths. Compression of streaming responses SHOULD be disabled or configured to flush per chunk.
  • HTTP/1.1 with chunked encoding is sufficient; each attachment then occupies one connection. HTTP/2 multiplexing is OPTIONAL. WebSockets are not used.
  • Browsers. Streaming response bodies can be read incrementally in current browsers, but streaming request bodies are not universally available (and require HTTP/2 where they are). A browser client may therefore be limited to inputs that it can send as a complete body. This is a limitation of the platform, not a protocol mode; v0.1 defines no alternative upload mechanism.

7. Status and outcome #

HTTP commits the status line before the body. A 200 on an output says only that streaming began; it cannot report a failure that happens half-way. Therefore:

The authoritative outcome of a session is GET {base}/sessions/{sessionId}.

json
{
  "sessionId": "example-session",
  "state": "failed",
  "error": {"code": "E_RUNTIME", "message": "validate-email: lookup table is not sorted", "port": "lookup"},
  "expiresAt": "2026-12-03T10:17:05Z",
  "partialOutput": true,
  "ports": {
    "inputs": {"records": {"state": "failed", "records": 1200, "bytes": 81234}},
    "outputs": {
      "valid": {"state": "failed", "records": 1100, "bytes": 74410},
      "rejected": {"state": "failed", "records": 37, "bytes": 3219}
    }
  }
}
  • state is one of pending, running, completed, failed, cancelled, with the meanings of the Pipeline specification, section 8.6. A session is completed only when the pipe finished successfully and every enabled output was delivered to its end.
  • error is present when the state is failed (and SHOULD be present, with E_CANCELLED, when cancelled).
  • ports reports per-port state and counters where the server tracks them.
  • A client MUST consult the status after its streams have ended and MUST treat anything other than completed as a failed node, even if every output body ended cleanly. Data received from a session that did not complete is partial output; it is not rolled back.

Failure during streaming. When a session fails, the server MUST abort every open output response abnormally — a connection reset on HTTP/1.1, a stream reset (RST_STREAM) on HTTP/2 — so that a truncated stream is not mistaken for a complete one by a client that looks only at the body, and SHOULD send the trailer OpenFlange-Status: failed where trailers can be delivered. On normal completion a server MAY send OpenFlange-Status: completed. Trailers are advisory; the session status remains authoritative. Open input requests of a failed session receive an error response if the response has not started.

8. Expiry, cleanup and cancellation #

8.1 Expiry #

  • A session expires at expiresAt only while idle, that is, while it has no attached streams. The default idle time-to-live before the first attachment is 60 seconds. A session with at least one open attachment does not expire for idleness; expiresAt is then advisory and moves forward, and long-running streams are legitimate.
  • A server MAY impose a maximum total session duration and MUST then fail the session with E_TIMEOUT when it is exceeded, rather than silently truncating.
  • A pending session that expires is cleaned up; nothing ran.

8.2 Retention of terminal sessions #

A session that reaches a terminal state is retained for 60 seconds (by default) so that the client can retrieve the outcome. During retention GET of the session returns its final status and port attachments are refused. After retention, and for expired sessions, every URL of the session returns 410 Gone. A server that cannot distinguish "never existed" from "cleaned up" MAY return 404 instead.

8.3 Cancellation and disconnects #

  • DELETE {base}/sessions/{sessionId} cancels a running session, releases its resources and returns 204. It is idempotent: deleting a terminal, expired or already-deleted session is also 204 (or 410 after retention). After a DELETE of a non-terminal session the state is cancelled with E_CANCELLED.
  • A client disconnect on any attached port cancels the session (E_CANCELLED): an input body that ends abnormally, or an output response whose reader goes away before EOF. There is no way to resume, so the remaining work would be wasted or, worse, half-delivered.
  • On cancellation or failure the server stops the pipe, aborts all open attachments, and frees buffers, processes and temporary files in bounded time.
  • A runner that fails or is cancelled MUST DELETE its open sessions.

8.4 Timeouts #

Clients SHOULD apply a connection timeout and an idle-read timeout to each attachment and cancel the session when one fires. Servers SHOULD time out attachments on which no progress is possible. Neither side may treat a time-out as a normal end of stream.

9. Authentication and transport security #

  • Credentials are sent only in Authorization: Bearer <token>. They MUST NOT appear in URLs, query strings or request bodies, and MUST NOT be logged.
  • Session token. If the session response contains sessionToken, the client MUST send it on every request under {base}/sessions/{sessionId}. It is opaque, short-lived and scoped to that one session; a server MUST reject it for any other session (401).
  • Inherited authentication. If the server issues no sessionToken, the credentials the client used to open the session (if any) apply to the session's requests as well.
  • Discovery and session creation MAY require credentials of the deployment's choosing (also as a bearer token). An unauthenticated or wrongly authenticated request is 401 with a WWW-Authenticate: Bearer header.
  • TLS is REQUIRED whenever credentials are sent to a non-loopback host. A client MUST refuse to send a bearer token — its own or a session token — over plain HTTP to anything but a loopback address, and MUST NOT follow a redirect that would carry credentials to another host or downgrade the scheme.
  • Session ids are capabilities when no token is issued; they MUST be unguessable and MUST NOT be logged at a level that would expose them to other tenants.

10. Status codes and errors #

Error responses carry a structured error object (Pipeline specification, section 11) as application/json:

json
{"code": "E_PARAM", "message": "parameter 'strict' must be a boolean", "details": {"parameter": "strict"}}
Status Condition Typical code
200 List, definition, status; an output stream has begun.
201 Session created.
204 Input stream fully received; session deleted.
400 Malformed request; invalid parameters. E_MANIFEST, E_PARAM
401 Missing or bad credentials. E_PERMISSION
404 Unknown pipe, session or port; port not enabled in this session. E_REF
406 No acceptable media type for an output. E_MEDIA
409 Port already attached; requested version not satisfiable. E_PROTOCOL, E_UNSUPPORTED
410 Session expired, or terminal and cleaned up. E_TIMEOUT
415 Unsupported or unexpected media type for an input. E_MEDIA
422 A required port was omitted from the session. E_UNCONNECTED
429, 503 Capacity: too many sessions, overloaded. SHOULD carry Retry-After. E_RESOURCE

A client maps a failed session to a failed node using the error from the session status; a violation of this protocol by the server (malformed JSON, a missing required member, an impossible status) is E_PROTOCOL.

11. Example: the validate-email interoperability fixture #

The fixture has inputs records and optional lookup, outputs valid, rejected and optional stats. The exchange below enables one input and two outputs and can be reproduced with curl; the three streaming requests run at the same time.

http
POST /v1/pipes/validate-email/sessions HTTP/1.1
Host: pipes.example.com
Content-Type: application/json

{"version":"0.1.0","inputs":["records"],"outputs":["valid","rejected"],"parameters":{}}

HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-store

{"sessionId":"example-session","sessionToken":"<opaque>","expiresAt":"2026-12-03T10:16:00Z"}
http
POST /v1/sessions/example-session/inputs/records HTTP/1.1
Authorization: Bearer <opaque>
Content-Type: application/x-ndjson
Transfer-Encoding: chunked

{"id":1,"email":"alice@example.com"}
{"id":2,"email":"not-an-address"}
http
GET /v1/sessions/example-session/outputs/valid HTTP/1.1
Authorization: Bearer <opaque>
Accept: application/x-ndjson

HTTP/1.1 200 OK
Content-Type: application/x-ndjson
Cache-Control: no-store
X-Accel-Buffering: no
Transfer-Encoding: chunked

{"id":1,"email":"alice@example.com"}

With curl (the token in a variable, not on a shared command line):

sh
B=https://pipes.example.com/v1
S=$(curl -sS -X POST "$B/pipes/validate-email/sessions" -H 'Content-Type: application/json' \
      -d '{"version":"0.1.0","inputs":["records"],"outputs":["valid","rejected"],"parameters":{}}')
ID=$(printf '%s' "$S" | jq -r .sessionId); AUTH="Authorization: Bearer $(printf '%s' "$S" | jq -r .sessionToken)"
curl -sSN -H "$AUTH" "$B/sessions/$ID/outputs/valid"    > valid.ndjson &
curl -sSN -H "$AUTH" "$B/sessions/$ID/outputs/rejected" > rejected.ndjson &
curl -sS  -X POST -H "$AUTH" -H 'Content-Type: application/x-ndjson' -T records.ndjson \
     "$B/sessions/$ID/inputs/records"
wait
curl -sS -H "$AUTH" "$B/sessions/$ID" | jq -e '.state == "completed"'

The two output readers are started before the input is sent, and the script does not trust the output files until the final status check passes. -T streams the file as the request body but makes curl send PUT unless -X POST is given; an input endpoint accepts only POST and answers PUT with 405 Method Not Allowed and Allow: POST.

The request body used above, as a checked example:

json
{"version":"0.1.0","inputs":["records"],"outputs":["valid","rejected"],"parameters":{}}

A request naming a port twice is malformed:

json
{"inputs": ["records", "records"], "outputs": ["valid"]}

12. Security considerations #

  • Remote data transmission. Using a remote pipe sends record data to another party. On the client side this requires the network and remoteData grants for the server's host (enforce or refuse: E_PERMISSION without them), and the execution plan shows the node as remote-http.
  • TLS and credentials. Section 9 is mandatory. Tokens never appear in query strings (which leak through logs, referrers and proxies), in process arguments or in reports.
  • SSRF and redirects. A runner contacting a server named by a manifest or a registry entry is making a request on behalf of untrusted input. It MUST apply the bounded-fetch rules of the Pipeline specification, section 12: no connections to private, loopback or link-local addresses unless the user addressed them explicitly, no cross-host or downgrading redirects with credentials, bounded redirects, bounded sizes for JSON responses and bounded time for non-streaming requests.
  • Servers execute other people's data, not their code. Session creation never uploads an implementation. Parameters are validated against the definition before the pipe starts. A server that wraps subprocesses MUST remember that a subprocess is not a sandbox and MUST NOT pass request data into command lines.
  • Resource exhaustion. Servers bound: concurrent sessions (429/503), idle lifetime (expiry), total duration, buffer sizes, the size of JSON request bodies and the length of a stream line. Clients bound the size of JSON responses. Slow readers back-pressure rather than accumulate. A pending session holds no pipe resources.
  • Session isolation. One session's token or id gives no access to another session. Ports accept a single attachment, so a third party who learns a URL cannot tap a stream that is already attached, but can pre-empt an unattached port; hence tokens or unguessable ids are mandatory.
  • Trusted mode honesty. A server operating pipes in trusted mode (no enforcement of declared permissions) MUST NOT advertise isolation it does not have.
  • Diagnostics. Error messages and the status document MUST NOT contain secrets and SHOULD NOT contain record contents.
  • Malicious definitions. A client validates the definition against the manifest schema, bounded in size, before using it, and never fetches anything a definition refers to.

13. Compatibility and versioning #

  • The protocol is identified by openflange.org/http/v0.1, carried in the pipe list's spec. A deployment changes protocol versions by changing {base}.
  • Clients MUST ignore unknown members of responses; servers MUST reject unknown members of the session request unless they are x- extensions, which they MUST ignore if not understood.
  • Unknown status codes are interpreted by class.
  • While experimental, a later 0.x version MAY change incompatibly, with a CHANGELOG.md entry.

See COMPATIBILITY.md in the specification repository.

14. Deferred #

Not part of v0.1: stream reconnect and resume; dynamic ports; several versions of one pipe under one base; WebSocket or other transports; an upload mechanism for browsers without streaming request bodies; checkpointing and recovery of sessions; server-to-server distributed scheduling; event-time watermarks and session windows (in the windowing sense); WASM; standardised authentication schemes beyond bearer tokens; signed definitions.

Источник: specs/http/v0.1.md в репозитории спецификаций. Ключевые слова, такие как MUST и SHOULD, используются в значении, определённом в RFC 2119.