@sealant/sdk-next 0.40.0-next.813 → 0.40.0-next.815
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/client.js +8 -1
- package/dist/effect/api-client.d.ts +40 -2
- package/dist/effect/operations.d.ts +16 -1
- package/dist/errors.d.ts +5 -1
- package/dist/errors.js +6 -0
- package/dist/facade/workspace.js +1 -0
- package/dist/internal/features.d.ts +2 -0
- package/dist/internal/features.js +14 -0
- package/dist/internal/inference.js +2 -0
- package/dist/internal/map-error.js +15 -0
- package/dist/types.d.ts +41 -3
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -7,7 +7,7 @@ import { makeWorkspace, registerHarnessExecutors, toRuntimeInfo, toWorkspaceImag
|
|
|
7
7
|
import { buildCreateWorkspaceRequest } from "./internal/blueprint.js";
|
|
8
8
|
import { resolveInternalConfig } from "./internal/config.js";
|
|
9
9
|
import { parseTtlSeconds } from "./internal/duration.js";
|
|
10
|
-
import { readFeatures, requireConnectedAccountDefaults, requireConnectedAccountLoginClass, } from "./internal/features.js";
|
|
10
|
+
import { readFeatures, requireConnectedAccountDefaults, requireConnectedAccountEndpoints, requireConnectedAccountLoginClass, requireInferenceAllowedLogin, } from "./internal/features.js";
|
|
11
11
|
import { imageSpecKey } from "./internal/image-key.js";
|
|
12
12
|
import { buildInferenceRespondRequest, mapInferenceResponse } from "./internal/inference.js";
|
|
13
13
|
import { requireSshUser } from "./internal/process-user.js";
|
|
@@ -217,6 +217,9 @@ export class Sealant {
|
|
|
217
217
|
*/
|
|
218
218
|
inference = {
|
|
219
219
|
respond: async (options) => {
|
|
220
|
+
if ("allowedLogin" in options && options.allowedLogin === "subscription") {
|
|
221
|
+
await requireInferenceAllowedLogin(this.#ctx);
|
|
222
|
+
}
|
|
220
223
|
const payload = buildInferenceRespondRequest(options, this.#ctx.config.hostLocal.ownerUserId);
|
|
221
224
|
const wire = await this.#runtime.run(inferenceRespondOp(payload));
|
|
222
225
|
return mapInferenceResponse(wire);
|
|
@@ -273,6 +276,9 @@ export class Sealant {
|
|
|
273
276
|
if (options.login !== undefined) {
|
|
274
277
|
await requireConnectedAccountLoginClass(this.#ctx);
|
|
275
278
|
}
|
|
279
|
+
if (options.endpoint !== undefined) {
|
|
280
|
+
await requireConnectedAccountEndpoints(this.#ctx);
|
|
281
|
+
}
|
|
276
282
|
const wire = await this.#runtime.run(createConnectedAccountOp({
|
|
277
283
|
ownerUserId: this.#ctx.config.hostLocal.ownerUserId,
|
|
278
284
|
provider: options.provider,
|
|
@@ -281,6 +287,7 @@ export class Sealant {
|
|
|
281
287
|
...(options.accountId === undefined ? {} : { accountId: options.accountId }),
|
|
282
288
|
...(options.makeDefault === undefined ? {} : { makeDefault: options.makeDefault }),
|
|
283
289
|
...(options.login === undefined ? {} : { login: options.login }),
|
|
290
|
+
...(options.endpoint === undefined ? {} : { endpoint: options.endpoint }),
|
|
284
291
|
}));
|
|
285
292
|
return mapConnectedAccount(wire);
|
|
286
293
|
},
|
|
@@ -84,6 +84,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
84
84
|
}>, import("effect/Schema").Struct<{
|
|
85
85
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
86
86
|
readonly suffix: import("effect/Schema").String;
|
|
87
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
87
88
|
}>]>>;
|
|
88
89
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
89
90
|
readonly createConnectedAccount: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"createConnectedAccount", "POST", "/v1/connected-accounts/", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -94,6 +95,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
94
95
|
readonly makeDefault: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
95
96
|
readonly login: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["subscription", "api-key"]>>;
|
|
96
97
|
readonly secret: import("effect/Schema").String;
|
|
98
|
+
readonly endpoint: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
97
99
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
98
100
|
readonly connectedAccountId: import("effect/Schema").String;
|
|
99
101
|
readonly ownerUserId: import("effect/Schema").String;
|
|
@@ -119,6 +121,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
119
121
|
}>, import("effect/Schema").Struct<{
|
|
120
122
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
121
123
|
readonly suffix: import("effect/Schema").String;
|
|
124
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
122
125
|
}>]>>;
|
|
123
126
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountBadRequestError | typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountConflictError | typeof import("@sealant/api-contracts").ConnectedAccountServiceUnavailableError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
124
127
|
readonly listConnectedAccounts: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listConnectedAccounts", "GET", "/v1/connected-accounts/", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
@@ -149,6 +152,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
149
152
|
}>, import("effect/Schema").Struct<{
|
|
150
153
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
151
154
|
readonly suffix: import("effect/Schema").String;
|
|
155
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
152
156
|
}>]>>;
|
|
153
157
|
}>>;
|
|
154
158
|
readonly hasApiKeyHistory: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
@@ -183,6 +187,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
183
187
|
}>, import("effect/Schema").Struct<{
|
|
184
188
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
185
189
|
readonly suffix: import("effect/Schema").String;
|
|
190
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
186
191
|
}>]>>;
|
|
187
192
|
readonly outcome: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["marked", "superseded"]>>;
|
|
188
193
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
@@ -216,6 +221,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
216
221
|
}>, import("effect/Schema").Struct<{
|
|
217
222
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
218
223
|
readonly suffix: import("effect/Schema").String;
|
|
224
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
219
225
|
}>]>>;
|
|
220
226
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountConflictError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
221
227
|
};
|
|
@@ -308,6 +314,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
308
314
|
readonly type: import("effect/Schema").Literal<"json">;
|
|
309
315
|
readonly schema: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
310
316
|
}>>;
|
|
317
|
+
readonly allowedLogin: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["subscription", "any"]>>;
|
|
311
318
|
readonly sessionId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
312
319
|
readonly toolResults: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
313
320
|
readonly toolCallId: import("effect/Schema").String;
|
|
@@ -332,7 +339,12 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
332
339
|
readonly inputTokens: import("effect/Schema").Number;
|
|
333
340
|
readonly outputTokens: import("effect/Schema").Number;
|
|
334
341
|
}>>;
|
|
335
|
-
|
|
342
|
+
readonly receipt: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
343
|
+
readonly accountId: import("effect/Schema").String;
|
|
344
|
+
readonly revision: import("effect/Schema").Number;
|
|
345
|
+
readonly login: import("effect/Schema").Literals<readonly ["subscription", "api-key"]>;
|
|
346
|
+
}>>;
|
|
347
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").InferenceBudgetExceededError | typeof import("@sealant/api-contracts").InferenceBadRequestError | typeof import("@sealant/api-contracts").InferenceNotFoundError | typeof import("@sealant/api-contracts").InferenceConflictError | typeof import("@sealant/api-contracts").InferenceUnavailableError | typeof import("@sealant/api-contracts").InferenceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
336
348
|
};
|
|
337
349
|
readonly packages: {
|
|
338
350
|
readonly resolvePackage: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"resolvePackage", "GET", "/v1/packages/resolve", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
@@ -421,6 +433,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
421
433
|
}>, import("effect/Schema").Struct<{
|
|
422
434
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
423
435
|
readonly suffix: import("effect/Schema").String;
|
|
436
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
424
437
|
}>]>>;
|
|
425
438
|
}>;
|
|
426
439
|
}>>;
|
|
@@ -476,6 +489,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
476
489
|
}>, import("effect/Schema").Struct<{
|
|
477
490
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
478
491
|
readonly suffix: import("effect/Schema").String;
|
|
492
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
479
493
|
}>]>>;
|
|
480
494
|
}>;
|
|
481
495
|
}>>;
|
|
@@ -1496,6 +1510,8 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
1496
1510
|
readonly kubernetesPersonLayout: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1497
1511
|
readonly credentialPlacements: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1498
1512
|
readonly connectedAccountApiKeys: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1513
|
+
readonly connectedAccountEndpoints: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1514
|
+
readonly inferenceAllowedLogin: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1499
1515
|
}>>;
|
|
1500
1516
|
}>>, never, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
1501
1517
|
readonly getSetupState: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"getSetupState", "GET", "/v1/system/setup-state", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -2313,6 +2329,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
2313
2329
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2314
2330
|
readonly suffix: import("effect/Schema").String;
|
|
2315
2331
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2332
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
2316
2333
|
}>]>;
|
|
2317
2334
|
readonly pinned: import("effect/Schema").Boolean;
|
|
2318
2335
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -2488,6 +2505,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
2488
2505
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2489
2506
|
readonly suffix: import("effect/Schema").String;
|
|
2490
2507
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2508
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
2491
2509
|
}>]>;
|
|
2492
2510
|
readonly pinned: import("effect/Schema").Boolean;
|
|
2493
2511
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -2547,6 +2565,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
2547
2565
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2548
2566
|
readonly suffix: import("effect/Schema").String;
|
|
2549
2567
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2568
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
2550
2569
|
}>]>;
|
|
2551
2570
|
readonly pinned: import("effect/Schema").Boolean;
|
|
2552
2571
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -2753,6 +2772,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2753
2772
|
}>, import("effect/Schema").Struct<{
|
|
2754
2773
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2755
2774
|
readonly suffix: import("effect/Schema").String;
|
|
2775
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2756
2776
|
}>]>>;
|
|
2757
2777
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
2758
2778
|
readonly createConnectedAccount: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"createConnectedAccount", "POST", "/v1/connected-accounts/", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -2763,6 +2783,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2763
2783
|
readonly makeDefault: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
2764
2784
|
readonly login: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["subscription", "api-key"]>>;
|
|
2765
2785
|
readonly secret: import("effect/Schema").String;
|
|
2786
|
+
readonly endpoint: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2766
2787
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2767
2788
|
readonly connectedAccountId: import("effect/Schema").String;
|
|
2768
2789
|
readonly ownerUserId: import("effect/Schema").String;
|
|
@@ -2788,6 +2809,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2788
2809
|
}>, import("effect/Schema").Struct<{
|
|
2789
2810
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2790
2811
|
readonly suffix: import("effect/Schema").String;
|
|
2812
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2791
2813
|
}>]>>;
|
|
2792
2814
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountBadRequestError | typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountConflictError | typeof import("@sealant/api-contracts").ConnectedAccountServiceUnavailableError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
2793
2815
|
readonly listConnectedAccounts: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listConnectedAccounts", "GET", "/v1/connected-accounts/", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
@@ -2818,6 +2840,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2818
2840
|
}>, import("effect/Schema").Struct<{
|
|
2819
2841
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2820
2842
|
readonly suffix: import("effect/Schema").String;
|
|
2843
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2821
2844
|
}>]>>;
|
|
2822
2845
|
}>>;
|
|
2823
2846
|
readonly hasApiKeyHistory: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
@@ -2852,6 +2875,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2852
2875
|
}>, import("effect/Schema").Struct<{
|
|
2853
2876
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2854
2877
|
readonly suffix: import("effect/Schema").String;
|
|
2878
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2855
2879
|
}>]>>;
|
|
2856
2880
|
readonly outcome: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["marked", "superseded"]>>;
|
|
2857
2881
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
@@ -2885,6 +2909,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2885
2909
|
}>, import("effect/Schema").Struct<{
|
|
2886
2910
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
2887
2911
|
readonly suffix: import("effect/Schema").String;
|
|
2912
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2888
2913
|
}>]>>;
|
|
2889
2914
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ConnectedAccountNotFoundError | typeof import("@sealant/api-contracts").ConnectedAccountConflictError | typeof import("@sealant/api-contracts").ConnectedAccountInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
2890
2915
|
};
|
|
@@ -2977,6 +3002,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
2977
3002
|
readonly type: import("effect/Schema").Literal<"json">;
|
|
2978
3003
|
readonly schema: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
2979
3004
|
}>>;
|
|
3005
|
+
readonly allowedLogin: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["subscription", "any"]>>;
|
|
2980
3006
|
readonly sessionId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2981
3007
|
readonly toolResults: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
2982
3008
|
readonly toolCallId: import("effect/Schema").String;
|
|
@@ -3001,7 +3027,12 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
3001
3027
|
readonly inputTokens: import("effect/Schema").Number;
|
|
3002
3028
|
readonly outputTokens: import("effect/Schema").Number;
|
|
3003
3029
|
}>>;
|
|
3004
|
-
|
|
3030
|
+
readonly receipt: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
3031
|
+
readonly accountId: import("effect/Schema").String;
|
|
3032
|
+
readonly revision: import("effect/Schema").Number;
|
|
3033
|
+
readonly login: import("effect/Schema").Literals<readonly ["subscription", "api-key"]>;
|
|
3034
|
+
}>>;
|
|
3035
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").InferenceBudgetExceededError | typeof import("@sealant/api-contracts").InferenceBadRequestError | typeof import("@sealant/api-contracts").InferenceNotFoundError | typeof import("@sealant/api-contracts").InferenceConflictError | typeof import("@sealant/api-contracts").InferenceUnavailableError | typeof import("@sealant/api-contracts").InferenceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
3005
3036
|
};
|
|
3006
3037
|
readonly packages: {
|
|
3007
3038
|
readonly resolvePackage: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"resolvePackage", "GET", "/v1/packages/resolve", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
@@ -3090,6 +3121,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
3090
3121
|
}>, import("effect/Schema").Struct<{
|
|
3091
3122
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
3092
3123
|
readonly suffix: import("effect/Schema").String;
|
|
3124
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3093
3125
|
}>]>>;
|
|
3094
3126
|
}>;
|
|
3095
3127
|
}>>;
|
|
@@ -3145,6 +3177,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
3145
3177
|
}>, import("effect/Schema").Struct<{
|
|
3146
3178
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
3147
3179
|
readonly suffix: import("effect/Schema").String;
|
|
3180
|
+
readonly endpointHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3148
3181
|
}>]>>;
|
|
3149
3182
|
}>;
|
|
3150
3183
|
}>>;
|
|
@@ -4165,6 +4198,8 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
4165
4198
|
readonly kubernetesPersonLayout: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4166
4199
|
readonly credentialPlacements: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4167
4200
|
readonly connectedAccountApiKeys: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4201
|
+
readonly connectedAccountEndpoints: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4202
|
+
readonly inferenceAllowedLogin: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4168
4203
|
}>>;
|
|
4169
4204
|
}>>, never, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
4170
4205
|
readonly getSetupState: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"getSetupState", "GET", "/v1/system/setup-state", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -4982,6 +5017,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
4982
5017
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
4983
5018
|
readonly suffix: import("effect/Schema").String;
|
|
4984
5019
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
5020
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
4985
5021
|
}>]>;
|
|
4986
5022
|
readonly pinned: import("effect/Schema").Boolean;
|
|
4987
5023
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -5157,6 +5193,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
5157
5193
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
5158
5194
|
readonly suffix: import("effect/Schema").String;
|
|
5159
5195
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
5196
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
5160
5197
|
}>]>;
|
|
5161
5198
|
readonly pinned: import("effect/Schema").Boolean;
|
|
5162
5199
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -5216,6 +5253,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
5216
5253
|
readonly kind: import("effect/Schema").Literal<"api-key">;
|
|
5217
5254
|
readonly suffix: import("effect/Schema").String;
|
|
5218
5255
|
readonly keyPath: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
5256
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").String>, import("effect/Schema").String, never, never>, "EndpointUrl">>;
|
|
5219
5257
|
}>]>;
|
|
5220
5258
|
readonly pinned: import("effect/Schema").Boolean;
|
|
5221
5259
|
readonly provider: import("effect/Schema").Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -663,6 +663,7 @@ export declare const putWorkspaceCredentialsOp: (workspaceId: string, payload: P
|
|
|
663
663
|
readonly kind: "api-key";
|
|
664
664
|
readonly suffix: string;
|
|
665
665
|
readonly keyPath?: string | undefined;
|
|
666
|
+
readonly baseUrl?: (string & import("effect/Brand").Brand<"EndpointUrl">) | undefined;
|
|
666
667
|
};
|
|
667
668
|
readonly pinned: boolean;
|
|
668
669
|
readonly provider: "claude" | "codex" | "github" | "opencode" | "pi";
|
|
@@ -713,6 +714,7 @@ export declare const pruneWorkspaceCredentialsOp: (workspaceId: string, payload:
|
|
|
713
714
|
readonly kind: "api-key";
|
|
714
715
|
readonly suffix: string;
|
|
715
716
|
readonly keyPath?: string | undefined;
|
|
717
|
+
readonly baseUrl?: (string & import("effect/Brand").Brand<"EndpointUrl">) | undefined;
|
|
716
718
|
};
|
|
717
719
|
readonly pinned: boolean;
|
|
718
720
|
readonly provider: "claude" | "codex" | "github" | "opencode" | "pi";
|
|
@@ -763,6 +765,7 @@ export declare const listWorkspaceCredentialsOp: (workspaceId: string, query: Li
|
|
|
763
765
|
readonly kind: "api-key";
|
|
764
766
|
readonly suffix: string;
|
|
765
767
|
readonly keyPath?: string | undefined;
|
|
768
|
+
readonly baseUrl?: (string & import("effect/Brand").Brand<"EndpointUrl">) | undefined;
|
|
766
769
|
};
|
|
767
770
|
readonly pinned: boolean;
|
|
768
771
|
readonly provider: "claude" | "codex" | "github" | "opencode" | "pi";
|
|
@@ -1152,6 +1155,7 @@ export declare const listConnectedAccountsOp: (ownerUserId: string) => Effect.Ef
|
|
|
1152
1155
|
} | {
|
|
1153
1156
|
readonly kind: "api-key";
|
|
1154
1157
|
readonly suffix: string;
|
|
1158
|
+
readonly endpointHost?: string | undefined;
|
|
1155
1159
|
} | undefined;
|
|
1156
1160
|
}[];
|
|
1157
1161
|
readonly hasApiKeyHistory?: boolean | undefined;
|
|
@@ -1183,6 +1187,7 @@ export declare const createConnectedAccountOp: (payload: CreateConnectedAccountR
|
|
|
1183
1187
|
} | {
|
|
1184
1188
|
readonly kind: "api-key";
|
|
1185
1189
|
readonly suffix: string;
|
|
1190
|
+
readonly endpointHost?: string | undefined;
|
|
1186
1191
|
} | undefined;
|
|
1187
1192
|
}, import("@sealant/api-contracts").BudgetExceededError | import("@sealant/api-contracts").ConnectedAccountBadRequestError | import("@sealant/api-contracts").ConnectedAccountConflictError | import("@sealant/api-contracts").ConnectedAccountInternalServerError | import("@sealant/api-contracts").ConnectedAccountNotFoundError | import("@sealant/api-contracts").ConnectedAccountServiceUnavailableError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
1188
1193
|
export declare const archiveConnectedAccountOp: (connectedAccountId: string, ownerUserId: string) => Effect.Effect<{
|
|
@@ -1212,6 +1217,7 @@ export declare const archiveConnectedAccountOp: (connectedAccountId: string, own
|
|
|
1212
1217
|
} | {
|
|
1213
1218
|
readonly kind: "api-key";
|
|
1214
1219
|
readonly suffix: string;
|
|
1220
|
+
readonly endpointHost?: string | undefined;
|
|
1215
1221
|
} | undefined;
|
|
1216
1222
|
}, import("@sealant/api-contracts").BudgetExceededError | import("@sealant/api-contracts").ConnectedAccountInternalServerError | import("@sealant/api-contracts").ConnectedAccountNotFoundError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
1217
1223
|
export declare const setConnectedAccountDefaultOp: (provider: ConnectedAccountProvider, payload: SetConnectedAccountDefaultRequest) => Effect.Effect<{
|
|
@@ -1241,6 +1247,7 @@ export declare const setConnectedAccountDefaultOp: (provider: ConnectedAccountPr
|
|
|
1241
1247
|
} | {
|
|
1242
1248
|
readonly kind: "api-key";
|
|
1243
1249
|
readonly suffix: string;
|
|
1250
|
+
readonly endpointHost?: string | undefined;
|
|
1244
1251
|
} | undefined;
|
|
1245
1252
|
}, import("@sealant/api-contracts").BudgetExceededError | import("@sealant/api-contracts").ConnectedAccountConflictError | import("@sealant/api-contracts").ConnectedAccountInternalServerError | import("@sealant/api-contracts").ConnectedAccountNotFoundError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
1246
1253
|
export declare const markConnectedAccountInvalidOp: (connectedAccountId: string, payload: MarkConnectedAccountInvalidRequest) => Effect.Effect<{
|
|
@@ -1270,6 +1277,7 @@ export declare const markConnectedAccountInvalidOp: (connectedAccountId: string,
|
|
|
1270
1277
|
} | {
|
|
1271
1278
|
readonly kind: "api-key";
|
|
1272
1279
|
readonly suffix: string;
|
|
1280
|
+
readonly endpointHost?: string | undefined;
|
|
1273
1281
|
} | undefined;
|
|
1274
1282
|
readonly outcome?: "marked" | "superseded" | undefined;
|
|
1275
1283
|
}, import("@sealant/api-contracts").BudgetExceededError | import("@sealant/api-contracts").ConnectedAccountInternalServerError | import("@sealant/api-contracts").ConnectedAccountNotFoundError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
@@ -1291,7 +1299,12 @@ export declare const inferenceRespondOp: (payload: InferenceRespondRequest) => E
|
|
|
1291
1299
|
readonly inputTokens: number;
|
|
1292
1300
|
readonly outputTokens: number;
|
|
1293
1301
|
} | undefined;
|
|
1294
|
-
|
|
1302
|
+
readonly receipt?: {
|
|
1303
|
+
readonly accountId: string;
|
|
1304
|
+
readonly revision: number;
|
|
1305
|
+
readonly login: "api-key" | "subscription";
|
|
1306
|
+
} | undefined;
|
|
1307
|
+
}, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").InferenceBadRequestError | import("@sealant/api-contracts").InferenceBudgetExceededError | import("@sealant/api-contracts").InferenceConflictError | import("@sealant/api-contracts").InferenceInternalServerError | import("@sealant/api-contracts").InferenceNotFoundError | import("@sealant/api-contracts").InferenceUnavailableError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
1295
1308
|
export declare const getIndexOp: () => Effect.Effect<{
|
|
1296
1309
|
readonly name: string;
|
|
1297
1310
|
readonly version: string;
|
|
@@ -1312,6 +1325,8 @@ export declare const getIndexOp: () => Effect.Effect<{
|
|
|
1312
1325
|
readonly kubernetesPersonLayout?: boolean | undefined;
|
|
1313
1326
|
readonly credentialPlacements?: boolean | undefined;
|
|
1314
1327
|
readonly connectedAccountApiKeys?: boolean | undefined;
|
|
1328
|
+
readonly connectedAccountEndpoints?: boolean | undefined;
|
|
1329
|
+
readonly inferenceAllowedLogin?: boolean | undefined;
|
|
1315
1330
|
} | undefined;
|
|
1316
1331
|
}, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError, SealantApiClient>;
|
|
1317
1332
|
export declare const getSetupStateOp: () => Effect.Effect<{
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequestBudgetRefusal, ForwardRefusalReason } from "@sealant/api-contracts";
|
|
2
|
-
import type { ForwardResetCause } from "./types.js";
|
|
2
|
+
import type { ForwardResetCause, InferenceReceipt } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Public SDK errors. The Effect core fails on a typed `Schema.TaggedError` channel; the facade maps
|
|
5
5
|
* every tagged failure onto one of these PLAIN `Error` subclasses (a single `_tag` switch) so the
|
|
@@ -41,12 +41,15 @@ export declare class SealantApiError extends SealantError {
|
|
|
41
41
|
readonly provider?: string;
|
|
42
42
|
/** The accounts a `connected-account-ambiguous` connect could have meant. */
|
|
43
43
|
readonly candidateAccountIds?: readonly string[];
|
|
44
|
+
/** An inference error after the account was resolved: the exchange's login. */
|
|
45
|
+
readonly receipt?: InferenceReceipt;
|
|
44
46
|
constructor(message: string, options?: {
|
|
45
47
|
readonly code?: string;
|
|
46
48
|
readonly status?: number;
|
|
47
49
|
readonly reason?: string;
|
|
48
50
|
readonly provider?: string;
|
|
49
51
|
readonly candidateAccountIds?: readonly string[];
|
|
52
|
+
readonly receipt?: InferenceReceipt;
|
|
50
53
|
readonly cause?: unknown;
|
|
51
54
|
});
|
|
52
55
|
}
|
|
@@ -67,6 +70,7 @@ export declare class SealantBudgetExceededError extends SealantApiError {
|
|
|
67
70
|
readonly limit: number;
|
|
68
71
|
readonly retryAfterSeconds: number;
|
|
69
72
|
readonly refusal?: RequestBudgetRefusal;
|
|
73
|
+
readonly receipt?: InferenceReceipt;
|
|
70
74
|
readonly cause?: unknown;
|
|
71
75
|
});
|
|
72
76
|
}
|
package/dist/errors.js
CHANGED
|
@@ -41,6 +41,8 @@ export class SealantApiError extends SealantError {
|
|
|
41
41
|
provider;
|
|
42
42
|
/** The accounts a `connected-account-ambiguous` connect could have meant. */
|
|
43
43
|
candidateAccountIds;
|
|
44
|
+
/** An inference error after the account was resolved: the exchange's login. */
|
|
45
|
+
receipt;
|
|
44
46
|
constructor(message, options) {
|
|
45
47
|
super(message, {
|
|
46
48
|
code: options?.code ?? "api_error",
|
|
@@ -58,6 +60,9 @@ export class SealantApiError extends SealantError {
|
|
|
58
60
|
if (options?.candidateAccountIds !== undefined) {
|
|
59
61
|
this.candidateAccountIds = options.candidateAccountIds;
|
|
60
62
|
}
|
|
63
|
+
if (options?.receipt !== undefined) {
|
|
64
|
+
this.receipt = options.receipt;
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
/** A control-plane budget failure, with the server's retry delay and admission metadata. */
|
|
@@ -76,6 +81,7 @@ export class SealantBudgetExceededError extends SealantApiError {
|
|
|
76
81
|
super(message, {
|
|
77
82
|
code: "BudgetExceededError",
|
|
78
83
|
status: 429,
|
|
84
|
+
...(options.receipt === undefined ? {} : { receipt: options.receipt }),
|
|
79
85
|
...(options.cause === undefined ? {} : { cause: options.cause }),
|
|
80
86
|
});
|
|
81
87
|
this.budget = options.budget;
|
package/dist/facade/workspace.js
CHANGED
|
@@ -206,6 +206,7 @@ const toPlacementLogin = (login) => login.kind === "subscription"
|
|
|
206
206
|
kind: "api-key",
|
|
207
207
|
suffix: login.suffix,
|
|
208
208
|
...(login.keyPath === undefined ? {} : { keyPath: login.keyPath }),
|
|
209
|
+
...(login.baseUrl === undefined ? {} : { baseUrl: login.baseUrl }),
|
|
209
210
|
};
|
|
210
211
|
/** Wire → public credential home. */
|
|
211
212
|
const toCredentialHome = (home) => ({
|
|
@@ -15,4 +15,6 @@ export declare const toFeatures: (index: SystemIndexResponse) => SealantFeatures
|
|
|
15
15
|
export declare const readFeatures: (ctx: SdkContext) => Promise<SealantFeatures>;
|
|
16
16
|
export declare const requireConnectedAccountDefaults: (ctx: SdkContext) => Promise<void>;
|
|
17
17
|
export declare const requireConnectedAccountLoginClass: (ctx: SdkContext) => Promise<void>;
|
|
18
|
+
export declare const requireConnectedAccountEndpoints: (ctx: SdkContext) => Promise<void>;
|
|
18
19
|
export declare const requireCredentialPlacements: (ctx: SdkContext) => Promise<void>;
|
|
20
|
+
export declare const requireInferenceAllowedLogin: (ctx: SdkContext) => Promise<void>;
|
|
@@ -25,6 +25,8 @@ export const toFeatures = (index) => {
|
|
|
25
25
|
connectedAccountLoginClass: features?.connectedAccountLoginClass === true,
|
|
26
26
|
kubernetesPersonLayout: features?.kubernetesPersonLayout === true,
|
|
27
27
|
connectedAccountApiKeys: features?.connectedAccountApiKeys === true,
|
|
28
|
+
connectedAccountEndpoints: features?.connectedAccountEndpoints === true,
|
|
29
|
+
inferenceAllowedLogin: features?.inferenceAllowedLogin === true,
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
@@ -59,8 +61,20 @@ export const requireConnectedAccountLoginClass = async (ctx) => {
|
|
|
59
61
|
throw new SealantError("This control plane cannot check a connect's login class (it does not report the feature, or could not be asked), and would store the secret whatever it is; nothing was sent.", { code: "connected-account-login-class-unsupported" });
|
|
60
62
|
}
|
|
61
63
|
};
|
|
64
|
+
export const requireConnectedAccountEndpoints = async (ctx) => {
|
|
65
|
+
const supported = await readFeatures(ctx).then((features) => features.connectedAccountEndpoints, () => false);
|
|
66
|
+
if (!supported) {
|
|
67
|
+
throw new SealantError("This control plane cannot keep an endpoint with a key (it does not report the feature, or could not be asked), and would send the key's requests to the provider; nothing was sent.", { code: "connected-account-endpoints-unsupported" });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
62
70
|
export const requireCredentialPlacements = async (ctx) => {
|
|
63
71
|
const supported = await readFeatures(ctx).then((features) => features.credentialPlacements, () => false);
|
|
64
72
|
if (!supported)
|
|
65
73
|
throw new SealantError("This control plane cannot protect live credential placements or prune them; nothing was sent.", { code: "credential-placements-unsupported" });
|
|
66
74
|
};
|
|
75
|
+
export const requireInferenceAllowedLogin = async (ctx) => {
|
|
76
|
+
const supported = await readFeatures(ctx).then((features) => features.inferenceAllowedLogin, () => false);
|
|
77
|
+
if (!supported) {
|
|
78
|
+
throw new SealantError("This control plane cannot limit inference to a subscription (it does not report the feature, or could not be asked), and would run on a key; nothing was sent.", { code: "inference-allowed-login-unsupported" });
|
|
79
|
+
}
|
|
80
|
+
};
|
|
@@ -23,6 +23,7 @@ export const buildInferenceRespondRequest = (options, ownerUserId) => {
|
|
|
23
23
|
...(codex === undefined ? {} : { codex }),
|
|
24
24
|
},
|
|
25
25
|
prompt: options.prompt,
|
|
26
|
+
...(options.allowedLogin === undefined ? {} : { allowedLogin: options.allowedLogin }),
|
|
26
27
|
...(options.system === undefined ? {} : { system: options.system }),
|
|
27
28
|
...(options.model === undefined ? {} : { model: options.model }),
|
|
28
29
|
...(options.maxTurns === undefined ? {} : { maxTurns: options.maxTurns }),
|
|
@@ -68,5 +69,6 @@ export const mapInferenceResponse = (wire) => {
|
|
|
68
69
|
...(wire.usage === undefined
|
|
69
70
|
? {}
|
|
70
71
|
: { usage: { inputTokens: wire.usage.inputTokens, outputTokens: wire.usage.outputTokens } }),
|
|
72
|
+
...(wire.receipt === undefined ? {} : { receipt: { ...wire.receipt } }),
|
|
71
73
|
};
|
|
72
74
|
};
|
|
@@ -22,6 +22,17 @@ const extractStatus = (record) => {
|
|
|
22
22
|
return undefined;
|
|
23
23
|
};
|
|
24
24
|
const nonEmptyString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
25
|
+
const toReceipt = (value) => {
|
|
26
|
+
const record = asRecord(value);
|
|
27
|
+
const accountId = nonEmptyString(record?.["accountId"]);
|
|
28
|
+
const revision = record?.["revision"];
|
|
29
|
+
const login = record?.["login"];
|
|
30
|
+
return accountId !== undefined &&
|
|
31
|
+
typeof revision === "number" &&
|
|
32
|
+
(login === "subscription" || login === "api-key")
|
|
33
|
+
? { accountId, revision, login }
|
|
34
|
+
: undefined;
|
|
35
|
+
};
|
|
25
36
|
export const toSealantError = (cause) => {
|
|
26
37
|
if (cause instanceof SealantError) {
|
|
27
38
|
return cause;
|
|
@@ -38,11 +49,13 @@ export const toSealantError = (cause) => {
|
|
|
38
49
|
if (tag === "BudgetExceededError") {
|
|
39
50
|
const budget = Schema.decodeUnknownOption(BudgetExceededError)(cause);
|
|
40
51
|
if (Option.isSome(budget)) {
|
|
52
|
+
const receipt = toReceipt(record?.["receipt"]);
|
|
41
53
|
return new SealantBudgetExceededError(message, {
|
|
42
54
|
budget: budget.value.budget,
|
|
43
55
|
limit: budget.value.limit,
|
|
44
56
|
retryAfterSeconds: budget.value.retryAfterSeconds,
|
|
45
57
|
...(budget.value.refusal === undefined ? {} : { refusal: budget.value.refusal }),
|
|
58
|
+
...(receipt === undefined ? {} : { receipt }),
|
|
46
59
|
cause,
|
|
47
60
|
});
|
|
48
61
|
}
|
|
@@ -55,12 +68,14 @@ export const toSealantError = (cause) => {
|
|
|
55
68
|
const candidateAccountIds = Array.isArray(candidates)
|
|
56
69
|
? candidates.filter((id) => typeof id === "string")
|
|
57
70
|
: undefined;
|
|
71
|
+
const receipt = toReceipt(record?.["receipt"]);
|
|
58
72
|
return new SealantApiError(message, {
|
|
59
73
|
code: tag,
|
|
60
74
|
...(status === undefined ? {} : { status }),
|
|
61
75
|
...(reason === undefined ? {} : { reason }),
|
|
62
76
|
...(provider === undefined ? {} : { provider }),
|
|
63
77
|
...(candidateAccountIds === undefined ? {} : { candidateAccountIds }),
|
|
78
|
+
...(receipt === undefined ? {} : { receipt }),
|
|
64
79
|
cause,
|
|
65
80
|
});
|
|
66
81
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `SealantNotImplementedError` at runtime, see `./errors.js`).
|
|
16
16
|
*/
|
|
17
17
|
import type { ReadableStream as NodeReadableStream, WritableStream as NodeWritableStream } from "node:stream/web";
|
|
18
|
-
import type { WorkspacePublication as WireWorkspacePublication, ConnectedAccountLogin, ConnectedAccountLoginClass, ForwardBinding, ForwardResetReason } from "@sealant/api-contracts";
|
|
18
|
+
import type { WorkspacePublication as WireWorkspacePublication, ConnectedAccountLogin, ConnectedAccountLoginClass, EndpointUrl, ForwardBinding, ForwardResetReason } from "@sealant/api-contracts";
|
|
19
19
|
/** A request hint. Interactive requests may use the server's reserved capacity. */
|
|
20
20
|
export type RequestPriority = "normal" | "interactive";
|
|
21
21
|
/**
|
|
@@ -1366,7 +1366,9 @@ export interface CredentialPlacementReceipt {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
/**
|
|
1368
1368
|
* What a placed login spends. A key carries its last four characters; a Claude key also the
|
|
1369
|
-
* absolute path of its file in the home, for an `apiKeyHelper` such as `cat <keyPath>`.
|
|
1369
|
+
* absolute path of its file in the home, for an `apiKeyHelper` such as `cat <keyPath>`. A key with
|
|
1370
|
+
* an endpoint carries its `baseUrl`, which nothing in the home holds: the harness's launch sets it
|
|
1371
|
+
* (Claude's `ANTHROPIC_BASE_URL`, a Codex model provider).
|
|
1370
1372
|
*/
|
|
1371
1373
|
export type CredentialPlacementLogin = {
|
|
1372
1374
|
readonly kind: "subscription";
|
|
@@ -1374,6 +1376,7 @@ export type CredentialPlacementLogin = {
|
|
|
1374
1376
|
readonly kind: "api-key";
|
|
1375
1377
|
readonly suffix: string;
|
|
1376
1378
|
readonly keyPath?: string;
|
|
1379
|
+
readonly baseUrl?: EndpointUrl;
|
|
1377
1380
|
};
|
|
1378
1381
|
/** A receipt associated with the provider slot it occupies in this home. */
|
|
1379
1382
|
export interface WorkspaceCredentialPlacementReceipt extends CredentialPlacementReceipt {
|
|
@@ -1490,6 +1493,16 @@ export interface SealantFeatures {
|
|
|
1490
1493
|
* file an `apiKeyHelper` reads. A launch at `$HOME` still refuses a Claude key.
|
|
1491
1494
|
*/
|
|
1492
1495
|
readonly connectedAccountApiKeys: boolean;
|
|
1496
|
+
/**
|
|
1497
|
+
* A Claude or Codex API key connects with an `endpoint`: `login.endpointHost` names its host, a
|
|
1498
|
+
* placement receipt carries its `baseUrl`, and inference sends the exchange there.
|
|
1499
|
+
*/
|
|
1500
|
+
readonly connectedAccountEndpoints: boolean;
|
|
1501
|
+
/**
|
|
1502
|
+
* `allowedLogin` on `inference.respond()` (a key is refused when it says `subscription`),
|
|
1503
|
+
* `receipt` on its answers and errors, and inference on a Claude API key.
|
|
1504
|
+
*/
|
|
1505
|
+
readonly inferenceAllowedLogin: boolean;
|
|
1493
1506
|
}
|
|
1494
1507
|
/** Tagged artifact facts reported by the control plane. */
|
|
1495
1508
|
export type WorkspacePublication = WireWorkspacePublication;
|
|
@@ -2150,12 +2163,23 @@ export interface InferenceUsage {
|
|
|
2150
2163
|
readonly inputTokens: number;
|
|
2151
2164
|
readonly outputTokens: number;
|
|
2152
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* The login an exchange runs on, fixed when it starts: every continuation runs on it, even after
|
|
2168
|
+
* the account is reconnected. `revision` is the account's credential revision at the start.
|
|
2169
|
+
*/
|
|
2170
|
+
export interface InferenceReceipt {
|
|
2171
|
+
readonly accountId: string;
|
|
2172
|
+
readonly revision: number;
|
|
2173
|
+
readonly login: "subscription" | "api-key";
|
|
2174
|
+
}
|
|
2153
2175
|
export interface InferenceResponse {
|
|
2154
2176
|
/** Continuation handle for the tool loop (held in memory server-side; expires after idle). */
|
|
2155
2177
|
readonly sessionId: string;
|
|
2156
2178
|
readonly turn: InferenceTurn;
|
|
2157
2179
|
/** Usage for the exchange, present on the final text turn. */
|
|
2158
2180
|
readonly usage?: InferenceUsage;
|
|
2181
|
+
/** The exchange's login; absent from a control plane without `features().inferenceAllowedLogin`. */
|
|
2182
|
+
readonly receipt?: InferenceReceipt;
|
|
2159
2183
|
}
|
|
2160
2184
|
/** Starts a new inference exchange on a connected account. */
|
|
2161
2185
|
export interface InferenceRespondOptions {
|
|
@@ -2171,6 +2195,12 @@ export interface InferenceRespondOptions {
|
|
|
2171
2195
|
readonly schema?: unknown;
|
|
2172
2196
|
};
|
|
2173
2197
|
readonly credentials: InferenceCredentialsOptions;
|
|
2198
|
+
/**
|
|
2199
|
+
* `subscription` refuses an account holding an API key before the provider is asked (a
|
|
2200
|
+
* `SealantApiError` with `reason` `login-not-allowed`); `any`, the default, runs on either.
|
|
2201
|
+
* `subscription` needs `features().inferenceAllowedLogin`; without it nothing is sent.
|
|
2202
|
+
*/
|
|
2203
|
+
readonly allowedLogin?: "subscription" | "any";
|
|
2174
2204
|
}
|
|
2175
2205
|
/** Continues an exchange by posting the results of the previous turn's tool calls. */
|
|
2176
2206
|
export interface InferenceContinueOptions {
|
|
@@ -2251,7 +2281,7 @@ export interface ConnectedAccountCredential {
|
|
|
2251
2281
|
readonly lastRefreshAt: string | null;
|
|
2252
2282
|
readonly lastRefreshOutcome: "refreshed" | "fresh" | "failed" | null;
|
|
2253
2283
|
}
|
|
2254
|
-
export type { ConnectedAccountLogin, ConnectedAccountLoginClass };
|
|
2284
|
+
export type { ConnectedAccountLogin, ConnectedAccountLoginClass, EndpointUrl };
|
|
2255
2285
|
export interface ConnectedAccount {
|
|
2256
2286
|
readonly connectedAccountId: string;
|
|
2257
2287
|
readonly ownerUserId: string;
|
|
@@ -2310,6 +2340,14 @@ interface ConnectConnectedAccountBase {
|
|
|
2310
2340
|
* without it. Needs `features().connectedAccountDefaults`.
|
|
2311
2341
|
*/
|
|
2312
2342
|
readonly makeDefault?: boolean;
|
|
2343
|
+
/**
|
|
2344
|
+
* Claude and Codex API keys: the base URL of a compatible endpoint to send this login's requests
|
|
2345
|
+
* to, such as a company gateway. An absolute `http:` or `https:` URL with no user name, password,
|
|
2346
|
+
* query string or fragment; a trailing slash is dropped. With one, `secret` may be any key without
|
|
2347
|
+
* spaces. Refused with any other login. A reconnect without it removes the endpoint. Needs
|
|
2348
|
+
* `features().connectedAccountEndpoints`.
|
|
2349
|
+
*/
|
|
2350
|
+
readonly endpoint?: string;
|
|
2313
2351
|
}
|
|
2314
2352
|
/**
|
|
2315
2353
|
* Which account a connect writes. A person's first account for a provider is named `default`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealant/sdk-next",
|
|
3
|
-
"version": "0.40.0-next.
|
|
3
|
+
"version": "0.40.0-next.815",
|
|
4
4
|
"description": "The fluent public SDK for Sealant — create a workspace, run a harness, replay the record.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"node": ">=20"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sealant/api-contracts": "npm:@sealant/api-contracts-next@0.40.0-next.
|
|
29
|
+
"@sealant/api-contracts": "npm:@sealant/api-contracts-next@0.40.0-next.815"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"effect": "^4.0.5"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "7c62e60f6ddc96a2de5cc52c43586676818dd971",
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
}
|