@oka-core/reason 0.2.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.
package/dist/client.js ADDED
@@ -0,0 +1,292 @@
1
+ import { EventBuffer } from "./buffer.js";
2
+ import { resolveApiKey, resolveApiKeyWithRefresh } from "./auth.js";
3
+ /**
4
+ * Unified HTTP client for Oka Reason API.
5
+ *
6
+ * Merges the functionality of OkaClient + OkaContextClient + OkaClientExt
7
+ * into a single class with all capabilities:
8
+ * - ingest() — fire-and-forget event ingestion with buffering
9
+ * - getContext() — the flagship context query (ranked learnings by topic)
10
+ * - getLearnings() — enhanced learning queries
11
+ * - getLearningStats() — aggregate statistics
12
+ * - queryEvents() — raw event queries
13
+ * - getBacklog() — backlog item listing
14
+ * - triggerConsolidation() — manual consolidation trigger
15
+ */
16
+ export class OkaClient {
17
+ apiUrl;
18
+ apiKey;
19
+ repo;
20
+ buffer;
21
+ agentId;
22
+ sessionId;
23
+ timeout;
24
+ constructor(config) {
25
+ this.apiUrl = (config?.apiUrl ||
26
+ process.env["OKA_API_URL"] ||
27
+ "http://localhost:3001").replace(/\/$/, "");
28
+ this.apiKey = config?.apiKey || "";
29
+ this.repo = config?.repo || process.env["OKA_REPO"] || "unknown";
30
+ this.agentId = process.env["AGENT_ID"] || `agent-${process.pid}`;
31
+ this.sessionId = process.env["SESSION_ID"] || `session-${Date.now()}`;
32
+ this.buffer = new EventBuffer(100);
33
+ this.timeout = 15_000;
34
+ }
35
+ updateApiKey(key) {
36
+ this.apiKey = key;
37
+ }
38
+ // ─── Write operations ───────────────────────────────────────────
39
+ async ingest(event) {
40
+ const full = {
41
+ ...event,
42
+ repo: this.repo,
43
+ agent_id: this.agentId,
44
+ session_id: this.sessionId,
45
+ timestamp: new Date().toISOString(),
46
+ };
47
+ this.buffer.add(full);
48
+ await this.flush();
49
+ }
50
+ async flush() {
51
+ const events = this.buffer.drain();
52
+ if (events.length === 0)
53
+ return;
54
+ try {
55
+ await fetch(`${this.apiUrl}/api/reasoning/ingest`, {
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json",
59
+ ...this.authHeaders(),
60
+ },
61
+ body: JSON.stringify({ events }),
62
+ signal: AbortSignal.timeout(5_000),
63
+ });
64
+ }
65
+ catch {
66
+ // Re-buffer failed events (up to capacity)
67
+ for (const e of events)
68
+ this.buffer.add(e);
69
+ }
70
+ }
71
+ // ─── Context query (the differentiator) ─────────────────────────
72
+ /**
73
+ * Get ranked learnings relevant to a topic.
74
+ * Calls `GET /api/learnings/context/:topic`.
75
+ */
76
+ async getContext(topic, options) {
77
+ const params = new URLSearchParams({ repo: this.repo });
78
+ if (options?.file_patterns)
79
+ params.set("file_patterns", options.file_patterns);
80
+ if (options?.limit)
81
+ params.set("limit", String(options.limit));
82
+ if (options?.min_confidence)
83
+ params.set("min_confidence", String(options.min_confidence));
84
+ if (options?.include_events)
85
+ params.set("include_events", String(options.include_events));
86
+ if (options?.visibility)
87
+ params.set("visibility", options.visibility);
88
+ return this.get(`/api/learnings/context/${encodeURIComponent(topic)}?${params}`).catch(() => ({ topic, learnings: [], total_matched: 0 }));
89
+ }
90
+ // ─── Event queries ──────────────────────────────────────────────
91
+ async query(params) {
92
+ try {
93
+ const url = new URL(`${this.apiUrl}/api/reasoning/query`);
94
+ url.searchParams.set("repo", this.repo);
95
+ for (const [k, v] of Object.entries(params)) {
96
+ if (v)
97
+ url.searchParams.set(k, v);
98
+ }
99
+ const res = await fetch(url.toString(), {
100
+ headers: this.authHeaders(),
101
+ signal: AbortSignal.timeout(10_000),
102
+ });
103
+ if (!res.ok)
104
+ return { results: [], confidence: 0, source_count: 0 };
105
+ return (await res.json());
106
+ }
107
+ catch {
108
+ return { results: [], confidence: 0, source_count: 0 };
109
+ }
110
+ }
111
+ // ─── Learning queries ───────────────────────────────────────────
112
+ /**
113
+ * Query enhanced learnings with rich filtering.
114
+ * GET /api/reasoning/learnings/enhanced
115
+ */
116
+ async getLearnings(params) {
117
+ const searchParams = new URLSearchParams();
118
+ searchParams.set("repo", params?.repo ?? this.repo);
119
+ if (params) {
120
+ for (const [key, value] of Object.entries(params)) {
121
+ if (key !== "repo" && value !== undefined && value !== null) {
122
+ searchParams.set(key, String(value));
123
+ }
124
+ }
125
+ }
126
+ return this.get(`/api/reasoning/learnings/enhanced?${searchParams}`).catch(() => ({ learnings: [], total: 0, limit: 50, offset: 0 }));
127
+ }
128
+ /**
129
+ * Get learning statistics.
130
+ * GET /api/reasoning/learnings/stats
131
+ */
132
+ async getLearningStats(repo) {
133
+ const r = repo ?? this.repo;
134
+ return this.get(`/api/reasoning/learnings/stats?repo=${r}`).catch(() => ({
135
+ total_learnings: 0,
136
+ by_category: {},
137
+ by_status: {},
138
+ avg_confidence: 0,
139
+ high_confidence_count: 0,
140
+ source_type_distribution: {},
141
+ }));
142
+ }
143
+ // ─── Backlog queries ────────────────────────────────────────────
144
+ /**
145
+ * Query backlog items.
146
+ * GET /api/reasoning/backlog
147
+ */
148
+ async getBacklog(params) {
149
+ const searchParams = new URLSearchParams();
150
+ searchParams.set("repo", params?.repo ?? this.repo);
151
+ if (params) {
152
+ for (const [key, value] of Object.entries(params)) {
153
+ if (key !== "repo" && value !== undefined && value !== null) {
154
+ searchParams.set(key, String(value));
155
+ }
156
+ }
157
+ }
158
+ return this.get(`/api/reasoning/backlog?${searchParams}`).catch(() => []);
159
+ }
160
+ // ─── Semantic search ────────────────────────────────────────────
161
+ /**
162
+ * Semantic search for learnings by natural language query.
163
+ * GET /api/learnings/semantic/:query
164
+ */
165
+ async semanticSearch(query, options) {
166
+ const params = new URLSearchParams();
167
+ // repo is optional for account_wide visibility (cross-repo search)
168
+ if (options?.repo)
169
+ params.set("repo", options.repo);
170
+ else if (!options?.visibility ||
171
+ options.visibility === "user_repo" ||
172
+ options.visibility === "user_private")
173
+ params.set("repo", this.repo);
174
+ if (options?.limit)
175
+ params.set("limit", String(options.limit));
176
+ if (options?.min_similarity)
177
+ params.set("min_similarity", String(options.min_similarity));
178
+ if (options?.min_confidence)
179
+ params.set("min_confidence", String(options.min_confidence));
180
+ if (options?.visibility)
181
+ params.set("visibility", options.visibility);
182
+ return this.get(`/api/learnings/semantic/${encodeURIComponent(query)}?${params}`).catch(() => ({ query, results: [], total: 0 }));
183
+ }
184
+ // ─── Consolidation ──────────────────────────────────────────────
185
+ /**
186
+ * Trigger a consolidation run.
187
+ * POST /api/reasoning/consolidate
188
+ */
189
+ async triggerConsolidation(req) {
190
+ return this.post("/api/reasoning/consolidate", req);
191
+ }
192
+ // ─── HTTP helpers ───────────────────────────────────────────────
193
+ authHeaders() {
194
+ // Resolve credentials fresh each call so .env / credentials.json
195
+ // changes (e.g. after `login`) are picked up without MCP restart.
196
+ const key = this.apiKey || resolveApiKey();
197
+ const headers = {
198
+ "Content-Type": "application/json",
199
+ };
200
+ if (key) {
201
+ // JWTs have dots (header.payload.signature); API keys don't.
202
+ // Sending both headers causes the server to try Bearer first and fail
203
+ // when the value is an API key, never falling back to X-Api-Key.
204
+ const isJwt = key.includes(".");
205
+ if (isJwt) {
206
+ headers["Authorization"] = `Bearer ${key}`;
207
+ }
208
+ else {
209
+ headers["X-Api-Key"] = key;
210
+ }
211
+ }
212
+ return headers;
213
+ }
214
+ async get(path) {
215
+ const controller = new AbortController();
216
+ const timer = setTimeout(() => controller.abort(), this.timeout);
217
+ try {
218
+ const response = await fetch(`${this.apiUrl}${path}`, {
219
+ method: "GET",
220
+ headers: this.authHeaders(),
221
+ signal: controller.signal,
222
+ });
223
+ if (response.status === 401) {
224
+ const retried = await this.retryWithRefresh("GET", path);
225
+ if (retried !== null)
226
+ return retried;
227
+ }
228
+ if (!response.ok)
229
+ throw new Error(`HTTP ${response.status}`);
230
+ return response.json();
231
+ }
232
+ finally {
233
+ clearTimeout(timer);
234
+ }
235
+ }
236
+ async post(path, body) {
237
+ const controller = new AbortController();
238
+ const timer = setTimeout(() => controller.abort(), this.timeout);
239
+ try {
240
+ const response = await fetch(`${this.apiUrl}${path}`, {
241
+ method: "POST",
242
+ headers: this.authHeaders(),
243
+ body: JSON.stringify(body),
244
+ signal: controller.signal,
245
+ });
246
+ if (response.status === 401) {
247
+ const retried = await this.retryWithRefresh("POST", path, body);
248
+ if (retried !== null)
249
+ return retried;
250
+ }
251
+ if (!response.ok) {
252
+ const text = await response.text().catch(() => "");
253
+ throw new Error(`HTTP ${response.status}: ${text}`);
254
+ }
255
+ return response.json();
256
+ }
257
+ finally {
258
+ clearTimeout(timer);
259
+ }
260
+ }
261
+ /**
262
+ * On 401, attempt to refresh the token and retry the request once.
263
+ * Returns the parsed JSON response on success, or null if refresh failed.
264
+ */
265
+ async retryWithRefresh(method, path, body) {
266
+ const newKey = await resolveApiKeyWithRefresh();
267
+ if (!newKey)
268
+ return null;
269
+ const headers = {
270
+ "Content-Type": "application/json",
271
+ };
272
+ const isJwt = newKey.includes(".");
273
+ if (isJwt) {
274
+ headers["Authorization"] = `Bearer ${newKey}`;
275
+ }
276
+ else {
277
+ headers["X-Api-Key"] = newKey;
278
+ }
279
+ const opts = {
280
+ method,
281
+ headers,
282
+ signal: AbortSignal.timeout(this.timeout),
283
+ };
284
+ if (body !== undefined) {
285
+ opts.body = JSON.stringify(body);
286
+ }
287
+ const retryResponse = await fetch(`${this.apiUrl}${path}`, opts);
288
+ if (!retryResponse.ok)
289
+ return null;
290
+ return retryResponse.json();
291
+ }
292
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @deprecated Use `OkaClient` from `./client.js` instead.
3
+ * This module is kept for backward compatibility.
4
+ * The unified OkaClient now includes all consolidation engine methods.
5
+ */
6
+ export type { ConsolidateRequest, ConsolidateResponse, EnhancedLearningParams, PaginatedLearnings, BacklogParams, LearningStats, } from "./client.js";
7
+ import { OkaClient } from "./client.js";
8
+ /**
9
+ * @deprecated Use `OkaClient` directly. `OkaClientExt` is now a type alias.
10
+ */
11
+ export declare class OkaClientExt extends OkaClient {
12
+ }
13
+ //# sourceMappingURL=client_ext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client_ext.d.ts","sourceRoot":"","sources":["../src/client_ext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;CAAG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @deprecated Use `OkaClient` from `./client.js` instead.
3
+ * This module is kept for backward compatibility.
4
+ * The unified OkaClient now includes all consolidation engine methods.
5
+ */
6
+ // Re-export the unified client as OkaClientExt for backward compat
7
+ import { OkaClient } from "./client.js";
8
+ /**
9
+ * @deprecated Use `OkaClient` directly. `OkaClientExt` is now a type alias.
10
+ */
11
+ export class OkaClientExt extends OkaClient {
12
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { OkaClient } from "./client.js";
5
+ import { registerWriteTools } from "./tools/write.js";
6
+ import { registerReadTools } from "./tools/read.js";
7
+ import { registerAuthTools } from "./tools/auth.js";
8
+ import { loadEnvFile } from "./auth.js";
9
+ // Load .env from the project root (cwd), env vars take precedence
10
+ loadEnvFile(process.cwd());
11
+ const server = new McpServer({
12
+ name: "@oka-core/reason",
13
+ version: "0.3.0",
14
+ });
15
+ // Client resolves credentials lazily on each request — no restart needed
16
+ // after login or credential changes.
17
+ const client = new OkaClient();
18
+ registerWriteTools(server, client);
19
+ registerReadTools(server, client);
20
+ registerAuthTools(server, client);
21
+ const transport = new StdioServerTransport();
22
+ await server.connect(transport);
@@ -0,0 +1,225 @@
1
+ import { z } from "zod";
2
+ export declare const RecordDecisionInput: z.ZodObject<{
3
+ description: z.ZodString;
4
+ rationale: z.ZodString;
5
+ alternatives_considered: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6
+ confidence: z.ZodNumber;
7
+ }, "strip", z.ZodTypeAny, {
8
+ confidence: number;
9
+ description: string;
10
+ rationale: string;
11
+ alternatives_considered: string[];
12
+ }, {
13
+ confidence: number;
14
+ description: string;
15
+ rationale: string;
16
+ alternatives_considered?: string[] | undefined;
17
+ }>;
18
+ export type RecordDecisionInput = z.infer<typeof RecordDecisionInput>;
19
+ export declare const RecordExplorationInput: z.ZodObject<{
20
+ area: z.ZodString;
21
+ findings: z.ZodString;
22
+ relevance_score: z.ZodNumber;
23
+ }, "strip", z.ZodTypeAny, {
24
+ area: string;
25
+ findings: string;
26
+ relevance_score: number;
27
+ }, {
28
+ area: string;
29
+ findings: string;
30
+ relevance_score: number;
31
+ }>;
32
+ export type RecordExplorationInput = z.infer<typeof RecordExplorationInput>;
33
+ export declare const RecordDeviationInput: z.ZodObject<{
34
+ planned_action: z.ZodString;
35
+ actual_action: z.ZodString;
36
+ reason: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ planned_action: string;
39
+ actual_action: string;
40
+ reason: string;
41
+ }, {
42
+ planned_action: string;
43
+ actual_action: string;
44
+ reason: string;
45
+ }>;
46
+ export type RecordDeviationInput = z.infer<typeof RecordDeviationInput>;
47
+ export declare const RecordCompletionInput: z.ZodObject<{
48
+ task_id: z.ZodString;
49
+ outcome: z.ZodEnum<["success", "partial", "failed"]>;
50
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
51
+ quality_signals: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ task_id: string;
54
+ outcome: "success" | "partial" | "failed";
55
+ artifacts: string[];
56
+ quality_signals: Record<string, number>;
57
+ }, {
58
+ task_id: string;
59
+ outcome: "success" | "partial" | "failed";
60
+ artifacts?: string[] | undefined;
61
+ quality_signals?: Record<string, number> | undefined;
62
+ }>;
63
+ export type RecordCompletionInput = z.infer<typeof RecordCompletionInput>;
64
+ export declare const RecordObservationInput: z.ZodObject<{
65
+ category: z.ZodEnum<["architecture", "bug_pattern", "convention", "performance", "security", "workflow", "dependency", "code_quality", "other"]>;
66
+ summary: z.ZodString;
67
+ details: z.ZodOptional<z.ZodString>;
68
+ confidence: z.ZodDefault<z.ZodNumber>;
69
+ file_patterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
70
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ file_patterns: string[];
73
+ confidence: number;
74
+ category: "architecture" | "bug_pattern" | "convention" | "performance" | "security" | "workflow" | "dependency" | "code_quality" | "other";
75
+ tags: string[];
76
+ summary: string;
77
+ details?: string | undefined;
78
+ }, {
79
+ category: "architecture" | "bug_pattern" | "convention" | "performance" | "security" | "workflow" | "dependency" | "code_quality" | "other";
80
+ summary: string;
81
+ file_patterns?: string[] | undefined;
82
+ confidence?: number | undefined;
83
+ tags?: string[] | undefined;
84
+ details?: string | undefined;
85
+ }>;
86
+ export type RecordObservationInput = z.infer<typeof RecordObservationInput>;
87
+ export declare const GetContextInput: z.ZodObject<{
88
+ topic: z.ZodString;
89
+ repo: z.ZodOptional<z.ZodString>;
90
+ file_patterns: z.ZodOptional<z.ZodString>;
91
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
92
+ min_confidence: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ limit: number;
95
+ min_confidence: number;
96
+ topic: string;
97
+ repo?: string | undefined;
98
+ file_patterns?: string | undefined;
99
+ }, {
100
+ topic: string;
101
+ repo?: string | undefined;
102
+ file_patterns?: string | undefined;
103
+ limit?: number | undefined;
104
+ min_confidence?: number | undefined;
105
+ }>;
106
+ export type GetContextInput = z.infer<typeof GetContextInput>;
107
+ export declare const ListLearningsInput: z.ZodObject<{
108
+ repo: z.ZodOptional<z.ZodString>;
109
+ category: z.ZodOptional<z.ZodEnum<["architecture", "bug_pattern", "convention", "decision", "performance", "security", "workflow", "domain_knowledge"]>>;
110
+ status: z.ZodOptional<z.ZodEnum<["active", "reinforced", "contradicted", "obsolete"]>>;
111
+ min_confidence: z.ZodOptional<z.ZodNumber>;
112
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ limit: number;
115
+ repo?: string | undefined;
116
+ min_confidence?: number | undefined;
117
+ category?: "decision" | "architecture" | "bug_pattern" | "convention" | "performance" | "security" | "workflow" | "domain_knowledge" | undefined;
118
+ status?: "active" | "reinforced" | "contradicted" | "obsolete" | undefined;
119
+ }, {
120
+ repo?: string | undefined;
121
+ limit?: number | undefined;
122
+ min_confidence?: number | undefined;
123
+ category?: "decision" | "architecture" | "bug_pattern" | "convention" | "performance" | "security" | "workflow" | "domain_knowledge" | undefined;
124
+ status?: "active" | "reinforced" | "contradicted" | "obsolete" | undefined;
125
+ }>;
126
+ export type ListLearningsInput = z.infer<typeof ListLearningsInput>;
127
+ export declare const GetDecisionsInput: z.ZodObject<{
128
+ repo: z.ZodString;
129
+ module: z.ZodOptional<z.ZodString>;
130
+ timeframe: z.ZodOptional<z.ZodString>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ repo: string;
133
+ module?: string | undefined;
134
+ timeframe?: string | undefined;
135
+ }, {
136
+ repo: string;
137
+ module?: string | undefined;
138
+ timeframe?: string | undefined;
139
+ }>;
140
+ export type GetDecisionsInput = z.infer<typeof GetDecisionsInput>;
141
+ export declare const GetPatternsInput: z.ZodObject<{
142
+ repo: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ repo: string;
145
+ }, {
146
+ repo: string;
147
+ }>;
148
+ export type GetPatternsInput = z.infer<typeof GetPatternsInput>;
149
+ export declare const SuggestPrioritiesInput: z.ZodObject<{
150
+ repo: z.ZodString;
151
+ backlog: z.ZodArray<z.ZodString, "many">;
152
+ }, "strip", z.ZodTypeAny, {
153
+ repo: string;
154
+ backlog: string[];
155
+ }, {
156
+ repo: string;
157
+ backlog: string[];
158
+ }>;
159
+ export type SuggestPrioritiesInput = z.infer<typeof SuggestPrioritiesInput>;
160
+ export declare const ReasoningEvent: z.ZodObject<{
161
+ id: z.ZodString;
162
+ repo: z.ZodString;
163
+ agent_id: z.ZodString;
164
+ event_type: z.ZodString;
165
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
166
+ session_id: z.ZodString;
167
+ timestamp: z.ZodString;
168
+ }, "strip", z.ZodTypeAny, {
169
+ repo: string;
170
+ id: string;
171
+ agent_id: string;
172
+ event_type: string;
173
+ payload: Record<string, unknown>;
174
+ session_id: string;
175
+ timestamp: string;
176
+ }, {
177
+ repo: string;
178
+ id: string;
179
+ agent_id: string;
180
+ event_type: string;
181
+ payload: Record<string, unknown>;
182
+ session_id: string;
183
+ timestamp: string;
184
+ }>;
185
+ export type ReasoningEvent = z.infer<typeof ReasoningEvent>;
186
+ export declare const Learning: z.ZodObject<{
187
+ id: z.ZodString;
188
+ repo: z.ZodString;
189
+ summary: z.ZodString;
190
+ file_patterns: z.ZodArray<z.ZodString, "many">;
191
+ tags: z.ZodArray<z.ZodString, "many">;
192
+ confidence: z.ZodNumber;
193
+ created_at: z.ZodString;
194
+ }, "strip", z.ZodTypeAny, {
195
+ repo: string;
196
+ file_patterns: string[];
197
+ confidence: number;
198
+ tags: string[];
199
+ summary: string;
200
+ id: string;
201
+ created_at: string;
202
+ }, {
203
+ repo: string;
204
+ file_patterns: string[];
205
+ confidence: number;
206
+ tags: string[];
207
+ summary: string;
208
+ id: string;
209
+ created_at: string;
210
+ }>;
211
+ export type Learning = z.infer<typeof Learning>;
212
+ export declare const QueryResult: <T extends z.ZodType>(itemSchema: T) => z.ZodObject<{
213
+ results: z.ZodArray<T, "many">;
214
+ confidence: z.ZodNumber;
215
+ source_count: z.ZodNumber;
216
+ }, "strip", z.ZodTypeAny, {
217
+ confidence: number;
218
+ source_count: number;
219
+ results: T["_output"][];
220
+ }, {
221
+ confidence: number;
222
+ source_count: number;
223
+ results: T["_input"][];
224
+ }>;
225
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAiBjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAI5E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAmB7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAI5E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;EAQnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC;;;;;;;;;;;;EAK1D,CAAC"}