@ekairos/events 1.22.67-beta.development.0 → 1.22.69-beta.development.0
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.
- package/dist/react.context-event-parts.d.ts +18 -0
- package/dist/react.context-event-parts.js +509 -0
- package/dist/react.d.ts +7 -42
- package/dist/react.js +4 -87
- package/dist/react.step-stream.d.ts +39 -0
- package/dist/react.step-stream.js +581 -0
- package/dist/react.types.d.ts +121 -0
- package/dist/react.types.js +2 -0
- package/dist/react.use-context.d.ts +7 -0
- package/dist/react.use-context.js +867 -0
- package/package.json +3 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export type ContextStatus = "open_idle" | "open_streaming" | "closed";
|
|
2
|
+
export type SendStatus = "idle" | "submitting" | "error";
|
|
3
|
+
export type ReasoningLevel = "off" | "low" | "medium" | "high";
|
|
4
|
+
export declare const INPUT_TEXT_ITEM_TYPE = "user.message";
|
|
5
|
+
export declare const ASSISTANT_MESSAGE_TYPE = "assistant.message";
|
|
6
|
+
export type ContextEventForUI = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
channel: string;
|
|
10
|
+
createdAt: string | Date;
|
|
11
|
+
content: {
|
|
12
|
+
parts: any[];
|
|
13
|
+
};
|
|
14
|
+
status?: string;
|
|
15
|
+
emails?: unknown[];
|
|
16
|
+
whatsappMessages?: unknown[];
|
|
17
|
+
executionId?: string | null;
|
|
18
|
+
steps?: ContextStepForUI[];
|
|
19
|
+
};
|
|
20
|
+
export type ContextStepForUI = {
|
|
21
|
+
stepId: string;
|
|
22
|
+
executionId: string | null;
|
|
23
|
+
createdAt: string | null;
|
|
24
|
+
updatedAt: string | null;
|
|
25
|
+
status: string;
|
|
26
|
+
iteration: number | null;
|
|
27
|
+
parts: Array<Record<string, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
export type ContextStepRuntime = ContextStepForUI & {
|
|
30
|
+
streamId: string | null;
|
|
31
|
+
streamClientId: string | null;
|
|
32
|
+
streamStartedAt: string | null;
|
|
33
|
+
streamFinishedAt: string | null;
|
|
34
|
+
streamAbortReason: string | null;
|
|
35
|
+
stream: ContextStepStreamInfo | null;
|
|
36
|
+
streamReader: ContextStepStreamReaderInfo | null;
|
|
37
|
+
};
|
|
38
|
+
export type ContextStepStreamInfo = {
|
|
39
|
+
id: string | null;
|
|
40
|
+
clientId: string | null;
|
|
41
|
+
done: boolean | null;
|
|
42
|
+
size: number | null;
|
|
43
|
+
machineId: string | null;
|
|
44
|
+
createdAt: string | null;
|
|
45
|
+
updatedAt: string | null;
|
|
46
|
+
raw: Record<string, unknown> | null;
|
|
47
|
+
};
|
|
48
|
+
export type ContextStepStreamReaderInfo = {
|
|
49
|
+
status: string;
|
|
50
|
+
streamKey: string | null;
|
|
51
|
+
startedAt: string | null;
|
|
52
|
+
updatedAt: string | null;
|
|
53
|
+
completedAt: string | null;
|
|
54
|
+
attempts: number;
|
|
55
|
+
chunkCount: number;
|
|
56
|
+
byteOffset: number;
|
|
57
|
+
streamByteOffset: number;
|
|
58
|
+
lastChunkType: string | null;
|
|
59
|
+
lastSequence: number | null;
|
|
60
|
+
lastError: string | null;
|
|
61
|
+
reason: string | null;
|
|
62
|
+
rawChunkSampleOffset: number;
|
|
63
|
+
rawChunkSample: Array<Record<string, unknown>>;
|
|
64
|
+
rawLineSample: string[];
|
|
65
|
+
};
|
|
66
|
+
export type AppendArgs = {
|
|
67
|
+
parts: any[];
|
|
68
|
+
webSearch?: boolean;
|
|
69
|
+
reasoningLevel?: ReasoningLevel;
|
|
70
|
+
};
|
|
71
|
+
export type ContextFirstLevel = {
|
|
72
|
+
id: string;
|
|
73
|
+
key?: string | null;
|
|
74
|
+
name?: string | null;
|
|
75
|
+
status: ContextStatus;
|
|
76
|
+
content?: unknown;
|
|
77
|
+
currentExecution?: {
|
|
78
|
+
id: string;
|
|
79
|
+
status?: string | null;
|
|
80
|
+
} | null;
|
|
81
|
+
};
|
|
82
|
+
export type ContextValue = {
|
|
83
|
+
apiUrl: string;
|
|
84
|
+
context: ContextFirstLevel | null;
|
|
85
|
+
contextId: string | null;
|
|
86
|
+
contextStatus: ContextStatus;
|
|
87
|
+
activeExecutionId: string | null;
|
|
88
|
+
turnSubstateKey: string | null;
|
|
89
|
+
events: ContextEventForUI[];
|
|
90
|
+
sendStatus: SendStatus;
|
|
91
|
+
sendError: string | null;
|
|
92
|
+
stop: () => void;
|
|
93
|
+
append: (args: AppendArgs) => Promise<void>;
|
|
94
|
+
};
|
|
95
|
+
export type UseContextArgs = {
|
|
96
|
+
contextId: string | null;
|
|
97
|
+
contextKey?: string;
|
|
98
|
+
};
|
|
99
|
+
export type UseContextState = {
|
|
100
|
+
context: any | null;
|
|
101
|
+
contextStatus: ContextStatus;
|
|
102
|
+
events: ContextEventForUI[];
|
|
103
|
+
};
|
|
104
|
+
export type UseContextStateHook = (db: any, args: UseContextArgs) => UseContextState;
|
|
105
|
+
export type UseContextOptions = {
|
|
106
|
+
apiUrl: string;
|
|
107
|
+
initialContextId?: string;
|
|
108
|
+
contextKey?: string;
|
|
109
|
+
onContextUpdate?: (contextId: string) => void;
|
|
110
|
+
prepareAppendArgs?: (args: AppendArgs) => Promise<AppendArgs> | AppendArgs;
|
|
111
|
+
prepareRequestBody?: (params: {
|
|
112
|
+
messages: any[];
|
|
113
|
+
webSearch?: boolean;
|
|
114
|
+
reasoningLevel?: ReasoningLevel;
|
|
115
|
+
contextId?: string;
|
|
116
|
+
}) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
117
|
+
enableResumableStreams?: boolean;
|
|
118
|
+
streamChunkDelayMs?: number;
|
|
119
|
+
onDataChunk?: (chunk: unknown) => void;
|
|
120
|
+
state?: UseContextStateHook;
|
|
121
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContextValue, UseContextOptions } from "./react.types";
|
|
2
|
+
export declare function mergeContextStepPartsForUI(params: {
|
|
3
|
+
persistedParts: Array<Record<string, unknown>>;
|
|
4
|
+
liveParts: Array<Record<string, unknown>>;
|
|
5
|
+
stepStatus?: string | null;
|
|
6
|
+
}): Record<string, unknown>[];
|
|
7
|
+
export declare function useContext(db: any, opts: UseContextOptions): ContextValue;
|