docs(agent): align event JSDoc with shipped behavior
- agent/error: drop the stale "(plus the logger)" claim; the machine only emits the event. - agent/inbox/claimed: document that a rejected turn boundary ends the claimed message without discard or re-emission, and that a later batch may reuse the turn number. - steer(): document that a rejected step leaves steering parked until the next wake. - Fix stray double-space in the inbox inserted/discarded callbacks. - Sync core.md/core.zh.md mirrors and regenerate the cordis catalog.
This commit is contained in:
@@ -80,8 +80,8 @@ export class ReactLoopAgent implements Agent {
|
||||
public readonly session: Session,
|
||||
) {
|
||||
this.inbox = new Inbox(session, {
|
||||
inserted: (message) =>{ emitAgentEvent(loopCtx, this, 'agent/inbox/inserted', { message }) },
|
||||
discarded: (message) =>{ emitAgentEvent(loopCtx, this, 'agent/inbox/discarded', { message }) },
|
||||
inserted: (message) => { emitAgentEvent(loopCtx, this, 'agent/inbox/inserted', { message }) },
|
||||
discarded: (message) => { emitAgentEvent(loopCtx, this, 'agent/inbox/discarded', { message }) },
|
||||
})
|
||||
const lastTurn = session.events.findLast(event => event.type === 'turn/start')?.data.turn ?? 0
|
||||
this.phase = { kind: 'idle', lastTurn }
|
||||
|
||||
@@ -145,7 +145,8 @@ export interface Agent {
|
||||
/**
|
||||
* Submit steering for the nearest step. An idle driver schedules a turn;
|
||||
* collecting and running drivers consume it at their next step boundary.
|
||||
* Cancellation or disposal may discard pending steering.
|
||||
* A rejected step leaves steering parked in the inbox until the next
|
||||
* wake; cancellation or disposal may discard pending steering.
|
||||
* @param message - identified steering content and its producer provenance.
|
||||
*/
|
||||
steer(message: UserMessage): void
|
||||
@@ -203,7 +204,10 @@ declare module 'cordis' {
|
||||
*/
|
||||
'agent/inbox/inserted'(this: Scoped<Agent>, agent: Agent, event: { message: UserMessage }): void
|
||||
/**
|
||||
* One message left the inbox for a turn.
|
||||
* One message left the inbox for a turn. If the turn boundary that
|
||||
* claimed it is rejected, the claimed message ends here: it is neither
|
||||
* discarded nor re-emitted as a user/message, and a later batch may
|
||||
* reuse the same turn number.
|
||||
* @param agent - the agent whose inbox changed.
|
||||
* @param event - the claimed message and owning turn.
|
||||
* Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
|
||||
@@ -284,8 +288,8 @@ declare module 'cordis' {
|
||||
'agent/turn-stopping'(this: Scoped<Agent>, agent: Agent, turn: number, signal: AbortSignal): Promise<void> | void
|
||||
// ---- error notifications (emit) ----
|
||||
/**
|
||||
* A step or turn errored. The machine reports a failure here (plus the
|
||||
* logger) even when the error has no in-turn position for a durable record.
|
||||
* A step or turn errored. The machine reports a failure here even when
|
||||
* the error has no in-turn position for a durable record.
|
||||
* @param agent - the agent whose turn errored.
|
||||
* @param turn - the turn in which the failure surfaced.
|
||||
* @param step - the step at which the failure surfaced.
|
||||
|
||||
Reference in New Issue
Block a user