@teodorruskvi/chat-core 0.1.26 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ export interface ToolCall {
28
28
  artifact?: any;
29
29
  status?: "running" | "completed" | "failed";
30
30
  content?: string;
31
+ scope?: string;
31
32
  }
32
33
  export interface InterruptAlternative {
33
34
  id: string;
@@ -1,6 +1,7 @@
1
1
  import type { ChatMessage, PendingInterrupt, StreamEvent } from "@/types";
2
2
  export interface MessagesState {
3
3
  messages: ChatMessage[];
4
+ taskMessagesByScope: Record<string, ChatMessage[]>;
4
5
  assemblingId: string | null;
5
6
  lastCheckpointId: string | null;
6
7
  lastCheckpointNs: string | null;
@@ -58,6 +58,10 @@ export type ActiveRunContext = {
58
58
  isStreaming: boolean;
59
59
  headers?: Record<string, string>;
60
60
  };
61
+ export type StreamEventMeta = {
62
+ origin?: "agent" | "task";
63
+ scope?: string;
64
+ };
61
65
  export type StreamFinishInfo = {
62
66
  lastSeq: number;
63
67
  lastCheckpointId: string | null;
@@ -107,6 +111,13 @@ export type ArtifactUpdateEvent = {
107
111
  error?: string;
108
112
  };
109
113
  export type ToolStreamEvent = ToolStartEvent | ToolEndEvent | ArtifactUpdateEvent;
114
+ export type TaskStartEvent = {
115
+ type: "task.start";
116
+ id?: string;
117
+ description?: string;
118
+ subagentType?: string;
119
+ seq?: number;
120
+ } & StreamEventMeta;
110
121
  export type MessageStreamEvent = ToolProgressEvent | {
111
122
  type: "messages/partial";
112
123
  messages: Array<{
@@ -177,6 +188,11 @@ export type SystemStreamEvent = {
177
188
  } | {
178
189
  type: "token";
179
190
  token: string;
191
+ } | {
192
+ type: "status";
193
+ status: "completed" | "interrupted" | "error";
194
+ message?: string;
195
+ seq?: number;
180
196
  };
181
197
  export type HeartbeatEvent = Extract<SystemStreamEvent, {
182
198
  type: "heartbeat";
@@ -184,7 +200,7 @@ export type HeartbeatEvent = Extract<SystemStreamEvent, {
184
200
  export type ValuesEvent = Extract<SystemStreamEvent, {
185
201
  type: "values";
186
202
  }>;
187
- export type StreamEvent = MessageStreamEvent | ToolStreamEvent | ThreadStreamEvent | SystemStreamEvent;
203
+ export type StreamEvent = (MessageStreamEvent | ToolStreamEvent | ThreadStreamEvent | SystemStreamEvent | TaskStartEvent) & StreamEventMeta;
188
204
  export interface StreamEventHandlers {
189
205
  onConnectionError?: (error: string) => void;
190
206
  onError?: (error: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teodorruskvi/chat-core",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Core chat protocols, hooks, and utilities (UI-agnostic)",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",