refactor(agent-loop): separate injected context from turns
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
import type { Context } from 'cordis'
|
||||
import z from 'schemastery'
|
||||
import type { Agent, HookContext, PromptDecision } from '@deepseek-ai/dsh-agent'
|
||||
import type { AdditionalContext, Agent, PromptDecision } from '@deepseek-ai/dsh-agent'
|
||||
import type { MessageSource } from '@deepseek-ai/dsh-llm'
|
||||
import type { PostToolDecision, ToolExecution } from '@deepseek-ai/dsh-tools'
|
||||
|
||||
@@ -142,7 +142,7 @@ function validateThresholds(values: number[]): number[] {
|
||||
* Prepend the guard's reminder while preserving every downstream context's
|
||||
* source and metadata.
|
||||
*/
|
||||
function prependContext(ours: HookContext, theirs: HookContext[] | undefined): HookContext[] {
|
||||
function prependContext(ours: AdditionalContext, theirs: AdditionalContext[] | undefined): AdditionalContext[] {
|
||||
return [ours, ...theirs ?? []]
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ export function apply(ctx: Context, config: Config): void {
|
||||
* same pipeline), and a model hammering a denied call is exactly the loop
|
||||
* worth breaking.
|
||||
*/
|
||||
function observe(exec: ToolExecution): HookContext | undefined {
|
||||
function observe(exec: ToolExecution): AdditionalContext | undefined {
|
||||
// A direct `ctx.tools.execute()` caller has no model to remind and no id
|
||||
// to key on; only agent-loop calls participate.
|
||||
if (!exec.agent) return undefined
|
||||
|
||||
Reference in New Issue
Block a user