@corsair-dev/studio 0.1.2 → 0.1.4

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.
@@ -0,0 +1,50 @@
1
+ export type StoredChat = {
2
+ id: string;
3
+ title: string;
4
+ created_at: number;
5
+ usage_total: ChatUsageTotal;
6
+ };
7
+ export type StoredMsgBlock = {
8
+ type: 'text';
9
+ content: string;
10
+ } | {
11
+ type: 'tool';
12
+ name: string;
13
+ args: unknown;
14
+ result?: unknown;
15
+ };
16
+ export type RawMessageUsage = {
17
+ model: string;
18
+ inputTokens: number;
19
+ outputTokens: number;
20
+ totalTokens: number;
21
+ };
22
+ export type MessageUsage = RawMessageUsage & {
23
+ cost: number | null;
24
+ };
25
+ export type ChatUsageTotal = {
26
+ inputTokens: number;
27
+ outputTokens: number;
28
+ totalTokens: number;
29
+ cost: number;
30
+ hasUnknownCost: boolean;
31
+ };
32
+ export type StoredMessage = {
33
+ id: string;
34
+ chat_id: string;
35
+ role: 'user' | 'assistant';
36
+ blocks: StoredMsgBlock[];
37
+ error: string | null;
38
+ usage: MessageUsage | null;
39
+ };
40
+ export declare function withCost(raw: RawMessageUsage): MessageUsage;
41
+ export declare function aggregateUsage(rows: (MessageUsage | null)[]): ChatUsageTotal;
42
+ export declare function createChat(): Promise<StoredChat>;
43
+ export declare function listChats(): Promise<StoredChat[]>;
44
+ export declare function chatExists(chatId: string): Promise<boolean>;
45
+ export declare function getMessages(chatId: string): Promise<StoredMessage[]>;
46
+ export declare function appendMessage(chatId: string, id: string, role: 'user' | 'assistant', blocks: StoredMsgBlock[], options?: {
47
+ error?: string;
48
+ usage?: RawMessageUsage;
49
+ }): Promise<void>;
50
+ //# sourceMappingURL=chat-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-store.d.ts","sourceRoot":"","sources":["../../../src/server/chat-store.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,MAA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AED,wBAAsB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CActD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CA6BvD;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,oBAS9C;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAqB1E;AAED,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GAAG,WAAW,EAC1B,MAAM,EAAE,cAAc,EAAE,EACxB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAO,iBAoCzD"}
@@ -0,0 +1,3 @@
1
+ import type { HandlerFn } from '../types.js';
2
+ export declare const chatHandler: HandlerFn;
3
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/server/handlers/chat.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuQ7C,eAAO,MAAM,WAAW,EAAE,SA6IzB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { HandlerFn } from '../types.js';
2
+ export declare const listChatsHandler: HandlerFn;
3
+ export declare const createChatHandler: HandlerFn;
4
+ export declare const getChatMessagesHandler: HandlerFn;
5
+ //# sourceMappingURL=chats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../../../src/server/handlers/chats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,SAE9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,SAE/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,SAIpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/server/handlers/operations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAsB1C,eAAO,MAAM,cAAc,EAAE,SAa5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAQhC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SA6B1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SA+BvB,CAAC"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/server/handlers/operations.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiB1C,eAAO,MAAM,cAAc,EAAE,SAa5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAQhC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SA6B1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SA+BvB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type ModelPrice = {
2
+ input: number;
3
+ output: number;
4
+ };
5
+ export declare const MODEL_PRICES: Record<string, ModelPrice>;
6
+ export declare function getModelPrice(modelId: string): ModelPrice | null;
7
+ export type TokenUsage = {
8
+ inputTokens: number;
9
+ outputTokens: number;
10
+ totalTokens: number;
11
+ };
12
+ export declare function computeCost(modelId: string, usage: TokenUsage): number | null;
13
+ //# sourceMappingURL=model-pricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-pricing.d.ts","sourceRoot":"","sources":["../../../src/server/model-pricing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAMF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsEnD,CAAC;AA0CF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAkBhE;AAED,MAAM,MAAM,UAAU,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAS7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/server/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAmBjE,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AAoCrD,wBAAsB,SAAS,CAC9B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED,wBAAsB,YAAY,CACjC,GAAG,EAAE,eAAe,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAoBlC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/server/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAyBjE,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AA8CrD,wBAAsB,SAAS,CAC9B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED,wBAAsB,YAAY,CACjC,GAAG,EAAE,eAAe,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAoBlC"}