| 1 | # Base on the Mac and iPhone |
| 2 | |
| 3 | Status: draft for Paul's review, 2026-11-23. Read against Base main `d8700cf`, |
| 4 | rastrillo/native `0254817`, Home `8125a3c`, Docs `d5a328a`, Equipo `a697cde9`. |
| 5 | |
| 6 | Decided by Paul so far: |
| 7 | |
| 8 | - The native "launcher" we once discussed for Oficina is **Base**, not a |
| 9 | native Oficina Home (2026-11-23). |
| 10 | - **Base probably replaces Oficina Home in the end; Home stays for now**, |
| 11 | as a slightly different concern (2026-11-24). |
| 12 | - Base's branches land on main first (done: `d8700cf`). |
| 13 | - **Native Base follows Base's look**, not Oficina's Calma (2026-11-23). |
| 14 | - **Mac main window: B**, Ask in the middle with the apps in a floating |
| 15 | sidebar, "for now" (2026-11-23, from the slice 1 mockups). |
| 16 | - **iPhone first screen: A**, Ask first, with the apps one tap away |
| 17 | (2026-11-23). |
| 18 | - **Ask is set up during sign-in, in slice 1** (2026-11-23): nobody approves |
| 19 | a code in Equipo before Ask works (3.8). |
| 20 | - **Slice 2 approved with every recommendation** (2026-11-28): section 7, |
| 21 | and its rulings in 7.9. |
| 22 | - **Jobs started in Equipo stay in Equipo, and jobs started in Base stay in |
| 23 | Base** (2026-11-28): notifications, decision cards and Live Activities. |
| 24 | - **Base takes over the Live Activity for jobs started from Ask** in slice 3 |
| 25 | (2026-11-28). |
| 26 | |
| 27 | Mockups: `.superpowers/mockups/native/` (git-ignored: it holds the licensed |
| 28 | font; `python3 build.py` draws it), shown to Paul on 2026-11-23. |
| 29 | |
| 30 | ## 1. What native Base is for |
| 31 | |
| 32 | Base's direction is "all about doing work and giving the user something to see |
| 33 | very quickly" (Paul, 2026-11-20, jobs design). The native app serves that, |
| 34 | not app launching. On a Mac the Dock and Spotlight already launch apps, and on |
| 35 | an iPhone the Home Screen does. A grid of icons in a window would only copy them. |
| 36 | |
| 37 | What only a native Base can do: |
| 38 | |
| 39 | 1. **Ask Base from anywhere.** One keystroke on the Mac, or Siri and Shortcuts |
| 40 | on the iPhone, opens Ask without finding a browser tab first. |
| 41 | 2. **Tell you when a job needs you.** It sends a notification when a job is |
| 42 | ready, done, stuck or waiting on your decision. The answer's buttons sit on |
| 43 | the notification where the platform allows it. |
| 44 | 3. **Sign in once.** It uses the same Oficina ID as Docs, Sheets, Calls and |
| 45 | Equipo, and goes straight in if one of them already holds it. |
| 46 | 4. **Open your apps.** It opens the native app when one is installed, and the |
| 47 | web app otherwise. |
| 48 | |
| 49 | *My call:* the order of importance is 1, 2, 3, 4, and the first slice is |
| 50 | built to match (section 6). |
| 51 | |
| 52 | ## 2. What exists today (audit) |
| 53 | |
| 54 | ### 2.1 Base's server |
| 55 | |
| 56 | - **Every screen is a server-rendered page behind a browser cookie** |
| 57 | (`internal/web/app.go:160-208`). There is no JSON API for a person. The one |
| 58 | bearer API, `/api/v1/operations`, is for Equipo's Assistant |
| 59 | (`internal/operations`). |
| 60 | - **Sign-in is either Base's own** (email link or passkey) **or Oficina ID**, |
| 61 | through Home's browser handoff (`internal/web/oficina.go`). There is no |
| 62 | native exchange. |
| 63 | - **Ask runs through Base.** Base enrols with Equipo as a device for each |
| 64 | person (`internal/equipo/equipo.go:168-208`). It keeps that person's Equipo |
| 65 | key sealed with `BASE_INSTANCE_KEY`, and relays the snapshot, events, |
| 66 | messages, cancel and card answers (`internal/web/ask*.go`). |
| 67 | - **Connecting Equipo is a one-time code** the person approves in Equipo |
| 68 | (`ask_connect.go:41-135`). |
| 69 | - **Connecting Oficina apps to the Assistant** goes through |
| 70 | oficina-connect (`ask_oficina.go`). |
| 71 | - **Home's apps come from two places.** The team's Oficina apps come from |
| 72 | `BASE_OFICINA_APPS` (`internal/config/oficina.go`) and open in a new tab. |
| 73 | The rest are apps installed from the Store. Base's own pages (Store, |
| 74 | People, Settings) form the dock (`internal/web/home.go:21-50`). |
| 75 | - **Appearance** is System, Light or Dark, stored for each member |
| 76 | (`internal/web/settings.go:44-47`). |
| 77 | - **The jobs design** (`2026-11-20-jobs-that-keep-moving-design.md`, direction |
| 78 | approved) is not built yet. Until it is, job cards can't carry their own |
| 79 | decision, on the web or in a native app. |
| 80 | |
| 81 | ### 2.2 The shared native kit (RastrilloApple) |
| 82 | |
| 83 | - **Oficina ID sign-in:** an email code or a passkey, with straight-in when |
| 84 | another app holds the ID and a chooser when there are two or more IDs |
| 85 | (`OficinaID/OficinaIDModel.swift`). |
| 86 | - **Keychain and App Group:** identities go in the shared group |
| 87 | `9U4A84C4WK.works.oficina.id`. Sessions go in each app's own group. The App |
| 88 | Group is `group.works.oficina` on iOS and `9U4A84C4WK.works.oficina` on the |
| 89 | Mac. |
| 90 | - **Also in the kit:** several accounts, a team step, an offline banner, and |
| 91 | quiet Sparkle updates. |
| 92 | - **Not in the kit:** an account or team menu (Equipo built its own), the |
| 93 | Colophon (each app has its own) and a string catalog. |
| 94 | - **`OficinaApp` has no `base` case** (`OficinaAppearance.swift:7-8`). |
| 95 | |
| 96 | ### 2.3 Equipo's native app |
| 97 | |
| 98 | - **Chat:** `EquipoKit` has public chat pieces: `ConversationScreen`, |
| 99 | `ChatMarkdownView`, `ThinkingLine` and an SSE reader. They are bound to the |
| 100 | Coordinator's routes and `EquipoSession`, and nothing calls the Assistant |
| 101 | routes. Base can adapt them, not drop them in. |
| 102 | - **Push:** registrations, an outbox and payloads are built. Sending is a stub |
| 103 | until the CARLOS `/v1/push` verb and rastrillo's push client exist. Paul |
| 104 | has still to rule who holds the Apple push key (Equipo native slice 2 plan). |
| 105 | - **Live Activities** exist in Equipo's iOS widget extension. |
| 106 | |
| 107 | ### 2.4 Opening other apps |
| 108 | |
| 109 | - **Bundle IDs:** every Oficina native app is `works.oficina.<app>` on every |
| 110 | build (D1, ruled 11-14). D2 puts "Oficina <Name>" in Finder and the plain |
| 111 | name inside the app. |
| 112 | - **Docs, Sheets, Calendar and Memoria** only handle `…://signin`. Opening |
| 113 | their scheme with anything else just launches them. |
| 114 | - **Calls** handles `oficina-calls://join`, and **Equipo** handles |
| 115 | `works.oficina.equipo://task/<id>`. |
| 116 | - **Missing:** universal links, and opening a given document by link. "Open |
| 117 | on the web, already signed in" is spec'd as Home slice D but not built. |
| 118 | |
| 119 | ## 3. How it works |
| 120 | |
| 121 | ### 3.1 Signing in |
| 122 | |
| 123 | - **Oficina ID only, with the kit's flow** (email code, passkey, straight-in). |
| 124 | - **Base becomes a Home consumer.** Its origin is added to `HOME_CONSUMERS`, |
| 125 | and it mounts `connect.Bridge.NativeExchange` at `POST /native/oficina-id`, |
| 126 | as Docs did in `9de84e4`. The exchange mints a native session (method |
| 127 | `home-assertion-native`, seven days). The answer is `ok`, `failed`, |
| 128 | `unknown`, `choose` or `unavailable`, with the kit's handling of each. |
| 129 | - **Also mounted:** `POST /signout`, `POST /native/web/end` and the choose |
| 130 | page at `/account/home/choose`. |
| 131 | - **A Base without Oficina ID** (self-hosted, Base's own sign-in only) gets a |
| 132 | "Use the browser instead" path in a later slice, not in slice 1 (*my |
| 133 | call*). Every Base Paul runs has Oficina ID. |
| 134 | |
| 135 | ### 3.2 A small JSON API for people |
| 136 | |
| 137 | Under `/api/v1`, with the native session. The routes are the web pages' |
| 138 | reads and writes, not new behaviour: |
| 139 | |
| 140 | - `GET me`: the member, the Base's name and the appearance. |
| 141 | - `GET home`: the steps and the apps in Home's order. Each app carries: |
| 142 | - `kind`: `oficina`, `installed` or `own`; |
| 143 | - its name and web address; |
| 144 | - its tint and icon; |
| 145 | - for Oficina apps, the native bundle ID. |
| 146 | - `ask/*`: the same relay as today's `/ask/*` (state, events, messages, turn |
| 147 | cancel, card answer, connect, check and disconnect), returning JSON and |
| 148 | SSE. |
| 149 | |
| 150 | *My call:* the native app talks **only to Base**, never to Equipo directly. |
| 151 | Base already holds each person's Equipo key, registers itself as the |
| 152 | Assistant's host and translates cards. A second, native path to Equipo would |
| 153 | fork all of that. |
| 154 | |
| 155 | ### 3.3 Ask |
| 156 | |
| 157 | - **Mac:** one window (B, chosen). Ask fills it. A floating glass sidebar |
| 158 | holds Ask Base (with a badge counting jobs waiting on the person), Getting |
| 159 | started while any step is open, every app (Oficina apps, then installed |
| 160 | ones), then Store and People, and the person and team at its foot. |
| 161 | Settings is the app's Settings window (⌘,). The web's layout, Home and Ask |
| 162 | side by side (A), was the alternative. |
| 163 | - A **menu-bar item and a global shortcut** open a small Ask panel from |
| 164 | anywhere. Its text field has focus, and the reply streams in. |
| 165 | - The native-levelup audit says to ask before adding a menu-bar item: this |
| 166 | is that ask (Q3). |
| 167 | - **iPhone:** Ask is the first screen (A, chosen). Home's apps sit behind one |
| 168 | button, top left, in a sheet. Home first, as the web's phone layout, was |
| 169 | the alternative. |
| 170 | - **Cards:** they draw what Base's web draws today: question, confirm, |
| 171 | outcome, connect and job cards, with jobs as pills. When the jobs design |
| 172 | lands, the job pill carries its decision on both web and native at once, |
| 173 | because both read the same JSON. |
| 174 | - **Code:** adapted from `EquipoKit`'s chat views and SSE reader, pointed at |
| 175 | Base's `ask/*`. |
| 176 | |
| 177 | ### 3.4 Opening apps |
| 178 | |
| 179 | - **Mac:** if the Oficina app's bundle ID is installed, open it with |
| 180 | `NSWorkspace`. Otherwise open its web address in the default browser. |
| 181 | - **iPhone:** an app can't be opened by bundle ID, so the kit's |
| 182 | `handleOpenURL` gains `…://open`, a small kit change that every app picks up |
| 183 | at its next repin. Until then, the web address. |
| 184 | - **Store apps** always open on the web. |
| 185 | - **When Home slice D lands**, "open on the web" arrives already signed in. |
| 186 | Until then the browser may ask once. |
| 187 | |
| 188 | ### 3.5 Notifications (slice 2) |
| 189 | |
| 190 | - **Equipo sends them**, to the Base app's device registrations, through |
| 191 | Equipo's existing outbox. *My call:* Equipo knows every job's state the |
| 192 | moment it changes, and Base only sees it while relaying a chat. |
| 193 | - **Blocked on** the CARLOS push verb and the ruling on who holds the Apple |
| 194 | push key, the same blockers as Equipo's own push. |
| 195 | - **Decided in section 7** (2026-11-28): Equipo sends, to registrations |
| 196 | Base relays, and each app hears only the jobs started in it (7.2). |
| 197 | |
| 198 | ### 3.6 The look |
| 199 | |
| 200 | Base's approved look (first-slice spec section 6), translated: |
| 201 | |
| 202 | - **Sky and fog:** the deep indigo sky with teal, violet, rose and mist fog, |
| 203 | and the swaying amber beam. Drawn with SwiftUI `MeshGradient` and `Canvas`. |
| 204 | Fog loops of 10 to 17 seconds, still when Reduce Motion is on. |
| 205 | - **Glass:** system materials with Base's dark tint (`--glass-base` |
| 206 | `rgba(14,17,42,.40)`) and a thin bright top edge. Text keeps WCAG AA on |
| 207 | every frame. |
| 208 | - **Accent and buttons:** teal `#6EE7DC` only for finished steps and progress. |
| 209 | Primary buttons are frost white with dark text. |
| 210 | - **Type:** Timeless Sans, the Grotesk cut for headings, bundled through a |
| 211 | fetch step with a pinned checksum. Never committed. No FOUT: the font is in |
| 212 | the bundle, so nothing paints in a fallback face. |
| 213 | - **Appearance:** System, Light and Dark, from the member's setting. |
| 214 | - **Platform rules:** standard platform controls (menus, sheets, toolbars, |
| 215 | Settings), with Base's colours and type. The Mac window is a real window; |
| 216 | nothing in it pretends to be an operating system. |
| 217 | |
| 218 | ### 3.7 Where it lives |
| 219 | |
| 220 | - **Code:** `native/` in this repo, laid out like Equipo's: `apple/` |
| 221 | (BaseKit), `ios/` and `macos/`, on RastrilloApple. |
| 222 | - **Kit changes:** a `base` case on `OficinaApp`, and the `open` URL. |
| 223 | - **Distribution:** Mac through Sparkle and the Mac release assets, iPhone |
| 224 | through TestFlight. |
| 225 | |
| 226 | ### 3.8 Ask set up during sign-in |
| 227 | |
| 228 | Today a person connects Equipo once from Base's web: Base enrols a device key |
| 229 | with Equipo (`internal/equipo/equipo.go:168-208`), the person approves its |
| 230 | code in Equipo, and Base keeps the resulting Equipo key sealed. In the native |
| 231 | app that step disappears: signing in to Base with Oficina ID also connects |
| 232 | Ask, the first time, with nothing to approve. |
| 233 | |
| 234 | Both ends already know the person through Oficina ID, so the approval can be |
| 235 | an Oficina ID proof in place of the code. Two shapes, to settle in the plan |
| 236 | with Equipo's owner: |
| 237 | |
| 238 | - **Base asks for it.** Base's server gets a short-lived Oficina ID assertion |
| 239 | for the person addressed to Equipo (a Home consumer change: Base may ask |
| 240 | for another app's audience only for the person it holds a session for) and |
| 241 | presents it with its device proof. Equipo checks the assertion and the |
| 242 | person's membership, and issues the person's key to Base. The native app |
| 243 | does nothing extra. |
| 244 | - **The app carries it.** At sign-in the native app fetches a second |
| 245 | assertion from Home with Equipo's audience, as it fetched Base's, and |
| 246 | hands it to Base with the exchange. Base presents it to Equipo as above. |
| 247 | No change to Home's rules about audiences, one more round trip for the app. |
| 248 | |
| 249 | *My call:* the second, because it keeps Home's rule that an assertion is |
| 250 | fetched by the person's own device for one app. Either way the web keeps its |
| 251 | code as a fallback, and a person whose Equipo membership is missing sees |
| 252 | Ask's existing "isn't set up for you yet" state. |
| 253 | |
| 254 | ## 4. Questions for Paul |
| 255 | |
| 256 | 1. **Base and Oficina Home.** Decided (Paul, 2026-11-24): Base probably |
| 257 | replaces Home as Oficina's front door in the end, but Home stays for now, |
| 258 | because it is a slightly different concern (Oficina ID, the team |
| 259 | directory and the suite's own front page). Nothing in this slice moves |
| 260 | Home's work into Base. |
| 261 | 2. **Bundle ID and name.** Base isn't only Oficina's: it fronts Keymail, |
| 262 | Sporran and the rest. Recommended: `works.oficina.base`, named "Base". It |
| 263 | lives at base.oficina.works and shares Oficina ID's keychain group. The |
| 264 | alternative is a CARLOS ID such as `com.carloku.base`. |
| 265 | 3. **Mac menu-bar item and global shortcut** for Ask. Recommended: yes, with |
| 266 | the shortcut off until the person sets one. |
| 267 | 4. **Store, People and Settings in slice 1?** Recommended: Settings natively |
| 268 | (account, appearance, sign out, Equipo connection). Store and People open |
| 269 | Base on the web in slice 1 and go native in slice 2. |
| 270 | 5. **Notifications:** sent by Equipo (recommended) or by Base. Decided |
| 271 | (Paul, 2026-11-28): Equipo (7.2, 7.9). |
| 272 | |
| 273 | ## 5. Not doing |
| 274 | |
| 275 | - A grid-of-icons launcher as the main screen. |
| 276 | - Base's own sign-in in the native app (slice 1). |
| 277 | - Installing Oficina, Keymail or Sporran from the Store. That is the web |
| 278 | Store's later slice; native follows it. |
| 279 | - Widgets and Live Activities before notifications. |
| 280 | |
| 281 | ## 6. Slices |
| 282 | |
| 283 | 1. **Sign in, Ask, Home.** |
| 284 | - Server: native exchange, JSON API. |
| 285 | - Native: Mac window with menu-bar Ask, iPhone with Ask first, Home's apps |
| 286 | opening as in 3.4, Settings. |
| 287 | - Mockups first, for Paul to approve. Then the plan. |
| 288 | 2. **Notifications, Store and People native, and the jobs design's |
| 289 | decisions on cards** (if not already built for the web). Specified in |
| 290 | section 7, in four parts (7.11); part 1 is planned in |
| 291 | `docs/superpowers/plans/2026-11-28-native-slice2-part1.md`. |
| 292 | 3. **Siri and Shortcuts** ("Ask Base"), a share extension ("Send to Base"), |
| 293 | and Live Activities for running jobs. |
| 294 | |
| 295 | ## 7. Slice 2: notifications, decisions on cards, Store and People, files |
| 296 | |
| 297 | Approved by Paul on 2026-11-28, with every recommendation as written (7.9). |
| 298 | Read against Base main `07ec2ec`, Equipo origin/main `8bd40ed1`, CARLOS |
| 299 | origin/main `e210550b1` and its push branch `379d97d17` |
| 300 | (`design/platform-push-submission`), rastrillo `0033fa0e` (v0.47.0), |
| 301 | rastrillo/native `bb989a7`, Docs `78fb1db`, Sheets `76b7abc`, Slides |
| 302 | `a27d28d`, Home `88f610a`. |
| 303 | |
| 304 | Mockups: `.superpowers/mockups/native-s2/` (git-ignored: it holds the |
| 305 | licensed font; `python3 build.py` draws them), shown to Paul on 2026-11-28. |
| 306 | |
| 307 | Rulings this section works under: |
| 308 | |
| 309 | - **Keep working through the plan in order** (Paul, 2026-11-28). |
| 310 | - **"Equipo jobs started in Equipo should stay in Equipo and jobs started in |
| 311 | Base should stay in Base"** (Paul, 2026-11-28). That covers notifications, |
| 312 | decision cards and, later, Live Activities. Base shows and notifies only |
| 313 | the jobs started from Ask, and Equipo only its own. |
| 314 | - **In slice 3, Base takes over the Live Activity for jobs started from Ask**, |
| 315 | so there's never a duplicate with Equipo's (Paul, 2026-11-28). |
| 316 | - **Files in Ask** (2026-11-26): Equipo holds the bytes (R1), the Assistant |
| 317 | reads a file for 14 days (R3), and native copies Equipo's attachment code |
| 318 | into BaseKit (R5). |
| 319 | |
| 320 | ### 7.1 What exists today |
| 321 | |
| 322 | #### Push |
| 323 | |
| 324 | - **CARLOS `/v1/push` is a spec, not code on main.** |
| 325 | - The spec was approved on 2026-11-20: |
| 326 | `docs/superpowers/specs/2026-11-20-platform-push-submission-design.md` |
| 327 | at `379d97d17`. |
| 328 | - The build is uncommitted work in `carlos/platform-wt-push-build` |
| 329 | (`internal/pusher/`, `internal/pushsubmit/`). Main and v0.44.0 have no |
| 330 | pusher. |
| 331 | - A box-local `carlos-pusher` holds the Apple key, plus a grant file that |
| 332 | names which `(account, app)` may push to which topic (decisions 4 and 9, |
| 333 | and §5 `apns.conf`): |
| 334 | ``` |
| 335 | key NS36T57NS4 9U4A84C4WK production works.oficina.equipo |
| 336 | grant <sqid>/equipo works.oficina.equipo |
| 337 | ``` |
| 338 | - **rastrillo's push client** (`push.FromCarlos`, `push.Submit`) is |
| 339 | uncommitted on `feat/push-submit` in `rastrillo/rastrillo-push-submit`, and |
| 340 | has no tag. |
| 341 | - **Equipo can't send to its own app yet.** |
| 342 | - Registrations, the outbox and the payloads are all built. |
| 343 | - The transport is a stub: `push.FromCarlos` refuses boot when |
| 344 | `CARLOS_PUSH=submit` (`internal/equipo/push/transport.go:50-64`, "SEAM |
| 345 | (2026-11-20)"). |
| 346 | - The topic is a constant, `push.Topic = "works.oficina.equipo"` |
| 347 | (`push/push.go:19`). |
| 348 | - **Equipo's registrations have no app or topic.** |
| 349 | - The table is `push_registrations(credential PRIMARY KEY, person, token, |
| 350 | environment, platform, start_token, …)` |
| 351 | (`migrations/0096_push.sql:8`), with `actions_version` and |
| 352 | `binding_id` added in 0111. |
| 353 | - The routes are `POST /api/v1/push-registrations` and |
| 354 | `…/activities` (`chat/http.go:95-96`). |
| 355 | - Recipients are `push.Devices(person)` (`push/store.go:286`). |
| 356 | - **The Apple key is topic-specific and production-only.** From the CARLOS |
| 357 | spec's "Facts (2026-11-20)": |
| 358 | > "key ID `NS36T57NS4`, Team ID `9U4A84C4WK`. It is **production only** |
| 359 | > and **topic-specific**: its only topic is `works.oficina.equipo` … The |
| 360 | > `.p8` has not been downloaded yet; Apple allows one download." |
| 361 | |
| 362 | So Equipo's key can't push to `works.oficina.base`, and Base needs a key of |
| 363 | its own. |
| 364 | - **Base's app has no push.** Both entitlements files say "No push until |
| 365 | slice 2" (`native/ios/BasePhone.entitlements`, |
| 366 | `native/macos/DeveloperID.entitlements`). Equipo's Mac app shows that a |
| 367 | Developer ID app can get push: it carries |
| 368 | `com.apple.developer.aps-environment = production` |
| 369 | (`equipo native/macos/DeveloperID.entitlements:10-11`). |
| 370 | |
| 371 | #### Where a job started (for the ruling) |
| 372 | |
| 373 | - **Every turn, card and task has a lane** (`wire/assistant.go:8-24`). |
| 374 | - `""` is the Coordinator (Equipo's own conversation). |
| 375 | - `assistant` is Base's Ask. |
| 376 | - `job:h_<id>` is "the Coordinator thread of one job Base handed off". |
| 377 | - **A task's lane comes from the turn that made it.** `chat_tasks.lane` is |
| 378 | set in `chat/tasks.go:866` (migration 0084), and cards inherit it |
| 379 | (`tasks.go:898`). |
| 380 | - **Hand-offs list their tasks** in `chat_handoff_tasks(handoff_id, task_id)` |
| 381 | (0079), and their lane in `chat_handoffs.lane` (0083). |
| 382 | - Hand-offs from before job threads existed have an empty lane. |
| 383 | - Their tasks still appear in `chat_handoff_tasks`, so that table is the |
| 384 | reliable test. |
| 385 | - **Equipo's push rules only half follow the ruling today** |
| 386 | (`push/rules.go:123-200`). |
| 387 | - **Followed:** `card_opens` and `reply_unseen` fire only for the |
| 388 | Coordinator lane (`:126`, `:138`). |
| 389 | - **Not followed:** `task_ends`, `task_fails`, `badge` and the four |
| 390 | `activity_*` rules check no lane. A task Base handed off therefore ends, |
| 391 | fails and runs a Live Activity on Equipo's app today. |
| 392 | - **Why:** `pushTask` (`chat/push.go:426`) builds the change from |
| 393 | `wire.Task`, which has no lane field. |
| 394 | - **No message records which client sent it.** `PersonPrincipal` carries |
| 395 | the credential for each request, but it isn't stored |
| 396 | (`personapi/types.go:16-21`). The lane is the origin, and it is enough. |
| 397 | |
| 398 | #### Decisions on cards |
| 399 | |
| 400 | - **"The jobs design's decisions on cards"** means phase 1 of |
| 401 | `2026-11-20-jobs-that-keep-moving-design.md`, plus Paul's addendum on |
| 402 | context and a recommendation: |
| 403 | - **K1:** the job card carries `ask`, `options`, `actions` and |
| 404 | `receipts`. |
| 405 | - **K2:** one act endpoint, bound to the decision and its revision. |
| 406 | - **K6:** stops, with their reasons and next steps. |
| 407 | - **K11:** "What next?" on a first look. |
| 408 | - **Addendum:** each decision gets context, a link, a recommended option |
| 409 | and a line for each option. |
| 410 | - Folding (K9) is phase 4. |
| 411 | - **None of it is built.** |
| 412 | - **Equipo:** there is no `JobAsk` and no job act route on origin/main. |
| 413 | `decision-cards-context` (`cf0614ec`, 11-20) is unmerged. |
| 414 | - **Base:** `equipo.Card` has no `Ask`, `Actions` or `Receipts` |
| 415 | (`internal/equipo/chat.go:60-76`), and there is no `/ask/jobs/{id}/act` |
| 416 | (`internal/web/ask.go:47-68`). |
| 417 | - **What Base can act on today:** |
| 418 | - question, confirm and outcome cards (`POST /ask/cards/{id}/answer`); |
| 419 | - a paused job's Carry on now (`POST /ask/cards/{id}/carry_on`). |
| 420 | - A job pill shows only its state, its status and one more sentence. |
| 421 | - **Waiting cards** (Equipo `50029aba`) aren't something Base draws. They |
| 422 | are a note in the Assistant's frame, listing Equipo's own open cards |
| 423 | (`chat/waiting_cards.go`). |
| 424 | |
| 425 | #### Store and People on the web |
| 426 | |
| 427 | - **Store** (`internal/web/store.go:32-116`, `templates/store.html`): |
| 428 | - It lists the catalogue: Welcome, Scratchpad and Contra |
| 429 | (`internal/catalog/catalog.json`). |
| 430 | - Each app shows its state: installing, installed or failed (with the |
| 431 | reason). |
| 432 | - The owner can Install, Try again, or Uninstall (with a confirm page). |
| 433 | Everyone else sees "Installed". |
| 434 | - The page refreshes every 2 s while anything is installing. |
| 435 | - **People** (`internal/web/people.go:30-96`, `templates/people.html`): |
| 436 | - It lists the members, each with their initial, name or address, and |
| 437 | Owner, Member or Invited ("Invited. Hasn't signed in yet."). |
| 438 | - The owner can invite by address. The invitation is sent again until one |
| 439 | is delivered. |
| 440 | - There is no Remove: `store.RemoveMember` exists but no route calls it. |
| 441 | - **Neither has JSON.** The native app opens both on the web: |
| 442 | `apiHomeRead` points Base's own pages at `origin + href` |
| 443 | (`internal/web/api.go:115-118`). |
| 444 | |
| 445 | #### Files in Ask |
| 446 | |
| 447 | - **The server side is done.** Slice 1 landed on Base `07ec2ec` and in |
| 448 | Equipo (`can_attach`, `wire/assistant.go:157`; `read_attachment`). |
| 449 | - **Native has every route it needs**, documented in |
| 450 | `docs/api/base-native-v1.md:262-311`: upload, delete, discard, read and |
| 451 | preview. |
| 452 | - **The app shows files only as a line of names** today |
| 453 | (`BaseKit/Ask/Thread.swift:135-159`). |
| 454 | - **Equipo's native code to copy (R5):** |
| 455 | |
| 456 | | File | What it does | |
| 457 | |---|---| |
| 458 | | `EquipoKit/API/Attachments.swift` | the client | |
| 459 | | `Attachments/PhoneAttachmentPicker.swift` | `PhotosPicker`, `fileImporter`, paste | |
| 460 | | `AttachmentDraft.swift` | draft state and refusal codes | |
| 461 | | `AttachmentViews.swift` | the chips (`AttachmentDraftStrip`), the bubble's thumbnails (`MessageAttachments`), the full-size preview | |
| 462 | | `native/share/Sources/EquipoShareCore/AttachmentFile.swift:58-93` | HEIC, HEIF and TIFF to JPEG, a 2560 px long edge | |
| 463 | | `EquipoMac/MacComposer.swift:13-31`, `AttachmentPromises.swift` | paste, drag, and file promises on the Mac | |
| 464 | |
| 465 | Equipo has no Quick Look. |
| 466 | |
| 467 | #### Opening Docs, Sheets and Slides |
| 468 | |
| 469 | - **Base can launch the Docs or Sheets app, not open a document in it.** |
| 470 | - On the Mac, `Opener.mac` opens the app by its bundle ID |
| 471 | (`BaseKit/Home/Opener.swift:22`). |
| 472 | - On the iPhone, everything except Calls and Equipo opens on the web |
| 473 | (`Opener.swift:34`). |
| 474 | - **The kit can open a path; the apps don't use it yet.** |
| 475 | - The kit handles `<scheme>://open?path=…` (`rastrillo/native` |
| 476 | `NativeConnection.swift:82-123`, since `8dc540a`). |
| 477 | - Docs and Sheets pin kits from before that change (`0254817` and |
| 478 | `1e36aac`), and neither sets `onOpen`. |
| 479 | - **No universal links:** |
| 480 | - The only association file is Home's, and it is webcredentials only |
| 481 | (`home internal/home/native_passkey.go:285-312`). |
| 482 | - The app hosts' `/.well-known/apple-app-site-association` answer 404. |
| 483 | - No app claims `applinks:`. |
| 484 | - **Slides has no native app**, and doesn't mount `/native/oficina-id`. |
| 485 | - **Nothing can be framed, and there's no read-only view.** |
| 486 | - Every app sends `frame-ancestors 'none'` and `X-Frame-Options: DENY` |
| 487 | (`rastrillo serve.go:464,480`). |
| 488 | - None has a signed-in read-only or embed view. |
| 489 | - The only read-only pages are the owner's public links: Docs `/p/{token}`, |
| 490 | Sheets `/l/{token}`, Slides `/s/{token}`. |
| 491 | - **Exports exist:** |
| 492 | - Docs: `/d/{sqid}/export.pdf` and `.md`. |
| 493 | - Sheets: `/sheets/{id}/export.xlsx`. |
| 494 | - Slides: a PDF job (`POST /d/{sqid}/export`). |
| 495 | - **Path-based team URLs don't work natively.** `NativeHTTP.origin` rejects |
| 496 | an origin with a path (`NativeHTTP.swift:94-100`), and Docs is the pilot |
| 497 | for path-based teams (ruling 11-26). |
| 498 | |
| 499 | ### 7.2 Notifications |
| 500 | |
| 501 | #### Who sends |
| 502 | |
| 503 | **Decided (7.9, 1): Equipo, through its outbox, to the Base app's |
| 504 | registrations**, as 3.5 said. Equipo learns of every change in the |
| 505 | transaction that makes it. It already has everything else: the outbox, |
| 506 | once-only dedupe, collapse, holds, sealed payloads, retries, action |
| 507 | bindings and receipts. Base would have to build all of that again. |
| 508 | |
| 509 | - **The app still talks only to Base** (3.2). |
| 510 | - It registers its token with Base: `POST /api/v1/push` with `{token, |
| 511 | environment, platform, install, start_token: null}`. |
| 512 | - Base relays the registration to Equipo with the person's bearer, adding |
| 513 | `app: "base"`. |
| 514 | - Answers from a notification go to Base's own routes, as everything else |
| 515 | does. |
| 516 | - **The alternative** was Base sending. Equipo would call Base, as the |
| 517 | Assistant's host, on every job change, and Base would keep its own |
| 518 | devices, outbox and CARLOS grant. Rejected: it is a second outbox and a |
| 519 | new callback channel, for words Equipo already writes. A job card's words |
| 520 | are already Base-facing (Base shows them as given). |
| 521 | |
| 522 | #### What Equipo changes |
| 523 | |
| 524 | - **E-P1. Registrations know their app and device.** |
| 525 | - `push_registrations` gains `app` (`equipo` | `base`) and `install` (the |
| 526 | app install's id). |
| 527 | - The key becomes `(credential, install)`. Base holds one Equipo |
| 528 | credential per person, but that person may have Base on a Mac and on an |
| 529 | iPhone. |
| 530 | - The topic follows from `app`. `push.Topic` becomes a lookup. |
| 531 | - **E-P2. One rule for where work started.** A change is Base's when: |
| 532 | - its lane is `assistant` or starts `job:`; or |
| 533 | - its task is in `chat_handoff_tasks`, which catches hand-offs from |
| 534 | before job threads. |
| 535 | |
| 536 | The rule is computed once into `push.Change` as `Origin`, because |
| 537 | `wire.Task` has no lane. Every rule then reads it: |
| 538 | - Equipo-origin changes go only to `app = equipo` devices. |
| 539 | - Base-origin changes go only to `app = base` devices. |
| 540 | - The rules that don't look at the lane today (`task_ends`, `task_fails`, |
| 541 | `badge`) gain the check. That stops Equipo's app hearing about Ask jobs, |
| 542 | which fixes a breach of the ruling that exists today. |
| 543 | - **E-P3. Base's rules, from the Assistant-lane job card**, not the task. |
| 544 | - A job is a hand-off that may run several tasks. Base knows it by its |
| 545 | job card id. |
| 546 | - Each rule's collapse id is the job card's id, so a newer state replaces |
| 547 | the older notification on every device. |
| 548 | - Its thread id is `job:<card>`. |
| 549 | - Its dedupe is the card's id, state and decision. |
| 550 | - The table follows. |
| 551 | - **E-P4. Base's payload.** |
| 552 | - `aps.alert{title: job title, body: the decision's text or the state |
| 553 | line}`, plus `category`, `thread-id` and `interruption-level`. |
| 554 | - A custom key: |
| 555 | ``` |
| 556 | base: {origin, member, job, revision, decision, actions: {binding, notification_id}} |
| 557 | ``` |
| 558 | - The app needs `origin` and `member` to pick the right account, since |
| 559 | the kit holds several. The words never name Equipo (Review 8). |
| 560 | - **E-P5. Withdraw on settle.** |
| 561 | - When a decision is settled anywhere (a tap, the web, another device), |
| 562 | Equipo sends a background push for that job. |
| 563 | - The app then removes the notifications delivered in its thread |
| 564 | (`removeDeliveredNotifications`). |
| 565 | - Each app also tidies itself whenever it opens. |
| 566 | - **E-P6. The grant.** On each box running an Equipo that serves a Base: |
| 567 | ``` |
| 568 | key <BASE-KEY-ID> 9U4A84C4WK production works.oficina.base |
| 569 | grant <equipo-sqid>/equipo works.oficina.base |
| 570 | ``` |
| 571 | The Live Activity topic `works.oficina.base.push-type.liveactivity` is |
| 572 | allowed with it (CARLOS spec §5). |
| 573 | |
| 574 | #### Which job events notify |
| 575 | |
| 576 | Decided (7.9, 2): |
| 577 | |
| 578 | | Job state (Base's pill) | Notification | Actions (with K1/K2; until then, a tap opens the job) | |
| 579 | |---|---|---| |
| 580 | | Asking: a question | alert | its choices (recommended first, at most 3), and Something else… when words are allowed | |
| 581 | | Asking: "First look ready" | alert | Build it; Try again… (asks "What should change?") | |
| 582 | | Asking: needs your OK (approvals) or replace | alert | none: a tap opens the job (approvals stay on Equipo's pages, K6; Replace drops work) | |
| 583 | | Ready to try | alert | Try it (opens the link) | |
| 584 | | Stopped, with Try again offered | alert | Try again | |
| 585 | | Stopped, otherwise | alert | none | |
| 586 | | Paused | quiet (`passive`) | none: Carry on now spends money, so it stays in the app | |
| 587 | | Done | quiet (`passive`) | none | |
| 588 | | Working, any stage | never | (Live Activities, slice 3) | |
| 589 | | The Assistant replied with no Ask open | alert, Ask's own (7.9, 4) | none | |
| 590 | |
| 591 | - **Never on a notification:** Drop it, Dismiss, Replace it, or anything |
| 592 | that publishes, spends or grants without a confirm in the app. |
| 593 | - **The badge** on the app's icon counts the jobs waiting on you, the same |
| 594 | number as the sidebar's. |
| 595 | - **In the foreground**, a job on screen shows no banner. Anything else |
| 596 | shows one. |
| 597 | |
| 598 | #### The buttons |
| 599 | |
| 600 | - **Actions answer without opening the app.** They use |
| 601 | `.authenticationRequired` and not `.foreground`, so the device must be |
| 602 | unlocked. |
| 603 | - Each is bound to the decision and revision the notification showed, with |
| 604 | its notification id as the idempotency key. |
| 605 | - A `409` (the decision has moved on) answers nothing. The app posts a |
| 606 | local "That's changed since. Open it to see." with Open. |
| 607 | - Equipo's buttons, by contrast, all bring the app forward |
| 608 | (`NotificationResponse.swift:81-93`). |
| 609 | - **Labels are the decision's own** ("Fri 18 Dec"), so categories can't be |
| 610 | fixed ahead. |
| 611 | - A notification service extension (iOS, and macOS 11 or later) registers |
| 612 | one category per decision before the notification shows. |
| 613 | - If that ever loses the race, the fallback is Equipo's: one "Choose…" |
| 614 | that opens the app at the decision. (7.9, 3) |
| 615 | - **On the Mac,** a banner's actions sit under Options. Alert style shows |
| 616 | them as buttons. Both work the same. |
| 617 | |
| 618 | #### Not notifying twice |
| 619 | |
| 620 | - **By construction** (E-P2). A job started in Ask notifies only Base's |
| 621 | devices, and a job started in Equipo only Equipo's. A person with both |
| 622 | apps hears each job once. |
| 623 | - **Across devices:** collapse by job, and withdraw on settle (E-P5). |
| 624 | - **No fallback** (7.9, 5). With no Base app installed, an Ask |
| 625 | job does not notify through Equipo's app. Web push for Base is for later. |
| 626 | |
| 627 | #### What slice 2 does so that slice 3 can take over Live Activities |
| 628 | |
| 629 | 1. **The origin rule (E-P2) decides the Live Activity rules too.** |
| 630 | - Slice 2 makes `activity_*` read `Origin`. |
| 631 | - Until slice 3 ships, Base-origin tasks keep Equipo's Live Activity, as |
| 632 | today (7.9, 6). |
| 633 | - Then one Equipo release switches them to Base's start tokens. It |
| 634 | switches only for people whose Base registration carries a |
| 635 | `start_token`, so there is never both and never a gap. |
| 636 | 2. **Registrations carry `start_token` from day one** (null until slice 3). |
| 637 | `app` decides the topic (`works.oficina.base.push-type.liveactivity`). |
| 638 | 3. **One activity per job, not per task.** Slice 2's collapse ids already |
| 639 | map a task to its hand-off and then to its job card |
| 640 | (`chat_handoff_tasks`). The activity reuses that mapping. |
| 641 | 4. **The payload names `origin` and `member`**, so the widget extension can |
| 642 | pick the account. |
| 643 | 5. **The same Base push key serves Live Activities.** The extension needs |
| 644 | its own App ID (`works.oficina.base.activity`) in slice 3. |
| 645 | |
| 646 | ### 7.3 Decisions on the cards |
| 647 | |
| 648 | - **Native draws what the web draws, from the same JSON** (3.3). It does |
| 649 | that once the jobs design's phase 1 is in Equipo and Base's web (7.9, 10), and |
| 650 | is never built native-first. |
| 651 | - **`Models.swift` gains** the K1 fields: `ask{kind, decision, text, words, |
| 652 | note}`, `options`, `actions`, `receipts`, `updated_at` and `hidden`. It |
| 653 | also gains the addendum's `context`, `link`, `recommended` and each |
| 654 | option's `detail`. |
| 655 | - **The pill** carries the decision under it, as the mockups show: |
| 656 | - the context, the link to the thing, the question; |
| 657 | - the choices, with Recommended and why; |
| 658 | - Something else as a one-line field. |
| 659 | - **Actions:** |
| 660 | - Try again opens its field. |
| 661 | - Drop it confirms ("Drop this job too?"). |
| 662 | - Stops show their reason and Try again. |
| 663 | - **The act:** `POST /ask/jobs/{id}/act` as JSON, with the idempotency key |
| 664 | and revision. A `409` redraws the card from the answer. |
| 665 | - **The job view** adds the first look's picture as a link, the receipts, |
| 666 | Dismiss with Undo for 8 s, and "Open in Equipo" as the title's link. |
| 667 | - **Placement:** jobs that need you move to the end of the thread. |
| 668 | "Waiting on you" and "N finished" fold, by `state` and `updated_at` |
| 669 | (K9, phase 4, when the web has it). |
| 670 | |
| 671 | ### 7.4 Store and People, native |
| 672 | |
| 673 | A small JSON API beside the pages, built from the same builders, behind the |
| 674 | same owner checks: |
| 675 | |
| 676 | - **`GET /api/v1/store`:** `{owner, rows: [{id, name, summary, tint, |
| 677 | icon_svg, state, error}]}`. `state` is `""`, `installing`, `installed` or |
| 678 | `failed`. |
| 679 | - **`POST /api/v1/store/{app}/install`:** `202 {store}`, then poll every |
| 680 | 2 s while any row is installing, as the web does. |
| 681 | - An app already installing answers `202`, and one already installed |
| 682 | `200`, both with the store and without starting anything. |
| 683 | - If starting the install fails, the store is read again. A row that now |
| 684 | shows installing (another request started it) answers `202` as it |
| 685 | stands. Otherwise the answer is `503 unavailable`, and nothing was |
| 686 | claimed: starting fails only before its claim, so a row that still |
| 687 | reads failed shows an earlier failure. |
| 688 | - **`POST /api/v1/store/{app}/uninstall`:** `200 {store}`, `409 busy` |
| 689 | while installing, `403 owner_only` if not the owner. |
| 690 | - **`GET /api/v1/people`:** `{owner, people: [{id, initial, name, email, |
| 691 | role}]}`. `role` is `owner`, `member` or `invited` (not yet signed in), |
| 692 | so no separate `joined` is sent. |
| 693 | - **`POST /api/v1/people`:** `{email}`. It answers `200 {person}` with the |
| 694 | person invited (or already here), `422 bad_email`, `502 mail_failed` |
| 695 | (invite again to retry), or `403 owner_only`. |
| 696 | - **Every route** answers `503 unavailable` when Base can't read its own |
| 697 | store, as the pages do, and `401 unauthenticated` without a member's |
| 698 | session. Nothing removes a member: `DELETE /api/v1/people/{id}` stays |
| 699 | unrouted. |
| 700 | - **Where they show:** |
| 701 | - **Mac:** in the window's pane, from the sidebar. |
| 702 | - **iPhone:** pushed from the apps sheet's new "Your team" section. |
| 703 | - Uninstall confirms with the web's words. |
| 704 | - **`GET /api/v1/home`'s** `own` apps keep their web URLs for older builds. |
| 705 | New builds route Store and People natively by `id`. |
| 706 | - **Not doing:** removing a member. The web has no such action either. |
| 707 | |
| 708 | ### 7.5 The sidebar |
| 709 | |
| 710 | - **Apps folds** (Paul). |
| 711 | - On both, the "Apps" heading is a button with a chevron: in the Mac's |
| 712 | glass sidebar (which isn't a `List`, so not `Section(isExpanded:)`) and |
| 713 | in the iPhone's apps sheet. |
| 714 | - Folded, it shows the count. |
| 715 | - The state is remembered for each person on each device, in |
| 716 | `UserDefaults`. It is keyed by a hash of the signed-in account the |
| 717 | session already holds, so it is right before `/api/v1/me` loads and |
| 718 | offline. It isn't synced, and the web's rail setting (migration 0007) |
| 719 | is its own. |
| 720 | - It starts open. |
| 721 | - **Made with Base.** Decided yes (7.9, 7). It lists what you made through |
| 722 | Ask that has an address: |
| 723 | - **What:** a published site, which shows a filled dot and its address; or |
| 724 | a first look that is still up, which shows a hollow dot and "First |
| 725 | look". Newest first, at most five, then "Show all". |
| 726 | - **Whose:** only jobs started in Base (the ruling). Equipo's own projects |
| 727 | stay in Equipo. |
| 728 | - **Data:** |
| 729 | - Published sites are in `chat_steps.publish`, and reach a task as |
| 730 | `wire.Task.site{app, url, state, at}` (`wire/tasks.go:457`, |
| 731 | `publish.go:102`). |
| 732 | - A task's job is found through `chat_handoff_tasks`. |
| 733 | - `chat_project_places` (0112) holds the deploy binding but no person. |
| 734 | `GET /api/v1/projects` has no site URL (`api.go:302-334`). |
| 735 | - So Equipo adds `GET /api/v1/assistant/made`: the person's Base-origin |
| 736 | jobs with a site or a live first look, as `{job, title, url, kind, |
| 737 | state, at}`. Base relays it as `GET /api/v1/made`, and the web can |
| 738 | show it too. |
| 739 | - **A click** opens the address in the browser. The context menu adds |
| 740 | "Show the job" and "Copy address". |
| 741 | - **Why yes:** it is what Base is for ("something to see very quickly"). |
| 742 | Without it, a finished site falls out of the snapshot after 7 days |
| 743 | (K9), and the only way back to it is Equipo. |
| 744 | - **Why it might be no:** a new Equipo route and section for what may be |
| 745 | only a handful of sites. It comes last in the slice for that reason. |
| 746 | - **Later**, Docs and Sheets the Assistant made through `use` could list |
| 747 | here too. |
| 748 | |
| 749 | ### 7.6 Files in Ask, native (attachments slice 2) |
| 750 | |
| 751 | No server change: the routes exist. BaseKit copies Equipo's code (R5) and |
| 752 | points it at Base's `/ask/attachments`. |
| 753 | |
| 754 | - **Mac:** |
| 755 | - A paperclip left of Send opens the file panel. |
| 756 | - Files can be dropped on the composer or anywhere on the window; the |
| 757 | outline uses the web's words. |
| 758 | - ⌘V pastes. A paste with words pastes the words (D8). Base's composer is |
| 759 | a SwiftUI field, not Equipo's `NSTextView`, so Base takes Paste in its |
| 760 | own Edit menu command and narrows the field's drag types. The plan |
| 761 | says how, and when it falls back to Equipo's editor. |
| 762 | - File promises are honoured, from Photos and Mail. |
| 763 | - **iPhone:** a `+` left of the field, with Photos (`PhotosPicker`, no |
| 764 | permission needed), Camera (`NSCameraUsageDescription`), Files and Paste |
| 765 | (as Equipo's menu has). The field also takes a pasted image. |
| 766 | - **On the device,** HEIC, HEIF and TIFF become JPEG, and anything over |
| 767 | 2560 px is scaled down, before uploading (`AttachmentFile.swift`). A chip |
| 768 | says "from HEIC". 48 MP photos stop being refused. |
| 769 | - At most two files are prepared at once, behind the same gate as the |
| 770 | uploads. A file whose size already rules it out is refused without |
| 771 | being read. |
| 772 | - Only converted output loses its metadata on the device. A PNG or JPEG |
| 773 | at or under 2560 px goes up as it is, and Equipo strips an image's |
| 774 | location on arrival (files spec 1.1). |
| 775 | - **Chips:** |
| 776 | - each has a thumbnail, name, size, an upload ring and Remove; |
| 777 | - Remove deletes the upload; |
| 778 | - uploads and chips survive the app going to the background. An upload |
| 779 | in flight runs as a background task so it can finish. A lost answer |
| 780 | shows Retry, and a retry is a second upload, so an orphan may count |
| 781 | against the 20 for a day; |
| 782 | - unsent uploads are discarded, as best the app can, when the session |
| 783 | ends (`end()`: sign-out, account switch, a rejected session), bounded |
| 784 | at 2 s. When another Oficina app signs the ID out, the session has |
| 785 | gone before Base hears, so nothing can be discarded. Equipo's 24-hour |
| 786 | drop catches that, a killed app, and quitting; |
| 787 | - two uploads at a time. A busy answer is retried by itself up to three |
| 788 | times with backoff, then the chip says busy and offers Retry; |
| 789 | - the paperclip shows only while `can_attach`; |
| 790 | - every refusal has the web's words (copy review 13), and the PDF chip |
| 791 | says "Ask can't read PDFs yet."; |
| 792 | - refused files never take Ask down (D5). |
| 793 | - **In the thread:** thumbnails, then file pills, then the words, as the |
| 794 | web draws them. |
| 795 | - On the Mac, a click or Space opens Quick Look (`QLPreviewPanel`), with |
| 796 | Open with Preview and Share. |
| 797 | - On the iPhone, a tap opens `QLPreviewController`, with Share. |
| 798 | - The original is fetched from `/ask/attachments/{id}` into the app's |
| 799 | cache (7.9, 12): |
| 800 | - **Path:** `Caches/Attachments/<account hash>/<attachment id>/<name>`. |
| 801 | The name is its last path component, with the extension taken from |
| 802 | the media type, so a file can't preview or open as another type. |
| 803 | - **Protection:** kept out of backups. On iOS it uses |
| 804 | `NSFileProtectionComplete`. |
| 805 | - **When it's cleared:** |
| 806 | - on `end()`, and when Ask is disconnected; |
| 807 | - 14 days after the message was sent (the file's date is set to the |
| 808 | message's at download); |
| 809 | - folders of accounts no longer signed in are cleared too; |
| 810 | - the sweep runs at launch, on each return to the foreground, and on |
| 811 | the Mac each time a window opens and daily. |
| 812 | - **One download per file:** a double tap shares it. |
| 813 | - **Copies:** Share and Open with Preview hand a copy to another app, |
| 814 | which is outside these rules once the person sends it there. |
| 815 | - **Not doing:** Equipo's "recent screenshot" suggestion |
| 816 | (`RecentScreenshot.swift`). It needs Photos permission. |
| 817 | |
| 818 | ### 7.7 Opening Docs, Sheets and Slides |
| 819 | |
| 820 | #### In the right app (decided for slice 2: 7.9, 9) |
| 821 | |
| 822 | - **When a reply links an Oficina document,** Base opens it in the |
| 823 | installed app with `works.oficina.docs://open?path=/d/<sqid>` (Sheets: |
| 824 | `/sheets/<id>`), and otherwise on the web. |
| 825 | - Base recognises a link by its host, from `BASE_OFICINA_APPS`, and by |
| 826 | the app's path patterns. |
| 827 | - On the iPhone, Base adds both schemes to `LSApplicationQueriesSchemes`. |
| 828 | - **Each app needs** a kit repin to `8dc540a` or later, and an `onOpen` |
| 829 | that routes the path to the document: |
| 830 | - **Mac:** look up the local document by its sqid and open its window. |
| 831 | - **iPhone:** push the document. |
| 832 | - **Slides** opens on the web: it has no native app. |
| 833 | - **Later:** universal links, once portero serves `applinks` (Home spec |
| 834 | appendix D). They make the same links work from anywhere. |
| 835 | - **Flag:** path-based team URLs (the Docs pilot) need `NativeHTTP.origin` |
| 836 | to accept a path before any of this works for them. |
| 837 | |
| 838 | #### A read-only view inside Base (7.9, 8) |
| 839 | |
| 840 | | | WKWebView of the web app | Render from JSON | Quick Look of an export | |
| 841 | |---|---|---|---| |
| 842 | | **Sign-in** | Needs a web session in the view's cookie store. Home's slice D is for the default browser and isn't built. A cookie bridge (an exchanged native session put into `WKHTTPCookieStore`) is possible, but no spec sanctions it, and `/native/web/end` isn't served | An exchanged session for that app | An exchanged session: Base asks Oficina ID for an assertion addressed to Docs and trades it at Docs' `/native/oficina-id`, as it already does for Equipo. No second sign-in | |
| 843 | | **What each app needs** | A read-only or embed view, which none has today. Framing headers don't matter to a top-level web view | Docs keeps only CRDT updates (`/d/{sqid}/updates`), so Base would need a Yjs reader and a renderer. Sheets' cells are workable | Nothing for Docs (PDF) or Sheets (XLSX). Slides needs `/native/oficina-id` mounted | |
| 844 | | **Fidelity** | Exact and live | Base's own drawing, which drifts from each app | A faithful snapshot, not live | |
| 845 | | **Cost** | High: a new view in three apps, plus a web-session story for embedded views and its security review | Highest, and duplicated per app | Lowest | |
| 846 | |
| 847 | - **Decided: Quick Look of the export now** (7.9, 8). |
| 848 | - Mac: `QLPreviewView` in a pane beside Ask, as in the mockup. |
| 849 | - iPhone: `QLPreviewController`. |
| 850 | - The bar says "Read only" and holds **Edit in Oficina Docs**. It opens |
| 851 | the Docs app at that document when it's installed (as above), and |
| 852 | otherwise the web. |
| 853 | - It reuses slice 2's Quick Look code, and the session is per app and |
| 854 | asked for only when needed. |
| 855 | - **WKWebView later**, once slice D gives embedded views a sanctioned |
| 856 | sign-in and the apps have a read-only view. Then it becomes live. |
| 857 | - **Placement:** after the rest of slice 2. Its Slides half waits on Slides |
| 858 | mounting the exchange. |
| 859 | |
| 860 | ### 7.8 Paul's portal steps (Apple Developer, team 9U4A84C4WK) |
| 861 | |
| 862 | 1. **Identifiers → `works.oficina.base`:** |
| 863 | - Tick **Push Notifications**, then Save. Changing a capability makes the |
| 864 | existing profiles invalid. |
| 865 | - Don't create a Push certificate: the key replaces it. |
| 866 | 2. **Keys → "+":** |
| 867 | - Name: "Oficina Base Push Production". |
| 868 | - Tick **Apple Push Notifications service (APNs)**, then Configure. |
| 869 | - **Environment: Production.** TestFlight and Developer ID builds both |
| 870 | use production. |
| 871 | - **Key restriction: Topic Specific, topic `works.oficina.base`.** This |
| 872 | matches Equipo's key, and CARLOS's decision 5 counts on a key for one |
| 873 | topic. |
| 874 | - Save, Continue, Register. |
| 875 | 3. **Download `AuthKey_<KEYID>.p8` once**, and note the Key ID. |
| 876 | - Apple allows a single download. |
| 877 | - It goes to the operator for `/etc/carlos-pusher/` on each box running |
| 878 | an Equipo that serves a Base (E-P6). |
| 879 | - It must never go in a repo or a chat. |
| 880 | - Equipo's own `.p8` (`NS36T57NS4`) hasn't been downloaded yet either. |
| 881 | Doing both in one sitting saves a second trip. |
| 882 | 4. **Profiles:** regenerate the iOS App Store profile and the macOS |
| 883 | Developer ID profile for `works.oficina.base`, so that both carry |
| 884 | `aps-environment`. Install them where the release scripts read |
| 885 | `OFICINA_PROVISIONING_PROFILE`. |
| 886 | 5. **For the notification service extension (7.9, 3):** |
| 887 | - register `works.oficina.base.notify` (iOS and macOS) with the App |
| 888 | Group `group.works.oficina` on iOS and `9U4A84C4WK.works.oficina` on |
| 889 | the Mac; |
| 890 | - make its two profiles. |
| 891 | 6. **In slice 3 (not now):** `works.oficina.base.activity` for the widget |
| 892 | extension. |
| 893 | |
| 894 | ### 7.9 Paul's rulings (2026-11-28) |
| 895 | |
| 896 | Paul approved every recommendation as written. Each is now decided: |
| 897 | |
| 898 | 1. **Who sends Base's notifications.** **Decided:** Equipo, through its |
| 899 | outbox, to registrations Base relays (7.2). Alternative: Base sends. |
| 900 | 2. **Which job states notify.** **Decided:** the table in 7.2. Asking, |
| 901 | first look, ready and stopped alert. Done and paused are quiet. Working |
| 902 | never notifies. |
| 903 | 3. **Buttons on notifications.** **Decided:** |
| 904 | - the decision's own choices, answered without opening the app, through |
| 905 | a notification service extension; |
| 906 | - never Drop, Replace, publishing or spending; |
| 907 | - "Choose…" as the fallback. |
| 908 | 4. **Assistant replies.** When the Assistant answers and no Ask is open |
| 909 | anywhere, should Base notify? **Decided:** yes, as Equipo does for its |
| 910 | Coordinator (`reply_unseen`). |
| 911 | 5. **A person without the Base app.** Should Ask jobs fall back to Equipo's |
| 912 | app? **Decided:** no, by the ruling. Web push for Base later. |
| 913 | 6. **Equipo's Live Activities for Ask jobs until slice 3.** **Decided:** |
| 914 | keep them until Base's ship, then switch in one release (7.2), so |
| 915 | there's never a gap. Alternative: stop them now. |
| 916 | 7. **"Made with Base" in the sidebar.** **Decided:** yes, named "Made |
| 917 | with Base", listing published sites and live first looks from Ask jobs, |
| 918 | with a new Equipo route. Last in the slice. Alternative names: "Your |
| 919 | sites", "Things you made". |
| 920 | 8. **Reading a Doc inside Base.** **Decided:** Quick Look of the export |
| 921 | now, with Edit in Oficina Docs; a web view later, after slice D. |
| 922 | 9. **Opening a linked Doc or Sheet in its app.** **Decided:** yes in |
| 923 | slice 2, through `://open?path=`. It needs Docs and Sheets to repin and |
| 924 | route the path. |
| 925 | 10. **Decisions on cards wait for the web.** **Decided:** yes. Native |
| 926 | follows phase 1 on the web and is never built first, so both read the |
| 927 | same JSON. |
| 928 | 11. **The push key.** **Decided:** a production, topic-specific key for |
| 929 | `works.oficina.base`. Alternative: one team-wide key for every Oficina |
| 930 | app. That is simpler, but it loses the per-app bound CARLOS relies on. |
| 931 | 12. **Opened files on the device.** **Decided:** kept in the app's cache, |
| 932 | out of backups, cleared on sign-out and after 14 days (matching R3). |
| 933 | Never anywhere else. |
| 934 | |
| 935 | ### 7.10 Blockers |
| 936 | |
| 937 | - **B1. CARLOS `/v1/push`:** the spec is approved, but the build is |
| 938 | uncommitted and undeployed (`carlos/platform-wt-push-build`). |
| 939 | - **B2. rastrillo `push`:** uncommitted, no tag (`feat/push-submit`). |
| 940 | - **B3. Equipo's transport seam:** `push/transport.go:50-64`. It also needs |
| 941 | E-P1 to E-P6 (7.2). |
| 942 | - **B4. Apple:** the Base push key doesn't exist yet, and Paul downloads it |
| 943 | (7.8). The App ID needs Push Notifications and new profiles. Equipo's |
| 944 | `.p8` isn't downloaded either. |
| 945 | - **B5. The jobs design's phase 1** isn't built in Equipo or Base. It is |
| 946 | needed for decisions on the cards and for notification buttons. |
| 947 | - **B6. "Made with Base"** needs Equipo's `GET /api/v1/assistant/made`. |
| 948 | - **B7. Opening documents** needs the Docs and Sheets kit repins and |
| 949 | `onOpen`. Slides needs its exchange mounted. Path-based teams need the |
| 950 | kit's origin fix. |
| 951 | |
| 952 | ### 7.11 Slice plan |
| 953 | |
| 954 | In the plan's order (Paul, 2026-11-28). Within slice 2, the unblocked parts |
| 955 | come first. |
| 956 | |
| 957 | 1. **2a. No blockers.** |
| 958 | - Store and People: the JSON API (7.4) and native screens. |
| 959 | - Apps folding. |
| 960 | - Files in Ask: native copy of Equipo's code, Quick Look, and the HEIC |
| 961 | conversion. |
| 962 | - Copy review of the new strings. |
| 963 | 2. **2b. Notifications, tap to open.** Needs B1 to B4. |
| 964 | - Base: `POST /api/v1/push` relay. |
| 965 | - Equipo: E-P1 to E-P6. |
| 966 | - App: registration, categories, the badge, foreground rules, withdraw. |
| 967 | - Ships without buttons. |
| 968 | 3. **2c. Decisions on the cards, and notification buttons.** Needs B5. |
| 969 | - Pills, the job view, the act, folding when the web has it. |
| 970 | - Then the service extension and the bound actions. |
| 971 | 4. **2d. Made with Base, and opening documents.** Needs B6 and B7. |
| 972 | - The sidebar section. |
| 973 | - `://open` into Docs and Sheets. |
| 974 | - The Quick Look viewer with Edit in Oficina Docs. |
| 975 | |
| 976 | The mockups are signed off (2026-11-28). Each part gets a plan, reviews as before, |
| 977 | and TestFlight and Sparkle releases. |
| 978 | |
| 979 | ### 7.12 Not doing in slice 2 |
| 980 | |
| 981 | - Siri, Shortcuts, the share extension and Live Activities: slice 3. |
| 982 | - Removing members natively. |
| 983 | - Base paths for approvals (K6 keeps them on Equipo's pages). |
| 984 | - A live embedded editor of any Oficina app. |
| 985 | |