@cerebriline/agents 4.100.267 → 4.100.268
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/dist/agent-runtime.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runtime.d.ts","sourceRoot":"","sources":["../src/agent-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,uBAAuB,EAE5B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAKX,YAAY,EAEZ,UAAU,EAKV,cAAc,EACd,iBAAiB,EAEjB,yBAAyB,EAOzB,kBAAkB,IAAI,sBAAsB,EAQ5C,iBAAiB,EAEjB,MAAM,eAAe,CAAC;AAmGvB,kEAAkE;AAClE,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,GAClB,MAAM,CAmBR;AAYD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAoPjD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACzC,SAAS,CAAC,EAAE,iBAAiB,GAC3B,MAAM,CAcR;AAYD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sCAAsC,IAAI,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mCAAmC,OAAO,CAAC;AA0BxD;;;;GAIG;AACH,eAAO,MAAM,kDAAkD,sPACgL,CAAC;AAEhP;;;GAGG;AACH,eAAO,MAAM,+CAA+C,0JAC4F,CAAC;AAEzJ;;;GA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AO,CAAC,iBAAiB;IAazB;;;;;;OAMG;YACW,eAAe;IAqB7B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,mBAAmB;IAW3B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgD;IAE5E,OAAO,CAAC,eAAe;IAevB,uEAAuE;IACvE,OAAO,CAAC,aAAa;IAQrB;;;;;;;;;OASG;IACH,OAAO,CAAC,KAAK;YAKC,IAAI;IAmHlB,OAAO,CAAC,gBAAgB;CAWxB;AA0DD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAE3E;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,qBAAe,CAAC;AAClC,MAAM,MAAM,KAAK,GAAG,YAAY,CAAC;AAEjC,wBAAgB,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAEpE"}
|
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ ${i}
|
|
|
94
94
|
</hook_context>`}function Y(e){return e.map((t)=>({...t,content:t.content.map((n)=>({...n})),metadata:t.metadata?{...t.metadata}:void 0,modelInfo:t.modelInfo?{...t.modelInfo}:void 0,metrics:t.metrics?{...t.metrics}:void 0}))}function Op(e,t){let n=Math.max(0,(t.inputTokens??0)-(e.inputTokens??0)),i=Math.max(0,(t.outputTokens??0)-(e.outputTokens??0)),r=Math.max(0,(t.cacheReadTokens??0)-(e.cacheReadTokens??0)),o=Math.max(0,(t.cacheWriteTokens??0)-(e.cacheWriteTokens??0)),s=Math.max(0,(t.reasoningTokenCount??0)-(e.reasoningTokenCount??0)),a=e.totalCost??0,u=t.totalCost??0,c=Math.max(0,u-a);if(n===0&&i===0&&r===0&&o===0&&s===0&&c===0)return;return{inputTokens:n>0?n:0,outputTokens:i>0?i:0,cacheReadTokens:r>0?r:0,cacheWriteTokens:o>0?o:0,...s>0?{reasoningTokenCount:s}:{},...c>0?{cost:c}:{}}}function Mp(e){return e.options?.thinking===!1}function Oe(e){if(!e)return"";return e.content.filter((t)=>t.type==="text").map((t)=>t.text).join("")}function eo(e){if(!e)return"";let t=[];for(let n of e.content){if(n.type!=="reasoning")continue;let i=n.text;if(typeof i==="string"&&i.length>0)t.push(i)}return t.join(`
|
|
95
95
|
|
|
96
96
|
`)}function Pp(e){if(!e)return 0;return e.content.reduce((t,n)=>{if(n.type!=="reasoning")return t;let i=n.text;return t+(typeof i==="string"?i.length:0)},0)}function to(e){let t=e?.content.find((n)=>n.type==="tool-result");if(!t||t.isError)return"";if(typeof t.output==="string")return t.output;try{return JSON.stringify(t.output)}catch{return String(t.output)}}function $p(e){if(typeof e==="string")return[de("user",[{type:"text",text:e}])];if(Array.isArray(e))return Y(e);return Y([e])}var Lp=8;function zp(e){if(e.toolExecution==="sequential")return 1;let t=e.maxParallelToolCalls;if(typeof t==="number"&&Number.isFinite(t))return Math.max(1,Math.floor(t));return Lp}class qe{config;listeners=new Set;tools=new Map;hooks={beforeRun:[],afterRun:[],beforeModel:[],afterModel:[],beforeTool:[],afterTool:[],onEvent:[]};pendingHookContexts=[];state={agentId:"",agentRole:void 0,parentAgentId:void 0,runId:void 0,status:"idle",iteration:0,messages:[],pendingToolCalls:[],usage:oe(tn),lastRequestTimings:void 0,lastError:void 0,lastErrorClass:void 0,lastRequestInputTokens:0,lastErrorRetryable:void 0,lastErrorReported:!1,lastFinishReason:void 0};lastToolCallRejection;overflowRecoveryAttempted=!1;lastRequestTokens;compactBeforeNextTurn=!1;imageRecoveryAttempted=!1;consecutiveNoToolCallNudges=0;noToolCallNudgeAsked=!1;calledToolThisRun=!1;stoppedForUserBy;hasCalledAnyTool=!1;consecutiveNoToolCallTurns=0;noToolCallStreakReasoningChars=0;nonConvergenceNudgeSpent=!1;lastNudgedUnreadableCall;intentNudgeSpent=!1;repetitionNudger;repetitionNudgerBuilt=!1;repetitionNudges=new WeakMap;announcedRepetitionRemoval=new WeakSet;unreadableCalls=new WeakMap;unreadableCallFingerprints=new WeakMap;steerAwaitingResume=!1;consecutiveMaxTokensRetries=0;toolCallParseRetries=0;thinkingOnlyRetries=0;truncatedOutputCapTokens;initialization;abortController;reasoningLoopStreak=0;pendingToolIntentNudge;lastIssuedRequest;toolIntentCutStreak=0;modelSteerController;telemetryProviderId;telemetryModelId;constructor(e){this.telemetryProviderId=V(e.messageModelInfo?.provider)??("providerId"in e?V(e.providerId):void 0),this.telemetryModelId=V(e.messageModelInfo?.id)??("modelId"in e?V(e.modelId):void 0);let t=xp(e),n=zp(t);this.config={...t,toolExecution:n>1?"parallel":"sequential",maxParallelToolCalls:n},this.state.agentId=t.agentId??ye("agent"),this.state.agentRole=t.agentRole,this.state.parentAgentId=t.parentAgentId,this.state.messages=Y(t.initialMessages??[])}async run(e){return this.execute(e)}async continue(e){return this.execute(e)}notifyPendingUserMessage(){this.modelSteerController?.abort()}abort(e){if(!this.abortController)return;if(this.abortController.signal.aborted)return;let t=e instanceof ve?e:new ve(e);this.state.lastError=t.message,this.captureTaskLifecycle(Ar,{error:t}),this.abortController.abort(t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}restore(e){this.abort("Agent state restored"),this.state.runId=void 0,this.state.status="idle",this.state.iteration=0,this.state.pendingToolCalls=[],this.state.usage=oe(tn),this.state.lastError=void 0,this.state.lastErrorClass=void 0,this.state.lastErrorRetryable=void 0,this.state.lastErrorReported=!1,this.state.messages=Y(e),this.config={...this.config,initialMessages:Y(e)}}snapshot(){let e=[...this.state.messages],t;return{agentId:this.state.agentId,agentRole:this.state.agentRole,parentAgentId:this.state.parentAgentId,conversationId:this.config.conversationId?.trim()||void 0,runId:this.state.runId,status:this.state.status,iteration:this.state.iteration,get messages(){return t??=Y(e),t},pendingToolCalls:[...this.state.pendingToolCalls],usage:oe(this.state.usage),lastError:this.state.lastError,lastErrorClass:this.state.lastErrorClass}}async ensureInitialized(){this.initialization??=this.initialize(),await this.initialization}async initialize(){this.registerHooks(this.config.hooks);for(let e of this.config.tools??[])this.tools.set(e.name,e);for(let e of this.config.plugins??[]){let t=await e.setup?.({agentId:this.state.agentId,agentRole:this.state.agentRole,systemPrompt:this.config.systemPrompt});for(let n of t?.tools??[])this.tools.set(n.name,n);this.registerHooks(t?.hooks)}}registerHooks(e){if(!e)return;if(e.beforeRun)this.hooks.beforeRun.push(e.beforeRun);if(e.afterRun)this.hooks.afterRun.push(e.afterRun);if(e.beforeModel)this.hooks.beforeModel.push(e.beforeModel);if(e.afterModel)this.hooks.afterModel.push(e.afterModel);if(e.beforeTool)this.hooks.beforeTool.push(e.beforeTool);if(e.afterTool)this.hooks.afterTool.push(e.afterTool);if(e.onEvent)this.hooks.onEvent.push(e.onEvent)}getRequiredCompletionToolNames(){if(this.config.completionPolicy?.requireCompletionTool!==!0)return[];return[...this.tools.values()].filter((e)=>e.lifecycle?.completesRun===!0).map((e)=>e.name).sort()}getCompletionToolReminderMessage(){let e=this.getRequiredCompletionToolNames();if(e.length===0)return;return`[SYSTEM] This run is not complete until you call one of these terminal completion tools: ${e.join(", ")}. Continue working if requirements are not met. If the task is complete, call the appropriate terminal completion tool now.`}async runCompletionBoundary(e,t=!1){let n=this.config.completionPolicy?.onCompletionAttempt;if(!n)return;let i=await n({text:e||void 0,forced:t});return i&&i.length>0?i:void 0}getCompletionReminderMessages(){let e=this.config.completionPolicy?.completionGuard?.();return{messages:[this.getCompletionToolReminderMessage(),e].filter((t)=>Boolean(t)),guardAsked:Boolean(e)}}async getNoToolCallNudgeMessage(e,t=!1,n){let i=this.config.completionPolicy?.maxNoToolCallNudges??0;if(this.consecutiveNoToolCallNudges>=i)return;let r=n??Se(e);if(r)return Bt(r);let o=await this.config.completionPolicy?.describeUnstartedWork?.();if(t&&!o)return;if(this.noToolCallNudgeAsked&&this.consecutiveNoToolCallNudges===0&&!o&&fr(e))return;if(this.calledToolThisRun&&this.consecutiveNoToolCallNudges===0&&!this.noToolCallNudgeAsked&&!o&&(gr(e)||this.stoppedForUserBy!==void 0&&yr(e)))return;if(this.config.completionPolicy?.strongNudges===!1&&!o&&!this.hasCalledAnyTool&&!ft(e))return;let s=this.tools.has("ask_question")?Ft+lr:Ft;return o?s+o:s}repetitionNudgeFor(e){if(!this.repetitionNudgerBuilt){this.repetitionNudgerBuilt=!0;let r=this.config.reasoningRepetition;this.repetitionNudger=r===!1?void 0:Gt({...ge,...r})}if(!e)return;let t=this.repetitionNudges.get(e);if(t)return t.nudge;let n=eo(e),i=n?this.repetitionNudger?.inspect(n,this.state.iteration):void 0;return this.repetitionNudges.set(e,{nudge:i}),i}replaceSpoiledContent(e){if(e.role!=="assistant")return;let t,n={kinds:[],removedChars:0},i=[...e.content],r=eo(e);if(r){this.repetitionNudgeFor(e);let c=e.metadata?.reasoningLoop,d=this.config.reasoningRepetition,y={...ge,...d||{}},p=d===!1?void 0:yt(r,y),v=c?"it collapsed into repeating itself and was cut":p&&vt(p,y)?`it repeated one passage ${p.maxRepeat} times`:void 0;if(v){let b=`[SYSTEM] The reasoning of this turn was removed: ${v}. Only what the turn did is kept.`,w=i.findIndex((B)=>B.type==="reasoning"),F=i.filter((B)=>B.type!=="reasoning");if(F.splice(Math.max(0,w),0,{type:"reasoning",text:b}),i.splice(0,i.length,...F),n.kinds.push("reasoning_loop"),n.removedChars+=r.length,this.recordCut({channel:"reasoning",cause:c?"reasoning_loop":"reasoning_repetition",...c?{verdict:c}:{},text:r}),!c&&p){let B=this.repetitionNudges.get(e)?.nudge;t=`the reasoning repeated one passage ${p.maxRepeat} times — removed from the conversation${B?", asking for a different approach":""}`}this.config.logger?.debug?.(`[reasoning-loop] iter=${this.state.iteration} removed: ${c?`${r.length} chars; cut while streaming (${c.kind}${c.cycles!==void 0?`, ${c.cycles} cycles`:""}); unit: ${JSON.stringify(c.sample.slice(0,400))}`:p?$r(r,p):`${r.length} chars`}`)}}let o=i.some((c)=>c.type==="tool-call"),s=Oe(e),a=o?void 0:Se(s);if(a){this.unreadableCalls.set(e,a),this.unreadableCallFingerprints.set(e,no(s));let c=i.findIndex((p)=>p.type==="text"),d=i.filter((p)=>p.type!=="text");d.splice(c<0?d.length:Math.min(c,d.length),0,{type:"text",text:cr(a)}),i.splice(0,i.length,...d),n.kinds.push("unreadable_tool_call"),n.removedChars+=s.length,this.recordCut({channel:"reply",cause:"unreadable_tool_call",text:s});let y=(p)=>p.replace(/\s+/g," ");this.config.logger?.debug?.(`[unreadable-call] iter=${this.state.iteration} ${s.length} chars; begins: ${y(s.slice(0,400))}${s.length>700?` ...; ends: ${y(s.slice(-300))}`:""}`)}if(n.kinds.length===0)return;this.config.logger?.debug?.(`Replaced spoiled content in an assistant turn (${n.kinds.join(", ")}): ${n.removedChars} chars removed`);let u=e;return u.content=i,u.metadata={...e.metadata??{},spoiledTurn:n},t}nudgesEnabled(){return(this.config.completionPolicy?.maxNoToolCallNudges??0)>0}shouldNudgeNonConvergence(){if(this.nonConvergenceNudgeSpent||!this.nudgesEnabled())return!1;let e=this.config.completionPolicy?.noToolCallTurnStreakLimit??io;return e>0&&this.consecutiveNoToolCallTurns>=e}turnProducedOutputTokens(e){return this.state.usage.outputTokens>e.outputTokens}continuationRoomTokens(){let e=this.state.lastRequestInputTokens,t=qt(this.config.sessionId);if(!(e>0)||!t)return;if(t.contextWindow!==void 0)return Math.max(0,t.contextWindow-e-hp);if(!t.maxTokens)return;let n=Math.max(e,t.estimatedInputTokens??0)+t.maxTokens;return Math.max(0,n-e)}async continueConversation(e,t){let n=new AbortController,i=await this.config.model.stream({...e,messages:[...e.messages,de("user",[{type:"text",text:t.instruction}],{displayRole:"system"})],signal:this.abortController?AbortSignal.any([this.abortController.signal,n.signal]):n.signal,options:{...e.options,maxTokens:t.maxTokens,toolChoice:"none"}}),r="";for await(let o of i){if(o.type==="tool-input-progress"||o.type==="tool-call-delta"&&!o.execution)throw n.abort(),Error(`the model started calling ${o.toolName??"a tool"} instead of answering (tool choice "none" was not enforced)`);if(o.type==="text-delta")r+=o.text;else if(o.type==="usage")this.state.usage.inputTokens+=o.usage.inputTokens??0,this.state.usage.outputTokens+=o.usage.outputTokens??0;else if(o.type==="finish"&&o.reason==="error")throw Error(o.error??"the model call failed")}return{text:r.trim()}}recoversTurnFault(e){if(!this.config.recoverTurnFault)return!1;let t=this.config.recoverTurnFaultKinds;return t===void 0||t.includes(e)}userRequestsInTranscript(){let e=[],t=(n)=>{let i=typeof n==="string"?n.trim():"";if(i&&!e.includes(i))e.push(i)};for(let n of this.state.messages){if(n.role!=="user")continue;let i=n.metadata;if(i?.kind==="compaction_summary"){if(Array.isArray(i.userRequests))for(let r of i.userRequests)t(r);continue}if(i?.userRunSpan===0||n.content.some((r)=>r.type==="tool-result"))continue;t(n.content.filter((r)=>r.type==="text"&&typeof r.text==="string").map((r)=>r.text).join(`
|
|
97
|
-
`))}return e}async noteDiscardedReasoning(e,t){let n=this.config.condenseDiscardedReasoning;if(!n){this.config.logger?.debug?.("Discarded turn not condensed: no condenser is installed");return}let i=e.content.filter((o)=>o.type==="reasoning"&&typeof o.text==="string").map((o)=>o.text).join("").trim(),r=e.content.filter((o)=>o.type==="text"&&typeof o.text==="string").map((o)=>o.text).join("").trim();if(this.config.logger?.log?.(`Discarded a turn cut off at the output limit: parts=[${e.content.map((o)=>o.type).join(", ")||"none"}] reasoning=${i.length} chars partialReply=${r.length} chars windowBound=${t}`,{severity:"info"}),!i&&!r){this.config.logger?.log?.(`Discarded turn had nothing to condense: parts=[${e.content.map((o)=>o.type).join(", ")||"none"}] contentLength=${e.content.length}`,{severity:"warn"});return}try{let o=this.lastIssuedRequest,s=this.continuationRoomTokens(),a=this.userRequestsInTranscript(),u=await n({reasoning:i,...r?{text:r}:{},windowBound:t,...a.length>0?{userRequests:a}:{},transcript:this.state.messages,...o?{continueConversation:(y)=>this.continueConversation(o,y)}:{},...s!==void 0?{continuationRoomTokens:s}:{}}),c=u?.note?.trim(),d=u?.retrospective?.trim();if(!c&&!d){this.config.logger?.log?.(`Discarded turn was not condensed: the condenser returned nothing for ${i.length} chars of reasoning and ${r.length} chars of partial reply`,{severity:"warn"});return}return this.config.logger?.log?.(`Condensed ${i.length} chars of discarded reasoning into a ${c?.length??0}-char note and a ${d?.length??0}-char retrospective for the retry`,{severity:"info",reasoningChars:i.length,noteChars:c?.length??0,retrospectiveChars:d?.length??0}),{...c?{note:c}:{},...d?{retrospective:d}:{}}}catch(o){this.config.logger?.log?.("Could not condense the discarded reasoning; retrying without a note",{severity:"warn",errorMessage:o instanceof Error?o.message:String(o)});return}}getRetryOutputCap(){if(this.consecutiveMaxTokensRetries<1||this.truncatedOutputCapTokens===void 0)return;let e=Math.floor(this.truncatedOutputCapTokens/2**this.consecutiveMaxTokensRetries);return Math.max(rp,e)}getMaxTokensRetryBudget(){let e=this.config.completionPolicy?.maxTruncatedTurnRetries;return typeof e==="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):Qd}async addUserReminderMessage(e,t){let n=de("user",[{type:"text",text:e}],{userRunSpan:0,displayRole:"system",...t??{}});return this.state.messages.push(n),await this.emit({type:"message-added",snapshot:this.snapshot(),message:n}),n}async execute(e){if(await this.ensureInitialized(),this.state.status==="running")throw Error("Agent runtime is already running");this.abortController=new AbortController,this.state.runId=ye("run"),this.state.status="running",this.state.iteration=0,this.state.pendingToolCalls=[],this.state.lastError=void 0,this.state.lastErrorClass=void 0,this.state.lastErrorRetryable=void 0,this.state.lastErrorReported=!1,this.state.lastFinishReason=void 0,this.state.usage=oe(tn),this.overflowRecoveryAttempted=!1,this.compactBeforeNextTurn=!1,this.imageRecoveryAttempted=!1,this.steerAwaitingResume=!1,this.noToolCallNudgeAsked=!1,this.calledToolThisRun=!1,this.stoppedForUserBy=void 0,this.state.lastRequestInputTokens=0,this.pendingHookContexts=[];try{await this.callBeforeRunHooks(),await this.emit({type:"run-started",snapshot:this.snapshot()});for(let i of e?$p(e):[])this.state.messages.push(i),await this.emit({type:"message-added",snapshot:this.snapshot(),message:i});let t=this.getCompletionToolReminderMessage();if(t)await this.addUserReminderMessage(t);await this.flushPendingHookContexts();let n;while(this.config.maxIterations===void 0||this.state.iteration<this.config.maxIterations){this.throwIfAborted(),this.state.iteration+=1,this.trace(`turn-begin iter=${this.state.iteration}`),await this.emit({type:"turn-started",snapshot:this.snapshot(),iteration:this.state.iteration});let i=oe(this.state.usage);this.resetLastError();let{message:r,finishReason:o,interrupted:s}=await this.generateAssistantMessageWithProviderRetry();if(s&&r.content.length===0){await this.emit({type:"turn-finished",snapshot:this.snapshot(),iteration:this.state.iteration,toolCallCount:0});continue}if(o==="aborted")throw this.normalizeAbortError();if(r.content.length===0){if(o!=="error"&&o!=="content-filter"&&this.turnProducedOutputTokens(i)&&this.consecutiveMaxTokensRetries<this.getMaxTokensRetryBudget()){this.consecutiveMaxTokensRetries+=1,await this.emit({type:"status-notice",snapshot:this.snapshot(),message:"the model produced nothing usable — retrying",metadata:{kind:"empty_turn_recovery",reason:"empty_turn_recovery",phase:"started",iteration:this.state.iteration,attempt:this.consecutiveMaxTokensRetries,finishReason:o}}),await this.addUserReminderMessage(up);continue}if(await this.recoverUnparsableToolCall())continue;if(o==="error")throw this.state.lastFinishReason=o,Error(this.state.lastError??"Model stream failed");if(!this.hasModelToolActivity(r)&&o!=="max-tokens"&&o!=="unknown")throw this.state.lastFinishReason=o,Error(o==="content-filter"?_p:"Model returned empty response")}let a=r.content.filter((p)=>p.type==="tool-call");if(o==="max-tokens"&&a.length===0&&this.consecutiveMaxTokensRetries<this.getMaxTokensRetryBudget()){this.consecutiveMaxTokensRetries+=1;let p=qt(this.config.sessionId);this.compactBeforeNextTurn=p?.windowBound??!0,this.truncatedOutputCapTokens=this.compactBeforeNextTurn?void 0:p?.maxTokens;let v=await this.noteDiscardedReasoning(r,this.compactBeforeNextTurn);await this.emit({type:"status-notice",snapshot:this.snapshot(),message:"output limit reached before the turn finished — retrying",metadata:{kind:"max_tokens_turn_recovery",reason:"max_tokens_turn_recovery",phase:"started",iteration:this.state.iteration,attempt:this.consecutiveMaxTokensRetries,maxAttempts:this.getMaxTokensRetryBudget(),outputCapSource:p?.source??"unknown",...typeof p?.maxTokens==="number"?{capTokens:p.maxTokens}:{},compacting:this.compactBeforeNextTurn}});let b=op(r.metadata?.unfinishedToolCalls),w=b?`${Yr} ${b}`:Yr;await this.addUserReminderMessage(v?[w,...v.note?[ap,v.note]:[],...v.retrospective?[sp,v.retrospective]:[]].join(`
|
|
97
|
+
`))}return e}async noteDiscardedReasoning(e,t){let n=this.config.condenseDiscardedReasoning;if(!n){this.config.logger?.debug?.("Discarded turn not condensed: no condenser is installed");return}let i=e.content.filter((o)=>o.type==="reasoning"&&typeof o.text==="string").map((o)=>o.text).join("").trim(),r=e.content.filter((o)=>o.type==="text"&&typeof o.text==="string").map((o)=>o.text).join("").trim();if(this.config.logger?.log?.(`Discarded a turn cut off at the output limit: parts=[${e.content.map((o)=>o.type).join(", ")||"none"}] reasoning=${i.length} chars partialReply=${r.length} chars windowBound=${t}`,{severity:"info"}),!i&&!r){this.config.logger?.log?.(`Discarded turn had nothing to condense: parts=[${e.content.map((o)=>o.type).join(", ")||"none"}] contentLength=${e.content.length}`,{severity:"warn"});return}try{let o=this.lastIssuedRequest,s=this.continuationRoomTokens(),a=this.userRequestsInTranscript(),u=await n({reasoning:i,...r?{text:r}:{},windowBound:t,...a.length>0?{userRequests:a}:{},transcript:this.state.messages,...o?{continueConversation:(y)=>this.continueConversation(o,y)}:{},...s!==void 0?{continuationRoomTokens:s}:{},...this.abortController?{abortSignal:this.abortController.signal}:{}}),c=u?.note?.trim(),d=u?.retrospective?.trim();if(!c&&!d){this.config.logger?.log?.(`Discarded turn was not condensed: the condenser returned nothing for ${i.length} chars of reasoning and ${r.length} chars of partial reply`,{severity:"warn"});return}return this.config.logger?.log?.(`Condensed ${i.length} chars of discarded reasoning into a ${c?.length??0}-char note and a ${d?.length??0}-char retrospective for the retry`,{severity:"info",reasoningChars:i.length,noteChars:c?.length??0,retrospectiveChars:d?.length??0}),{...c?{note:c}:{},...d?{retrospective:d}:{}}}catch(o){if(this.abortController?.signal.aborted){this.config.logger?.log?.("Stopped condensing the discarded reasoning: the run was aborted",{severity:"info"});return}this.config.logger?.log?.("Could not condense the discarded reasoning; retrying without a note",{severity:"warn",errorMessage:o instanceof Error?o.message:String(o)});return}}getRetryOutputCap(){if(this.consecutiveMaxTokensRetries<1||this.truncatedOutputCapTokens===void 0)return;let e=Math.floor(this.truncatedOutputCapTokens/2**this.consecutiveMaxTokensRetries);return Math.max(rp,e)}getMaxTokensRetryBudget(){let e=this.config.completionPolicy?.maxTruncatedTurnRetries;return typeof e==="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):Qd}async addUserReminderMessage(e,t){let n=de("user",[{type:"text",text:e}],{userRunSpan:0,displayRole:"system",...t??{}});return this.state.messages.push(n),await this.emit({type:"message-added",snapshot:this.snapshot(),message:n}),n}async execute(e){if(await this.ensureInitialized(),this.state.status==="running")throw Error("Agent runtime is already running");this.abortController=new AbortController,this.state.runId=ye("run"),this.state.status="running",this.state.iteration=0,this.state.pendingToolCalls=[],this.state.lastError=void 0,this.state.lastErrorClass=void 0,this.state.lastErrorRetryable=void 0,this.state.lastErrorReported=!1,this.state.lastFinishReason=void 0,this.state.usage=oe(tn),this.overflowRecoveryAttempted=!1,this.compactBeforeNextTurn=!1,this.imageRecoveryAttempted=!1,this.steerAwaitingResume=!1,this.noToolCallNudgeAsked=!1,this.calledToolThisRun=!1,this.stoppedForUserBy=void 0,this.state.lastRequestInputTokens=0,this.pendingHookContexts=[];try{await this.callBeforeRunHooks(),await this.emit({type:"run-started",snapshot:this.snapshot()});for(let i of e?$p(e):[])this.state.messages.push(i),await this.emit({type:"message-added",snapshot:this.snapshot(),message:i});let t=this.getCompletionToolReminderMessage();if(t)await this.addUserReminderMessage(t);await this.flushPendingHookContexts();let n;while(this.config.maxIterations===void 0||this.state.iteration<this.config.maxIterations){this.throwIfAborted(),this.state.iteration+=1,this.trace(`turn-begin iter=${this.state.iteration}`),await this.emit({type:"turn-started",snapshot:this.snapshot(),iteration:this.state.iteration});let i=oe(this.state.usage);this.resetLastError();let{message:r,finishReason:o,interrupted:s}=await this.generateAssistantMessageWithProviderRetry();if(s&&r.content.length===0){await this.emit({type:"turn-finished",snapshot:this.snapshot(),iteration:this.state.iteration,toolCallCount:0});continue}if(o==="aborted")throw this.normalizeAbortError();if(r.content.length===0){if(o!=="error"&&o!=="content-filter"&&this.turnProducedOutputTokens(i)&&this.consecutiveMaxTokensRetries<this.getMaxTokensRetryBudget()){this.consecutiveMaxTokensRetries+=1,await this.emit({type:"status-notice",snapshot:this.snapshot(),message:"the model produced nothing usable — retrying",metadata:{kind:"empty_turn_recovery",reason:"empty_turn_recovery",phase:"started",iteration:this.state.iteration,attempt:this.consecutiveMaxTokensRetries,finishReason:o}}),await this.addUserReminderMessage(up);continue}if(await this.recoverUnparsableToolCall())continue;if(o==="error")throw this.state.lastFinishReason=o,Error(this.state.lastError??"Model stream failed");if(!this.hasModelToolActivity(r)&&o!=="max-tokens"&&o!=="unknown")throw this.state.lastFinishReason=o,Error(o==="content-filter"?_p:"Model returned empty response")}let a=r.content.filter((p)=>p.type==="tool-call");if(o==="max-tokens"&&a.length===0&&this.consecutiveMaxTokensRetries<this.getMaxTokensRetryBudget()){this.consecutiveMaxTokensRetries+=1;let p=qt(this.config.sessionId);this.compactBeforeNextTurn=p?.windowBound??!0,this.truncatedOutputCapTokens=this.compactBeforeNextTurn?void 0:p?.maxTokens;let v=await this.noteDiscardedReasoning(r,this.compactBeforeNextTurn);await this.emit({type:"status-notice",snapshot:this.snapshot(),message:"output limit reached before the turn finished — retrying",metadata:{kind:"max_tokens_turn_recovery",reason:"max_tokens_turn_recovery",phase:"started",iteration:this.state.iteration,attempt:this.consecutiveMaxTokensRetries,maxAttempts:this.getMaxTokensRetryBudget(),outputCapSource:p?.source??"unknown",...typeof p?.maxTokens==="number"?{capTokens:p.maxTokens}:{},compacting:this.compactBeforeNextTurn}});let b=op(r.metadata?.unfinishedToolCalls),w=b?`${Yr} ${b}`:Yr;await this.addUserReminderMessage(v?[w,...v.note?[ap,v.note]:[],...v.retrospective?[sp,v.retrospective]:[]].join(`
|
|
98
98
|
|
|
99
99
|
`):w,{noticeKind:"max_tokens_turn_recovery",attempt:this.consecutiveMaxTokensRetries,maxAttempts:this.getMaxTokensRetryBudget(),capSource:p?.source??"unknown",...typeof p?.maxTokens==="number"?{capTokens:p.maxTokens}:{},compacting:this.compactBeforeNextTurn});continue}if(n=r,await this.recordAssistantMessage(r,o),s){await this.emit({type:"turn-finished",snapshot:this.snapshot(),iteration:this.state.iteration,toolCallCount:0});continue}if(o==="unknown"&&a.length===0)throw this.state.lastFinishReason=o,Error("Model ended without a recognized finish reason");if(o==="max-tokens"&&a.length===0)throw this.state.lastFinishReason=o,Error(Xd);if(o==="error"&&a.length===0){if(await this.recoverUnparsableToolCall())continue;throw this.state.lastFinishReason=o,Error(this.state.lastError??"Model stream failed")}if(this.toolCallParseRetries=0,this.state.pendingToolCalls=a.map((p)=>p.toolCallId),a.length===0){await this.emit({type:"turn-finished",snapshot:this.snapshot(),iteration:this.state.iteration,toolCallCount:0});let p=Pp(r);if(p>=ro)this.consecutiveNoToolCallTurns+=1,this.noToolCallStreakReasoningChars+=p;else this.consecutiveNoToolCallTurns=0,this.noToolCallStreakReasoningChars=0;if(this.steerAwaitingResume){this.steerAwaitingResume=!1,await this.addUserReminderMessage(lp);continue}if(this.pendingToolIntentNudge){let x=this.pendingToolIntentNudge;this.pendingToolIntentNudge=void 0,await this.addUserReminderMessage(x);continue}let v=[],b=[],w=this.getCompletionReminderMessages();v.push(...w.messages);let F=Oe(n),B=n?this.unreadableCalls.get(n):void 0,H=await this.getNoToolCallNudgeMessage(F,w.guardAsked,B);if(H)this.noToolCallNudgeAsked=!0,this.consecutiveNoToolCallNudges+=1,v.push(H),b.push({nudge:"no_tool_call",detail:{consecutive:this.consecutiveNoToolCallNudges}});let A=this.nudgesEnabled()?B??Se(F):void 0,P=A?(n?this.unreadableCallFingerprints.get(n):void 0)??no(F??""):void 0;if(A&&P!==this.lastNudgedUnreadableCall){this.lastNudgedUnreadableCall=P;let x=Bt(A);if(!v.includes(x))v.push(x);b.push({nudge:"unparsed_tool_call"})}let G=this.intentNudgeSpent||!this.nudgesEnabled()?void 0:ft(F);if(G)this.intentNudgeSpent=!0,v.push(dr(G)),b.push({nudge:"announced_intent"});if(this.shouldNudgeNonConvergence())this.nonConvergenceNudgeSpent=!0,v.push(ur(this.consecutiveNoToolCallTurns,this.noToolCallStreakReasoningChars)),b.push({nudge:"non_convergence",detail:{consecutiveNoToolCallTurns:this.consecutiveNoToolCallTurns,reasoningChars:this.noToolCallStreakReasoningChars}});let se=this.nudgesEnabled()?this.repetitionNudgeFor(r):void 0;if(se)v.push(se),b.push({nudge:"silent_repetition"});if(v.length>0){for(let x of new Set(v))await this.addUserReminderMessage(x);for(let x of b){if(x.nudge==="silent_repetition"&&this.announcedRepetitionRemoval.has(r))continue;await this.emit({type:"status-notice",snapshot:this.snapshot(),message:Up(x.nudge),metadata:{kind:"nudge",reason:"nudge",nudge:x.nudge,iteration:this.state.iteration,...x.detail??{}}})}continue}let be=await this.runCompletionBoundary(Oe(n),this.consecutiveNoToolCallNudges>0);if(be){await this.addUserReminderMessage(be);continue}let ae=r.metadata?.modelToolActivities||this.reasoningLoopStreak>0?void 0:mp(r);if(ae&&this.thinkingOnlyRetries<Xr){this.thinkingOnlyRetries+=1,await this.emit({type:"status-notice",snapshot:this.snapshot(),message:ae.toolCallInThinking?"the model wrote its tool call inside its thinking — asking for it again":"the model's turn was thinking only — asking for an answer",metadata:{kind:"thinking_only_recovery",reason:"thinking_only_recovery",phase:"started",iteration:this.state.iteration,attempt:this.thinkingOnlyRetries,maxAttempts:Xr,toolCallInThinking:ae.toolCallInThinking}}),await this.addUserReminderMessage(ae.toolCallInThinking?dp:cp);continue}let K=this.finishRun("completed",n);return await this.callAfterRunHooks(K),await this.emit({type:"run-finished",snapshot:this.snapshot(),result:K}),K}this.hasCalledAnyTool=!0,this.calledToolThisRun=!0,this.consecutiveNoToolCallNudges=0,this.thinkingOnlyRetries=0,this.consecutiveNoToolCallTurns=0,this.noToolCallStreakReasoningChars=0,this.consecutiveMaxTokensRetries=0,this.truncatedOutputCapTokens=void 0;let u=Date.now();this.trace(`tools-begin iter=${this.state.iteration} n=${a.length} ${a.map((p)=>p.toolName).join(",")}`);let c=await this.executeToolCalls(a);this.trace(`tools-end iter=${this.state.iteration} took=${Date.now()-u}ms`),this.state.pendingToolCalls=[];let d=this.findCompletingToolMessage(a,c)?[]:this.attachTurnNotes(c,n);for(let p of c)this.state.messages.push(p),await this.emit({type:"message-added",snapshot:this.snapshot(),message:p});if(o==="unknown"&&!c.some((p)=>p.content.some((v)=>v.type==="tool-result"&&!v.isError)))throw this.state.lastFinishReason=o,Error("Model ended without a recognized finish reason or successful tool work");await this.flushPendingHookContexts(),await this.emit({type:"turn-finished",snapshot:this.snapshot(),iteration:this.state.iteration,toolCallCount:a.length});let y=this.findCompletingToolMessage(a,c);if(y){let p=await this.runCompletionBoundary(to(y)||Oe(n));if(p){await this.addUserReminderMessage(p);continue}let v=this.finishRun("completed",n,to(y)||void 0);return await this.callAfterRunHooks(v),await this.emit({type:"run-finished",snapshot:this.snapshot(),result:v}),v}for(let p of d)await this.addUserReminderMessage(p)}throw new on(this.config.maxIterations)}catch(t){let n=t instanceof Error?t:Error(String(t)),i=n instanceof Tt,o=this.abortController.signal.aborted||i?"aborted":"failed",s=n instanceof Me?"context_window_exceeded":n.message===this.state.lastError?this.state.lastErrorClass:void 0,a=n.message===this.state.lastError&&this.state.lastErrorReported;this.state.status=o,this.state.lastError=n.message,this.state.lastErrorClass=s,this.state.lastErrorReported=a;let u=this.findLastAssistantMessage(),c={agentId:this.state.agentId,agentRole:this.state.agentRole,runId:this.state.runId??ye("run"),status:o,iterations:this.state.iteration,outputText:Oe(u),messages:Y(this.state.messages),usage:oe(this.state.usage),error:o==="failed"?n:void 0,abortReason:o==="aborted"?n.message:void 0,...o==="failed"&&n instanceof on?{limit:"max_iterations"}:{}};if(this.config.logger?.log?.(`Agent loop caught error (${o}): ${n.name}: ${n.message}`,{severity:o==="failed"?"error":"warn",agentId:this.state.agentId,agentRole:this.state.agentRole,runId:c.runId,status:o,iteration:this.state.iteration,errorName:n.name,errorMessage:n.message,assistantContentPartCount:u?.content.length??0}),await this.callAfterRunHooks(c),o==="failed")await this.emit({type:"run-failed",snapshot:this.snapshot(),error:n,errorClass:s});else await this.emit({type:"run-finished",snapshot:this.snapshot(),result:c});return c}finally{this.abortController=void 0}}async flushPendingHookContexts(){if(this.pendingHookContexts.length===0)return;let e=this.pendingHookContexts.join(`
|
|
100
100
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerebriline/agents",
|
|
3
|
-
"version": "4.100.
|
|
3
|
+
"version": "4.100.268",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/mann1x/cline.git",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"nanoid": "^5.1.7",
|
|
12
|
-
"@cerebriline/llms": "4.100.
|
|
13
|
-
"@cerebriline/shared": "4.100.
|
|
12
|
+
"@cerebriline/llms": "4.100.268",
|
|
13
|
+
"@cerebriline/shared": "4.100.268"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|