sa2kit 3.3.0 → 3.6.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.
Files changed (143) hide show
  1. package/dist/{chunk-LGVPFYPR.mjs → chunk-4H3SGG3T.mjs} +27 -3
  2. package/dist/chunk-4H3SGG3T.mjs.map +1 -0
  3. package/dist/{chunk-KVYHCGRY.js → chunk-7Z3XR2Y4.js} +552 -263
  4. package/dist/chunk-7Z3XR2Y4.js.map +1 -0
  5. package/dist/{chunk-5H2FICSO.js → chunk-LBMUIWJR.js} +27 -3
  6. package/dist/chunk-LBMUIWJR.js.map +1 -0
  7. package/dist/chunk-XPY45Y75.js +1143 -0
  8. package/dist/chunk-XPY45Y75.js.map +1 -0
  9. package/dist/{chunk-YIRPPMCN.mjs → chunk-XSTMLLJV.mjs} +474 -198
  10. package/dist/chunk-XSTMLLJV.mjs.map +1 -0
  11. package/dist/chunk-ZJLS5JU5.mjs +1090 -0
  12. package/dist/chunk-ZJLS5JU5.mjs.map +1 -0
  13. package/dist/common/aiApi/client/index.d.mts +71 -0
  14. package/dist/common/aiApi/client/index.d.ts +71 -0
  15. package/dist/common/aiApi/client/index.js +165 -0
  16. package/dist/common/aiApi/client/index.js.map +1 -0
  17. package/dist/common/aiApi/client/index.mjs +151 -0
  18. package/dist/common/aiApi/client/index.mjs.map +1 -0
  19. package/dist/common/aiApi/index.d.mts +184 -0
  20. package/dist/common/aiApi/index.d.ts +184 -0
  21. package/dist/common/aiApi/index.js +217 -0
  22. package/dist/common/aiApi/index.mjs +4 -0
  23. package/dist/common/aiApi/server/index.d.mts +3 -0
  24. package/dist/common/aiApi/server/index.d.ts +3 -0
  25. package/dist/common/aiApi/server/index.js +217 -0
  26. package/dist/common/aiApi/server/index.mjs +4 -0
  27. package/dist/common/auth/server/index.js +8 -8
  28. package/dist/common/auth/server/index.mjs +2 -2
  29. package/dist/common/components/index.js +176 -177
  30. package/dist/common/components/index.mjs +1 -2
  31. package/dist/common/config/bootstrap/index.d.mts +24 -0
  32. package/dist/common/config/bootstrap/index.d.ts +24 -0
  33. package/dist/common/config/bootstrap/index.js +15 -15
  34. package/dist/common/config/bootstrap/index.mjs +1 -1
  35. package/dist/common/config/server/index.js +14 -14
  36. package/dist/common/config/server/index.mjs +1 -1
  37. package/dist/common/index.js +2 -3
  38. package/dist/common/index.mjs +1 -2
  39. package/dist/index.d.mts +314 -154
  40. package/dist/index.d.ts +314 -154
  41. package/dist/index.js +1055 -369
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +1005 -360
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/types-CiqMQ-uu.d.mts +166 -0
  46. package/dist/types-CiqMQ-uu.d.ts +166 -0
  47. package/package.json +15 -50
  48. package/dist/chunk-3R6JHA6D.js +0 -120
  49. package/dist/chunk-3R6JHA6D.js.map +0 -1
  50. package/dist/chunk-4PJM4752.js +0 -4
  51. package/dist/chunk-4PJM4752.js.map +0 -1
  52. package/dist/chunk-5H2FICSO.js.map +0 -1
  53. package/dist/chunk-7PMT4L4I.js +0 -324
  54. package/dist/chunk-7PMT4L4I.js.map +0 -1
  55. package/dist/chunk-FY2X3LYR.mjs +0 -3
  56. package/dist/chunk-FY2X3LYR.mjs.map +0 -1
  57. package/dist/chunk-GS4SAW25.mjs +0 -116
  58. package/dist/chunk-GS4SAW25.mjs.map +0 -1
  59. package/dist/chunk-HL4H2HF6.js +0 -279
  60. package/dist/chunk-HL4H2HF6.js.map +0 -1
  61. package/dist/chunk-IJIQUMAK.mjs +0 -272
  62. package/dist/chunk-IJIQUMAK.mjs.map +0 -1
  63. package/dist/chunk-KVYHCGRY.js.map +0 -1
  64. package/dist/chunk-LGVPFYPR.mjs.map +0 -1
  65. package/dist/chunk-MMDSZIXD.mjs +0 -286
  66. package/dist/chunk-MMDSZIXD.mjs.map +0 -1
  67. package/dist/chunk-N2O3OX5Y.mjs +0 -243
  68. package/dist/chunk-N2O3OX5Y.mjs.map +0 -1
  69. package/dist/chunk-RRQ2X26Z.js +0 -106
  70. package/dist/chunk-RRQ2X26Z.js.map +0 -1
  71. package/dist/chunk-RVNQI6BI.js +0 -249
  72. package/dist/chunk-RVNQI6BI.js.map +0 -1
  73. package/dist/chunk-UJUWDF7M.mjs +0 -336
  74. package/dist/chunk-UJUWDF7M.mjs.map +0 -1
  75. package/dist/chunk-VCKXK6V5.js +0 -345
  76. package/dist/chunk-VCKXK6V5.js.map +0 -1
  77. package/dist/chunk-VIEXDTNF.mjs +0 -100
  78. package/dist/chunk-VIEXDTNF.mjs.map +0 -1
  79. package/dist/chunk-YIRPPMCN.mjs.map +0 -1
  80. package/dist/common/ai/llm/core/index.d.mts +0 -70
  81. package/dist/common/ai/llm/core/index.d.ts +0 -70
  82. package/dist/common/ai/llm/core/index.js +0 -54
  83. package/dist/common/ai/llm/core/index.mjs +0 -5
  84. package/dist/common/ai/llm/electron/index.d.mts +0 -6
  85. package/dist/common/ai/llm/electron/index.d.ts +0 -6
  86. package/dist/common/ai/llm/electron/index.js +0 -67
  87. package/dist/common/ai/llm/electron/index.mjs +0 -10
  88. package/dist/common/ai/llm/index.d.mts +0 -3
  89. package/dist/common/ai/llm/index.d.ts +0 -3
  90. package/dist/common/ai/llm/index.js +0 -54
  91. package/dist/common/ai/llm/index.js.map +0 -1
  92. package/dist/common/ai/llm/index.mjs +0 -5
  93. package/dist/common/ai/llm/index.mjs.map +0 -1
  94. package/dist/common/ai/llm/miniapp/index.d.mts +0 -6
  95. package/dist/common/ai/llm/miniapp/index.d.ts +0 -6
  96. package/dist/common/ai/llm/miniapp/index.js +0 -59
  97. package/dist/common/ai/llm/miniapp/index.js.map +0 -1
  98. package/dist/common/ai/llm/miniapp/index.mjs +0 -6
  99. package/dist/common/ai/llm/miniapp/index.mjs.map +0 -1
  100. package/dist/common/ai/llm/rn/index.d.mts +0 -6
  101. package/dist/common/ai/llm/rn/index.d.ts +0 -6
  102. package/dist/common/ai/llm/rn/index.js +0 -59
  103. package/dist/common/ai/llm/rn/index.js.map +0 -1
  104. package/dist/common/ai/llm/rn/index.mjs +0 -6
  105. package/dist/common/ai/llm/rn/index.mjs.map +0 -1
  106. package/dist/common/ai/llm/ui/electron/index.d.mts +0 -5
  107. package/dist/common/ai/llm/ui/electron/index.d.ts +0 -5
  108. package/dist/common/ai/llm/ui/electron/index.js +0 -22
  109. package/dist/common/ai/llm/ui/electron/index.js.map +0 -1
  110. package/dist/common/ai/llm/ui/electron/index.mjs +0 -9
  111. package/dist/common/ai/llm/ui/electron/index.mjs.map +0 -1
  112. package/dist/common/ai/llm/ui/miniapp/index.d.mts +0 -9
  113. package/dist/common/ai/llm/ui/miniapp/index.d.ts +0 -9
  114. package/dist/common/ai/llm/ui/miniapp/index.js +0 -14
  115. package/dist/common/ai/llm/ui/miniapp/index.js.map +0 -1
  116. package/dist/common/ai/llm/ui/miniapp/index.mjs +0 -5
  117. package/dist/common/ai/llm/ui/miniapp/index.mjs.map +0 -1
  118. package/dist/common/ai/llm/ui/rn/index.d.mts +0 -9
  119. package/dist/common/ai/llm/ui/rn/index.d.ts +0 -9
  120. package/dist/common/ai/llm/ui/rn/index.js +0 -14
  121. package/dist/common/ai/llm/ui/rn/index.js.map +0 -1
  122. package/dist/common/ai/llm/ui/rn/index.mjs +0 -5
  123. package/dist/common/ai/llm/ui/rn/index.mjs.map +0 -1
  124. package/dist/common/ai/llm/ui/web/index.d.mts +0 -15
  125. package/dist/common/ai/llm/ui/web/index.d.ts +0 -15
  126. package/dist/common/ai/llm/ui/web/index.js +0 -21
  127. package/dist/common/ai/llm/ui/web/index.js.map +0 -1
  128. package/dist/common/ai/llm/ui/web/index.mjs +0 -8
  129. package/dist/common/ai/llm/ui/web/index.mjs.map +0 -1
  130. package/dist/common/ai/llm/web/index.d.mts +0 -6
  131. package/dist/common/ai/llm/web/index.d.ts +0 -6
  132. package/dist/common/ai/llm/web/index.js +0 -66
  133. package/dist/common/ai/llm/web/index.js.map +0 -1
  134. package/dist/common/ai/llm/web/index.mjs +0 -9
  135. package/dist/common/ai/llm/web/index.mjs.map +0 -1
  136. package/dist/types-B2rs_jq1.d.mts +0 -38
  137. package/dist/types-DgACCUpT.d.ts +0 -122
  138. package/dist/types-DwS2Eg0q.d.ts +0 -38
  139. package/dist/types-LU_BGSzk.d.mts +0 -122
  140. /package/dist/common/{ai/llm/core → aiApi}/index.js.map +0 -0
  141. /package/dist/common/{ai/llm/core → aiApi}/index.mjs.map +0 -0
  142. /package/dist/common/{ai/llm/electron → aiApi/server}/index.js.map +0 -0
  143. /package/dist/common/{ai/llm/electron → aiApi/server}/index.mjs.map +0 -0
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkHL4H2HF6_js = require('../../../../chunk-HL4H2HF6.js');
4
- var chunkVCKXK6V5_js = require('../../../../chunk-VCKXK6V5.js');
5
- var chunk3R6JHA6D_js = require('../../../../chunk-3R6JHA6D.js');
6
- require('../../../../chunk-7PMT4L4I.js');
7
- require('../../../../chunk-Y7WHUKJF.js');
8
- require('../../../../chunk-F2BZIU67.js');
9
- require('../../../../chunk-NSBPE2FW.js');
10
-
11
-
12
-
13
- Object.defineProperty(exports, "AiChatDialog", {
14
- enumerable: true,
15
- get: function () { return chunkHL4H2HF6_js.AiChatDialog; }
16
- });
17
- Object.defineProperty(exports, "AiConfigPage", {
18
- enumerable: true,
19
- get: function () { return chunkHL4H2HF6_js.AiConfigPage; }
20
- });
21
- Object.defineProperty(exports, "DEFAULT_OPENAI_BASE_URL", {
22
- enumerable: true,
23
- get: function () { return chunkVCKXK6V5_js.DEFAULT_OPENAI_BASE_URL; }
24
- });
25
- Object.defineProperty(exports, "DEFAULT_OPENAI_MODEL", {
26
- enumerable: true,
27
- get: function () { return chunkVCKXK6V5_js.DEFAULT_OPENAI_MODEL; }
28
- });
29
- Object.defineProperty(exports, "InMemorySkillRegistry", {
30
- enumerable: true,
31
- get: function () { return chunkVCKXK6V5_js.InMemorySkillRegistry; }
32
- });
33
- Object.defineProperty(exports, "createAiClient", {
34
- enumerable: true,
35
- get: function () { return chunkVCKXK6V5_js.createAiClient; }
36
- });
37
- Object.defineProperty(exports, "createChatSession", {
38
- enumerable: true,
39
- get: function () { return chunkVCKXK6V5_js.createChatSession; }
40
- });
41
- Object.defineProperty(exports, "createOpenAICompatibleProvider", {
42
- enumerable: true,
43
- get: function () { return chunkVCKXK6V5_js.createOpenAICompatibleProvider; }
44
- });
45
- Object.defineProperty(exports, "createSkillRegistry", {
46
- enumerable: true,
47
- get: function () { return chunkVCKXK6V5_js.createSkillRegistry; }
48
- });
49
- Object.defineProperty(exports, "skillToToolDefinition", {
50
- enumerable: true,
51
- get: function () { return chunkVCKXK6V5_js.skillToToolDefinition; }
52
- });
53
- Object.defineProperty(exports, "applyPromptTemplate", {
54
- enumerable: true,
55
- get: function () { return chunk3R6JHA6D_js.applyPromptTemplate; }
56
- });
57
- Object.defineProperty(exports, "normalizePromptVariables", {
58
- enumerable: true,
59
- get: function () { return chunk3R6JHA6D_js.normalizePromptVariables; }
60
- });
61
- Object.defineProperty(exports, "useAiChat", {
62
- enumerable: true,
63
- get: function () { return chunk3R6JHA6D_js.useAiChat; }
64
- });
65
- //# sourceMappingURL=index.js.map
66
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,9 +0,0 @@
1
- export { AiChatDialog, AiConfigPage } from '../../../../chunk-IJIQUMAK.mjs';
2
- export { DEFAULT_OPENAI_BASE_URL, DEFAULT_OPENAI_MODEL, InMemorySkillRegistry, createAiClient, createChatSession, createOpenAICompatibleProvider, createSkillRegistry, skillToToolDefinition } from '../../../../chunk-UJUWDF7M.mjs';
3
- export { applyPromptTemplate, normalizePromptVariables, useAiChat } from '../../../../chunk-GS4SAW25.mjs';
4
- import '../../../../chunk-MMDSZIXD.mjs';
5
- import '../../../../chunk-FUA6ZGMI.mjs';
6
- import '../../../../chunk-VYK4M2D6.mjs';
7
- import '../../../../chunk-MAI35PU6.mjs';
8
- //# sourceMappingURL=index.mjs.map
9
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -1,38 +0,0 @@
1
- import { l as AiClient, q as PromptVariables, d as AiMessage, n as AiChatInputOptions, h as AiChatResponse } from './types-LU_BGSzk.mjs';
2
-
3
- interface AiChatDialogBaseProps {
4
- client: AiClient;
5
- title?: string;
6
- placeholder?: string;
7
- systemPrompt?: string;
8
- template?: string;
9
- templateVariables?: PromptVariables;
10
- initialMessages?: AiMessage[];
11
- requestOptions?: Omit<AiChatInputOptions, 'template' | 'variables'>;
12
- onResponse?: (response: AiChatResponse) => void;
13
- onError?: (error: Error) => void;
14
- }
15
- interface AiChatDialogProps extends AiChatDialogBaseProps {
16
- open: boolean;
17
- onOpenChange?: (open: boolean) => void;
18
- }
19
- interface AiUiConfig {
20
- apiKey: string;
21
- baseUrl: string;
22
- model: string;
23
- systemPrompt: string;
24
- template: string;
25
- temperature: number;
26
- topP: number;
27
- maxTokens: number;
28
- }
29
- interface AiConfigPageProps {
30
- storageKey?: string;
31
- initialConfig?: Partial<AiUiConfig>;
32
- title?: string;
33
- description?: string;
34
- onSave?: (config: AiUiConfig) => void;
35
- onChange?: (config: AiUiConfig) => void;
36
- }
37
-
38
- export type { AiChatDialogBaseProps as A, AiChatDialogProps as a, AiUiConfig as b, AiConfigPageProps as c };
@@ -1,122 +0,0 @@
1
- import { R as RequestAdapter } from './types-CbTsi9CZ.js';
2
-
3
- type PromptVariableValue = string | number | boolean | null | undefined;
4
- type PromptVariables = Record<string, PromptVariableValue>;
5
- declare const normalizePromptVariables: (variables?: PromptVariables) => Record<string, string>;
6
-
7
- interface AiProvider {
8
- id?: string;
9
- sendChat(request: AiChatRequest, config: ResolvedAiClientConfig): Promise<AiChatResponse>;
10
- streamChat?(request: AiChatRequest, config: ResolvedAiClientConfig): AsyncIterable<AiChatChunk>;
11
- }
12
-
13
- type AiRole = 'system' | 'user' | 'assistant' | 'tool';
14
- type AiToolChoice = {
15
- type: 'function';
16
- function: {
17
- name: string;
18
- };
19
- };
20
- type AiToolDefinition = {
21
- type: 'function';
22
- function: {
23
- name: string;
24
- description?: string;
25
- parameters?: Record<string, any>;
26
- };
27
- };
28
- type AiToolCall = {
29
- id: string;
30
- type: 'function';
31
- function: {
32
- name: string;
33
- arguments: string;
34
- };
35
- };
36
- interface AiMessage {
37
- role: AiRole;
38
- content: string;
39
- name?: string;
40
- toolCallId?: string;
41
- toolCalls?: AiToolCall[];
42
- }
43
- interface AiUsage {
44
- promptTokens?: number;
45
- completionTokens?: number;
46
- totalTokens?: number;
47
- }
48
- interface AiChatRequestOptions {
49
- model?: string;
50
- temperature?: number;
51
- maxTokens?: number;
52
- topP?: number;
53
- stop?: string | string[];
54
- stream?: boolean;
55
- tools?: AiToolDefinition[];
56
- toolChoice?: 'auto' | 'none' | AiToolChoice;
57
- }
58
- interface AiChatRequest extends AiChatRequestOptions {
59
- messages: AiMessage[];
60
- }
61
- interface AiChatResponse {
62
- id: string;
63
- content: string;
64
- message?: AiMessage;
65
- usage?: AiUsage;
66
- raw?: unknown;
67
- toolCalls?: AiToolCall[];
68
- }
69
- interface AiChatChunk {
70
- id: string;
71
- content?: string;
72
- delta?: string;
73
- toolCalls?: AiToolCall[];
74
- raw?: unknown;
75
- }
76
- interface AiLogger {
77
- debug?: (message: string, data?: any) => void;
78
- info?: (message: string, data?: any) => void;
79
- warn?: (message: string, data?: any) => void;
80
- error?: (message: string, error?: any) => void;
81
- }
82
- interface AiClientConfig {
83
- apiKey?: string;
84
- getApiKey?: () => Promise<string> | string;
85
- baseUrl?: string;
86
- model?: string;
87
- headers?: Record<string, string>;
88
- timeoutMs?: number;
89
- requestAdapter?: RequestAdapter;
90
- logger?: AiLogger;
91
- provider?: AiProvider;
92
- }
93
- interface ResolvedAiClientConfig extends AiClientConfig {
94
- baseUrl: string;
95
- headers: Record<string, string>;
96
- timeoutMs: number;
97
- }
98
- interface AiClient {
99
- sendChat(request: AiChatRequest): Promise<AiChatResponse>;
100
- sendMessage(content: string, options?: AiChatRequestOptions & {
101
- systemPrompt?: string;
102
- }): Promise<AiChatResponse>;
103
- }
104
- type AiChatStatus = 'idle' | 'loading' | 'success' | 'error';
105
- interface AiChatInputOptions extends AiChatRequestOptions {
106
- template?: string;
107
- variables?: PromptVariables;
108
- }
109
- interface AiChatSessionOptions {
110
- client: AiClient;
111
- systemPrompt?: string;
112
- template?: string;
113
- initialMessages?: AiMessage[];
114
- }
115
- interface AiChatSession {
116
- getMessages(): AiMessage[];
117
- setSystemPrompt(prompt?: string): void;
118
- reset(): void;
119
- sendMessage(input: string, options?: AiChatInputOptions): Promise<AiChatResponse>;
120
- }
121
-
122
- export { type AiRole as A, type PromptVariableValue as P, type ResolvedAiClientConfig as R, type AiToolChoice as a, type AiToolDefinition as b, type AiToolCall as c, type AiMessage as d, type AiUsage as e, type AiChatRequestOptions as f, type AiChatRequest as g, type AiChatResponse as h, type AiChatChunk as i, type AiLogger as j, type AiClientConfig as k, type AiClient as l, type AiChatStatus as m, type AiChatInputOptions as n, type AiChatSessionOptions as o, type AiChatSession as p, type PromptVariables as q, normalizePromptVariables as r, type AiProvider as s };
@@ -1,38 +0,0 @@
1
- import { l as AiClient, q as PromptVariables, d as AiMessage, n as AiChatInputOptions, h as AiChatResponse } from './types-DgACCUpT.js';
2
-
3
- interface AiChatDialogBaseProps {
4
- client: AiClient;
5
- title?: string;
6
- placeholder?: string;
7
- systemPrompt?: string;
8
- template?: string;
9
- templateVariables?: PromptVariables;
10
- initialMessages?: AiMessage[];
11
- requestOptions?: Omit<AiChatInputOptions, 'template' | 'variables'>;
12
- onResponse?: (response: AiChatResponse) => void;
13
- onError?: (error: Error) => void;
14
- }
15
- interface AiChatDialogProps extends AiChatDialogBaseProps {
16
- open: boolean;
17
- onOpenChange?: (open: boolean) => void;
18
- }
19
- interface AiUiConfig {
20
- apiKey: string;
21
- baseUrl: string;
22
- model: string;
23
- systemPrompt: string;
24
- template: string;
25
- temperature: number;
26
- topP: number;
27
- maxTokens: number;
28
- }
29
- interface AiConfigPageProps {
30
- storageKey?: string;
31
- initialConfig?: Partial<AiUiConfig>;
32
- title?: string;
33
- description?: string;
34
- onSave?: (config: AiUiConfig) => void;
35
- onChange?: (config: AiUiConfig) => void;
36
- }
37
-
38
- export type { AiChatDialogBaseProps as A, AiChatDialogProps as a, AiUiConfig as b, AiConfigPageProps as c };
@@ -1,122 +0,0 @@
1
- import { R as RequestAdapter } from './types-CbTsi9CZ.mjs';
2
-
3
- type PromptVariableValue = string | number | boolean | null | undefined;
4
- type PromptVariables = Record<string, PromptVariableValue>;
5
- declare const normalizePromptVariables: (variables?: PromptVariables) => Record<string, string>;
6
-
7
- interface AiProvider {
8
- id?: string;
9
- sendChat(request: AiChatRequest, config: ResolvedAiClientConfig): Promise<AiChatResponse>;
10
- streamChat?(request: AiChatRequest, config: ResolvedAiClientConfig): AsyncIterable<AiChatChunk>;
11
- }
12
-
13
- type AiRole = 'system' | 'user' | 'assistant' | 'tool';
14
- type AiToolChoice = {
15
- type: 'function';
16
- function: {
17
- name: string;
18
- };
19
- };
20
- type AiToolDefinition = {
21
- type: 'function';
22
- function: {
23
- name: string;
24
- description?: string;
25
- parameters?: Record<string, any>;
26
- };
27
- };
28
- type AiToolCall = {
29
- id: string;
30
- type: 'function';
31
- function: {
32
- name: string;
33
- arguments: string;
34
- };
35
- };
36
- interface AiMessage {
37
- role: AiRole;
38
- content: string;
39
- name?: string;
40
- toolCallId?: string;
41
- toolCalls?: AiToolCall[];
42
- }
43
- interface AiUsage {
44
- promptTokens?: number;
45
- completionTokens?: number;
46
- totalTokens?: number;
47
- }
48
- interface AiChatRequestOptions {
49
- model?: string;
50
- temperature?: number;
51
- maxTokens?: number;
52
- topP?: number;
53
- stop?: string | string[];
54
- stream?: boolean;
55
- tools?: AiToolDefinition[];
56
- toolChoice?: 'auto' | 'none' | AiToolChoice;
57
- }
58
- interface AiChatRequest extends AiChatRequestOptions {
59
- messages: AiMessage[];
60
- }
61
- interface AiChatResponse {
62
- id: string;
63
- content: string;
64
- message?: AiMessage;
65
- usage?: AiUsage;
66
- raw?: unknown;
67
- toolCalls?: AiToolCall[];
68
- }
69
- interface AiChatChunk {
70
- id: string;
71
- content?: string;
72
- delta?: string;
73
- toolCalls?: AiToolCall[];
74
- raw?: unknown;
75
- }
76
- interface AiLogger {
77
- debug?: (message: string, data?: any) => void;
78
- info?: (message: string, data?: any) => void;
79
- warn?: (message: string, data?: any) => void;
80
- error?: (message: string, error?: any) => void;
81
- }
82
- interface AiClientConfig {
83
- apiKey?: string;
84
- getApiKey?: () => Promise<string> | string;
85
- baseUrl?: string;
86
- model?: string;
87
- headers?: Record<string, string>;
88
- timeoutMs?: number;
89
- requestAdapter?: RequestAdapter;
90
- logger?: AiLogger;
91
- provider?: AiProvider;
92
- }
93
- interface ResolvedAiClientConfig extends AiClientConfig {
94
- baseUrl: string;
95
- headers: Record<string, string>;
96
- timeoutMs: number;
97
- }
98
- interface AiClient {
99
- sendChat(request: AiChatRequest): Promise<AiChatResponse>;
100
- sendMessage(content: string, options?: AiChatRequestOptions & {
101
- systemPrompt?: string;
102
- }): Promise<AiChatResponse>;
103
- }
104
- type AiChatStatus = 'idle' | 'loading' | 'success' | 'error';
105
- interface AiChatInputOptions extends AiChatRequestOptions {
106
- template?: string;
107
- variables?: PromptVariables;
108
- }
109
- interface AiChatSessionOptions {
110
- client: AiClient;
111
- systemPrompt?: string;
112
- template?: string;
113
- initialMessages?: AiMessage[];
114
- }
115
- interface AiChatSession {
116
- getMessages(): AiMessage[];
117
- setSystemPrompt(prompt?: string): void;
118
- reset(): void;
119
- sendMessage(input: string, options?: AiChatInputOptions): Promise<AiChatResponse>;
120
- }
121
-
122
- export { type AiRole as A, type PromptVariableValue as P, type ResolvedAiClientConfig as R, type AiToolChoice as a, type AiToolDefinition as b, type AiToolCall as c, type AiMessage as d, type AiUsage as e, type AiChatRequestOptions as f, type AiChatRequest as g, type AiChatResponse as h, type AiChatChunk as i, type AiLogger as j, type AiClientConfig as k, type AiClient as l, type AiChatStatus as m, type AiChatInputOptions as n, type AiChatSessionOptions as o, type AiChatSession as p, type PromptVariables as q, normalizePromptVariables as r, type AiProvider as s };
File without changes