@pellux/goodvibes-sdk 0.21.2 → 0.21.3
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/_internal/contracts/zod-schemas/accounts.d.ts.map +1 -1
- package/dist/_internal/contracts/zod-schemas/accounts.js +1 -0
- package/dist/_internal/contracts/zod-schemas/auth.d.ts.map +1 -1
- package/dist/_internal/contracts/zod-schemas/auth.js +1 -0
- package/dist/_internal/contracts/zod-schemas/events.d.ts.map +1 -1
- package/dist/_internal/contracts/zod-schemas/events.js +1 -0
- package/dist/_internal/contracts/zod-schemas/index.d.ts +2 -0
- package/dist/_internal/contracts/zod-schemas/index.d.ts.map +1 -1
- package/dist/_internal/contracts/zod-schemas/index.js +2 -0
- package/dist/_internal/contracts/zod-schemas/providers.d.ts +139 -0
- package/dist/_internal/contracts/zod-schemas/providers.d.ts.map +1 -0
- package/dist/_internal/contracts/zod-schemas/providers.js +65 -0
- package/dist/_internal/contracts/zod-schemas/session.d.ts.map +1 -1
- package/dist/_internal/contracts/zod-schemas/session.js +1 -0
- package/dist/_internal/platform/control-plane/gateway.d.ts +2 -1
- package/dist/_internal/platform/control-plane/gateway.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway.js +7 -0
- package/dist/_internal/platform/daemon/http/provider-routes.d.ts +3 -0
- package/dist/_internal/platform/daemon/http/provider-routes.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/provider-routes.js +72 -25
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/accounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/accounts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAyC3B;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Synced from packages/contracts/src/zod-schemas/accounts.ts
|
|
1
2
|
import { z } from 'zod/v4';
|
|
2
3
|
const RouteKindSchema = z.enum(['api-key', 'service-oauth', 'subscription', 'unconfigured']);
|
|
3
4
|
const AuthFreshnessSchema = z.enum(['expired', 'expiring', 'healthy', 'pending', 'unconfigured']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;iBAW3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;iBAQxC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;kCAEb,CAAC;AAEzB,eAAO,MAAM,kCAAkC;;;;;;;;;;iBAE7C,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|
|
@@ -6,4 +6,6 @@ export { SerializedEventEnvelopeSchema, TypedSerializedEventEnvelopeSchema, Runt
|
|
|
6
6
|
export type { SerializedEventEnvelopeShape, TypedSerializedEventEnvelopeShape, } from './events.js';
|
|
7
7
|
export { ControlStatusResponseSchema, LocalAuthStatusResponseSchema, } from './session.js';
|
|
8
8
|
export type { ControlStatusResponse, LocalAuthStatusResponse, } from './session.js';
|
|
9
|
+
export { ProviderModelRefSchema, ProviderModelEntrySchema, ConfiguredViaSchema, ProviderEntrySchema, ListProvidersResponseSchema, CurrentModelResponseSchema, PatchCurrentModelBodySchema, PatchCurrentModelErrorSchema, PatchCurrentModelResponseSchema, ModelChangedEventSchema, } from './providers.js';
|
|
10
|
+
export type { ProviderModelRef, ProviderModelEntry, ConfiguredVia, ProviderEntry, ListProvidersResponse, CurrentModelResponse, PatchCurrentModelBody, PatchCurrentModelError, PatchCurrentModelResponse, ModelChangedEvent, } from './providers.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
// Synced from packages/contracts/src/zod-schemas/index.ts
|
|
1
2
|
export { ControlAuthLoginResponseSchema, ControlAuthCurrentResponseSchema, } from './auth.js';
|
|
2
3
|
export { AccountsSnapshotResponseSchema, } from './accounts.js';
|
|
3
4
|
export { SerializedEventEnvelopeSchema, TypedSerializedEventEnvelopeSchema, RuntimeEventRecordSchema, } from './events.js';
|
|
4
5
|
export { ControlStatusResponseSchema, LocalAuthStatusResponseSchema, } from './session.js';
|
|
6
|
+
export { ProviderModelRefSchema, ProviderModelEntrySchema, ConfiguredViaSchema, ProviderEntrySchema, ListProvidersResponseSchema, CurrentModelResponseSchema, PatchCurrentModelBodySchema, PatchCurrentModelErrorSchema, PatchCurrentModelResponseSchema, ModelChangedEventSchema, } from './providers.js';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Schemas for the provider/model discovery and selection HTTP API.
|
|
4
|
+
*
|
|
5
|
+
* Endpoints:
|
|
6
|
+
* GET /api/providers → ListProvidersResponseSchema
|
|
7
|
+
* GET /api/providers/current → CurrentModelResponseSchema
|
|
8
|
+
* PATCH /api/providers/current → PatchCurrentModelBodySchema (request) / CurrentModelResponseSchema (response)
|
|
9
|
+
*/
|
|
10
|
+
export declare const ProviderModelRefSchema: z.ZodObject<{
|
|
11
|
+
registryKey: z.ZodString;
|
|
12
|
+
provider: z.ZodString;
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type ProviderModelRef = z.infer<typeof ProviderModelRefSchema>;
|
|
16
|
+
export declare const ProviderModelEntrySchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
registryKey: z.ZodString;
|
|
19
|
+
provider: z.ZodString;
|
|
20
|
+
label: z.ZodOptional<z.ZodString>;
|
|
21
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type ProviderModelEntry = z.infer<typeof ProviderModelEntrySchema>;
|
|
24
|
+
export declare const ConfiguredViaSchema: z.ZodEnum<{
|
|
25
|
+
env: "env";
|
|
26
|
+
anonymous: "anonymous";
|
|
27
|
+
subscription: "subscription";
|
|
28
|
+
secrets: "secrets";
|
|
29
|
+
}>;
|
|
30
|
+
export type ConfiguredVia = z.infer<typeof ConfiguredViaSchema>;
|
|
31
|
+
export declare const ProviderEntrySchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
label: z.ZodString;
|
|
34
|
+
configured: z.ZodBoolean;
|
|
35
|
+
configuredVia: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
env: "env";
|
|
37
|
+
anonymous: "anonymous";
|
|
38
|
+
subscription: "subscription";
|
|
39
|
+
secrets: "secrets";
|
|
40
|
+
}>>;
|
|
41
|
+
envVars: z.ZodArray<z.ZodString>;
|
|
42
|
+
models: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
registryKey: z.ZodString;
|
|
45
|
+
provider: z.ZodString;
|
|
46
|
+
label: z.ZodOptional<z.ZodString>;
|
|
47
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type ProviderEntry = z.infer<typeof ProviderEntrySchema>;
|
|
51
|
+
export declare const ListProvidersResponseSchema: z.ZodObject<{
|
|
52
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
label: z.ZodString;
|
|
55
|
+
configured: z.ZodBoolean;
|
|
56
|
+
configuredVia: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
env: "env";
|
|
58
|
+
anonymous: "anonymous";
|
|
59
|
+
subscription: "subscription";
|
|
60
|
+
secrets: "secrets";
|
|
61
|
+
}>>;
|
|
62
|
+
envVars: z.ZodArray<z.ZodString>;
|
|
63
|
+
models: z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
registryKey: z.ZodString;
|
|
66
|
+
provider: z.ZodString;
|
|
67
|
+
label: z.ZodOptional<z.ZodString>;
|
|
68
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
currentModel: z.ZodNullable<z.ZodObject<{
|
|
72
|
+
registryKey: z.ZodString;
|
|
73
|
+
provider: z.ZodString;
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type ListProvidersResponse = z.infer<typeof ListProvidersResponseSchema>;
|
|
78
|
+
export declare const CurrentModelResponseSchema: z.ZodObject<{
|
|
79
|
+
model: z.ZodNullable<z.ZodObject<{
|
|
80
|
+
registryKey: z.ZodString;
|
|
81
|
+
provider: z.ZodString;
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
configured: z.ZodBoolean;
|
|
85
|
+
configuredVia: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
env: "env";
|
|
87
|
+
anonymous: "anonymous";
|
|
88
|
+
subscription: "subscription";
|
|
89
|
+
secrets: "secrets";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type CurrentModelResponse = z.infer<typeof CurrentModelResponseSchema>;
|
|
93
|
+
export declare const PatchCurrentModelBodySchema: z.ZodObject<{
|
|
94
|
+
registryKey: z.ZodString;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export type PatchCurrentModelBody = z.infer<typeof PatchCurrentModelBodySchema>;
|
|
97
|
+
export declare const PatchCurrentModelErrorSchema: z.ZodObject<{
|
|
98
|
+
error: z.ZodString;
|
|
99
|
+
code: z.ZodEnum<{
|
|
100
|
+
INVALID_REQUEST: "INVALID_REQUEST";
|
|
101
|
+
MODEL_NOT_FOUND: "MODEL_NOT_FOUND";
|
|
102
|
+
PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED";
|
|
103
|
+
SET_MODEL_FAILED: "SET_MODEL_FAILED";
|
|
104
|
+
}>;
|
|
105
|
+
missingEnvVars: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type PatchCurrentModelError = z.infer<typeof PatchCurrentModelErrorSchema>;
|
|
108
|
+
export declare const PatchCurrentModelResponseSchema: z.ZodObject<{
|
|
109
|
+
model: z.ZodNullable<z.ZodObject<{
|
|
110
|
+
registryKey: z.ZodString;
|
|
111
|
+
provider: z.ZodString;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
configured: z.ZodBoolean;
|
|
115
|
+
configuredVia: z.ZodOptional<z.ZodEnum<{
|
|
116
|
+
env: "env";
|
|
117
|
+
anonymous: "anonymous";
|
|
118
|
+
subscription: "subscription";
|
|
119
|
+
secrets: "secrets";
|
|
120
|
+
}>>;
|
|
121
|
+
persisted: z.ZodBoolean;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type PatchCurrentModelResponse = z.infer<typeof PatchCurrentModelResponseSchema>;
|
|
124
|
+
/**
|
|
125
|
+
* SSE event shape emitted on `model.changed` events.
|
|
126
|
+
*
|
|
127
|
+
* Forwarded to companion SSE streams when the current model changes.
|
|
128
|
+
*/
|
|
129
|
+
export declare const ModelChangedEventSchema: z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"MODEL_CHANGED">;
|
|
131
|
+
registryKey: z.ZodString;
|
|
132
|
+
provider: z.ZodString;
|
|
133
|
+
previous: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
registryKey: z.ZodString;
|
|
135
|
+
provider: z.ZodString;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export type ModelChangedEvent = z.infer<typeof ModelChangedEventSchema>;
|
|
139
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/providers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;;;;GAOG;AAEH,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sB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BAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Synced from packages/contracts/src/zod-schemas/providers.ts
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
/**
|
|
4
|
+
* Schemas for the provider/model discovery and selection HTTP API.
|
|
5
|
+
*
|
|
6
|
+
* Endpoints:
|
|
7
|
+
* GET /api/providers → ListProvidersResponseSchema
|
|
8
|
+
* GET /api/providers/current → CurrentModelResponseSchema
|
|
9
|
+
* PATCH /api/providers/current → PatchCurrentModelBodySchema (request) / CurrentModelResponseSchema (response)
|
|
10
|
+
*/
|
|
11
|
+
export const ProviderModelRefSchema = z.object({
|
|
12
|
+
registryKey: z.string(),
|
|
13
|
+
provider: z.string(),
|
|
14
|
+
id: z.string(),
|
|
15
|
+
});
|
|
16
|
+
export const ProviderModelEntrySchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
registryKey: z.string(),
|
|
19
|
+
provider: z.string(),
|
|
20
|
+
label: z.string().optional(),
|
|
21
|
+
contextWindow: z.number().optional(),
|
|
22
|
+
});
|
|
23
|
+
export const ConfiguredViaSchema = z.enum(['env', 'secrets', 'subscription', 'anonymous']);
|
|
24
|
+
export const ProviderEntrySchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
label: z.string(),
|
|
27
|
+
configured: z.boolean(),
|
|
28
|
+
configuredVia: ConfiguredViaSchema.optional(),
|
|
29
|
+
envVars: z.array(z.string()),
|
|
30
|
+
models: z.array(ProviderModelEntrySchema),
|
|
31
|
+
});
|
|
32
|
+
export const ListProvidersResponseSchema = z.object({
|
|
33
|
+
providers: z.array(ProviderEntrySchema),
|
|
34
|
+
currentModel: ProviderModelRefSchema.nullable(),
|
|
35
|
+
});
|
|
36
|
+
export const CurrentModelResponseSchema = z.object({
|
|
37
|
+
model: ProviderModelRefSchema.nullable(),
|
|
38
|
+
configured: z.boolean(),
|
|
39
|
+
configuredVia: ConfiguredViaSchema.optional(),
|
|
40
|
+
});
|
|
41
|
+
export const PatchCurrentModelBodySchema = z.object({
|
|
42
|
+
registryKey: z.string().min(1),
|
|
43
|
+
});
|
|
44
|
+
export const PatchCurrentModelErrorSchema = z.object({
|
|
45
|
+
error: z.string(),
|
|
46
|
+
code: z.enum(['INVALID_REQUEST', 'MODEL_NOT_FOUND', 'PROVIDER_NOT_CONFIGURED', 'SET_MODEL_FAILED']),
|
|
47
|
+
missingEnvVars: z.array(z.string()).optional(),
|
|
48
|
+
});
|
|
49
|
+
export const PatchCurrentModelResponseSchema = CurrentModelResponseSchema.extend({
|
|
50
|
+
persisted: z.boolean(),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* SSE event shape emitted on `model.changed` events.
|
|
54
|
+
*
|
|
55
|
+
* Forwarded to companion SSE streams when the current model changes.
|
|
56
|
+
*/
|
|
57
|
+
export const ModelChangedEventSchema = z.object({
|
|
58
|
+
type: z.literal('MODEL_CHANGED'),
|
|
59
|
+
registryKey: z.string(),
|
|
60
|
+
provider: z.string(),
|
|
61
|
+
previous: z.object({
|
|
62
|
+
registryKey: z.string(),
|
|
63
|
+
provider: z.string(),
|
|
64
|
+
}).optional(),
|
|
65
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/zod-schemas/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;kCAGlB,CAAC;AAEzB,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RuntimeStore } from '../runtime/store/index.js';
|
|
2
2
|
import type { RuntimeEventBus, RuntimeEventDomain } from '../runtime/events/index.js';
|
|
3
3
|
import type { ControlPlaneClientDescriptor, ControlPlaneServerConfig, ControlPlaneSurfaceMessage } from './types.js';
|
|
4
|
+
declare const DEFAULT_DOMAINS: readonly RuntimeEventDomain[];
|
|
4
5
|
export interface ControlPlaneGatewayConfig {
|
|
5
6
|
readonly runtimeBus?: RuntimeEventBus | null;
|
|
6
7
|
readonly runtimeStore?: RuntimeStore | null;
|
|
@@ -98,5 +99,5 @@ export declare class ControlPlaneGateway {
|
|
|
98
99
|
private _scheduleControlPlaneSync;
|
|
99
100
|
private rememberEvent;
|
|
100
101
|
}
|
|
101
|
-
export {};
|
|
102
|
+
export { DEFAULT_DOMAINS as DEFAULT_DOMAINS_TEST_EXPORT };
|
|
102
103
|
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAyC,MAAM,4BAA4B,CAAC;AAU7H,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAyC,MAAM,4BAA4B,CAAC;AAU7H,OAAO,KAA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,mBAAmB;IAa3B,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,8BAAmC,GAAG,QAAQ;IAiK3F,WAAW,CAAC,aAAa,SAAK,GAAG,QAAQ;IAIzC,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,aAAa;CAgBtB;AAOD,OAAO,EAAE,eAAe,IAAI,2BAA2B,EAAE,CAAC"}
|
|
@@ -15,6 +15,7 @@ const DEFAULT_DOMAINS = [
|
|
|
15
15
|
'transport',
|
|
16
16
|
'ops',
|
|
17
17
|
'knowledge',
|
|
18
|
+
'providers',
|
|
18
19
|
];
|
|
19
20
|
const DEFAULT_SERVER_CONFIG = {
|
|
20
21
|
enabled: false,
|
|
@@ -617,3 +618,9 @@ export class ControlPlaneGateway {
|
|
|
617
618
|
return record;
|
|
618
619
|
}
|
|
619
620
|
}
|
|
621
|
+
// ---------------------------------------------------------------------------
|
|
622
|
+
// Test export — exposes DEFAULT_DOMAINS for regression tests.
|
|
623
|
+
// This export is intentional; the const itself is module-scoped so tests
|
|
624
|
+
// cannot otherwise verify its contents without runtime inspection.
|
|
625
|
+
// ---------------------------------------------------------------------------
|
|
626
|
+
export { DEFAULT_DOMAINS as DEFAULT_DOMAINS_TEST_EXPORT };
|
|
@@ -44,6 +44,9 @@ export interface CurrentModelResponse {
|
|
|
44
44
|
readonly configured: boolean;
|
|
45
45
|
readonly configuredVia?: ConfiguredVia;
|
|
46
46
|
}
|
|
47
|
+
export interface PatchCurrentModelResponse extends CurrentModelResponse {
|
|
48
|
+
readonly persisted: boolean;
|
|
49
|
+
}
|
|
47
50
|
export interface ProviderRouteContext {
|
|
48
51
|
readonly providerRegistry: ProviderRegistry;
|
|
49
52
|
readonly configManager: ConfigManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-routes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/daemon/http/provider-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAE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CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAMD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;CACvF;AAyED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAiB1B"}
|
|
@@ -11,27 +11,71 @@
|
|
|
11
11
|
* All routes require the existing daemon bearer-token auth (enforced by the
|
|
12
12
|
* caller — DaemonHttpRouter.handleRequest validates auth before dispatching).
|
|
13
13
|
*/
|
|
14
|
-
import { emitModelChanged } from '../../runtime/emitters/index.js';
|
|
15
14
|
import { findModelDefinition } from '../../providers/registry-models.js';
|
|
16
|
-
import { BUILTIN_PROVIDER_ENV_KEYS } from '../../providers/builtin-catalog.js';
|
|
15
|
+
import { BUILTIN_COMPAT_PROVIDERS, BUILTIN_PROVIDER_ENV_KEYS } from '../../providers/builtin-catalog.js';
|
|
16
|
+
import { logger } from '../../utils/logger.js';
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Provider label map — brand-accurate display names
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const BUILTIN_LABEL_MAP = {
|
|
21
|
+
// Native / first-party providers (not in BUILTIN_COMPAT_PROVIDERS)
|
|
22
|
+
openai: 'OpenAI',
|
|
23
|
+
anthropic: 'Anthropic',
|
|
24
|
+
gemini: 'Gemini',
|
|
25
|
+
inceptionlabs: 'Inception Labs',
|
|
26
|
+
'amazon-bedrock': 'Amazon Bedrock',
|
|
27
|
+
'amazon-bedrock-mantle': 'Amazon Bedrock (Mantle)',
|
|
28
|
+
'anthropic-vertex': 'Anthropic (Vertex)',
|
|
29
|
+
'github-copilot': 'GitHub Copilot',
|
|
30
|
+
groq: 'Groq',
|
|
31
|
+
cerebras: 'Cerebras',
|
|
32
|
+
mistral: 'Mistral',
|
|
33
|
+
'ollama-cloud': 'Ollama Cloud',
|
|
34
|
+
huggingface: 'Hugging Face',
|
|
35
|
+
nvidia: 'NVIDIA',
|
|
36
|
+
llm7: 'LLM7',
|
|
37
|
+
perplexity: 'Perplexity',
|
|
38
|
+
deepgram: 'Deepgram',
|
|
39
|
+
elevenlabs: 'ElevenLabs',
|
|
40
|
+
microsoft: 'Microsoft',
|
|
41
|
+
vydra: 'Vydra',
|
|
42
|
+
byteplus: 'BytePlus',
|
|
43
|
+
fal: 'fal.ai',
|
|
44
|
+
comfy: 'ComfyUI',
|
|
45
|
+
runway: 'Runway',
|
|
46
|
+
alibaba: 'Alibaba Cloud',
|
|
47
|
+
synthetic: 'Synthetic (Local)',
|
|
48
|
+
};
|
|
49
|
+
// Build label map from the compat catalog (these already carry a label field)
|
|
50
|
+
const _catalogLabelMap = {};
|
|
51
|
+
for (const def of BUILTIN_COMPAT_PROVIDERS) {
|
|
52
|
+
if (def.label)
|
|
53
|
+
_catalogLabelMap[def.id] = def.label;
|
|
54
|
+
}
|
|
55
|
+
function getProviderLabel(providerId) {
|
|
56
|
+
return (BUILTIN_LABEL_MAP[providerId] ??
|
|
57
|
+
_catalogLabelMap[providerId] ??
|
|
58
|
+
providerId.charAt(0).toUpperCase() + providerId.slice(1));
|
|
59
|
+
}
|
|
17
60
|
// ---------------------------------------------------------------------------
|
|
18
61
|
// Helpers
|
|
19
62
|
// ---------------------------------------------------------------------------
|
|
20
63
|
function getConfiguredVia(providerId, envVars, providerRegistry) {
|
|
21
|
-
//
|
|
64
|
+
// Tier 1: env var present
|
|
22
65
|
const hasEnvKey = envVars.some((v) => {
|
|
23
66
|
const val = process.env[v];
|
|
24
67
|
return typeof val === 'string' && val.length > 0;
|
|
25
68
|
});
|
|
26
69
|
if (hasEnvKey)
|
|
27
70
|
return 'env';
|
|
28
|
-
//
|
|
29
|
-
|
|
71
|
+
// Tier 2: detect anonymous providers (no env vars required by design)
|
|
72
|
+
const catalogDef = BUILTIN_COMPAT_PROVIDERS.find((d) => d.id === providerId);
|
|
73
|
+
if (catalogDef?.allowAnonymous && catalogDef?.anonymousConfigured)
|
|
74
|
+
return 'anonymous';
|
|
75
|
+
// Tier 3: present in configuredProviderIds but not env — subscription-backed
|
|
30
76
|
const configuredIds = providerRegistry.getConfiguredProviderIds();
|
|
31
|
-
if (configuredIds.includes(providerId))
|
|
32
|
-
// It's configured but not via env — could be subscription or anonymous
|
|
77
|
+
if (configuredIds.includes(providerId))
|
|
33
78
|
return 'subscription';
|
|
34
|
-
}
|
|
35
79
|
return undefined;
|
|
36
80
|
}
|
|
37
81
|
function buildCurrentModelResponse(providerRegistry) {
|
|
@@ -53,10 +97,17 @@ function buildCurrentModelResponse(providerRegistry) {
|
|
|
53
97
|
configuredVia = 'env';
|
|
54
98
|
}
|
|
55
99
|
else {
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
100
|
+
const catalogDef = BUILTIN_COMPAT_PROVIDERS.find((d) => d.id === current.provider);
|
|
101
|
+
if (catalogDef?.allowAnonymous && catalogDef?.anonymousConfigured) {
|
|
58
102
|
configured = true;
|
|
59
|
-
configuredVia = '
|
|
103
|
+
configuredVia = 'anonymous';
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const configuredIds = providerRegistry.getConfiguredProviderIds();
|
|
107
|
+
if (configuredIds.includes(current.provider)) {
|
|
108
|
+
configured = true;
|
|
109
|
+
configuredVia = 'subscription';
|
|
110
|
+
}
|
|
60
111
|
}
|
|
61
112
|
}
|
|
62
113
|
}
|
|
@@ -110,8 +161,7 @@ async function handleListProviders(context) {
|
|
|
110
161
|
const configuredVia = configured
|
|
111
162
|
? getConfiguredVia(providerId, envVars, providerRegistry)
|
|
112
163
|
: undefined;
|
|
113
|
-
|
|
114
|
-
const label = providerId.charAt(0).toUpperCase() + providerId.slice(1);
|
|
164
|
+
const label = getProviderLabel(providerId);
|
|
115
165
|
providers.push({ id: providerId, label, configured, configuredVia, envVars, models });
|
|
116
166
|
}
|
|
117
167
|
// Sort: configured first, then alphabetical
|
|
@@ -134,7 +184,7 @@ async function handleGetCurrentModel(context) {
|
|
|
134
184
|
// PATCH /api/providers/current
|
|
135
185
|
// ---------------------------------------------------------------------------
|
|
136
186
|
async function handlePatchCurrentModel(req, context) {
|
|
137
|
-
const { providerRegistry, configManager
|
|
187
|
+
const { providerRegistry, configManager } = context;
|
|
138
188
|
const bodyOrErr = await context.parseJsonBody(req);
|
|
139
189
|
if (bodyOrErr instanceof Response)
|
|
140
190
|
return bodyOrErr;
|
|
@@ -169,20 +219,17 @@ async function handlePatchCurrentModel(req, context) {
|
|
|
169
219
|
return Response.json({ error: message, code: 'SET_MODEL_FAILED' }, { status: 400 });
|
|
170
220
|
}
|
|
171
221
|
// Persist to config
|
|
222
|
+
let persisted = false;
|
|
172
223
|
try {
|
|
173
224
|
configManager.set('provider.model', modelDef.id);
|
|
174
225
|
configManager.set('provider.provider', modelDef.provider);
|
|
226
|
+
persisted = true;
|
|
175
227
|
}
|
|
176
|
-
catch {
|
|
177
|
-
|
|
228
|
+
catch (persistErr) {
|
|
229
|
+
const msg = persistErr instanceof Error ? persistErr.message : String(persistErr);
|
|
230
|
+
logger.warn(`[provider-routes] Failed to persist model selection to config: ${msg}`);
|
|
178
231
|
}
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
const traceId = `model:changed:${Date.now()}`;
|
|
183
|
-
emitModelChanged(runtimeBus, { sessionId: 'system', source: 'http-api', traceId }, {
|
|
184
|
-
registryKey,
|
|
185
|
-
provider: modelDef.provider,
|
|
186
|
-
});
|
|
187
|
-
return Response.json(buildCurrentModelResponse(providerRegistry));
|
|
232
|
+
// setCurrentModel emits MODEL_CHANGED synchronously on the same runtimeBus —
|
|
233
|
+
// no second emission needed here.
|
|
234
|
+
return Response.json({ ...buildCurrentModelResponse(providerRegistry), persisted });
|
|
188
235
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
let version = '0.21.
|
|
3
|
+
let version = '0.21.3';
|
|
4
4
|
try {
|
|
5
5
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
|
|
6
6
|
version = pkg.version ?? version;
|