@noetic-tools/core 5.20.0 → 5.21.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.
|
@@ -11,7 +11,6 @@ import { buildItemSchemaRegistry } from './model-schema.js';
|
|
|
11
11
|
import { awaitWithAbort, hasUsableResponseOutput, noteStreamGeneration, pipeStreamEventsToBroadcaster, providerTerminalError, } from './model-stream.js';
|
|
12
12
|
import { hasFunctionCalls, replayOutput, runToolRound } from './model-tool-round.js';
|
|
13
13
|
import { openSteerInbox } from './steer-inbox.js';
|
|
14
|
-
const MAX_TOOL_ROUNDS = 32;
|
|
15
14
|
const MAX_RECOVERY_CONTINUATIONS = 3;
|
|
16
15
|
const EPHEMERAL_CONTINUE_INPUT = 'continue';
|
|
17
16
|
function itemIds(items) {
|
|
@@ -190,7 +189,6 @@ export class AgentHarnessModelCaller {
|
|
|
190
189
|
: undefined;
|
|
191
190
|
let round = 0;
|
|
192
191
|
let invalidRecoveryContinuations = 0;
|
|
193
|
-
let toolLimitRecoveryContinuations = 0;
|
|
194
192
|
let useEphemeralContinue = false;
|
|
195
193
|
const drains = drainsOf(request.ctx);
|
|
196
194
|
const replaySchemas = buildItemSchemaRegistry({
|
|
@@ -323,15 +321,6 @@ export class AgentHarnessModelCaller {
|
|
|
323
321
|
await recordRound(spend.keep());
|
|
324
322
|
}
|
|
325
323
|
round += 1;
|
|
326
|
-
const replayLimit = this.handleToolRoundLimit({
|
|
327
|
-
round,
|
|
328
|
-
toolLimitRecoveryContinuations,
|
|
329
|
-
emitIfAllowed: prepared.emitIfAllowed,
|
|
330
|
-
});
|
|
331
|
-
if (replayLimit.kind === 'continue') {
|
|
332
|
-
toolLimitRecoveryContinuations = replayLimit.toolLimitRecoveryContinuations;
|
|
333
|
-
useEphemeralContinue = true;
|
|
334
|
-
}
|
|
335
324
|
continue;
|
|
336
325
|
}
|
|
337
326
|
if (marks.round !== round) {
|
|
@@ -552,15 +541,6 @@ export class AgentHarnessModelCaller {
|
|
|
552
541
|
});
|
|
553
542
|
await recordRound(bill);
|
|
554
543
|
round += 1;
|
|
555
|
-
const cutLimitRecovery = this.handleToolRoundLimit({
|
|
556
|
-
round,
|
|
557
|
-
toolLimitRecoveryContinuations,
|
|
558
|
-
emitIfAllowed: prepared.emitIfAllowed,
|
|
559
|
-
});
|
|
560
|
-
if (cutLimitRecovery.kind === 'continue') {
|
|
561
|
-
toolLimitRecoveryContinuations = cutLimitRecovery.toolLimitRecoveryContinuations;
|
|
562
|
-
useEphemeralContinue = true;
|
|
563
|
-
}
|
|
564
544
|
continue;
|
|
565
545
|
}
|
|
566
546
|
const recovery = await rejectRound(() => this.handleModelRecovery({
|
|
@@ -619,15 +599,6 @@ export class AgentHarnessModelCaller {
|
|
|
619
599
|
}
|
|
620
600
|
await recordRound(bill);
|
|
621
601
|
round += 1;
|
|
622
|
-
const limitRecovery = this.handleToolRoundLimit({
|
|
623
|
-
round,
|
|
624
|
-
toolLimitRecoveryContinuations,
|
|
625
|
-
emitIfAllowed: prepared.emitIfAllowed,
|
|
626
|
-
});
|
|
627
|
-
if (limitRecovery.kind === 'continue') {
|
|
628
|
-
toolLimitRecoveryContinuations = limitRecovery.toolLimitRecoveryContinuations;
|
|
629
|
-
useEphemeralContinue = true;
|
|
630
|
-
}
|
|
631
602
|
}
|
|
632
603
|
return {
|
|
633
604
|
items: allItems,
|
|
@@ -733,23 +704,4 @@ export class AgentHarnessModelCaller {
|
|
|
733
704
|
invalidRecoveryContinuations: next,
|
|
734
705
|
};
|
|
735
706
|
}
|
|
736
|
-
handleToolRoundLimit(params) {
|
|
737
|
-
if (params.round < MAX_TOOL_ROUNDS) {
|
|
738
|
-
return {
|
|
739
|
-
kind: 'ok',
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
params.emitIfAllowed('tool_round_limit_exceeded', {
|
|
743
|
-
maxToolRounds: MAX_TOOL_ROUNDS,
|
|
744
|
-
attempt: params.toolLimitRecoveryContinuations + 1,
|
|
745
|
-
maxAttempts: MAX_RECOVERY_CONTINUATIONS,
|
|
746
|
-
});
|
|
747
|
-
if (params.toolLimitRecoveryContinuations >= MAX_RECOVERY_CONTINUATIONS) {
|
|
748
|
-
throw new Error(`LLM exceeded maximum tool rounds (${MAX_TOOL_ROUNDS})`);
|
|
749
|
-
}
|
|
750
|
-
return {
|
|
751
|
-
kind: 'continue',
|
|
752
|
-
toolLimitRecoveryContinuations: params.toolLimitRecoveryContinuations + 1,
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
707
|
}
|