@microboxlabs/miot-chat 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,107 @@
1
+ import { RunMode, MiotHarnessClient } from '@microboxlabs/miot-harness-client';
2
+
3
+ interface MiotChatProfile {
4
+ baseUrl: string;
5
+ token: string | null;
6
+ tenantId: string;
7
+ userId: string;
8
+ mode?: RunMode;
9
+ /**
10
+ * Organization slug; when set, runs route through the quarkus-srv harness
11
+ * proxy at {baseUrl}/api/v1/orgs/{orgSlug}/harness.
12
+ */
13
+ orgSlug?: string;
14
+ }
15
+ type ThemeConfig = string | {
16
+ name?: string;
17
+ tokens?: Record<string, string>;
18
+ };
19
+ interface MiotChatConfig {
20
+ defaultProfile: string;
21
+ profiles: Record<string, MiotChatProfile>;
22
+ theme?: ThemeConfig;
23
+ }
24
+ interface ResolvedConfig {
25
+ baseUrl: string;
26
+ token: string | null;
27
+ tenantId: string;
28
+ userId: string;
29
+ mode: RunMode;
30
+ profileName: string;
31
+ theme: ThemeConfig | null;
32
+ /**
33
+ * When true, outgoing runs request debug=true so the SSE stream
34
+ * carries full tool inputs and truncated tool outputs. Requires
35
+ * the server-side allow-list to permit the tenant.
36
+ */
37
+ debug: boolean;
38
+ /** Org slug resolved from flag > env > profile, or null when not set. */
39
+ orgSlug: string | null;
40
+ /**
41
+ * Effective base URL for the harness client — the quarkus proxy prefix
42
+ * ({baseUrl}/api/v1/orgs/{orgSlug}/harness) when orgSlug is set,
43
+ * otherwise baseUrl unchanged.
44
+ */
45
+ harnessBaseUrl: string;
46
+ }
47
+ interface CliFlags {
48
+ baseUrl?: string;
49
+ token?: string;
50
+ tenant?: string;
51
+ user?: string;
52
+ mode?: string;
53
+ profile?: string;
54
+ debug?: boolean;
55
+ org?: string;
56
+ }
57
+ interface ResolveOptions {
58
+ flags?: CliFlags;
59
+ env?: NodeJS.ProcessEnv;
60
+ configDir?: string;
61
+ }
62
+ declare const DEFAULT_CONFIG: MiotChatConfig;
63
+ declare function getConfigDir(env?: NodeJS.ProcessEnv): string;
64
+ declare function getConfigPath(env?: NodeJS.ProcessEnv): string;
65
+ declare function readConfig(opts?: {
66
+ configDir?: string;
67
+ }): MiotChatConfig;
68
+ declare function writeConfig(cfg: MiotChatConfig, opts?: {
69
+ configDir?: string;
70
+ }): void;
71
+ declare function resolveConfig(opts?: ResolveOptions): ResolvedConfig;
72
+
73
+ interface RunMiotChatOptions {
74
+ config: ResolvedConfig;
75
+ client: MiotHarnessClient;
76
+ env?: NodeJS.ProcessEnv;
77
+ stdin?: {
78
+ isTTY?: boolean;
79
+ };
80
+ stdout?: {
81
+ isTTY?: boolean;
82
+ };
83
+ /**
84
+ * Optional conversation id to forward to the headless REPL. Ignored
85
+ * in TUI mode (the user picks via /resume). Mirrors the legacy
86
+ * `miot-chat resume` flow.
87
+ */
88
+ conversationId?: string;
89
+ }
90
+ declare function shouldUseTui(env: NodeJS.ProcessEnv, stdin: {
91
+ isTTY?: boolean;
92
+ }, stdout: {
93
+ isTTY?: boolean;
94
+ }): boolean;
95
+ declare function runMiotChat(opts: RunMiotChatOptions): Promise<number>;
96
+
97
+ interface AskOptions {
98
+ message: string;
99
+ config: ResolvedConfig;
100
+ conversationId?: string;
101
+ stdout?: NodeJS.WritableStream;
102
+ stderr?: NodeJS.WritableStream;
103
+ noColor?: boolean;
104
+ }
105
+ declare function runAsk(opts: AskOptions): Promise<number>;
106
+
107
+ export { type AskOptions, type CliFlags, DEFAULT_CONFIG, type MiotChatConfig, type MiotChatProfile, type ResolveOptions, type ResolvedConfig, type RunMiotChatOptions, type ThemeConfig, getConfigDir, getConfigPath, readConfig, resolveConfig, runAsk, runMiotChat, shouldUseTui, writeConfig };