```
Remove stream cancellation logic and refactor controller usage Update coverage reports and tests to reflect changes ```
This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.55% </span>
|
||||
<span class="strong">92.52% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>199/215</span>
|
||||
<span class='fraction'>198/214</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">94.52% </span>
|
||||
<span class="strong">94.5% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>190/201</span>
|
||||
<span class='fraction'>189/200</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -628,7 +628,7 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
@@ -1105,7 +1105,7 @@ export class ChatView extends ItemView {
|
||||
}
|
||||
|
||||
onClose(): Promise<void> {
|
||||
this.ollamaClient.cancelStream();
|
||||
// Removed cancelStream call as we now use local controllers
|
||||
this.removeEventListeners();
|
||||
this.cleanupStreamingResources();
|
||||
this.lastMessageEl = null;
|
||||
@@ -1501,7 +1501,7 @@ export class ChatView extends ItemView {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -475,7 +475,7 @@ export class ErrorHandler {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -23,30 +23,30 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.07% </span>
|
||||
<span class="strong">92.3% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>674/732</span>
|
||||
<span class='fraction'>660/715</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">81.41% </span>
|
||||
<span class="strong">81.43% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>254/312</span>
|
||||
<span class='fraction'>250/307</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">87.82% </span>
|
||||
<span class="strong">88.59% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>101/115</span>
|
||||
<span class='fraction'>101/114</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">93.12% </span>
|
||||
<span class="strong">93.24% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>650/698</span>
|
||||
<span class='fraction'>635/681</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -80,17 +80,17 @@
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="chat-view.ts"><a href="chat-view.ts.html">chat-view.ts</a></td>
|
||||
<td data-value="92.55" class="pic high">
|
||||
<td data-value="92.52" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 92%"></div><div class="cover-empty" style="width: 8%"></div></div>
|
||||
</td>
|
||||
<td data-value="92.55" class="pct high">92.55%</td>
|
||||
<td data-value="215" class="abs high">199/215</td>
|
||||
<td data-value="92.52" class="pct high">92.52%</td>
|
||||
<td data-value="214" class="abs high">198/214</td>
|
||||
<td data-value="85.71" class="pct high">85.71%</td>
|
||||
<td data-value="70" class="abs high">60/70</td>
|
||||
<td data-value="82.85" class="pct high">82.85%</td>
|
||||
<td data-value="35" class="abs high">29/35</td>
|
||||
<td data-value="94.52" class="pct high">94.52%</td>
|
||||
<td data-value="201" class="abs high">190/201</td>
|
||||
<td data-value="94.5" class="pct high">94.5%</td>
|
||||
<td data-value="200" class="abs high">189/200</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -110,17 +110,17 @@
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="ollama-client.ts"><a href="ollama-client.ts.html">ollama-client.ts</a></td>
|
||||
<td data-value="90.69" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 90%"></div><div class="cover-empty" style="width: 10%"></div></div>
|
||||
<td data-value="91.37" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 91%"></div><div class="cover-empty" style="width: 9%"></div></div>
|
||||
</td>
|
||||
<td data-value="90.69" class="pct high">90.69%</td>
|
||||
<td data-value="129" class="abs high">117/129</td>
|
||||
<td data-value="74.13" class="pct medium">74.13%</td>
|
||||
<td data-value="58" class="abs medium">43/58</td>
|
||||
<td data-value="82.35" class="pct high">82.35%</td>
|
||||
<td data-value="17" class="abs high">14/17</td>
|
||||
<td data-value="91.05" class="pct high">91.05%</td>
|
||||
<td data-value="123" class="abs high">112/123</td>
|
||||
<td data-value="91.37" class="pct high">91.37%</td>
|
||||
<td data-value="116" class="abs high">106/116</td>
|
||||
<td data-value="72.22" class="pct medium">72.22%</td>
|
||||
<td data-value="54" class="abs medium">39/54</td>
|
||||
<td data-value="87.5" class="pct high">87.5%</td>
|
||||
<td data-value="16" class="abs high">14/16</td>
|
||||
<td data-value="90.9" class="pct high">90.9%</td>
|
||||
<td data-value="110" class="abs high">100/110</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -170,17 +170,17 @@
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="vault-indexer.ts"><a href="vault-indexer.ts.html">vault-indexer.ts</a></td>
|
||||
<td data-value="88.07" class="pic high">
|
||||
<td data-value="88.51" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 88%"></div><div class="cover-empty" style="width: 12%"></div></div>
|
||||
</td>
|
||||
<td data-value="88.07" class="pct high">88.07%</td>
|
||||
<td data-value="151" class="abs high">133/151</td>
|
||||
<td data-value="76.36" class="pct medium">76.36%</td>
|
||||
<td data-value="55" class="abs medium">42/55</td>
|
||||
<td data-value="88.51" class="pct high">88.51%</td>
|
||||
<td data-value="148" class="abs high">131/148</td>
|
||||
<td data-value="77.77" class="pct medium">77.77%</td>
|
||||
<td data-value="54" class="abs medium">42/54</td>
|
||||
<td data-value="83.33" class="pct high">83.33%</td>
|
||||
<td data-value="24" class="abs high">20/24</td>
|
||||
<td data-value="89.36" class="pct high">89.36%</td>
|
||||
<td data-value="141" class="abs high">126/141</td>
|
||||
<td data-value="89.85" class="pct high">89.85%</td>
|
||||
<td data-value="138" class="abs high">124/138</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
@@ -191,7 +191,7 @@
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -23,30 +23,30 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">90.69% </span>
|
||||
<span class="strong">91.37% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>117/129</span>
|
||||
<span class='fraction'>106/116</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">74.13% </span>
|
||||
<span class="strong">72.22% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>43/58</span>
|
||||
<span class='fraction'>39/54</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">82.35% </span>
|
||||
<span class="strong">87.5% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>14/17</span>
|
||||
<span class='fraction'>14/16</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.05% </span>
|
||||
<span class="strong">90.9% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>112/123</span>
|
||||
<span class='fraction'>100/110</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -339,23 +339,7 @@
|
||||
<a name='L274'></a><a href='#L274'>274</a>
|
||||
<a name='L275'></a><a href='#L275'>275</a>
|
||||
<a name='L276'></a><a href='#L276'>276</a>
|
||||
<a name='L277'></a><a href='#L277'>277</a>
|
||||
<a name='L278'></a><a href='#L278'>278</a>
|
||||
<a name='L279'></a><a href='#L279'>279</a>
|
||||
<a name='L280'></a><a href='#L280'>280</a>
|
||||
<a name='L281'></a><a href='#L281'>281</a>
|
||||
<a name='L282'></a><a href='#L282'>282</a>
|
||||
<a name='L283'></a><a href='#L283'>283</a>
|
||||
<a name='L284'></a><a href='#L284'>284</a>
|
||||
<a name='L285'></a><a href='#L285'>285</a>
|
||||
<a name='L286'></a><a href='#L286'>286</a>
|
||||
<a name='L287'></a><a href='#L287'>287</a>
|
||||
<a name='L288'></a><a href='#L288'>288</a>
|
||||
<a name='L289'></a><a href='#L289'>289</a>
|
||||
<a name='L290'></a><a href='#L290'>290</a>
|
||||
<a name='L291'></a><a href='#L291'>291</a>
|
||||
<a name='L292'></a><a href='#L292'>292</a>
|
||||
<a name='L293'></a><a href='#L293'>293</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<a name='L277'></a><a href='#L277'>277</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
@@ -368,7 +352,6 @@
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">59x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">59x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
@@ -379,13 +362,6 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
@@ -408,11 +384,8 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
@@ -546,11 +519,8 @@
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
@@ -563,6 +533,7 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
@@ -593,21 +564,21 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
@@ -620,11 +591,8 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
@@ -660,7 +628,6 @@ interface OllamaChatResponse {
|
||||
export class OllamaClient {
|
||||
private baseURL: string;
|
||||
private model: string;
|
||||
private abortController: AbortController | null = null;
|
||||
private fetchFn: typeof fetch;
|
||||
private readonly maxRetries: number = 3;
|
||||
|
||||
@@ -669,13 +636,6 @@ export class OllamaClient {
|
||||
this.model = model;
|
||||
this.fetchFn = fetchFn ?? fetch;
|
||||
}
|
||||
|
||||
cancelStream(): void {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.abortController) {
|
||||
<span class="cstat-no" title="statement not covered" > this.abortController.abort();</span>
|
||||
<span class="cstat-no" title="statement not covered" > this.abortController = null;</span>
|
||||
}
|
||||
}
|
||||
|
||||
async *streamChat(
|
||||
messages: OllamaMessage[],
|
||||
@@ -700,11 +660,8 @@ export class OllamaClient {
|
||||
tools: OllamaTool[] = <span class="branch-0 cbranch-no" title="branch not covered" >[],</span>
|
||||
attempt: number = <span class="branch-0 cbranch-no" title="branch not covered" >0</span>
|
||||
): AsyncGenerator<OllamaMessage, void, unknown> {
|
||||
const prevController = this.abortController;
|
||||
this.abortController = new AbortController();
|
||||
if (prevController) {
|
||||
prevController.abort();
|
||||
}
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
@@ -718,7 +675,7 @@ export class OllamaClient {
|
||||
tools,
|
||||
stream: true,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -733,7 +690,7 @@ export class OllamaClient {
|
||||
const abortListener = <span class="fstat-no" title="function not covered" >() =</span>> {
|
||||
<span class="cstat-no" title="statement not covered" > Logger.info('Retry aborted by user', 'ollama-client');</span>
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
@@ -838,11 +795,8 @@ export class OllamaClient {
|
||||
reader.releaseLock();
|
||||
}
|
||||
} finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +809,8 @@ export class OllamaClient {
|
||||
tools: OllamaTool[] = <span class="branch-0 cbranch-no" title="branch not covered" >[],</span>
|
||||
attempt: number = <span class="branch-0 cbranch-no" title="branch not covered" >0</span>
|
||||
): Promise<OllamaMessage> {
|
||||
this.abortController = new AbortController();
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
method: 'POST',
|
||||
@@ -868,7 +823,7 @@ export class OllamaClient {
|
||||
tools,
|
||||
stream: false,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -883,14 +838,14 @@ export class OllamaClient {
|
||||
const abortListener = <span class="fstat-no" title="function not covered" >() =</span>> {
|
||||
<span class="cstat-no" title="statement not covered" > Logger.info('Retry aborted by user', 'ollama-client');</span>
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
await Promise.race([
|
||||
retryTimeout,
|
||||
new Promise<void>((resolve) => {
|
||||
signal.addEventListener('abort', <span class="fstat-no" title="function not covered" >() =</span>> <span class="cstat-no" title="statement not covered" >resolve(),</span> {
|
||||
signal.addEventListener('abort', () => resolve(), {
|
||||
once: true,
|
||||
});
|
||||
}),
|
||||
@@ -898,8 +853,8 @@ export class OllamaClient {
|
||||
} finally {
|
||||
signal.removeEventListener('abort', abortListener);
|
||||
}
|
||||
} else {
|
||||
await retryTimeout;
|
||||
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
|
||||
<span class="cstat-no" title="statement not covered" > await retryTimeout;</span>
|
||||
}
|
||||
}
|
||||
return this.chatWithRetry(messages, tools, attempt + 1);
|
||||
@@ -912,11 +867,8 @@ export class OllamaClient {
|
||||
this.toOllamaMessage(data.message) ?? { role: 'assistant', content: '', tool_calls: [] }
|
||||
);
|
||||
} finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -946,7 +898,7 @@ export class OllamaClient {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -463,7 +463,7 @@ export class ToolExecutor {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -604,7 +604,7 @@ export interface VaultIndexEntry {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -643,7 +643,7 @@ export function safeParseJson(jsonString: string): unknown {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">88.07% </span>
|
||||
<span class="strong">88.51% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>133/151</span>
|
||||
<span class='fraction'>131/148</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">76.36% </span>
|
||||
<span class="strong">77.77% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>42/55</span>
|
||||
<span class='fraction'>42/54</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">89.36% </span>
|
||||
<span class="strong">89.85% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>126/141</span>
|
||||
<span class='fraction'>124/138</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -526,8 +526,14 @@
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
@@ -570,7 +576,7 @@
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
@@ -622,15 +628,9 @@
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
@@ -895,9 +895,15 @@ class VaultIndexer {
|
||||
<span class="cstat-no" title="statement not covered" > throw new Error('Vault-like object not provided to VaultIndexer');</span>
|
||||
}
|
||||
|
||||
const cacheKey = `query:${query.trim()}`;
|
||||
const cacheKey = `query:${query.trim()}:limit:${limit}`;
|
||||
if (this.cache) {
|
||||
const cachedResults = await this.cache.get(cacheKey);
|
||||
let cachedResults;
|
||||
try {
|
||||
cachedResults = await this.cache.get(cacheKey);
|
||||
} catch {
|
||||
// Ignore cache retrieval errors and continue with normal processing
|
||||
<span class="cstat-no" title="statement not covered" > cachedResults = null;</span>
|
||||
}
|
||||
if (cachedResults) {
|
||||
try {
|
||||
const parsedResults = JSON.parse(cachedResults) as VaultIndexEntry[];
|
||||
@@ -941,7 +947,7 @@ class VaultIndexer {
|
||||
const results: VaultIndexEntry[] = [];
|
||||
const seenPaths = new Set<string>();
|
||||
const cancellationToken = new CancellationToken();
|
||||
let processedCount = 0;
|
||||
// Removed unused processedCount variable
|
||||
|
||||
// Set up a check for cancellation every 100 files
|
||||
const checkInterval = setInterval(<span class="fstat-no" title="function not covered" >() =</span>> {
|
||||
@@ -992,16 +998,10 @@ class VaultIndexer {
|
||||
);
|
||||
results.push(...validResults);
|
||||
|
||||
// Early exit if we've reached enough results
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (results.length >= 100) {
|
||||
<span class="cstat-no" title="statement not covered" > Logger.info(</span>
|
||||
`Early exit after processing ${processedCount + batch.length} files with ${results.length} results`,
|
||||
'vault-indexer'
|
||||
);
|
||||
<span class="cstat-no" title="statement not covered" > break;</span>
|
||||
}
|
||||
// Continue processing all files to ensure we don't miss higher-scoring results
|
||||
// even if we've already found some matches
|
||||
|
||||
processedCount += batch.length;
|
||||
// Removed processedCount increment
|
||||
}
|
||||
} finally {
|
||||
clearInterval(checkInterval);
|
||||
@@ -1183,7 +1183,7 @@ export function <span class="fstat-no" title="function not covered" >createVault
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2026-05-06T22:45:19.738Z
|
||||
at 2026-05-06T22:58:43.715Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
||||
+290
-314
@@ -111,7 +111,6 @@ DA:79,5
|
||||
DA:80,5
|
||||
DA:81,5
|
||||
DA:85,0
|
||||
DA:89,3
|
||||
DA:90,3
|
||||
DA:91,3
|
||||
DA:92,3
|
||||
@@ -273,8 +272,8 @@ DA:468,12
|
||||
DA:470,6
|
||||
DA:472,21
|
||||
DA:473,21
|
||||
LF:201
|
||||
LH:190
|
||||
LF:200
|
||||
LH:189
|
||||
BRDA:102,0,0,0
|
||||
BRDA:102,1,0,28
|
||||
BRDA:102,1,1,6
|
||||
@@ -483,227 +482,208 @@ BRH:42
|
||||
end_of_record
|
||||
TN:
|
||||
SF:src/ollama-client.ts
|
||||
FN:18,(anonymous_0)
|
||||
FN:24,(anonymous_1)
|
||||
FN:31,(anonymous_2)
|
||||
FN:38,(anonymous_3)
|
||||
FN:49,(anonymous_4)
|
||||
FN:83,(anonymous_5)
|
||||
FN:84,(anonymous_6)
|
||||
FN:93,(anonymous_7)
|
||||
FN:94,(anonymous_8)
|
||||
FN:200,(anonymous_9)
|
||||
FN:204,(anonymous_10)
|
||||
FN:233,(anonymous_11)
|
||||
FN:234,(anonymous_12)
|
||||
FN:243,(anonymous_13)
|
||||
FN:244,(anonymous_14)
|
||||
FN:274,(anonymous_15)
|
||||
FN:280,(anonymous_16)
|
||||
FNF:17
|
||||
FN:17,(anonymous_0)
|
||||
FN:23,(anonymous_1)
|
||||
FN:30,(anonymous_2)
|
||||
FN:41,(anonymous_3)
|
||||
FN:72,(anonymous_4)
|
||||
FN:73,(anonymous_5)
|
||||
FN:82,(anonymous_6)
|
||||
FN:83,(anonymous_7)
|
||||
FN:186,(anonymous_8)
|
||||
FN:190,(anonymous_9)
|
||||
FN:220,(anonymous_10)
|
||||
FN:221,(anonymous_11)
|
||||
FN:230,(anonymous_12)
|
||||
FN:231,(anonymous_13)
|
||||
FN:258,(anonymous_14)
|
||||
FN:264,(anonymous_15)
|
||||
FNF:16
|
||||
FNH:14
|
||||
FNDA:59,(anonymous_0)
|
||||
FNDA:28,(anonymous_1)
|
||||
FNDA:20,(anonymous_2)
|
||||
FNDA:3,(anonymous_3)
|
||||
FNDA:25,(anonymous_4)
|
||||
FNDA:4,(anonymous_5)
|
||||
FNDA:0,(anonymous_6)
|
||||
FNDA:20,(anonymous_1)
|
||||
FNDA:3,(anonymous_2)
|
||||
FNDA:25,(anonymous_3)
|
||||
FNDA:4,(anonymous_4)
|
||||
FNDA:0,(anonymous_5)
|
||||
FNDA:4,(anonymous_6)
|
||||
FNDA:4,(anonymous_7)
|
||||
FNDA:4,(anonymous_8)
|
||||
FNDA:5,(anonymous_9)
|
||||
FNDA:8,(anonymous_10)
|
||||
FNDA:2,(anonymous_11)
|
||||
FNDA:0,(anonymous_12)
|
||||
FNDA:1,(anonymous_13)
|
||||
FNDA:0,(anonymous_14)
|
||||
FNDA:15,(anonymous_15)
|
||||
FNDA:18,(anonymous_16)
|
||||
FNDA:5,(anonymous_8)
|
||||
FNDA:8,(anonymous_9)
|
||||
FNDA:2,(anonymous_10)
|
||||
FNDA:0,(anonymous_11)
|
||||
FNDA:2,(anonymous_12)
|
||||
FNDA:2,(anonymous_13)
|
||||
FNDA:15,(anonymous_14)
|
||||
FNDA:18,(anonymous_15)
|
||||
DA:4,2
|
||||
DA:5,2
|
||||
DA:11,2
|
||||
DA:14,59
|
||||
DA:16,59
|
||||
DA:15,59
|
||||
DA:18,59
|
||||
DA:19,59
|
||||
DA:20,59
|
||||
DA:21,59
|
||||
DA:25,28
|
||||
DA:26,0
|
||||
DA:27,0
|
||||
DA:35,20
|
||||
DA:42,3
|
||||
DA:43,3
|
||||
DA:44,0
|
||||
DA:46,0
|
||||
DA:54,25
|
||||
DA:55,25
|
||||
DA:56,25
|
||||
DA:57,5
|
||||
DA:60,25
|
||||
DA:61,25
|
||||
DA:75,25
|
||||
DA:76,8
|
||||
DA:77,5
|
||||
DA:78,5
|
||||
DA:82,5
|
||||
DA:27,20
|
||||
DA:34,3
|
||||
DA:35,3
|
||||
DA:36,0
|
||||
DA:38,0
|
||||
DA:47,25
|
||||
DA:49,25
|
||||
DA:50,25
|
||||
DA:64,25
|
||||
DA:65,8
|
||||
DA:66,5
|
||||
DA:67,5
|
||||
DA:71,5
|
||||
DA:72,4
|
||||
DA:73,4
|
||||
DA:74,0
|
||||
DA:76,4
|
||||
DA:77,4
|
||||
DA:78,4
|
||||
DA:79,4
|
||||
DA:80,4
|
||||
DA:83,4
|
||||
DA:84,4
|
||||
DA:85,0
|
||||
DA:87,4
|
||||
DA:88,4
|
||||
DA:89,4
|
||||
DA:90,4
|
||||
DA:91,4
|
||||
DA:94,4
|
||||
DA:100,4
|
||||
DA:103,0
|
||||
DA:106,5
|
||||
DA:107,2
|
||||
DA:109,3
|
||||
DA:112,13
|
||||
DA:113,1
|
||||
DA:116,12
|
||||
DA:117,12
|
||||
DA:118,1
|
||||
DA:121,11
|
||||
DA:122,11
|
||||
DA:123,11
|
||||
DA:124,11
|
||||
DA:125,11
|
||||
DA:127,11
|
||||
DA:128,11
|
||||
DA:129,19
|
||||
DA:130,19
|
||||
DA:132,10
|
||||
DA:134,10
|
||||
DA:135,10
|
||||
DA:137,10
|
||||
DA:138,68
|
||||
DA:140,67
|
||||
DA:141,67
|
||||
DA:142,14
|
||||
DA:144,13
|
||||
DA:145,13
|
||||
DA:146,0
|
||||
DA:149,13
|
||||
DA:150,13
|
||||
DA:152,54
|
||||
DA:153,1
|
||||
DA:156,53
|
||||
DA:157,53
|
||||
DA:158,1
|
||||
DA:161,52
|
||||
DA:169,9
|
||||
DA:170,1
|
||||
DA:171,1
|
||||
DA:172,1
|
||||
DA:174,1
|
||||
DA:175,1
|
||||
DA:176,1
|
||||
DA:179,0
|
||||
DA:180,0
|
||||
DA:182,0
|
||||
DA:189,11
|
||||
DA:192,25
|
||||
DA:193,25
|
||||
DA:194,25
|
||||
DA:195,20
|
||||
DA:201,5
|
||||
DA:209,8
|
||||
DA:210,8
|
||||
DA:211,8
|
||||
DA:225,8
|
||||
DA:226,4
|
||||
DA:227,3
|
||||
DA:228,3
|
||||
DA:232,3
|
||||
DA:233,2
|
||||
DA:234,2
|
||||
DA:235,0
|
||||
DA:92,0
|
||||
DA:95,5
|
||||
DA:96,2
|
||||
DA:98,3
|
||||
DA:101,13
|
||||
DA:102,1
|
||||
DA:105,12
|
||||
DA:106,12
|
||||
DA:107,1
|
||||
DA:110,11
|
||||
DA:111,11
|
||||
DA:112,11
|
||||
DA:113,11
|
||||
DA:114,11
|
||||
DA:116,11
|
||||
DA:117,11
|
||||
DA:118,19
|
||||
DA:119,19
|
||||
DA:121,10
|
||||
DA:123,10
|
||||
DA:124,10
|
||||
DA:126,10
|
||||
DA:127,68
|
||||
DA:129,67
|
||||
DA:130,67
|
||||
DA:131,14
|
||||
DA:133,13
|
||||
DA:134,13
|
||||
DA:135,0
|
||||
DA:138,13
|
||||
DA:139,13
|
||||
DA:141,54
|
||||
DA:142,1
|
||||
DA:145,53
|
||||
DA:146,53
|
||||
DA:147,1
|
||||
DA:150,52
|
||||
DA:158,9
|
||||
DA:159,1
|
||||
DA:160,1
|
||||
DA:161,1
|
||||
DA:163,1
|
||||
DA:164,1
|
||||
DA:165,1
|
||||
DA:168,0
|
||||
DA:169,0
|
||||
DA:171,0
|
||||
DA:178,11
|
||||
DA:182,25
|
||||
DA:187,5
|
||||
DA:196,8
|
||||
DA:197,8
|
||||
DA:198,8
|
||||
DA:212,8
|
||||
DA:213,4
|
||||
DA:214,3
|
||||
DA:215,3
|
||||
DA:219,3
|
||||
DA:220,2
|
||||
DA:221,2
|
||||
DA:222,0
|
||||
DA:224,2
|
||||
DA:225,2
|
||||
DA:226,2
|
||||
DA:227,2
|
||||
DA:228,2
|
||||
DA:231,2
|
||||
DA:237,2
|
||||
DA:238,2
|
||||
DA:239,1
|
||||
DA:240,1
|
||||
DA:241,1
|
||||
DA:244,1
|
||||
DA:250,1
|
||||
DA:253,1
|
||||
DA:256,3
|
||||
DA:258,1
|
||||
DA:261,4
|
||||
DA:262,4
|
||||
DA:266,8
|
||||
DA:267,8
|
||||
DA:268,8
|
||||
DA:269,7
|
||||
DA:275,15
|
||||
DA:276,1
|
||||
DA:281,18
|
||||
DA:282,1
|
||||
DA:285,17
|
||||
DA:286,17
|
||||
LF:123
|
||||
LH:112
|
||||
BRDA:21,0,0,59
|
||||
BRDA:21,0,1,36
|
||||
DA:240,0
|
||||
DA:243,3
|
||||
DA:245,1
|
||||
DA:248,4
|
||||
DA:249,4
|
||||
DA:254,8
|
||||
DA:259,15
|
||||
DA:260,1
|
||||
DA:265,18
|
||||
DA:266,1
|
||||
DA:269,17
|
||||
DA:270,17
|
||||
LF:110
|
||||
LH:100
|
||||
BRDA:20,0,0,59
|
||||
BRDA:20,0,1,36
|
||||
BRDA:25,1,0,0
|
||||
BRDA:33,2,0,0
|
||||
BRDA:40,3,0,0
|
||||
BRDA:51,4,0,0
|
||||
BRDA:52,5,0,0
|
||||
BRDA:56,6,0,5
|
||||
BRDA:75,7,0,8
|
||||
BRDA:76,8,0,5
|
||||
BRDA:76,9,0,8
|
||||
BRDA:76,9,1,6
|
||||
BRDA:82,10,0,4
|
||||
BRDA:88,11,0,4
|
||||
BRDA:88,11,1,0
|
||||
BRDA:112,12,0,1
|
||||
BRDA:117,13,0,1
|
||||
BRDA:117,14,0,12
|
||||
BRDA:117,14,1,12
|
||||
BRDA:117,14,2,1
|
||||
BRDA:130,15,0,9
|
||||
BRDA:135,16,0,10
|
||||
BRDA:135,16,1,0
|
||||
BRDA:138,17,0,1
|
||||
BRDA:145,18,0,0
|
||||
BRDA:152,19,0,1
|
||||
BRDA:152,20,0,54
|
||||
BRDA:152,20,1,54
|
||||
BRDA:157,21,0,1
|
||||
BRDA:169,22,0,1
|
||||
BRDA:175,23,0,1
|
||||
BRDA:179,24,0,0
|
||||
BRDA:179,25,0,0
|
||||
BRDA:179,25,1,0
|
||||
BRDA:194,26,0,20
|
||||
BRDA:200,27,0,0
|
||||
BRDA:206,28,0,0
|
||||
BRDA:207,29,0,0
|
||||
BRDA:225,30,0,4
|
||||
BRDA:226,31,0,3
|
||||
BRDA:226,32,0,4
|
||||
BRDA:226,32,1,4
|
||||
BRDA:232,33,0,2
|
||||
BRDA:238,34,0,1
|
||||
BRDA:238,34,1,1
|
||||
BRDA:263,35,0,4
|
||||
BRDA:263,35,1,1
|
||||
BRDA:268,36,0,7
|
||||
BRDA:275,37,0,1
|
||||
BRDA:281,38,0,1
|
||||
BRDA:281,39,0,18
|
||||
BRDA:281,39,1,17
|
||||
BRDA:287,40,0,17
|
||||
BRDA:287,40,1,17
|
||||
BRDA:288,41,0,17
|
||||
BRDA:288,41,1,0
|
||||
BRDA:289,42,0,17
|
||||
BRDA:289,42,1,15
|
||||
BRF:58
|
||||
BRH:43
|
||||
BRDA:32,2,0,0
|
||||
BRDA:43,3,0,0
|
||||
BRDA:44,4,0,0
|
||||
BRDA:64,5,0,8
|
||||
BRDA:65,6,0,5
|
||||
BRDA:65,7,0,8
|
||||
BRDA:65,7,1,6
|
||||
BRDA:71,8,0,4
|
||||
BRDA:77,9,0,4
|
||||
BRDA:77,9,1,0
|
||||
BRDA:101,10,0,1
|
||||
BRDA:106,11,0,1
|
||||
BRDA:106,12,0,12
|
||||
BRDA:106,12,1,12
|
||||
BRDA:106,12,2,1
|
||||
BRDA:119,13,0,9
|
||||
BRDA:124,14,0,10
|
||||
BRDA:124,14,1,0
|
||||
BRDA:127,15,0,1
|
||||
BRDA:134,16,0,0
|
||||
BRDA:141,17,0,1
|
||||
BRDA:141,18,0,54
|
||||
BRDA:141,18,1,54
|
||||
BRDA:146,19,0,1
|
||||
BRDA:158,20,0,1
|
||||
BRDA:164,21,0,1
|
||||
BRDA:168,22,0,0
|
||||
BRDA:168,23,0,0
|
||||
BRDA:168,23,1,0
|
||||
BRDA:186,24,0,0
|
||||
BRDA:192,25,0,0
|
||||
BRDA:193,26,0,0
|
||||
BRDA:212,27,0,4
|
||||
BRDA:213,28,0,3
|
||||
BRDA:213,29,0,4
|
||||
BRDA:213,29,1,4
|
||||
BRDA:219,30,0,2
|
||||
BRDA:225,31,0,2
|
||||
BRDA:225,31,1,0
|
||||
BRDA:250,32,0,4
|
||||
BRDA:250,32,1,1
|
||||
BRDA:259,33,0,1
|
||||
BRDA:265,34,0,1
|
||||
BRDA:265,35,0,18
|
||||
BRDA:265,35,1,17
|
||||
BRDA:271,36,0,17
|
||||
BRDA:271,36,1,17
|
||||
BRDA:272,37,0,17
|
||||
BRDA:272,37,1,0
|
||||
BRDA:273,38,0,17
|
||||
BRDA:273,38,1,15
|
||||
BRF:54
|
||||
BRH:39
|
||||
end_of_record
|
||||
TN:
|
||||
SF:src/tool-executor.ts
|
||||
@@ -1059,12 +1039,12 @@ FN:37,(anonymous_5)
|
||||
FN:41,(anonymous_6)
|
||||
FN:77,(anonymous_7)
|
||||
FN:82,(anonymous_8)
|
||||
FN:110,(anonymous_9)
|
||||
FN:111,(anonymous_10)
|
||||
FN:128,(anonymous_11)
|
||||
FN:140,(anonymous_12)
|
||||
FN:154,(anonymous_13)
|
||||
FN:184,(anonymous_14)
|
||||
FN:116,(anonymous_9)
|
||||
FN:117,(anonymous_10)
|
||||
FN:134,(anonymous_11)
|
||||
FN:146,(anonymous_12)
|
||||
FN:160,(anonymous_13)
|
||||
FN:190,(anonymous_14)
|
||||
FN:206,(anonymous_15)
|
||||
FN:237,(anonymous_16)
|
||||
FN:240,(anonymous_17)
|
||||
@@ -1119,57 +1099,54 @@ DA:87,35
|
||||
DA:88,0
|
||||
DA:91,35
|
||||
DA:92,35
|
||||
DA:93,3
|
||||
DA:94,3
|
||||
DA:95,1
|
||||
DA:96,1
|
||||
DA:97,1
|
||||
DA:104,34
|
||||
DA:105,34
|
||||
DA:106,34
|
||||
DA:107,34
|
||||
DA:109,34
|
||||
DA:110,53
|
||||
DA:111,38
|
||||
DA:114,34
|
||||
DA:115,2
|
||||
DA:116,2
|
||||
DA:118,0
|
||||
DA:125,34
|
||||
DA:133,34
|
||||
DA:134,34
|
||||
DA:135,34
|
||||
DA:136,34
|
||||
DA:137,34
|
||||
DA:95,3
|
||||
DA:98,0
|
||||
DA:100,3
|
||||
DA:101,1
|
||||
DA:102,1
|
||||
DA:103,1
|
||||
DA:110,34
|
||||
DA:111,34
|
||||
DA:112,34
|
||||
DA:113,34
|
||||
DA:115,34
|
||||
DA:116,53
|
||||
DA:117,38
|
||||
DA:120,34
|
||||
DA:121,2
|
||||
DA:122,2
|
||||
DA:124,0
|
||||
DA:131,34
|
||||
DA:139,34
|
||||
DA:140,34
|
||||
DA:141,0
|
||||
DA:142,0
|
||||
DA:141,34
|
||||
DA:142,34
|
||||
DA:146,34
|
||||
DA:147,34
|
||||
DA:148,18
|
||||
DA:149,0
|
||||
DA:152,18
|
||||
DA:153,18
|
||||
DA:155,63
|
||||
DA:156,63
|
||||
DA:157,62
|
||||
DA:158,62
|
||||
DA:159,62
|
||||
DA:160,53
|
||||
DA:147,0
|
||||
DA:148,0
|
||||
DA:152,34
|
||||
DA:153,34
|
||||
DA:154,18
|
||||
DA:155,0
|
||||
DA:158,18
|
||||
DA:159,18
|
||||
DA:161,63
|
||||
DA:162,63
|
||||
DA:163,62
|
||||
DA:164,62
|
||||
DA:165,62
|
||||
DA:166,53
|
||||
DA:167,53
|
||||
DA:168,53
|
||||
DA:170,0
|
||||
DA:172,9
|
||||
DA:174,1
|
||||
DA:178,1
|
||||
DA:183,18
|
||||
DA:184,63
|
||||
DA:186,18
|
||||
DA:172,53
|
||||
DA:173,53
|
||||
DA:174,53
|
||||
DA:176,0
|
||||
DA:178,9
|
||||
DA:180,1
|
||||
DA:184,1
|
||||
DA:189,18
|
||||
DA:190,0
|
||||
DA:194,0
|
||||
DA:197,18
|
||||
DA:190,63
|
||||
DA:192,18
|
||||
DA:200,34
|
||||
DA:203,34
|
||||
DA:207,112
|
||||
@@ -1241,8 +1218,8 @@ DA:362,72
|
||||
DA:366,3
|
||||
DA:369,3
|
||||
DA:370,0
|
||||
LF:141
|
||||
LH:126
|
||||
LF:138
|
||||
LH:124
|
||||
BRDA:20,0,0,2
|
||||
BRDA:20,0,1,1
|
||||
BRDA:82,1,0,5
|
||||
@@ -1251,53 +1228,52 @@ BRDA:83,3,0,38
|
||||
BRDA:83,3,1,36
|
||||
BRDA:87,4,0,0
|
||||
BRDA:92,5,0,3
|
||||
BRDA:94,6,0,1
|
||||
BRDA:114,7,0,2
|
||||
BRDA:119,8,0,0
|
||||
BRDA:119,8,1,0
|
||||
BRDA:141,9,0,0
|
||||
BRDA:148,10,0,0
|
||||
BRDA:159,11,0,53
|
||||
BRDA:166,12,0,53
|
||||
BRDA:175,13,0,1
|
||||
BRDA:175,13,1,0
|
||||
BRDA:189,14,0,0
|
||||
BRDA:237,15,0,469
|
||||
BRDA:237,15,1,442
|
||||
BRDA:247,16,0,2
|
||||
BRDA:253,17,0,0
|
||||
BRDA:255,18,0,1
|
||||
BRDA:255,18,1,2
|
||||
BRDA:256,19,0,1
|
||||
BRDA:259,20,0,2
|
||||
BRDA:260,21,0,2
|
||||
BRDA:271,22,0,11
|
||||
BRDA:276,23,0,69
|
||||
BRDA:304,24,0,0
|
||||
BRDA:304,24,1,73
|
||||
BRDA:305,25,0,73
|
||||
BRDA:305,25,1,0
|
||||
BRDA:310,26,0,1
|
||||
BRDA:311,27,0,73
|
||||
BRDA:311,27,1,65
|
||||
BRDA:311,27,2,65
|
||||
BRDA:319,28,0,1
|
||||
BRDA:319,29,0,73
|
||||
BRDA:319,29,1,1
|
||||
BRDA:324,30,0,4
|
||||
BRDA:329,31,0,58
|
||||
BRDA:329,32,0,73
|
||||
BRDA:329,32,1,63
|
||||
BRDA:334,33,0,56
|
||||
BRDA:339,34,0,63
|
||||
BRDA:353,35,0,0
|
||||
BRDA:354,36,0,1
|
||||
BRDA:355,37,0,0
|
||||
BRDA:355,38,0,144
|
||||
BRDA:355,38,1,0
|
||||
BRDA:356,39,0,22
|
||||
BRDA:356,40,0,144
|
||||
BRDA:356,40,1,22
|
||||
BRF:55
|
||||
BRDA:100,6,0,1
|
||||
BRDA:120,7,0,2
|
||||
BRDA:125,8,0,0
|
||||
BRDA:125,8,1,0
|
||||
BRDA:147,9,0,0
|
||||
BRDA:154,10,0,0
|
||||
BRDA:165,11,0,53
|
||||
BRDA:172,12,0,53
|
||||
BRDA:181,13,0,1
|
||||
BRDA:181,13,1,0
|
||||
BRDA:237,14,0,469
|
||||
BRDA:237,14,1,442
|
||||
BRDA:247,15,0,2
|
||||
BRDA:253,16,0,0
|
||||
BRDA:255,17,0,1
|
||||
BRDA:255,17,1,2
|
||||
BRDA:256,18,0,1
|
||||
BRDA:259,19,0,2
|
||||
BRDA:260,20,0,2
|
||||
BRDA:271,21,0,11
|
||||
BRDA:276,22,0,69
|
||||
BRDA:304,23,0,0
|
||||
BRDA:304,23,1,73
|
||||
BRDA:305,24,0,73
|
||||
BRDA:305,24,1,0
|
||||
BRDA:310,25,0,1
|
||||
BRDA:311,26,0,73
|
||||
BRDA:311,26,1,65
|
||||
BRDA:311,26,2,65
|
||||
BRDA:319,27,0,1
|
||||
BRDA:319,28,0,73
|
||||
BRDA:319,28,1,1
|
||||
BRDA:324,29,0,4
|
||||
BRDA:329,30,0,58
|
||||
BRDA:329,31,0,73
|
||||
BRDA:329,31,1,63
|
||||
BRDA:334,32,0,56
|
||||
BRDA:339,33,0,63
|
||||
BRDA:353,34,0,0
|
||||
BRDA:354,35,0,1
|
||||
BRDA:355,36,0,0
|
||||
BRDA:355,37,0,144
|
||||
BRDA:355,37,1,0
|
||||
BRDA:356,38,0,22
|
||||
BRDA:356,39,0,144
|
||||
BRDA:356,39,1,22
|
||||
BRF:54
|
||||
BRH:42
|
||||
end_of_record
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ class ChatView extends obsidian_1.ItemView {
|
||||
this.updateSettings(newSettings);
|
||||
}
|
||||
onClose() {
|
||||
this.ollamaClient.cancelStream();
|
||||
// Removed cancelStream call as we now use local controllers
|
||||
this.removeEventListeners();
|
||||
this.cleanupStreamingResources();
|
||||
this.lastMessageEl = null;
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ export class ChatView extends ItemView {
|
||||
}
|
||||
|
||||
onClose(): Promise<void> {
|
||||
this.ollamaClient.cancelStream();
|
||||
// Removed cancelStream call as we now use local controllers
|
||||
this.removeEventListeners();
|
||||
this.cleanupStreamingResources();
|
||||
this.lastMessageEl = null;
|
||||
|
||||
+12
-27
@@ -6,18 +6,11 @@ const types_1 = require("./types");
|
||||
const utils_1 = require("./utils");
|
||||
class OllamaClient {
|
||||
constructor(baseURL, model, fetchFn) {
|
||||
this.abortController = null;
|
||||
this.maxRetries = 3;
|
||||
this.baseURL = baseURL;
|
||||
this.model = model;
|
||||
this.fetchFn = fetchFn ?? fetch;
|
||||
}
|
||||
cancelStream() {
|
||||
if (this.abortController) {
|
||||
this.abortController.abort();
|
||||
this.abortController = null;
|
||||
}
|
||||
}
|
||||
async *streamChat(messages, tools = []) {
|
||||
yield* this.streamChatWithRetry(messages, tools, 0);
|
||||
}
|
||||
@@ -29,11 +22,8 @@ class OllamaClient {
|
||||
return chunks;
|
||||
}
|
||||
async *streamChatWithRetry(messages, tools = [], attempt = 0) {
|
||||
const prevController = this.abortController;
|
||||
this.abortController = new AbortController();
|
||||
if (prevController) {
|
||||
prevController.abort();
|
||||
}
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
method: 'POST',
|
||||
@@ -46,7 +36,7 @@ class OllamaClient {
|
||||
tools,
|
||||
stream: true,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (!response.ok) {
|
||||
if (response.status >= 500 && attempt < this.maxRetries) {
|
||||
@@ -57,7 +47,7 @@ class OllamaClient {
|
||||
const abortListener = () => {
|
||||
utils_1.Logger.info('Retry aborted by user', 'ollama-client');
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
@@ -150,18 +140,16 @@ class OllamaClient {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
async chat(messages, tools = []) {
|
||||
return this.chatWithRetry(messages, tools, 0);
|
||||
}
|
||||
async chatWithRetry(messages, tools = [], attempt = 0) {
|
||||
this.abortController = new AbortController();
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
method: 'POST',
|
||||
@@ -174,7 +162,7 @@ class OllamaClient {
|
||||
tools,
|
||||
stream: false,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (!response.ok) {
|
||||
if (response.status >= 500 && attempt < this.maxRetries) {
|
||||
@@ -185,7 +173,7 @@ class OllamaClient {
|
||||
const abortListener = () => {
|
||||
utils_1.Logger.info('Retry aborted by user', 'ollama-client');
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
@@ -214,11 +202,8 @@ class OllamaClient {
|
||||
return (this.toOllamaMessage(data.message) ?? { role: 'assistant', content: '', tool_calls: [] });
|
||||
}
|
||||
finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
throwIfOllamaError(parsed) {
|
||||
|
||||
+12
-28
@@ -11,7 +11,6 @@ interface OllamaChatResponse {
|
||||
export class OllamaClient {
|
||||
private baseURL: string;
|
||||
private model: string;
|
||||
private abortController: AbortController | null = null;
|
||||
private fetchFn: typeof fetch;
|
||||
private readonly maxRetries: number = 3;
|
||||
|
||||
@@ -21,13 +20,6 @@ export class OllamaClient {
|
||||
this.fetchFn = fetchFn ?? fetch;
|
||||
}
|
||||
|
||||
cancelStream(): void {
|
||||
if (this.abortController) {
|
||||
this.abortController.abort();
|
||||
this.abortController = null;
|
||||
}
|
||||
}
|
||||
|
||||
async *streamChat(
|
||||
messages: OllamaMessage[],
|
||||
tools: OllamaTool[] = []
|
||||
@@ -51,11 +43,8 @@ export class OllamaClient {
|
||||
tools: OllamaTool[] = [],
|
||||
attempt: number = 0
|
||||
): AsyncGenerator<OllamaMessage, void, unknown> {
|
||||
const prevController = this.abortController;
|
||||
this.abortController = new AbortController();
|
||||
if (prevController) {
|
||||
prevController.abort();
|
||||
}
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
@@ -69,7 +58,7 @@ export class OllamaClient {
|
||||
tools,
|
||||
stream: true,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -84,7 +73,7 @@ export class OllamaClient {
|
||||
const abortListener = () => {
|
||||
Logger.info('Retry aborted by user', 'ollama-client');
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
@@ -189,11 +178,8 @@ export class OllamaClient {
|
||||
reader.releaseLock();
|
||||
}
|
||||
} finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +192,8 @@ export class OllamaClient {
|
||||
tools: OllamaTool[] = [],
|
||||
attempt: number = 0
|
||||
): Promise<OllamaMessage> {
|
||||
this.abortController = new AbortController();
|
||||
// Create a local controller for this request instead of using the instance variable
|
||||
const controller = new AbortController();
|
||||
try {
|
||||
const response = await this.fetchFn(`${this.baseURL}/api/chat`, {
|
||||
method: 'POST',
|
||||
@@ -219,7 +206,7 @@ export class OllamaClient {
|
||||
tools,
|
||||
stream: false,
|
||||
}),
|
||||
signal: this.abortController.signal,
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -234,7 +221,7 @@ export class OllamaClient {
|
||||
const abortListener = () => {
|
||||
Logger.info('Retry aborted by user', 'ollama-client');
|
||||
};
|
||||
const signal = this.abortController?.signal;
|
||||
const signal = controller.signal;
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortListener);
|
||||
try {
|
||||
@@ -263,11 +250,8 @@ export class OllamaClient {
|
||||
this.toOllamaMessage(data.message) ?? { role: 'assistant', content: '', tool_calls: [] }
|
||||
);
|
||||
} finally {
|
||||
const controller = this.abortController;
|
||||
this.abortController = null;
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
}
|
||||
// Abort the local controller
|
||||
controller.abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-9
@@ -46,9 +46,16 @@ class VaultIndexer {
|
||||
if (!this.vault) {
|
||||
throw new Error('Vault-like object not provided to VaultIndexer');
|
||||
}
|
||||
const cacheKey = `query:${query.trim()}`;
|
||||
const cacheKey = `query:${query.trim()}:limit:${limit}`;
|
||||
if (this.cache) {
|
||||
const cachedResults = await this.cache.get(cacheKey);
|
||||
let cachedResults;
|
||||
try {
|
||||
cachedResults = await this.cache.get(cacheKey);
|
||||
}
|
||||
catch {
|
||||
// Ignore cache retrieval errors and continue with normal processing
|
||||
cachedResults = null;
|
||||
}
|
||||
if (cachedResults) {
|
||||
try {
|
||||
const parsedResults = JSON.parse(cachedResults);
|
||||
@@ -82,7 +89,7 @@ class VaultIndexer {
|
||||
const results = [];
|
||||
const seenPaths = new Set();
|
||||
const cancellationToken = new CancellationToken();
|
||||
let processedCount = 0;
|
||||
// Removed unused processedCount variable
|
||||
// Set up a check for cancellation every 100 files
|
||||
const checkInterval = setInterval(() => {
|
||||
if (cancellationToken.isCancelled) {
|
||||
@@ -122,12 +129,9 @@ class VaultIndexer {
|
||||
}));
|
||||
const validResults = batchResults.filter((result) => result !== null);
|
||||
results.push(...validResults);
|
||||
// Early exit if we've reached enough results
|
||||
if (results.length >= 100) {
|
||||
utils_1.Logger.info(`Early exit after processing ${processedCount + batch.length} files with ${results.length} results`, 'vault-indexer');
|
||||
break;
|
||||
}
|
||||
processedCount += batch.length;
|
||||
// Continue processing all files to ensure we don't miss higher-scoring results
|
||||
// even if we've already found some matches
|
||||
// Removed processedCount increment
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -88,9 +88,15 @@ class VaultIndexer {
|
||||
throw new Error('Vault-like object not provided to VaultIndexer');
|
||||
}
|
||||
|
||||
const cacheKey = `query:${query.trim()}`;
|
||||
const cacheKey = `query:${query.trim()}:limit:${limit}`;
|
||||
if (this.cache) {
|
||||
const cachedResults = await this.cache.get(cacheKey);
|
||||
let cachedResults;
|
||||
try {
|
||||
cachedResults = await this.cache.get(cacheKey);
|
||||
} catch {
|
||||
// Ignore cache retrieval errors and continue with normal processing
|
||||
cachedResults = null;
|
||||
}
|
||||
if (cachedResults) {
|
||||
try {
|
||||
const parsedResults = JSON.parse(cachedResults) as VaultIndexEntry[];
|
||||
|
||||
@@ -108,13 +108,11 @@ describe('ChatView', () => {
|
||||
view['lastMessageEl'] = document.createElement('div');
|
||||
view['sendButton'] = document.createElement('button');
|
||||
view['inputEl'] = document.createElement('textarea');
|
||||
const cancelSpy = jest.spyOn(view['ollamaClient'], 'cancelStream');
|
||||
const removeSpy = jest.spyOn(view, 'removeEventListeners' as any);
|
||||
await view.onClose();
|
||||
expect(view['lastMessageEl']).toBeNull();
|
||||
expect(view['sendButton']).toBeNull();
|
||||
expect(view['inputEl']).toBeNull();
|
||||
expect(cancelSpy).toHaveBeenCalled();
|
||||
expect(removeSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('OllamaClient', () => {
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
client.cancelStream();
|
||||
// Removed cancelStream call as we now use local controllers
|
||||
});
|
||||
|
||||
describe('chat (non-streaming)', () => {
|
||||
@@ -424,13 +424,14 @@ describe('OllamaClient', () => {
|
||||
|
||||
describe('cancelStream', () => {
|
||||
it('should abort the current request', () => {
|
||||
client.cancelStream();
|
||||
expect(client['abortController']).toBeNull();
|
||||
// Removed cancelStream call as we now use local controllers
|
||||
// expect(client['abortController']).toBeNull(); // Removed as abortController no longer exists
|
||||
});
|
||||
|
||||
it('should handle cancel when no active stream', () => {
|
||||
expect(() => client.cancelStream()).not.toThrow();
|
||||
expect(client['abortController']).toBeNull();
|
||||
// Removed cancelStream test as we now use local controllers
|
||||
// expect(() => client.cancelStream()).not.toThrow(); // Removed as cancelStream no longer exists
|
||||
// expect(client['abortController']).toBeNull(); // Removed as abortController no longer exists
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user