@eggjs/tegg-types 3.77.2 → 3.78.1
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.
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
export declare const ContentBlockType: {
|
|
2
|
-
readonly Text: "text";
|
|
3
|
-
readonly ToolUse: "tool_use";
|
|
4
|
-
readonly ToolResult: "tool_result";
|
|
5
|
-
};
|
|
6
|
-
export type ContentBlockType = (typeof ContentBlockType)[keyof typeof ContentBlockType];
|
|
7
1
|
export interface TextInputContentPart {
|
|
8
|
-
type:
|
|
2
|
+
type: 'text';
|
|
9
3
|
text: string;
|
|
10
4
|
}
|
|
11
5
|
export interface ToolUseInputContentPart {
|
|
12
|
-
type:
|
|
6
|
+
type: 'tool_use';
|
|
13
7
|
id: string;
|
|
14
8
|
name: string;
|
|
15
9
|
input: Record<string, unknown>;
|
|
16
10
|
}
|
|
17
11
|
export interface ToolResultInputContentPart {
|
|
18
|
-
type:
|
|
12
|
+
type: 'tool_result';
|
|
19
13
|
tool_use_id: string;
|
|
20
14
|
content?: string | {
|
|
21
15
|
type: string;
|
|
@@ -29,46 +23,47 @@ export interface GenericInputContentPart {
|
|
|
29
23
|
[key: string]: unknown;
|
|
30
24
|
}
|
|
31
25
|
export type InputContentPart = TextInputContentPart | ToolUseInputContentPart | ToolResultInputContentPart | GenericInputContentPart;
|
|
32
|
-
export interface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
annotations: unknown[];
|
|
37
|
-
};
|
|
26
|
+
export interface InputMessage {
|
|
27
|
+
role: string;
|
|
28
|
+
content: string | InputContentPart[];
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
38
30
|
}
|
|
39
|
-
export interface
|
|
40
|
-
type:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
export interface SDKSystemMessage {
|
|
32
|
+
type: 'system';
|
|
33
|
+
subtype: string;
|
|
34
|
+
session_id?: string;
|
|
35
|
+
[key: string]: unknown;
|
|
44
36
|
}
|
|
45
|
-
export interface
|
|
46
|
-
type:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
text?: string;
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
}[];
|
|
53
|
-
is_error?: boolean;
|
|
37
|
+
export interface SDKStreamEvent {
|
|
38
|
+
type: 'stream_event';
|
|
39
|
+
event: unknown;
|
|
40
|
+
session_id?: string;
|
|
41
|
+
[key: string]: unknown;
|
|
54
42
|
}
|
|
55
|
-
export interface
|
|
56
|
-
type:
|
|
43
|
+
export interface SDKUserMessage {
|
|
44
|
+
type: 'user';
|
|
45
|
+
message: unknown;
|
|
57
46
|
[key: string]: unknown;
|
|
58
47
|
}
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
metadata?: Record<string, unknown>;
|
|
48
|
+
export interface SDKAssistantMessage {
|
|
49
|
+
type: 'assistant';
|
|
50
|
+
message: unknown;
|
|
51
|
+
[key: string]: unknown;
|
|
64
52
|
}
|
|
65
|
-
export interface
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
53
|
+
export interface SDKResultMessage {
|
|
54
|
+
type: 'result';
|
|
55
|
+
subtype: string;
|
|
56
|
+
usage?: {
|
|
57
|
+
input_tokens?: number;
|
|
58
|
+
output_tokens?: number;
|
|
59
|
+
cache_creation_input_tokens?: number;
|
|
60
|
+
cache_read_input_tokens?: number;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
export interface SDKGenericMessage {
|
|
66
|
+
type: string;
|
|
67
|
+
[key: string]: unknown;
|
|
74
68
|
}
|
|
69
|
+
export type AgentMessage = SDKSystemMessage | SDKStreamEvent | SDKUserMessage | SDKAssistantMessage | SDKResultMessage | SDKGenericMessage;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// =====
|
|
2
|
+
// ===== Input content types (for CreateRunInput) =====
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
exports.ContentBlockType = {
|
|
6
|
-
Text: 'text',
|
|
7
|
-
ToolUse: 'tool_use',
|
|
8
|
-
ToolResult: 'tool_result',
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdlbnRNZXNzYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiQWdlbnRNZXNzYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxrQ0FBa0M7OztBQUVyQixRQUFBLGdCQUFnQixHQUFHO0lBQzlCLElBQUksRUFBRSxNQUFNO0lBQ1osT0FBTyxFQUFFLFVBQVU7SUFDbkIsVUFBVSxFQUFFLGFBQWE7Q0FDakIsQ0FBQyJ9
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdlbnRNZXNzYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiQWdlbnRNZXNzYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1REFBdUQifQ==
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentMessage } from './AgentMessage';
|
|
2
2
|
import type { AgentRunConfig, RunStatus } from './AgentStore';
|
|
3
|
-
export declare const MessageRole: {
|
|
4
|
-
readonly User: "user";
|
|
5
|
-
readonly Assistant: "assistant";
|
|
6
|
-
readonly System: "system";
|
|
7
|
-
};
|
|
8
|
-
export type MessageRole = (typeof MessageRole)[keyof typeof MessageRole];
|
|
9
|
-
export declare const MessageStatus: {
|
|
10
|
-
readonly InProgress: "in_progress";
|
|
11
|
-
readonly Incomplete: "incomplete";
|
|
12
|
-
readonly Completed: "completed";
|
|
13
|
-
};
|
|
14
|
-
export type MessageStatus = (typeof MessageStatus)[keyof typeof MessageStatus];
|
|
15
|
-
export declare const AgentSSEEvent: {
|
|
16
|
-
readonly ThreadRunCreated: "thread.run.created";
|
|
17
|
-
readonly ThreadRunInProgress: "thread.run.in_progress";
|
|
18
|
-
readonly ThreadRunCompleted: "thread.run.completed";
|
|
19
|
-
readonly ThreadRunFailed: "thread.run.failed";
|
|
20
|
-
readonly ThreadRunCancelled: "thread.run.cancelled";
|
|
21
|
-
readonly ThreadMessageCreated: "thread.message.created";
|
|
22
|
-
readonly ThreadMessageDelta: "thread.message.delta";
|
|
23
|
-
readonly ThreadMessageCompleted: "thread.message.completed";
|
|
24
|
-
readonly Done: "done";
|
|
25
|
-
};
|
|
26
|
-
export type AgentSSEEvent = (typeof AgentSSEEvent)[keyof typeof AgentSSEEvent];
|
|
27
3
|
export declare const AgentErrorCode: {
|
|
28
4
|
readonly ExecError: "EXEC_ERROR";
|
|
29
5
|
};
|
|
@@ -35,7 +11,7 @@ export interface ThreadObject {
|
|
|
35
11
|
metadata: Record<string, unknown>;
|
|
36
12
|
}
|
|
37
13
|
export interface ThreadObjectWithMessages extends ThreadObject {
|
|
38
|
-
messages:
|
|
14
|
+
messages: AgentMessage[];
|
|
39
15
|
}
|
|
40
16
|
export interface RunObject {
|
|
41
17
|
id: string;
|
|
@@ -57,7 +33,6 @@ export interface RunObject {
|
|
|
57
33
|
totalTokens: number;
|
|
58
34
|
} | null;
|
|
59
35
|
metadata?: Record<string, unknown>;
|
|
60
|
-
output?: MessageObject[];
|
|
61
36
|
config?: AgentRunConfig;
|
|
62
37
|
}
|
|
63
38
|
export interface CreateRunInput {
|
|
@@ -69,30 +44,19 @@ export interface CreateRunInput {
|
|
|
69
44
|
*/
|
|
70
45
|
isResume?: boolean;
|
|
71
46
|
input: {
|
|
72
|
-
messages: InputMessage[];
|
|
47
|
+
messages: import('./AgentMessage').InputMessage[];
|
|
73
48
|
};
|
|
74
49
|
config?: AgentRunConfig;
|
|
75
50
|
metadata?: Record<string, unknown>;
|
|
76
51
|
}
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
export interface AgentStreamMessagePayload {
|
|
85
|
-
role?: string;
|
|
86
|
-
content: string | InputContentPart[];
|
|
87
|
-
}
|
|
88
|
-
export interface AgentRunUsage {
|
|
89
|
-
promptTokens?: number;
|
|
90
|
-
completionTokens?: number;
|
|
52
|
+
export interface StreamEvent {
|
|
53
|
+
seq: number;
|
|
54
|
+
type: string;
|
|
55
|
+
data: unknown;
|
|
56
|
+
ts: number;
|
|
91
57
|
}
|
|
92
|
-
export interface
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/** Whether to accumulate message content into the final completed message. Defaults to true. */
|
|
97
|
-
accumulate?: boolean;
|
|
58
|
+
export interface GetThreadOptions {
|
|
59
|
+
/** When true, return all message types (system, result, stream_event, etc.).
|
|
60
|
+
* Defaults to false — only user and assistant messages are returned. */
|
|
61
|
+
includeAllMessages?: boolean;
|
|
98
62
|
}
|
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgentErrorCode =
|
|
4
|
-
// ===== Message roles =====
|
|
5
|
-
exports.MessageRole = {
|
|
6
|
-
User: 'user',
|
|
7
|
-
Assistant: 'assistant',
|
|
8
|
-
System: 'system',
|
|
9
|
-
};
|
|
10
|
-
// ===== Message statuses =====
|
|
11
|
-
exports.MessageStatus = {
|
|
12
|
-
InProgress: 'in_progress',
|
|
13
|
-
Incomplete: 'incomplete',
|
|
14
|
-
Completed: 'completed',
|
|
15
|
-
};
|
|
16
|
-
// ===== SSE events =====
|
|
17
|
-
exports.AgentSSEEvent = {
|
|
18
|
-
ThreadRunCreated: 'thread.run.created',
|
|
19
|
-
ThreadRunInProgress: 'thread.run.in_progress',
|
|
20
|
-
ThreadRunCompleted: 'thread.run.completed',
|
|
21
|
-
ThreadRunFailed: 'thread.run.failed',
|
|
22
|
-
ThreadRunCancelled: 'thread.run.cancelled',
|
|
23
|
-
ThreadMessageCreated: 'thread.message.created',
|
|
24
|
-
ThreadMessageDelta: 'thread.message.delta',
|
|
25
|
-
ThreadMessageCompleted: 'thread.message.completed',
|
|
26
|
-
Done: 'done',
|
|
27
|
-
};
|
|
3
|
+
exports.AgentErrorCode = void 0;
|
|
28
4
|
// ===== Error codes =====
|
|
29
5
|
exports.AgentErrorCode = {
|
|
30
6
|
ExecError: 'EXEC_ERROR',
|
|
31
7
|
};
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdlbnRSdW50aW1lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiQWdlbnRSdW50aW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUdBLDBCQUEwQjtBQUViLFFBQUEsY0FBYyxHQUFHO0lBQzVCLFNBQVMsRUFBRSxZQUFZO0NBQ2YsQ0FBQyJ9
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentMessage, InputMessage } from './AgentMessage';
|
|
2
|
+
import type { GetThreadOptions } from './AgentRuntime';
|
|
2
3
|
export declare const AgentObjectType: {
|
|
3
4
|
readonly Thread: "thread";
|
|
4
5
|
readonly ThreadRun: "thread.run";
|
|
5
|
-
readonly ThreadMessage: "thread.message";
|
|
6
|
-
readonly ThreadMessageDelta: "thread.message.delta";
|
|
7
6
|
};
|
|
8
7
|
export type AgentObjectType = (typeof AgentObjectType)[keyof typeof AgentObjectType];
|
|
9
8
|
export declare const RunStatus: {
|
|
@@ -24,11 +23,12 @@ export interface ThreadRecord {
|
|
|
24
23
|
id: string;
|
|
25
24
|
object: typeof AgentObjectType.Thread;
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* All messages in the thread, stored as SDK-format AgentMessage objects.
|
|
27
|
+
* In OSSAgentStore the messages are stored separately as a JSONL file
|
|
28
|
+
* and assembled on read — callers should treat this as a unified view
|
|
29
|
+
* regardless of the underlying storage layout.
|
|
30
30
|
*/
|
|
31
|
-
messages:
|
|
31
|
+
messages: AgentMessage[];
|
|
32
32
|
metadata: Record<string, unknown>;
|
|
33
33
|
createdAt: number;
|
|
34
34
|
}
|
|
@@ -38,7 +38,6 @@ export interface RunRecord {
|
|
|
38
38
|
threadId?: string;
|
|
39
39
|
status: RunStatus;
|
|
40
40
|
input: InputMessage[];
|
|
41
|
-
output?: MessageObject[];
|
|
42
41
|
lastError?: {
|
|
43
42
|
code: string;
|
|
44
43
|
message: string;
|
|
@@ -60,8 +59,8 @@ export interface AgentStore {
|
|
|
60
59
|
init?(): Promise<void>;
|
|
61
60
|
destroy?(): Promise<void>;
|
|
62
61
|
createThread(metadata?: Record<string, unknown>): Promise<ThreadRecord>;
|
|
63
|
-
getThread(threadId: string): Promise<ThreadRecord>;
|
|
64
|
-
appendMessages(threadId: string, messages:
|
|
62
|
+
getThread(threadId: string, options?: GetThreadOptions): Promise<ThreadRecord>;
|
|
63
|
+
appendMessages(threadId: string, messages: AgentMessage[]): Promise<void>;
|
|
65
64
|
createRun(input: InputMessage[], threadId?: string, config?: AgentRunConfig, metadata?: Record<string, unknown>): Promise<RunRecord>;
|
|
66
65
|
getRun(runId: string): Promise<RunRecord>;
|
|
67
66
|
updateRun(runId: string, updates: Partial<RunRecord>): Promise<void>;
|
|
@@ -5,8 +5,6 @@ exports.RunStatus = exports.AgentObjectType = void 0;
|
|
|
5
5
|
exports.AgentObjectType = {
|
|
6
6
|
Thread: 'thread',
|
|
7
7
|
ThreadRun: 'thread.run',
|
|
8
|
-
ThreadMessage: 'thread.message',
|
|
9
|
-
ThreadMessageDelta: 'thread.message.delta',
|
|
10
8
|
};
|
|
11
9
|
// ===== Run statuses =====
|
|
12
10
|
exports.RunStatus = {
|
|
@@ -18,4 +16,4 @@ exports.RunStatus = {
|
|
|
18
16
|
Cancelling: 'cancelling',
|
|
19
17
|
Expired: 'expired',
|
|
20
18
|
};
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdlbnRTdG9yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkFnZW50U3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EsMkJBQTJCO0FBRWQsUUFBQSxlQUFlLEdBQUc7SUFDN0IsTUFBTSxFQUFFLFFBQVE7SUFDaEIsU0FBUyxFQUFFLFlBQVk7Q0FDZixDQUFDO0FBR1gsMkJBQTJCO0FBRWQsUUFBQSxTQUFTLEdBQUc7SUFDdkIsTUFBTSxFQUFFLFFBQVE7SUFDaEIsVUFBVSxFQUFFLGFBQWE7SUFDekIsU0FBUyxFQUFFLFdBQVc7SUFDdEIsTUFBTSxFQUFFLFFBQVE7SUFDaEIsU0FBUyxFQUFFLFdBQVc7SUFDdEIsVUFBVSxFQUFFLFlBQVk7SUFDeEIsT0FBTyxFQUFFLFNBQVM7Q0FDVixDQUFDIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tegg-types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.78.1",
|
|
4
4
|
"description": "tegg types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"ts-node": "^10.9.1",
|
|
46
46
|
"typescript": "^5.0.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e131fdb561c81ed09ff1689a277cba36604359e5"
|
|
49
49
|
}
|