oficina / base Public

Clone
git clone https://amadan.net/oficina/base

Plain git — no account needed to clone.

Download

Download this file

1# Base on the Mac and iPhone, slice 1: Implementation Plan
2
3> **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.
4
5**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.
6
7**Architecture:**
8- **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.
9- **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.
10- **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.
11
12**Tech Stack:**
13- Server: Go (`GOTOOLCHAIN=go1.26.11`, `CGO_ENABLED=0`), chi, rastrillo, Home's `connect` module.
14- 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.
15
16**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`).
17
18**Repositories and branches:**
19
20| Repo | Tasks | Branch |
21|---|---|---|
22| **rastrillo/native** | 1 | `base-kit` from `origin/main` `0254817` |
23| **Home** (oficina/home) | 2 | `base-native-app-id` from `origin/main` `8125a3c` |
24| **Base** (this repo) | 3 to 16 | `native/slice-1` from `origin/main` `d8700cf` |
25| Controller | 17 | copy review, operator steps with Paul, live check, release |
26
27**Equipo** needs no change (checked at `00d09aa7`; see P1).
28
29## Plan decisions
30
31- **P1. Equipo's key from Oficina ID lasts 7 days.**
32 - **How it's minted:** Equipo's native exchange (`oficinaid/native.go:56-104`) and `POST /api/v1/auth/devices/native` (`native_device.go`).
33 - **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.
34 - **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.
35 - **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.
36 - **Web-only people** keep the code flow. Whichever key is newest is used.
37 - 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.
38- **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.
39- **P3. Base admits only people already linked in Base** (slice 1).
40 - `Admit`, `Unlinked` and `HomeOnly` stay unset, as on the web today.
41 - 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.
42 - Admitting an invited person straight from native is slice 2, with the team-mode hooks Docs uses.
43- **P4. Ask routes are reused, not copied.**
44 - 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.
45 - 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.
46 - Unauthenticated JSON requests get `401 {"code":"unauthenticated"}`, never a redirect to `/signin`. The kit calls `sessionRejected()` on 401.
47- **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.
48- **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.
49- **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.
50- **P8. Timeless Sans in the app.** `hack/fonts.sh` already fetches the pinned file (git-ignored). The native build copies it into the bundle.
51 - **Release builds** refuse to run without it (`hack/fonts.sh check`).
52 - **Dev builds** fall back to DM Sans (committed, OFL), as the web does.
53 - 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.
54- **P9. The sky** is a `TimelineView`-driven `Canvas`.
55 - **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.
56 - **Reduce Motion** freezes it at the CSS's reduced-motion pose.
57 - **Performance:** it pauses when the window is hidden or the app inactive, and draws at 30 fps.
58- **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).
59- **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.
60- **P12. Opening an Oficina app:**
61 - **Mac:** if `NSWorkspace.urlForApplication(withBundleIdentifier:)` finds the app and Settings says "The app", open it there. Otherwise open the app's web URL.
62 - **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.
63- **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`.
64
65## File map (Base, new)
66
67```
68native/
69 .gitignore *.xcodeproj, generated Info.plists, Resources/Fonts/Timeless*
70 PrivacyInfo.xcprivacy
71 mac-updates.json Sparkle: bundle_id, feed_url …/native-releases/main/base/appcast.xml
72 apple/Package.swift BaseKit (library), BaseMac (executable)
73 apple/Sources/BaseKit/
74 Look/Palette.swift Look/Sky.swift Look/Glass.swift Look/Type.swift Look/Marks.swift
75 API/Client.swift API/Models.swift API/Events.swift
76 Ask/AskModel.swift Ask/Thread.swift Ask/Pill.swift Ask/Card.swift Ask/Composer.swift Ask/Markdown*.swift
77 Home/HomeModel.swift Home/AppIcon.swift Home/Opener.swift
78 Session/BaseSession.swift Session/AskSetup.swift
79 SignIn/BaseOnboarding.swift
80 apple/Sources/BaseMac/ BaseMacApp.swift MainWindow.swift Sidebar.swift MenuPanel.swift Settings*.swift Colophon.swift
81 apple/Sources/BasePhone/ (compiled by the xcodegen project) BasePhoneApp.swift AskScreen.swift AppsSheet.swift
82 apple/Tests/BaseKitTests/ PaletteTests ClientTests EventsTests AskModelTests AskSetupTests OpenerTests
83 ios/project.yml ios/BasePhone.entitlements ios/Assets.xcassets
84 macos/DeveloperID.entitlements
85 scripts/build-mac.sh scripts/build-iphone.sh scripts/check-native.sh scripts/snapshots.sh scripts/fonts-into-bundle.sh
86.amadan/ci.d/20-native check-native.sh on Darwin, --core-only elsewhere
87docs/api/base-native-v1.md
88```
89
90## Task 1 (rastrillo/native): the kit's three additions
91
92**Files:**
93- `Sources/RastrilloApple/OficinaID/OficinaIDModel.swift`
94- `Sources/RastrilloApple/OficinaID/OficinaAppearance.swift`
95- `Sources/RastrilloApple/NativeConnection.swift`
96- their tests
97
98- [ ] **Step 1: tests first.**
99 - `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.
100 - `OficinaAppTests`: `.base` has its symbol and accents.
101 - `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.
102- [ ] **Step 2: implement.**
103 - `public func assertion(for audience: URL) async throws -> (assertion: String, verifier: String)` on `OficinaIDModel`, reusing `service` and the signed-in identity's credential.
104 - 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).
105 - The `open` action on `NativeConnection.handleOpenURL`. It brings the app forward and, with `path`, hands the path to a new optional `onOpen` closure.
106- [ ] **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.
107
108## Task 2 (Home): Base's app ID can use passkeys
109
110**Files:**
111- `internal/home/native_passkey.go:287-294` (`nativeAppIDs`)
112- its test
113
114- [ ] Add `9U4A84C4WK.works.oficina.base` to `nativeAppIDs`. The test asserts the AASA `webcredentials.apps` list contains it.
115- [ ] `make ci`, push, review, merge. Deploying waits for the controller (Task 17), with Home's usual promote and restart (see Home's deploy notes).
116
117## Task 3 (Base): connect bump and native sessions recognised
118
119**Files:**
120- `go.mod`, `go.sum`
121- `internal/web/app.go:261-310` (`requireMember`, `memberFor`, `ownSignInOnly`)
122- `internal/web/oficina.go`
123- tests in `internal/webtest`
124
125- [ ] **Step 1:** bump `amadan.net/oficina/home/connect` (and `handoff`) to Home `origin/main`. Fix any compile changes. `make ci` green before going on.
126- [ ] **Step 2: tests.**
127 - `TestNativeSessionIsAMember`: a session with method `connect.NativeMethod` for a linked member reaches `/`.
128 - `TestNativeSessionExpiresAfterSevenDays`: the same session 7 days and 1 second after `At` is refused.
129 - `TestOwnSignInOnlyRefusesNativeSessions`: passkey registration refuses a native session, as it refuses a Home one.
130- [ ] **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.
131
132## Task 4 (Base): the native exchange and `/signout`
133
134**Files:**
135- `internal/web/oficina.go`, `internal/web/app.go`
136- tests in `internal/webtest`
137
138- [ ] **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):
139 - `TestNativeExchangeMintsASession`: the answer is `200 {state:"ok", name:"__Host-rastrillo_session", value, expires_at}`, and the value opens `/api/v1/me`.
140 - `TestNativeExchangeUnknownPerson`: `403 {state:"unknown"}` for an unlinked subject.
141 - `TestNativeExchangeRefusesBrowsers`: `Origin` or `Sec-Fetch-Site` gets a 400.
142 - `TestSignoutEndsTheNativeSession`: `POST /signout` with the cookie and `Origin: <base origin>` ends the session, and the cookie no longer opens anything.
143- [ ] **Step 2: implement.**
144 - Set `Config.MintNativeSession` to `sess.Mint` with `NativeMethod`; the store keeps `At`.
145 - Mount `r.Post(connect.NativeExchangePath, o.bridge.NativeExchange)` outside CSRF; connect's Middleware already exempts it.
146 - Mount `r.Post("/signout", …)`, which ends the current session (any method) and answers 204 to JSON, or a 303 to `/signed-out`.
147 - Don't mount `/native/web/end` (Home slice D). The kit treats its failure as harmless.
148
149## Task 5 (Base): `GET /api/v1/me` and `GET /api/v1/home`
150
151**Files:**
152- `internal/web/api.go` (new), `internal/web/app.go`
153- `internal/config/oficina.go` (bundle IDs, schemes)
154- tests
155
156- [ ] **Step 1: tests.**
157 - `TestAPIMe`: `{member:{id,name,email,initials,owner}, base:{name,slug,origin,timezone}, appearance:"system|light|dark", equipo_origin:"…"|null}`.
158 - `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.
159 - `TestAPIRefusesWithoutSession`: `401 {"code":"unauthenticated"}`, `Cache-Control: no-store`, no redirect.
160- [ ] **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).
161
162## Task 6 (Base): Ask's JSON contract, written down and pinned
163
164**Files:**
165- `docs/api/base-native-v1.md` (new)
166- `internal/webtest/ask_native_contract_test.go` (new)
167
168- [ ] **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:
169 - `/ask/state` (`state`, `messages`, `jobs`, `cards`, `turn`, `status`, `cursor`);
170 - `/ask/events?after=` (SSE event types and their `data`);
171 - `/ask/messages` (`text`, `key`);
172 - cancel and answer (`choice`, `revision`, `key`), their status codes and error bodies.
173- [ ] **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.
174
175## Task 7 (Base): Ask set up with Oficina ID
176
177**Files:**
178- `internal/equipo/equipo.go`: add `NativeExchange(ctx, assertion, verifier) (cookie, expires, error)` and `RegisterNative(ctx, cookie, pub, label) (Credential, error)`
179- `internal/web/ask_oficina_native.go` (new)
180- `internal/store` (columns for the sealed Equipo session cookie, its expiry, and how the key was minted)
181- `internal/equipo/equipotest` (fake the two Equipo routes)
182- README
183
184- [ ] **Step 1: tests,** against `equipotest`.
185 - `TestAskOficinaConnect`: `POST /api/v1/ask/oficina {assertion, verifier}` from a native session:
186 - Base calls Equipo's `POST /native/oficina-id`, with Host set to Equipo's origin and no `Origin` header;
187 - 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;
188 - then seals the key and cookie, registers the Assistant host as the code flow does, and answers `200 {state:"ready", renew_after}`;
189 - `/ask/state` is `ready`.
190 - `TestAskOficinaUnknown`: Equipo's 403 becomes `409 {state:"not_linked"}`, and nothing is stored.
191 - `TestAskOficinaRenew`: a second post replaces the key and cookie, revoking the old device in Equipo.
192 - `TestAskOficinaRefusesWeb`: a browser session (not native) gets 403; the web keeps its code flow.
193 - `TestAskStateSaysWhenToRenew`: `/ask/state` gains `renew_after` (RFC 3339, empty for code-flow keys) and `equipo_origin`.
194 - `TestDisconnectRevokesOficinaKey`: Settings' Disconnect revokes it as it does a code-flow key.
195- [ ] **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:
196 - A failure from Equipo stores nothing.
197 - Two posts for the same person run one at a time (a per-member lock).
198 - Never send Base's own cookie or session to Equipo.
199- [ ] **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.
200
201## Task 8 (Base): native skeleton builds and is gated
202
203**Files:** `native/` as in the file map (empty views); `.amadan/ci.d/20-native`; `Makefile` (`native-check`).
204
205- [ ] 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:
206 - bundle `works.oficina.base`;
207 - keychain groups `9U4A84C4WK.works.oficina.base`, then `9U4A84C4WK.works.oficina.id` (in that order);
208 - App Group `group.works.oficina` (iOS) and `9U4A84C4WK.works.oficina` (Mac);
209 - `webcredentials:id.oficina.works`;
210 - rastrillo/native pinned at Task 1's merge commit, and swift-cmark at Equipo's pin;
211 - KeyboardShortcuts at its latest tagged release.
212- [ ] `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.
213- [ ] `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`.
214- [ ] 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.
215- [ ] `check-native.sh` passes: `swift test`, the BaseMac build, and an iPhone simulator build.
216
217## Task 9 (Base): the look
218
219**Files:** `BaseKit/Look/*`, `Tests/BaseKitTests/PaletteTests.swift`.
220
221- [ ] **Step 1: tests.**
222 - `PaletteTests`: parses `app.css`, comparing the light and dark values of every token `Palette` mirrors (P7).
223 - `TypeTests`: Timeless registers before first use, and the Grotesk and Sans cuts resolve; with the file absent, DM Sans and no crash.
224- [ ] **Step 2: implement**
225 - `Palette`, keyed by `ColorScheme`;
226 - `Sky` (P9);
227 - `.glass()`, `.sheet()` and `.solid()` modifiers (P10);
228 - `BaseFont.heading(size)` and `.body(size)`;
229 - `Marks`: the state marks (asking, ready, done, stopped paths from `ask.js`; working is a turning arc round a breathing dot).
230 - The member's Appearance from `/api/v1/me` overrides the system's (`preferredColorScheme`).
231- [ ] **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).
232
233## Task 10 (Base): session, client and events
234
235**Files:** `Session/*`, `API/*`, tests.
236
237- [ ] **Step 1: tests.**
238 - `ClientTests`: requests carry the kit's cookie and `Origin`; a 401 calls `sessionRejected()`; a JSON error body becomes a typed error.
239 - `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`.
240 - `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).
241- [ ] **Step 2: implement.**
242 - `BaseSession` wraps `OficinaIDModel.live(configuration: .init(app: "base", appName: "Base"), appGroup:)` and its `client()`.
243 - The client and models.
244 - `AskModel`, an `@Observable` holding the thread, jobs, cards and turn.
245 - The SSE reader, adapted from EquipoKit's `URLSessionTransport.lines()`.
246 - On foreground: `renewIfNeeded()`, then reload state and resume events.
247
248## Task 11 (Base): Ask, drawn
249
250**Files:** `Ask/*`, `Ask/Markdown*.swift` (copied from EquipoKit's `ChatMarkdown`, `MarkdownStreamRenderer` and `MarkdownDraft`, at `00d09aa7`, with the source noted in each file), snapshot tests.
251
252- [ ] Draw, matching the approved mockups:
253 - the thread: person and Assistant bubbles; the streaming draft and caret; the thinking line, with glance text (dots, then the words);
254 - job pills: state mark, title and stage, the Try it link, and the open cards hanging under the pill;
255 - cards: question, connect and outcome, with choices as ghost buttons;
256 - "Jump to latest";
257 - the composer: Send and Stop inside the field, and the luminous focus edge;
258 - Ask's non-ready states (`connect`, `pending`, `reconnect`, `unavailable`, `norunner`, `oldrunner`, `not_linked`), with the web's approved copy.
259- [ ] **Behaviour:**
260 - Sending uses a fresh idempotency key per message; a resend after a network error reuses it.
261 - Answering posts the card's revision, and a 409 `card_stale` redraws the card.
262 - Stop cancels the turn.
263 - 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.
264- [ ] **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.
265- [ ] Snapshots of the mockups' thread on Mac and iPhone, light and dark, and at large text.
266
267## Task 12 (Base): sign-in and Ask set-up, without a step
268
269**Files:** `SignIn/BaseOnboarding.swift`, `Session/AskSetup.swift`, tests.
270
271- [ ] **Step 1: tests (`AskSetupTests`, fake client and fake kit).**
272 - After sign-in, if `/ask/state` is `connect` or `reconnect`, or `renew_after` has passed:
273 1. call `assertion(for: equipo_origin)`;
274 2. `POST /api/v1/ask/oficina`;
275 3. reload the state.
276 - `not_linked` shows the non-ready state, with no loop.
277 - A failure leaves the state as Base reports it and retries on the next foreground, never more than once a minute.
278- [ ] **Step 2: implement.**
279 - `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.
280 - 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.
281
282## Task 13 (Base): the Mac app
283
284**Files:** `BaseMac/*`.
285
286- [ ] **The window (B):**
287 - The sky, with a floating glass sidebar and the Ask pane as a sheet (mockup `mac-main-b`).
288 - **Sidebar:**
289 - Ask Base, with a badge counting jobs in `asking` or `stopped`;
290 - Getting started, while any step is open;
291 - Apps: each opens through `Opener` (P12);
292 - the team's name, with Store and People (opening the web);
293 - at the foot, the person and team, with a menu (Switch team, Sign out, Open Base on the web).
294 - The sidebar toggle in the pane's bar.
295 - Window state restores.
296 - One window; ⌘N does nothing new.
297- [ ] **The menu-bar panel:** `MenuBarExtra(isInserted:)` with `.window` style, showing the compact Ask (mockup `mac-menubar`).
298 - The field has focus when the panel opens.
299 - Jobs waiting on the person sit at the top.
300 - Open Base brings the window forward.
301 - The foot shows the team and the shortcut, if one is set.
302- [ ] **Settings (⌘,),** three tabs (mockup `mac-settings`):
303 - **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).
304 - **Account:** the Oficina ID, the team, Switch team and Sign out.
305 - **Ask Base:** connected or not, and Disconnect.
306- [ ] **Chrome:**
307 - `PlainAppNameCommands()` first, `NativeUpdater(policy: .quiet)`, `NativeUpdateCommands`;
308 - a Colophon under Help (estilo's catalog plus KeyboardShortcuts, swift-cmark, Sparkle, Timeless Sans and DM Sans, each with its licence);
309 - an offline banner from the kit, with Base's copy.
310- [ ] **Snapshots:** window B, the menu panel and Settings, in light and dark.
311
312## Task 14 (Base): the iPhone app
313
314**Files:** `BasePhone/*`, `ios/project.yml`.
315
316- [ ] **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.
317- [ ] **The Apps sheet** (`phone-apps`): steps and a 4-column grid, opening each app through `Opener` (P12).
318- [ ] **The job sheet** (`phone-job`), with today's content (Task 11).
319- [ ] **The keyboard:** the composer rides above it, the thread keeps its newest message in view, and there's no zoom on focus.
320- [ ] **Snapshots:** the iPhone 18 Pro simulator ("Rastrillo Snapshots"), light and dark, at large text.
321
322## Task 15 (Base): release tooling
323
324**Files:**
325- `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`)
326- `native/scripts/testflight.sh` (a copy of `agent-tools/equipo-tf/testflight.sh` with Base's paths, profiles and bundle ID)
327
328- [ ] Both scripts plan by default and act only with `--publish` / `--upload`.
329- [ ] Dry runs pass locally up to the signing step. Real signing waits on Paul's portal steps (Task 17).
330
331## Task 16 (Base): gates and hand-over
332
333- [ ] **Gates:** `make ci` green; `native/scripts/check-native.sh` green; snapshots recorded and reviewed by eye against the mockups.
334- [ ] **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`.
335- [ ] **Hand-over** to the controller: branch, commits, gates, the new strings for copy review, and the operator steps.
336
337## Task 17 (controller, with Paul)
338
3391. **Copy review** (the `copy-review` skill) of every new string:
340 - the onboarding and `unknown` copy;
341 - Settings labels;
342 - the sidebar's headings;
343 - menu-panel and offline copy;
344 - VoiceOver labels.
3452. **Paul's portal steps:**
346 - App ID `works.oficina.base`, with Associated Domains and App Groups;
347 - iOS development and App Store profiles, and a macOS Developer ID profile, saved to `~/private_keys/oficina/profiles/`;
348 - the App Store Connect app record, "Oficina Base".
3493. **Operator steps:**
350 - 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")`).
351 - Base staging: deploy `native/slice-1`; check `/api/version`; check `BASE_EQUIPO_ORIGIN`.
352 - Make `native-releases/base/`.
3534. **Live check on staging,** Mac first, then iPhone through TestFlight:
354 - straight-in sign-in;
355 - Ask connects with no code;
356 - send, stream, cancel and answer a card;
357 - open Docs natively and Store on the web;
358 - the menu-bar panel and a recorded shortcut;
359 - sign out;
360 - the 7-day renewal, simulated by moving `renew_after`.
3615. **Merge** `native/slice-1` on the hub. Release Mac 0.1.0 through Sparkle and iPhone 0.1.0 to TestFlight.
362
363## Not in this plan
364
365- Notifications.
366- Store and People drawn natively.
367- Admitting an invited person straight from native.
368- Siri, Shortcuts and the share extension.
369- Live Activities.
370- Decisions on job pills: the 11-20 jobs design, built for web and native together when it lands.
371