Skip to content

Commit 01b8d38

Browse files
committed
wip
1 parent 3b29801 commit 01b8d38

33 files changed

+578
-289
lines changed

src/AGUI/Enums/EventType.php

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,84 @@
66

77
enum EventType: string
88
{
9+
/** Signals the start of an agent run. */
10+
case RunStarted = 'RUN_STARTED';
11+
12+
/** Signals the successful completion of an agent run. */
13+
case RunFinished = 'RUN_FINISHED';
14+
15+
/** Signals an error during an agent run. */
16+
case RunError = 'RUN_ERROR';
17+
18+
/** Signals the start of a step within an agent run. */
19+
case StepStarted = 'STEP_STARTED';
20+
21+
/** Signals the completion of a step within an agent run. */
22+
case StepFinished = 'STEP_FINISHED';
23+
24+
/** Signals the start of a text message. */
925
case TextMessageStart = 'TEXT_MESSAGE_START';
26+
27+
/** Represents a chunk of content in a streaming text message. */
1028
case TextMessageContent = 'TEXT_MESSAGE_CONTENT';
29+
30+
/** Signals the end of a text message. */
1131
case TextMessageEnd = 'TEXT_MESSAGE_END';
32+
33+
/** Convenience event that expands to Start → Content → End automatically. */
1234
case TextMessageChunk = 'TEXT_MESSAGE_CHUNK';
13-
case ThinkingTextMessageStart = 'THINKING_TEXT_MESSAGE_START';
14-
case ThinkingTextMessageContent = 'THINKING_TEXT_MESSAGE_CONTENT';
15-
case ThinkingTextMessageEnd = 'THINKING_TEXT_MESSAGE_END';
35+
36+
/** Signals the start of a tool call. */
1637
case ToolCallStart = 'TOOL_CALL_START';
38+
39+
/** Represents a chunk of argument data for a tool call. */
1740
case ToolCallArgs = 'TOOL_CALL_ARGS';
41+
42+
/** Signals the end of a tool call. */
1843
case ToolCallEnd = 'TOOL_CALL_END';
44+
45+
/** Convenience event that expands to Start → Args → End automatically. */
1946
case ToolCallChunk = 'TOOL_CALL_CHUNK';
47+
48+
/** Provides the result of a tool call execution. */
2049
case ToolCallResult = 'TOOL_CALL_RESULT';
21-
case ThinkingStart = 'THINKING_START';
22-
case ThinkingEnd = 'THINKING_END';
50+
51+
/** Marks the start of reasoning. */
52+
case ReasoningStart = 'REASONING_START';
53+
54+
/** Marks the end of reasoning. */
55+
case ReasoningEnd = 'REASONING_END';
56+
57+
/** Signals the start of a reasoning message. */
58+
case ReasoningMessageStart = 'REASONING_MESSAGE_START';
59+
60+
/** Represents a chunk of content in a streaming reasoning message. */
61+
case ReasoningMessageContent = 'REASONING_MESSAGE_CONTENT';
62+
63+
/** Signals the end of a reasoning message. */
64+
case ReasoningMessageEnd = 'REASONING_MESSAGE_END';
65+
66+
/** A convenience event to auto start/close reasoning messages. */
67+
case ReasoningMessageChunk = 'REASONING_MESSAGE_CHUNK';
68+
69+
/** Provides a complete snapshot of an agent’s state. */
2370
case StateSnapshot = 'STATE_SNAPSHOT';
71+
72+
/** Provides a partial update to an agent’s state using JSON Patch. */
2473
case StateDelta = 'STATE_DELTA';
74+
75+
/** Provides a snapshot of all messages in a conversation. */
2576
case MessagesSnapshot = 'MESSAGES_SNAPSHOT';
77+
78+
/** Delivers a complete snapshot of an activity message. */
2679
case ActivitySnapshot = 'ACTIVITY_SNAPSHOT';
80+
81+
/** Applies incremental updates to an existing activity using JSON Patch operations. */
2782
case ActivityDelta = 'ACTIVITY_DELTA';
83+
84+
/** Used to pass through events from external systems. */
2885
case Raw = 'RAW';
86+
87+
/** Used for application-specific custom events. */
2988
case Custom = 'CUSTOM';
30-
case RunStarted = 'RUN_STARTED';
31-
case RunFinished = 'RUN_FINISHED';
32-
case RunError = 'RUN_ERROR';
33-
case StepStarted = 'STEP_STARTED';
34-
case StepFinished = 'STEP_FINISHED';
3589
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
use DateTimeImmutable;
88
use Cortex\AGUI\Enums\EventType;
99

10-
final class ThinkingEnd extends AbstractEvent
10+
final class ReasoningEnd extends AbstractEvent
1111
{
1212
public function __construct(
1313
?DateTimeImmutable $timestamp = null,
1414
mixed $rawEvent = null,
15+
public string $messageId = '',
1516
) {
1617
parent::__construct($timestamp, $rawEvent);
17-
$this->type = EventType::ThinkingEnd;
18+
$this->type = EventType::ReasoningEnd;
1819
}
1920
}

src/AGUI/Events/ThinkingTextMessageContent.php renamed to src/AGUI/Events/ReasoningMessageContent.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
use DateTimeImmutable;
88
use Cortex\AGUI\Enums\EventType;
99

10-
final class ThinkingTextMessageContent extends AbstractEvent
10+
final class ReasoningMessageContent extends AbstractEvent
1111
{
1212
public function __construct(
1313
?DateTimeImmutable $timestamp = null,
1414
mixed $rawEvent = null,
15+
public string $messageId = '',
1516
public string $delta = '',
1617
) {
1718
parent::__construct($timestamp, $rawEvent);
18-
$this->type = EventType::ThinkingTextMessageContent;
19+
$this->type = EventType::ReasoningMessageContent;
1920
}
2021
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
use DateTimeImmutable;
88
use Cortex\AGUI\Enums\EventType;
99

10-
final class ThinkingStart extends AbstractEvent
10+
final class ReasoningMessageEnd extends AbstractEvent
1111
{
1212
public function __construct(
1313
?DateTimeImmutable $timestamp = null,
1414
mixed $rawEvent = null,
15-
public ?string $title = null,
15+
public string $messageId = '',
1616
) {
1717
parent::__construct($timestamp, $rawEvent);
18-
$this->type = EventType::ThinkingStart;
18+
$this->type = EventType::ReasoningMessageEnd;
1919
}
2020
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Cortex\AGUI\Events;
6+
7+
use DateTimeImmutable;
8+
use Cortex\AGUI\Enums\EventType;
9+
10+
final class ReasoningMessageStart extends AbstractEvent
11+
{
12+
public function __construct(
13+
?DateTimeImmutable $timestamp = null,
14+
mixed $rawEvent = null,
15+
public string $messageId = '',
16+
public string $role = 'assistant',
17+
) {
18+
parent::__construct($timestamp, $rawEvent);
19+
$this->type = EventType::ReasoningMessageStart;
20+
}
21+
}

src/AGUI/Events/ThinkingTextMessageEnd.php renamed to src/AGUI/Events/ReasoningStart.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
use DateTimeImmutable;
88
use Cortex\AGUI\Enums\EventType;
99

10-
final class ThinkingTextMessageEnd extends AbstractEvent
10+
final class ReasoningStart extends AbstractEvent
1111
{
1212
public function __construct(
1313
?DateTimeImmutable $timestamp = null,
1414
mixed $rawEvent = null,
15+
public string $messageId = '',
16+
public ?string $encryptedContent = null,
1517
) {
1618
parent::__construct($timestamp, $rawEvent);
17-
$this->type = EventType::ThinkingTextMessageEnd;
19+
$this->type = EventType::ReasoningStart;
1820
}
1921
}

src/AGUI/Events/ThinkingTextMessageStart.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)