fix(api): preserve dynamic defaults after rebase
This commit is contained in:
@@ -20,8 +20,8 @@ export type ApiRemoteAgentResult =
|
|||||||
|
|
||||||
/** Resume configuration supplied by the owning Host composition. */
|
/** Resume configuration supplied by the owning Host composition. */
|
||||||
export interface ApiRemoteAgentOptions {
|
export interface ApiRemoteAgentOptions {
|
||||||
/** Per-Agent defaults used when a cold identity must resume. */
|
/** Read the per-Agent defaults when a cold identity must resume. */
|
||||||
readonly agentOptions?: AgentOptions
|
readonly agentOptions?: () => AgentOptions
|
||||||
/** Host-specific Agent-scope composition completed before publication. */
|
/** Host-specific Agent-scope composition completed before publication. */
|
||||||
readonly setup?: AgentSetup
|
readonly setup?: AgentSetup
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ export function createApiRemoteAgentResolver(
|
|||||||
}
|
}
|
||||||
const handle = await ctx.agents.resume({
|
const handle = await ctx.agents.resume({
|
||||||
resumeSessionId: sessionId,
|
resumeSessionId: sessionId,
|
||||||
...options.agentOptions === undefined ? {} : { agentOptions: options.agentOptions },
|
...options.agentOptions === undefined ? {} : { agentOptions: options.agentOptions() },
|
||||||
...options.setup === undefined ? {} : { setup: options.setup },
|
...options.setup === undefined ? {} : { setup: options.setup },
|
||||||
})
|
})
|
||||||
return handle.agent
|
return handle.agent
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ describe('Remote Agent and Session lookup policy', () => {
|
|||||||
})
|
})
|
||||||
const defaultAgentLookup = ctx.typert.lookups.get('agent')
|
const defaultAgentLookup = ctx.typert.lookups.get('agent')
|
||||||
const defaultSessionLookup = ctx.typert.lookups.get('session')
|
const defaultSessionLookup = ctx.typert.lookups.get('session')
|
||||||
createApiProxy(ctx, { provider: 'p', model: 'm', cwd: '/tmp', workspaceRoot: '/tmp' })
|
createApiProxy(ctx, { defaultTarget: () => ({ provider: 'p', model: 'm' }), cwd: '/tmp', workspaceRoot: '/tmp' })
|
||||||
await vi.waitFor(() => {
|
await vi.waitFor(() => {
|
||||||
expect(ctx.typert.lookups.get('agent')).not.toBe(defaultAgentLookup)
|
expect(ctx.typert.lookups.get('agent')).not.toBe(defaultAgentLookup)
|
||||||
expect(ctx.typert.lookups.get('session')).not.toBe(defaultSessionLookup)
|
expect(ctx.typert.lookups.get('session')).not.toBe(defaultSessionLookup)
|
||||||
@@ -250,7 +250,7 @@ describe('Remote Agent and Session lookup policy', () => {
|
|||||||
const resume = vi.spyOn(ctx.agents, 'resume')
|
const resume = vi.spyOn(ctx.agents, 'resume')
|
||||||
const defaultAgentLookup = ctx.typert.lookups.get('agent')
|
const defaultAgentLookup = ctx.typert.lookups.get('agent')
|
||||||
const defaultSessionLookup = ctx.typert.lookups.get('session')
|
const defaultSessionLookup = ctx.typert.lookups.get('session')
|
||||||
createApiProxy(ctx, { provider: 'p', model: 'm', cwd: '/tmp', workspaceRoot: '/tmp' })
|
createApiProxy(ctx, { defaultTarget: () => ({ provider: 'p', model: 'm' }), cwd: '/tmp', workspaceRoot: '/tmp' })
|
||||||
await vi.waitFor(() => {
|
await vi.waitFor(() => {
|
||||||
expect(ctx.typert.lookups.get('agent')).not.toBe(defaultAgentLookup)
|
expect(ctx.typert.lookups.get('agent')).not.toBe(defaultAgentLookup)
|
||||||
expect(ctx.typert.lookups.get('session')).not.toBe(defaultSessionLookup)
|
expect(ctx.typert.lookups.get('session')).not.toBe(defaultSessionLookup)
|
||||||
|
|||||||
Reference in New Issue
Block a user