package wire import "time" // Push (native slice 2, plan 2026-11-20-equipo-native-slice-2.md): a // paired device registers its APNs token; the engine writes pushes to an // outbox in the transaction of the change; a sender delivers them. // Push environments: the APNs gateway a token belongs to. const ( APNsProduction = "production" APNsDevelopment = "development" ) // Device platforms. Only iOS starts Live Activities (macOS shows the // iPhone's in its menu bar). const ( PlatformIOS = "ios" PlatformMacOS = "macos" ) // MaxPushToken bounds an APNs token in hex: Apple's are 32 bytes today // and may grow. const MaxPushToken = 400 // RegisterPush is the body of POST /api/v1/push-registrations: the // device's APNs token, its environment and platform, and on iPhone the // Live Activity push-to-start token. It is bound to the paired device // credential that sends it and replaces that credential's earlier one. type RegisterPush struct { ActionsVersion int `json:"actions_version,omitempty"` BindingID string `json:"binding_id,omitempty"` Token string `json:"token"` Environment string `json:"environment"` Platform string `json:"platform"` StartToken string `json:"start_token,omitempty"` } // PushRegistration is what the server keeps for the device, without its // tokens (which are never echoed). LiveActivities is whether a // push-to-start token is on file. type PushRegistration struct { Environment string `json:"environment"` Platform string `json:"platform"` LiveActivities bool `json:"live_activities"` UpdatedAt time.Time `json:"updated_at"` } // RegisterActivity is the body of POST // /api/v1/push-registrations/activities: a running Live Activity's own // update token, for the task it follows. The server forgets it when the // activity ends. type RegisterActivity struct { TaskID string `json:"task_id"` Token string `json:"token"` } // LiveActivityAttributesType is the app's ActivityAttributes type, named in a // push-to-start payload ("attributes-type"). const LiveActivityAttributesType = "EquipoTaskAttributes" // LiveActivityAttributes are a task Live Activity's fixed attributes. type LiveActivityAttributes struct { TaskID string `json:"task_id"` // Origin is the instance's origin: a device sends this activity's // token only to the account it names. Origin string `json:"origin"` } // Live Activity tones, as Roster's stage track: amber waits on you, red // only for a failure. const ( TonePositive = "positive" ToneWarning = "warning" ToneNegative = "negative" ) // Live Activity and task outcomes. const ( PushOutcomeDone = "done" PushOutcomeCancelled = "cancelled" PushOutcomeFailed = "failed" // PushOutcomeReplaced ends an activity to make room for a newer // task's (at most MaxLiveActivities a person). PushOutcomeReplaced = "replaced" ) // MaxLiveActivities is how many task Live Activities a person has at // once: the most recently started tasks'. const MaxLiveActivities = 3 // LiveActivityState is a task Live Activity's content state, the app's // Codable ContentState: the task, its stage (Task.stage), the specialist // working on it (Step.specialist, or its maker's category: design), the // newest activity line, what it // needs from you (Task.needs_you, "" when nothing), the tone, and once it // ended, the outcome. type LiveActivityState struct { TaskID string `json:"task_id"` Title string `json:"title"` Stage string `json:"stage"` Specialist string `json:"specialist"` Activity string `json:"activity"` NeedsYou string `json:"needs_you"` Tone string `json:"tone"` Outcome string `json:"outcome,omitempty"` } // PushData is what an alert carries beside aps, under "equipo", for the // app to open the right place when it is tapped: a card, a task, or the // conversation (a reply). // PushActions is routing and revision metadata only, never authority or text. type PushActions struct { Version int `json:"version"` BindingID string `json:"binding_id"` NotificationID string `json:"notification_id"` CardKind string `json:"card_kind,omitempty"` CardRevision int64 `json:"card_revision,omitempty"` TaskRevision int64 `json:"task_revision,omitempty"` StepID string `json:"step_id,omitempty"` StepRevision int64 `json:"step_revision,omitempty"` Attempt int64 `json:"attempt,omitempty"` } type PushData struct { Actions *PushActions `json:"actions,omitempty"` Kind string `json:"kind"` CardID string `json:"card_id,omitempty"` TaskID string `json:"task_id,omitempty"` TurnID string `json:"turn_id,omitempty"` } // PushData kinds. const ( PushCard = "card" PushReply = "reply" PushTask = "task" PushBadge = "badge" ) // SetCardVisibility is the body of POST /api/v1/cards/{id}/visibility: // set the card aside (or bring it back) for the person, at the card's // current revision. It never answers, cancels or starts anything; the // card stays in Needs you. type SetCardVisibility struct { Aside bool `json:"aside"` Revision int64 `json:"revision"` } // RetryTask binds notification retry to the exact failed attempt shown. type RetryTask struct { Revision int64 `json:"revision"` StepID string `json:"step_id"` StepRevision int64 `json:"step_revision"` Attempt int64 `json:"attempt"` IdempotencyKey string `json:"idempotency_key"` }