@celljs/ta-host 4.13.1 → 4.15.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/README.en.md +3 -1
- package/README.md +3 -1
- package/esm/node/auth-server-impl.d.ts +12 -2
- package/esm/node/auth-server-impl.js +102 -3
- package/esm/node/custom-providers.d.ts +50 -0
- package/esm/node/custom-providers.js +335 -0
- package/esm/node/host-protocol.d.ts +17 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/node/package-hosts.d.ts +2 -1
- package/esm/node/package-hosts.js +6 -2
- package/esm/node/presence-book.d.ts +38 -0
- package/esm/node/presence-book.js +159 -0
- package/esm/node/presence-server-impl.d.ts +13 -0
- package/esm/node/presence-server-impl.js +45 -0
- package/esm/node/rooms-bridge.d.ts +6 -1
- package/esm/node/rooms-bridge.js +21 -3
- package/esm/node/session-list-feed.js +2 -1
- package/esm/node/sign-in/access-server-impl.d.ts +5 -1
- package/esm/node/sign-in/access-server-impl.js +22 -1
- package/esm/node/sign-in/sign-in-flow.d.ts +14 -1
- package/esm/node/sign-in/sign-in-flow.js +24 -7
- package/esm/node/sign-in/sign-in-provider.d.ts +84 -1
- package/esm/node/sign-in/sign-in-provider.js +194 -7
- package/esm/node/sign-in/ta-sign-in.d.ts +12 -3
- package/esm/node/sign-in/ta-sign-in.js +36 -4
- package/esm/node/ta-server-impl.d.ts +7 -0
- package/esm/node/ta-server-impl.js +44 -7
- package/esm/node/ta-session-registry.d.ts +10 -3
- package/esm/node/ta-session-registry.js +29 -3
- package/esm/node/ta-session.d.ts +2 -0
- package/esm/node/ta-session.js +6 -0
- package/esm/node/team/host-team.d.ts +2 -1
- package/esm/node/team/host-team.js +11 -1
- package/esm/node/team/index.d.ts +1 -0
- package/esm/node/team/index.js +1 -0
- package/esm/node/team/member-accounts.d.ts +30 -0
- package/esm/node/team/member-accounts.js +117 -0
- package/esm/node/team/team-calls.d.ts +2 -1
- package/esm/node/team/team-calls.js +11 -0
- package/esm/node/team/team-gate.js +1 -1
- package/esm/node/team/team-protocol.d.ts +5 -1
- package/esm/node/team/team-protocol.js +2 -0
- package/esm/node/web-extension-util.js +1 -0
- package/lib/node/auth-server-impl.d.ts +12 -2
- package/lib/node/auth-server-impl.js +101 -2
- package/lib/node/custom-providers.d.ts +51 -0
- package/lib/node/custom-providers.js +338 -0
- package/lib/node/host-protocol.d.ts +17 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +2 -0
- package/lib/node/index.js +2 -0
- package/lib/node/package-hosts.d.ts +2 -1
- package/lib/node/package-hosts.js +5 -1
- package/lib/node/presence-book.d.ts +39 -0
- package/lib/node/presence-book.js +162 -0
- package/lib/node/presence-server-impl.d.ts +14 -0
- package/lib/node/presence-server-impl.js +48 -0
- package/lib/node/rooms-bridge.d.ts +6 -1
- package/lib/node/rooms-bridge.js +20 -2
- package/lib/node/session-list-feed.js +2 -1
- package/lib/node/sign-in/access-server-impl.d.ts +5 -1
- package/lib/node/sign-in/access-server-impl.js +21 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +14 -1
- package/lib/node/sign-in/sign-in-flow.js +24 -7
- package/lib/node/sign-in/sign-in-provider.d.ts +84 -1
- package/lib/node/sign-in/sign-in-provider.js +197 -9
- package/lib/node/sign-in/ta-sign-in.d.ts +12 -3
- package/lib/node/sign-in/ta-sign-in.js +36 -4
- package/lib/node/ta-server-impl.d.ts +7 -0
- package/lib/node/ta-server-impl.js +43 -6
- package/lib/node/ta-session-registry.d.ts +10 -3
- package/lib/node/ta-session-registry.js +27 -1
- package/lib/node/ta-session.d.ts +2 -0
- package/lib/node/ta-session.js +6 -0
- package/lib/node/team/host-team.d.ts +2 -1
- package/lib/node/team/host-team.js +10 -0
- package/lib/node/team/index.d.ts +1 -0
- package/lib/node/team/index.js +1 -0
- package/lib/node/team/member-accounts.d.ts +31 -0
- package/lib/node/team/member-accounts.js +120 -0
- package/lib/node/team/team-calls.d.ts +2 -1
- package/lib/node/team/team-calls.js +11 -0
- package/lib/node/team/team-gate.js +1 -1
- package/lib/node/team/team-protocol.d.ts +5 -1
- package/lib/node/team/team-protocol.js +3 -1
- package/lib/node/web-extension-util.js +1 -0
- package/package.json +12 -12
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import type { TaSignInKind, TaSignInSetup } from '@celljs/ta-protocol';
|
|
1
2
|
import { SignInFlow } from './sign-in-flow';
|
|
3
|
+
import { type DeviceSignInProvider } from './sign-in-provider';
|
|
2
4
|
export declare const TA_SIGN_IN: unique symbol;
|
|
3
5
|
/**
|
|
4
|
-
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment, then
|
|
7
|
+
* sign-in.json of the agent directory (SignInProviders.withConfig), which Settings, Access writes (setProvider) and
|
|
8
|
+
* which is read again then; who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
9
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request. Those asking to come in by a
|
|
10
|
+
* link sign in with the same providers to say who they are (TaHostAccounts), which lets them into nothing, or, when GitHub
|
|
11
|
+
* is not set up, with GitHub by a code, Ta's own app (`device`, SignInProviders.device).
|
|
7
12
|
*/
|
|
8
13
|
export declare class TaSignIn extends SignInFlow {
|
|
14
|
+
device: DeviceSignInProvider | undefined;
|
|
9
15
|
constructor();
|
|
16
|
+
setups(): TaSignInSetup[];
|
|
17
|
+
/** Sets a kind up in sign-in.json (readable by the user alone), offered at once; not one the environment sets. */
|
|
18
|
+
setProvider(id: TaSignInKind, fields: Record<string, unknown> | null): void;
|
|
10
19
|
}
|
|
11
20
|
//# sourceMappingURL=ta-sign-in.d.ts.map
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TaSignIn = exports.TA_SIGN_IN = void 0;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
13
14
|
const node_path_1 = require("node:path");
|
|
14
15
|
const core_1 = require("@celljs/core");
|
|
15
16
|
const ta_brand_1 = require("@celljs/ta-harness/lib/node/ta-brand");
|
|
@@ -17,14 +18,45 @@ const access_store_1 = require("./access-store");
|
|
|
17
18
|
const sign_in_flow_1 = require("./sign-in-flow");
|
|
18
19
|
const sign_in_provider_1 = require("./sign-in-provider");
|
|
19
20
|
exports.TA_SIGN_IN = Symbol('TaSignIn');
|
|
21
|
+
function file() {
|
|
22
|
+
return (0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'sign-in.json');
|
|
23
|
+
}
|
|
24
|
+
/** sign-in.json of the agent directory (SignInProviders.Config); none when it is not there or not JSON. */
|
|
25
|
+
function config() {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse((0, node_fs_1.readFileSync)(file(), 'utf8'));
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
20
33
|
/**
|
|
21
|
-
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
22
|
-
*
|
|
23
|
-
*
|
|
34
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment, then
|
|
35
|
+
* sign-in.json of the agent directory (SignInProviders.withConfig), which Settings, Access writes (setProvider) and
|
|
36
|
+
* which is read again then; who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
37
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request. Those asking to come in by a
|
|
38
|
+
* link sign in with the same providers to say who they are (TaHostAccounts), which lets them into nothing, or, when GitHub
|
|
39
|
+
* is not set up, with GitHub by a code, Ta's own app (`device`, SignInProviders.device).
|
|
24
40
|
*/
|
|
25
41
|
let TaSignIn = class TaSignIn extends sign_in_flow_1.SignInFlow {
|
|
26
42
|
constructor() {
|
|
27
|
-
super(sign_in_provider_1.SignInProviders.fromEnv(process.env), new access_store_1.AccessStore((0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'access.json'), access_store_1.AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), sign_in_provider_1.SignInProviders.publicUrl(process.env));
|
|
43
|
+
super(sign_in_provider_1.SignInProviders.fromEnv(sign_in_provider_1.SignInProviders.withConfig(process.env, config())), new access_store_1.AccessStore((0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'access.json'), access_store_1.AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), sign_in_provider_1.SignInProviders.publicUrl(process.env));
|
|
44
|
+
this.device = sign_in_provider_1.SignInProviders.device(sign_in_provider_1.SignInProviders.withConfig(process.env, config()));
|
|
45
|
+
}
|
|
46
|
+
setups() {
|
|
47
|
+
const device = this.device;
|
|
48
|
+
return sign_in_provider_1.SignInProviders.setups(process.env, config()).map(setup => ((device === null || device === void 0 ? void 0 : device.id) === setup.id && !setup.configured ? { ...setup, device: true } : setup));
|
|
49
|
+
}
|
|
50
|
+
/** Sets a kind up in sign-in.json (readable by the user alone), offered at once; not one the environment sets. */
|
|
51
|
+
setProvider(id, fields) {
|
|
52
|
+
var _a;
|
|
53
|
+
if (((_a = this.setups().find(one => one.id === id)) === null || _a === void 0 ? void 0 : _a.source) === 'env') {
|
|
54
|
+
throw new Error(`${id} is set up by the environment of ta serve, not here.`);
|
|
55
|
+
}
|
|
56
|
+
const next = sign_in_provider_1.SignInProviders.withProvider(config(), id, fields);
|
|
57
|
+
(0, node_fs_1.writeFileSync)(file(), `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 });
|
|
58
|
+
this.providers = sign_in_provider_1.SignInProviders.fromEnv(sign_in_provider_1.SignInProviders.withConfig(process.env, next));
|
|
59
|
+
this.device = sign_in_provider_1.SignInProviders.device(sign_in_provider_1.SignInProviders.withConfig(process.env, next));
|
|
28
60
|
}
|
|
29
61
|
};
|
|
30
62
|
exports.TaSignIn = TaSignIn;
|
|
@@ -38,6 +38,13 @@ export declare class TaServerImpl implements TaServer {
|
|
|
38
38
|
prompt(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
39
39
|
steer(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
40
40
|
followUp(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
41
|
+
/**
|
|
42
|
+
* A message as written by who sends it (TaMessageAuthor): the line of one let in, never one a page wrote. The
|
|
43
|
+
* owner's has none, as before anyone was let in.
|
|
44
|
+
*/
|
|
45
|
+
protected signed(input: TaPromptInput): TaPromptInput;
|
|
46
|
+
/** Whether the principal of this call may take back a waiting message: the owner any, another only their own. */
|
|
47
|
+
protected mayTakeBack(text: string): boolean;
|
|
41
48
|
/** Logs how long the run took to end here: with the times the box keeps (stop.times of @celljs/ta-web), where a slow stop went. */
|
|
42
49
|
abort(sessionId: string): Promise<void>;
|
|
43
50
|
clearQueue(sessionId: string): Promise<TaCommandResult<'clear_queue'>>;
|
|
@@ -70,7 +70,7 @@ let TaServerImpl = class TaServerImpl {
|
|
|
70
70
|
return this.guard(() => this.sessions.close(sessionId));
|
|
71
71
|
}
|
|
72
72
|
async listSessions() {
|
|
73
|
-
return this.
|
|
73
|
+
return this.sessions.infos(node_1.RpcContext.connection());
|
|
74
74
|
}
|
|
75
75
|
async watchSessions() {
|
|
76
76
|
return this.sessions.watch(node_1.RpcContext.requireConnection());
|
|
@@ -115,16 +115,35 @@ let TaServerImpl = class TaServerImpl {
|
|
|
115
115
|
prompt(sessionId, input) {
|
|
116
116
|
return this.on(sessionId, session => {
|
|
117
117
|
this.runs.prompted(sessionId);
|
|
118
|
-
return session.prompt(input);
|
|
118
|
+
return session.prompt(this.signed(input));
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
steer(sessionId, input) {
|
|
122
122
|
this.runs.prompted(sessionId);
|
|
123
|
-
return this.on(sessionId, session => session.steer(input));
|
|
123
|
+
return this.on(sessionId, session => session.steer(this.signed(input)));
|
|
124
124
|
}
|
|
125
125
|
followUp(sessionId, input) {
|
|
126
126
|
this.runs.prompted(sessionId);
|
|
127
|
-
return this.on(sessionId, session => session.followUp(input));
|
|
127
|
+
return this.on(sessionId, session => session.followUp(this.signed(input)));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A message as written by who sends it (TaMessageAuthor): the line of one let in, never one a page wrote. The
|
|
131
|
+
* owner's has none, as before anyone was let in.
|
|
132
|
+
*/
|
|
133
|
+
signed(input) {
|
|
134
|
+
if (typeof (input === null || input === void 0 ? void 0 : input.message) !== 'string') {
|
|
135
|
+
return input;
|
|
136
|
+
}
|
|
137
|
+
const principal = this.principals.current();
|
|
138
|
+
const member = principal === ta_protocol_1.TA_OWNER ? undefined : this.authority.describe(principal);
|
|
139
|
+
const message = member ? ta_protocol_1.TaMessageAuthor.mark(input.message, principal, member.name) : ta_protocol_1.TaMessageAuthor.strip(input.message);
|
|
140
|
+
return message === input.message ? input : { ...input, message };
|
|
141
|
+
}
|
|
142
|
+
/** Whether the principal of this call may take back a waiting message: the owner any, another only their own. */
|
|
143
|
+
mayTakeBack(text) {
|
|
144
|
+
var _a;
|
|
145
|
+
const principal = this.principals.current();
|
|
146
|
+
return principal === ta_protocol_1.TA_OWNER || ((_a = ta_protocol_1.TaMessageAuthor.of(text)) === null || _a === void 0 ? void 0 : _a.id) === principal;
|
|
128
147
|
}
|
|
129
148
|
/** Logs how long the run took to end here: with the times the box keeps (stop.times of @celljs/ta-web), where a slow stop went. */
|
|
130
149
|
async abort(sessionId) {
|
|
@@ -133,10 +152,28 @@ let TaServerImpl = class TaServerImpl {
|
|
|
133
152
|
console.log(`[${new Date().toISOString()}] ta serve: stopped ${sessionId.slice(0, 8)} in ${Date.now() - start} ms`);
|
|
134
153
|
}
|
|
135
154
|
clearQueue(sessionId) {
|
|
136
|
-
return this.on(sessionId,
|
|
155
|
+
return this.on(sessionId, session => {
|
|
156
|
+
if (this.principals.current() === ta_protocol_1.TA_OWNER) {
|
|
157
|
+
return session.pi.clearQueue();
|
|
158
|
+
}
|
|
159
|
+
// One let in takes back their own, the others' stay.
|
|
160
|
+
const taken = { steering: [], followUp: [] };
|
|
161
|
+
for (const kind of ['steering', 'followUp']) {
|
|
162
|
+
const texts = session.queued(kind);
|
|
163
|
+
for (let index = texts.length - 1; index >= 0; index--) {
|
|
164
|
+
if (this.mayTakeBack(texts[index]) && session.removeQueued(kind, index)) {
|
|
165
|
+
taken[kind].unshift(texts[index]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return taken;
|
|
170
|
+
});
|
|
137
171
|
}
|
|
138
172
|
removeQueued(sessionId, kind, index) {
|
|
139
|
-
return this.on(sessionId, session =>
|
|
173
|
+
return this.on(sessionId, session => {
|
|
174
|
+
const text = session.queued(kind)[index];
|
|
175
|
+
return text !== undefined && this.mayTakeBack(text) && session.removeQueued(kind, index);
|
|
176
|
+
});
|
|
140
177
|
}
|
|
141
178
|
newSession(sessionId, parentSession) {
|
|
142
179
|
return this.authored(sessionId, ({ runtime }) => runtime.newSession(parentSession ? { parentSession } : undefined));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
-
import type
|
|
2
|
+
import { type TaEvent, type TaOpenSessionOptions, type TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import { ClientChannel } from './client-channel';
|
|
4
|
-
import { type TaHostOptions, TaSessionFactory, TaSessionRegistry } from './host-protocol';
|
|
4
|
+
import { type TaHostOptions, TaPresenceBook, TaSessionFactory, TaSessionRegistry } from './host-protocol';
|
|
5
5
|
import { TaSessionHandles } from './session-handles';
|
|
6
6
|
import { SessionListFeed } from './session-list-feed';
|
|
7
7
|
import type { TaSession } from './ta-session';
|
|
8
|
-
import { TaVisibility } from './team/team-protocol';
|
|
8
|
+
import { TaPrincipals, TaVisibility } from './team/team-protocol';
|
|
9
9
|
/**
|
|
10
10
|
* The open sessions. A session's id outlives its memory: closed while idle or by a restart, it opens again
|
|
11
11
|
* from its file under the same id at the next call (TaSessionHandles), so clients never see it go.
|
|
@@ -25,6 +25,10 @@ export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
|
25
25
|
protected readonly waking: Map<string, Promise<TaSession>>;
|
|
26
26
|
/** What each connection may see of the list (docs/design/ta-team.md): all of it for the owner's. */
|
|
27
27
|
protected readonly visibility: TaVisibility;
|
|
28
|
+
protected readonly principals: TaPrincipals;
|
|
29
|
+
/** Who else is at each conversation: what each connection is told of the others (TaSessionInfo.people). */
|
|
30
|
+
protected readonly presence: TaPresenceBook;
|
|
31
|
+
protected presenceWatched: boolean;
|
|
28
32
|
protected readonly feed: SessionListFeed;
|
|
29
33
|
locate(sessionId: string): {
|
|
30
34
|
sessionFile?: string;
|
|
@@ -34,7 +38,10 @@ export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
|
34
38
|
require(sessionId: string): TaSession;
|
|
35
39
|
resolve(sessionId: string): Promise<TaSession>;
|
|
36
40
|
list(): TaSession[];
|
|
41
|
+
infos(connection: RpcConnection | undefined): TaSessionInfo[];
|
|
37
42
|
watch(connection: RpcConnection): TaSessionInfo[];
|
|
43
|
+
/** Each with the others at it, as the principal of `connection` is told: never themselves. */
|
|
44
|
+
protected withPeople(connection: RpcConnection | undefined, list: TaSessionInfo[]): TaSessionInfo[];
|
|
38
45
|
get watching(): number;
|
|
39
46
|
get watchedAt(): number;
|
|
40
47
|
onSessionEvent(listener: (session: TaSession, event: TaEvent) => void): () => void;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DefaultTaSessionRegistry = void 0;
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const core_1 = require("@celljs/core");
|
|
15
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
15
16
|
const client_channel_1 = require("./client-channel");
|
|
16
17
|
const host_protocol_1 = require("./host-protocol");
|
|
17
18
|
const session_handles_1 = require("./session-handles");
|
|
@@ -33,7 +34,8 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
33
34
|
this.closing = new Map();
|
|
34
35
|
/** Sessions opening again under their ids: the calls that come meanwhile wait for the same. */
|
|
35
36
|
this.waking = new Map();
|
|
36
|
-
this.
|
|
37
|
+
this.presenceWatched = false;
|
|
38
|
+
this.feed = new session_list_feed_1.SessionListFeed(() => this.list().map(session => session.info()), undefined, (connection, list) => this.withPeople(connection, this.visibility.sessions(connection, list)));
|
|
37
39
|
}
|
|
38
40
|
locate(sessionId) {
|
|
39
41
|
const session = this.sessions.get(sessionId);
|
|
@@ -80,9 +82,25 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
80
82
|
list() {
|
|
81
83
|
return [...this.sessions.values()];
|
|
82
84
|
}
|
|
85
|
+
infos(connection) {
|
|
86
|
+
return this.withPeople(connection, this.visibility.sessions(connection, this.list().map(session => session.info())));
|
|
87
|
+
}
|
|
83
88
|
watch(connection) {
|
|
89
|
+
// Once a page watches, every component is made: who is where tells the lists again as it changes.
|
|
90
|
+
if (!this.presenceWatched) {
|
|
91
|
+
this.presenceWatched = true;
|
|
92
|
+
this.presence.onChange(() => this.feed.changed());
|
|
93
|
+
}
|
|
84
94
|
return this.feed.watch(connection);
|
|
85
95
|
}
|
|
96
|
+
/** Each with the others at it, as the principal of `connection` is told: never themselves. */
|
|
97
|
+
withPeople(connection, list) {
|
|
98
|
+
const principal = connection ? this.principals.of(connection) : ta_protocol_1.TA_OWNER;
|
|
99
|
+
return list.map(info => {
|
|
100
|
+
const people = this.presence.people(info.sessionId, principal, info.isStreaming);
|
|
101
|
+
return people ? { ...info, people } : info;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
86
104
|
get watching() {
|
|
87
105
|
return this.feed.watching;
|
|
88
106
|
}
|
|
@@ -188,6 +206,14 @@ __decorate([
|
|
|
188
206
|
(0, core_1.Autowired)({ id: team_protocol_1.TaVisibility, detached: true }),
|
|
189
207
|
__metadata("design:type", Object)
|
|
190
208
|
], DefaultTaSessionRegistry.prototype, "visibility", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, core_1.Autowired)({ id: team_protocol_1.TaPrincipals, detached: true }),
|
|
211
|
+
__metadata("design:type", Object)
|
|
212
|
+
], DefaultTaSessionRegistry.prototype, "principals", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
(0, core_1.Autowired)({ id: host_protocol_1.TaPresenceBook, detached: true }),
|
|
215
|
+
__metadata("design:type", Object)
|
|
216
|
+
], DefaultTaSessionRegistry.prototype, "presence", void 0);
|
|
191
217
|
exports.DefaultTaSessionRegistry = DefaultTaSessionRegistry = __decorate([
|
|
192
218
|
(0, core_1.Component)(host_protocol_1.TaSessionRegistry)
|
|
193
219
|
], DefaultTaSessionRegistry);
|
package/lib/node/ta-session.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export declare class TaSession {
|
|
|
75
75
|
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
76
76
|
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
77
77
|
*/
|
|
78
|
+
/** The texts of the messages waiting, of one kind, in their order. */
|
|
79
|
+
queued(kind: 'steering' | 'followUp'): readonly string[];
|
|
78
80
|
removeQueued(kind: 'steering' | 'followUp', index: number): boolean;
|
|
79
81
|
/** pi's runtime says nothing of a move in the tree: the clients are told to read the conversation again. */
|
|
80
82
|
navigateTree(targetId: string, options?: Parameters<AgentSession['navigateTree']>[1]): Promise<TaNavigateResult>;
|
package/lib/node/ta-session.js
CHANGED
|
@@ -160,6 +160,12 @@ class TaSession {
|
|
|
160
160
|
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
161
161
|
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
162
162
|
*/
|
|
163
|
+
/** The texts of the messages waiting, of one kind, in their order. */
|
|
164
|
+
queued(kind) {
|
|
165
|
+
var _a;
|
|
166
|
+
const pi = this.pi;
|
|
167
|
+
return [...((_a = (kind === 'steering' ? pi._steeringMessages : pi._followUpMessages)) !== null && _a !== void 0 ? _a : [])];
|
|
168
|
+
}
|
|
163
169
|
removeQueued(kind, index) {
|
|
164
170
|
const pi = this.pi;
|
|
165
171
|
const texts = kind === 'steering' ? pi._steeringMessages : pi._followUpMessages;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TaHostTeam } from '@celljs/ta-protocol';
|
|
2
|
-
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry } from './team-protocol';
|
|
2
|
+
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberAccounts, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry } from './team-protocol';
|
|
3
3
|
/** The face of the parts of ta serve that let people in, as the server side of packages gets it (TaExtensionHost.team). */
|
|
4
4
|
export declare class DefaultTaHostTeamProvider implements TaHostTeamProvider {
|
|
5
5
|
protected readonly principals: TaPrincipals;
|
|
@@ -9,6 +9,7 @@ export declare class DefaultTaHostTeamProvider implements TaHostTeamProvider {
|
|
|
9
9
|
protected readonly permissions: TaPackagePermissions;
|
|
10
10
|
protected readonly devices: TaMemberDevices;
|
|
11
11
|
protected readonly connections: TaConnections;
|
|
12
|
+
protected readonly accounts: TaMemberAccounts;
|
|
12
13
|
readonly team: TaHostTeam;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=host-team.d.ts.map
|
|
@@ -34,6 +34,12 @@ let DefaultTaHostTeamProvider = class DefaultTaHostTeamProvider {
|
|
|
34
34
|
pair: (principal, name, expiresAt) => this.devices.pair(principal, name, expiresAt),
|
|
35
35
|
unpair: deviceId => this.devices.unpair(deviceId),
|
|
36
36
|
devices: () => this.devices.list(),
|
|
37
|
+
accounts: {
|
|
38
|
+
providers: () => this.accounts.providers(),
|
|
39
|
+
start: (provider, redirectUri) => this.accounts.start(provider, redirectUri),
|
|
40
|
+
verify: (state, code) => this.accounts.verify(state, code),
|
|
41
|
+
typed: (state, waitMs) => this.accounts.typed(state, waitMs),
|
|
42
|
+
},
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
};
|
|
@@ -66,6 +72,10 @@ __decorate([
|
|
|
66
72
|
(0, core_1.Autowired)(team_protocol_1.TaConnections),
|
|
67
73
|
__metadata("design:type", Object)
|
|
68
74
|
], DefaultTaHostTeamProvider.prototype, "connections", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, core_1.Autowired)(team_protocol_1.TaMemberAccounts),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], DefaultTaHostTeamProvider.prototype, "accounts", void 0);
|
|
69
79
|
exports.DefaultTaHostTeamProvider = DefaultTaHostTeamProvider = __decorate([
|
|
70
80
|
(0, core_1.Component)(team_protocol_1.TaHostTeamProvider)
|
|
71
81
|
], DefaultTaHostTeamProvider);
|
package/lib/node/team/index.d.ts
CHANGED
package/lib/node/team/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./authority"), exports);
|
|
|
18
18
|
__exportStar(require("./call-util"), exports);
|
|
19
19
|
__exportStar(require("./connections"), exports);
|
|
20
20
|
__exportStar(require("./host-team"), exports);
|
|
21
|
+
__exportStar(require("./member-accounts"), exports);
|
|
21
22
|
__exportStar(require("./member-devices"), exports);
|
|
22
23
|
__exportStar(require("./package-permissions"), exports);
|
|
23
24
|
__exportStar(require("./principals"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TaAccount, TaAccountStart, TaSignInProvider } from '@celljs/ta-protocol';
|
|
2
|
+
import { type DeviceSignInProvider, type SignInAccount } from '../sign-in/sign-in-provider';
|
|
3
|
+
import { type TaSignIn } from '../sign-in/ta-sign-in';
|
|
4
|
+
import { TaMemberAccounts } from './team-protocol';
|
|
5
|
+
/** A sign-in by a code, its device code kept here: who types the code sees it alone. */
|
|
6
|
+
interface Typing {
|
|
7
|
+
provider: DeviceSignInProvider;
|
|
8
|
+
deviceCode: string;
|
|
9
|
+
interval: number;
|
|
10
|
+
next: number;
|
|
11
|
+
expiresAt: number;
|
|
12
|
+
account?: TaAccount;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Who one asking to come in is, by an account of the providers ta serve signs in with (TaSignIn), or by a code typed at
|
|
16
|
+
* GitHub with Ta's own app when GitHub is not set up (TaSignIn.device): nothing let in by it.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DefaultTaMemberAccounts implements TaMemberAccounts {
|
|
19
|
+
protected readonly flow: TaSignIn;
|
|
20
|
+
protected readonly typing: Map<string, Typing>;
|
|
21
|
+
providers(): TaSignInProvider[];
|
|
22
|
+
start(provider: string, redirectUri: string): Promise<TaAccountStart>;
|
|
23
|
+
verify(state: string, code: string): Promise<TaAccount>;
|
|
24
|
+
typed(state: string, waitMs?: number): Promise<TaAccount | undefined>;
|
|
25
|
+
/** GitHub by a code, when ta serve has no GitHub of its own. */
|
|
26
|
+
protected device(): DeviceSignInProvider | undefined;
|
|
27
|
+
protected startTyping(device: DeviceSignInProvider): Promise<TaAccountStart>;
|
|
28
|
+
protected of({ id, name, avatar }: SignInAccount): TaAccount;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=member-accounts.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultTaMemberAccounts = void 0;
|
|
13
|
+
const node_crypto_1 = require("node:crypto");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const sign_in_provider_1 = require("../sign-in/sign-in-provider");
|
|
16
|
+
const ta_sign_in_1 = require("../sign-in/ta-sign-in");
|
|
17
|
+
const team_protocol_1 = require("./team-protocol");
|
|
18
|
+
/** Sign-ins by a code under way at once: anyone holding a link may start one. */
|
|
19
|
+
const MAX_TYPING = 200;
|
|
20
|
+
const WAIT_MS = 25000;
|
|
21
|
+
/**
|
|
22
|
+
* Who one asking to come in is, by an account of the providers ta serve signs in with (TaSignIn), or by a code typed at
|
|
23
|
+
* GitHub with Ta's own app when GitHub is not set up (TaSignIn.device): nothing let in by it.
|
|
24
|
+
*/
|
|
25
|
+
let DefaultTaMemberAccounts = class DefaultTaMemberAccounts {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.typing = new Map();
|
|
28
|
+
}
|
|
29
|
+
providers() {
|
|
30
|
+
const own = this.flow.providers.map(({ id, name }) => ({ id, name }));
|
|
31
|
+
const device = this.device();
|
|
32
|
+
return device ? [...own, { id: device.id, name: device.name, device: true }] : own;
|
|
33
|
+
}
|
|
34
|
+
async start(provider, redirectUri) {
|
|
35
|
+
const device = this.device();
|
|
36
|
+
if ((device === null || device === void 0 ? void 0 : device.id) === provider) {
|
|
37
|
+
return this.startTyping(device);
|
|
38
|
+
}
|
|
39
|
+
if (!/^https?:\/\/[^/?#]+\/[^?#]*$/.test(redirectUri)) {
|
|
40
|
+
throw new Error(`Not an address to come back to: ${redirectUri}`);
|
|
41
|
+
}
|
|
42
|
+
return this.flow.startVerify(provider, redirectUri);
|
|
43
|
+
}
|
|
44
|
+
async verify(state, code) {
|
|
45
|
+
return this.of(await this.flow.verify(state, code));
|
|
46
|
+
}
|
|
47
|
+
async typed(state, waitMs = WAIT_MS) {
|
|
48
|
+
const typing = this.typing.get(state);
|
|
49
|
+
if (!typing) {
|
|
50
|
+
throw new sign_in_provider_1.SignInError('The sign-in expired or was not started here');
|
|
51
|
+
}
|
|
52
|
+
const until = Date.now() + Math.min(Math.max(0, waitMs), WAIT_MS);
|
|
53
|
+
// Asked no more often than the provider says; one waiting already asks for both.
|
|
54
|
+
while (!typing.account) {
|
|
55
|
+
if (Date.now() >= typing.expiresAt) {
|
|
56
|
+
this.typing.delete(state);
|
|
57
|
+
throw new sign_in_provider_1.SignInError('The code ran out: sign in again');
|
|
58
|
+
}
|
|
59
|
+
const sleep = typing.next - Date.now();
|
|
60
|
+
if (Date.now() + Math.max(0, sleep) > until) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (sleep > 0) {
|
|
64
|
+
await new Promise(resolve => setTimeout(resolve, sleep));
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
typing.next = Date.now() + typing.interval;
|
|
68
|
+
let answer;
|
|
69
|
+
try {
|
|
70
|
+
answer = await typing.provider.poll(typing.deviceCode);
|
|
71
|
+
}
|
|
72
|
+
catch (failure) {
|
|
73
|
+
// Refused, or the code is no good: over. The network failing is not, and is asked again.
|
|
74
|
+
if (failure instanceof sign_in_provider_1.SignInError) {
|
|
75
|
+
this.typing.delete(state);
|
|
76
|
+
}
|
|
77
|
+
throw failure;
|
|
78
|
+
}
|
|
79
|
+
if (answer === 'slowDown') {
|
|
80
|
+
typing.interval += 5000;
|
|
81
|
+
typing.next = Date.now() + typing.interval;
|
|
82
|
+
}
|
|
83
|
+
else if (answer !== 'pending') {
|
|
84
|
+
typing.account = this.of(answer);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return typing.account;
|
|
88
|
+
}
|
|
89
|
+
/** GitHub by a code, when ta serve has no GitHub of its own. */
|
|
90
|
+
device() {
|
|
91
|
+
const device = this.flow.device;
|
|
92
|
+
return device && !this.flow.providers.some(one => one.id === device.id) ? device : undefined;
|
|
93
|
+
}
|
|
94
|
+
async startTyping(device) {
|
|
95
|
+
const now = Date.now();
|
|
96
|
+
for (const [state, typing] of this.typing) {
|
|
97
|
+
if (now >= typing.expiresAt || this.typing.size >= MAX_TYPING) {
|
|
98
|
+
this.typing.delete(state);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const code = await device.code();
|
|
102
|
+
const state = (0, node_crypto_1.randomBytes)(18).toString('base64url');
|
|
103
|
+
const interval = Math.max(0, code.interval) * 1000;
|
|
104
|
+
const expiresAt = now + code.expiresIn * 1000;
|
|
105
|
+
this.typing.set(state, { provider: device, deviceCode: code.deviceCode, interval, next: now + interval, expiresAt });
|
|
106
|
+
return { state, device: { code: code.userCode, uri: code.uri, expiresAt } };
|
|
107
|
+
}
|
|
108
|
+
of({ id, name, avatar }) {
|
|
109
|
+
return { id, ...(name ? { name } : {}), ...(avatar ? { avatar } : {}) };
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
exports.DefaultTaMemberAccounts = DefaultTaMemberAccounts;
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, core_1.Autowired)(ta_sign_in_1.TA_SIGN_IN),
|
|
115
|
+
__metadata("design:type", Function)
|
|
116
|
+
], DefaultTaMemberAccounts.prototype, "flow", void 0);
|
|
117
|
+
exports.DefaultTaMemberAccounts = DefaultTaMemberAccounts = __decorate([
|
|
118
|
+
(0, core_1.Component)(team_protocol_1.TaMemberAccounts)
|
|
119
|
+
], DefaultTaMemberAccounts);
|
|
120
|
+
//# sourceMappingURL=member-accounts.js.map
|
|
@@ -9,7 +9,8 @@ export interface TaCallNeedOne {
|
|
|
9
9
|
* directory it opens), nothing (`anyone`: any principal let in), or nothing either and open to one holding a link of
|
|
10
10
|
* invitation too (`invite`: asking to come in).
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
/** `owner`: the owner alone, whatever a role gives (secrets of the owner's, such as those of providers to sign in with). */
|
|
13
|
+
export type TaCallNeed = TaCallNeedOne | TaCallNeedOne[] | 'anyone' | 'invite' | 'owner';
|
|
13
14
|
/** What finding the resource of a call needs: where a session is, the default directory, what packages declare. */
|
|
14
15
|
export interface TaCallLookup {
|
|
15
16
|
session(sessionId: string): {
|
|
@@ -4,6 +4,7 @@ exports.TaCallPermissions = void 0;
|
|
|
4
4
|
exports.plainPath = plainPath;
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const anyone = () => 'anyone';
|
|
7
|
+
const owner = () => 'owner';
|
|
7
8
|
const fixed = (action) => () => ({ action });
|
|
8
9
|
/** The conversation of the session of the first parameter. */
|
|
9
10
|
const session = (action) => (params, lookup) => {
|
|
@@ -217,6 +218,10 @@ const RULES = {
|
|
|
217
218
|
'watch',
|
|
218
219
|
'unwatch',
|
|
219
220
|
].map(method => [method, fixed('settings.manage')])),
|
|
221
|
+
// What a page is at: each page's own, and only of conversations it may see (TaPresenceServerImpl).
|
|
222
|
+
TaPresenceServer: {
|
|
223
|
+
report: anyone,
|
|
224
|
+
},
|
|
220
225
|
TaSettingsServer: {
|
|
221
226
|
getSettings: fixed('settings.view'),
|
|
222
227
|
updateSettings: fixed('settings.manage'),
|
|
@@ -228,8 +233,14 @@ const RULES = {
|
|
|
228
233
|
answer: fixed('models.manage'),
|
|
229
234
|
cancel: fixed('models.manage'),
|
|
230
235
|
logout: fixed('models.manage'),
|
|
236
|
+
listCustomProviders: fixed('models.manage'),
|
|
237
|
+
saveCustomProvider: fixed('models.manage'),
|
|
238
|
+
removeCustomProvider: fixed('models.manage'),
|
|
239
|
+
fetchCustomModels: fixed('models.manage'),
|
|
231
240
|
},
|
|
232
241
|
TaAccessServer: {
|
|
242
|
+
getSignInConfig: owner,
|
|
243
|
+
setSignInProvider: owner,
|
|
233
244
|
getAccess: fixed('members.view'),
|
|
234
245
|
bindUrl: fixed('members.roles'),
|
|
235
246
|
allow: fixed('members.roles'),
|
|
@@ -71,7 +71,7 @@ let TaTeamGate = class TaTeamGate {
|
|
|
71
71
|
packageAction: (pkg, method, kind) => this.permissions.host(pkg, method, kind),
|
|
72
72
|
});
|
|
73
73
|
// A call of no rule is the owner's; one holding a link of invitation only asks to come in.
|
|
74
|
-
if (!need || (principal.startsWith(ta_protocol_1.TA_INVITE_PREFIX) && need !== 'invite')) {
|
|
74
|
+
if (!need || need === 'owner' || (principal.startsWith(ta_protocol_1.TA_INVITE_PREFIX) && need !== 'invite')) {
|
|
75
75
|
refused({ action: name, askable: false });
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
-
import type { TaAuditEvent, TaAuthorizer, TaDenial, TaHostTeam, TaMemberInfo, TaResource, TaSessionInfo, TaSharedData, TaSharedRef, TaTeamDevice, TaTeamPairing } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaAuditEvent, TaAuthorizer, TaDenial, TaHostAccounts, TaHostTeam, TaMemberInfo, TaResource, TaSessionInfo, TaSharedData, TaSharedRef, TaTeamDevice, TaTeamPairing } from '@celljs/ta-protocol';
|
|
3
3
|
/**
|
|
4
4
|
* The parts by which ta serve lets people in besides its user (docs/design/ta-team.md 4, 14). Each has one concern, and
|
|
5
5
|
* the rest of ta serve depends on these interfaces only: the sessions, the data of packages and the terminals ask
|
|
@@ -61,6 +61,10 @@ export interface TaMemberDevices {
|
|
|
61
61
|
unpair(deviceId: string): void;
|
|
62
62
|
list(): TaTeamDevice[];
|
|
63
63
|
}
|
|
64
|
+
/** Who one asking to come in is, by an account (TaHostAccounts). */
|
|
65
|
+
export declare const TaMemberAccounts: unique symbol;
|
|
66
|
+
export interface TaMemberAccounts extends TaHostAccounts {
|
|
67
|
+
}
|
|
64
68
|
/** The connections open, by principal. */
|
|
65
69
|
export declare const TaConnections: unique symbol;
|
|
66
70
|
export interface TaConnections {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaHostTeamProvider = exports.TaVisibility = exports.TaConnections = exports.TaMemberDevices = exports.TaPackagePermissions = exports.TaSharedDataRegistry = exports.TaRunActors = exports.TaAuthority = exports.TaPrincipals = void 0;
|
|
3
|
+
exports.TaHostTeamProvider = exports.TaVisibility = exports.TaConnections = exports.TaMemberAccounts = exports.TaMemberDevices = exports.TaPackagePermissions = exports.TaSharedDataRegistry = exports.TaRunActors = exports.TaAuthority = exports.TaPrincipals = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The parts by which ta serve lets people in besides its user (docs/design/ta-team.md 4, 14). Each has one concern, and
|
|
6
6
|
* the rest of ta serve depends on these interfaces only: the sessions, the data of packages and the terminals ask
|
|
@@ -18,6 +18,8 @@ exports.TaSharedDataRegistry = Symbol('TaSharedDataRegistry');
|
|
|
18
18
|
exports.TaPackagePermissions = Symbol('TaPackagePermissions');
|
|
19
19
|
/** The devices of those let in, through the relay. */
|
|
20
20
|
exports.TaMemberDevices = Symbol('TaMemberDevices');
|
|
21
|
+
/** Who one asking to come in is, by an account (TaHostAccounts). */
|
|
22
|
+
exports.TaMemberAccounts = Symbol('TaMemberAccounts');
|
|
21
23
|
/** The connections open, by principal. */
|
|
22
24
|
exports.TaConnections = Symbol('TaConnections');
|
|
23
25
|
/**
|
|
@@ -25,6 +25,7 @@ var WebExtensionUtil;
|
|
|
25
25
|
origin: pkg.origin,
|
|
26
26
|
enabled: (_e = pkg.enabled) !== null && _e !== void 0 ? _e : true,
|
|
27
27
|
source: pkg.source,
|
|
28
|
+
root: pkg.root,
|
|
28
29
|
entry,
|
|
29
30
|
hash: hash((0, node_fs_1.readFileSync)((0, node_path_1.join)(pkg.root, entry), 'utf8')),
|
|
30
31
|
title: text((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.title),
|