mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* fix(orchestration): label follow-up worker cards, gate remote-owned start cards on ready A send that continues a finished or closed worker starts a follow-up Dispatch, and the coordinator's chat showed it as "Started worker". The agent-start item now carries the Dispatch it followed and whether the conversation reopened, and the card reads "Reopened worker" or "Sent follow-up to worker". worker-start --on a server that owns its workers wrote the card for any parsed answer, with no agent kind. It now passes the started agent and writes the card only once the server readied the worker, as local and attached starts do. * test(native-chat): assert follow-up heading kind, not its copy
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import type { AgentJournalRenderItem } from './agent-session/journal/agent-session-journal-types'
|
|
import { agentJournalItemRowOrigin } from './agent-session/journal/agent-session-journal-position'
|
|
import { agentJournalLinkageFields } from './agent-session/journal/agent-session-journal-producer'
|
|
import { readAgentMessageSource } from './agent-session/agent-session-message-source'
|
|
import type { NativeChatMessage } from './native-chat/native-chat-types'
|
|
import { projectStructuredItemToNativeChat } from './agent-session/view/structured-agent-session-projection'
|
|
|
|
/** Display-only creation facts are opt-in; canonical transcript readers keep their existing meaning. */
|
|
export function projectStructuredAgentStartItem(
|
|
item: AgentJournalRenderItem
|
|
): NativeChatMessage | null {
|
|
const { body } = item
|
|
if (body.kind !== 'agent-start' && body.kind !== 'agent-handoff') {
|
|
return projectStructuredItemToNativeChat(item)
|
|
}
|
|
if (item.shortened) {
|
|
return null
|
|
}
|
|
return {
|
|
...agentJournalItemRowOrigin(item),
|
|
...agentJournalLinkageFields(item),
|
|
role: 'system',
|
|
blocks: [{ type: 'text', text: body.task }],
|
|
agentStart: true,
|
|
...(body.kind === 'agent-start' ? { agentStartDispatchId: body.dispatchId } : {}),
|
|
...(body.kind === 'agent-start' && body.followUp
|
|
? { agentFollowUp: body.followUp.reopened ? ('reopened' as const) : ('fresh' as const) }
|
|
: {}),
|
|
...(body.kind === 'agent-handoff' ? { agentHandoff: true as const } : {}),
|
|
from: readAgentMessageSource({
|
|
kind: 'agent',
|
|
senders: [body.kind === 'agent-handoff' ? body.agent : body.worker],
|
|
orchestration: null
|
|
})
|
|
}
|
|
}
|