@holokai/harbor-sdk 0.6.0 → 0.7.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/dist/build-inputs.json +3 -3
- package/dist/runtime.d.ts +37 -1
- package/dist/runtime.js +4 -0
- package/package.json +1 -1
package/dist/build-inputs.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@holokai/harbor-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"digest": "
|
|
5
|
-
"commit": "
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"digest": "8d223c581375c32f0101c6872e3ca430f01471a03af9b5b69760ffdb7c1789df",
|
|
5
|
+
"commit": "5702055131a3a386352bb78adc3bb969bdff41c8"
|
|
6
6
|
}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export declare const EXTENSIONS_ENV: {
|
|
|
25
25
|
readonly enabled: "EXTENSIONS_ENABLED";
|
|
26
26
|
/** Comma-separated names of the settings whose value came from Moku rather than harbor's environment. */
|
|
27
27
|
readonly fromMoku: "EXTENSIONS_SETTINGS_FROM_MOKU";
|
|
28
|
+
/** Comma-separated names of the settings Moku holds and trades with; the server never receives their values. */
|
|
29
|
+
readonly brokeredByMoku: "EXTENSIONS_SETTINGS_BROKERED_BY_MOKU";
|
|
28
30
|
/** The sign-in return address the providers are given; absent means this server's own `/auth/callback`. */
|
|
29
31
|
readonly callbackAddress: "EXTENSIONS_CALLBACK_ADDRESS";
|
|
30
32
|
/** The connection this server runs for; `/health` names it, so harbor takes an answer only from its own child. */
|
|
@@ -37,7 +39,8 @@ export declare const EXTENSIONS_ENV: {
|
|
|
37
39
|
/**
|
|
38
40
|
* The messages on Node's IPC channel between harbor and an extensions server it started:
|
|
39
41
|
* `catalog_loaded`, `tools_changed`, `page_notification`, `saved_sign_in`, `extension_state` and
|
|
40
|
-
* `provider_account` from the server, `saved_sign_in_answer
|
|
42
|
+
* `provider_account` and `token_trade` from the server, `saved_sign_in_answer`, `extension_state_answer` and
|
|
43
|
+
* `token_trade_answer` back from harbor.
|
|
41
44
|
*/
|
|
42
45
|
export declare const EXTENSIONS_MESSAGE: {
|
|
43
46
|
readonly toolsChanged: "tools_changed";
|
|
@@ -47,6 +50,8 @@ export declare const EXTENSIONS_MESSAGE: {
|
|
|
47
50
|
readonly extensionState: "extension_state";
|
|
48
51
|
readonly extensionStateAnswer: "extension_state_answer";
|
|
49
52
|
readonly providerAccount: "provider_account";
|
|
53
|
+
readonly tokenTrade: "token_trade";
|
|
54
|
+
readonly tokenTradeAnswer: "token_trade_answer";
|
|
50
55
|
readonly catalogLoaded: "catalog_loaded";
|
|
51
56
|
};
|
|
52
57
|
/**
|
|
@@ -193,6 +198,37 @@ export interface ProviderAccountMessage {
|
|
|
193
198
|
account: string | null;
|
|
194
199
|
reason: 'restored' | 'signed_in' | 'signed_out';
|
|
195
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* The server asks harbor to trade one OAuth grant at the vendor's token endpoint through Moku, which holds the
|
|
203
|
+
* client secret. The provider is never named here: harbor knows the connection the request came through.
|
|
204
|
+
*/
|
|
205
|
+
export interface TokenTradeRequest {
|
|
206
|
+
type: typeof EXTENSIONS_MESSAGE.tokenTrade;
|
|
207
|
+
/** The server's own, unique among its requests still waiting for an answer. */
|
|
208
|
+
id: string;
|
|
209
|
+
grantType: 'authorization_code' | 'refresh_token';
|
|
210
|
+
code?: string;
|
|
211
|
+
codeVerifier?: string;
|
|
212
|
+
redirectUri?: string;
|
|
213
|
+
refreshToken?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Harbor's answer to one trade: the vendor's status, body and content type, when it named one, as Moku passed them back. `refused` is a request
|
|
217
|
+
* harbor does not take; `failed` is a trade that did not reach the vendor.
|
|
218
|
+
*/
|
|
219
|
+
export type TokenTradeAnswer = {
|
|
220
|
+
type: typeof EXTENSIONS_MESSAGE.tokenTradeAnswer;
|
|
221
|
+
id: string;
|
|
222
|
+
ok: true;
|
|
223
|
+
status: number;
|
|
224
|
+
body: string;
|
|
225
|
+
contentType?: string;
|
|
226
|
+
} | {
|
|
227
|
+
type: typeof EXTENSIONS_MESSAGE.tokenTradeAnswer;
|
|
228
|
+
id: string;
|
|
229
|
+
ok: false;
|
|
230
|
+
reason: 'refused' | 'failed';
|
|
231
|
+
};
|
|
196
232
|
/**
|
|
197
233
|
* The JSON Schema keyword that marks a tool input as a local file: a property
|
|
198
234
|
* carrying it, or an array whose items carry it. The AI fills it with a path
|
package/dist/runtime.js
CHANGED
|
@@ -12,6 +12,8 @@ var EXTENSIONS_ENV = {
|
|
|
12
12
|
enabled: "EXTENSIONS_ENABLED",
|
|
13
13
|
/** Comma-separated names of the settings whose value came from Moku rather than harbor's environment. */
|
|
14
14
|
fromMoku: "EXTENSIONS_SETTINGS_FROM_MOKU",
|
|
15
|
+
/** Comma-separated names of the settings Moku holds and trades with; the server never receives their values. */
|
|
16
|
+
brokeredByMoku: "EXTENSIONS_SETTINGS_BROKERED_BY_MOKU",
|
|
15
17
|
/** The sign-in return address the providers are given; absent means this server's own `/auth/callback`. */
|
|
16
18
|
callbackAddress: "EXTENSIONS_CALLBACK_ADDRESS",
|
|
17
19
|
/** The connection this server runs for; `/health` names it, so harbor takes an answer only from its own child. */
|
|
@@ -29,6 +31,8 @@ var EXTENSIONS_MESSAGE = {
|
|
|
29
31
|
extensionState: "extension_state",
|
|
30
32
|
extensionStateAnswer: "extension_state_answer",
|
|
31
33
|
providerAccount: "provider_account",
|
|
34
|
+
tokenTrade: "token_trade",
|
|
35
|
+
tokenTradeAnswer: "token_trade_answer",
|
|
32
36
|
catalogLoaded: "catalog_loaded"
|
|
33
37
|
};
|
|
34
38
|
var PAGE_NOTIFICATION_NAME = /^[a-z][a-z0-9_.-]{0,63}$/;
|
package/package.json
CHANGED