Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e2e8040
feat(transport): freeze the ogiZ0b frame builder contract
ffroliva Nov 22, 2026
959c396
feat(transport): add GeneratedImage.transport to the contract
ffroliva Nov 22, 2026
135f23d
Record generated image transport in asset metadata
ffroliva Nov 22, 2026
b327f11
Add direct_can_serve strategy selector and unit tests
ffroliva Nov 22, 2026
bfef801
Builds pure ogiZ0b request bodies
ffroliva Nov 22, 2026
716938d
feat(transport): build the ogiZ0b T2I body as a pure function (T1.1)
ffroliva Nov 22, 2026
c84c032
Record transport telemetry fact and report map
ffroliva Nov 22, 2026
b1d8023
Extract ogiz0b_reply_images reply mapper from _mc_submit_observe
ffroliva Nov 22, 2026
a5966b4
Bump notice version to 4, name transport in notice and docs
ffroliva Nov 22, 2026
0fc2fe7
Implement DirectHttpTransport with fallback and direct HTTP runner
ffroliva Nov 22, 2026
7cd2c3c
feat(telemetry): record the image transport in asset metadata and the…
ffroliva Nov 22, 2026
7f378cf
fix(telemetry): keep the transport enum to the values a caller produces
ffroliva Nov 22, 2026
7ef67f3
Register direct_http transport in experimental transports
ffroliva Nov 22, 2026
b8abd74
Add offline BDD scenario for direct_http image transport
ffroliva Nov 22, 2026
7817505
feat(transport): add the direct_http image transport adapter (T1.2-T1.5)
ffroliva Nov 22, 2026
eebc858
fix(transport): send the migrated wire model name on the direct path
ffroliva Nov 22, 2026
aa27157
test(e2e): a plain t2i on direct_http is made by one direct POST; 16:…
ffroliva Nov 22, 2026
c37b73d
test(e2e): the queued MCP worker path runs a t2i on direct_http (T1.7)
ffroliva Nov 22, 2026
df44a5e
test: mirror GeneratedImage.transport on the worker test fakes
ffroliva Nov 22, 2026
6e71af6
feat(transport): serve every aspect and up to two images on the direc…
ffroliva Nov 22, 2026
c41cc8a
feat(transport): serve a single in-project reference on the direct pa…
ffroliva Nov 23, 2026
b2576e8
fix(transport): wait for reCAPTCHA after navigating before a direct mint
ffroliva Nov 23, 2026
1014171
feat(transport): serve one named character on the direct path (T2.2)
ffroliva Nov 23, 2026
be46d25
test(e2e): a named character is generated by the direct transport (T2.2)
ffroliva Nov 23, 2026
d51389e
docs: the direct_http image transport — user doc, Gate 0 findings, pl…
ffroliva Nov 23, 2026
fb4be23
fix(transport): direct_http review round — fallbacks, token cache, pa…
ffroliva Nov 23, 2026
419b2a8
fix(transport): serve catalogued in-project refs again; cover local-f…
ffroliva Nov 23, 2026
1e9f679
feat(transport): serve a bare @Name mention on the direct path
ffroliva Nov 23, 2026
ed7689e
feat(transport): serve every image count Flow offers on the direct path
ffroliva Nov 23, 2026
1e4cca2
fix(transport): match Flow cookies per RFC 6265; address CodeRabbit o…
ffroliva Nov 23, 2026
1b73233
fix(transport): verify refs and characters before a direct POST (seco…
ffroliva Nov 23, 2026
e24787e
feat(telemetry): count runs by image transport in the weekly report (…
ffroliva Nov 23, 2026
c26c296
feat(transport): upload local files with one direct maseQ POST (Phase 4)
ffroliva Nov 23, 2026
e7bb383
fix(transport): take the upload MIME type from the image bytes
ffroliva Nov 23, 2026
a11b9cb
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva Nov 23, 2026
512004e
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva Nov 23, 2026
7a3c637
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva Nov 23, 2026
d16c961
refactor(transport): return one character pair from the direct read path
ffroliva Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- **The weekly usage report counts runs by the image transport that made their images.** A new field, `transports` (`direct`, `ui`, `other`), counts each run that generated an image once, by its last generation. The privacy notice moves to version 4 and names the image transport; in the EU and EEA, consent given to an earlier notice version no longer counts, and uploads stop until `gflow telemetry on` is run again. The telemetry endpoint must accept the `transports` key before this version is released: an endpoint that does not answers 400, and that week's report is dropped.
- **An experimental `direct_http` image transport ([docs/DIRECT_TRANSPORT.md](docs/DIRECT_TRANSPORT.md)).** With `GFLOW_CLI_TRANSPORT=direct_http`, an image on `flow.google.com` is generated by one direct request to Flow's `ogiZ0b` RPC; the browser only mints the reCAPTCHA token and holds the session. It serves text-to-image with `nano2`/`nano21`, every aspect, one to four images, one ref made in this run (a `gflow run` `"ref": "batch:N"`, or a local file, which is itself uploaded by one direct `maseQ` request), or one character (`--reference-entity` with its name, or an `@Name` mention), each with one image; any other request runs on the UI transport before anything is sent. A sent request is never resent: a timeout or an unexpected status stops the run with `next_action: reconcile`, and a redirect, HTTP 401 or HTTP 403 (Flow accepted nothing) falls back to the UI transport. Each generated image records `"transport": "direct_http"` in its catalog metadata.

### Fixed

- **`gflow video captions` centres the caption box on the text ([#1431](https://github.com/ffroliva/gflow-cli/issues/1431)).** The text was drawn from its layout origin while the box was laid out around its ink, so the box sat above the glyphs and descenders touched or crossed its bottom edge. The text is now drawn so its ink lands where the box expects it, with the same padding above and below.
Expand Down
87 changes: 87 additions & 0 deletions docs/DIRECT_TRANSPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Direct HTTP image transport (`direct_http`, experimental)

`direct_http` generates images on `flow.google.com` with one direct HTTP request to Flow's
`ogiZ0b` RPC instead of driving the composer page. The browser is still started and still
needed: it mints the reCAPTCHA token and holds the signed-in session. It no longer types
the prompt, opens the settings pane or clicks Generate.

It is experimental. It is off unless you select it, and any request it cannot build
exactly goes to the default `ui_automation` transport before anything is sent.

## Turning it on

```bash
GFLOW_CLI_TRANSPORT=direct_http gflow image t2i "a paper boat on a pond"
```

The setting applies to `gflow image t2i` / `i2i` / `generate`, to the MCP image tool
(in-process and as a queued job), and to each row of `gflow run` (from the environment, or
`"transport": "direct_http"` in the config; a `"ref": "batch:N"` row is served too).
`gflow image batch` resolves to the same transport, but its rows run the inherited UI batch
method, which flow.google.com refuses on every transport.

## What it serves

A request goes direct only when every slot of the frame it needs has been measured against
Flow's own submit. Everything else is routed to `ui_automation` before any request is sent.

| Request | Direct | Measured by |
|---|---|---|
| Text-to-image, model `nano2` / `nano21` (sent as `BELUGA`) | yes | 10 consecutive live generations |
| Aspect 9:16, 16:9 | yes | live generations (768x1376, 1376x768) |
| Aspect 1:1, 4:3, 3:4 | yes | captures of Flow's own submit |
| Count 1 to 4 | yes | live generations: 2, 3 and 4 entries in one request returned 2, 3 and 4 images |
| One ref made in this run: a `gflow run` row's `"ref": "batch:N"`, one image | yes | a live `gflow run` |
| One `--ref ./photo.png` (a local file not yet in the catalog), one image | yes | uploaded by one direct `maseQ` request (reCAPTCHA action `UPLOAD_IMAGE`), then generated directly; a live generation |
| One `--reference-entity` with its `--reference-entity-name` | yes | a live generation |
| One `@Name` mention of a character in the project | yes, when exactly one character has that name (trimmed, case-insensitive, as the UI picker matches) | the id is read from the project; a live generation |
| Any other model (`nano-pro`, `nano2-lite`, `imagen4`) | no | wire name not captured |
| Several refs, several characters, a ref plus a character, or a ref or character with count 2-4 | no | not captured |
| A mention whose name matches no character, or several | no | the UI picker decides |
| Agent-mode instructions, or `--ui-mode agentic` | no | not captured |
| A configured proxy (gflow's, the environment's or the OS's) | no | the browser and the request could leave by different routes |

## Failure behaviour

| What happens | Before the request is sent? | Result |
|---|---|---|
| The browser's cookies, the session tokens or the reCAPTCHA mint are unavailable | yes | the same request runs on `ui_automation` |
| The connection cannot be opened (or opening it timed out) | yes | the same request runs on `ui_automation` |
| The account is served on labs.google, or `GFLOW_CLI_FLOW_HOST=labs.google` | yes | the same request runs on `ui_automation` |
| Flow answers a redirect, HTTP 401 or HTTP 403 | no: it was sent once and refused | the request is submitted a second time, through `ui_automation`'s own page |
| A timeout, a dropped connection or any other HTTP status | no | the run stops with a network error (`next_action: reconcile`); gflow does **not** resend, because Flow may have made the image |
| Flow refuses the prompt | no | the same refusal error as the UI path |
| A `--ref` found in the local catalog (a media id, or a file used before) | yes: the selector routes it before any request | the request runs on `ui_automation`; the catalog may be stale, and the UI path proves the image still exists before it submits, refusing at $0 |

A sent request is never retried. Every rejected reply drops the cached session token, so a
Comment thread
ffroliva marked this conversation as resolved.
Resolved
stale one cannot stick in a long-running MCP server or worker. A reCAPTCHA mint is retried
for up to 10 seconds while the page loads its reCAPTCHA script, because a mint spends
nothing. The page is parked after every direct run, as after a UI run.

## What it records

- Each image's catalog row carries `"transport": "direct_http"` in its `metadata_json`.
- Log events: `direct.frame_built`, `direct.image_post` (status, `mint_ms`, `post_ms`,
`total_ms`) and `direct.fallback_to_ui` (reason). Set `GFLOW_CLI_LOG_LEVEL=INFO` to see
them. Tokens, cookies, prompts and signed URLs are never logged.

## Refusals observed

On 2026-11-23 the test profile made about 90 image generations in one day. Late in that day
Flow answered some requests with a WAF refusal (exit 10, `WafRejectionError`), on direct and
plain requests alike, including a plain text-to-image with no reference; the identical
request usually went through minutes later. The refusals followed the day's volume, not a
request shape: Flow's own submit for each refused shape was captured and matches what the
direct path sends. Those refusals came back as a refusal reply (exit 10): nothing was billed,
and gflow did not resend them. This differs from an HTTP 403, a redirect or a 401 on the
direct POST, where Flow accepted nothing and the request is submitted once more through
`ui_automation` (see the failure table).

## Speed

Measured on one profile, ten generations each, same prompt and model: the direct path took
a median of 18.6 s from mint to reply, the warm UI transport 20.7 s. Flow's own generation
time dominates both. The case for the transport is that it does not depend on the
composer's DOM, so selector changes and UI locale do not affect it.

Evidence: [`docs/superpowers/spikes/2026-11-22-direct-image-gate0.md`](superpowers/spikes/2026-11-22-direct-image-gate0.md).
1 change: 1 addition & 0 deletions docs/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Welcome to the `gflow-cli` documentation. This index is the routing layer: it te
| **[docs/DATA_LAYER.md](DATA_LAYER.md)** | Local SQLite catalog: goals, schema, recording flow, redaction, `gflow data` CLI, migrations, extension guide | Anything touching `gflow_cli.data`, debugging missing rows, building I2V/repair tooling, auditing what is stored |
| **[docs/TELEMETRY.md](TELEMETRY.md)** | Usage data and privacy notice: local counters, the weekly report and exactly what it contains, EU/EEA consent, kill switches, `gflow telemetry on\|off\|status\|show` | Auditing what is counted and sent, turning uploads off or on, or giving EU/EEA consent |
| **[docs/CHARACTER.md](CHARACTER.md)** | Characters feature spec & system design: domain model, endpoint/cost matrix, sequence diagrams, JSON payloads (I/O), CLI surface, reuse via `referenceEntities` (#145) | Working on `gflow character`, reusing a character in generations, or understanding Flow's character wire protocol |
| **[docs/DIRECT_TRANSPORT.md](DIRECT_TRANSPORT.md)** | The experimental `direct_http` image transport: one direct `ogiZ0b` request instead of the composer page, which requests it serves, its fallback and no-resend rules, what it records, measured speed | Turning it on with `GFLOW_CLI_TRANSPORT=direct_http`, or finding out why a request went to the UI transport |
| **[docs/REFERENCE_STRATEGIES.md](REFERENCE_STRATEGIES.md)** | How to reference an asset: `@Name` mention vs `--reference-entity` vs `--ref` — the two-axis model (identity vs image), same-wire+dedupe rule, per-path support matrix, image-less-entity prerequisite, agent rule | Deciding how to tag a saved character/asset in a prompt, or wiring `@`-mentions into a generation |
| **[docs/MEDIA_LIBRARY.md](MEDIA_LIBRARY.md)** | Flow's media library as a component: asset-kind taxonomy (`media[]`/`workflows[]`/preset voices), UUID-vs-displayName identity rules (AI caption ≤~35 chars, mutable, async, non-unique), the `projectInitialData` listing endpoint (complete, direct-GET-able), picker UI facts (virtualized grid, per-picker project, no a11y tree, single-click attach) + full pitfall table | Touching any picker/listing/reference code, or debugging why an asset "isn't found" |
| **[docs/MOVIE.md](MOVIE.md)** | `gflow movie` — multi-scene character-consistent films: manifest format, run lifecycle (browser stays open through generate→poll→download), entity-attach mechanism (Personagens right-click), resume/handoff, credits | Working on `gflow movie`, debugging scene generation, or understanding the character-entity attach + consistency model |
Expand Down
15 changes: 8 additions & 7 deletions docs/TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Counters are kept in `<GFLOW_CLI_HOME>/telemetry.db`, separately from the catalo
grouped by ISO week and retained for 53 weeks. gflow counts command and flag names, outcomes, coarse
duration buckets, command transitions, crash fingerprints made from exception and code names, and
generation details read from the local catalog. It also records the storage service category and MCP
client category, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys.
client category, image transport, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys.

`gflow telemetry show` prints the current week's report as JSON, including its random per-week
`report_id`; this is the report sent by the uploader. `gflow data stats` shows your own local usage
Expand All @@ -35,6 +35,7 @@ counts.
| `crashes` | Counts of code-only crash fingerprints by surface. A fingerprint contains exception class names, up to three gflow-cli function names, and a third-party package marker where relevant. |
| `engines` | Counts of generation, project and catalog commands and queued jobs that selected a browser engine, by engine: `playwright`, `patchright`, or `other`. A run is counted when the engine is selected, so a launch that then fails (a missing patchright install, a locked profile) still counts, which is what sizes an engine-specific failure. `gflow auth` commands and runs that launch no browser are not counted. |
| `hosts` | For the same runs, the Flow site that served them, as observed from the page address when a generation is routed: `labs` (labs.google), `flow` (flow.google.com), or `unknown` when the run routed no generation (for example a credits, project or character read, or a run that failed first). It records which site served a run and says nothing about what that site supports. |
| `transports` | Counts of runs that generated at least one image, by the transport that made it: `direct` (the experimental direct HTTP transport) or `ui` (UI automation); any other value counts as `other`. One run counts once, by its last image generation. A run that generated no image adds nothing. |
| `tools` | Counts by packaged prompt-tool name and whether it expanded or left the prompt unchanged. Custom tools, including tools that shadow a packaged name, are counted only as `custom`. |

## What is never sent
Expand Down Expand Up @@ -82,7 +83,7 @@ read your IP address or locale to make this decision, and never sends the timezo
Local counters still work in the EU/EEA and remain on your device unless you consent. To allow
weekly uploads, run `gflow telemetry on`; this records your choice locally in
`<GFLOW_CLI_HOME>/telemetry.consent`, together with the notice version you agreed to. When the
notice changes (version 3 added the browser engine and the Flow site), uploads stop until you run
notice changes (version 4 added image transport), uploads stop until you run
`gflow telemetry on` again. Run `gflow telemetry off` to withdraw consent and stop
counting and uploads. Environment kill switches still take precedence.

Expand Down Expand Up @@ -119,21 +120,21 @@ the sender is `src/gflow_cli/telemetry_upload.py` in this repository.

## Notice

Notice version: 3
Notice version: 4

```text
gflow sends weekly usage totals to improve it, and we share overall figures publicly and with
sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and
your country as a total. No ID, prompts, paths or account details. Each report is added to
totals and discarded.
sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used,
error codes, and your country as a total. No ID, prompts, paths or account details. Each
report is added to totals and discarded.
Turn it off: gflow telemetry off, or set GFLOW_CLI_TELEMETRY=0
See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETRY
```

The notice shown in the EU/EEA:

```text
gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded.
gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded.
In your region nothing is sent unless you agree: gflow telemetry on (undo: gflow telemetry off)
See exactly what would be sent: gflow telemetry show. Full notice: gflow docs TELEMETRY
```
Expand Down
Loading
Loading