# Equipo native, slice 1 (plan, 2026-11-18)

Paul approved building the first production slice of Equipo for iPhone and Mac
on 2026-11-18, with three defaults: Equipo's own device pairing behind a
sign-in interface (Oficina ID later), rastrillo/native's toolchain, and a
Developer ID Mac build with Sparkle plus an iPhone build run from Xcode. The
design is revision 7 of the mockups on `native-mockups-r4`
(`docs/native/r7/index.md`) and the web-led sync proposal
(`docs/native/sync-proposal.md`). The web leads; native follows its parity
rows.

## What a person can do

1. Pair the device: the app shows a code, opens the team in the browser, and
   waits while the person approves it there. The credential lives in the
   Keychain for its thirty days. Sign out revokes the device.
2. Read the conversation and send messages. Answer questions in their cards,
   with an option or in their own words when the question allows text.
3. Needs you, Tasks and the task view with its steps, usage and its thread
   ("Talk about this"), which can be read and replied to.
4. New activity arrives on the conversation's event stream while the app is
   in front; the thinking line shows the coordinator's real activity. A
   dropped stream reconnects from its cursor. Offline is shown, never hidden.

## Finding: the device reads the conversation engine, not the OpenAPI shapes

A device bearer is answered by the conversation engine's routes
(`internal/equipo/chat/http.go`, shapes in `internal/wire`): `/snapshot`,
`/messages`, `/events`, `/cards/{id}/answer`, `/tasks`, `/needs-you`,
`/tasks/{id}` and `/tasks/{id}/thread`. The web's Roster is drawn from the
same engine. `docs/api/equipo-v1.openapi.json` describes a different
conversation shape, and a live run against a local drive showed the device
never sees it (`/projects` with a bearer answers in the engine's shape).

So slice 1 is built on the engine's routes, and most of
`roster-gaps.json` on `native-mockups-r4` is not missing from the server,
only from the OpenAPI file: stage, Checks, Review, Branch, card times, the
activity label and the event stream are all there. Pairing, devices and
errors stay on the person API and its schema. Two follow-ups for Paul: the
OpenAPI file should describe what a device is actually answered with (or say
it is not the device's contract), and the sync proposal's gap list should be
cut down to what is really missing (set aside and the roll-up).

## What waits

- Merges, approvals, Contra and every other decision card open the web app,
  until each has an accepted parity row (sync proposal, "must match").
- Set aside and the day roll-up. Where a value has no words yet, the native
  view leaves it out; it never invents it.
- Push notifications (APNs), Oficina ID, several teams at once, TestFlight.

## Shape

```
native/
  apple/            SwiftPM: EquipoKit (library), EquipoMac (executable), tests
  ios/project.yml   XcodeGen: EquipoPhone, the iPhone app
  mac-updates.json  Sparkle settings for rastrillo's bundle-mac.py
  scripts/          check-native.sh, build-mac.sh, build-iphone.sh
```

Pinned to rastrillo/native `f1c7a14` (the revision Docs uses). Deployment
targets iOS 26 and macOS 26, as Docs. Bundle ID `works.oficina.equipo`;
"Oficina Equipo" in Finder, the Dock and Spotlight and "Equipo" inside the
app (the native level-up's D1 and D2).

EquipoKit owns:

- **Transport.** URLSession, ephemeral, no cookies, no cache, no redirects.
  Bearer only, never mixed with a browser cookie. Every write carries an
  `Idempotency-Key` kept with its body and revision until the result is known;
  a retry resends the same three. Responses are bounded. Outcomes are reported
  to RastrilloApple's `NativeConnectivity` so its offline banner works.
- **Errors.** The person API's `code`, `copy_key`, `request_id` and
  `current_revision`. 401 ends the session; 409 `revision_conflict` refetches
  before any new decision; 410 restarts what the API says to restart.
- **Pairing.** Curve25519 (Ed25519) key generated on the device and kept in
  the Keychain, `ThisDeviceOnly`. The proof message is the server's own
  `personapi.DeviceProofMessage`; a Go test owns a vector file that the Swift
  tests must reproduce byte for byte. Poll every five seconds at least, slow
  down on 429, start again on 410.
- **Models.** Hand-written Codable. The conversation fixtures under
  `Fixtures/thin` are the server's own answers, captured from the thin test
  rig with a device bearer by `internal/thintest` `TestNativeFixtures`
  (`EQUIPO_UPDATE_NATIVE_FIXTURES=1`) and strictly decoded into `internal/wire`
  on every Go run, so a changed wire shape fails CI. Pairing, device and error
  fixtures are checked against the OpenAPI schema by
  `native/scripts/check-fixtures.py`. An unloaded Needs you count stays
  unknown, never zero.
- **Sync.** One `CoalescedRunner` per refresh (snapshot, tasks, needs-you),
  reconciled by ID and revision. The event stream resumes after its cursor;
  an activity moves the thinking line without a read, a change to a message,
  turn, card, task, step or project reads again, and runner or connection
  events are ignored. Writes keep their key and body until they have a
  result; an answer is bound to the card revision the person saw, and a
  stale or answered card is shown as it is now and never resent.
- **Presentation.** Roster from r7 (bylines, raised cards, tone rules), fed
  only from API data.

Locale: dates and times use `Date.FormatStyle` in the reader's locale;
token counts use the locale's number format. Storage and every request stay
canonical (ISO dates, integers). Slice 1 shows no money.

Copy: native strings live in one String Catalog, English. Where the web
already has a string (`copy.go`), the native one uses the same words. Paul
reviewed the 86 native-only strings on 2026-11-19 and approved them as
written; the other 57 are the web's accepted words. A new or changed
native string is draft until it is reviewed the same way.

## Gates

- `native/scripts/check-native.sh`: Swift tests, the fixture check, the Mac
  executable and an unsigned iPhone Simulator build. Runs on a Mac.
- Go: the proof vector test runs inside `make test`, on Linux CI.
- An end-to-end pairing against a local Equipo on 127.0.0.1 before review.
- Mutations of the guards that matter each fail a test: idempotency key
  reuse (messages, thread replies, answers), revision on answers, stale
  answers never resent, closed cards never answered, unknown counts, proof
  bytes, the polling floor, the stream cursor, activity without a read,
  facts never invented, and every fact's words in the catalog. Go: a fixture
  with an invented field fails `TestNativeFixtures`.
- One Fable review of the whole branch. Paul lands it.

## Steps for Paul

- Slice 1 needs no provisioning profile: the Mac app is signed with the
  Developer ID certificate and notarised (no restricted entitlements), and the
  iPhone build runs from Xcode with automatic signing. The Sparkle feed under
  `native-releases/equipo` is needed when there is something to ship.
- Approving the first device in the browser.
