@agentshouse/app-bridge 0.1.0-c94ad2bcf90f7 → 0.1.0-c951f91b2c8ee

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/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  import type { MdRuntimeClient } from '@agentshouse/mdruntime/client';
2
+ type Open<Value extends string> = Value | (string & {});
2
3
  export interface HouseSyncState {
3
4
  readonly state: string;
4
5
  readonly providerUnreachable: boolean;
5
6
  }
6
7
  export interface HouseCredentialState {
7
- readonly state: 'none' | 'held' | 'rejected';
8
+ readonly state: Open<'none' | 'held' | 'rejected'>;
8
9
  readonly expiresAt: number | null;
9
10
  }
10
11
  export type HouseAnalyticsChoice = 'accept' | 'decline';
11
12
  export interface HouseAnalytics {
12
13
  readonly measures: boolean;
13
- readonly choice: HouseAnalyticsChoice | null;
14
+ readonly choice: Open<HouseAnalyticsChoice> | null;
14
15
  }
15
16
  export interface HouseStatus {
16
17
  readonly app: string | null;
@@ -22,11 +23,12 @@ export interface HouseStatus {
22
23
  readonly credential: HouseCredentialState;
23
24
  readonly sync: HouseSyncState | null;
24
25
  readonly refusal: {
25
- readonly reason: string;
26
+ readonly code: string;
27
+ readonly retryable: boolean;
26
28
  } | null;
27
29
  readonly loss: string | null;
28
30
  readonly analytics: HouseAnalytics;
29
- readonly serviceMode: 'open' | 'write-halted' | null;
31
+ readonly serviceMode: Open<'open' | 'write-halted'> | null;
30
32
  readonly offline: boolean;
31
33
  }
32
34
  export type HouseNavigationMode = 'push' | 'replace';
@@ -77,14 +79,15 @@ export type HouseExternalAnswer = {
77
79
  export interface HouseRefusal {
78
80
  readonly error: {
79
81
  readonly code: string;
82
+ readonly retryable: boolean;
80
83
  };
81
84
  }
82
85
  export interface HouseAppMessage {
83
86
  readonly from: string;
84
87
  readonly body: unknown;
85
88
  }
86
- export type HouseInstallation = 'accepted' | 'dismissed' | 'manual';
87
- export type HouseNotifications = 'on' | 'off' | 'blocked' | 'unavailable';
89
+ export type HouseInstallation = Open<'accepted' | 'dismissed' | 'manual'>;
90
+ export type HouseNotifications = Open<'on' | 'off' | 'blocked' | 'unavailable'>;
88
91
  export interface HouseImageCopy {
89
92
  readonly attachment: string;
90
93
  readonly copy: string;
@@ -93,12 +96,20 @@ export interface HouseImageCopy {
93
96
  }
94
97
  export interface HouseCeremonyRefused extends Error {
95
98
  readonly name: 'HouseCeremonyRefused';
99
+ readonly code: Open<'house_ceremony_refused'>;
100
+ readonly retryable: boolean;
96
101
  readonly path: string | null;
97
102
  }
98
103
  export interface HouseNavigationRefused extends Error {
99
104
  readonly name: 'HouseNavigationRefused';
105
+ readonly code: Open<'house_navigation_refused'>;
106
+ readonly retryable: boolean;
100
107
  readonly address: string | null;
101
108
  }
109
+ export interface HouseBrowserRefused extends Error {
110
+ readonly code: string;
111
+ readonly retryable: boolean;
112
+ }
102
113
  export interface HouseBridge {
103
114
  readonly runtime: Promise<MdRuntimeClient>;
104
115
  address(): string | null;
@@ -121,5 +132,8 @@ export interface HouseBridge {
121
132
  messages(listener: (message: HouseAppMessage) => void): () => void;
122
133
  analyticsConsent(choice: HouseAnalyticsChoice): void;
123
134
  }
135
+ export interface HouseHeld {
136
+ readonly houseBridge: HouseBridge;
137
+ }
124
138
  export declare const houseBridge: () => HouseBridge;
125
139
  export {};
package/dist/test-host.js CHANGED
@@ -16,12 +16,16 @@ function appAddress(address) {
16
16
  function ceremonyRefused(path) {
17
17
  return Object.assign(new Error('house_ceremony_refused'), {
18
18
  name: 'HouseCeremonyRefused',
19
+ code: 'house_ceremony_refused',
20
+ retryable: false,
19
21
  path,
20
22
  });
21
23
  }
22
24
  function navigationRefused(address) {
23
25
  return Object.assign(new Error('house_navigation_refused'), {
24
26
  name: 'HouseNavigationRefused',
27
+ code: 'house_navigation_refused',
28
+ retryable: false,
25
29
  address,
26
30
  });
27
31
  }
package/docs/families.md CHANGED
@@ -18,17 +18,17 @@
18
18
  `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
19
19
  otherwise, as on every iPhone and iPad, it resolves `'manual'` and the App
20
20
  shows its own instructions. A prompt the browser refuses to show, as for a
21
- call made without a click, rejects with the browser's own `DOMException`
22
- and stays ready. Call it from a click. The standard
21
+ call made without a click, rejects with an error named and coded by the
22
+ browser's own error name, with `retryable` false, and stays ready. Call it from a click. The standard
23
23
  `display-mode: standalone` media query tells the App it runs installed.
24
24
  - **Notifications** - House's own panel alone; an App's or a Site's call
25
- rejects with an error named `HouseCeremonyRefused`. `notifications()` answers this browser
25
+ rejects with an error named `HouseCeremonyRefused`, carrying `code` and `retryable`. `notifications()` answers this browser
26
26
  storage's push state: `'on'`, `'off'`, `'blocked'` where the browser refuses
27
27
  notifications, or `'unavailable'` where it has no push, as on an iPhone or
28
28
  iPad outside a Home-screen app. `notifications(true)` asks the browser's
29
29
  permission and subscribes, `notifications(false)` unsubscribes, and each
30
- answers the state it leaves; a failure of the browser's push service rejects
31
- with the browser's own `DOMException`. Call `notifications(true)` from a
30
+ answers the state it leaves; a failure of the browser's push service, and
31
+ of `setBadge`, rejects the same way. Call `notifications(true)` from a
32
32
  click. `setBadge(unread)` takes the identifiers of the Human Notifications
33
33
  unread in this storage and sets the icon's badge to their number, or clears
34
34
  it at none, where the browser shows one.
@@ -53,14 +53,14 @@
53
53
  path, its size and its `text`, or its bytes as `base64`. The browser keeps
54
54
  each answer per App and release: a read naming a release it holds answers
55
55
  without asking House, and keeping a newer release drops the earlier one. A
56
- refusal is House's `{ error: { code } }`, `app_release_not_found` for an
56
+ refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
57
57
  App with no release; a read House does not answer, or one that outlived
58
58
  the browser's signed-in User, is `null`.
59
59
  - **External calls** - `callExternal({ url, method, headers, body, slot })`
60
60
  has House's server send an HTTPS request to one of the release's declared
61
61
  external origins and resolves with the service's `status`, `headers` and its
62
62
  body as `body` text or `body_base64`, or a refusal as House's
63
- `{ error: { code } }`, or `null` when House does not answer. House fills in the
63
+ `{ error: { code, retryable } }`, or `null` when House does not answer. House fills in the
64
64
  App and its running release; naming an account slot places the key of the
65
65
  account the User connected to it, which the App never sees, and naming none
66
66
  sends no key. A Site's call names no slot, and the House panel names an
@@ -69,7 +69,7 @@
69
69
  another holder of this App sends to this User's running copies, as `from`,
70
70
  the sender's User id, and `body`, the JSON value they sent, until the
71
71
  function it returns is called. App code sends one through the Runtime's
72
- `call('apps/messages/send', { to, body })` with the recipient's User id and
72
+ `call('message.send', { to, body })` with the recipient's User id and
73
73
  a body of at most 32 KiB of JSON; House fills in the App and relays it only
74
74
  to copies running now, storing nothing. The panel sends none.
75
75
  - **App screenshot read** - given an App reference, `readScreenshot(app)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-c94ad2bcf90f7",
3
+ "version": "0.1.0-c951f91b2c8ee",
4
4
  "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, and App messages, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@agentshouse/mdruntime": "0.1.0-c7bd7ca3faee4"
22
+ "@agentshouse/mdruntime": "0.1.0-cf24798931067"
23
23
  },
24
24
  "files": [
25
25
  "dist",