@kolisachint/hoocode-agent 0.4.71 → 0.4.72
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/CHANGELOG.md +17 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +3 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +10 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/routing/local-inference.d.ts +37 -7
- package/dist/core/routing/local-inference.d.ts.map +1 -1
- package/dist/core/routing/local-inference.js +44 -8
- package/dist/core/routing/local-inference.js.map +1 -1
- package/dist/core/routing/tool-result-prompts.d.ts +7 -6
- package/dist/core/routing/tool-result-prompts.d.ts.map +1 -1
- package/dist/core/routing/tool-result-prompts.js +7 -11
- package/dist/core/routing/tool-result-prompts.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -21,12 +21,13 @@ import { sleep } from "../utils/sleep.js";
|
|
|
21
21
|
import { loadAgentRegistry } from "./agent-registry.js";
|
|
22
22
|
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
|
23
23
|
import { executeBashWithOperations } from "./bash-executor.js";
|
|
24
|
-
import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, generateBranchSummary, prepareCompaction, shouldCompact, } from "./compaction/index.js";
|
|
24
|
+
import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, generateBranchSummary, prepareCompaction, serializeConversation, shouldCompact, } from "./compaction/index.js";
|
|
25
25
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
26
26
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
27
27
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
28
28
|
import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
|
|
29
29
|
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
30
|
+
import { convertToLlm } from "./messages.js";
|
|
30
31
|
import { expandPromptTemplate, tryExpandPromptTemplate } from "./prompt-templates.js";
|
|
31
32
|
import { clearProviderExhaustion, isProviderQuotaError, markProviderExhausted } from "./provider-health.js";
|
|
32
33
|
import { LocalInferenceRouter, resolveRoutingMode } from "./routing/local-inference.js";
|
|
@@ -283,7 +284,7 @@ export class AgentSession {
|
|
|
283
284
|
changed = true;
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
|
-
// Optionally compress large
|
|
287
|
+
// Optionally compress large bash output before it enters context.
|
|
287
288
|
// Only when local-inference tool-result routing is active; on any
|
|
288
289
|
// failure the original (uncompressed) content is kept (fallback to raw).
|
|
289
290
|
if (!resolvedIsError) {
|
|
@@ -301,7 +302,8 @@ export class AgentSession {
|
|
|
301
302
|
/**
|
|
302
303
|
* Compress a tool result via the local executor when routing is active and the
|
|
303
304
|
* tool/size qualify. Returns the compressed content blocks, or undefined to
|
|
304
|
-
* keep the original (no routing, not compressible,
|
|
305
|
+
* keep the original (no routing, not compressible, outside the size band, or
|
|
306
|
+
* any failure).
|
|
305
307
|
*/
|
|
306
308
|
async _maybeCompressToolResult(toolName, content) {
|
|
307
309
|
const router = this.localRouter;
|
|
@@ -1494,7 +1496,11 @@ export class AgentSession {
|
|
|
1494
1496
|
async _compactWithRouting(preparation, primaryModel, apiKey, headers, customInstructions, signal) {
|
|
1495
1497
|
const router = this.localRouter;
|
|
1496
1498
|
const executor = router?.selectModel("summarization", primaryModel);
|
|
1497
|
-
|
|
1499
|
+
// Size band guards local inference globally: only route conversations within
|
|
1500
|
+
// the configured byte band to the executor. Oversized conversations are slow
|
|
1501
|
+
// locally and can OOM small machines, so they fall back to the primary model.
|
|
1502
|
+
const conversationBytes = Buffer.byteLength(serializeConversation(convertToLlm(preparation.messagesToSummarize)), "utf8");
|
|
1503
|
+
if (router && executor && executor !== primaryModel && router.withinSizeBand(conversationBytes)) {
|
|
1498
1504
|
try {
|
|
1499
1505
|
if (!(await this._ensureExecutorServer(signal))) {
|
|
1500
1506
|
throw new Error("executor server unavailable");
|