@agentshouse/app-bridge 0.1.0-c415579fa0c3a → 0.1.0-c58a055eeaa71
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/README.md +14 -11
- package/dist/index.d.ts +139 -0
- package/dist/index.js +1 -0
- package/dist/{client/src/test-host.d.ts → test-host.d.ts} +3 -4
- package/dist/test-host.js +165 -0
- package/docs/families.md +35 -34
- package/package.json +7 -7
- package/dist/client/src/bridge.d.ts +0 -38
- package/dist/client/src/bridge.js +0 -320
- package/dist/client/src/index.d.ts +0 -3
- package/dist/client/src/index.js +0 -2
- package/dist/client/src/test-host.js +0 -185
- package/dist/client/src/wire.d.ts +0 -215
- package/dist/client/src/wire.js +0 -1
- package/dist/src/apps/remainder.d.ts +0 -2
- package/dist/src/apps/remainder.js +0 -16
- package/dist/src/apps/tab.d.ts +0 -6
- package/dist/src/apps/tab.js +0 -27
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import type { TabChange } from '../../src/apps/tab.js';
|
|
2
|
-
export interface HouseBridgeEvent {
|
|
3
|
-
readonly data: unknown;
|
|
4
|
-
}
|
|
5
|
-
export interface HouseBridgePort {
|
|
6
|
-
postMessage(message: HouseFrameRequest): void;
|
|
7
|
-
addEventListener(type: 'message', listener: (event: HouseBridgeEvent) => void): void;
|
|
8
|
-
start(): void;
|
|
9
|
-
}
|
|
10
|
-
export interface HouseSyncState {
|
|
11
|
-
readonly state: string;
|
|
12
|
-
readonly providerUnreachable: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface HouseCredentialState {
|
|
15
|
-
readonly state: 'none' | 'held' | 'rejected';
|
|
16
|
-
readonly expires_at: number | null;
|
|
17
|
-
}
|
|
18
|
-
export type HouseGaChoice = 'accept' | 'decline';
|
|
19
|
-
export interface HouseGa {
|
|
20
|
-
readonly measures: boolean;
|
|
21
|
-
readonly choice: HouseGaChoice | null;
|
|
22
|
-
}
|
|
23
|
-
export interface HouseStatus {
|
|
24
|
-
readonly app: string | null;
|
|
25
|
-
readonly preferences: {
|
|
26
|
-
readonly room_ref: string;
|
|
27
|
-
readonly path: string;
|
|
28
|
-
} | null;
|
|
29
|
-
readonly runtime: string;
|
|
30
|
-
readonly credential: HouseCredentialState;
|
|
31
|
-
readonly sync: HouseSyncState | null;
|
|
32
|
-
readonly refusal: {
|
|
33
|
-
readonly reason: string;
|
|
34
|
-
} | null;
|
|
35
|
-
readonly loss: string | null;
|
|
36
|
-
readonly ga: HouseGa;
|
|
37
|
-
readonly service_mode: 'open' | 'write-halted' | null;
|
|
38
|
-
readonly offline: boolean;
|
|
39
|
-
}
|
|
40
|
-
export type HouseNavigationMode = 'push' | 'replace';
|
|
41
|
-
interface HouseRelease {
|
|
42
|
-
readonly app_ref: string;
|
|
43
|
-
readonly release: string;
|
|
44
|
-
}
|
|
45
|
-
export interface HouseSourceTop extends HouseRelease {
|
|
46
|
-
readonly folders: readonly string[];
|
|
47
|
-
readonly files: readonly {
|
|
48
|
-
readonly name: string;
|
|
49
|
-
readonly size: number;
|
|
50
|
-
}[];
|
|
51
|
-
readonly readme: string | null;
|
|
52
|
-
}
|
|
53
|
-
export type HouseSourceFile = {
|
|
54
|
-
readonly path: string;
|
|
55
|
-
readonly size: number;
|
|
56
|
-
} & ({
|
|
57
|
-
readonly text: string;
|
|
58
|
-
} | {
|
|
59
|
-
readonly base64: string;
|
|
60
|
-
});
|
|
61
|
-
export interface HouseSourceDownload extends HouseRelease {
|
|
62
|
-
readonly files: readonly HouseSourceFile[];
|
|
63
|
-
}
|
|
64
|
-
export type HouseTab = TabChange;
|
|
65
|
-
export interface HouseExternalRequest {
|
|
66
|
-
readonly url: string;
|
|
67
|
-
readonly method?: string;
|
|
68
|
-
readonly headers?: Readonly<Record<string, string>>;
|
|
69
|
-
readonly body?: string;
|
|
70
|
-
readonly body_base64?: string;
|
|
71
|
-
readonly account?: string;
|
|
72
|
-
readonly slot?: string;
|
|
73
|
-
}
|
|
74
|
-
export type HouseExternalAnswer = {
|
|
75
|
-
readonly status: number;
|
|
76
|
-
readonly headers: Readonly<Record<string, string | readonly string[]>>;
|
|
77
|
-
} & ({
|
|
78
|
-
readonly body: string;
|
|
79
|
-
} | {
|
|
80
|
-
readonly body_base64: string;
|
|
81
|
-
});
|
|
82
|
-
export interface HouseRefusal {
|
|
83
|
-
readonly error: {
|
|
84
|
-
readonly code: string;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export interface HouseAppMessage {
|
|
88
|
-
readonly from: string;
|
|
89
|
-
readonly body: unknown;
|
|
90
|
-
}
|
|
91
|
-
export type HouseInstallation = 'accepted' | 'dismissed' | 'manual';
|
|
92
|
-
export type HouseNotifications = 'on' | 'off' | 'blocked' | 'unavailable';
|
|
93
|
-
export interface HouseImageCopy {
|
|
94
|
-
readonly attachment: string;
|
|
95
|
-
readonly copy: string;
|
|
96
|
-
readonly name: string;
|
|
97
|
-
readonly media_type: string;
|
|
98
|
-
}
|
|
99
|
-
export interface HouseFrameRefusal {
|
|
100
|
-
readonly name: string;
|
|
101
|
-
readonly message: string;
|
|
102
|
-
}
|
|
103
|
-
export type HouseFrameRequest = {
|
|
104
|
-
readonly house: 'navigate';
|
|
105
|
-
readonly mode: HouseNavigationMode;
|
|
106
|
-
readonly address: string;
|
|
107
|
-
} | ({
|
|
108
|
-
readonly house: 'tab';
|
|
109
|
-
} & HouseTab) | {
|
|
110
|
-
readonly house: 'ceremony';
|
|
111
|
-
readonly path: string;
|
|
112
|
-
} | {
|
|
113
|
-
readonly house: 'install';
|
|
114
|
-
readonly id: number;
|
|
115
|
-
} | {
|
|
116
|
-
readonly house: 'notifications';
|
|
117
|
-
readonly id: number;
|
|
118
|
-
readonly on?: boolean;
|
|
119
|
-
} | {
|
|
120
|
-
readonly house: 'badge';
|
|
121
|
-
readonly id: number;
|
|
122
|
-
readonly unread: readonly string[];
|
|
123
|
-
} | {
|
|
124
|
-
readonly house: 'attachment-read';
|
|
125
|
-
readonly id: number;
|
|
126
|
-
readonly room: string;
|
|
127
|
-
readonly attachment: string;
|
|
128
|
-
} | {
|
|
129
|
-
readonly house: 'source-top' | 'source-download';
|
|
130
|
-
readonly id: number;
|
|
131
|
-
readonly app: string;
|
|
132
|
-
readonly release?: string;
|
|
133
|
-
} | {
|
|
134
|
-
readonly house: 'external-call';
|
|
135
|
-
readonly id: number;
|
|
136
|
-
readonly request: HouseExternalRequest;
|
|
137
|
-
} | {
|
|
138
|
-
readonly house: 'screenshot-read';
|
|
139
|
-
readonly id: number;
|
|
140
|
-
readonly app: string;
|
|
141
|
-
} | {
|
|
142
|
-
readonly house: 'site-screenshot-read';
|
|
143
|
-
readonly id: number;
|
|
144
|
-
readonly site: string;
|
|
145
|
-
} | {
|
|
146
|
-
readonly house: 'ga/consent';
|
|
147
|
-
readonly choice: HouseGaChoice;
|
|
148
|
-
};
|
|
149
|
-
export type HouseInstallAnswer = {
|
|
150
|
-
readonly outcome: HouseInstallation;
|
|
151
|
-
} | {
|
|
152
|
-
readonly refusal: HouseFrameRefusal;
|
|
153
|
-
};
|
|
154
|
-
export type HouseNotificationAnswer = {
|
|
155
|
-
readonly refused: true;
|
|
156
|
-
} | {
|
|
157
|
-
readonly refusal: HouseFrameRefusal;
|
|
158
|
-
} | {
|
|
159
|
-
readonly state: HouseNotifications;
|
|
160
|
-
};
|
|
161
|
-
export type HouseBadgeAnswer = {
|
|
162
|
-
readonly refused: true;
|
|
163
|
-
} | {
|
|
164
|
-
readonly refusal: HouseFrameRefusal;
|
|
165
|
-
} | {
|
|
166
|
-
readonly refused?: never;
|
|
167
|
-
readonly refusal?: never;
|
|
168
|
-
};
|
|
169
|
-
export type HouseFrameMessage = {
|
|
170
|
-
readonly house: 'runtime';
|
|
171
|
-
} | {
|
|
172
|
-
readonly house: 'status';
|
|
173
|
-
readonly status: HouseStatus;
|
|
174
|
-
} | {
|
|
175
|
-
readonly house: 'screenshot';
|
|
176
|
-
readonly id: number;
|
|
177
|
-
readonly image: Blob | null;
|
|
178
|
-
} | {
|
|
179
|
-
readonly house: 'address';
|
|
180
|
-
readonly address: string;
|
|
181
|
-
readonly navigated: boolean;
|
|
182
|
-
} | {
|
|
183
|
-
readonly house: 'ceremony-refused';
|
|
184
|
-
readonly path: string | null;
|
|
185
|
-
} | {
|
|
186
|
-
readonly house: 'navigate-refused';
|
|
187
|
-
readonly address: string | null;
|
|
188
|
-
} | {
|
|
189
|
-
readonly house: 'attachment';
|
|
190
|
-
readonly id: number;
|
|
191
|
-
readonly image: HouseImageCopy | null;
|
|
192
|
-
} | {
|
|
193
|
-
readonly house: 'source';
|
|
194
|
-
readonly id: number;
|
|
195
|
-
readonly answer: HouseSourceTop | HouseSourceDownload | HouseRefusal | null;
|
|
196
|
-
} | {
|
|
197
|
-
readonly house: 'external-call';
|
|
198
|
-
readonly id: number;
|
|
199
|
-
readonly answer: HouseExternalAnswer | HouseRefusal | null;
|
|
200
|
-
} | ({
|
|
201
|
-
readonly house: 'install';
|
|
202
|
-
readonly id: number;
|
|
203
|
-
} & HouseInstallAnswer) | ({
|
|
204
|
-
readonly house: 'notifications';
|
|
205
|
-
readonly id: number;
|
|
206
|
-
} & HouseNotificationAnswer) | ({
|
|
207
|
-
readonly house: 'badge';
|
|
208
|
-
readonly id: number;
|
|
209
|
-
} & HouseBadgeAnswer) | {
|
|
210
|
-
readonly house: 'app-message';
|
|
211
|
-
readonly from: string;
|
|
212
|
-
readonly body: unknown;
|
|
213
|
-
};
|
|
214
|
-
export declare const HOUSE_ADDRESS_MAX_CHARS = 1000;
|
|
215
|
-
export {};
|
package/dist/client/src/wire.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const HOUSE_ADDRESS_MAX_CHARS = 1000;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function split(address) {
|
|
2
|
-
const mark = address.search(/[?#]/u);
|
|
3
|
-
return mark < 0
|
|
4
|
-
? { path: address, rest: '' }
|
|
5
|
-
: { path: address.slice(0, mark), rest: address.slice(mark) };
|
|
6
|
-
}
|
|
7
|
-
export function appAddressOf(root, address) {
|
|
8
|
-
const { path, rest } = split(address);
|
|
9
|
-
const below = root === '/' ? path : path.slice(root.length);
|
|
10
|
-
return `${below.startsWith('/') ? below : `/${below}`}${rest}`;
|
|
11
|
-
}
|
|
12
|
-
export function shellAddressOf(root, appAddress) {
|
|
13
|
-
const { path, rest } = split(appAddress);
|
|
14
|
-
const below = path === '/' ? '' : path;
|
|
15
|
-
return `${`${root === '/' ? '' : root}${below}` || '/'}${rest}`;
|
|
16
|
-
}
|
package/dist/src/apps/tab.d.ts
DELETED
package/dist/src/apps/tab.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const TAB_TITLE_MAX_CHARS = 200;
|
|
2
|
-
const TAB_ICON_MAX_CHARS = 1_048_576;
|
|
3
|
-
function caseless(text) {
|
|
4
|
-
return text.replace(/[a-z]/gu, (letter) => `[${letter}${letter.toUpperCase()}]`);
|
|
5
|
-
}
|
|
6
|
-
export const TAB_IMAGE = new RegExp(`^${caseless('data:image/')}(?:svg\\+xml|${['png', 'gif', 'webp'].map(caseless).join('|')});${caseless('base64')},[A-Za-z0-9+/]+={0,2}$`, 'u');
|
|
7
|
-
function admittedTitle(title) {
|
|
8
|
-
return typeof title === 'string' && title.length <= TAB_TITLE_MAX_CHARS;
|
|
9
|
-
}
|
|
10
|
-
function admittedIcon(icon) {
|
|
11
|
-
return typeof icon === 'string' && icon.length <= TAB_ICON_MAX_CHARS && TAB_IMAGE.test(icon);
|
|
12
|
-
}
|
|
13
|
-
export function tabChange(asked) {
|
|
14
|
-
if (asked === null || typeof asked !== 'object')
|
|
15
|
-
return null;
|
|
16
|
-
const { title, icon } = asked;
|
|
17
|
-
if (title === undefined && icon === undefined)
|
|
18
|
-
return null;
|
|
19
|
-
if (title !== undefined && !admittedTitle(title))
|
|
20
|
-
return null;
|
|
21
|
-
if (icon !== undefined && !admittedIcon(icon))
|
|
22
|
-
return null;
|
|
23
|
-
return {
|
|
24
|
-
...(title === undefined ? {} : { title: title }),
|
|
25
|
-
...(icon === undefined ? {} : { icon: icon }),
|
|
26
|
-
};
|
|
27
|
-
}
|