quassel 0.1.0

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,62 @@
1
+ import { ChatEvent } from "../events";
2
+ /** Konfiguration gegen ein OpenAI-kompatibles Backend (OpenRouter, Ollama, vLLM, ...). */
3
+ export interface AgentConfig {
4
+ baseUrl: string;
5
+ model: string;
6
+ apiKey?: string;
7
+ systemPrompt?: string;
8
+ temperature?: number;
9
+ topP?: number;
10
+ maxTokens?: number;
11
+ headers?: Record<string, string>;
12
+ tools?: AgentTool[];
13
+ }
14
+ export interface AgentTool {
15
+ name: string;
16
+ description: string;
17
+ parameters: object;
18
+ run: (args: unknown) => Promise<string> | string;
19
+ }
20
+ export interface OpenAiToolCall {
21
+ id: string;
22
+ type: "function";
23
+ function: {
24
+ name: string;
25
+ arguments: string;
26
+ };
27
+ }
28
+ export interface OpenAiMessage {
29
+ role: "system" | "user" | "assistant" | "tool";
30
+ content: string | null;
31
+ tool_calls?: OpenAiToolCall[];
32
+ tool_call_id?: string;
33
+ }
34
+ export interface SessionState {
35
+ id: string;
36
+ events: ChatEvent[];
37
+ history: OpenAiMessage[];
38
+ updatedAt: number;
39
+ }
40
+ export interface SessionInfo {
41
+ id: string;
42
+ title: string;
43
+ updatedAt: number;
44
+ }
45
+ /** Was der HTTP-Adapter von einer Unterhaltung braucht - AgentSession erfüllt das, andere Backends auch. */
46
+ export interface ChatSessionLike {
47
+ readonly running: boolean;
48
+ subscribe(listener: (event: import("../events").ChatEvent) => void): () => void;
49
+ send(text: string): void;
50
+ stop(): void;
51
+ }
52
+ export interface ChatSessionProvider {
53
+ get(id: string): Promise<ChatSessionLike>;
54
+ list(): Promise<SessionInfo[]>;
55
+ delete(id: string): Promise<void>;
56
+ }
57
+ export interface SessionStore {
58
+ load(id: string): Promise<SessionState | undefined>;
59
+ save(state: SessionState): Promise<void>;
60
+ list(): Promise<SessionInfo[]>;
61
+ delete(id: string): Promise<void>;
62
+ }
package/texts.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ export interface ChatTexts {
2
+ working: string;
3
+ toolRunning: string;
4
+ toolStillRunning: string;
5
+ thinkingChip: string;
6
+ stepGroupOne: string;
7
+ stepGroupMany: string;
8
+ stepGroupCollapse: string;
9
+ thinkingTitle: string;
10
+ toolTitle: string;
11
+ argumentsLabel: string;
12
+ resultLabel: string;
13
+ close: string;
14
+ jumpToEnd: string;
15
+ send: string;
16
+ sendIntoRun: string;
17
+ stop: string;
18
+ placeholder: string;
19
+ steeringPlaceholder: string;
20
+ timestamps: string;
21
+ messageActions: string;
22
+ questionSubmit: string;
23
+ questionPlaceholder: string;
24
+ questionAnswer: string;
25
+ copyMessage: string;
26
+ copyCode: string;
27
+ copied: string;
28
+ copyFailed: string;
29
+ editMessage: string;
30
+ retryMessage: string;
31
+ detailModeTitle: string;
32
+ detailModeOff: string;
33
+ detailModeIcons: string;
34
+ detailModeChips: string;
35
+ detailModeGrouped: string;
36
+ detailModeCompact: string;
37
+ detailModeFull: string;
38
+ }
39
+ export declare const defaultTexts: ChatTexts;
@@ -0,0 +1,5 @@
1
+ import type { TimestampOptions } from "./options";
2
+ export declare function timestampDate(at?: string): Date | undefined;
3
+ export declare function formatTimestamp(date: Date, options?: TimestampOptions, now?: number): string;
4
+ export declare function timestampDay(date: Date, timeZone?: string): string;
5
+ export declare function formatDay(date: Date, options?: TimestampOptions): string;
package/types.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { Message } from "./events";
2
+ export type { Role, ToolInfo, Question, Message, ChatEvent } from "./events";
3
+ export { applyEvent, prettyJson, compactToolLine } from "./events";
4
+ /**
5
+ * off = nur Antworten, icons = Schritte als reine Symbole nebeneinander,
6
+ * chips = Schritte als Symbol + Kurztext nebeneinander (mit Umbruch),
7
+ * grouped = aufeinanderfolgende Schritte hinter einer aufklappbaren Kopfzeile, darin einzeilig,
8
+ * compact = Denken und Werkzeuge einzeilig, full = alles ausgeklappt.
9
+ */
10
+ export type DetailMode = "off" | "icons" | "chips" | "grouped" | "compact" | "full";
11
+ /** running = call still open, thinking = thought block still open, done = finished, error = failed. */
12
+ export type StepState = "running" | "thinking" | "done" | "error";
13
+ /** The single derivation of a step state, so chips, hosts and tests read the same signal. */
14
+ export declare function stepState(message: Message): StepState;
15
+ /** A moment worth one screen reader announcement: a finished reply or a new open question. */
16
+ export type ChatAnnouncement = {
17
+ kind: "reply";
18
+ message: Message;
19
+ } | {
20
+ kind: "question";
21
+ message: Message;
22
+ };
package/useChat.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { ChatEvent, Message } from "./events";
2
+ /**
3
+ * Verbindet die Chat-Komponenten mit einem quassel/server-Endpunkt: ein dauerhafter
4
+ * SSE-Strom liefert erst den Verlauf, dann live; Senden und Stoppen sind eigene Aufrufe
5
+ * und erreichen so auch einen laufenden Turn. Bricht der Strom ab, verbindet der Hook
6
+ * nach 3 Sekunden neu.
7
+ */
8
+ export declare function useChat(baseUrl: string, headers?: Record<string, string>, onEvent?: (event: ChatEvent) => void): {
9
+ messages: Message[];
10
+ running: boolean;
11
+ connected: boolean;
12
+ send: (text: string) => Promise<void>;
13
+ stop: () => Promise<void>;
14
+ };