@coasys/ad4m 0.13.1-staging.3 → 0.13.1-staging.4
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/lib/index.cjs +27 -6
- package/lib/index.js +27 -6
- package/lib/src/agent/AgentClient.d.ts +16 -1
- package/lib/src/agent/AgentClient.js +21 -2
- package/lib/src/ai/AITypes.d.ts +6 -2
- package/lib/src/apiClient.js +1 -1
- package/lib/src/generated/api/Apps.d.ts +4 -0
- package/lib/src/generated/api/Events.d.ts +10 -12
- package/lib/src/generated/api/FlowStateChangedEvent.d.ts +3 -2
- package/lib/src/generated/api/Model.d.ts +4 -0
- package/lib/src/generated/api/ModelApi.d.ts +5 -1
- package/lib/src/generated/api/ModelApiInput.d.ts +7 -1
- package/lib/src/generated/api/Notification.d.ts +5 -1
- package/lib/src/generated/api/NotificationInput.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveEvent.d.ts +8 -0
- package/lib/src/generated/api/{PerspectiveLinkWithOwner.d.ts → PerspectiveLinkEvent.d.ts} +4 -2
- package/lib/src/generated/api/{PerspectiveLinkUpdatedWithOwner.d.ts → PerspectiveLinkUpdatedEvent.d.ts} +4 -2
- package/lib/src/generated/api/PerspectiveRemovedEvent.d.ts +7 -0
- package/lib/src/generated/api/RequestCapabilityRequest.d.ts +1 -0
- package/lib/src/generated/api/RpcMethods.d.ts +10 -1
- package/lib/src/generated/api/RuntimeUpdateNotificationParams.d.ts +6 -1
- package/lib/src/generated/api/UsersRevokeAllSessionsParams.d.ts +7 -0
- package/{src/generated/api/PerspectiveRemovedWithOwner.ts → lib/src/generated/api/UsersRevokeAllSessionsParams.js} +1 -2
- package/lib/src/perspectives/WakerSubscriptionManager.js +3 -3
- package/lib/src/runtime/RuntimeClient.d.ts +6 -3
- package/lib/src/runtime/RuntimeClient.js +2 -0
- package/lib/src/runtime/RuntimeTypes.d.ts +5 -1
- package/package.json +2 -2
- package/src/Ad4mClient.test.ts +53 -18
- package/src/agent/AgentClient.ts +26 -2
- package/src/ai/AITypes.ts +6 -2
- package/src/apiClient.test.ts +2 -3
- package/src/apiClient.ts +1 -1
- package/src/generated/api/Apps.ts +6 -1
- package/src/generated/api/Events.ts +10 -12
- package/src/generated/api/FlowStateChangedEvent.ts +3 -2
- package/src/generated/api/Model.ts +4 -0
- package/src/generated/api/ModelApi.ts +5 -1
- package/src/generated/api/ModelApiInput.ts +8 -1
- package/src/generated/api/Notification.ts +5 -1
- package/src/generated/api/NotificationInput.ts +6 -1
- package/src/generated/api/PerspectiveEvent.ts +7 -0
- package/src/generated/api/{PerspectiveLinkUpdatedWithOwner.ts → PerspectiveLinkEvent.ts} +4 -1
- package/src/generated/api/PerspectiveLinkUpdatedEvent.ts +7 -0
- package/src/generated/api/PerspectiveRemovedEvent.ts +6 -0
- package/src/generated/api/RequestCapabilityRequest.ts +1 -1
- package/src/generated/api/RpcMethods.ts +4 -1
- package/src/generated/api/RuntimeUpdateNotificationParams.ts +7 -1
- package/src/generated/api/UsersRevokeAllSessionsParams.ts +8 -0
- package/src/perspectives/WakerSubscriptionManager.test.ts +2 -2
- package/src/perspectives/WakerSubscriptionManager.ts +3 -3
- package/src/perspectives/link-updated-type.test.ts +2 -2
- package/src/perspectives/listener-leaks.test.ts +3 -3
- package/src/runtime/RuntimeClient.ts +6 -3
- package/src/runtime/RuntimeTypes.ts +8 -1
- package/lib/src/generated/api/MessageReceivedEvent.d.ts +0 -7
- package/lib/src/generated/api/PerspectiveRemovedWithOwner.d.ts +0 -5
- package/lib/src/generated/api/PerspectiveWithOwner.d.ts +0 -6
- package/lib/src/generated/api/PerspectiveWithOwner.js +0 -1
- package/src/generated/api/MessageReceivedEvent.ts +0 -7
- package/src/generated/api/PerspectiveLinkWithOwner.ts +0 -4
- package/src/generated/api/PerspectiveWithOwner.ts +0 -4
- /package/lib/src/generated/api/{MessageReceivedEvent.js → PerspectiveEvent.js} +0 -0
- /package/lib/src/generated/api/{PerspectiveLinkUpdatedWithOwner.js → PerspectiveLinkEvent.js} +0 -0
- /package/lib/src/generated/api/{PerspectiveLinkWithOwner.js → PerspectiveLinkUpdatedEvent.js} +0 -0
- /package/lib/src/generated/api/{PerspectiveRemovedWithOwner.js → PerspectiveRemovedEvent.js} +0 -0
package/lib/index.cjs
CHANGED
|
@@ -212,7 +212,7 @@ class ApiClient {
|
|
|
212
212
|
? new RpcError(401, event.reason || 'token expired or revoked')
|
|
213
213
|
: closedError(event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined));
|
|
214
214
|
if (event?.code === CLOSE_AUTH_FAILED && this._ws === ws) {
|
|
215
|
-
this._failAuth(event.reason || 'token expired or revoked');
|
|
215
|
+
this._failAuth(event.reason || 'Unauthorized access: the token expired or was revoked');
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
218
218
|
this._onClose(ws, event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined);
|
|
@@ -1296,8 +1296,15 @@ class AgentClient {
|
|
|
1296
1296
|
async entanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
1297
1297
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
|
|
1298
1298
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1299
|
+
/**
|
|
1300
|
+
* Asks the executor for a capability token. `agent` names the agent the token will act
|
|
1301
|
+
* as: a managed user's email or an agent's DID; absent, the executor's main agent. That
|
|
1302
|
+
* agent's owner approves the request (the operator for the main agent, the user for
|
|
1303
|
+
* theirs). Returns the request id that {@link generateJwt} redeems with the approver's
|
|
1304
|
+
* six-digit code.
|
|
1305
|
+
*/
|
|
1306
|
+
async requestCapability(authInfo, agent) {
|
|
1307
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
|
|
1301
1308
|
}
|
|
1302
1309
|
async permitCapability(auth) {
|
|
1303
1310
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
|
|
@@ -1333,6 +1340,18 @@ class AgentClient {
|
|
|
1333
1340
|
async verifyEmailCode(email, code, verificationType) {
|
|
1334
1341
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
|
|
1335
1342
|
}
|
|
1343
|
+
/** Revokes this client's user token. The executor then closes the client's sockets. */
|
|
1344
|
+
async logout() {
|
|
1345
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.logout', {});
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Revokes every token of a user issued up to now, this client's own included, and closes
|
|
1349
|
+
* their sockets. A user leaves out `email` (or names themselves); the operator names the
|
|
1350
|
+
* user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
|
|
1351
|
+
*/
|
|
1352
|
+
async revokeAllSessions(email) {
|
|
1353
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
|
|
1354
|
+
}
|
|
1336
1355
|
// Hosting methods
|
|
1337
1356
|
async hostingUserInfo() {
|
|
1338
1357
|
const info = (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
|
|
@@ -9972,6 +9991,8 @@ class RuntimeClient {
|
|
|
9972
9991
|
async removeKnownLinkLanguageTemplates(addresses) {
|
|
9973
9992
|
return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
|
|
9974
9993
|
}
|
|
9994
|
+
/** Every link-language template the executor knows, with its meta (name, description,
|
|
9995
|
+
* `possibleTemplateParams`). A template whose meta cannot be read is left out. */
|
|
9975
9996
|
async knownLinkLanguageTemplates() {
|
|
9976
9997
|
return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
|
|
9977
9998
|
}
|
|
@@ -23088,13 +23109,13 @@ function hintFor(msg) {
|
|
|
23088
23109
|
// "Executor is locked" is the current executor's message; "main key not
|
|
23089
23110
|
// found" is what older executors (and unrelated key lookups) say for the
|
|
23090
23111
|
// same locked state. Either way the caller cannot fix it themselves: keys
|
|
23091
|
-
// live in memory only, so every restart locks the
|
|
23112
|
+
// live in memory only, so every restart locks the executor again and only its
|
|
23092
23113
|
// operator can unlock it.
|
|
23093
23114
|
if (/executor is locked/i.test(msg) || /main key not found/i.test(msg)) {
|
|
23094
|
-
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the
|
|
23115
|
+
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the executor's operator can unlock it: contact them and ask for unlockAgent, then subscribe again — a pending subscription re-attempts on its own once the executor is unlocked";
|
|
23095
23116
|
}
|
|
23096
23117
|
if (/timed out after \d+ms/i.test(msg)) {
|
|
23097
|
-
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the
|
|
23118
|
+
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the executor is unlocked";
|
|
23098
23119
|
}
|
|
23099
23120
|
return "";
|
|
23100
23121
|
}
|
package/lib/index.js
CHANGED
|
@@ -208,7 +208,7 @@ class ApiClient {
|
|
|
208
208
|
? new RpcError(401, event.reason || 'token expired or revoked')
|
|
209
209
|
: closedError(event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined));
|
|
210
210
|
if (event?.code === CLOSE_AUTH_FAILED && this._ws === ws) {
|
|
211
|
-
this._failAuth(event.reason || 'token expired or revoked');
|
|
211
|
+
this._failAuth(event.reason || 'Unauthorized access: the token expired or was revoked');
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
214
|
this._onClose(ws, event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined);
|
|
@@ -1292,8 +1292,15 @@ class AgentClient {
|
|
|
1292
1292
|
async entanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
1293
1293
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
|
|
1294
1294
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
/**
|
|
1296
|
+
* Asks the executor for a capability token. `agent` names the agent the token will act
|
|
1297
|
+
* as: a managed user's email or an agent's DID; absent, the executor's main agent. That
|
|
1298
|
+
* agent's owner approves the request (the operator for the main agent, the user for
|
|
1299
|
+
* theirs). Returns the request id that {@link generateJwt} redeems with the approver's
|
|
1300
|
+
* six-digit code.
|
|
1301
|
+
*/
|
|
1302
|
+
async requestCapability(authInfo, agent) {
|
|
1303
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
|
|
1297
1304
|
}
|
|
1298
1305
|
async permitCapability(auth) {
|
|
1299
1306
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
|
|
@@ -1329,6 +1336,18 @@ class AgentClient {
|
|
|
1329
1336
|
async verifyEmailCode(email, code, verificationType) {
|
|
1330
1337
|
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
|
|
1331
1338
|
}
|
|
1339
|
+
/** Revokes this client's user token. The executor then closes the client's sockets. */
|
|
1340
|
+
async logout() {
|
|
1341
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.logout', {});
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Revokes every token of a user issued up to now, this client's own included, and closes
|
|
1345
|
+
* their sockets. A user leaves out `email` (or names themselves); the operator names the
|
|
1346
|
+
* user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
|
|
1347
|
+
*/
|
|
1348
|
+
async revokeAllSessions(email) {
|
|
1349
|
+
return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
|
|
1350
|
+
}
|
|
1332
1351
|
// Hosting methods
|
|
1333
1352
|
async hostingUserInfo() {
|
|
1334
1353
|
const info = (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
|
|
@@ -9968,6 +9987,8 @@ class RuntimeClient {
|
|
|
9968
9987
|
async removeKnownLinkLanguageTemplates(addresses) {
|
|
9969
9988
|
return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
|
|
9970
9989
|
}
|
|
9990
|
+
/** Every link-language template the executor knows, with its meta (name, description,
|
|
9991
|
+
* `possibleTemplateParams`). A template whose meta cannot be read is left out. */
|
|
9971
9992
|
async knownLinkLanguageTemplates() {
|
|
9972
9993
|
return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
|
|
9973
9994
|
}
|
|
@@ -23084,13 +23105,13 @@ function hintFor(msg) {
|
|
|
23084
23105
|
// "Executor is locked" is the current executor's message; "main key not
|
|
23085
23106
|
// found" is what older executors (and unrelated key lookups) say for the
|
|
23086
23107
|
// same locked state. Either way the caller cannot fix it themselves: keys
|
|
23087
|
-
// live in memory only, so every restart locks the
|
|
23108
|
+
// live in memory only, so every restart locks the executor again and only its
|
|
23088
23109
|
// operator can unlock it.
|
|
23089
23110
|
if (/executor is locked/i.test(msg) || /main key not found/i.test(msg)) {
|
|
23090
|
-
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the
|
|
23111
|
+
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the executor's operator can unlock it: contact them and ask for unlockAgent, then subscribe again — a pending subscription re-attempts on its own once the executor is unlocked";
|
|
23091
23112
|
}
|
|
23092
23113
|
if (/timed out after \d+ms/i.test(msg)) {
|
|
23093
|
-
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the
|
|
23114
|
+
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the executor is unlocked";
|
|
23094
23115
|
}
|
|
23095
23116
|
return "";
|
|
23096
23117
|
}
|
|
@@ -48,7 +48,14 @@ export declare class AgentClient {
|
|
|
48
48
|
deleteEntanglementProofs(proofs: EntanglementProofInput[]): Promise<EntanglementProof[]>;
|
|
49
49
|
getEntanglementProofs(): Promise<EntanglementProof[]>;
|
|
50
50
|
entanglementProofPreFlight(deviceKey: string, deviceKeyType: string): Promise<EntanglementProof>;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Asks the executor for a capability token. `agent` names the agent the token will act
|
|
53
|
+
* as: a managed user's email or an agent's DID; absent, the executor's main agent. That
|
|
54
|
+
* agent's owner approves the request (the operator for the main agent, the user for
|
|
55
|
+
* theirs). Returns the request id that {@link generateJwt} redeems with the approver's
|
|
56
|
+
* six-digit code.
|
|
57
|
+
*/
|
|
58
|
+
requestCapability(authInfo: AuthInfoInput, agent?: string): Promise<string>;
|
|
52
59
|
permitCapability(auth: string): Promise<string>;
|
|
53
60
|
generateJwt(requestId: string, rand: string): Promise<string>;
|
|
54
61
|
getApps(): Promise<Apps[]>;
|
|
@@ -60,6 +67,14 @@ export declare class AgentClient {
|
|
|
60
67
|
loginUser(email: string, password: string): Promise<string>;
|
|
61
68
|
requestLoginVerification(email: string, appInfo?: AuthInfoInput): Promise<VerificationRequestResult>;
|
|
62
69
|
verifyEmailCode(email: string, code: string, verificationType: string): Promise<string>;
|
|
70
|
+
/** Revokes this client's user token. The executor then closes the client's sockets. */
|
|
71
|
+
logout(): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Revokes every token of a user issued up to now, this client's own included, and closes
|
|
74
|
+
* their sockets. A user leaves out `email` (or names themselves); the operator names the
|
|
75
|
+
* user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
|
|
76
|
+
*/
|
|
77
|
+
revokeAllSessions(email?: string): Promise<boolean>;
|
|
63
78
|
hostingUserInfo(): Promise<HostingUserInfo>;
|
|
64
79
|
computeLog(since?: string, limit?: number, userEmail?: string): Promise<ComputeLogEntry[]>;
|
|
65
80
|
setHotWalletAddress(address: string): Promise<boolean>;
|
|
@@ -163,8 +163,15 @@ export class AgentClient {
|
|
|
163
163
|
async entanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
164
164
|
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Asks the executor for a capability token. `agent` names the agent the token will act
|
|
168
|
+
* as: a managed user's email or an agent's DID; absent, the executor's main agent. That
|
|
169
|
+
* agent's owner approves the request (the operator for the main agent, the user for
|
|
170
|
+
* theirs). Returns the request id that {@link generateJwt} redeems with the approver's
|
|
171
|
+
* six-digit code.
|
|
172
|
+
*/
|
|
173
|
+
async requestCapability(authInfo, agent) {
|
|
174
|
+
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
|
|
168
175
|
}
|
|
169
176
|
async permitCapability(auth) {
|
|
170
177
|
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
|
|
@@ -200,6 +207,18 @@ export class AgentClient {
|
|
|
200
207
|
async verifyEmailCode(email, code, verificationType) {
|
|
201
208
|
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
|
|
202
209
|
}
|
|
210
|
+
/** Revokes this client's user token. The executor then closes the client's sockets. */
|
|
211
|
+
async logout() {
|
|
212
|
+
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('user.logout', {});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Revokes every token of a user issued up to now, this client's own included, and closes
|
|
216
|
+
* their sockets. A user leaves out `email` (or names themselves); the operator names the
|
|
217
|
+
* user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
|
|
218
|
+
*/
|
|
219
|
+
async revokeAllSessions(email) {
|
|
220
|
+
return __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
|
|
221
|
+
}
|
|
203
222
|
// Hosting methods
|
|
204
223
|
async hostingUserInfo() {
|
|
205
224
|
const info = (await __classPrivateFieldGet(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
|
package/lib/src/ai/AITypes.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class ModelApi {
|
|
2
2
|
baseUrl: string;
|
|
3
|
-
|
|
3
|
+
/** Whether the model has a provider key. The executor never returns the key itself. */
|
|
4
|
+
hasApiKey: boolean;
|
|
4
5
|
model: string;
|
|
5
6
|
apiType: String;
|
|
6
7
|
/** Optional ceiling for the provider's context window (tokens).
|
|
@@ -28,7 +29,10 @@ export declare class Model {
|
|
|
28
29
|
}
|
|
29
30
|
export declare class ModelApiInput {
|
|
30
31
|
baseUrl: string;
|
|
31
|
-
|
|
32
|
+
/** The provider key. Empty or left out on `addModel`: no key. Left out on
|
|
33
|
+
* `updateModel`: the stored key stays, and the update is refused if `baseUrl`
|
|
34
|
+
* changes too. Empty on `updateModel`: the stored key is removed. */
|
|
35
|
+
apiKey?: string;
|
|
32
36
|
model: string;
|
|
33
37
|
apiType: string;
|
|
34
38
|
/** Optional ceiling for the provider's context window (tokens). */
|
package/lib/src/apiClient.js
CHANGED
|
@@ -98,7 +98,7 @@ export class ApiClient {
|
|
|
98
98
|
? new RpcError(401, event.reason || 'token expired or revoked')
|
|
99
99
|
: closedError(event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined));
|
|
100
100
|
if (event?.code === CLOSE_AUTH_FAILED && this._ws === ws) {
|
|
101
|
-
this._failAuth(event.reason || 'token expired or revoked');
|
|
101
|
+
this._failAuth(event.reason || 'Unauthorized access: the token expired or was revoked');
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
this._onClose(ws, event?.code === CLOSE_TRY_AGAIN_LATER ? event.reason : undefined);
|
|
@@ -3,5 +3,9 @@ export type Apps = {
|
|
|
3
3
|
auth: AuthInfo;
|
|
4
4
|
requestId: string;
|
|
5
5
|
revoked: boolean | null;
|
|
6
|
+
/**
|
|
7
|
+
* Always empty: the executor does not keep app tokens, and an app receives its token
|
|
8
|
+
* once, from `agent.generateJwt`. The field stays for clients that require it.
|
|
9
|
+
*/
|
|
6
10
|
token: string;
|
|
7
11
|
};
|
|
@@ -7,14 +7,13 @@ import type { AutoProcessorNeighbourhoodState } from "./AutoProcessorNeighbourho
|
|
|
7
7
|
import type { ExceptionOccurredEvent } from "./ExceptionOccurredEvent";
|
|
8
8
|
import type { FlowStateChangedEvent } from "./FlowStateChangedEvent";
|
|
9
9
|
import type { HostingUserInfo } from "./HostingUserInfo";
|
|
10
|
-
import type { MessageReceivedEvent } from "./MessageReceivedEvent";
|
|
11
10
|
import type { NeighbourhoodSignalFilter } from "./NeighbourhoodSignalFilter";
|
|
12
11
|
import type { NotificationTriggeredEvent } from "./NotificationTriggeredEvent";
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
12
|
+
import type { PerspectiveEvent } from "./PerspectiveEvent";
|
|
13
|
+
import type { PerspectiveLinkEvent } from "./PerspectiveLinkEvent";
|
|
14
|
+
import type { PerspectiveLinkUpdatedEvent } from "./PerspectiveLinkUpdatedEvent";
|
|
15
|
+
import type { PerspectiveRemovedEvent } from "./PerspectiveRemovedEvent";
|
|
16
16
|
import type { PerspectiveStateFilter } from "./PerspectiveStateFilter";
|
|
17
|
-
import type { PerspectiveWithOwner } from "./PerspectiveWithOwner";
|
|
18
17
|
import type { QuerySubscriptionUpdateEvent } from "./QuerySubscriptionUpdateEvent";
|
|
19
18
|
import type { SfuCallRenegotiationOffer } from "./SfuCallRenegotiationOffer";
|
|
20
19
|
import type { SfuDataMessage } from "./SfuDataMessage";
|
|
@@ -27,15 +26,14 @@ export interface EventMap {
|
|
|
27
26
|
"agent-updated": AgentUpdatedEvent;
|
|
28
27
|
"apps-changed": Apps;
|
|
29
28
|
"hosting-user-info-changed": HostingUserInfo;
|
|
30
|
-
"perspective-added":
|
|
31
|
-
"perspective-removed":
|
|
32
|
-
"perspective-updated":
|
|
29
|
+
"perspective-added": PerspectiveEvent;
|
|
30
|
+
"perspective-removed": PerspectiveRemovedEvent;
|
|
31
|
+
"perspective-updated": PerspectiveEvent;
|
|
33
32
|
"sync-state-change": PerspectiveStateFilter;
|
|
34
|
-
"link-added":
|
|
35
|
-
"link-removed":
|
|
36
|
-
"link-updated":
|
|
33
|
+
"link-added": PerspectiveLinkEvent;
|
|
34
|
+
"link-removed": PerspectiveLinkEvent;
|
|
35
|
+
"link-updated": PerspectiveLinkUpdatedEvent;
|
|
37
36
|
"signal": NeighbourhoodSignalFilter;
|
|
38
|
-
"message-received": MessageReceivedEvent;
|
|
39
37
|
"notification-triggered": NotificationTriggeredEvent;
|
|
40
38
|
"exception-occurred": ExceptionOccurredEvent;
|
|
41
39
|
"transcription-text": TranscriptionTextFilter;
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
export type FlowStateChangedEvent = {
|
|
12
12
|
perspectiveUuid: string;
|
|
13
13
|
/**
|
|
14
|
-
* The agent whose replica derived this
|
|
15
|
-
*
|
|
14
|
+
* The agent whose replica derived this: the event's only recipient when it
|
|
15
|
+
* may read the perspective. Otherwise only the operator gets the main
|
|
16
|
+
* agent's event, and nobody gets another agent's.
|
|
16
17
|
*/
|
|
17
18
|
agentDid: string;
|
|
18
19
|
instance: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { LocalModel } from "./LocalModel";
|
|
2
2
|
import type { ModelApi } from "./ModelApi";
|
|
3
3
|
import type { ModelType } from "./ModelType";
|
|
4
|
+
/**
|
|
5
|
+
* A model as RPC results show it. Its provider key never leaves the executor:
|
|
6
|
+
* `api.hasApiKey` says whether one is set.
|
|
7
|
+
*/
|
|
4
8
|
export type Model = {
|
|
5
9
|
id: string;
|
|
6
10
|
name: string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ModelApiType } from "./ModelApiType";
|
|
2
|
+
/**
|
|
3
|
+
* A remote model's endpoint as RPC results show it: whether a provider key is set,
|
|
4
|
+
* never the key.
|
|
5
|
+
*/
|
|
2
6
|
export type ModelApi = {
|
|
3
7
|
baseUrl: string;
|
|
4
|
-
|
|
8
|
+
hasApiKey: boolean;
|
|
5
9
|
model: string;
|
|
6
10
|
apiType: ModelApiType;
|
|
7
11
|
/**
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type ModelApiInput = {
|
|
2
2
|
baseUrl: string;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The provider key. An empty key stores no key, and so does `ai.addModel` without
|
|
5
|
+
* one. `ai.updateModel` without one keeps the stored key; it refuses the update if
|
|
6
|
+
* `baseUrl` changes too, because a key goes only to the endpoint it was set for.
|
|
7
|
+
* Never serialised back out.
|
|
8
|
+
*/
|
|
9
|
+
apiKey?: string;
|
|
4
10
|
model: string;
|
|
5
11
|
apiType: string;
|
|
6
12
|
/**
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A notification as RPC results and events show it: whether a webhook credential is
|
|
3
|
+
* set, never the credential.
|
|
4
|
+
*/
|
|
1
5
|
export type Notification = {
|
|
2
6
|
id: string;
|
|
3
7
|
granted: boolean;
|
|
@@ -8,7 +12,7 @@ export type Notification = {
|
|
|
8
12
|
trigger: string;
|
|
9
13
|
perspectiveIds: Array<string>;
|
|
10
14
|
webhookUrl: string;
|
|
11
|
-
|
|
15
|
+
hasWebhookAuth: boolean;
|
|
12
16
|
/**
|
|
13
17
|
* The owner's DID: a managed user's, or the main agent's.
|
|
14
18
|
*/
|
|
@@ -6,5 +6,9 @@ export type NotificationInput = {
|
|
|
6
6
|
trigger: string;
|
|
7
7
|
perspectiveIds: Array<string>;
|
|
8
8
|
webhookUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* Sent as the bearer credential to `webhookUrl`. Results and events say only
|
|
11
|
+
* whether one is set (`hasWebhookAuth`).
|
|
12
|
+
*/
|
|
9
13
|
webhookAuth: string;
|
|
10
14
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PerspectiveHandle } from "./PerspectiveHandle";
|
|
2
|
+
/**
|
|
3
|
+
* `perspective-added` / `perspective-updated`: one event to all of the perspective's owners.
|
|
4
|
+
*/
|
|
5
|
+
export type PerspectiveEvent = {
|
|
6
|
+
perspectiveUuid: string;
|
|
7
|
+
perspective: PerspectiveHandle;
|
|
8
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { DecoratedLinkExpression } from "./DecoratedLinkExpression";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `link-added` / `link-removed`: one event to all of the perspective's owners.
|
|
4
|
+
*/
|
|
5
|
+
export type PerspectiveLinkEvent = {
|
|
3
6
|
perspectiveUuid: string;
|
|
4
7
|
link: DecoratedLinkExpression;
|
|
5
|
-
owner: string;
|
|
6
8
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { DecoratedLinkExpression } from "./DecoratedLinkExpression";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `link-updated`: one event to all of the perspective's owners.
|
|
4
|
+
*/
|
|
5
|
+
export type PerspectiveLinkUpdatedEvent = {
|
|
3
6
|
perspectiveUuid: string;
|
|
4
7
|
newLink: DecoratedLinkExpression;
|
|
5
8
|
oldLink: DecoratedLinkExpression;
|
|
6
|
-
owner: string;
|
|
7
9
|
};
|
|
@@ -172,6 +172,7 @@ import type { UsersEmailTestParams } from "./UsersEmailTestParams";
|
|
|
172
172
|
import type { UsersEmailTestResult } from "./UsersEmailTestResult";
|
|
173
173
|
import type { UsersLoginParams } from "./UsersLoginParams";
|
|
174
174
|
import type { UsersRequestVerificationParams } from "./UsersRequestVerificationParams";
|
|
175
|
+
import type { UsersRevokeAllSessionsParams } from "./UsersRevokeAllSessionsParams";
|
|
175
176
|
import type { UsersSetCreditsParams } from "./UsersSetCreditsParams";
|
|
176
177
|
import type { UsersVerifyEmailParams } from "./UsersVerifyEmailParams";
|
|
177
178
|
import type { ValidOutput } from "./ValidOutput";
|
|
@@ -743,7 +744,7 @@ export interface RpcMethods {
|
|
|
743
744
|
};
|
|
744
745
|
"runtime.linkLanguageTemplates": {
|
|
745
746
|
params: Record<string, never>;
|
|
746
|
-
result: Array<
|
|
747
|
+
result: Array<LanguageMeta>;
|
|
747
748
|
};
|
|
748
749
|
"runtime.networkMetrics": {
|
|
749
750
|
params: Record<string, never>;
|
|
@@ -933,6 +934,10 @@ export interface RpcMethods {
|
|
|
933
934
|
params: UsersLoginParams;
|
|
934
935
|
result: string;
|
|
935
936
|
};
|
|
937
|
+
"user.logout": {
|
|
938
|
+
params: Record<string, never>;
|
|
939
|
+
result: boolean;
|
|
940
|
+
};
|
|
936
941
|
"user.multiUserEnabled": {
|
|
937
942
|
params: Record<string, never>;
|
|
938
943
|
result: boolean;
|
|
@@ -941,6 +946,10 @@ export interface RpcMethods {
|
|
|
941
946
|
params: UsersRequestVerificationParams;
|
|
942
947
|
result: VerificationRequestResult;
|
|
943
948
|
};
|
|
949
|
+
"user.revokeAllSessions": {
|
|
950
|
+
params: UsersRevokeAllSessionsParams;
|
|
951
|
+
result: boolean;
|
|
952
|
+
};
|
|
944
953
|
"user.setMultiUserEnabled": {
|
|
945
954
|
params: SetMultiUserRequest;
|
|
946
955
|
result: boolean;
|
|
@@ -7,5 +7,10 @@ export type RuntimeUpdateNotificationParams = {
|
|
|
7
7
|
trigger: string;
|
|
8
8
|
perspectiveIds: Array<string>;
|
|
9
9
|
webhookUrl: string;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Without it the update keeps the stored credential, and fails if `webhookUrl`
|
|
12
|
+
* changes too, because a credential goes only to the webhook it was set for. An empty
|
|
13
|
+
* string clears it.
|
|
14
|
+
*/
|
|
15
|
+
webhookAuth?: string;
|
|
11
16
|
};
|
|
@@ -116,13 +116,13 @@ export function hintFor(msg) {
|
|
|
116
116
|
// "Executor is locked" is the current executor's message; "main key not
|
|
117
117
|
// found" is what older executors (and unrelated key lookups) say for the
|
|
118
118
|
// same locked state. Either way the caller cannot fix it themselves: keys
|
|
119
|
-
// live in memory only, so every restart locks the
|
|
119
|
+
// live in memory only, so every restart locks the executor again and only its
|
|
120
120
|
// operator can unlock it.
|
|
121
121
|
if (/executor is locked/i.test(msg) || /main key not found/i.test(msg)) {
|
|
122
|
-
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the
|
|
122
|
+
return " — the executor is locked (its keys live in memory only, so every restart locks it again). Only the executor's operator can unlock it: contact them and ask for unlockAgent, then subscribe again — a pending subscription re-attempts on its own once the executor is unlocked";
|
|
123
123
|
}
|
|
124
124
|
if (/timed out after \d+ms/i.test(msg)) {
|
|
125
|
-
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the
|
|
125
|
+
return " — the executor accepted the waker's connection but never answered; check that the waker is pointed at the right executor host and API port (executorUrl in the plugin config) and that the executor is unlocked";
|
|
126
126
|
}
|
|
127
127
|
return "";
|
|
128
128
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ApiClient, CallOptions } from '../apiClient';
|
|
2
2
|
import { Perspective, PerspectiveExpression } from "../perspectives/Perspective";
|
|
3
|
-
import { RuntimeInfo, SentMessage, NotificationInput, Notification, ImportResult, UserStatistics } from "./RuntimeTypes";
|
|
3
|
+
import { RuntimeInfo, SentMessage, NotificationInput, NotificationUpdate, Notification, ImportResult, UserStatistics } from "./RuntimeTypes";
|
|
4
4
|
import type { HostRate, UnytVersionInfo } from "../generated/api";
|
|
5
|
+
import { LanguageMeta } from "../language/LanguageMeta";
|
|
5
6
|
export declare class RuntimeClient {
|
|
6
7
|
#private;
|
|
7
8
|
constructor(baseUrl: string, token?: string, sharedApiClient?: ApiClient);
|
|
@@ -14,7 +15,9 @@ export declare class RuntimeClient {
|
|
|
14
15
|
getTrustedAgents(): Promise<string[]>;
|
|
15
16
|
addKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]>;
|
|
16
17
|
removeKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]>;
|
|
17
|
-
|
|
18
|
+
/** Every link-language template the executor knows, with its meta (name, description,
|
|
19
|
+
* `possibleTemplateParams`). A template whose meta cannot be read is left out. */
|
|
20
|
+
knownLinkLanguageTemplates(): Promise<LanguageMeta[]>;
|
|
18
21
|
addFriends(dids: string[]): Promise<string[]>;
|
|
19
22
|
removeFriends(dids: string[]): Promise<string[]>;
|
|
20
23
|
friends(): Promise<string[]>;
|
|
@@ -33,7 +36,7 @@ export declare class RuntimeClient {
|
|
|
33
36
|
exportDb(filePath: string): Promise<boolean>;
|
|
34
37
|
importDb(filePath: string): Promise<ImportResult>;
|
|
35
38
|
notifications(): Promise<Notification[]>;
|
|
36
|
-
updateNotification(id: string, notification:
|
|
39
|
+
updateNotification(id: string, notification: NotificationUpdate): Promise<boolean>;
|
|
37
40
|
removeNotification(id: string): Promise<boolean>;
|
|
38
41
|
exportPerspective(uuid: string, filePath: string): Promise<boolean>;
|
|
39
42
|
importPerspective(filePath: string): Promise<boolean>;
|
|
@@ -44,6 +44,8 @@ export class RuntimeClient {
|
|
|
44
44
|
async removeKnownLinkLanguageTemplates(addresses) {
|
|
45
45
|
return __classPrivateFieldGet(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
|
|
46
46
|
}
|
|
47
|
+
/** Every link-language template the executor knows, with its meta (name, description,
|
|
48
|
+
* `possibleTemplateParams`). A template whose meta cannot be read is left out. */
|
|
47
49
|
async knownLinkLanguageTemplates() {
|
|
48
50
|
return __classPrivateFieldGet(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
|
|
49
51
|
}
|
|
@@ -27,6 +27,9 @@ export declare class NotificationInput {
|
|
|
27
27
|
webhookUrl: string;
|
|
28
28
|
webhookAuth: string;
|
|
29
29
|
}
|
|
30
|
+
export type NotificationUpdate = Omit<NotificationInput, 'webhookAuth'> & {
|
|
31
|
+
webhookAuth?: string;
|
|
32
|
+
};
|
|
30
33
|
export declare class Notification {
|
|
31
34
|
id: string;
|
|
32
35
|
granted: boolean;
|
|
@@ -37,7 +40,8 @@ export declare class Notification {
|
|
|
37
40
|
trigger: string;
|
|
38
41
|
perspectiveIds: string[];
|
|
39
42
|
webhookUrl: string;
|
|
40
|
-
|
|
43
|
+
hasWebhookAuth: boolean;
|
|
44
|
+
ownerDid: string;
|
|
41
45
|
}
|
|
42
46
|
export declare class TriggeredNotification {
|
|
43
47
|
notification: Notification;
|
package/package.json
CHANGED
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"ws": "8.13.0"
|
|
54
54
|
},
|
|
55
55
|
"patchedDependencies": {},
|
|
56
|
-
"version": "0.13.1-staging.
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"version": "0.13.1-staging.4",
|
|
57
|
+
"gitHead": "e5b5e7c4b565c7d7bdafe6913c1e15ac4428de99",
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "patch-package && tsc && pnpm run bundle",
|
|
60
60
|
"bundle": "rollup -c rollup.config.js",
|