suemo 0.1.4 → 0.1.7

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/src/types.ts CHANGED
@@ -131,19 +131,47 @@ export const SuemoStatsSchema = z.object({
131
131
  export type SuemoStats = z.infer<typeof SuemoStatsSchema>
132
132
 
133
133
  // ── query() input ─────────────────────────────────────────────────────────────
134
+ export const QueryStrategySchema = z.enum(['vector', 'bm25', 'graph'])
135
+ export type QueryStrategy = z.infer<typeof QueryStrategySchema>
136
+
134
137
  export const QueryInputSchema = z.object({
135
138
  input: z.string().min(1),
136
139
  scope: z.string().optional(),
137
140
  kind: z.array(MemoryKindSchema).optional(),
138
141
  topK: z.number().int().min(1).max(50).default(5).optional(),
139
142
  activeOnly: z.boolean().default(true).optional(),
140
- strategies: z
141
- .array(z.enum(['vector', 'bm25', 'graph']))
142
- .default(['vector', 'bm25', 'graph'])
143
- .optional(),
143
+ strategies: z.array(QueryStrategySchema).default(['vector', 'bm25', 'graph']).optional(),
144
+ explain: z.boolean().default(false).optional(),
145
+ minScore: z.number().min(0).max(1).optional(),
146
+ relativeFloor: z.number().min(0).max(1).optional(),
144
147
  })
145
148
  export type QueryInput = z.infer<typeof QueryInputSchema>
146
149
 
150
+ export interface QueryStrategyBreakdown {
151
+ raw: number
152
+ norm: number
153
+ weighted: number
154
+ rank: number
155
+ }
156
+
157
+ export interface QueryRetrievalExplain {
158
+ finalScore: number
159
+ matchedStrategies: QueryStrategy[]
160
+ agreementBonus: number
161
+ thresholds: {
162
+ minScore: number
163
+ relativeFloor: number
164
+ topScore: number
165
+ relativeMinScore: number
166
+ primaryEvidenceMin: number
167
+ }
168
+ vector?: QueryStrategyBreakdown
169
+ bm25?: QueryStrategyBreakdown
170
+ graph?: QueryStrategyBreakdown & { anchorCount: number }
171
+ }
172
+
173
+ export type QueryNode = MemoryNode & { _retrieval?: QueryRetrievalExplain }
174
+
147
175
  // ── Health report ─────────────────────────────────────────────────────────────
148
176
  export const HealthReportSchema = z.object({
149
177
  nodes: z.object({