mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 13:04:08 +00:00
Support multiple messages in agent.prompt() and agentLoop
- agentLoop now accepts AgentMessage[] instead of single message - agent.prompt() accepts AgentMessage | AgentMessage[] - Emits message_start/end for each message in the array - AgentSession.prompt() builds array with hook message + user message - TUI now receives events for before_agent_start injected messages
This commit is contained in:
parent
575c875475
commit
41af99cccf
4 changed files with 48 additions and 36 deletions
|
|
@ -105,7 +105,7 @@ describe("agentLoop with AgentMessage", () => {
|
|||
};
|
||||
|
||||
const events: AgentEvent[] = [];
|
||||
const stream = agentLoop(userPrompt, context, config, undefined, streamFn);
|
||||
const stream = agentLoop([userPrompt], context, config, undefined, streamFn);
|
||||
|
||||
for await (const event of stream) {
|
||||
events.push(event);
|
||||
|
|
@ -172,7 +172,7 @@ describe("agentLoop with AgentMessage", () => {
|
|||
};
|
||||
|
||||
const events: AgentEvent[] = [];
|
||||
const stream = agentLoop(userPrompt, context, config, undefined, streamFn);
|
||||
const stream = agentLoop([userPrompt], context, config, undefined, streamFn);
|
||||
|
||||
for await (const event of stream) {
|
||||
events.push(event);
|
||||
|
|
@ -224,7 +224,7 @@ describe("agentLoop with AgentMessage", () => {
|
|||
return stream;
|
||||
};
|
||||
|
||||
const stream = agentLoop(userPrompt, context, config, undefined, streamFn);
|
||||
const stream = agentLoop([userPrompt], context, config, undefined, streamFn);
|
||||
|
||||
for await (const _ of stream) {
|
||||
// consume
|
||||
|
|
@ -288,7 +288,7 @@ describe("agentLoop with AgentMessage", () => {
|
|||
};
|
||||
|
||||
const events: AgentEvent[] = [];
|
||||
const stream = agentLoop(userPrompt, context, config, undefined, streamFn);
|
||||
const stream = agentLoop([userPrompt], context, config, undefined, streamFn);
|
||||
|
||||
for await (const event of stream) {
|
||||
events.push(event);
|
||||
|
|
@ -351,7 +351,7 @@ describe("agentLoop with AgentMessage", () => {
|
|||
};
|
||||
|
||||
const events: AgentEvent[] = [];
|
||||
const stream = agentLoop(userPrompt, context, config, undefined, (_model, ctx, _options) => {
|
||||
const stream = agentLoop([userPrompt], context, config, undefined, (_model, ctx, _options) => {
|
||||
// Check if interrupt message is in context on second call
|
||||
if (callIndex === 1) {
|
||||
sawInterruptInContext = ctx.messages.some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue