Skip to content

docs(email): reconcile 0.4.0 docs — /init, voice, comprehensive CHANGELOG (schema 2.3) - #1986

Merged
kovtcharov merged 7 commits into
mainfrom
email-0.4.0-release
Jul 10, 2026
Merged

kovtcharov merged 7 commits into
mainfrom
email-0.4.0-release

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Brings the email agent's integrator-facing docs in line with the code as of the in-progress 0.4.0 (schema 2.3). Merged with main, so this now sits on top of the 2.3 scaffold (#1984), caller auth (#1706), and memory/agent-surface (#1666) work.

No release action — version stays where main has it (0.4.0, staged), no tag, no publish. This is docs-only reconciliation to land while the other email PRs finish.

Test plan

  • npm run build clean at 0.4.0 (types.ts incl. InitResponse compiles)
  • Merge conflicts resolved (specification.html, SPEC.md, CHANGELOG); no markers remain
  • No stale "current schema 2.2" claim remains (historical "attachments in 2.2" left intact)
  • CI: Email Agent tests + eval gate on this PR

…t; bump 0.4.0

Closes three release-blocking spec/doc gaps in the email agent and bumps it to
0.4.0 across all four version locations.

Gap 1 — /init endpoints undocumented in the npm package. GET /v1/email/init
(readiness preflight, #1795) and POST /v1/email/init (streaming provisioning)
shipped in the sidecar but were absent from the npm-facing docs. Added both to
SPEC.md's endpoint table, rewrote the now-stale "readiness vs liveness" prose in
SPEC/README/SKILL (the real readiness signal is GET /init, not "a triage
returning 200"), added InitResponse/InitLemonadeStatus/InitModelStatus types to
src/types.ts (matching the api_routes.py envelope), and a CHANGELOG bullet.

Gap 2 — voice-style drafting (#1607) shipped but mislabeled + undocumented. It is
live in the agent loop (build_voice_profile/clear_voice_profile, prompt injection
via render_style_guidance) with no REST endpoint. Flipped specification.html's P5
card from "Planned" to "Wired" and reconciled the dependent counters (at-a-glance
cards + stat boxes: 2 planned -> 1, 15 in-progress -> 16), and documented it as an
agent-loop capability in the npm README/SKILL/SPEC alongside scheduled-send/snooze,
with a CHANGELOG bullet.

Gap 3 — specification.html schema-version drift. The doc is headlined 2.2 but
several request/response defaults still showed 1.0/2.1. Updated the EmailTriage /
EmailSearch / BatchTriage request defaults and the prescan/briefing curl responses
to 2.2, matching contract.SCHEMA_VERSION. Remaining 1.0/2.0/2.1 mentions are
legitimate historical/feature-introduction labels.

Also: follow-up tracking (#1606) prose added to npm README/SKILL/SPEC for parity
(was CHANGELOG-only), and an EmailBriefingResponse type for the briefing endpoint.
Verified: npm run build clean, 59 npm tests pass, all four versions agree at 0.4.0.
@github-actions github-actions Bot added the agent::email Email agent changes label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Approve — this is a documentation + version-bump release PR for the email agent 0.4.0, and every claim in it checks out against the shipped code.

It closes the spec/doc gaps a pre-release audit found: the new /v1/email/init readiness endpoint is now documented across the npm docs (with matching TS types), voice-style drafting is correctly relabeled from "Planned" to live, and the stale 1.0/2.1 schema-version defaults in the HTML spec are corrected to 2.2 to match the contract. I verified the routes exist, the new TypeScript types field-match the Python models exactly, the contract is genuinely SCHEMA_VERSION = "2.2", and the voice tools are real and agent-loop-only. Cross-doc consistency (SPEC/README/SKILL/CHANGELOG all agree the schema stays 2.2) is properly maintained.

One low-priority miss and one release-sequencing thing to confirm, both in the details below — neither blocks merge. The scorecard staying at 0.3.0 is expected (it's the unchecked test-plan item, refreshed on the AMD eval pool separately).

🔍 Technical details

Verification performed (all passed):

  • InitResponse / InitLemonadeStatus / InitModelStatus in src/types.ts field-match api_routes.py:1562-1631 exactly (names, optionality, loadable/compatible/version nullability). ✓
  • EmailBriefingResponse matches api_routes.py:1909 (schema_version / generated_at / briefing). ✓
  • GET /v1/email/init (api_routes.py:2428) and POST /v1/email/init (api_routes.py:2525, include_in_schema=False) both exist — matches the SPEC.md "not in the OpenAPI JSON" claim. ✓
  • contract.py:72 → SCHEMA_VERSION = "2.2"; voice tools (build_voice_profile / clear_voice_profile) present in tools/voice_tools.py and injected via the agent system prompt (agent.py:158). ✓
  • The "Planned" labels left in specification.html:331/355/368/786 are all Capability 13 (Search past email), which genuinely stays Planned — correctly not rewritten. Same for the schema-1.0/2.0 migration prose at specification.html:1172/1647 (legacy/proposed-breaking discussion, not drift). ✓
  • Default port 8131 consistent across README/SPEC init examples. ✓

🟢 Stale version badge (hub/agents/npm/agent-email/assets/architecture.html:86) — still reads v0.3.0 while the four tracked locations moved to 0.4.0. It's a standalone asset not referenced by the markdown docs, so low impact, but it slightly undercuts the "no stale 0.3.0 remains" test-plan item. Worth a one-line bump:

      <span class="ver" id="ver">v0.4.0</span>

Not a finding, just confirm: binaries.lock.json still pins agentVersion: 0.3.0 / baseUrl .../0.3.0 — but every sha256 is PENDING-1648-replace-with-real-sha256 and size: 0, so this is clearly a freeze-time CI artifact, not hand-maintained here. Just make sure the freeze/publish pipeline rewrites it to the 0.4.0 binary before/with the npm 0.4.0 publish, otherwise the published 0.4.0 package would resolve the 0.3.0 binary URL.

Strengths:

  • The hand-written TS types are faithfully mirrored from the Python source of truth — I checked every field and found no drift, which is exactly what the "types mirror two Python sources" note in SPEC.md promises.
  • Honors CLAUDE.md's bundled-docs rule: the /init and voice changes land in README + SPEC + SKILL + CHANGELOG together, all agreeing the schema stays 2.2 — no self-contradicting lifecycle docs.
  • Disciplined scoping — corrected only the defaults/examples that were wrong (1.0/2.1→2.2) without touching the legitimate legacy-schema migration prose.

The 0.4.0 docs typed and documented GET /v1/email/init but shipped "no
client wrapper yet (call with fetch)" — so a host using the typed
EmailClient still couldn't reach the readiness preflight without dropping
to raw fetch, and client.ts still claimed the endpoint was "tracked
separately."

Add EmailClient.init(): it returns the InitResponse on both the 200
(ready) and 503 (not-ready) paths — 503 is the expected not-ready
response whose body is a valid InitResponse, so it's parsed and returned,
not thrown. Any other status still raises HttpError. Covers the gap with
three tests (ready, not-ready-503, non-503-throws), an interface-table
row, and the changelog clause; types.ts/SPEC/SKILL are unchanged (already
in the release).
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Three reference docs say "no client wrapper yet" for init() — but EmailClient.init() ships in this same PR.

README.md's prose block, SPEC.md's Readiness vs liveness section, and SKILL.md's gotchas all tell integrators to call GET /v1/email/init via raw fetch because there is no client wrapper. client.ts adds EmailClient.init() in this exact push, and the README interface table documents it — but the prose in all three docs contradicts that. Integrators reading SPEC.md or SKILL.md will reach for fetch and manually parse the response when they should be calling client.init().

Fix: update the "no client wrapper yet" passages in SPEC.md, SKILL.md, and README.md prose to reference client.init(), and remove or replace the raw fetch example in SPEC.md.

🔍 Technical details

Three docs claim "no client wrapper yet" for GET /v1/email/init:

  • README.md:174–175 — "no client wrapper yet; use fetch with the exported InitResponse type"
  • SPEC.md:163 — "There is no client wrapper yet, so call it with a plain fetch" (plus a raw fetch code example on lines 167–170)
  • SKILL.md:177 — "no client wrapper yet; fetch it, the InitResponse type is exported"

But client.ts:293 adds async init(): Promise<InitResponse>, and README.md's own interface table (the init() row) documents it correctly.

The raw fetch example in SPEC.md should be replaced with await client.init() (or at minimum note that EmailClient.init() is the preferred path). The "no client wrapper yet" language in all three docs should be dropped or corrected to "use client.init()."

@kovtcharov kovtcharov changed the title release(email): document /init + voice, fix schema drift; bump 0.4.0 docs(email): document /init + voice drafting, fix schema-version drift Jul 10, 2026
Brings the branch up to schema 2.3 (triage reply scaffold #1984), caller
auth #1706, runtime memory + stateful agent surface #1666, and the eval-CI
changes. Conflict resolution: took main's regenerated 2.3 specification.html;
reconciled SPEC.md to keep main's 2.3 contract notes plus the /init readiness
+ briefing additions; merged CHANGELOG so the 0.4.0 section carries every
feature from both lines (/init #1795, voice #1607, agent surface + memory
#1666, caller auth #1706, 2.3 scaffold #1984, follow-up, attachments, …).
Also corrected 4 stale 'schema 2.2' claims to 2.3 in README/SPEC/SKILL.
@kovtcharov kovtcharov changed the title docs(email): document /init + voice drafting, fix schema-version drift docs(email): reconcile 0.4.0 docs — /init, voice, comprehensive CHANGELOG (schema 2.3) Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Three docs added in this push say "no client wrapper yet — use fetch" for GET /v1/email/init, but this same push adds EmailClient.init(). Users following those docs will write a manual fetch call and miss both the type safety and the built-in 503-body handling.

The contradiction is sharpest in README.md, which says "no client wrapper yet; use fetch" in the prose immediately above the Interface table that lists init() as a first-class method.

🔍 Technical details

Files that still claim "no wrapper yet" after this push:

  • README.md line ~65 (new prose block): "no client wrapper yet; use fetch with the exported InitResponse type"
  • SPEC.md route table (new row): | GET /v1/email/init | — (plain fetch; no wrapper yet) |
  • SPEC.md Readiness section (new prose): "There is no client wrapper yet, so call it with a plain fetch"
  • SKILL.md (new bullet): "no client wrapper yet; fetch it, the InitResponse type is exported"

All four should be updated to direct users to client.init() instead, since the wrapper is now shipped. The Interface table in README.md already does this correctly — the prose just needs to match.

The main merge brought the #1706 caller-auth token and left the /init
docs describing the endpoint as "no client wrapper yet — call it with a
plain fetch." That is now both stale (this branch ships EmailClient.init())
and, for the SPEC example, wrong: a raw fetch("/v1/email/init") with no
Authorization header now 401s under the new per-session bearer token.

Point every readiness doc at init() instead: add it to the SPEC method
list + REST-table row, replace the raw-fetch SPEC example with
client.init(), and fix the README self-contradiction (it listed init() in
the interface table but the prose still said "no wrapper"). The briefing
and POST /v1/email/init "no wrapper yet" notes are left as-is — those are
genuinely still unwrapped.
@github-actions

Copy link
Copy Markdown
Contributor

🟡 init() can throw a bare SyntaxError when a proxy or load-balancer returns a 503 with a non-JSON body (HTML error page, empty string). The guard on line 308 checks e.bodyText is truthy, so an HTML body passes through to JSON.parse, which throws outside of HttpError — contradicting the docstring's "any other status… still throws HttpError as usual." Callers told to catch (e instanceof HttpError) will miss this.

The fix is a one-liner: wrap the JSON.parse in its own try/catch and re-throw the original HttpError if parsing fails. The test suite covers HTTP 500 but not a 503 with an unparseable body, so that path should be added too.

🔍 Technical details

hub/agents/npm/agent-email/src/client.ts:308-309

      if (e instanceof HttpError && e.status === 503 && e.bodyText) {
        try {
          return JSON.parse(e.bodyText) as InitResponse;
        } catch {
          throw e; // body wasn't the expected InitResponse JSON (e.g. proxy HTML) — re-throw HttpError
        }
      }

Missing test case (test/client.test.ts): a 503 response whose body is "<html>Bad Gateway</html>" should throw HttpError, not SyntaxError.

…non-JSON 503

The 503 branch parsed e.bodyText unguarded, so a 503 whose body isn't the
InitResponse JSON — e.g. a proxy / load-balancer HTML error page — threw a
bare SyntaxError, breaking the documented contract that any status other
than a valid not-ready 503 still surfaces as HttpError. Guard the parse and
re-throw the original HttpError on failure; add a 503-with-HTML-body test.
@kovtcharov
kovtcharov enabled auto-merge July 10, 2026 21:42
# Conflicts:
#	hub/agents/npm/agent-email/CHANGELOG.md
#	hub/agents/npm/agent-email/README.md
#	hub/agents/npm/agent-email/SKILL.md
#	hub/agents/npm/agent-email/SPEC.md
Now that this branch adds the init() client method, correct the GET /v1/email/init
docs that still said 'no client wrapper yet; use fetch' (README/SKILL/SPEC) to
reference init() — it returns the InitResponse on both the 200 and 503 paths and
attaches the per-session bearer token like every EmailClient method. Left the
/briefing and POST /init 'no wrapper yet' notes intact (those remain fetch-only).
@kovtcharov
kovtcharov added this pull request to the merge queue Jul 10, 2026
Merged via the queue into main with commit 18c7f0e Jul 10, 2026
25 checks passed
@kovtcharov
kovtcharov deleted the email-0.4.0-release branch July 10, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants