@usine/gateway 0.3.1-next.596.gcfd02df.1.1 → 0.3.1-next.609.g4e2cbe7.1.1
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/admin/api.d.ts +35 -35
- package/dist/admin/api.d.ts.map +1 -1
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js +9 -10
- package/dist/llm/llm.js.map +1 -1
- package/package.json +2 -2
package/dist/admin/api.d.ts
CHANGED
|
@@ -106,23 +106,7 @@ export declare class AdminAuthorization extends AdminAuthorization_base {
|
|
|
106
106
|
* for an attempt, and to read the gateway's LLM provider credential kinds (ADR 0013).
|
|
107
107
|
* Renewal re-creates a missing attachment under the same ID, so caller tokens stay valid.
|
|
108
108
|
*/
|
|
109
|
-
export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApiGroup.HttpApiGroup<"attachments", HttpApiEndpoint.HttpApiEndpoint<"
|
|
110
|
-
id: Schema.brand<Schema.String, "AttachmentId">;
|
|
111
|
-
}>>, never, never, never, Schema.toCodecJson<typeof Detached>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<AttachmentPersistenceError, {
|
|
112
|
-
readonly _tag: "AttachmentPersistenceError";
|
|
113
|
-
readonly operation: "read" | "write";
|
|
114
|
-
readonly message: string;
|
|
115
|
-
}, readonly [Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
116
|
-
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
117
|
-
readonly message: Schema.String;
|
|
118
|
-
}>], {
|
|
119
|
-
readonly _tag: "AttachmentPersistenceError";
|
|
120
|
-
readonly operation: "read" | "write";
|
|
121
|
-
readonly message: string;
|
|
122
|
-
}>, Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
123
|
-
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
124
|
-
readonly message: Schema.String;
|
|
125
|
-
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/v1/attachments", never, never, never, never, Schema.toCodecJson<typeof AttachmentList>, never, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"attach", "POST", "/v1/attachments", never, never, Schema.toCodecJson<typeof AttachRequest>, never, Schema.toCodecJson<typeof Attached>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<AttachmentAlreadyExpired, {
|
|
109
|
+
export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApiGroup.HttpApiGroup<"attachments", HttpApiEndpoint.HttpApiEndpoint<"attach", "POST", "/v1/attachments", never, never, Schema.toCodecJson<typeof AttachRequest>, never, Schema.toCodecJson<typeof Attached>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<AttachmentAlreadyExpired, {
|
|
126
110
|
readonly _tag: "AttachmentAlreadyExpired";
|
|
127
111
|
readonly worker: string;
|
|
128
112
|
readonly repository: string;
|
|
@@ -154,7 +138,23 @@ export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApi
|
|
|
154
138
|
}>, Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
155
139
|
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
156
140
|
readonly message: Schema.String;
|
|
157
|
-
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
141
|
+
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"detach", "DELETE", "/v1/attachments/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
142
|
+
id: Schema.brand<Schema.String, "AttachmentId">;
|
|
143
|
+
}>>, never, never, never, Schema.toCodecJson<typeof Detached>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<AttachmentPersistenceError, {
|
|
144
|
+
readonly _tag: "AttachmentPersistenceError";
|
|
145
|
+
readonly operation: "read" | "write";
|
|
146
|
+
readonly message: string;
|
|
147
|
+
}, readonly [Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
148
|
+
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
149
|
+
readonly message: Schema.String;
|
|
150
|
+
}>], {
|
|
151
|
+
readonly _tag: "AttachmentPersistenceError";
|
|
152
|
+
readonly operation: "read" | "write";
|
|
153
|
+
readonly message: string;
|
|
154
|
+
}>, Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
155
|
+
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
156
|
+
readonly message: Schema.String;
|
|
157
|
+
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/v1/attachments", never, never, never, never, Schema.toCodecJson<typeof AttachmentList>, never, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"renew", "PUT", "/v1/attachments/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
158
158
|
id: Schema.brand<Schema.String, "AttachmentId">;
|
|
159
159
|
}>>, never, Schema.toCodecJson<typeof AttachRequest>, never, Schema.toCodecJson<typeof Attached>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<AttachmentAlreadyExpired, {
|
|
160
160
|
readonly _tag: "AttachmentAlreadyExpired";
|
|
@@ -206,9 +206,19 @@ export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApi
|
|
|
206
206
|
}>, Schema.TaggedStruct<"AttachmentPersistenceError", {
|
|
207
207
|
readonly operation: Schema.Literals<readonly ["read", "write"]>;
|
|
208
208
|
readonly message: Schema.String;
|
|
209
|
-
}>, never, never>>, AdminAuthorization, never>, false> | HttpApiGroup.HttpApiGroup<"llm", HttpApiEndpoint.HttpApiEndpoint<"
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
}>, never, never>>, AdminAuthorization, never>, false> | HttpApiGroup.HttpApiGroup<"llm", HttpApiEndpoint.HttpApiEndpoint<"connect", "PUT", "/v1/provider-credentials", never, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
|
|
210
|
+
readonly kind: Schema.Literal<"claude-subscription">;
|
|
211
|
+
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
212
|
+
}>, Schema.Struct<{
|
|
213
|
+
readonly kind: Schema.Literal<"anthropic-api-key">;
|
|
214
|
+
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly kind: Schema.Literal<"chatgpt-subscription">;
|
|
217
|
+
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
218
|
+
}>, Schema.Struct<{
|
|
219
|
+
readonly kind: Schema.Literal<"openai-api-key">;
|
|
220
|
+
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
221
|
+
}>]>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
212
222
|
readonly ok: Schema.Boolean;
|
|
213
223
|
}>>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<ProviderCredentialError, {
|
|
214
224
|
readonly _tag: "ProviderCredentialError";
|
|
@@ -238,19 +248,9 @@ export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApi
|
|
|
238
248
|
readonly message: string;
|
|
239
249
|
}>, Schema.TaggedStruct<"ProviderCredentialError", {
|
|
240
250
|
readonly message: Schema.String;
|
|
241
|
-
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}>, Schema.Struct<{
|
|
245
|
-
readonly kind: Schema.Literal<"anthropic-api-key">;
|
|
246
|
-
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
247
|
-
}>, Schema.Struct<{
|
|
248
|
-
readonly kind: Schema.Literal<"chatgpt-subscription">;
|
|
249
|
-
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
250
|
-
}>, Schema.Struct<{
|
|
251
|
-
readonly kind: Schema.Literal<"openai-api-key">;
|
|
252
|
-
readonly secret: Schema.Redacted<Schema.NonEmptyString>;
|
|
253
|
-
}>]>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
251
|
+
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"disconnect", "DELETE", "/v1/provider-credentials/:provider", Schema.toCodecStringTree<Schema.Struct<{
|
|
252
|
+
provider: Schema.Literals<readonly ["anthropic-messages", "openai-responses"]>;
|
|
253
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
254
254
|
readonly ok: Schema.Boolean;
|
|
255
255
|
}>>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<ProviderCredentialError, {
|
|
256
256
|
readonly _tag: "ProviderCredentialError";
|
|
@@ -262,5 +262,5 @@ export declare const GatewayAdminApi: HttpApi.HttpApi<"GatewayAdminApi", HttpApi
|
|
|
262
262
|
readonly message: string;
|
|
263
263
|
}>, Schema.TaggedStruct<"ProviderCredentialError", {
|
|
264
264
|
readonly message: Schema.String;
|
|
265
|
-
}>, never, never>>, AdminAuthorization, never>, false>>;
|
|
265
|
+
}>, never, never>>, AdminAuthorization, never> | HttpApiEndpoint.HttpApiEndpoint<"providers", "GET", "/v1/providers", never, never, never, never, Schema.toCodecJson<typeof LlmProviderList>, never, AdminAuthorization, never>, false>>;
|
|
266
266
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/admin/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/admin/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EAExB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EACL,OAAO,EACP,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,UAAU,EACf,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B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;;IAOH,oGAAoG;;;AALtG,8EAA8E;AAC9E,qBAAa,QAAS,SAAQ,aAM5B;CAAG;;IAOH,+EAA+E;;;AALjF,mFAAmF;AACnF,qBAAa,cAAe,SAAQ,mBAMlC;CAAG;;IAOH,yEAAyE;;IAEzE,oEAAoE;;;AAPtE,yGAAyG;AACzG,qBAAa,kBAAmB,SAAQ,uBAQtC;CAAG;;IAUH,yFAAyF;;;AAR3F;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAMnC;IACA,wGAAwG;IACxG,MAAM,CAAC,aAAa,CAAC,EACnB,oBAAoB,EAAE,SAAS,EAC/B,kBAAkB,EAAE,MAAM,GAC3B,EAAE,YAAY,GAAG,eAAe,CAahC;CACF;;;;;;;;;;;;;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,uBAGvC;CAAG;AAEJ;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wOAiD3B,CAAC"}
|
package/dist/llm/llm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;;IAUpC,oEAAoE;;;AALtE,0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LlmProtocol, GatewayLlmProtocolFromName, } from "@usine/core/worker";
|
|
2
2
|
import { Option, Redacted, Schema } from "effect";
|
|
3
3
|
import { Headers } from "effect/http";
|
|
4
4
|
import { UpstreamBase } from "../upstream.js";
|
|
@@ -66,19 +66,18 @@ export class OpenAiProvider extends Schema.TaggedClass()("OpenAiProvider", {
|
|
|
66
66
|
}
|
|
67
67
|
/** The `llm.<domain>` path prefixes that select a provider. */
|
|
68
68
|
export const LlmProviderName = GatewayLlmProtocol;
|
|
69
|
-
const
|
|
69
|
+
const providerOfPrefix = Schema.decodeUnknownOption(GatewayLlmProtocolFromName);
|
|
70
70
|
/** Returns the provider from the first path segment; for example, `/anthropic-messages/v1/messages` is Anthropic's `/v1/messages`. */
|
|
71
71
|
export const llmTarget = (pathname) => {
|
|
72
72
|
const match = /^\/([a-z-]+)(\/.*)?$/u.exec(pathname);
|
|
73
|
-
|
|
74
|
-
const provider = prefix === "anthropic"
|
|
75
|
-
? "anthropic-messages"
|
|
76
|
-
: prefix === "openai"
|
|
77
|
-
? "openai-responses"
|
|
78
|
-
: prefix;
|
|
79
|
-
if (match === null || provider === undefined || !isProviderName(provider))
|
|
73
|
+
if (match === null)
|
|
80
74
|
return Option.none();
|
|
81
|
-
|
|
75
|
+
const prefix = match[1];
|
|
76
|
+
return Option.map(providerOfPrefix(prefix), (provider) => ({
|
|
77
|
+
provider,
|
|
78
|
+
rest: match[2] ?? "",
|
|
79
|
+
legacy: prefix !== provider,
|
|
80
|
+
}));
|
|
82
81
|
};
|
|
83
82
|
/** Returns the credential kind sent to `provider`: a subscription for a Claude token or a ChatGPT login. */
|
|
84
83
|
export const credentialKind = (provider) => {
|
package/dist/llm/llm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names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CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBAC3D,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,UAAU,CAAC;aAC/E,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC;AAUF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAAqB,EACrB,OAAwB,EACP,EAAE;IACnB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CACxB,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,oBAAoB,CAAC,EAC7C,eAAe,EACf,UAAU,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAC/C,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;QACpC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;QACpB,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC;KAC5E,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usine/gateway",
|
|
3
|
-
"version": "0.3.1-next.
|
|
3
|
+
"version": "0.3.1-next.609.g4e2cbe7.1.1",
|
|
4
4
|
"description": "The usine gateway: a credential-injecting proxy for GitHub and LLM providers, and an egress allowlist, in front of Worker VMs.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@effect/platform-node": "4.0.6",
|
|
43
43
|
"@effect/platform-node-shared": "4.0.6",
|
|
44
|
-
"@usine/core": "0.7.1-next.
|
|
44
|
+
"@usine/core": "0.7.1-next.609.g4e2cbe7.1.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@effect/vitest": "4.0.6",
|