agl 43.10.2 → 43.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +10 -0
- package/dist_serve/bundle.js +2 -2
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.apnsclient.d.ts +5 -3
- package/dist_ts/classes.apnsclient.js +10 -5
- package/dist_ts/classes.controller.js +11 -4
- package/dist_ts/classes.controllerdevices.d.ts +4 -3
- package/dist_ts/classes.controllerdevices.js +3 -2
- package/dist_ts/classes.controllerpush.d.ts +6 -1
- package/dist_ts/classes.controllerpush.js +25 -2
- package/dist_ts/classes.fcmclient.d.ts +2 -1
- package/dist_ts/classes.fcmclient.js +3 -2
- package/dist_ts/classes.pushregistrations.d.ts +13 -3
- package/dist_ts/classes.pushregistrations.js +56 -27
- package/dist_ts_interfaces/devices.d.ts +31 -8
- package/dist_ts_interfaces/devices.js +2 -2
- package/package.json +1 -1
- package/readme.md +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.apnsclient.ts +9 -4
- package/ts/classes.controller.ts +9 -3
- package/ts/classes.controllerdevices.ts +4 -2
- package/ts/classes.controllerpush.ts +31 -1
- package/ts/classes.fcmclient.ts +2 -1
- package/ts/classes.pushregistrations.ts +56 -24
- package/ts_interfaces/devices.schema.json +25 -4
- package/ts_interfaces/devices.ts +32 -8
- package/ts_web/00_commitinfo_data.ts +1 -1
|
@@ -2,7 +2,7 @@ import type { ITypedRequest, implementsTR } from '@api.global/typedrequest-inter
|
|
|
2
2
|
/** The device protocol this controller speaks. */
|
|
3
3
|
export declare const deviceProtocolVersion: {
|
|
4
4
|
readonly major: 1;
|
|
5
|
-
readonly minor:
|
|
5
|
+
readonly minor: 5;
|
|
6
6
|
};
|
|
7
7
|
/** The scheme of a pairing payload: `agl-pair:?origin=<https origin>&controller=<controller id>&code=<base64url>`. */
|
|
8
8
|
export declare const devicePairingScheme: 'agl-pair';
|
|
@@ -720,10 +720,17 @@ export declare const devicePushSummarySentence = "New items wait for you in the
|
|
|
720
720
|
export declare const devicePushReportSentence = "A direct report has a new result.";
|
|
721
721
|
/** The text of the owner's test notification. Since protocol 1.4. */
|
|
722
722
|
export declare const devicePushTestSentence = "Push from AGL works.";
|
|
723
|
+
/**
|
|
724
|
+
* The buttons a notification offers, for an item a device answers from the notification itself. `permission`: Allow
|
|
725
|
+
* once (`device.permission.reply` with `reply: 'once'`), Reject (`reply: 'reject'`) and Open, which opens the item in
|
|
726
|
+
* the app. On iOS it is also the notification's category (`aps.category`). Since protocol 1.5.
|
|
727
|
+
*/
|
|
728
|
+
export type TDevicePushActions = 'permission';
|
|
723
729
|
/**
|
|
724
730
|
* One Inbox item that came: an alert (iOS: thread `inbox`, interruption level `active`; Android: channel Inbox). With
|
|
725
731
|
* previews off it says only the kind's fixed sentence; with previews on also where the item lives, what it asks and
|
|
726
|
-
* its id
|
|
732
|
+
* its id, and for a permission the device can answer (`device.inbox.list` names its answer `session` or `child`) the
|
|
733
|
+
* buttons and the ids their reply names. Tapping it opens the Inbox. Since protocol 1.4.
|
|
727
734
|
*/
|
|
728
735
|
export interface IDevicePushInboxData {
|
|
729
736
|
type: 'inbox';
|
|
@@ -743,6 +750,18 @@ export interface IDevicePushInboxData {
|
|
|
743
750
|
title?: string;
|
|
744
751
|
/** Previews on only: the item's id, as `device.inbox.list` names it. */
|
|
745
752
|
itemId?: string;
|
|
753
|
+
/**
|
|
754
|
+
* Previews on only, and only for an item the device answers from the notification: the buttons it offers. Set
|
|
755
|
+
* together with `sessionId` and `permissionId` (and `childSessionId` for a direct child's permission), never alone.
|
|
756
|
+
* Since protocol 1.5.
|
|
757
|
+
*/
|
|
758
|
+
actions?: TDevicePushActions;
|
|
759
|
+
/** With `actions`: `device.permission.reply`'s `sessionId`. Since protocol 1.5. */
|
|
760
|
+
sessionId?: string;
|
|
761
|
+
/** With `actions`, only for a direct child's permission: `device.permission.reply`'s `childSessionId`. Since protocol 1.5. */
|
|
762
|
+
childSessionId?: string;
|
|
763
|
+
/** With `actions`: `device.permission.reply`'s `permissionId`. Since protocol 1.5. */
|
|
764
|
+
permissionId?: string;
|
|
746
765
|
}
|
|
747
766
|
/**
|
|
748
767
|
* More than four items came at once: one notification says so (iOS: thread `inbox`, level `active`; Android: channel
|
|
@@ -762,7 +781,7 @@ export interface IDevicePushSummaryData {
|
|
|
762
781
|
/**
|
|
763
782
|
* A direct report's new `result:` line, sent only to a registration with `reports` (iOS: thread `reports`,
|
|
764
783
|
* interruption level `passive`; Android: channel Reports, low importance). It leaves the badge alone: a result waits
|
|
765
|
-
* for nobody. Since protocol 1.4.
|
|
784
|
+
* for nobody. Tapping it opens the Driver tab, where the direct reports are. Since protocol 1.4.
|
|
766
785
|
*/
|
|
767
786
|
export interface IDevicePushReportData {
|
|
768
787
|
type: 'report';
|
|
@@ -801,9 +820,11 @@ export interface IDevicePushClearData {
|
|
|
801
820
|
* What a notification from the host carries, the same for both platforms, each value a string because FCM data carries
|
|
802
821
|
* only strings: FCM sends it as a data-only message's `data` (the Android app builds the notification itself), APNs as
|
|
803
822
|
* the payload's `agl` object beside `aps` (an alert push for `inbox`, `summary`, `report` and `test`, a background push
|
|
804
|
-
* for `clear`). No notification carries a session's or a ticket's id with previews off.
|
|
805
|
-
*
|
|
806
|
-
*
|
|
823
|
+
* for `clear`). No notification carries a session's or a ticket's id with previews off. An inbox notification with
|
|
824
|
+
* `actions` names its category on iOS (`aps.category`); an app that registers no category of that name shows it without
|
|
825
|
+
* buttons. A later minor may add keys and types: an app ignores keys it does not know, and a notification whose `type`
|
|
826
|
+
* it does not know, except an iOS alert push, which the system presents from `aps` without running the app. Since
|
|
827
|
+
* protocol 1.4.
|
|
807
828
|
*/
|
|
808
829
|
export type TDevicePushData = IDevicePushInboxData | IDevicePushSummaryData | IDevicePushReportData | IDevicePushTestData | IDevicePushClearData;
|
|
809
830
|
/**
|
|
@@ -1494,8 +1515,10 @@ export interface IReq_DeviceHostGet extends implementsTR<ITypedRequest, IReq_Dev
|
|
|
1494
1515
|
/**
|
|
1495
1516
|
* Registers this device for notifications of what comes into the Inbox, and with `reports` of the direct reports'
|
|
1496
1517
|
* results too: one registration per device, which the next one replaces, so an app registers again with its current
|
|
1497
|
-
* token on every connect.
|
|
1498
|
-
*
|
|
1518
|
+
* token on every connect. A token is one device's: the registration of any other device holding the same platform's
|
|
1519
|
+
* token (the same app, paired before) ends with it. Taken also while the host holds no credential to send with (the
|
|
1520
|
+
* answer's `available` says so). The token stays on the host: no answer, event or log repeats it. Scope `device`.
|
|
1521
|
+
* Since protocol 1.4.
|
|
1499
1522
|
*/
|
|
1500
1523
|
export interface IReq_DevicePushRegister extends implementsTR<ITypedRequest, IReq_DevicePushRegister> {
|
|
1501
1524
|
method: 'device.push.register';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The device protocol this controller speaks. */
|
|
2
|
-
export const deviceProtocolVersion = { major: 1, minor:
|
|
2
|
+
export const deviceProtocolVersion = { major: 1, minor: 5 };
|
|
3
3
|
/** The scheme of a pairing payload: `agl-pair:?origin=<https origin>&controller=<controller id>&code=<base64url>`. */
|
|
4
4
|
export const devicePairingScheme = 'agl-pair';
|
|
5
5
|
/** The first field of the message a device signs to pair. */
|
|
@@ -120,4 +120,4 @@ export const deviceMethods = [
|
|
|
120
120
|
'device.ticket.ask',
|
|
121
121
|
'device.ticket.move',
|
|
122
122
|
];
|
|
123
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
123
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGV2aWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzX2ludGVyZmFjZXMvZGV2aWNlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFrQkEsa0RBQWtEO0FBQ2xELE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFHLEVBQUUsS0FBSyxFQUFFLENBQUMsRUFBRSxLQUFLLEVBQUUsQ0FBQyxFQUFXLENBQUM7QUFFckUsc0hBQXNIO0FBQ3RILE1BQU0sQ0FBQyxNQUFNLG1CQUFtQixHQUFHLFVBQW1CLENBQUM7QUFDdkQsNkRBQTZEO0FBQzdELE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLGlCQUEwQixDQUFDO0FBQ3BFLGtGQUFrRjtBQUNsRixNQUFNLENBQUMsTUFBTSxnQ0FBZ0MsR0FBRyxpQkFBMEIsQ0FBQztBQUMzRSxpRUFBaUU7QUFDakUsTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsRUFBRSxDQUFDO0FBQ3BDLHFFQUFxRTtBQUNyRSxNQUFNLENBQUMsTUFBTSx1QkFBdUIsR0FBRyxDQUFDLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQztBQUNyRCwyRkFBMkY7QUFDM0YsTUFBTSxDQUFDLE1BQU0seUJBQXlCLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQztBQUNuRCxvREFBb0Q7QUFDcEQsTUFBTSxDQUFDLE1BQU0sNEJBQTRCLEdBQUcsQ0FBQyxDQUFDO0FBQzlDLDhEQUE4RDtBQUM5RCxNQUFNLENBQUMsTUFBTSxjQUFjLEdBQUcsRUFBRSxDQUFDO0FBQ2pDLGlFQUFpRTtBQUNqRSxNQUFNLENBQUMsTUFBTSw0QkFBNEIsR0FBRyxFQUFFLENBQUM7QUFDL0MsMERBQTBEO0FBQzFELE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLEVBQUUsR0FBRyxJQUFJLENBQUM7QUFDbkQsNkVBQTZFO0FBQzdFLE1BQU0sQ0FBQyxNQUFNLHNCQUFzQixHQUFHLElBQUksQ0FBQztBQUUzQzs7Ozs7Ozs7O0dBU0c7QUFDSCxNQUFNLENBQUMsTUFBTSx3QkFBd0IsR0FBRztJQUN0QywwQkFBMEI7SUFDMUIsMEJBQTBCO0lBQzFCLGtCQUFrQjtJQUNsQixxQkFBcUI7SUFDckIsc0JBQXNCO0lBQ3RCLDhCQUE4QjtJQUM5Qiw2QkFBNkI7SUFDN0IsK0JBQStCO0lBQy9CLGlDQUFpQztJQUNqQyxtQ0FBbUM7SUFDbkMsc0JBQXNCO0lBQ3RCLHdCQUF3QjtJQUN4Qix1QkFBdUI7SUFDdkIsNEJBQTRCO0lBQzVCLHVCQUF1QjtJQUN2QiwrQkFBK0I7SUFDL0IseUJBQXlCO0lBQ3pCLCtCQUErQjtJQUMvQix1QkFBdUI7SUFDdkIsd0JBQXdCO0lBQ3hCLDZCQUE2QjtJQUM3Qix5QkFBeUI7SUFDekIsdUJBQXVCO0lBQ3ZCLDhCQUE4QjtJQUM5Qiw0QkFBNEI7SUFDNUIsbUNBQW1DO0lBQ25DLDBCQUEwQjtJQUMxQix1QkFBdUI7SUFDdkIsc0JBQXNCO0lBQ3RCLHNCQUFzQjtJQUN0Qix5QkFBeUI7SUFDekIsMkJBQTJCO0lBQzNCLDBCQUEwQjtJQUMxQiwwQkFBMEI7SUFDMUIsdUJBQXVCO0NBQ2YsQ0FBQztBQW13Qlg7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sbUJBQW1CLEdBQStDO0lBQzdFLFVBQVUsRUFBRSxzQ0FBc0M7SUFDbEQsUUFBUSxFQUFFLGdDQUFnQztJQUMxQyxXQUFXLEVBQUUsdUNBQXVDO0lBQ3BELFdBQVcsRUFBRSxzQ0FBc0M7SUFDbkQsTUFBTSxFQUFFLDhCQUE4QjtJQUN0QyxTQUFTLEVBQUUsNkJBQTZCO0lBQ3hDLFNBQVMsRUFBRSx5Q0FBeUM7SUFDcEQsZUFBZSxFQUFFLCtCQUErQjtDQUNqRCxDQUFDO0FBRUYseURBQXlEO0FBQ3pELE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLHNDQUFzQyxDQUFDO0FBRWhGLGlGQUFpRjtBQUNqRixNQUFNLENBQUMsTUFBTSx3QkFBd0IsR0FBRyxtQ0FBbUMsQ0FBQztBQUU1RSxxRUFBcUU7QUFDckUsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBQUcsc0JBQXNCLENBQUM7QUErZTdEOzs7R0FHRztBQUNILE1BQU0sQ0FBQyxNQUFNLDBCQUEwQixHQUFHLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEtBQUssRUFBRSxHQUFHLEdBQUcsSUFBSSxFQUFXLENBQUM7QUErY25HLHdEQUF3RDtBQUN4RCxNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBRyxDQUFDLGNBQWMsRUFBRSxhQUFhLEVBQUUsdUJBQXVCLEVBQUUsbUJBQW1CLENBQVUsQ0FBQztBQUMzSCxNQUFNLENBQUMsTUFBTSxhQUFhLEdBQUc7SUFDM0Isc0JBQXNCO0lBQ3RCLHFCQUFxQjtJQUNyQixxQkFBcUI7SUFDckIseUJBQXlCO0lBQ3pCLHVCQUF1QjtJQUN2QiwwQkFBMEI7SUFDMUIsbUJBQW1CO0lBQ25CLHNCQUFzQjtJQUN0QixtQkFBbUI7SUFDbkIsb0JBQW9CO0lBQ3BCLG9CQUFvQjtJQUNwQixvQkFBb0I7SUFDcEIsMkJBQTJCO0lBQzNCLDZCQUE2QjtJQUM3QixpQkFBaUI7SUFDakIsc0JBQXNCO0lBQ3RCLHdCQUF3QjtJQUN4QixtQkFBbUI7SUFDbkIsbUJBQW1CO0lBQ25CLHVCQUF1QjtJQUN2QixtQkFBbUI7SUFDbkIsb0JBQW9CO0NBQ1osQ0FBQyJ9
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4003,7 +4003,7 @@ The device API is its own contract, separate from the browser's: `ts_interfaces/
|
|
|
4003
4003
|
- `device.directreports.list` lists the active direct reports as the Driver view does, each by its name, with its session as the feed names it, status, projects, ticket, newest `result:` line, open questions and the fleet workers that report to it (name, harness, status, ticket; no directories or profiles), and whether it takes a message. `device.directreport.message` sends one the owner's message as the Driver view does: a fleet worker report is steered through its ticket and answers `fleet` once the steer succeeded (a steer the fleet refused before its dispatch is refused with `direct_report_failed` and the fleet's own text, such as "Worker is archived.", or "The controller operation failed." with the failure journal's reference where a harness's own text failed it; a steer that failed after its dispatch, or whose job does not prove it sent nothing (`errorOutcome` other than `refused`), may have delivered the message and is `outcome_unknown`, "The request may have taken effect. Read again to learn whether it did before sending it again." with the failure journal's reference, which a client never sends again on its own); a Codex thread takes it as the owner's agent message, `steer` into the turn AGL runs or `next-turn`. A turn another Codex client runs is refused with `direct_report_busy` (nothing was sent), a Claude Code session the fleet does not run with `direct_report_failed`, and messages to a report faster than its agent message rate with `rate_limited`. Messages are audited as `session.message` from `Owner` for the device.
|
|
4004
4004
|
- The Host view is read-only (AGL-824): a device changes nothing on the host (no deploy or deploy probe, account, setting, upgrade or pairing). `device.host.get` answers what runs (`agl`: the AGL release, its start, its public origin, and whether a device reaches it through the gateway AGL keeps its route on, with where that route's sync stands, or through the owner's own reverse proxy; never the gateway's address, the client or the route's target), the device itself as the controller keeps it (`device`: name, model, when it paired and when it last connected; a device neither renames nor unpairs itself), the deploy targets (`deploys`: what each runs and since when, whether its probe answers, its newest release, the released versions it does not run (`undeployed`, newest first), and its planned deploys (`plans`: the ticket, the version, the owner's go and, for one queued into a maintenance window, the window's times); never a probe's address, the owner's notes on how it deploys and what a deploy interrupts, a failed probe's text, a plan's question or who deploys it, and the read runs no probe), the inference proxy's account pools (`pools`: each pool's verdict and room, and its accounts by plan and then the most used first, each only as its plan, state and the usage window it is bound by: no account id, and no order that stands in for one) and the API keys (`apiKeys`: per provider, how many keys are under their monthly spend limit, held at it, without one, or not read, judged by the rule AGL's inference proxy places by; no label, email, id or dollar amount). `deploys`, `pools` and `apiKeys` each answer `ready` or `unavailable` on their own, with the reason (`not_running`, `outdated`, or `failed` with the failure journal's `reference`), and the request still answers the others. `host.changed` (no payload) says when to read it again: the deploy targets, their planned deploys (tickets) or the accounts changed. Usage moves without an event, so a client reads it again when the Host view is opened or refreshed.
|
|
4005
4005
|
- The shared board on a device is the browser's board (AGL-1637). `device.board.list` answers one column at a time, as the browser shows its cards (the tasks; an epic and a subtask open with `device.ticket.get`), in the column's order, `limit` (1 to 100, default 50) from `offset`, filtered as the browser filters: `text` (1 to 200 characters, in the key, title, description and source words), `project`, `epic` (the epic's own tasks), `assignee` (`{ kind: 'owner' }`, `{ kind: 'unassigned' }` or a session as the feed names it) and an AutoLabel (`openQuestion`, `planned`, `undeployed`). Every column's count under the same filters comes from the same read as the page, with `total`, the projects the board's tickets name, the epics a filter may choose and the board's `revision`: when a later page answers another revision, or `tickets.changed` arrives, a client reads the board again from offset 0. `device.ticket.get` answers a ticket with its description, source words, links and parent, one page of its discussion (comments and questions together in the order they were written, newest page first, at most `limit` of 1 to 50 and 256 KiB, `before` for the next older page), where it runs (`placement`, from the deploy monitor, `unavailable` on its own as a section of `device.host.get` is) and what it plans (`plans`: the release plan, the maintenance window and the deploy plan, with where the window stands and the owner's go while the monitor answers); no history of its other changes, no source attachments, no plan's question and nothing that names who deploys it. People appear by name: the owner as `kind: 'owner'`, never the owner's account, a person's id or a session the feed does not list (the driver's own session included). `device.ticket.comment` (Markdown, at most 64 KiB as the store keeps it), `device.ticket.ask` (text alone, at most 16 KiB, answered with text) and `device.ticket.move` (to the end of a column; "Move to…" stands in for the browser's drag) run the browser board's own function as the owner, audited as `ticket.comment`, `ticket.ask` and `ticket.move` for the device; `device.ticket.answer` answers a question. The controller decides every change: a refusal changes nothing and carries the ticket store's own code (`deviceTicketRefusalCodes`, such as `ticket_review_branch_required` for a move to review without a branch) and its reason. The app then keeps the owner's draft, reads the ticket again and shows the reason; it never sends a refused change again on its own. A change whose outcome AGL cannot tell is refused as `outcome_unknown` and stays fenced: the app reads the ticket again to learn whether it happened before the owner decides, and never sends it again on its own. Creating, editing and assigning tickets stay in the browser.
|
|
4006
|
-
- Notifications (AGL-1639): `device.push.register` registers the device itself, never another, with its push service's token (`platform` `apns` with the device token as lowercase hex and its `environment`, `sandbox` or `production`, or `fcm` with the registration token) and whether it wants the direct reports' results too (`reports`). A device holds one registration, which the next one replaces, so the app registers again with its current token on every connect; the same request again changes nothing. It answers the registration as `device.host.get` shows it (`push`: `reports`, `previews`, `available`, `lastFailure`), and is taken also while the host cannot send (`available` `false`: the owner has not set the platform's credential, or Apple or Google refused it; see [Notifications](#notifications)). `device.push.unregister` ends it (`removed` says whether there was one). The token is kept only in the registration (`agl_controller_push_registrations`, one record per device, beside the device record and never in it); no answer, event, audit entry or log repeats it. Revoking the device and an origin move delete its registration with it, in the same transaction, and a start removes every registration whose device is gone.
|
|
4006
|
+
- Notifications (AGL-1639): `device.push.register` registers the device itself, never another, with its push service's token (`platform` `apns` with the device token as lowercase hex and its `environment`, `sandbox` or `production`, or `fcm` with the registration token) and whether it wants the direct reports' results too (`reports`). A device holds one registration, which the next one replaces, so the app registers again with its current token on every connect; the same request again changes nothing. A token is one device's: the app holds one pairing, so when a registration takes a token another device's registration holds on the same platform (the app was unpaired without revoking the device here, then paired again), that registration ends in the same transaction and nothing new is sent to it; this controller also drops what it still had queued for that device, while another controller of the same store can still deliver what it had already queued for up to an hour. The earlier device stays paired until it is revoked; the APNs environment is no part of the match. It answers the registration as `device.host.get` shows it (`push`: `reports`, `previews`, `available`, `lastFailure`), and is taken also while the host cannot send (`available` `false`: the owner has not set the platform's credential, or Apple or Google refused it; see [Notifications](#notifications)). `device.push.unregister` ends it (`removed` says whether there was one). The token is kept only in the registration (`agl_controller_push_registrations`, one record per device, beside the device record and never in it); no answer, event, audit entry or log repeats it. Revoking the device and an origin move delete its registration with it, in the same transaction, and a start removes every registration whose device is gone.
|
|
4007
4007
|
- Every refusal of every device method carries one code of `TDeviceRefusalCode` as `error.data.code` and a message to show, whatever the controller refused it with (AGL-1670): the set is closed, and within a major it only grows. The pairing and the connection: `device_unknown` (forget the pairing), `device_pairing_invalid`, `device_pairing_unavailable`, `device_limit`, `device_already_paired`, `device_proof_invalid`, `device_challenge_invalid` and `device_authentication_required`. What the request names is gone: `session_not_found` (list the feed again), `driver_absent`, and the ticket store's `ticket_not_found` and `ticket_question_not_found`. Nothing was done because something else changed meanwhile, so read again, then decide: `concurrent_change` (among others an answer to a permission or question the session no longer holds, AGL-1687), `ticket_revision_conflict` and `direct_report_busy`. Refused by a rule, with the reason: `session_read_only` (including a session whose model or stopped message the owner resolves in the browser first), `invalid_request`, `direct_report_failed` and the ticket store's other codes (`deviceTicketRefusalCodes`). Limits: `rate_limited`, final as every refusal, and `operation_limit`. The controller: `controller_unavailable` (not ready: starting, stopping, or a harness or the Flex child not running) and `controller_failed` (a fault, always "The controller operation failed."; `error.data.reference` names the failure journal entry the owner's browser shows, and no message to a device carries a raw cause such as a socket path or a spawn error). `outcome_unknown` means the request may have happened: AGL dispatched it, or may have, and cannot tell whether it took effect. A client never resends it on its own; it keeps the owner's text, reads the session, the driver or the ticket again to learn the outcome, and the owner decides.
|
|
4008
4008
|
- The controller pushes a device an allowlist of events in their own shape: feed changes, a session's change, its streaming text (snapshots and exact deltas), Inbox changes, the driver's changes (`driver.changed` with its status, also when its transcript or prompts changed, never its streaming text), the direct reports' changes (`directreports.changed`, with no payload, also when fleet workers or tickets changed), the host's changes (`host.changed`, with no payload, when the deploy targets or the accounts changed), the board's changes (`tickets.changed`, with no ticket key and with the board's revision when it moved, followed by `directreports.changed` and `host.changed`, since tickets hold the reports' questions and the planned deploys) and a resynchronization request. Every other event, and every event about a session the feed does not list, stays on the controller. A device that falls behind by 256 events or 4 MiB is resynchronized alone: on `sessions.changed` it lists the feed and reads the open session again, an open Driver view included (the driver's own changes may have folded into it).
|
|
4009
4009
|
- Through the gateway, a device's WebSocket upgrade carries the public origin as `Origin`, like a browser's (Admission).
|
package/ts/00_commitinfo_data.ts
CHANGED
package/ts/classes.apnsclient.ts
CHANGED
|
@@ -54,9 +54,11 @@ const badgeOf = (valueArg: string): number | undefined => (/^\d{1,9}$/u.test(val
|
|
|
54
54
|
/**
|
|
55
55
|
* The APNs request for a notification: an alert push with `aps` (the alert, `thread-id` inbox or reports,
|
|
56
56
|
* `interruption-level` active or passive, the default sound except for a report's result, the badge where the payload
|
|
57
|
-
* carries one
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* carries one, and for an inbox notification with `actions` that value as `category`, the buttons the app registered
|
|
58
|
+
* under it) for `inbox`, `summary`, `report` and `test`, a background push (`content-available`, priority 5) for
|
|
59
|
+
* `clear`, and the payload itself under `agl`. No `mutable-content`: no extension changes a notification. The payload's
|
|
60
|
+
* key is `apns-collapse-id`, so a notification sent again replaces the one shown. None when the payload breaks Apple's
|
|
61
|
+
* limits.
|
|
60
62
|
*/
|
|
61
63
|
export const apnsRequest = (topicArg: string, payloadArg: TDevicePushData, expiresAtArg: number): IApnsRequest | undefined => {
|
|
62
64
|
const alert = (bodyArg: string, titleArg?: string) => (titleArg === undefined ? { body: bodyArg } : { title: titleArg, body: bodyArg });
|
|
@@ -65,7 +67,10 @@ export const apnsRequest = (topicArg: string, payloadArg: TDevicePushData, expir
|
|
|
65
67
|
case 'inbox': {
|
|
66
68
|
const badge = badgeOf(payloadArg.badge);
|
|
67
69
|
if (badge === undefined) return undefined;
|
|
68
|
-
aps = {
|
|
70
|
+
aps = {
|
|
71
|
+
alert: alert(payloadArg.body, payloadArg.title), badge, sound: 'default', 'thread-id': 'inbox', 'interruption-level': 'active',
|
|
72
|
+
...(payloadArg.actions === undefined ? {} : { category: payloadArg.actions }),
|
|
73
|
+
};
|
|
69
74
|
break;
|
|
70
75
|
}
|
|
71
76
|
case 'summary': {
|
package/ts/classes.controller.ts
CHANGED
|
@@ -11024,6 +11024,8 @@ export class OpenCodeController {
|
|
|
11024
11024
|
targets: () => devices.pushTargets(),
|
|
11025
11025
|
delivery: this.pushDelivery,
|
|
11026
11026
|
previews: () => pushSettings.previews(),
|
|
11027
|
+
// The rows `device.inbox.list` names sessions by: a previewed permission a device answers carries its buttons.
|
|
11028
|
+
rowOf: (rowIdArg) => this.sessionFeed?.publishedRow(rowIdArg),
|
|
11027
11029
|
// What the last clean stop announced, read (and removed) before the first change is sent; written by the stop.
|
|
11028
11030
|
handover: {
|
|
11029
11031
|
take: () => takePushHandover(pushControllerId),
|
|
@@ -15138,9 +15140,13 @@ export class OpenCodeController {
|
|
|
15138
15140
|
routerArg.addHandler<IReq_DevicePushRegister>('device.push.register', async (requestArg, toolsArg) => {
|
|
15139
15141
|
const request = validateRequest(() => assertDevicePushRegisterRequest(requestArg));
|
|
15140
15142
|
const { peer, deviceId } = this.requestDevice(toolsArg?.localData);
|
|
15141
|
-
return this.runDeviceOperation(peer, deviceId, async () =>
|
|
15142
|
-
|
|
15143
|
-
|
|
15143
|
+
return this.runDeviceOperation(peer, deviceId, async () => {
|
|
15144
|
+
const { registration, displaced } = await this.requireDevices().registerPush(deviceId, request);
|
|
15145
|
+
// A device whose registration held the same token is this app paired before: drop this controller's queued sends for it
|
|
15146
|
+
// (another controller of the store keeps what it already queued until that ages out).
|
|
15147
|
+
for (const displacedId of displaced) this.pushDelivery?.forget(displacedId);
|
|
15148
|
+
return { push: deviceHostPush(registration, this.devicePushState(deviceId, request.platform)) };
|
|
15149
|
+
}, toolsArg?.abortSignal);
|
|
15144
15150
|
});
|
|
15145
15151
|
|
|
15146
15152
|
routerArg.addHandler<IReq_DevicePushUnregister>('device.push.unregister', async (requestArg, toolsArg) => {
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
readPushTargets,
|
|
35
35
|
sweepPushRegistrations,
|
|
36
36
|
writePushRegistration,
|
|
37
|
+
type IControllerPushRegistrationWrite,
|
|
37
38
|
type IControllerPushTarget,
|
|
38
39
|
type TControllerPushRegistrationRequest,
|
|
39
40
|
type TControllerPushRegistrationState,
|
|
@@ -506,9 +507,10 @@ export class ControllerDevices {
|
|
|
506
507
|
|
|
507
508
|
/**
|
|
508
509
|
* Registers a paired device for notifications, replacing its registration: it runs in the order of the device
|
|
509
|
-
* writes, after a revocation that came first, so a revoked device is never registered.
|
|
510
|
+
* writes, after a revocation that came first, so a revoked device is never registered. The registration of every
|
|
511
|
+
* other device that held the same token goes with it (`writePushRegistration`); the answer names those devices.
|
|
510
512
|
*/
|
|
511
|
-
public registerPush(deviceIdArg: string, requestArg: TControllerPushRegistrationRequest): Promise<
|
|
513
|
+
public registerPush(deviceIdArg: string, requestArg: TControllerPushRegistrationRequest): Promise<IControllerPushRegistrationWrite> {
|
|
512
514
|
if (this.closed) return Promise.reject(deviceRefusal('controller_unavailable', 'The controller is stopping.'));
|
|
513
515
|
return this.mutate(async () => {
|
|
514
516
|
if (!this.records.has(deviceIdArg)) throw deviceRefusal('device_unknown', 'No such device is paired with this controller.');
|
|
@@ -11,12 +11,14 @@ import type { IDirectReport } from '../ts_interfaces/directreports.js';
|
|
|
11
11
|
import {
|
|
12
12
|
controllerInboxLimits,
|
|
13
13
|
type IControllerInboxSnapshot,
|
|
14
|
+
type IControllerSessionFeedRow,
|
|
14
15
|
type TControllerInboxDelta,
|
|
15
16
|
type TControllerInboxItem,
|
|
16
17
|
type TControllerInboxWhere,
|
|
17
18
|
} from '../ts_interfaces/index.js';
|
|
18
19
|
import { apnsRequest } from './classes.apnsclient.js';
|
|
19
20
|
import { fcmMessage } from './classes.fcmclient.js';
|
|
21
|
+
import { deviceInboxItem } from './functions.deviceapi.js';
|
|
20
22
|
import { inboxTitle } from './classes.inbox.js';
|
|
21
23
|
import type { IPushDeliveryTarget } from './classes.pushdelivery.js';
|
|
22
24
|
import { pushKeySubjects, pushNotificationKey, type IControllerPushTarget } from './classes.pushregistrations.js';
|
|
@@ -64,6 +66,11 @@ export interface IControllerPushOptions {
|
|
|
64
66
|
delivery: IControllerPushDelivery;
|
|
65
67
|
/** Whether notifications carry previews (`ControllerPushSettings.previews`). */
|
|
66
68
|
previews(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The session feed's row a device names a session by, as `device.inbox.list` reads it (`SessionFeed.publishedRow`):
|
|
71
|
+
* whether a previewed notification's item is one the device answers.
|
|
72
|
+
*/
|
|
73
|
+
rowOf(rowIdArg: string): IControllerSessionFeedRow | undefined;
|
|
67
74
|
/** Read once as the trigger starts, before any change is sent, and written once by `stop`. */
|
|
68
75
|
handover: IControllerPushHandover;
|
|
69
76
|
/** A failure no caller sees: a registration read that failed, a handover that was not there or not kept, a fault of the trigger. */
|
|
@@ -94,6 +101,24 @@ const pushPlace = (whereArg: TControllerInboxWhere): string => {
|
|
|
94
101
|
}
|
|
95
102
|
};
|
|
96
103
|
|
|
104
|
+
/** A previewed notification's buttons and the ids their reply names (protocol 1.5). */
|
|
105
|
+
type TPushReply = Pick<IDevicePushInboxData, 'actions' | 'sessionId' | 'childSessionId' | 'permissionId'>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The buttons of a previewed notification and the ids `device.permission.reply` names, for a permission a device
|
|
109
|
+
* answers as `device.inbox.list` shows the item (`deviceInboxItem`: answer `session`, or `child` with the child's id);
|
|
110
|
+
* none for any other item.
|
|
111
|
+
*/
|
|
112
|
+
const pushReply = (itemArg: TControllerInboxItem, rowOfArg: (rowIdArg: string) => IControllerSessionFeedRow | undefined): TPushReply => {
|
|
113
|
+
const item = deviceInboxItem(itemArg, rowOfArg);
|
|
114
|
+
if (item.kind !== 'permission' || item.permission === undefined || item.where.kind !== 'session') return {};
|
|
115
|
+
const { sessionId, childSessionId } = item.where;
|
|
116
|
+
const permissionId = item.permission.id;
|
|
117
|
+
if (item.answer === 'session') return { actions: 'permission', sessionId, permissionId };
|
|
118
|
+
if (item.answer === 'child' && childSessionId !== undefined) return { actions: 'permission', sessionId, childSessionId, permissionId };
|
|
119
|
+
return {};
|
|
120
|
+
};
|
|
121
|
+
|
|
97
122
|
/** Whether a payload fits both push services' limits, as their senders build the request. */
|
|
98
123
|
const pushPayloadFits = (payloadArg: TDevicePushData): boolean => (
|
|
99
124
|
apnsRequest('com.modelprofile.harness', payloadArg, 0) !== undefined && fcmMessage('token', payloadArg, 0, 0) !== undefined
|
|
@@ -107,7 +132,7 @@ const cut = (textArg: string, charactersArg: number): string => {
|
|
|
107
132
|
|
|
108
133
|
/**
|
|
109
134
|
* A previewed notification within the push services' limits: its title and body cut shorter until it fits (Apple
|
|
110
|
-
* repeats both in `aps`), or, for an item whose
|
|
135
|
+
* repeats both in `aps`), or, for an item whose ids alone leave no room, `plainArg`. Ids are never cut.
|
|
111
136
|
*/
|
|
112
137
|
const fitted = <TPayload extends IDevicePushInboxData | IDevicePushReportData>(
|
|
113
138
|
plainArg: TPayload,
|
|
@@ -322,6 +347,10 @@ export class ControllerPush {
|
|
|
322
347
|
private sendInboxChange(changeArg: IInboxChange, targetsArg: readonly IControllerPushTarget[]): void {
|
|
323
348
|
const { delivery } = this.options;
|
|
324
349
|
const badge = String(changeArg.total);
|
|
350
|
+
// Read once per change, as `device.inbox.list` would show the items now; only previewed notifications carry it.
|
|
351
|
+
const replies = new Map(changeArg.previews && changeArg.added.length <= pushSummaryThreshold
|
|
352
|
+
? changeArg.added.map((itemArg) => [itemArg.id, pushReply(itemArg, (rowIdArg) => this.options.rowOf(rowIdArg))] as const)
|
|
353
|
+
: []);
|
|
325
354
|
for (const registration of targetsArg) {
|
|
326
355
|
const target = deliveryTarget(registration);
|
|
327
356
|
const summaryKey = pushNotificationKey(registration.salt, pushKeySubjects.summary);
|
|
@@ -343,6 +372,7 @@ export class ControllerPush {
|
|
|
343
372
|
delivery.send(target, changeArg.previews
|
|
344
373
|
? fitted(plain, (charactersArg) => ({
|
|
345
374
|
...plain, title: cut(inboxTitle(pushPlace(item.where)), charactersArg), body: cut(item.title, charactersArg), itemId: item.id,
|
|
375
|
+
...replies.get(item.id),
|
|
346
376
|
}))
|
|
347
377
|
: plain);
|
|
348
378
|
}
|
package/ts/classes.fcmclient.ts
CHANGED
|
@@ -36,7 +36,8 @@ const reservedDataKey = (keyArg: string): boolean => keyArg === 'from' || keyArg
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* The FCM v1 request body for a notification: a data-only message to the registration token (the payload's values as
|
|
39
|
-
* they are, all strings
|
|
39
|
+
* they are, all strings, an inbox notification's `actions` and reply ids too, counted toward the 4096 bytes like every
|
|
40
|
+
* other key; the app builds the buttons), `android.priority` HIGH for what a person acts on (`inbox`, `summary`, `test`) and NORMAL for
|
|
40
41
|
* a report's result and a `clear`, and a `ttl` up to `expiresAtArg`. No collapse key: FCM keeps at most four of them per
|
|
41
42
|
* device, and the app replaces a notification by its tag (the payload's key) itself. None when the payload breaks FCM's
|
|
42
43
|
* limits.
|
|
@@ -106,45 +106,77 @@ export const readPushRegistration = async (deviceIdArg: string): Promise<TContro
|
|
|
106
106
|
return stored === null ? undefined : stateOf(ControllerPushRegistrationModel.exact.toPersisted(stored));
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
/** What a registration wrote: the device's registration, and the other devices whose registration held its token. */
|
|
110
|
+
export interface IControllerPushRegistrationWrite {
|
|
111
|
+
registration: TControllerPushRegistrationState;
|
|
112
|
+
/** The devices whose registration held the same platform and token: deleted with the write, in one transaction. */
|
|
113
|
+
displaced: string[];
|
|
114
|
+
}
|
|
115
|
+
|
|
109
116
|
/**
|
|
110
117
|
* Sets a device's registration: a new one gets a fresh salt, an existing one takes the request's platform, token and
|
|
111
|
-
* choices and keeps its salt; the same request again writes nothing
|
|
112
|
-
*
|
|
118
|
+
* choices and keeps its salt; the same request again writes nothing to it. A token is the address of one app on one
|
|
119
|
+
* phone, and the app holds one pairing: every other device's registration with the same platform and token is the
|
|
120
|
+
* same app paired before (unpaired in the app, never revoked here) and is deleted in the same transaction, so one
|
|
121
|
+
* token never receives a notification twice. The environment is no part of the match: an APNs token is globally unique
|
|
122
|
+
* and belongs to one environment. Nothing records the deletion; the token stays out of every error. The caller runs it
|
|
123
|
+
* after the device's record and in the one order of the device's writes, so a revoked device is never registered again.
|
|
113
124
|
*/
|
|
114
125
|
export const writePushRegistration = async (
|
|
115
126
|
deviceIdArg: string,
|
|
116
127
|
requestArg: TControllerPushRegistrationRequest,
|
|
117
128
|
nowArg: number,
|
|
118
|
-
): Promise<
|
|
129
|
+
): Promise<IControllerPushRegistrationWrite> => {
|
|
119
130
|
const content = {
|
|
120
131
|
platform: requestArg.platform,
|
|
121
132
|
...(requestArg.platform === 'apns' ? { environment: requestArg.environment } : {}),
|
|
122
133
|
token: requestArg.token,
|
|
123
134
|
reports: requestArg.reports,
|
|
124
135
|
};
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
136
|
+
const session = ControllerPushRegistrationModel.collection.smartdataDb.createSession();
|
|
137
|
+
try {
|
|
138
|
+
const written = await session.withTransaction(async (transactionArg): Promise<IControllerPushRegistrationWrite> => {
|
|
139
|
+
const options = { session: transactionArg };
|
|
140
|
+
const displaced: string[] = [];
|
|
141
|
+
const holders = await ControllerPushRegistrationModel.exact.findStored({
|
|
142
|
+
filter: { platform: content.platform, token: content.token }, ...options,
|
|
143
|
+
});
|
|
144
|
+
for (const holder of holders) {
|
|
145
|
+
const { id } = ControllerPushRegistrationModel.exact.toPersisted(holder);
|
|
146
|
+
if (id === deviceIdArg) continue;
|
|
147
|
+
const result = await ControllerPushRegistrationModel.exact.delete({ current: holder }, options);
|
|
148
|
+
if (result.status !== 'deleted') throw new Error('A push registration holding the same token changed concurrently.');
|
|
149
|
+
displaced.push(id);
|
|
150
|
+
}
|
|
151
|
+
const current = await ControllerPushRegistrationModel.exact.findStoredOne({ id: deviceIdArg }, options);
|
|
152
|
+
if (current === null) {
|
|
153
|
+
const inserted = await ControllerPushRegistrationModel.exact.insert({
|
|
154
|
+
id: deviceIdArg, ...content, salt: plugins.crypto.randomBytes(32).toString('base64url'), registeredAt: nowArg,
|
|
155
|
+
}, options);
|
|
156
|
+
if (inserted.status !== 'inserted') throw new Error('The push registration changed concurrently and was not stored.');
|
|
157
|
+
return { registration: stateOf(ControllerPushRegistrationModel.exact.toPersisted(inserted.document)), displaced };
|
|
158
|
+
}
|
|
159
|
+
const stored = ControllerPushRegistrationModel.exact.toPersisted(current);
|
|
160
|
+
if (stored.platform === content.platform && stored.environment === content.environment && stored.token === content.token
|
|
161
|
+
&& stored.reports === content.reports) {
|
|
162
|
+
return { registration: stateOf(stored), displaced };
|
|
163
|
+
}
|
|
164
|
+
const result = await ControllerPushRegistrationModel.exact.transition({ current, change: (modelArg) => {
|
|
165
|
+
modelArg.platform = content.platform;
|
|
166
|
+
if (content.environment === undefined) delete modelArg.environment;
|
|
167
|
+
else modelArg.environment = content.environment;
|
|
168
|
+
modelArg.token = content.token;
|
|
169
|
+
modelArg.reports = content.reports;
|
|
170
|
+
modelArg.registeredAt = nowArg;
|
|
171
|
+
} }, options);
|
|
172
|
+
if (result.status !== 'transitioned') throw new Error('The push registration changed concurrently and was not stored.');
|
|
173
|
+
return { registration: stateOf(ControllerPushRegistrationModel.exact.toPersisted(result.document)), displaced };
|
|
129
174
|
});
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (stored.platform === content.platform && stored.environment === content.environment && stored.token === content.token
|
|
135
|
-
&& stored.reports === content.reports) {
|
|
136
|
-
return stateOf(stored);
|
|
175
|
+
if (written === undefined) throw new Error('The push registration was not stored.');
|
|
176
|
+
return written;
|
|
177
|
+
} finally {
|
|
178
|
+
await session.close();
|
|
137
179
|
}
|
|
138
|
-
const result = await ControllerPushRegistrationModel.exact.transition({ current, change: (modelArg) => {
|
|
139
|
-
modelArg.platform = content.platform;
|
|
140
|
-
if (content.environment === undefined) delete modelArg.environment;
|
|
141
|
-
else modelArg.environment = content.environment;
|
|
142
|
-
modelArg.token = content.token;
|
|
143
|
-
modelArg.reports = content.reports;
|
|
144
|
-
modelArg.registeredAt = nowArg;
|
|
145
|
-
} });
|
|
146
|
-
if (result.status !== 'transitioned') throw new Error('The push registration changed concurrently and was not stored.');
|
|
147
|
-
return stateOf(ControllerPushRegistrationModel.exact.toPersisted(result.document));
|
|
148
180
|
};
|
|
149
181
|
|
|
150
182
|
/**
|
|
@@ -637,7 +637,7 @@
|
|
|
637
637
|
{
|
|
638
638
|
"name": "IReq_DevicePushRegister",
|
|
639
639
|
"method": "device.push.register",
|
|
640
|
-
"description": "Registers this device for notifications of what comes into the Inbox, and with `reports` of the direct reports' results too: one registration per device, which the next one replaces, so an app registers again with its current token on every connect. Taken also while the host holds no credential to send with (the answer's `available` says so). The token stays on the host: no answer, event or log repeats it. Scope `device`. Since protocol 1.4.",
|
|
640
|
+
"description": "Registers this device for notifications of what comes into the Inbox, and with `reports` of the direct reports' results too: one registration per device, which the next one replaces, so an app registers again with its current token on every connect. A token is one device's: the registration of any other device holding the same platform's token (the same app, paired before) ends with it. Taken also while the host holds no credential to send with (the answer's `available` says so). The token stays on the host: no answer, event or log repeats it. Scope `device`. Since protocol 1.4.",
|
|
641
641
|
"request": {
|
|
642
642
|
"type": "object",
|
|
643
643
|
"properties": {
|
|
@@ -2792,6 +2792,22 @@
|
|
|
2792
2792
|
"itemId": {
|
|
2793
2793
|
"type": "string",
|
|
2794
2794
|
"description": "Previews on only: the item's id, as `device.inbox.list` names it."
|
|
2795
|
+
},
|
|
2796
|
+
"actions": {
|
|
2797
|
+
"$ref": "#/components/schemas/TDevicePushActions",
|
|
2798
|
+
"description": "Previews on only, and only for an item the device answers from the notification: the buttons it offers. Set together with `sessionId` and `permissionId` (and `childSessionId` for a direct child's permission), never alone. Since protocol 1.5."
|
|
2799
|
+
},
|
|
2800
|
+
"sessionId": {
|
|
2801
|
+
"type": "string",
|
|
2802
|
+
"description": "With `actions`: `device.permission.reply`'s `sessionId`. Since protocol 1.5."
|
|
2803
|
+
},
|
|
2804
|
+
"childSessionId": {
|
|
2805
|
+
"type": "string",
|
|
2806
|
+
"description": "With `actions`, only for a direct child's permission: `device.permission.reply`'s `childSessionId`. Since protocol 1.5."
|
|
2807
|
+
},
|
|
2808
|
+
"permissionId": {
|
|
2809
|
+
"type": "string",
|
|
2810
|
+
"description": "With `actions`: `device.permission.reply`'s `permissionId`. Since protocol 1.5."
|
|
2795
2811
|
}
|
|
2796
2812
|
},
|
|
2797
2813
|
"required": [
|
|
@@ -2802,7 +2818,7 @@
|
|
|
2802
2818
|
"body"
|
|
2803
2819
|
],
|
|
2804
2820
|
"additionalProperties": false,
|
|
2805
|
-
"description": "One Inbox item that came: an alert (iOS: thread `inbox`, interruption level `active`; Android: channel Inbox). With previews off it says only the kind's fixed sentence; with previews on also where the item lives, what it asks and its id. Tapping it opens the Inbox. Since protocol 1.4."
|
|
2821
|
+
"description": "One Inbox item that came: an alert (iOS: thread `inbox`, interruption level `active`; Android: channel Inbox). With previews off it says only the kind's fixed sentence; with previews on also where the item lives, what it asks and its id, and for a permission the device can answer (`device.inbox.list` names its answer `session` or `child`) the buttons and the ids their reply names. Tapping it opens the Inbox. Since protocol 1.4."
|
|
2806
2822
|
},
|
|
2807
2823
|
"IDevicePushReportData": {
|
|
2808
2824
|
"type": "object",
|
|
@@ -2830,7 +2846,7 @@
|
|
|
2830
2846
|
"body"
|
|
2831
2847
|
],
|
|
2832
2848
|
"additionalProperties": false,
|
|
2833
|
-
"description": "A direct report's new `result:` line, sent only to a registration with `reports` (iOS: thread `reports`, interruption level `passive`; Android: channel Reports, low importance). It leaves the badge alone: a result waits for nobody. Since protocol 1.4."
|
|
2849
|
+
"description": "A direct report's new `result:` line, sent only to a registration with `reports` (iOS: thread `reports`, interruption level `passive`; Android: channel Reports, low importance). It leaves the badge alone: a result waits for nobody. Tapping it opens the Driver tab, where the direct reports are. Since protocol 1.4."
|
|
2834
2850
|
},
|
|
2835
2851
|
"IDevicePushSummaryData": {
|
|
2836
2852
|
"type": "object",
|
|
@@ -4324,6 +4340,11 @@
|
|
|
4324
4340
|
],
|
|
4325
4341
|
"description": "Whether a pool's account takes new work now, or why not. Since protocol 1.3."
|
|
4326
4342
|
},
|
|
4343
|
+
"TDevicePushActions": {
|
|
4344
|
+
"type": "string",
|
|
4345
|
+
"const": "permission",
|
|
4346
|
+
"description": "The buttons a notification offers, for an item a device answers from the notification itself. `permission`: Allow once (`device.permission.reply` with `reply: 'once'`), Reject (`reply: 'reject'`) and Open, which opens the item in the app. On iOS it is also the notification's category (`aps.category`). Since protocol 1.5."
|
|
4347
|
+
},
|
|
4327
4348
|
"TDevicePushData": {
|
|
4328
4349
|
"anyOf": [
|
|
4329
4350
|
{
|
|
@@ -4342,7 +4363,7 @@
|
|
|
4342
4363
|
"$ref": "#/components/schemas/IDevicePushClearData"
|
|
4343
4364
|
}
|
|
4344
4365
|
],
|
|
4345
|
-
"description": "What a notification from the host carries, the same for both platforms, each value a string because FCM data carries only strings: FCM sends it as a data-only message's `data` (the Android app builds the notification itself), APNs as the payload's `agl` object beside `aps` (an alert push for `inbox`, `summary`, `report` and `test`, a background push for `clear`). No notification carries a session's or a ticket's id with previews off. A later minor may add keys and types: an app ignores keys it does not know, and a notification whose `type` it does not know, except an iOS alert push, which the system presents from `aps` without running the app. Since protocol 1.4."
|
|
4366
|
+
"description": "What a notification from the host carries, the same for both platforms, each value a string because FCM data carries only strings: FCM sends it as a data-only message's `data` (the Android app builds the notification itself), APNs as the payload's `agl` object beside `aps` (an alert push for `inbox`, `summary`, `report` and `test`, a background push for `clear`). No notification carries a session's or a ticket's id with previews off. An inbox notification with `actions` names its category on iOS (`aps.category`); an app that registers no category of that name shows it without buttons. A later minor may add keys and types: an app ignores keys it does not know, and a notification whose `type` it does not know, except an iOS alert push, which the system presents from `aps` without running the app. Since protocol 1.4."
|
|
4346
4367
|
},
|
|
4347
4368
|
"TDevicePushEnvironment": {
|
|
4348
4369
|
"type": "string",
|
package/ts_interfaces/devices.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import type { ITypedRequest, implementsTR } from '@api.global/typedrequest-interfaces';
|
|
18
18
|
|
|
19
19
|
/** The device protocol this controller speaks. */
|
|
20
|
-
export const deviceProtocolVersion = { major: 1, minor:
|
|
20
|
+
export const deviceProtocolVersion = { major: 1, minor: 5 } as const;
|
|
21
21
|
|
|
22
22
|
/** The scheme of a pairing payload: `agl-pair:?origin=<https origin>&controller=<controller id>&code=<base64url>`. */
|
|
23
23
|
export const devicePairingScheme = 'agl-pair' as const;
|
|
@@ -883,10 +883,18 @@ export const devicePushReportSentence = 'A direct report has a new result.';
|
|
|
883
883
|
/** The text of the owner's test notification. Since protocol 1.4. */
|
|
884
884
|
export const devicePushTestSentence = 'Push from AGL works.';
|
|
885
885
|
|
|
886
|
+
/**
|
|
887
|
+
* The buttons a notification offers, for an item a device answers from the notification itself. `permission`: Allow
|
|
888
|
+
* once (`device.permission.reply` with `reply: 'once'`), Reject (`reply: 'reject'`) and Open, which opens the item in
|
|
889
|
+
* the app. On iOS it is also the notification's category (`aps.category`). Since protocol 1.5.
|
|
890
|
+
*/
|
|
891
|
+
export type TDevicePushActions = 'permission';
|
|
892
|
+
|
|
886
893
|
/**
|
|
887
894
|
* One Inbox item that came: an alert (iOS: thread `inbox`, interruption level `active`; Android: channel Inbox). With
|
|
888
895
|
* previews off it says only the kind's fixed sentence; with previews on also where the item lives, what it asks and
|
|
889
|
-
* its id
|
|
896
|
+
* its id, and for a permission the device can answer (`device.inbox.list` names its answer `session` or `child`) the
|
|
897
|
+
* buttons and the ids their reply names. Tapping it opens the Inbox. Since protocol 1.4.
|
|
890
898
|
*/
|
|
891
899
|
export interface IDevicePushInboxData {
|
|
892
900
|
type: 'inbox';
|
|
@@ -906,6 +914,18 @@ export interface IDevicePushInboxData {
|
|
|
906
914
|
title?: string;
|
|
907
915
|
/** Previews on only: the item's id, as `device.inbox.list` names it. */
|
|
908
916
|
itemId?: string;
|
|
917
|
+
/**
|
|
918
|
+
* Previews on only, and only for an item the device answers from the notification: the buttons it offers. Set
|
|
919
|
+
* together with `sessionId` and `permissionId` (and `childSessionId` for a direct child's permission), never alone.
|
|
920
|
+
* Since protocol 1.5.
|
|
921
|
+
*/
|
|
922
|
+
actions?: TDevicePushActions;
|
|
923
|
+
/** With `actions`: `device.permission.reply`'s `sessionId`. Since protocol 1.5. */
|
|
924
|
+
sessionId?: string;
|
|
925
|
+
/** With `actions`, only for a direct child's permission: `device.permission.reply`'s `childSessionId`. Since protocol 1.5. */
|
|
926
|
+
childSessionId?: string;
|
|
927
|
+
/** With `actions`: `device.permission.reply`'s `permissionId`. Since protocol 1.5. */
|
|
928
|
+
permissionId?: string;
|
|
909
929
|
}
|
|
910
930
|
|
|
911
931
|
/**
|
|
@@ -927,7 +947,7 @@ export interface IDevicePushSummaryData {
|
|
|
927
947
|
/**
|
|
928
948
|
* A direct report's new `result:` line, sent only to a registration with `reports` (iOS: thread `reports`,
|
|
929
949
|
* interruption level `passive`; Android: channel Reports, low importance). It leaves the badge alone: a result waits
|
|
930
|
-
* for nobody. Since protocol 1.4.
|
|
950
|
+
* for nobody. Tapping it opens the Driver tab, where the direct reports are. Since protocol 1.4.
|
|
931
951
|
*/
|
|
932
952
|
export interface IDevicePushReportData {
|
|
933
953
|
type: 'report';
|
|
@@ -969,9 +989,11 @@ export interface IDevicePushClearData {
|
|
|
969
989
|
* What a notification from the host carries, the same for both platforms, each value a string because FCM data carries
|
|
970
990
|
* only strings: FCM sends it as a data-only message's `data` (the Android app builds the notification itself), APNs as
|
|
971
991
|
* the payload's `agl` object beside `aps` (an alert push for `inbox`, `summary`, `report` and `test`, a background push
|
|
972
|
-
* for `clear`). No notification carries a session's or a ticket's id with previews off.
|
|
973
|
-
*
|
|
974
|
-
*
|
|
992
|
+
* for `clear`). No notification carries a session's or a ticket's id with previews off. An inbox notification with
|
|
993
|
+
* `actions` names its category on iOS (`aps.category`); an app that registers no category of that name shows it without
|
|
994
|
+
* buttons. A later minor may add keys and types: an app ignores keys it does not know, and a notification whose `type`
|
|
995
|
+
* it does not know, except an iOS alert push, which the system presents from `aps` without running the app. Since
|
|
996
|
+
* protocol 1.4.
|
|
975
997
|
*/
|
|
976
998
|
export type TDevicePushData =
|
|
977
999
|
| IDevicePushInboxData
|
|
@@ -1665,8 +1687,10 @@ export interface IReq_DeviceHostGet extends implementsTR<ITypedRequest, IReq_Dev
|
|
|
1665
1687
|
/**
|
|
1666
1688
|
* Registers this device for notifications of what comes into the Inbox, and with `reports` of the direct reports'
|
|
1667
1689
|
* results too: one registration per device, which the next one replaces, so an app registers again with its current
|
|
1668
|
-
* token on every connect.
|
|
1669
|
-
*
|
|
1690
|
+
* token on every connect. A token is one device's: the registration of any other device holding the same platform's
|
|
1691
|
+
* token (the same app, paired before) ends with it. Taken also while the host holds no credential to send with (the
|
|
1692
|
+
* answer's `available` says so). The token stays on the host: no answer, event or log repeats it. Scope `device`.
|
|
1693
|
+
* Since protocol 1.4.
|
|
1670
1694
|
*/
|
|
1671
1695
|
export interface IReq_DevicePushRegister extends implementsTR<ITypedRequest, IReq_DevicePushRegister> {
|
|
1672
1696
|
method: 'device.push.register';
|