gauss-ts 1.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +499 -0
  3. package/dist/agent-CHrSUkPz.d.ts +485 -0
  4. package/dist/agent-CMp1wFzs.d.cts +485 -0
  5. package/dist/agent.cjs +2 -0
  6. package/dist/agent.cjs.map +1 -0
  7. package/dist/agent.d.cts +144 -0
  8. package/dist/agent.d.ts +144 -0
  9. package/dist/agent.js +2 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/index.cjs +21 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +492 -0
  14. package/dist/index.d.ts +492 -0
  15. package/dist/index.js +21 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/mcp.cjs +2 -0
  18. package/dist/mcp.cjs.map +1 -0
  19. package/dist/mcp.d.cts +282 -0
  20. package/dist/mcp.d.ts +282 -0
  21. package/dist/mcp.js +2 -0
  22. package/dist/mcp.js.map +1 -0
  23. package/dist/middleware.cjs +2 -0
  24. package/dist/middleware.cjs.map +1 -0
  25. package/dist/middleware.d.cts +46 -0
  26. package/dist/middleware.d.ts +46 -0
  27. package/dist/middleware.js +2 -0
  28. package/dist/middleware.js.map +1 -0
  29. package/dist/orchestration.cjs +2 -0
  30. package/dist/orchestration.cjs.map +1 -0
  31. package/dist/orchestration.d.cts +94 -0
  32. package/dist/orchestration.d.ts +94 -0
  33. package/dist/orchestration.js +2 -0
  34. package/dist/orchestration.js.map +1 -0
  35. package/dist/rag.cjs +2 -0
  36. package/dist/rag.cjs.map +1 -0
  37. package/dist/rag.d.cts +43 -0
  38. package/dist/rag.d.ts +43 -0
  39. package/dist/rag.js +2 -0
  40. package/dist/rag.js.map +1 -0
  41. package/dist/tools.cjs +2 -0
  42. package/dist/tools.cjs.map +1 -0
  43. package/dist/tools.d.cts +48 -0
  44. package/dist/tools.d.ts +48 -0
  45. package/dist/tools.js +2 -0
  46. package/dist/tools.js.map +1 -0
  47. package/dist/types-BkwC4s1P.d.cts +239 -0
  48. package/dist/types-BkwC4s1P.d.ts +239 -0
  49. package/package.json +132 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sdk/tool-validator.ts","../src/sdk/tool-registry.ts"],"sourcesContent":["/**\n * Tool Validator SDK wrapper, backed by Rust core.\n */\nimport {\n create_tool_validator,\n tool_validator_validate,\n destroy_tool_validator,\n} from \"gauss-napi\";\n\nimport type { Handle, Disposable, CoercionStrategy } from \"./types.js\";\n\nexport class ToolValidator implements Disposable {\n private readonly _handle: Handle;\n private disposed = false;\n\n constructor(strategies?: CoercionStrategy[]) {\n this._handle = create_tool_validator(strategies);\n }\n\n get handle(): Handle {\n return this._handle;\n }\n\n validate(\n input: Record<string, unknown>,\n schema: Record<string, unknown>\n ): unknown {\n this.assertNotDisposed();\n return JSON.parse(\n tool_validator_validate(\n this._handle,\n JSON.stringify(input),\n JSON.stringify(schema)\n )\n );\n }\n\n destroy(): void {\n if (!this.disposed) {\n this.disposed = true;\n try {\n destroy_tool_validator(this._handle);\n } catch {\n // Already destroyed.\n }\n }\n }\n\n [Symbol.dispose](): void {\n this.destroy();\n }\n\n private assertNotDisposed(): void {\n if (this.disposed) {\n throw new Error(\"ToolValidator has been destroyed\");\n }\n }\n}\n","/**\n * ToolRegistry SDK — searchable tool registry with tags, examples, and batch execution.\n */\nimport {\n createToolRegistry,\n toolRegistryAdd,\n toolRegistrySearch,\n toolRegistryByTag,\n toolRegistryList,\n destroyToolRegistry,\n} from \"gauss-napi\";\n\nimport type { Handle, Disposable } from \"./types.js\";\n\n// ── Types ───────────────────────────────────────────────────────\n\nexport interface ToolExample {\n description: string;\n input: unknown;\n expectedOutput?: unknown;\n}\n\nexport interface ToolRegistryEntry {\n name: string;\n description: string;\n tags?: string[];\n examples?: ToolExample[];\n}\n\nexport interface ToolSearchResult {\n name: string;\n description: string;\n tags: string[];\n}\n\n// ── ToolRegistry Class ──────────────────────────────────────────\n\nexport class ToolRegistry implements Disposable {\n private readonly _handle: Handle;\n private disposed = false;\n\n constructor() {\n this._handle = createToolRegistry();\n }\n\n get handle(): Handle {\n return this._handle;\n }\n\n /** Register a tool with optional tags and examples. */\n add(entry: ToolRegistryEntry): this {\n this.assertNotDisposed();\n toolRegistryAdd(this._handle, JSON.stringify(entry));\n return this;\n }\n\n /** Search tools by query (matches name, description, tags). */\n search(query: string): ToolSearchResult[] {\n this.assertNotDisposed();\n return toolRegistrySearch(this._handle, query) as ToolSearchResult[];\n }\n\n /** Find tools by tag. */\n byTag(tag: string): ToolSearchResult[] {\n this.assertNotDisposed();\n return toolRegistryByTag(this._handle, tag) as ToolSearchResult[];\n }\n\n /** List all registered tools. */\n list(): ToolRegistryEntry[] {\n this.assertNotDisposed();\n return toolRegistryList(this._handle) as ToolRegistryEntry[];\n }\n\n destroy(): void {\n if (!this.disposed) {\n this.disposed = true;\n try {\n destroyToolRegistry(this._handle);\n } catch {\n // Already destroyed.\n }\n }\n }\n\n [Symbol.dispose](): void {\n this.destroy();\n }\n\n private assertNotDisposed(): void {\n if (this.disposed) {\n throw new Error(\"ToolRegistry has been destroyed\");\n }\n }\n}\n"],"mappings":"AAGA,OACE,yBAAAA,EACA,2BAAAC,EACA,0BAAAC,MACK,aAIA,IAAMC,EAAN,KAA0C,CAC9B,QACT,SAAW,GAEnB,YAAYC,EAAiC,CAC3C,KAAK,QAAUJ,EAAsBI,CAAU,CACjD,CAEA,IAAI,QAAiB,CACnB,OAAO,KAAK,OACd,CAEA,SACEC,EACAC,EACS,CACT,YAAK,kBAAkB,EAChB,KAAK,MACVL,EACE,KAAK,QACL,KAAK,UAAUI,CAAK,EACpB,KAAK,UAAUC,CAAM,CACvB,CACF,CACF,CAEA,SAAgB,CACd,GAAI,CAAC,KAAK,SAAU,CAClB,KAAK,SAAW,GAChB,GAAI,CACFJ,EAAuB,KAAK,OAAO,CACrC,MAAQ,CAER,CACF,CACF,CAEA,CAAC,OAAO,OAAO,GAAU,CACvB,KAAK,QAAQ,CACf,CAEQ,mBAA0B,CAChC,GAAI,KAAK,SACP,MAAM,IAAI,MAAM,kCAAkC,CAEtD,CACF,ECtDA,OACE,sBAAAK,EACA,mBAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,uBAAAC,MACK,aA2BA,IAAMC,EAAN,KAAyC,CAC7B,QACT,SAAW,GAEnB,aAAc,CACZ,KAAK,QAAUN,EAAmB,CACpC,CAEA,IAAI,QAAiB,CACnB,OAAO,KAAK,OACd,CAGA,IAAIO,EAAgC,CAClC,YAAK,kBAAkB,EACvBN,EAAgB,KAAK,QAAS,KAAK,UAAUM,CAAK,CAAC,EAC5C,IACT,CAGA,OAAOC,EAAmC,CACxC,YAAK,kBAAkB,EAChBN,EAAmB,KAAK,QAASM,CAAK,CAC/C,CAGA,MAAMC,EAAiC,CACrC,YAAK,kBAAkB,EAChBN,EAAkB,KAAK,QAASM,CAAG,CAC5C,CAGA,MAA4B,CAC1B,YAAK,kBAAkB,EAChBL,EAAiB,KAAK,OAAO,CACtC,CAEA,SAAgB,CACd,GAAI,CAAC,KAAK,SAAU,CAClB,KAAK,SAAW,GAChB,GAAI,CACFC,EAAoB,KAAK,OAAO,CAClC,MAAQ,CAER,CACF,CACF,CAEA,CAAC,OAAO,OAAO,GAAU,CACvB,KAAK,QAAQ,CACf,CAEQ,mBAA0B,CAChC,GAAI,KAAK,SACP,MAAM,IAAI,MAAM,iCAAiC,CAErD,CACF","names":["create_tool_validator","tool_validator_validate","destroy_tool_validator","ToolValidator","strategies","input","schema","createToolRegistry","toolRegistryAdd","toolRegistrySearch","toolRegistryByTag","toolRegistryList","destroyToolRegistry","ToolRegistry","entry","query","tag"]}
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Gauss SDK — Shared types.
3
+ *
4
+ * Design principles:
5
+ * - Every option has a sensible default
6
+ * - Minimal required fields — only what's truly mandatory
7
+ * - String unions over enums for JS-friendliness
8
+ * - Record<string, unknown> for extensibility
9
+ */
10
+ type ProviderType = "openai" | "anthropic" | "google" | "groq" | "ollama" | "deepseek" | "openrouter" | "together" | "fireworks" | "mistral" | "perplexity" | "xai";
11
+ interface ProviderOptions {
12
+ /** API key. Auto-resolved from environment if omitted. */
13
+ apiKey?: string;
14
+ baseUrl?: string;
15
+ timeoutMs?: number;
16
+ maxRetries?: number;
17
+ organization?: string;
18
+ }
19
+ type MessageRole = "system" | "user" | "assistant" | "tool";
20
+ interface Message {
21
+ role: MessageRole;
22
+ content: string;
23
+ }
24
+ /** @deprecated Use `Message` instead. */
25
+ type JsMessage = Message;
26
+ interface ToolDef {
27
+ name: string;
28
+ description: string;
29
+ parameters?: Record<string, unknown>;
30
+ }
31
+ type ToolExecutor = (callJson: string) => Promise<string>;
32
+ type StreamCallback = (eventJson: string) => void;
33
+ interface AgentOptions {
34
+ instructions?: string;
35
+ maxSteps?: number;
36
+ temperature?: number;
37
+ topP?: number;
38
+ maxTokens?: number;
39
+ seed?: number;
40
+ stopOnTool?: string;
41
+ outputSchema?: Record<string, unknown>;
42
+ thinkingBudget?: number;
43
+ /** Reasoning effort for OpenAI o-series models: "low", "medium", or "high". */
44
+ reasoningEffort?: "low" | "medium" | "high";
45
+ cacheControl?: boolean;
46
+ codeExecution?: CodeExecutionOptions;
47
+ /** Enable Google Search grounding (Gemini only). */
48
+ grounding?: boolean;
49
+ /** Enable native code execution / Gemini code interpreter. */
50
+ nativeCodeExecution?: boolean;
51
+ /** Response modalities (e.g. ["TEXT", "IMAGE"] for Gemini image generation). */
52
+ responseModalities?: string[];
53
+ }
54
+ /** A citation reference from document-aware responses. */
55
+ interface Citation {
56
+ /** Citation type: char_location, page_location, content_block_location. */
57
+ type: string;
58
+ /** The cited text from the document. */
59
+ citedText?: string;
60
+ /** Title of the source document. */
61
+ documentTitle?: string;
62
+ /** Start index (character, page, or block depending on type). */
63
+ start?: number;
64
+ /** End index (character, page, or block depending on type). */
65
+ end?: number;
66
+ }
67
+ interface AgentResult {
68
+ text: string;
69
+ steps: number;
70
+ inputTokens: number;
71
+ outputTokens: number;
72
+ structuredOutput?: Record<string, unknown>;
73
+ /** Extended thinking output (Anthropic). */
74
+ thinking?: string;
75
+ /** Citations from document-aware responses (Anthropic). */
76
+ citations?: Citation[];
77
+ /** Grounding metadata from Google Search grounding. */
78
+ groundingMetadata?: GroundingMetadata[];
79
+ }
80
+ /** Metadata from Google Search grounding. */
81
+ interface GroundingMetadata {
82
+ /** Search queries generated by the model. */
83
+ searchQueries: string[];
84
+ /** Grounding chunks (web results). */
85
+ groundingChunks: GroundingChunk[];
86
+ /** Rendered HTML search entry point widget. */
87
+ searchEntryPoint?: string;
88
+ }
89
+ /** A single grounding chunk (web search result). */
90
+ interface GroundingChunk {
91
+ /** URL of the web result. */
92
+ url?: string;
93
+ /** Title of the web result. */
94
+ title?: string;
95
+ }
96
+ /** Configuration for image generation. */
97
+ interface ImageGenerationConfig {
98
+ /** Image model (e.g. "dall-e-3", "gemini-2.0-flash"). */
99
+ model?: string;
100
+ /** Desired size (e.g. "1024x1024"). */
101
+ size?: string;
102
+ /** Quality level (e.g. "standard", "hd"). */
103
+ quality?: string;
104
+ /** Style (e.g. "vivid", "natural"). */
105
+ style?: string;
106
+ /** Aspect ratio for Gemini (e.g. "16:9", "1:1"). */
107
+ aspectRatio?: string;
108
+ /** Number of images to generate. */
109
+ n?: number;
110
+ /** Response format ("url" or "b64_json"). */
111
+ responseFormat?: string;
112
+ }
113
+ /** Result of image generation. */
114
+ interface ImageGenerationResult {
115
+ /** Generated images. */
116
+ images: GeneratedImageData[];
117
+ /** Revised prompt (DALL-E 3 rewrites prompts). */
118
+ revisedPrompt?: string;
119
+ }
120
+ /** A single generated image. */
121
+ interface GeneratedImageData {
122
+ /** URL to the generated image (temporary). */
123
+ url?: string;
124
+ /** Base64-encoded image data. */
125
+ base64?: string;
126
+ /** MIME type. */
127
+ mimeType?: string;
128
+ }
129
+ /** Feature capabilities of a provider/model combination. */
130
+ interface ProviderCapabilities {
131
+ streaming: boolean;
132
+ toolUse: boolean;
133
+ vision: boolean;
134
+ audio: boolean;
135
+ extendedThinking: boolean;
136
+ citations: boolean;
137
+ cacheControl: boolean;
138
+ structuredOutput: boolean;
139
+ reasoningEffort: boolean;
140
+ imageGeneration: boolean;
141
+ grounding: boolean;
142
+ codeExecution: boolean;
143
+ webSearch: boolean;
144
+ }
145
+ interface CostEstimate {
146
+ model: string;
147
+ normalizedModel: string;
148
+ currency: string;
149
+ inputTokens: number;
150
+ outputTokens: number;
151
+ reasoningTokens: number;
152
+ cacheReadTokens: number;
153
+ cacheCreationTokens: number;
154
+ inputCostUsd: number;
155
+ outputCostUsd: number;
156
+ reasoningCostUsd: number;
157
+ cacheReadCostUsd: number;
158
+ cacheCreationCostUsd: number;
159
+ totalCostUsd: number;
160
+ }
161
+ /** Configuration for programmatic code execution runtimes. */
162
+ interface CodeExecutionOptions {
163
+ /** Enable Python runtime (default: true). */
164
+ python?: boolean;
165
+ /** Enable JavaScript/Node.js runtime (default: true). */
166
+ javascript?: boolean;
167
+ /** Enable Bash runtime (default: true). */
168
+ bash?: boolean;
169
+ /** Timeout in seconds per execution (default: 30). */
170
+ timeoutSecs?: number;
171
+ /** Working directory for subprocesses. */
172
+ workingDir?: string;
173
+ /** Sandbox mode: "default" | "strict" | "permissive" (default: "default"). */
174
+ sandbox?: "default" | "strict" | "permissive";
175
+ /** Use a single unified execute_code tool instead of per-language tools. */
176
+ unified?: boolean;
177
+ }
178
+ /** Result of a code execution. */
179
+ interface CodeExecutionResult {
180
+ stdout: string;
181
+ stderr: string;
182
+ exitCode: number;
183
+ timedOut: boolean;
184
+ runtime: string;
185
+ success: boolean;
186
+ }
187
+ type MemoryEntryType = "conversation" | "fact" | "preference" | "task" | "summary";
188
+ type MemoryTier = "core" | "active" | "background" | "archive";
189
+ interface MemoryEntry {
190
+ id: string;
191
+ content: string;
192
+ entryType: MemoryEntryType;
193
+ timestamp: string;
194
+ tier?: MemoryTier;
195
+ metadata?: Record<string, unknown>;
196
+ importance?: number;
197
+ sessionId?: string;
198
+ embedding?: number[];
199
+ }
200
+ interface RecallOptions {
201
+ sessionId?: string;
202
+ limit?: number;
203
+ }
204
+ interface MemoryStats {
205
+ totalEntries: number;
206
+ [key: string]: unknown;
207
+ }
208
+ interface VectorChunk {
209
+ id: string;
210
+ documentId: string;
211
+ content: string;
212
+ index: number;
213
+ metadata?: Record<string, unknown>;
214
+ embedding?: number[];
215
+ }
216
+ interface SearchResult {
217
+ id: string;
218
+ text: string;
219
+ score: number;
220
+ metadata?: Record<string, unknown>;
221
+ }
222
+ type PiiAction = "block" | "warn" | "redact";
223
+ type CoercionStrategy = "null_to_default" | "type_cast" | "json_parse" | "strip_null";
224
+ type EvalScorerType = "exact_match" | "contains" | "length_ratio";
225
+ /** Opaque handle returned by NAPI resource constructors. */
226
+ type Handle = number;
227
+ /** Any SDK resource that owns native memory. */
228
+ interface Disposable {
229
+ destroy(): void;
230
+ }
231
+ /** Resolve an API key from environment for the given provider. */
232
+ declare function resolveApiKey(provider: ProviderType): string;
233
+ /** Auto-detect the best available provider from environment variables. */
234
+ declare function detectProvider(): {
235
+ provider: ProviderType;
236
+ model: string;
237
+ } | undefined;
238
+
239
+ export { type AgentOptions as A, type CodeExecutionOptions as C, type Disposable as D, type EvalScorerType as E, type GeneratedImageData as G, type Handle as H, type ImageGenerationConfig as I, type JsMessage as J, type Message as M, type ProviderType as P, type RecallOptions as R, type StreamCallback as S, type ToolDef as T, type VectorChunk as V, type ToolExecutor as a, type AgentResult as b, type ProviderOptions as c, type ProviderCapabilities as d, type CostEstimate as e, type Citation as f, type CodeExecutionResult as g, type CoercionStrategy as h, type GroundingChunk as i, type GroundingMetadata as j, type ImageGenerationResult as k, type MemoryEntry as l, type MemoryStats as m, type MessageRole as n, type PiiAction as o, type SearchResult as p, detectProvider as q, resolveApiKey as r };
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Gauss SDK — Shared types.
3
+ *
4
+ * Design principles:
5
+ * - Every option has a sensible default
6
+ * - Minimal required fields — only what's truly mandatory
7
+ * - String unions over enums for JS-friendliness
8
+ * - Record<string, unknown> for extensibility
9
+ */
10
+ type ProviderType = "openai" | "anthropic" | "google" | "groq" | "ollama" | "deepseek" | "openrouter" | "together" | "fireworks" | "mistral" | "perplexity" | "xai";
11
+ interface ProviderOptions {
12
+ /** API key. Auto-resolved from environment if omitted. */
13
+ apiKey?: string;
14
+ baseUrl?: string;
15
+ timeoutMs?: number;
16
+ maxRetries?: number;
17
+ organization?: string;
18
+ }
19
+ type MessageRole = "system" | "user" | "assistant" | "tool";
20
+ interface Message {
21
+ role: MessageRole;
22
+ content: string;
23
+ }
24
+ /** @deprecated Use `Message` instead. */
25
+ type JsMessage = Message;
26
+ interface ToolDef {
27
+ name: string;
28
+ description: string;
29
+ parameters?: Record<string, unknown>;
30
+ }
31
+ type ToolExecutor = (callJson: string) => Promise<string>;
32
+ type StreamCallback = (eventJson: string) => void;
33
+ interface AgentOptions {
34
+ instructions?: string;
35
+ maxSteps?: number;
36
+ temperature?: number;
37
+ topP?: number;
38
+ maxTokens?: number;
39
+ seed?: number;
40
+ stopOnTool?: string;
41
+ outputSchema?: Record<string, unknown>;
42
+ thinkingBudget?: number;
43
+ /** Reasoning effort for OpenAI o-series models: "low", "medium", or "high". */
44
+ reasoningEffort?: "low" | "medium" | "high";
45
+ cacheControl?: boolean;
46
+ codeExecution?: CodeExecutionOptions;
47
+ /** Enable Google Search grounding (Gemini only). */
48
+ grounding?: boolean;
49
+ /** Enable native code execution / Gemini code interpreter. */
50
+ nativeCodeExecution?: boolean;
51
+ /** Response modalities (e.g. ["TEXT", "IMAGE"] for Gemini image generation). */
52
+ responseModalities?: string[];
53
+ }
54
+ /** A citation reference from document-aware responses. */
55
+ interface Citation {
56
+ /** Citation type: char_location, page_location, content_block_location. */
57
+ type: string;
58
+ /** The cited text from the document. */
59
+ citedText?: string;
60
+ /** Title of the source document. */
61
+ documentTitle?: string;
62
+ /** Start index (character, page, or block depending on type). */
63
+ start?: number;
64
+ /** End index (character, page, or block depending on type). */
65
+ end?: number;
66
+ }
67
+ interface AgentResult {
68
+ text: string;
69
+ steps: number;
70
+ inputTokens: number;
71
+ outputTokens: number;
72
+ structuredOutput?: Record<string, unknown>;
73
+ /** Extended thinking output (Anthropic). */
74
+ thinking?: string;
75
+ /** Citations from document-aware responses (Anthropic). */
76
+ citations?: Citation[];
77
+ /** Grounding metadata from Google Search grounding. */
78
+ groundingMetadata?: GroundingMetadata[];
79
+ }
80
+ /** Metadata from Google Search grounding. */
81
+ interface GroundingMetadata {
82
+ /** Search queries generated by the model. */
83
+ searchQueries: string[];
84
+ /** Grounding chunks (web results). */
85
+ groundingChunks: GroundingChunk[];
86
+ /** Rendered HTML search entry point widget. */
87
+ searchEntryPoint?: string;
88
+ }
89
+ /** A single grounding chunk (web search result). */
90
+ interface GroundingChunk {
91
+ /** URL of the web result. */
92
+ url?: string;
93
+ /** Title of the web result. */
94
+ title?: string;
95
+ }
96
+ /** Configuration for image generation. */
97
+ interface ImageGenerationConfig {
98
+ /** Image model (e.g. "dall-e-3", "gemini-2.0-flash"). */
99
+ model?: string;
100
+ /** Desired size (e.g. "1024x1024"). */
101
+ size?: string;
102
+ /** Quality level (e.g. "standard", "hd"). */
103
+ quality?: string;
104
+ /** Style (e.g. "vivid", "natural"). */
105
+ style?: string;
106
+ /** Aspect ratio for Gemini (e.g. "16:9", "1:1"). */
107
+ aspectRatio?: string;
108
+ /** Number of images to generate. */
109
+ n?: number;
110
+ /** Response format ("url" or "b64_json"). */
111
+ responseFormat?: string;
112
+ }
113
+ /** Result of image generation. */
114
+ interface ImageGenerationResult {
115
+ /** Generated images. */
116
+ images: GeneratedImageData[];
117
+ /** Revised prompt (DALL-E 3 rewrites prompts). */
118
+ revisedPrompt?: string;
119
+ }
120
+ /** A single generated image. */
121
+ interface GeneratedImageData {
122
+ /** URL to the generated image (temporary). */
123
+ url?: string;
124
+ /** Base64-encoded image data. */
125
+ base64?: string;
126
+ /** MIME type. */
127
+ mimeType?: string;
128
+ }
129
+ /** Feature capabilities of a provider/model combination. */
130
+ interface ProviderCapabilities {
131
+ streaming: boolean;
132
+ toolUse: boolean;
133
+ vision: boolean;
134
+ audio: boolean;
135
+ extendedThinking: boolean;
136
+ citations: boolean;
137
+ cacheControl: boolean;
138
+ structuredOutput: boolean;
139
+ reasoningEffort: boolean;
140
+ imageGeneration: boolean;
141
+ grounding: boolean;
142
+ codeExecution: boolean;
143
+ webSearch: boolean;
144
+ }
145
+ interface CostEstimate {
146
+ model: string;
147
+ normalizedModel: string;
148
+ currency: string;
149
+ inputTokens: number;
150
+ outputTokens: number;
151
+ reasoningTokens: number;
152
+ cacheReadTokens: number;
153
+ cacheCreationTokens: number;
154
+ inputCostUsd: number;
155
+ outputCostUsd: number;
156
+ reasoningCostUsd: number;
157
+ cacheReadCostUsd: number;
158
+ cacheCreationCostUsd: number;
159
+ totalCostUsd: number;
160
+ }
161
+ /** Configuration for programmatic code execution runtimes. */
162
+ interface CodeExecutionOptions {
163
+ /** Enable Python runtime (default: true). */
164
+ python?: boolean;
165
+ /** Enable JavaScript/Node.js runtime (default: true). */
166
+ javascript?: boolean;
167
+ /** Enable Bash runtime (default: true). */
168
+ bash?: boolean;
169
+ /** Timeout in seconds per execution (default: 30). */
170
+ timeoutSecs?: number;
171
+ /** Working directory for subprocesses. */
172
+ workingDir?: string;
173
+ /** Sandbox mode: "default" | "strict" | "permissive" (default: "default"). */
174
+ sandbox?: "default" | "strict" | "permissive";
175
+ /** Use a single unified execute_code tool instead of per-language tools. */
176
+ unified?: boolean;
177
+ }
178
+ /** Result of a code execution. */
179
+ interface CodeExecutionResult {
180
+ stdout: string;
181
+ stderr: string;
182
+ exitCode: number;
183
+ timedOut: boolean;
184
+ runtime: string;
185
+ success: boolean;
186
+ }
187
+ type MemoryEntryType = "conversation" | "fact" | "preference" | "task" | "summary";
188
+ type MemoryTier = "core" | "active" | "background" | "archive";
189
+ interface MemoryEntry {
190
+ id: string;
191
+ content: string;
192
+ entryType: MemoryEntryType;
193
+ timestamp: string;
194
+ tier?: MemoryTier;
195
+ metadata?: Record<string, unknown>;
196
+ importance?: number;
197
+ sessionId?: string;
198
+ embedding?: number[];
199
+ }
200
+ interface RecallOptions {
201
+ sessionId?: string;
202
+ limit?: number;
203
+ }
204
+ interface MemoryStats {
205
+ totalEntries: number;
206
+ [key: string]: unknown;
207
+ }
208
+ interface VectorChunk {
209
+ id: string;
210
+ documentId: string;
211
+ content: string;
212
+ index: number;
213
+ metadata?: Record<string, unknown>;
214
+ embedding?: number[];
215
+ }
216
+ interface SearchResult {
217
+ id: string;
218
+ text: string;
219
+ score: number;
220
+ metadata?: Record<string, unknown>;
221
+ }
222
+ type PiiAction = "block" | "warn" | "redact";
223
+ type CoercionStrategy = "null_to_default" | "type_cast" | "json_parse" | "strip_null";
224
+ type EvalScorerType = "exact_match" | "contains" | "length_ratio";
225
+ /** Opaque handle returned by NAPI resource constructors. */
226
+ type Handle = number;
227
+ /** Any SDK resource that owns native memory. */
228
+ interface Disposable {
229
+ destroy(): void;
230
+ }
231
+ /** Resolve an API key from environment for the given provider. */
232
+ declare function resolveApiKey(provider: ProviderType): string;
233
+ /** Auto-detect the best available provider from environment variables. */
234
+ declare function detectProvider(): {
235
+ provider: ProviderType;
236
+ model: string;
237
+ } | undefined;
238
+
239
+ export { type AgentOptions as A, type CodeExecutionOptions as C, type Disposable as D, type EvalScorerType as E, type GeneratedImageData as G, type Handle as H, type ImageGenerationConfig as I, type JsMessage as J, type Message as M, type ProviderType as P, type RecallOptions as R, type StreamCallback as S, type ToolDef as T, type VectorChunk as V, type ToolExecutor as a, type AgentResult as b, type ProviderOptions as c, type ProviderCapabilities as d, type CostEstimate as e, type Citation as f, type CodeExecutionResult as g, type CoercionStrategy as h, type GroundingChunk as i, type GroundingMetadata as j, type ImageGenerationResult as k, type MemoryEntry as l, type MemoryStats as m, type MessageRole as n, type PiiAction as o, type SearchResult as p, detectProvider as q, resolveApiKey as r };
package/package.json ADDED
@@ -0,0 +1,132 @@
1
+ {
2
+ "name": "gauss-ts",
3
+ "version": "1.1.0",
4
+ "description": "Production-grade AI agent SDK for TypeScript — thin wrapper over Rust core via NAPI. Agents, RAG, graphs, workflows, multi-agent networks, middleware, streaming, structured output, and more.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "ai",
9
+ "agent",
10
+ "agentic",
11
+ "llm",
12
+ "rag",
13
+ "workflow",
14
+ "middleware",
15
+ "mcp",
16
+ "tools",
17
+ "multi-agent",
18
+ "typescript",
19
+ "rust",
20
+ "napi",
21
+ "streaming",
22
+ "structured-output",
23
+ "prompt-template"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/giulio-leone/gauss.git"
28
+ },
29
+ "homepage": "https://github.com/giulio-leone/gauss",
30
+ "bugs": {
31
+ "url": "https://github.com/giulio-leone/gauss/issues"
32
+ },
33
+ "author": "Giulio Leone <https://github.com/giulio-leone>",
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "sideEffects": false,
41
+ "main": "./dist/index.cjs",
42
+ "module": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/index.d.ts",
47
+ "import": "./dist/index.js",
48
+ "require": "./dist/index.cjs"
49
+ },
50
+ "./agent": {
51
+ "types": "./dist/agent.d.ts",
52
+ "import": "./dist/agent.js",
53
+ "require": "./dist/agent.cjs"
54
+ },
55
+ "./rag": {
56
+ "types": "./dist/rag.d.ts",
57
+ "import": "./dist/rag.js",
58
+ "require": "./dist/rag.cjs"
59
+ },
60
+ "./orchestration": {
61
+ "types": "./dist/orchestration.d.ts",
62
+ "import": "./dist/orchestration.js",
63
+ "require": "./dist/orchestration.cjs"
64
+ },
65
+ "./middleware": {
66
+ "types": "./dist/middleware.d.ts",
67
+ "import": "./dist/middleware.js",
68
+ "require": "./dist/middleware.cjs"
69
+ },
70
+ "./mcp": {
71
+ "types": "./dist/mcp.d.ts",
72
+ "import": "./dist/mcp.js",
73
+ "require": "./dist/mcp.cjs"
74
+ },
75
+ "./tools": {
76
+ "types": "./dist/tools.d.ts",
77
+ "import": "./dist/tools.js",
78
+ "require": "./dist/tools.cjs"
79
+ }
80
+ },
81
+ "typesVersions": {
82
+ "*": {
83
+ "agent": [
84
+ "dist/agent.d.ts"
85
+ ],
86
+ "rag": [
87
+ "dist/rag.d.ts"
88
+ ],
89
+ "orchestration": [
90
+ "dist/orchestration.d.ts"
91
+ ],
92
+ "middleware": [
93
+ "dist/middleware.d.ts"
94
+ ],
95
+ "mcp": [
96
+ "dist/mcp.d.ts"
97
+ ],
98
+ "tools": [
99
+ "dist/tools.d.ts"
100
+ ]
101
+ }
102
+ },
103
+ "files": [
104
+ "dist",
105
+ "README.md",
106
+ "LICENSE"
107
+ ],
108
+ "scripts": {
109
+ "build": "tsup",
110
+ "dev": "tsup --watch",
111
+ "check-types": "tsc --noEmit",
112
+ "test": "vitest run",
113
+ "test:watch": "vitest",
114
+ "test:coverage": "vitest run --coverage",
115
+ "docs": "typedoc --out docs/api src/sdk/index.ts --tsconfig tsconfig.json",
116
+ "prepublishOnly": "npm run build",
117
+ "clean": "rimraf dist"
118
+ },
119
+ "dependencies": {
120
+ "gauss-napi": "file:../gauss-core/crates/gauss-napi"
121
+ },
122
+ "devDependencies": {
123
+ "@types/node": "^25.2.3",
124
+ "@vitest/coverage-v8": "4.0.18",
125
+ "fast-check": "^4.5.3",
126
+ "rimraf": "^6.1.2",
127
+ "tsup": "^8.0.2",
128
+ "typedoc": "^0.28.17",
129
+ "typescript": "^5.9.3",
130
+ "vitest": "^4.0.15"
131
+ }
132
+ }