Merge remote-tracking branch 'origin/master' into xtr/identified-immutable-messages
# Conflicts: # docs/cordis-catalog/events.md # docs/core-data-structures/core.i18n.yaml # docs/event-producer-consumer.md # examples/acp-agent/tests/snapshots/cordis-inspect-jsdoc/session.jsonl # packages/core/agent-loop/README.i18n.yaml # packages/core/agent/README.i18n.yaml
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Context } from 'cordis'
|
||||
import { type Agent } from '@deepseek-ai/dsh-agent'
|
||||
import { type Agent, type AgentOptions } from '@deepseek-ai/dsh-agent'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import AgentLoop from '@deepseek-ai/dsh-agent-loop'
|
||||
import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit'
|
||||
@@ -22,7 +22,7 @@ async function mountInvariants(ctx: Context): Promise<void> {
|
||||
await ctx.plugin(AgentLoopInvariant)
|
||||
}
|
||||
|
||||
async function setup(script: Script) {
|
||||
async function setup(script: Script, parentOptions: Partial<AgentOptions> = {}) {
|
||||
const ctx = new Context()
|
||||
await mountAgentLoopTestDependencies(ctx)
|
||||
await mountInvariants(ctx)
|
||||
@@ -30,7 +30,7 @@ async function setup(script: Script) {
|
||||
await ctx.plugin(SubagentService)
|
||||
const adapter = new MockAdapter(script)
|
||||
ctx.llm.registerAdapter(['mock'], adapter)
|
||||
const parent = ctx.agentLoop.create(SessionId('parent'), { provider: 'mock', model: 'mock' })
|
||||
const parent = ctx.agentLoop.create(SessionId('parent'), { provider: 'mock', model: 'mock', ...parentOptions })
|
||||
return { ctx, parent, adapter }
|
||||
}
|
||||
|
||||
@@ -111,6 +111,27 @@ describe('startInProcessRun', () => {
|
||||
await run.dispose()
|
||||
})
|
||||
|
||||
it('inherits the parent output-token cap and accepts an explicit child override', async () => {
|
||||
const { ctx, parent, adapter } = await setup(
|
||||
[textResponse('inherited'), textResponse('overridden')],
|
||||
{ maxTokens: 111 },
|
||||
)
|
||||
const inherited = await startInProcessRun(request(parent), {})
|
||||
await inherited.result
|
||||
expect(adapter.requests[0]?.maxTokens).toBe(111)
|
||||
expect(ctx.agents.get(inherited.id)?.options.maxTokens).toBe(111)
|
||||
await inherited.dispose()
|
||||
|
||||
const overridden = await startInProcessRun({
|
||||
...request(parent),
|
||||
agentOptions: { maxTokens: 222 },
|
||||
}, {})
|
||||
await overridden.result
|
||||
expect(adapter.requests[1]?.maxTokens).toBe(222)
|
||||
expect(ctx.agents.get(overridden.id)?.options.maxTokens).toBe(222)
|
||||
await overridden.dispose()
|
||||
})
|
||||
|
||||
it('counts a RESUMED child by its persisted header depth, not the absent runtime depth', async () => {
|
||||
// Resume rebuilds runtime options, so the durable header must keep this
|
||||
// depth-1 child from delegating as though it were top-level.
|
||||
|
||||
Reference in New Issue
Block a user