viberag 0.3.2 → 0.4.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 (209) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/app.d.ts +3 -0
  3. package/dist/cli/app.js +100 -102
  4. package/dist/cli/commands/handlers.d.ts +8 -6
  5. package/dist/cli/commands/handlers.js +90 -32
  6. package/dist/cli/commands/useCommands.d.ts +20 -0
  7. package/dist/cli/commands/useCommands.js +189 -0
  8. package/dist/cli/commands/useRagCommands.d.ts +2 -5
  9. package/dist/cli/commands/useRagCommands.js +11 -18
  10. package/dist/cli/components/InitWizard.js +66 -27
  11. package/dist/cli/components/McpSetupWizard.js +23 -4
  12. package/dist/cli/components/SlotRow.d.ts +22 -0
  13. package/dist/cli/components/SlotRow.js +55 -0
  14. package/dist/cli/components/StatusBar.d.ts +14 -0
  15. package/dist/cli/components/StatusBar.js +156 -0
  16. package/dist/cli/contexts/DaemonStatusContext.d.ts +38 -0
  17. package/dist/cli/contexts/DaemonStatusContext.js +106 -0
  18. package/dist/cli/hooks/useStatusPolling.d.ts +34 -0
  19. package/dist/cli/hooks/useStatusPolling.js +121 -0
  20. package/dist/cli/store/app/selectors.d.ts +87 -0
  21. package/dist/cli/store/app/selectors.js +28 -0
  22. package/dist/cli/store/app/slice.d.ts +1013 -0
  23. package/dist/cli/store/app/slice.js +112 -0
  24. package/dist/cli/store/hooks.d.ts +22 -0
  25. package/dist/cli/store/hooks.js +17 -0
  26. package/dist/cli/store/store.d.ts +17 -0
  27. package/dist/cli/store/store.js +18 -0
  28. package/dist/cli/store/wizard/selectors.d.ts +115 -0
  29. package/dist/cli/store/wizard/selectors.js +36 -0
  30. package/dist/cli/store/wizard/slice.d.ts +523 -0
  31. package/dist/cli/store/wizard/slice.js +119 -0
  32. package/dist/cli/utils/error-handler.d.ts +55 -0
  33. package/dist/cli/utils/error-handler.js +92 -0
  34. package/dist/client/auto-start.d.ts +42 -0
  35. package/dist/client/auto-start.js +250 -0
  36. package/dist/client/connection.d.ts +48 -0
  37. package/dist/client/connection.js +200 -0
  38. package/dist/client/index.d.ts +93 -0
  39. package/dist/client/index.js +209 -0
  40. package/dist/client/types.d.ts +105 -0
  41. package/dist/client/types.js +7 -0
  42. package/dist/common/components/SlotRow.d.ts +22 -0
  43. package/dist/common/components/SlotRow.js +53 -0
  44. package/dist/common/components/StatusBar.js +82 -31
  45. package/dist/common/types.d.ts +12 -13
  46. package/dist/daemon/handlers.d.ts +15 -0
  47. package/dist/daemon/handlers.js +157 -0
  48. package/dist/daemon/index.d.ts +21 -0
  49. package/dist/daemon/index.js +123 -0
  50. package/dist/daemon/lib/chunker/bounded-channel.d.ts +51 -0
  51. package/dist/daemon/lib/chunker/bounded-channel.js +138 -0
  52. package/dist/daemon/lib/chunker/index.d.ts +135 -0
  53. package/dist/daemon/lib/chunker/index.js +1370 -0
  54. package/dist/daemon/lib/chunker/types.d.ts +77 -0
  55. package/dist/daemon/lib/chunker/types.js +50 -0
  56. package/dist/daemon/lib/config.d.ts +73 -0
  57. package/dist/daemon/lib/config.js +149 -0
  58. package/dist/daemon/lib/constants.d.ts +75 -0
  59. package/dist/daemon/lib/constants.js +114 -0
  60. package/dist/daemon/lib/gitignore.d.ts +57 -0
  61. package/dist/daemon/lib/gitignore.js +246 -0
  62. package/dist/daemon/lib/logger.d.ts +51 -0
  63. package/dist/daemon/lib/logger.js +167 -0
  64. package/dist/daemon/lib/manifest.d.ts +58 -0
  65. package/dist/daemon/lib/manifest.js +116 -0
  66. package/dist/daemon/lib/merkle/diff.d.ts +32 -0
  67. package/dist/daemon/lib/merkle/diff.js +107 -0
  68. package/dist/daemon/lib/merkle/hash.d.ts +40 -0
  69. package/dist/daemon/lib/merkle/hash.js +180 -0
  70. package/dist/daemon/lib/merkle/index.d.ts +71 -0
  71. package/dist/daemon/lib/merkle/index.js +309 -0
  72. package/dist/daemon/lib/merkle/node.d.ts +55 -0
  73. package/dist/daemon/lib/merkle/node.js +82 -0
  74. package/dist/daemon/lifecycle.d.ts +50 -0
  75. package/dist/daemon/lifecycle.js +142 -0
  76. package/dist/daemon/owner.d.ts +175 -0
  77. package/dist/daemon/owner.js +609 -0
  78. package/dist/daemon/protocol.d.ts +100 -0
  79. package/dist/daemon/protocol.js +163 -0
  80. package/dist/daemon/providers/api-utils.d.ts +130 -0
  81. package/dist/daemon/providers/api-utils.js +248 -0
  82. package/dist/daemon/providers/gemini.d.ts +39 -0
  83. package/dist/daemon/providers/gemini.js +205 -0
  84. package/dist/daemon/providers/index.d.ts +14 -0
  85. package/dist/daemon/providers/index.js +14 -0
  86. package/dist/daemon/providers/local-4b.d.ts +28 -0
  87. package/dist/daemon/providers/local-4b.js +51 -0
  88. package/dist/daemon/providers/local.d.ts +36 -0
  89. package/dist/daemon/providers/local.js +166 -0
  90. package/dist/daemon/providers/mistral.d.ts +35 -0
  91. package/dist/daemon/providers/mistral.js +160 -0
  92. package/dist/daemon/providers/mock.d.ts +35 -0
  93. package/dist/daemon/providers/mock.js +69 -0
  94. package/dist/daemon/providers/openai.d.ts +41 -0
  95. package/dist/daemon/providers/openai.js +190 -0
  96. package/dist/daemon/providers/types.d.ts +68 -0
  97. package/dist/daemon/providers/types.js +6 -0
  98. package/dist/daemon/providers/validate.d.ts +30 -0
  99. package/dist/daemon/providers/validate.js +162 -0
  100. package/dist/daemon/server.d.ts +79 -0
  101. package/dist/daemon/server.js +293 -0
  102. package/dist/daemon/services/index.d.ts +11 -0
  103. package/dist/daemon/services/index.js +16 -0
  104. package/dist/daemon/services/indexing.d.ts +117 -0
  105. package/dist/daemon/services/indexing.js +573 -0
  106. package/dist/daemon/services/search/filters.d.ts +21 -0
  107. package/dist/daemon/services/search/filters.js +106 -0
  108. package/dist/daemon/services/search/fts.d.ts +32 -0
  109. package/dist/daemon/services/search/fts.js +61 -0
  110. package/dist/daemon/services/search/hybrid.d.ts +17 -0
  111. package/dist/daemon/services/search/hybrid.js +58 -0
  112. package/dist/daemon/services/search/index.d.ts +108 -0
  113. package/dist/daemon/services/search/index.js +417 -0
  114. package/dist/daemon/services/search/types.d.ts +126 -0
  115. package/dist/daemon/services/search/types.js +4 -0
  116. package/dist/daemon/services/search/vector.d.ts +25 -0
  117. package/dist/daemon/services/search/vector.js +44 -0
  118. package/dist/daemon/services/storage/index.d.ts +110 -0
  119. package/dist/daemon/services/storage/index.js +378 -0
  120. package/dist/daemon/services/storage/schema.d.ts +24 -0
  121. package/dist/daemon/services/storage/schema.js +51 -0
  122. package/dist/daemon/services/storage/types.d.ts +105 -0
  123. package/dist/daemon/services/storage/types.js +71 -0
  124. package/dist/daemon/services/types.d.ts +192 -0
  125. package/dist/daemon/services/types.js +53 -0
  126. package/dist/daemon/services/watcher.d.ts +98 -0
  127. package/dist/daemon/services/watcher.js +386 -0
  128. package/dist/daemon/state.d.ts +119 -0
  129. package/dist/daemon/state.js +161 -0
  130. package/dist/mcp/index.d.ts +1 -1
  131. package/dist/mcp/index.js +44 -60
  132. package/dist/mcp/server.d.ts +10 -14
  133. package/dist/mcp/server.js +75 -74
  134. package/dist/mcp/services/lazy-loader.d.ts +23 -0
  135. package/dist/mcp/services/lazy-loader.js +34 -0
  136. package/dist/mcp/warmup.d.ts +3 -3
  137. package/dist/mcp/warmup.js +39 -40
  138. package/dist/mcp/watcher.d.ts +5 -7
  139. package/dist/mcp/watcher.js +73 -64
  140. package/dist/rag/config/index.d.ts +2 -0
  141. package/dist/rag/constants.d.ts +30 -0
  142. package/dist/rag/constants.js +38 -0
  143. package/dist/rag/embeddings/api-utils.d.ts +121 -0
  144. package/dist/rag/embeddings/api-utils.js +259 -0
  145. package/dist/rag/embeddings/gemini.d.ts +4 -12
  146. package/dist/rag/embeddings/gemini.js +22 -72
  147. package/dist/rag/embeddings/index.d.ts +5 -3
  148. package/dist/rag/embeddings/index.js +5 -2
  149. package/dist/rag/embeddings/local-4b.d.ts +2 -2
  150. package/dist/rag/embeddings/local-4b.js +1 -1
  151. package/dist/rag/embeddings/local.d.ts +10 -3
  152. package/dist/rag/embeddings/local.js +58 -12
  153. package/dist/rag/embeddings/mistral.d.ts +4 -12
  154. package/dist/rag/embeddings/mistral.js +22 -72
  155. package/dist/rag/embeddings/mock.d.ts +35 -0
  156. package/dist/rag/embeddings/mock.js +69 -0
  157. package/dist/rag/embeddings/openai.d.ts +11 -13
  158. package/dist/rag/embeddings/openai.js +47 -75
  159. package/dist/rag/embeddings/types.d.ts +27 -1
  160. package/dist/rag/embeddings/validate.d.ts +9 -1
  161. package/dist/rag/embeddings/validate.js +17 -4
  162. package/dist/rag/index.d.ts +2 -2
  163. package/dist/rag/index.js +1 -1
  164. package/dist/rag/indexer/bounded-channel.d.ts +51 -0
  165. package/dist/rag/indexer/bounded-channel.js +138 -0
  166. package/dist/rag/indexer/indexer.d.ts +4 -14
  167. package/dist/rag/indexer/indexer.js +246 -169
  168. package/dist/rag/indexer/types.d.ts +1 -0
  169. package/dist/rag/logger/index.d.ts +22 -0
  170. package/dist/rag/logger/index.js +78 -1
  171. package/dist/rag/manifest/index.js +1 -2
  172. package/dist/rag/search/index.js +1 -1
  173. package/dist/rag/storage/schema.d.ts +2 -4
  174. package/dist/rag/storage/schema.js +3 -5
  175. package/dist/store/app/selectors.d.ts +87 -0
  176. package/dist/store/app/selectors.js +28 -0
  177. package/dist/store/app/slice.d.ts +1013 -0
  178. package/dist/store/app/slice.js +112 -0
  179. package/dist/store/hooks.d.ts +22 -0
  180. package/dist/store/hooks.js +17 -0
  181. package/dist/store/index.d.ts +12 -0
  182. package/dist/store/index.js +18 -0
  183. package/dist/store/indexing/listeners.d.ts +25 -0
  184. package/dist/store/indexing/listeners.js +46 -0
  185. package/dist/store/indexing/selectors.d.ts +195 -0
  186. package/dist/store/indexing/selectors.js +69 -0
  187. package/dist/store/indexing/slice.d.ts +309 -0
  188. package/dist/store/indexing/slice.js +113 -0
  189. package/dist/store/slot-progress/listeners.d.ts +23 -0
  190. package/dist/store/slot-progress/listeners.js +33 -0
  191. package/dist/store/slot-progress/selectors.d.ts +67 -0
  192. package/dist/store/slot-progress/selectors.js +36 -0
  193. package/dist/store/slot-progress/slice.d.ts +246 -0
  194. package/dist/store/slot-progress/slice.js +70 -0
  195. package/dist/store/store.d.ts +17 -0
  196. package/dist/store/store.js +18 -0
  197. package/dist/store/warmup/selectors.d.ts +109 -0
  198. package/dist/store/warmup/selectors.js +44 -0
  199. package/dist/store/warmup/slice.d.ts +137 -0
  200. package/dist/store/warmup/slice.js +72 -0
  201. package/dist/store/watcher/selectors.d.ts +115 -0
  202. package/dist/store/watcher/selectors.js +52 -0
  203. package/dist/store/watcher/slice.d.ts +269 -0
  204. package/dist/store/watcher/slice.js +100 -0
  205. package/dist/store/wizard/selectors.d.ts +115 -0
  206. package/dist/store/wizard/selectors.js +36 -0
  207. package/dist/store/wizard/slice.d.ts +523 -0
  208. package/dist/store/wizard/slice.js +119 -0
  209. package/package.json +10 -2
@@ -0,0 +1,246 @@
1
+ /**
2
+ * Redux slice for slot progress during indexing.
3
+ *
4
+ * Separates trigger actions (intercepted by listeners) from mutation actions
5
+ * (called directly by api-utils).
6
+ */
7
+ import { type PayloadAction } from '@reduxjs/toolkit';
8
+ /**
9
+ * State of a single embedding slot.
10
+ * Matches daemon SlotInfo type.
11
+ */
12
+ export type SlotState = {
13
+ state: 'idle' | 'processing' | 'rate-limited';
14
+ batchInfo: string | null;
15
+ retryInfo: string | null;
16
+ };
17
+ /**
18
+ * Information about a batch that failed after exhausting all retries.
19
+ * Matches daemon FailureInfo type.
20
+ */
21
+ export type FailedChunk = {
22
+ /** Batch info (e.g., "chunks 15-20") */
23
+ batchInfo: string;
24
+ /** Error message */
25
+ error: string;
26
+ /** ISO timestamp when failure occurred */
27
+ timestamp: string;
28
+ };
29
+ export interface SlotProgressState {
30
+ slots: SlotState[];
31
+ /** Batches that failed after exhausting all retries */
32
+ failures: FailedChunk[];
33
+ }
34
+ export declare const slotProgressSlice: import("@reduxjs/toolkit").Slice<SlotProgressState, {
35
+ setSlotProcessing: (state: {
36
+ slots: {
37
+ state: "idle" | "processing" | "rate-limited";
38
+ batchInfo: string | null;
39
+ retryInfo: string | null;
40
+ }[];
41
+ failures: {
42
+ batchInfo: string;
43
+ error: string;
44
+ timestamp: string;
45
+ }[];
46
+ }, action: PayloadAction<{
47
+ index: number;
48
+ batchInfo: string;
49
+ }>) => void;
50
+ setSlotRateLimited: (state: {
51
+ slots: {
52
+ state: "idle" | "processing" | "rate-limited";
53
+ batchInfo: string | null;
54
+ retryInfo: string | null;
55
+ }[];
56
+ failures: {
57
+ batchInfo: string;
58
+ error: string;
59
+ timestamp: string;
60
+ }[];
61
+ }, action: PayloadAction<{
62
+ index: number;
63
+ batchInfo: string;
64
+ retryInfo: string;
65
+ }>) => void;
66
+ setSlotIdle: (state: {
67
+ slots: {
68
+ state: "idle" | "processing" | "rate-limited";
69
+ batchInfo: string | null;
70
+ retryInfo: string | null;
71
+ }[];
72
+ failures: {
73
+ batchInfo: string;
74
+ error: string;
75
+ timestamp: string;
76
+ }[];
77
+ }, action: PayloadAction<number>) => void;
78
+ resetSlots: (state: {
79
+ slots: {
80
+ state: "idle" | "processing" | "rate-limited";
81
+ batchInfo: string | null;
82
+ retryInfo: string | null;
83
+ }[];
84
+ failures: {
85
+ batchInfo: string;
86
+ error: string;
87
+ timestamp: string;
88
+ }[];
89
+ }) => void;
90
+ /**
91
+ * Record a batch failure after all retries exhausted.
92
+ */
93
+ addFailure: (state: {
94
+ slots: {
95
+ state: "idle" | "processing" | "rate-limited";
96
+ batchInfo: string | null;
97
+ retryInfo: string | null;
98
+ }[];
99
+ failures: {
100
+ batchInfo: string;
101
+ error: string;
102
+ timestamp: string;
103
+ }[];
104
+ }, action: PayloadAction<FailedChunk>) => void;
105
+ /**
106
+ * Clear all recorded failures (typically at start of new indexing run).
107
+ */
108
+ clearFailures: (state: {
109
+ slots: {
110
+ state: "idle" | "processing" | "rate-limited";
111
+ batchInfo: string | null;
112
+ retryInfo: string | null;
113
+ }[];
114
+ failures: {
115
+ batchInfo: string;
116
+ error: string;
117
+ timestamp: string;
118
+ }[];
119
+ }) => void;
120
+ /**
121
+ * Sync full state from daemon status (for polling-based updates).
122
+ * Replaces slots and failures arrays from daemon status response.
123
+ */
124
+ sync: (state: {
125
+ slots: {
126
+ state: "idle" | "processing" | "rate-limited";
127
+ batchInfo: string | null;
128
+ retryInfo: string | null;
129
+ }[];
130
+ failures: {
131
+ batchInfo: string;
132
+ error: string;
133
+ timestamp: string;
134
+ }[];
135
+ }, action: PayloadAction<{
136
+ slots: SlotState[];
137
+ failures: FailedChunk[];
138
+ }>) => void;
139
+ }, "slotProgress", "slotProgress", import("@reduxjs/toolkit").SliceSelectors<SlotProgressState>>;
140
+ export declare const SlotProgressActions: import("@reduxjs/toolkit").CaseReducerActions<{
141
+ setSlotProcessing: (state: {
142
+ slots: {
143
+ state: "idle" | "processing" | "rate-limited";
144
+ batchInfo: string | null;
145
+ retryInfo: string | null;
146
+ }[];
147
+ failures: {
148
+ batchInfo: string;
149
+ error: string;
150
+ timestamp: string;
151
+ }[];
152
+ }, action: PayloadAction<{
153
+ index: number;
154
+ batchInfo: string;
155
+ }>) => void;
156
+ setSlotRateLimited: (state: {
157
+ slots: {
158
+ state: "idle" | "processing" | "rate-limited";
159
+ batchInfo: string | null;
160
+ retryInfo: string | null;
161
+ }[];
162
+ failures: {
163
+ batchInfo: string;
164
+ error: string;
165
+ timestamp: string;
166
+ }[];
167
+ }, action: PayloadAction<{
168
+ index: number;
169
+ batchInfo: string;
170
+ retryInfo: string;
171
+ }>) => void;
172
+ setSlotIdle: (state: {
173
+ slots: {
174
+ state: "idle" | "processing" | "rate-limited";
175
+ batchInfo: string | null;
176
+ retryInfo: string | null;
177
+ }[];
178
+ failures: {
179
+ batchInfo: string;
180
+ error: string;
181
+ timestamp: string;
182
+ }[];
183
+ }, action: PayloadAction<number>) => void;
184
+ resetSlots: (state: {
185
+ slots: {
186
+ state: "idle" | "processing" | "rate-limited";
187
+ batchInfo: string | null;
188
+ retryInfo: string | null;
189
+ }[];
190
+ failures: {
191
+ batchInfo: string;
192
+ error: string;
193
+ timestamp: string;
194
+ }[];
195
+ }) => void;
196
+ /**
197
+ * Record a batch failure after all retries exhausted.
198
+ */
199
+ addFailure: (state: {
200
+ slots: {
201
+ state: "idle" | "processing" | "rate-limited";
202
+ batchInfo: string | null;
203
+ retryInfo: string | null;
204
+ }[];
205
+ failures: {
206
+ batchInfo: string;
207
+ error: string;
208
+ timestamp: string;
209
+ }[];
210
+ }, action: PayloadAction<FailedChunk>) => void;
211
+ /**
212
+ * Clear all recorded failures (typically at start of new indexing run).
213
+ */
214
+ clearFailures: (state: {
215
+ slots: {
216
+ state: "idle" | "processing" | "rate-limited";
217
+ batchInfo: string | null;
218
+ retryInfo: string | null;
219
+ }[];
220
+ failures: {
221
+ batchInfo: string;
222
+ error: string;
223
+ timestamp: string;
224
+ }[];
225
+ }) => void;
226
+ /**
227
+ * Sync full state from daemon status (for polling-based updates).
228
+ * Replaces slots and failures arrays from daemon status response.
229
+ */
230
+ sync: (state: {
231
+ slots: {
232
+ state: "idle" | "processing" | "rate-limited";
233
+ batchInfo: string | null;
234
+ retryInfo: string | null;
235
+ }[];
236
+ failures: {
237
+ batchInfo: string;
238
+ error: string;
239
+ timestamp: string;
240
+ }[];
241
+ }, action: PayloadAction<{
242
+ slots: SlotState[];
243
+ failures: FailedChunk[];
244
+ }>) => void;
245
+ }, "slotProgress">;
246
+ export declare const slotProgressReducer: import("redux").Reducer<SlotProgressState>;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Redux slice for slot progress during indexing.
3
+ *
4
+ * Separates trigger actions (intercepted by listeners) from mutation actions
5
+ * (called directly by api-utils).
6
+ */
7
+ import { createSlice } from '@reduxjs/toolkit';
8
+ import { CONCURRENCY } from '../../daemon/lib/constants.js';
9
+ // ============================================================================
10
+ // Initial State
11
+ // ============================================================================
12
+ const createInitialSlots = () => Array(CONCURRENCY)
13
+ .fill(null)
14
+ .map(() => ({ state: 'idle', batchInfo: null, retryInfo: null }));
15
+ const initialState = {
16
+ slots: createInitialSlots(),
17
+ failures: [],
18
+ };
19
+ // ============================================================================
20
+ // Slice
21
+ // ============================================================================
22
+ export const slotProgressSlice = createSlice({
23
+ name: 'slotProgress',
24
+ initialState,
25
+ reducers: {
26
+ setSlotProcessing: (state, action) => {
27
+ const { index, batchInfo } = action.payload;
28
+ if (index >= 0 && index < state.slots.length) {
29
+ state.slots[index] = { state: 'processing', batchInfo, retryInfo: null };
30
+ }
31
+ },
32
+ setSlotRateLimited: (state, action) => {
33
+ const { index, batchInfo, retryInfo } = action.payload;
34
+ if (index >= 0 && index < state.slots.length) {
35
+ state.slots[index] = { state: 'rate-limited', batchInfo, retryInfo };
36
+ }
37
+ },
38
+ setSlotIdle: (state, action) => {
39
+ const index = action.payload;
40
+ if (index >= 0 && index < state.slots.length) {
41
+ state.slots[index] = { state: 'idle', batchInfo: null, retryInfo: null };
42
+ }
43
+ },
44
+ resetSlots: state => {
45
+ state.slots = createInitialSlots();
46
+ },
47
+ /**
48
+ * Record a batch failure after all retries exhausted.
49
+ */
50
+ addFailure: (state, action) => {
51
+ state.failures.push(action.payload);
52
+ },
53
+ /**
54
+ * Clear all recorded failures (typically at start of new indexing run).
55
+ */
56
+ clearFailures: state => {
57
+ state.failures = [];
58
+ },
59
+ /**
60
+ * Sync full state from daemon status (for polling-based updates).
61
+ * Replaces slots and failures arrays from daemon status response.
62
+ */
63
+ sync: (state, action) => {
64
+ state.slots = action.payload.slots;
65
+ state.failures = action.payload.failures;
66
+ },
67
+ },
68
+ });
69
+ export const SlotProgressActions = slotProgressSlice.actions;
70
+ export const slotProgressReducer = slotProgressSlice.reducer;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Redux store configuration.
3
+ *
4
+ * CLI-only store for wizard and app state.
5
+ * Daemon state is managed separately via daemon/state.ts.
6
+ */
7
+ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
8
+ wizard: import("./wizard/slice.js").WizardState;
9
+ app: import("./app/slice.js").AppState;
10
+ }, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
11
+ dispatch: import("redux-thunk").ThunkDispatch<{
12
+ wizard: import("./wizard/slice.js").WizardState;
13
+ app: import("./app/slice.js").AppState;
14
+ }, undefined, import("redux").UnknownAction>;
15
+ }>, import("redux").StoreEnhancer]>>;
16
+ export type RootState = ReturnType<typeof store.getState>;
17
+ export type AppDispatch = typeof store.dispatch;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Redux store configuration.
3
+ *
4
+ * CLI-only store for wizard and app state.
5
+ * Daemon state is managed separately via daemon/state.ts.
6
+ */
7
+ import { configureStore } from '@reduxjs/toolkit';
8
+ import { wizardReducer } from './wizard/slice.js';
9
+ import { appReducer } from './app/slice.js';
10
+ // ============================================================================
11
+ // Store Configuration
12
+ // ============================================================================
13
+ export const store = configureStore({
14
+ reducer: {
15
+ wizard: wizardReducer,
16
+ app: appReducer,
17
+ },
18
+ });
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Memoized selectors for warmup state.
3
+ */
4
+ import type { WarmupState, WarmupStatus } from './slice.js';
5
+ type RootState = {
6
+ warmup: WarmupState;
7
+ };
8
+ export declare const selectWarmupState: (state: RootState) => WarmupState;
9
+ export declare const selectWarmupStatus: (state: RootState) => WarmupStatus;
10
+ export declare const selectWarmupProvider: (state: RootState) => string | null;
11
+ export declare const selectWarmupError: (state: RootState) => string | null;
12
+ export declare const selectWarmupElapsedMs: (state: RootState) => number | null;
13
+ /**
14
+ * Check if warmup is ready (engine available for searches).
15
+ */
16
+ export declare const selectIsWarmupReady: ((state: RootState) => boolean) & {
17
+ clearCache: () => void;
18
+ resultsCount: () => number;
19
+ resetResultsCount: () => void;
20
+ } & {
21
+ resultFunc: (resultFuncArgs_0: WarmupStatus) => boolean;
22
+ memoizedResultFunc: ((resultFuncArgs_0: WarmupStatus) => boolean) & {
23
+ clearCache: () => void;
24
+ resultsCount: () => number;
25
+ resetResultsCount: () => void;
26
+ };
27
+ lastResult: () => boolean;
28
+ dependencies: [(state: RootState) => WarmupStatus];
29
+ recomputations: () => number;
30
+ resetRecomputations: () => void;
31
+ dependencyRecomputations: () => number;
32
+ resetDependencyRecomputations: () => void;
33
+ } & {
34
+ memoize: typeof import("reselect").weakMapMemoize;
35
+ argsMemoize: typeof import("reselect").weakMapMemoize;
36
+ };
37
+ /**
38
+ * Check if warmup is in progress.
39
+ */
40
+ export declare const selectIsWarmingUp: ((state: RootState) => boolean) & {
41
+ clearCache: () => void;
42
+ resultsCount: () => number;
43
+ resetResultsCount: () => void;
44
+ } & {
45
+ resultFunc: (resultFuncArgs_0: WarmupStatus) => boolean;
46
+ memoizedResultFunc: ((resultFuncArgs_0: WarmupStatus) => boolean) & {
47
+ clearCache: () => void;
48
+ resultsCount: () => number;
49
+ resetResultsCount: () => void;
50
+ };
51
+ lastResult: () => boolean;
52
+ dependencies: [(state: RootState) => WarmupStatus];
53
+ recomputations: () => number;
54
+ resetRecomputations: () => void;
55
+ dependencyRecomputations: () => number;
56
+ resetDependencyRecomputations: () => void;
57
+ } & {
58
+ memoize: typeof import("reselect").weakMapMemoize;
59
+ argsMemoize: typeof import("reselect").weakMapMemoize;
60
+ };
61
+ /**
62
+ * Check if warmup failed.
63
+ */
64
+ export declare const selectIsWarmupFailed: ((state: RootState) => boolean) & {
65
+ clearCache: () => void;
66
+ resultsCount: () => number;
67
+ resetResultsCount: () => void;
68
+ } & {
69
+ resultFunc: (resultFuncArgs_0: WarmupStatus) => boolean;
70
+ memoizedResultFunc: ((resultFuncArgs_0: WarmupStatus) => boolean) & {
71
+ clearCache: () => void;
72
+ resultsCount: () => number;
73
+ resetResultsCount: () => void;
74
+ };
75
+ lastResult: () => boolean;
76
+ dependencies: [(state: RootState) => WarmupStatus];
77
+ recomputations: () => number;
78
+ resetRecomputations: () => void;
79
+ dependencyRecomputations: () => number;
80
+ resetDependencyRecomputations: () => void;
81
+ } & {
82
+ memoize: typeof import("reselect").weakMapMemoize;
83
+ argsMemoize: typeof import("reselect").weakMapMemoize;
84
+ };
85
+ /**
86
+ * Get display-friendly status text.
87
+ */
88
+ export declare const selectWarmupStatusText: ((state: RootState) => string) & {
89
+ clearCache: () => void;
90
+ resultsCount: () => number;
91
+ resetResultsCount: () => void;
92
+ } & {
93
+ resultFunc: (resultFuncArgs_0: WarmupState) => string;
94
+ memoizedResultFunc: ((resultFuncArgs_0: WarmupState) => string) & {
95
+ clearCache: () => void;
96
+ resultsCount: () => number;
97
+ resetResultsCount: () => void;
98
+ };
99
+ lastResult: () => string;
100
+ dependencies: [(state: RootState) => WarmupState];
101
+ recomputations: () => number;
102
+ resetRecomputations: () => void;
103
+ dependencyRecomputations: () => number;
104
+ resetDependencyRecomputations: () => void;
105
+ } & {
106
+ memoize: typeof import("reselect").weakMapMemoize;
107
+ argsMemoize: typeof import("reselect").weakMapMemoize;
108
+ };
109
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Memoized selectors for warmup state.
3
+ */
4
+ import { createSelector } from '@reduxjs/toolkit';
5
+ // ============================================================================
6
+ // Basic Selectors
7
+ // ============================================================================
8
+ export const selectWarmupState = (state) => state.warmup;
9
+ export const selectWarmupStatus = (state) => state.warmup.status;
10
+ export const selectWarmupProvider = (state) => state.warmup.provider;
11
+ export const selectWarmupError = (state) => state.warmup.error;
12
+ export const selectWarmupElapsedMs = (state) => state.warmup.elapsedMs;
13
+ // ============================================================================
14
+ // Memoized Selectors
15
+ // ============================================================================
16
+ /**
17
+ * Check if warmup is ready (engine available for searches).
18
+ */
19
+ export const selectIsWarmupReady = createSelector([selectWarmupStatus], (status) => status === 'ready');
20
+ /**
21
+ * Check if warmup is in progress.
22
+ */
23
+ export const selectIsWarmingUp = createSelector([selectWarmupStatus], (status) => status === 'initializing');
24
+ /**
25
+ * Check if warmup failed.
26
+ */
27
+ export const selectIsWarmupFailed = createSelector([selectWarmupStatus], (status) => status === 'failed');
28
+ /**
29
+ * Get display-friendly status text.
30
+ */
31
+ export const selectWarmupStatusText = createSelector([selectWarmupState], (state) => {
32
+ switch (state.status) {
33
+ case 'not_started':
34
+ return 'Not started';
35
+ case 'not_initialized':
36
+ return 'Project not initialized';
37
+ case 'initializing':
38
+ return `Warming up ${state.provider ?? 'provider'}...`;
39
+ case 'ready':
40
+ return `Ready (${state.provider}, ${state.elapsedMs}ms)`;
41
+ case 'failed':
42
+ return `Failed: ${state.error ?? 'Unknown error'}`;
43
+ }
44
+ });
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Redux slice for warmup state.
3
+ *
4
+ * Manages the state of the embedding provider warmup process.
5
+ * The WarmupManager dispatches actions to this slice to track status.
6
+ */
7
+ import { type PayloadAction } from '@reduxjs/toolkit';
8
+ export type WarmupStatus = 'not_started' | 'not_initialized' | 'initializing' | 'ready' | 'failed';
9
+ export interface WarmupState {
10
+ /** Current warmup status */
11
+ status: WarmupStatus;
12
+ /** Embedding provider name (e.g., 'gemini', 'openai', 'local') */
13
+ provider: string | null;
14
+ /** ISO timestamp when warmup started */
15
+ startedAt: string | null;
16
+ /** ISO timestamp when warmup completed */
17
+ readyAt: string | null;
18
+ /** Time taken to warm up in milliseconds */
19
+ elapsedMs: number | null;
20
+ /** Error message if warmup failed */
21
+ error: string | null;
22
+ }
23
+ export declare const warmupSlice: import("@reduxjs/toolkit").Slice<WarmupState, {
24
+ /**
25
+ * Project is not initialized.
26
+ */
27
+ setNotInitialized: (state: {
28
+ status: WarmupStatus;
29
+ provider: string | null;
30
+ startedAt: string | null;
31
+ readyAt: string | null;
32
+ elapsedMs: number | null;
33
+ error: string | null;
34
+ }) => void;
35
+ /**
36
+ * Start warmup process.
37
+ */
38
+ start: (state: {
39
+ status: WarmupStatus;
40
+ provider: string | null;
41
+ startedAt: string | null;
42
+ readyAt: string | null;
43
+ elapsedMs: number | null;
44
+ error: string | null;
45
+ }, action: PayloadAction<{
46
+ provider: string;
47
+ }>) => void;
48
+ /**
49
+ * Warmup completed successfully.
50
+ */
51
+ ready: (state: {
52
+ status: WarmupStatus;
53
+ provider: string | null;
54
+ startedAt: string | null;
55
+ readyAt: string | null;
56
+ elapsedMs: number | null;
57
+ error: string | null;
58
+ }, action: PayloadAction<{
59
+ elapsedMs: number;
60
+ }>) => void;
61
+ /**
62
+ * Warmup failed with error.
63
+ */
64
+ failed: (state: {
65
+ status: WarmupStatus;
66
+ provider: string | null;
67
+ startedAt: string | null;
68
+ readyAt: string | null;
69
+ elapsedMs: number | null;
70
+ error: string | null;
71
+ }, action: PayloadAction<{
72
+ error: string;
73
+ elapsedMs: number;
74
+ }>) => void;
75
+ /**
76
+ * Reset state for retry.
77
+ */
78
+ reset: () => WarmupState;
79
+ }, "warmup", "warmup", import("@reduxjs/toolkit").SliceSelectors<WarmupState>>;
80
+ export declare const WarmupActions: import("@reduxjs/toolkit").CaseReducerActions<{
81
+ /**
82
+ * Project is not initialized.
83
+ */
84
+ setNotInitialized: (state: {
85
+ status: WarmupStatus;
86
+ provider: string | null;
87
+ startedAt: string | null;
88
+ readyAt: string | null;
89
+ elapsedMs: number | null;
90
+ error: string | null;
91
+ }) => void;
92
+ /**
93
+ * Start warmup process.
94
+ */
95
+ start: (state: {
96
+ status: WarmupStatus;
97
+ provider: string | null;
98
+ startedAt: string | null;
99
+ readyAt: string | null;
100
+ elapsedMs: number | null;
101
+ error: string | null;
102
+ }, action: PayloadAction<{
103
+ provider: string;
104
+ }>) => void;
105
+ /**
106
+ * Warmup completed successfully.
107
+ */
108
+ ready: (state: {
109
+ status: WarmupStatus;
110
+ provider: string | null;
111
+ startedAt: string | null;
112
+ readyAt: string | null;
113
+ elapsedMs: number | null;
114
+ error: string | null;
115
+ }, action: PayloadAction<{
116
+ elapsedMs: number;
117
+ }>) => void;
118
+ /**
119
+ * Warmup failed with error.
120
+ */
121
+ failed: (state: {
122
+ status: WarmupStatus;
123
+ provider: string | null;
124
+ startedAt: string | null;
125
+ readyAt: string | null;
126
+ elapsedMs: number | null;
127
+ error: string | null;
128
+ }, action: PayloadAction<{
129
+ error: string;
130
+ elapsedMs: number;
131
+ }>) => void;
132
+ /**
133
+ * Reset state for retry.
134
+ */
135
+ reset: () => WarmupState;
136
+ }, "warmup">;
137
+ export declare const warmupReducer: import("redux").Reducer<WarmupState>;