@brainpilot/protocol 0.0.4 → 0.0.6
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/__tests__/http.test.d.ts +2 -0
- package/dist/__tests__/http.test.d.ts.map +1 -0
- package/dist/__tests__/http.test.js +22 -0
- package/dist/__tests__/http.test.js.map +1 -0
- package/dist/domain.d.ts +387 -0
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +152 -0
- package/dist/domain.js.map +1 -1
- package/dist/events.d.ts +15 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +15 -0
- package/dist/events.js.map +1 -1
- package/dist/http.d.ts +291 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +75 -1
- package/dist/http.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/http.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { SendMessageRequestSchema } from "../http.js";
|
|
3
|
+
describe("SendMessageRequestSchema", () => {
|
|
4
|
+
it("accepts a normal send-message body", () => {
|
|
5
|
+
const r = SendMessageRequestSchema.safeParse({ content: "hello", agent: "principal" });
|
|
6
|
+
expect(r.success).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
it("accepts a user_input_response answer body", () => {
|
|
9
|
+
const r = SendMessageRequestSchema.safeParse({
|
|
10
|
+
type: "user_input_response",
|
|
11
|
+
session_id: "s1",
|
|
12
|
+
request_id: "req_123",
|
|
13
|
+
answer: "option A",
|
|
14
|
+
});
|
|
15
|
+
expect(r.success).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it("rejects a body that is neither (no content, no answer)", () => {
|
|
18
|
+
const r = SendMessageRequestSchema.safeParse({ foo: "bar" });
|
|
19
|
+
expect(r.success).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=http.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.js","sourceRoot":"","sources":["../../src/__tests__/http.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,GAAG,wBAAwB,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACvF,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,GAAG,wBAAwB,CAAC,SAAS,CAAC;YAC3C,IAAI,EAAE,qBAAqB;YAC3B,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,UAAU;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,CAAC,GAAG,wBAAwB,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7D,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/domain.d.ts
CHANGED
|
@@ -93,6 +93,109 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
93
93
|
} | undefined;
|
|
94
94
|
}>;
|
|
95
95
|
export type AgentState = z.infer<typeof AgentStateSchema>;
|
|
96
|
+
/**
|
|
97
|
+
* Real token usage counters for one accounting unit (a whole session, or a
|
|
98
|
+
* single agent). Sourced from the provider's reported usage (Pi's
|
|
99
|
+
* `AssistantMessage.usage`), accumulated over every assistant turn — NOT a
|
|
100
|
+
* char-count estimate. `total` is the running sum the provider charges against
|
|
101
|
+
* the context window (`input + output + cacheRead + cacheWrite`); we keep it
|
|
102
|
+
* explicit rather than re-deriving so a consumer never has to know the formula.
|
|
103
|
+
*/
|
|
104
|
+
export declare const TokenUsageSchema: z.ZodObject<{
|
|
105
|
+
input: z.ZodNumber;
|
|
106
|
+
output: z.ZodNumber;
|
|
107
|
+
cacheRead: z.ZodNumber;
|
|
108
|
+
cacheWrite: z.ZodNumber;
|
|
109
|
+
total: z.ZodNumber;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
input: number;
|
|
112
|
+
output: number;
|
|
113
|
+
cacheRead: number;
|
|
114
|
+
cacheWrite: number;
|
|
115
|
+
total: number;
|
|
116
|
+
}, {
|
|
117
|
+
input: number;
|
|
118
|
+
output: number;
|
|
119
|
+
cacheRead: number;
|
|
120
|
+
cacheWrite: number;
|
|
121
|
+
total: number;
|
|
122
|
+
}>;
|
|
123
|
+
export type TokenUsage = z.infer<typeof TokenUsageSchema>;
|
|
124
|
+
/**
|
|
125
|
+
* Per-session token accounting: the whole-session `total` plus a per-agent
|
|
126
|
+
* breakdown keyed by agent name (`principal`, expert names, `trace`).
|
|
127
|
+
*/
|
|
128
|
+
export declare const SessionTokenUsageSchema: z.ZodObject<{
|
|
129
|
+
total: z.ZodObject<{
|
|
130
|
+
input: z.ZodNumber;
|
|
131
|
+
output: z.ZodNumber;
|
|
132
|
+
cacheRead: z.ZodNumber;
|
|
133
|
+
cacheWrite: z.ZodNumber;
|
|
134
|
+
total: z.ZodNumber;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
input: number;
|
|
137
|
+
output: number;
|
|
138
|
+
cacheRead: number;
|
|
139
|
+
cacheWrite: number;
|
|
140
|
+
total: number;
|
|
141
|
+
}, {
|
|
142
|
+
input: number;
|
|
143
|
+
output: number;
|
|
144
|
+
cacheRead: number;
|
|
145
|
+
cacheWrite: number;
|
|
146
|
+
total: number;
|
|
147
|
+
}>;
|
|
148
|
+
byAgent: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
149
|
+
input: z.ZodNumber;
|
|
150
|
+
output: z.ZodNumber;
|
|
151
|
+
cacheRead: z.ZodNumber;
|
|
152
|
+
cacheWrite: z.ZodNumber;
|
|
153
|
+
total: z.ZodNumber;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
input: number;
|
|
156
|
+
output: number;
|
|
157
|
+
cacheRead: number;
|
|
158
|
+
cacheWrite: number;
|
|
159
|
+
total: number;
|
|
160
|
+
}, {
|
|
161
|
+
input: number;
|
|
162
|
+
output: number;
|
|
163
|
+
cacheRead: number;
|
|
164
|
+
cacheWrite: number;
|
|
165
|
+
total: number;
|
|
166
|
+
}>>;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
total: {
|
|
169
|
+
input: number;
|
|
170
|
+
output: number;
|
|
171
|
+
cacheRead: number;
|
|
172
|
+
cacheWrite: number;
|
|
173
|
+
total: number;
|
|
174
|
+
};
|
|
175
|
+
byAgent: Record<string, {
|
|
176
|
+
input: number;
|
|
177
|
+
output: number;
|
|
178
|
+
cacheRead: number;
|
|
179
|
+
cacheWrite: number;
|
|
180
|
+
total: number;
|
|
181
|
+
}>;
|
|
182
|
+
}, {
|
|
183
|
+
total: {
|
|
184
|
+
input: number;
|
|
185
|
+
output: number;
|
|
186
|
+
cacheRead: number;
|
|
187
|
+
cacheWrite: number;
|
|
188
|
+
total: number;
|
|
189
|
+
};
|
|
190
|
+
byAgent: Record<string, {
|
|
191
|
+
input: number;
|
|
192
|
+
output: number;
|
|
193
|
+
cacheRead: number;
|
|
194
|
+
cacheWrite: number;
|
|
195
|
+
total: number;
|
|
196
|
+
}>;
|
|
197
|
+
}>;
|
|
198
|
+
export type SessionTokenUsage = z.infer<typeof SessionTokenUsageSchema>;
|
|
96
199
|
/**
|
|
97
200
|
* Authoritative live session state. Identical shape across SSE first frame
|
|
98
201
|
* (`CUSTOM:session_state`), push events, and `GET /sessions/:id/state`.
|
|
@@ -128,6 +231,81 @@ export declare const SessionStateSnapshotSchema: z.ZodObject<{
|
|
|
128
231
|
alive?: boolean | undefined;
|
|
129
232
|
}>, "many">;
|
|
130
233
|
lastActivityTs: z.ZodString;
|
|
234
|
+
/**
|
|
235
|
+
* Cumulative real token usage for this session (total + per-agent). Optional
|
|
236
|
+
* for forward/backward compat: a frame from an older runtime, or before the
|
|
237
|
+
* first assistant turn completes, simply omits it.
|
|
238
|
+
*/
|
|
239
|
+
tokenUsage: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
total: z.ZodObject<{
|
|
241
|
+
input: z.ZodNumber;
|
|
242
|
+
output: z.ZodNumber;
|
|
243
|
+
cacheRead: z.ZodNumber;
|
|
244
|
+
cacheWrite: z.ZodNumber;
|
|
245
|
+
total: z.ZodNumber;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
input: number;
|
|
248
|
+
output: number;
|
|
249
|
+
cacheRead: number;
|
|
250
|
+
cacheWrite: number;
|
|
251
|
+
total: number;
|
|
252
|
+
}, {
|
|
253
|
+
input: number;
|
|
254
|
+
output: number;
|
|
255
|
+
cacheRead: number;
|
|
256
|
+
cacheWrite: number;
|
|
257
|
+
total: number;
|
|
258
|
+
}>;
|
|
259
|
+
byAgent: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
260
|
+
input: z.ZodNumber;
|
|
261
|
+
output: z.ZodNumber;
|
|
262
|
+
cacheRead: z.ZodNumber;
|
|
263
|
+
cacheWrite: z.ZodNumber;
|
|
264
|
+
total: z.ZodNumber;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
input: number;
|
|
267
|
+
output: number;
|
|
268
|
+
cacheRead: number;
|
|
269
|
+
cacheWrite: number;
|
|
270
|
+
total: number;
|
|
271
|
+
}, {
|
|
272
|
+
input: number;
|
|
273
|
+
output: number;
|
|
274
|
+
cacheRead: number;
|
|
275
|
+
cacheWrite: number;
|
|
276
|
+
total: number;
|
|
277
|
+
}>>;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
total: {
|
|
280
|
+
input: number;
|
|
281
|
+
output: number;
|
|
282
|
+
cacheRead: number;
|
|
283
|
+
cacheWrite: number;
|
|
284
|
+
total: number;
|
|
285
|
+
};
|
|
286
|
+
byAgent: Record<string, {
|
|
287
|
+
input: number;
|
|
288
|
+
output: number;
|
|
289
|
+
cacheRead: number;
|
|
290
|
+
cacheWrite: number;
|
|
291
|
+
total: number;
|
|
292
|
+
}>;
|
|
293
|
+
}, {
|
|
294
|
+
total: {
|
|
295
|
+
input: number;
|
|
296
|
+
output: number;
|
|
297
|
+
cacheRead: number;
|
|
298
|
+
cacheWrite: number;
|
|
299
|
+
total: number;
|
|
300
|
+
};
|
|
301
|
+
byAgent: Record<string, {
|
|
302
|
+
input: number;
|
|
303
|
+
output: number;
|
|
304
|
+
cacheRead: number;
|
|
305
|
+
cacheWrite: number;
|
|
306
|
+
total: number;
|
|
307
|
+
}>;
|
|
308
|
+
}>>;
|
|
131
309
|
}, "strip", z.ZodTypeAny, {
|
|
132
310
|
runState: {
|
|
133
311
|
active: boolean;
|
|
@@ -141,6 +319,22 @@ export declare const SessionStateSnapshotSchema: z.ZodObject<{
|
|
|
141
319
|
alive?: boolean | undefined;
|
|
142
320
|
}[];
|
|
143
321
|
lastActivityTs: string;
|
|
322
|
+
tokenUsage?: {
|
|
323
|
+
total: {
|
|
324
|
+
input: number;
|
|
325
|
+
output: number;
|
|
326
|
+
cacheRead: number;
|
|
327
|
+
cacheWrite: number;
|
|
328
|
+
total: number;
|
|
329
|
+
};
|
|
330
|
+
byAgent: Record<string, {
|
|
331
|
+
input: number;
|
|
332
|
+
output: number;
|
|
333
|
+
cacheRead: number;
|
|
334
|
+
cacheWrite: number;
|
|
335
|
+
total: number;
|
|
336
|
+
}>;
|
|
337
|
+
} | undefined;
|
|
144
338
|
}, {
|
|
145
339
|
runState: {
|
|
146
340
|
active: boolean;
|
|
@@ -154,6 +348,22 @@ export declare const SessionStateSnapshotSchema: z.ZodObject<{
|
|
|
154
348
|
alive?: boolean | undefined;
|
|
155
349
|
}[];
|
|
156
350
|
lastActivityTs: string;
|
|
351
|
+
tokenUsage?: {
|
|
352
|
+
total: {
|
|
353
|
+
input: number;
|
|
354
|
+
output: number;
|
|
355
|
+
cacheRead: number;
|
|
356
|
+
cacheWrite: number;
|
|
357
|
+
total: number;
|
|
358
|
+
};
|
|
359
|
+
byAgent: Record<string, {
|
|
360
|
+
input: number;
|
|
361
|
+
output: number;
|
|
362
|
+
cacheRead: number;
|
|
363
|
+
cacheWrite: number;
|
|
364
|
+
total: number;
|
|
365
|
+
}>;
|
|
366
|
+
} | undefined;
|
|
157
367
|
}>;
|
|
158
368
|
export type SessionStateSnapshot = z.infer<typeof SessionStateSnapshotSchema>;
|
|
159
369
|
export declare const TraceNodeStatusSchema: z.ZodUnion<[z.ZodEnum<["pending", "running", "completed", "error"]>, z.ZodString]>;
|
|
@@ -618,6 +828,56 @@ export declare const McpServerEntrySchema: z.ZodObject<{
|
|
|
618
828
|
timeout?: number | undefined;
|
|
619
829
|
}>;
|
|
620
830
|
export type McpServerEntry = z.infer<typeof McpServerEntrySchema>;
|
|
831
|
+
export declare const McpServerConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
832
|
+
type: z.ZodLiteral<"stdio">;
|
|
833
|
+
command: z.ZodString;
|
|
834
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
835
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
836
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
837
|
+
}, "strip", z.ZodTypeAny, {
|
|
838
|
+
type: "stdio";
|
|
839
|
+
command: string;
|
|
840
|
+
args?: string[] | undefined;
|
|
841
|
+
env?: Record<string, string> | undefined;
|
|
842
|
+
timeout?: number | undefined;
|
|
843
|
+
}, {
|
|
844
|
+
type: "stdio";
|
|
845
|
+
command: string;
|
|
846
|
+
args?: string[] | undefined;
|
|
847
|
+
env?: Record<string, string> | undefined;
|
|
848
|
+
timeout?: number | undefined;
|
|
849
|
+
}>, z.ZodObject<{
|
|
850
|
+
type: z.ZodLiteral<"http">;
|
|
851
|
+
url: z.ZodString;
|
|
852
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
853
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
854
|
+
}, "strip", z.ZodTypeAny, {
|
|
855
|
+
type: "http";
|
|
856
|
+
url: string;
|
|
857
|
+
headers?: Record<string, string> | undefined;
|
|
858
|
+
timeout?: number | undefined;
|
|
859
|
+
}, {
|
|
860
|
+
type: "http";
|
|
861
|
+
url: string;
|
|
862
|
+
headers?: Record<string, string> | undefined;
|
|
863
|
+
timeout?: number | undefined;
|
|
864
|
+
}>, z.ZodObject<{
|
|
865
|
+
type: z.ZodLiteral<"sse">;
|
|
866
|
+
url: z.ZodString;
|
|
867
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
868
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
869
|
+
}, "strip", z.ZodTypeAny, {
|
|
870
|
+
type: "sse";
|
|
871
|
+
url: string;
|
|
872
|
+
headers?: Record<string, string> | undefined;
|
|
873
|
+
timeout?: number | undefined;
|
|
874
|
+
}, {
|
|
875
|
+
type: "sse";
|
|
876
|
+
url: string;
|
|
877
|
+
headers?: Record<string, string> | undefined;
|
|
878
|
+
timeout?: number | undefined;
|
|
879
|
+
}>]>;
|
|
880
|
+
export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
|
|
621
881
|
export declare const HealthStatusSchema: z.ZodEnum<["healthy", "degraded", "unavailable", "unknown"]>;
|
|
622
882
|
export type HealthStatus = z.infer<typeof HealthStatusSchema>;
|
|
623
883
|
export declare const ModelHealthSchema: z.ZodObject<{
|
|
@@ -640,10 +900,44 @@ export declare const ModelHealthSchema: z.ZodObject<{
|
|
|
640
900
|
checkedAt?: number | undefined;
|
|
641
901
|
}>;
|
|
642
902
|
export type ModelHealth = z.infer<typeof ModelHealthSchema>;
|
|
903
|
+
/**
|
|
904
|
+
* #63: the wire protocol BrainPilot speaks to a provider's gateway. These map
|
|
905
|
+
* 1:1 to Pi's models.json `providers.<id>.api` values; the runtime writes the
|
|
906
|
+
* selected value into the per-session models.json instead of hardcoding
|
|
907
|
+
* `anthropic-messages`. Azure needs only this + the Azure base URL (Pi derives
|
|
908
|
+
* api-version/deployment), so all four configure identically from the UI.
|
|
909
|
+
*/
|
|
910
|
+
export declare const ProviderApiSchema: z.ZodEnum<["anthropic-messages", "openai-completions", "openai-responses", "azure-openai-responses"]>;
|
|
911
|
+
export type ProviderApi = z.infer<typeof ProviderApiSchema>;
|
|
912
|
+
/**
|
|
913
|
+
* #68 (R-10): coarse provider family the UI/hosted layer declares — "which kind
|
|
914
|
+
* of endpoint is this base URL". This is the user-facing intent; `api` (above)
|
|
915
|
+
* is the precise Pi wire value the runtime executes. `auto` means "infer"
|
|
916
|
+
* (the runtime derives `api` from the base URL / falls back to the default).
|
|
917
|
+
* Optional so single-user / open-source deploys can omit it (defaults to
|
|
918
|
+
* `auto` semantically). When `api` is unset, the runtime derives it from
|
|
919
|
+
* `adapter`: anthropic→anthropic-messages, openai→openai-completions,
|
|
920
|
+
* auto→default.
|
|
921
|
+
*/
|
|
922
|
+
export declare const ProviderAdapterSchema: z.ZodEnum<["auto", "openai", "anthropic"]>;
|
|
923
|
+
export type ProviderAdapter = z.infer<typeof ProviderAdapterSchema>;
|
|
924
|
+
/**
|
|
925
|
+
* #75: single source of truth for adapter→api derivation, shared by the backend
|
|
926
|
+
* (so create/echo never persist a default that contradicts the adapter) and the
|
|
927
|
+
* runtime (so the wire value it writes matches). `anthropic`→anthropic-messages,
|
|
928
|
+
* `openai`→openai-completions; `auto`/undefined → undefined (caller falls back
|
|
929
|
+
* to its own default). Keeping this in protocol prevents the two layers from
|
|
930
|
+
* drifting (the footgun #75 surfaced: backend defaulting api to
|
|
931
|
+
* anthropic-messages short-circuited the runtime's adapter fallback).
|
|
932
|
+
*/
|
|
933
|
+
export declare function deriveProviderApi(adapter?: ProviderAdapter): ProviderApi | undefined;
|
|
643
934
|
export declare const ProviderProfileSchema: z.ZodObject<{
|
|
644
935
|
id: z.ZodString;
|
|
645
936
|
name: z.ZodString;
|
|
646
937
|
baseUrl: z.ZodString;
|
|
938
|
+
api: z.ZodEnum<["anthropic-messages", "openai-completions", "openai-responses", "azure-openai-responses"]>;
|
|
939
|
+
adapter: z.ZodOptional<z.ZodEnum<["auto", "openai", "anthropic"]>>;
|
|
940
|
+
isShared: z.ZodBoolean;
|
|
647
941
|
models: z.ZodArray<z.ZodString, "many">;
|
|
648
942
|
icon: z.ZodString;
|
|
649
943
|
iconColor: z.ZodString;
|
|
@@ -679,6 +973,8 @@ export declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
679
973
|
updatedAt: number;
|
|
680
974
|
name: string;
|
|
681
975
|
baseUrl: string;
|
|
976
|
+
api: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses";
|
|
977
|
+
isShared: boolean;
|
|
682
978
|
models: string[];
|
|
683
979
|
icon: string;
|
|
684
980
|
iconColor: string;
|
|
@@ -693,6 +989,7 @@ export declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
693
989
|
latencyMs?: number | undefined;
|
|
694
990
|
checkedAt?: number | undefined;
|
|
695
991
|
}[];
|
|
992
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
696
993
|
healthCheckedAt?: number | undefined;
|
|
697
994
|
}, {
|
|
698
995
|
id: string;
|
|
@@ -700,6 +997,8 @@ export declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
700
997
|
updatedAt: number;
|
|
701
998
|
name: string;
|
|
702
999
|
baseUrl: string;
|
|
1000
|
+
api: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses";
|
|
1001
|
+
isShared: boolean;
|
|
703
1002
|
models: string[];
|
|
704
1003
|
icon: string;
|
|
705
1004
|
iconColor: string;
|
|
@@ -714,9 +1013,97 @@ export declare const ProviderProfileSchema: z.ZodObject<{
|
|
|
714
1013
|
latencyMs?: number | undefined;
|
|
715
1014
|
checkedAt?: number | undefined;
|
|
716
1015
|
}[];
|
|
1016
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
717
1017
|
healthCheckedAt?: number | undefined;
|
|
718
1018
|
}>;
|
|
719
1019
|
export type ProviderProfile = z.infer<typeof ProviderProfileSchema>;
|
|
1020
|
+
export declare const ProviderProfileCreateSchema: z.ZodObject<{
|
|
1021
|
+
name: z.ZodString;
|
|
1022
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
1023
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1024
|
+
api: z.ZodOptional<z.ZodEnum<["anthropic-messages", "openai-completions", "openai-responses", "azure-openai-responses"]>>;
|
|
1025
|
+
adapter: z.ZodOptional<z.ZodEnum<["auto", "openai", "anthropic"]>>;
|
|
1026
|
+
api_key: z.ZodOptional<z.ZodString>;
|
|
1027
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
1028
|
+
models: z.ZodArray<z.ZodString, "many">;
|
|
1029
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1030
|
+
icon_color: z.ZodOptional<z.ZodString>;
|
|
1031
|
+
iconColor: z.ZodOptional<z.ZodString>;
|
|
1032
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
1033
|
+
}, "strip", z.ZodTypeAny, {
|
|
1034
|
+
name: string;
|
|
1035
|
+
models: string[];
|
|
1036
|
+
apiKey?: string | undefined;
|
|
1037
|
+
baseUrl?: string | undefined;
|
|
1038
|
+
api?: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses" | undefined;
|
|
1039
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
1040
|
+
icon?: string | undefined;
|
|
1041
|
+
iconColor?: string | undefined;
|
|
1042
|
+
notes?: string | undefined;
|
|
1043
|
+
base_url?: string | undefined;
|
|
1044
|
+
api_key?: string | undefined;
|
|
1045
|
+
icon_color?: string | undefined;
|
|
1046
|
+
}, {
|
|
1047
|
+
name: string;
|
|
1048
|
+
models: string[];
|
|
1049
|
+
apiKey?: string | undefined;
|
|
1050
|
+
baseUrl?: string | undefined;
|
|
1051
|
+
api?: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses" | undefined;
|
|
1052
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
1053
|
+
icon?: string | undefined;
|
|
1054
|
+
iconColor?: string | undefined;
|
|
1055
|
+
notes?: string | undefined;
|
|
1056
|
+
base_url?: string | undefined;
|
|
1057
|
+
api_key?: string | undefined;
|
|
1058
|
+
icon_color?: string | undefined;
|
|
1059
|
+
}>;
|
|
1060
|
+
export type ProviderProfileCreate = z.infer<typeof ProviderProfileCreateSchema>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Update is a partial patch: every field optional (omitting `models` leaves it
|
|
1063
|
+
* unchanged), but each field keeps its create-time rule when present — so a
|
|
1064
|
+
* supplied `models` must still be a non-empty array (#61).
|
|
1065
|
+
*/
|
|
1066
|
+
export declare const ProviderProfileUpdateSchema: z.ZodObject<{
|
|
1067
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1068
|
+
base_url: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1069
|
+
baseUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1070
|
+
api: z.ZodOptional<z.ZodOptional<z.ZodEnum<["anthropic-messages", "openai-completions", "openai-responses", "azure-openai-responses"]>>>;
|
|
1071
|
+
adapter: z.ZodOptional<z.ZodOptional<z.ZodEnum<["auto", "openai", "anthropic"]>>>;
|
|
1072
|
+
api_key: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1073
|
+
apiKey: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1074
|
+
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1075
|
+
icon: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1076
|
+
icon_color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1077
|
+
iconColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1078
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1079
|
+
}, "strip", z.ZodTypeAny, {
|
|
1080
|
+
name?: string | undefined;
|
|
1081
|
+
apiKey?: string | undefined;
|
|
1082
|
+
baseUrl?: string | undefined;
|
|
1083
|
+
api?: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses" | undefined;
|
|
1084
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
1085
|
+
models?: string[] | undefined;
|
|
1086
|
+
icon?: string | undefined;
|
|
1087
|
+
iconColor?: string | undefined;
|
|
1088
|
+
notes?: string | undefined;
|
|
1089
|
+
base_url?: string | undefined;
|
|
1090
|
+
api_key?: string | undefined;
|
|
1091
|
+
icon_color?: string | undefined;
|
|
1092
|
+
}, {
|
|
1093
|
+
name?: string | undefined;
|
|
1094
|
+
apiKey?: string | undefined;
|
|
1095
|
+
baseUrl?: string | undefined;
|
|
1096
|
+
api?: "anthropic-messages" | "openai-completions" | "openai-responses" | "azure-openai-responses" | undefined;
|
|
1097
|
+
adapter?: "auto" | "openai" | "anthropic" | undefined;
|
|
1098
|
+
models?: string[] | undefined;
|
|
1099
|
+
icon?: string | undefined;
|
|
1100
|
+
iconColor?: string | undefined;
|
|
1101
|
+
notes?: string | undefined;
|
|
1102
|
+
base_url?: string | undefined;
|
|
1103
|
+
api_key?: string | undefined;
|
|
1104
|
+
icon_color?: string | undefined;
|
|
1105
|
+
}>;
|
|
1106
|
+
export type ProviderProfileUpdate = z.infer<typeof ProviderProfileUpdateSchema>;
|
|
720
1107
|
export declare const FileEntrySchema: z.ZodObject<{
|
|
721
1108
|
name: z.ZodString;
|
|
722
1109
|
type: z.ZodEnum<["file", "folder", "symlink"]>;
|
package/dist/domain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAKxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAMpD,gCAAgC;AAChC,eAAO,MAAM,qBAAqB,oDAAkD,CAAC;AACrF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,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