Add the slice 1 plan for Base on the Mac and iPhone
Seventeen tasks across rastrillo/native (assertion for any audience, OficinaApp.base, the open URL), Home (Base's app ID for passkeys) and Base (native sessions, /api/v1 reads, Ask's JSON contract, Ask set up with Oficina ID through Equipo's own native sign-in, the Mac and iPhone apps, release tooling). Equipo needs no change; its Oficina ID key lasts 7 days, so the app renews it (P1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+370
−0
docs/superpowers/plans/2026-11-23-base-native-slice1.md+370 −0
diff --git a/docs/superpowers/plans/2026-11-23-base-native-slice1.md b/docs/superpowers/plans/2026-11-23-base-native-slice1.md| new file mode 100644 |
| index 0000000..7c0aa72 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-23-base-native-slice1.md |
| @@ -0,0 +1,370 @@ |
| +# Base on the Mac and iPhone, slice 1: Implementation Plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** A person signs in to Base on a Mac or an iPhone with Oficina ID, going straight in when another Oficina app holds the ID. Ask Base works at once, with no code to approve in Equipo. They talk to the Assistant, see and answer their jobs, and open their apps. On the Mac, Ask is also a menu-bar panel and an optional global shortcut. |
| + |
| +**Architecture:** |
| +- **Base's server** becomes a native Oficina ID consumer. It mounts connect's `NativeExchange`, mints the 7-day native session, and accepts it everywhere a Home session is accepted. It also gains two small JSON reads, `GET /api/v1/me` and `GET /api/v1/home`. Ask's routes already answer JSON and SSE for `ask.js`, so the native app uses them as they are. |
| +- **Ask set-up uses Oficina ID.** The app fetches a second Home assertion addressed to Equipo and posts it to Base. Base's server completes Equipo's own native sign-in on the person's behalf: `POST /native/oficina-id`, then `POST /api/v1/auth/devices/native`. It seals the resulting Equipo key exactly where the code flow puts it today. No Equipo change. |
| +- **The native app** lives in `native/` and is built on RastrilloApple, like Equipo's. It has one SwiftUI package, `BaseKit` (look, API client, Ask, Home), a SwiftPM Mac executable, and an xcodegen iPhone project. |
| + |
| +**Tech Stack:** |
| +- Server: Go (`GOTOOLCHAIN=go1.26.11`, `CGO_ENABLED=0`), chi, rastrillo, Home's `connect` module. |
| +- Native: Swift 6.2 / SwiftUI, macOS 26 and iOS 26, RastrilloApple (Oficina ID, NativeHTTP, quiet Sparkle updates), swift-cmark, and KeyboardShortcuts (MIT) for the Mac shortcut. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-23-base-native-design.md` (binding, with Paul's picks of 2026-11-23: Mac window B, iPhone Ask first, Ask set up at sign-in). Approved look: `.superpowers/mockups/native/` (git-ignored; `python3 build.py`). |
| + |
| +**Repositories and branches:** |
| + |
| +| Repo | Tasks | Branch | |
| +|---|---|---| |
| +| **rastrillo/native** | 1 | `base-kit` from `origin/main` `0254817` | |
| +| **Home** (oficina/home) | 2 | `base-native-app-id` from `origin/main` `8125a3c` | |
| +| **Base** (this repo) | 3 to 16 | `native/slice-1` from `origin/main` `d8700cf` | |
| +| Controller | 17 | copy review, operator steps with Paul, live check, release | |
| + |
| +**Equipo** needs no change (checked at `00d09aa7`; see P1). |
| + |
| +## Plan decisions |
| + |
| +- **P1. Equipo's key from Oficina ID lasts 7 days.** |
| + - **How it's minted:** Equipo's native exchange (`oficinaid/native.go:56-104`) and `POST /api/v1/auth/devices/native` (`native_device.go`). |
| + - **What it is:** the same `PersonCredential` (audience `equipo.person.v1`) as the code flow, so the relay and `PUT /api/v1/assistant/host` work unchanged. |
| + - **The catch:** it ends with the Equipo native session, 7 days after minting, and with any Equipo sign-out, relink or roster removal. The code flow's key lasts 30 days. |
| + - **The rule:** Base stores the Equipo session cookie sealed beside the key, and never signs it out. Base tells the app `renew_after` (minted + 5 days). The app sends a fresh assertion the next time it starts or comes forward after that time, silently. |
| + - **Web-only people** keep the code flow. Whichever key is newest is used. |
| + - A 30-day Oficina ID key would need an Equipo policy change that `devices.go:280-284` deliberately rules out, so slice 1 doesn't ask for one. |
| +- **P2. Only people Equipo already links get Ask this way.** Equipo's exchange answers `403 unknown` for an Oficina ID it hasn't linked to a roster member. Base then shows Ask's existing "Ask Base isn't set up for you yet" state, with the code flow's button. |
| +- **P3. Base admits only people already linked in Base** (slice 1). |
| + - `Admit`, `Unlinked` and `HomeOnly` stay unset, as on the web today. |
| + - A person who has never signed in to Base with Oficina ID on the web gets the kit's "unknown" answer. Its copy points them to Base on the web once. |
| + - Admitting an invited person straight from native is slice 2, with the team-mode hooks Docs uses. |
| +- **P4. Ask routes are reused, not copied.** |
| + - The native client calls `/ask/state`, `/ask/events`, `/ask/messages`, `/ask/turns/{id}/cancel` and `/ask/cards/{id}/answer` with `Accept: application/json`. That's the same contract `ask.js` uses; the kit's `NativeHTTP` sends the session cookie and `Origin`, so CSRF passes. |
| + - Task 6 writes the contract down (`docs/api/base-native-v1.md`) and pins it with tests. The web and native then can't drift apart. |
| + - Unauthenticated JSON requests get `401 {"code":"unauthenticated"}`, never a redirect to `/signin`. The kit calls `sessionRejected()` on 401. |
| +- **P5. `/api/v1` is reads only:** `me` and `home`. Store, People and Settings changes stay on the web in slice 1 (spec 3.3, Paul 11-23). The Mac sidebar's Store and People rows open Base's web pages in the browser. |
| +- **P6. App metadata the API serves.** `GET /api/v1/home` gives each Oficina app its native bundle ID (`works.oficina.<id>`; Calls is `works.oficina.calls`) and, where the app has one, its URL scheme. Installed apps carry their tint and line-art SVG (the catalog's own); Oficina apps carry their icon's URL (`/static/oficina/<id>.svg`). The client never hard-codes an app. |
| +- **P7. One palette.** `BaseKit/Look/Palette.swift` holds Base's tokens (sky, fog, glass, sheet, pill, states, text) for light and dark. A test parses `internal/look/static/app.css` (`:root` and `:root[data-theme="light"]`) and fails if any mirrored token differs. The web and native look can't drift. |
| +- **P8. Timeless Sans in the app.** `hack/fonts.sh` already fetches the pinned file (git-ignored). The native build copies it into the bundle. |
| + - **Release builds** refuse to run without it (`hack/fonts.sh check`). |
| + - **Dev builds** fall back to DM Sans (committed, OFL), as the web does. |
| + - The face is registered at launch, before the first frame, so nothing ever paints in a fallback face when the file is there. The Grotesk cut is the `STYL` axis at 0 (headings, wordmark); the Sans cut is `STYL` 100. |
| +- **P9. The sky** is a `TimelineView`-driven `Canvas`. |
| + - **Light and fog:** two blurred beams and four blurred fog ellipses on the same paths and periods as `app.css` (`sway` 9 s and 13 s, `breathe` 6 s, `path-a/b/c` 10 to 17 s, `tint` 18 s), and the same sky gradient. |
| + - **Reduce Motion** freezes it at the CSS's reduced-motion pose. |
| + - **Performance:** it pauses when the window is hidden or the app inactive, and draws at 30 fps. |
| +- **P10. Glass** is a `.background` of the sheet or glass gradient over `.ultraThinMaterial`, with a 1 px top edge (`--glass-shine`) and a hairline border (`--glass-edge`). Text sits only on glass, never straight on the sky (spec 6, WCAG AA). |
| +- **P11. The shortcut** uses `KeyboardShortcuts` (sindresorhus, MIT; it's in the Colophon). It is off until the person records one (Paul 11-23). The menu-bar item is on by default, and Settings can switch it off. |
| +- **P12. Opening an Oficina app:** |
| + - **Mac:** if `NSWorkspace.urlForApplication(withBundleIdentifier:)` finds the app and Settings says "The app", open it there. Otherwise open the app's web URL. |
| + - **iPhone:** Calls by `oficina-calls://`, Equipo by its scheme (in `LSApplicationQueriesSchemes`), everything else on the web. Opening Docs, Sheets, Calendar and Memoria natively waits for the kit's `open` URL (Task 1) to reach their repins. Until then they open on the web. |
| +- **P13. Bundle ID `works.oficina.base`** (Paul 11-23), shown as "Oficina Base" in Finder, the Dock and Spotlight and as "Base" inside the app (D2). The app is version `0.1.0`. |
| + |
| +## File map (Base, new) |
| + |
| +``` |
| +native/ |
| + .gitignore *.xcodeproj, generated Info.plists, Resources/Fonts/Timeless* |
| + PrivacyInfo.xcprivacy |
| + mac-updates.json Sparkle: bundle_id, feed_url …/native-releases/main/base/appcast.xml |
| + apple/Package.swift BaseKit (library), BaseMac (executable) |
| + apple/Sources/BaseKit/ |
| + Look/Palette.swift Look/Sky.swift Look/Glass.swift Look/Type.swift Look/Marks.swift |
| + API/Client.swift API/Models.swift API/Events.swift |
| + Ask/AskModel.swift Ask/Thread.swift Ask/Pill.swift Ask/Card.swift Ask/Composer.swift Ask/Markdown*.swift |
| + Home/HomeModel.swift Home/AppIcon.swift Home/Opener.swift |
| + Session/BaseSession.swift Session/AskSetup.swift |
| + SignIn/BaseOnboarding.swift |
| + apple/Sources/BaseMac/ BaseMacApp.swift MainWindow.swift Sidebar.swift MenuPanel.swift Settings*.swift Colophon.swift |
| + apple/Sources/BasePhone/ (compiled by the xcodegen project) BasePhoneApp.swift AskScreen.swift AppsSheet.swift |
| + apple/Tests/BaseKitTests/ PaletteTests ClientTests EventsTests AskModelTests AskSetupTests OpenerTests |
| + ios/project.yml ios/BasePhone.entitlements ios/Assets.xcassets |
| + macos/DeveloperID.entitlements |
| + scripts/build-mac.sh scripts/build-iphone.sh scripts/check-native.sh scripts/snapshots.sh scripts/fonts-into-bundle.sh |
| +.amadan/ci.d/20-native check-native.sh on Darwin, --core-only elsewhere |
| +docs/api/base-native-v1.md |
| +``` |
| + |
| +## Task 1 (rastrillo/native): the kit's three additions |
| + |
| +**Files:** |
| +- `Sources/RastrilloApple/OficinaID/OficinaIDModel.swift` |
| +- `Sources/RastrilloApple/OficinaID/OficinaAppearance.swift` |
| +- `Sources/RastrilloApple/NativeConnection.swift` |
| +- their tests |
| + |
| +- [ ] **Step 1: tests first.** |
| + - `OficinaIDModelAssertionTests`: `assertion(for:)` returns an assertion and its verifier for any audience; it uses the model's own service (shared clock-skew); a `grantEnded` error ends the grant through `grantEnded()` exactly as `mint` does. |
| + - `OficinaAppTests`: `.base` has its symbol and accents. |
| + - `NativeConnectionOpenURLTests`: `handleOpenURL` accepts `<scheme>://open` (and `…://open?path=/x` where `path` is a relative path on the app's own origin), and still ignores anything else. |
| +- [ ] **Step 2: implement.** |
| + - `public func assertion(for audience: URL) async throws -> (assertion: String, verifier: String)` on `OficinaIDModel`, reusing `service` and the signed-in identity's credential. |
| + - The `OficinaApp.base` case: symbol `square.fill` (`circle.grid.2x2` if that reads better at 16 pt); accent `#2FC6C0`, accentSoft `#6EE7DC` (Base's lagoon and signal). |
| + - The `open` action on `NativeConnection.handleOpenURL`. It brings the app forward and, with `path`, hands the path to a new optional `onOpen` closure. |
| +- [ ] **Step 3:** run `swift test`; check that the snapshot gate is unchanged (nothing iterates `OficinaApp`). Push, ask for review, and merge on the hub with `amadan branch merge`. Record the merge commit for Task 7's pin. |
| + |
| +## Task 2 (Home): Base's app ID can use passkeys |
| + |
| +**Files:** |
| +- `internal/home/native_passkey.go:287-294` (`nativeAppIDs`) |
| +- its test |
| + |
| +- [ ] Add `9U4A84C4WK.works.oficina.base` to `nativeAppIDs`. The test asserts the AASA `webcredentials.apps` list contains it. |
| +- [ ] `make ci`, push, review, merge. Deploying waits for the controller (Task 17), with Home's usual promote and restart (see Home's deploy notes). |
| + |
| +## Task 3 (Base): connect bump and native sessions recognised |
| + |
| +**Files:** |
| +- `go.mod`, `go.sum` |
| +- `internal/web/app.go:261-310` (`requireMember`, `memberFor`, `ownSignInOnly`) |
| +- `internal/web/oficina.go` |
| +- tests in `internal/webtest` |
| + |
| +- [ ] **Step 1:** bump `amadan.net/oficina/home/connect` (and `handoff`) to Home `origin/main`. Fix any compile changes. `make ci` green before going on. |
| +- [ ] **Step 2: tests.** |
| + - `TestNativeSessionIsAMember`: a session with method `connect.NativeMethod` for a linked member reaches `/`. |
| + - `TestNativeSessionExpiresAfterSevenDays`: the same session 7 days and 1 second after `At` is refused. |
| + - `TestOwnSignInOnlyRefusesNativeSessions`: passkey registration refuses a native session, as it refuses a Home one. |
| +- [ ] **Step 3:** replace every `s.Method == connect.HomeMethod` with `connect.IsHomeDerived(s.Method)`, and check `connect.Expired(s, now)` wherever Base resolves a Home-derived session itself. |
| + |
| +## Task 4 (Base): the native exchange and `/signout` |
| + |
| +**Files:** |
| +- `internal/web/oficina.go`, `internal/web/app.go` |
| +- tests in `internal/webtest` |
| + |
| +- [ ] **Step 1: tests,** driving the exchange with connect's test helpers (a signed assertion for Base's origin, as Docs' `home_native_test.go` does): |
| + - `TestNativeExchangeMintsASession`: the answer is `200 {state:"ok", name:"__Host-rastrillo_session", value, expires_at}`, and the value opens `/api/v1/me`. |
| + - `TestNativeExchangeUnknownPerson`: `403 {state:"unknown"}` for an unlinked subject. |
| + - `TestNativeExchangeRefusesBrowsers`: `Origin` or `Sec-Fetch-Site` gets a 400. |
| + - `TestSignoutEndsTheNativeSession`: `POST /signout` with the cookie and `Origin: <base origin>` ends the session, and the cookie no longer opens anything. |
| +- [ ] **Step 2: implement.** |
| + - Set `Config.MintNativeSession` to `sess.Mint` with `NativeMethod`; the store keeps `At`. |
| + - Mount `r.Post(connect.NativeExchangePath, o.bridge.NativeExchange)` outside CSRF; connect's Middleware already exempts it. |
| + - Mount `r.Post("/signout", …)`, which ends the current session (any method) and answers 204 to JSON, or a 303 to `/signed-out`. |
| + - Don't mount `/native/web/end` (Home slice D). The kit treats its failure as harmless. |
| + |
| +## Task 5 (Base): `GET /api/v1/me` and `GET /api/v1/home` |
| + |
| +**Files:** |
| +- `internal/web/api.go` (new), `internal/web/app.go` |
| +- `internal/config/oficina.go` (bundle IDs, schemes) |
| +- tests |
| + |
| +- [ ] **Step 1: tests.** |
| + - `TestAPIMe`: `{member:{id,name,email,initials,owner}, base:{name,slug,origin,timezone}, appearance:"system|light|dark", equipo_origin:"…"|null}`. |
| + - `TestAPIHome`: `{greeting, lede, steps:[{label,done}], apps:[{id,kind:"oficina"|"installed"|"own",name,url,icon_url?,tint?,icon_svg?,bundle_id?,scheme?}]}`, in Home's order. Own pages carry Base's web URLs. |
| + - `TestAPIRefusesWithoutSession`: `401 {"code":"unauthenticated"}`, `Cache-Control: no-store`, no redirect. |
| +- [ ] **Step 2: implement**, reusing `home.go`'s builders (move the tile and step building into one function both use, so Home and the API can't disagree). Mount under `requireMember`. Make `requireMember` answer 401 JSON for `/api/` paths and for any request with `Accept: application/json` (this covers the Ask routes). |
| + |
| +## Task 6 (Base): Ask's JSON contract, written down and pinned |
| + |
| +**Files:** |
| +- `docs/api/base-native-v1.md` (new) |
| +- `internal/webtest/ask_native_contract_test.go` (new) |
| + |
| +- [ ] **Step 1:** document what `ask.js` already relies on. Read it from `ask.js`, `ask.go`, `ask_relay.go` and `ask_cards.go`; don't invent anything. Cover: |
| + - `/ask/state` (`state`, `messages`, `jobs`, `cards`, `turn`, `status`, `cursor`); |
| + - `/ask/events?after=` (SSE event types and their `data`); |
| + - `/ask/messages` (`text`, `key`); |
| + - cancel and answer (`choice`, `revision`, `key`), their status codes and error bodies. |
| +- [ ] **Step 2:** contract tests that make each call the way the native client will. Each carries the native session cookie, `Origin`, and `Accept: application/json`, and no `Sec-Fetch-Site`. Each asserts the documented shape against `equipotest`'s fake Equipo. Any shape `ask.js` changes later now breaks a test. |
| + |
| +## Task 7 (Base): Ask set up with Oficina ID |
| + |
| +**Files:** |
| +- `internal/equipo/equipo.go`: add `NativeExchange(ctx, assertion, verifier) (cookie, expires, error)` and `RegisterNative(ctx, cookie, pub, label) (Credential, error)` |
| +- `internal/web/ask_oficina_native.go` (new) |
| +- `internal/store` (columns for the sealed Equipo session cookie, its expiry, and how the key was minted) |
| +- `internal/equipo/equipotest` (fake the two Equipo routes) |
| +- README |
| + |
| +- [ ] **Step 1: tests,** against `equipotest`. |
| + - `TestAskOficinaConnect`: `POST /api/v1/ask/oficina {assertion, verifier}` from a native session: |
| + - Base calls Equipo's `POST /native/oficina-id`, with Host set to Equipo's origin and no `Origin` header; |
| + - then `POST /api/v1/auth/devices/native` with that cookie, `Origin: <equipo origin>`, a new Ed25519 key pair for the member (as the code flow makes one, `ask_connect.go:60`) and Base's device label; |
| + - then seals the key and cookie, registers the Assistant host as the code flow does, and answers `200 {state:"ready", renew_after}`; |
| + - `/ask/state` is `ready`. |
| + - `TestAskOficinaUnknown`: Equipo's 403 becomes `409 {state:"not_linked"}`, and nothing is stored. |
| + - `TestAskOficinaRenew`: a second post replaces the key and cookie, revoking the old device in Equipo. |
| + - `TestAskOficinaRefusesWeb`: a browser session (not native) gets 403; the web keeps its code flow. |
| + - `TestAskStateSaysWhenToRenew`: `/ask/state` gains `renew_after` (RFC 3339, empty for code-flow keys) and `equipo_origin`. |
| + - `TestDisconnectRevokesOficinaKey`: Settings' Disconnect revokes it as it does a code-flow key. |
| +- [ ] **Step 2: implement**, reusing the code flow's storage and host registration, so the relay can't tell the two kinds of key apart. Rules: |
| + - A failure from Equipo stores nothing. |
| + - Two posts for the same person run one at a time (a per-member lock). |
| + - Never send Base's own cookie or session to Equipo. |
| +- [ ] **Step 3:** README. Explain that the native app connects Ask with Oficina ID; that this key lasts 7 days and the app renews it; and that the person must be linked in Equipo. |
| + |
| +## Task 8 (Base): native skeleton builds and is gated |
| + |
| +**Files:** `native/` as in the file map (empty views); `.amadan/ci.d/20-native`; `Makefile` (`native-check`). |
| + |
| +- [ ] Copy and adapt Equipo's `native/apple/Package.swift`, `ios/project.yml`, entitlements, `PrivacyInfo.xcprivacy`, `.gitignore` and `scripts/build-mac.sh`, `build-iphone.sh` and `check-native.sh`, all at Equipo `00d09aa7`. Use: |
| + - bundle `works.oficina.base`; |
| + - keychain groups `9U4A84C4WK.works.oficina.base`, then `9U4A84C4WK.works.oficina.id` (in that order); |
| + - App Group `group.works.oficina` (iOS) and `9U4A84C4WK.works.oficina` (Mac); |
| + - `webcredentials:id.oficina.works`; |
| + - rastrillo/native pinned at Task 1's merge commit, and swift-cmark at Equipo's pin; |
| + - KeyboardShortcuts at its latest tagged release. |
| +- [ ] `scripts/fonts-into-bundle.sh` copies `internal/look/static/fonts/timeless/1.094/TimelessSansVF.woff2` and DM Sans into `BaseKit` resources. `check-native.sh --release` runs `hack/fonts.sh check` first. |
| +- [ ] `mac-updates.json` follows Equipo's, with `feed_url https://raw.amadan.net/oficina/native-releases/main/base/appcast.xml` and profile `~/private_keys/oficina/profiles/Oficina-Base-macOS-Developer-ID.provisionprofile`. |
| +- [ ] The icon: Base's mark (the rounded square, `--mark-1` to `--mark-2`) on the indigo sky, one 1024 px PNG, with the Mac icon made by the kit's `mac-icon.swift`. Show it to Paul in Task 17. |
| +- [ ] `check-native.sh` passes: `swift test`, the BaseMac build, and an iPhone simulator build. |
| + |
| +## Task 9 (Base): the look |
| + |
| +**Files:** `BaseKit/Look/*`, `Tests/BaseKitTests/PaletteTests.swift`. |
| + |
| +- [ ] **Step 1: tests.** |
| + - `PaletteTests`: parses `app.css`, comparing the light and dark values of every token `Palette` mirrors (P7). |
| + - `TypeTests`: Timeless registers before first use, and the Grotesk and Sans cuts resolve; with the file absent, DM Sans and no crash. |
| +- [ ] **Step 2: implement** |
| + - `Palette`, keyed by `ColorScheme`; |
| + - `Sky` (P9); |
| + - `.glass()`, `.sheet()` and `.solid()` modifiers (P10); |
| + - `BaseFont.heading(size)` and `.body(size)`; |
| + - `Marks`: the state marks (asking, ready, done, stopped paths from `ask.js`; working is a turning arc round a breathing dot). |
| + - The member's Appearance from `/api/v1/me` overrides the system's (`preferredColorScheme`). |
| +- [ ] **Step 3:** snapshot the sky (frozen pose), a glass card and the type scale in light and dark (`scripts/snapshots.sh`, RastrilloSnapshots; out of CI, as in Docs). |
| + |
| +## Task 10 (Base): session, client and events |
| + |
| +**Files:** `Session/*`, `API/*`, tests. |
| + |
| +- [ ] **Step 1: tests.** |
| + - `ClientTests`: requests carry the kit's cookie and `Origin`; a 401 calls `sessionRejected()`; a JSON error body becomes a typed error. |
| + - `EventsTests`: the SSE reader handles `id`, `event`, multi-line `data`, `retry`, pings, and a reconnect with `after=<last id>`; a `410 cursor_expired` reloads `/ask/state`. |
| + - `AskModelTests`: applying `message`, `turn`, `delta`, `glance`, `card` and `activity` events to a snapshot gives the same thread `ask.js` would draw (fixtures from Task 6's contract tests). |
| +- [ ] **Step 2: implement.** |
| + - `BaseSession` wraps `OficinaIDModel.live(configuration: .init(app: "base", appName: "Base"), appGroup:)` and its `client()`. |
| + - The client and models. |
| + - `AskModel`, an `@Observable` holding the thread, jobs, cards and turn. |
| + - The SSE reader, adapted from EquipoKit's `URLSessionTransport.lines()`. |
| + - On foreground: `renewIfNeeded()`, then reload state and resume events. |
| + |
| +## Task 11 (Base): Ask, drawn |
| + |
| +**Files:** `Ask/*`, `Ask/Markdown*.swift` (copied from EquipoKit's `ChatMarkdown`, `MarkdownStreamRenderer` and `MarkdownDraft`, at `00d09aa7`, with the source noted in each file), snapshot tests. |
| + |
| +- [ ] Draw, matching the approved mockups: |
| + - the thread: person and Assistant bubbles; the streaming draft and caret; the thinking line, with glance text (dots, then the words); |
| + - job pills: state mark, title and stage, the Try it link, and the open cards hanging under the pill; |
| + - cards: question, connect and outcome, with choices as ghost buttons; |
| + - "Jump to latest"; |
| + - the composer: Send and Stop inside the field, and the luminous focus edge; |
| + - Ask's non-ready states (`connect`, `pending`, `reconnect`, `unavailable`, `norunner`, `oldrunner`, `not_linked`), with the web's approved copy. |
| +- [ ] **Behaviour:** |
| + - Sending uses a fresh idempotency key per message; a resend after a network error reuses it. |
| + - Answering posts the card's revision, and a 409 `card_stale` redraws the card. |
| + - Stop cancels the turn. |
| + - A pill opens its job view: a popover on the Mac, a sheet on the iPhone. It shows the job's title (linking to Equipo, as on the web), status, detail, ended cards and start time. The jobs design (11-20) adds decisions to it later. |
| +- [ ] **Accessibility:** VoiceOver labels (a pill reads "Christmas order form, One question for you"), Dynamic Type up to accessibility sizes, and Reduce Motion stopping the working arc and the caret. |
| +- [ ] Snapshots of the mockups' thread on Mac and iPhone, light and dark, and at large text. |
| + |
| +## Task 12 (Base): sign-in and Ask set-up, without a step |
| + |
| +**Files:** `SignIn/BaseOnboarding.swift`, `Session/AskSetup.swift`, tests. |
| + |
| +- [ ] **Step 1: tests (`AskSetupTests`, fake client and fake kit).** |
| + - After sign-in, if `/ask/state` is `connect` or `reconnect`, or `renew_after` has passed: |
| + 1. call `assertion(for: equipo_origin)`; |
| + 2. `POST /api/v1/ask/oficina`; |
| + 3. reload the state. |
| + - `not_linked` shows the non-ready state, with no loop. |
| + - A failure leaves the state as Base reports it and retries on the next foreground, never more than once a minute. |
| +- [ ] **Step 2: implement.** |
| + - `BaseOnboarding` is the kit's `OficinaOnboardingView` in Base's look (the sky behind; wordmark; copy per the mockup: "Sign in to Base", "Use your Oficina ID, the same one as Docs, Sheets and Calls."). The kit's straight-in means most people never see it. |
| + - The `unknown` answer (P3): "Sign in to Base on the web once with your Oficina ID, then come back." It has a button that opens Base's `/signin` in the browser. |
| + |
| +## Task 13 (Base): the Mac app |
| + |
| +**Files:** `BaseMac/*`. |
| + |
| +- [ ] **The window (B):** |
| + - The sky, with a floating glass sidebar and the Ask pane as a sheet (mockup `mac-main-b`). |
| + - **Sidebar:** |
| + - Ask Base, with a badge counting jobs in `asking` or `stopped`; |
| + - Getting started, while any step is open; |
| + - Apps: each opens through `Opener` (P12); |
| + - the team's name, with Store and People (opening the web); |
| + - at the foot, the person and team, with a menu (Switch team, Sign out, Open Base on the web). |
| + - The sidebar toggle in the pane's bar. |
| + - Window state restores. |
| + - One window; ⌘N does nothing new. |
| +- [ ] **The menu-bar panel:** `MenuBarExtra(isInserted:)` with `.window` style, showing the compact Ask (mockup `mac-menubar`). |
| + - The field has focus when the panel opens. |
| + - Jobs waiting on the person sit at the top. |
| + - Open Base brings the window forward. |
| + - The foot shows the team and the shortcut, if one is set. |
| +- [ ] **Settings (⌘,),** three tabs (mockup `mac-settings`): |
| + - **General:** Appearance (writes the member's Appearance on the web through the existing `POST /settings/appearance`, with the native session); Show Base in the menu bar; Shortcut for Ask Base (KeyboardShortcuts recorder, empty by default); Open Base when you log in (`SMAppService.mainApp`); Open Oficina apps in (The app / The browser); and Notifications (opens System Settings; there are no notifications until slice 2, so the row is hidden in slice 1). |
| + - **Account:** the Oficina ID, the team, Switch team and Sign out. |
| + - **Ask Base:** connected or not, and Disconnect. |
| +- [ ] **Chrome:** |
| + - `PlainAppNameCommands()` first, `NativeUpdater(policy: .quiet)`, `NativeUpdateCommands`; |
| + - a Colophon under Help (estilo's catalog plus KeyboardShortcuts, swift-cmark, Sparkle, Timeless Sans and DM Sans, each with its licence); |
| + - an offline banner from the kit, with Base's copy. |
| +- [ ] **Snapshots:** window B, the menu panel and Settings, in light and dark. |
| + |
| +## Task 14 (Base): the iPhone app |
| + |
| +**Files:** `BasePhone/*`, `ios/project.yml`. |
| + |
| +- [ ] **Ask first** (mockup `phone-ask`): round glass buttons for Apps (left) and the person (right, a menu: Switch team, Sign out, Open Base on the web), the title "Ask Base" with the team under it, then the thread and composer. |
| +- [ ] **The Apps sheet** (`phone-apps`): steps and a 4-column grid, opening each app through `Opener` (P12). |
| +- [ ] **The job sheet** (`phone-job`), with today's content (Task 11). |
| +- [ ] **The keyboard:** the composer rides above it, the thread keeps its newest message in view, and there's no zoom on focus. |
| +- [ ] **Snapshots:** the iPhone 18 Pro simulator ("Rastrillo Snapshots"), light and dark, at large text. |
| + |
| +## Task 15 (Base): release tooling |
| + |
| +**Files:** |
| +- `native/scripts/release-mac.sh` (Equipo's `release-equipo-0.1.5.sh` steps: build-mac, then `release_mac.py`, a smoke check, and `publish_mac_update.py`) |
| +- `native/scripts/testflight.sh` (a copy of `agent-tools/equipo-tf/testflight.sh` with Base's paths, profiles and bundle ID) |
| + |
| +- [ ] Both scripts plan by default and act only with `--publish` / `--upload`. |
| +- [ ] Dry runs pass locally up to the signing step. Real signing waits on Paul's portal steps (Task 17). |
| + |
| +## Task 16 (Base): gates and hand-over |
| + |
| +- [ ] **Gates:** `make ci` green; `native/scripts/check-native.sh` green; snapshots recorded and reviewed by eye against the mockups. |
| +- [ ] **Review:** ask for a review of the server half (Tasks 3 to 7) and the native half (8 to 15), by a reviewer of another model family. Record findings and fixes in `.superpowers/sdd/2026-11-23-base-native/progress.md`. |
| +- [ ] **Hand-over** to the controller: branch, commits, gates, the new strings for copy review, and the operator steps. |
| + |
| +## Task 17 (controller, with Paul) |
| + |
| +1. **Copy review** (the `copy-review` skill) of every new string: |
| + - the onboarding and `unknown` copy; |
| + - Settings labels; |
| + - the sidebar's headings; |
| + - menu-panel and offline copy; |
| + - VoiceOver labels. |
| +2. **Paul's portal steps:** |
| + - App ID `works.oficina.base`, with Associated Domains and App Groups; |
| + - iOS development and App Store profiles, and a macOS Developer ID profile, saved to `~/private_keys/oficina/profiles/`; |
| + - the App Store Connect app record, "Oficina Base". |
| +3. **Operator steps:** |
| + - Home: deploy Task 2. Confirm that Base's staging origin and Equipo's staging origin are registered consumers (`HOME_CONSUMERS` or the table), and that the directory lists a `base` app with Base's origin for team `oficina` (the kit opens `team.origin(for: "base")`). |
| + - Base staging: deploy `native/slice-1`; check `/api/version`; check `BASE_EQUIPO_ORIGIN`. |
| + - Make `native-releases/base/`. |
| +4. **Live check on staging,** Mac first, then iPhone through TestFlight: |
| + - straight-in sign-in; |
| + - Ask connects with no code; |
| + - send, stream, cancel and answer a card; |
| + - open Docs natively and Store on the web; |
| + - the menu-bar panel and a recorded shortcut; |
| + - sign out; |
| + - the 7-day renewal, simulated by moving `renew_after`. |
| +5. **Merge** `native/slice-1` on the hub. Release Mac 0.1.0 through Sparkle and iPhone 0.1.0 to TestFlight. |
| + |
| +## Not in this plan |
| + |
| +- Notifications. |
| +- Store and People drawn natively. |
| +- Admitting an invited person straight from native. |
| +- Siri, Shortcuts and the share extension. |
| +- Live Activities. |
| +- Decisions on job pills: the 11-20 jobs design, built for web and native together when it lands. |