fix(agent-loop): preserve unified send contracts
This commit is contained in:
@@ -106,7 +106,7 @@ export function apply(ctx: Context): void {
|
||||
|
||||
/** Read only when the exact Agent remains live. */
|
||||
function currentGoal(state: DriverState): GoalView | undefined {
|
||||
if (ctx.agents.get(state.agent.id) !== state.agent || state.agent.status === 'disposed') return undefined
|
||||
if (ctx.agents.get(state.agent.id) !== state.agent) return undefined
|
||||
return ctx.goals.get(state.agent)
|
||||
}
|
||||
|
||||
@@ -297,10 +297,6 @@ export function apply(ctx: Context): void {
|
||||
})
|
||||
ctx.on('agent/status', (agent, status) => {
|
||||
const state = stateFor(agent)
|
||||
if (status === 'disposed') {
|
||||
state.stopping = true
|
||||
return
|
||||
}
|
||||
if (status === 'idle') {
|
||||
state.competingQueued = false
|
||||
requestDrive(state)
|
||||
|
||||
@@ -346,7 +346,7 @@ export class GoalService extends Service {
|
||||
|
||||
/** Enforce exact live-agent identity rather than trusting a matching id. */
|
||||
private assertLive(agent: Agent): void {
|
||||
if (this.ctx.agents.get(agent.id) !== agent || agent.status === 'disposed') {
|
||||
if (this.ctx.agents.get(agent.id) !== agent) {
|
||||
throw new GoalError(`agent "${agent.id}" is not live in this registry`, 'GOAL_AGENT_NOT_LIVE')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user