@eggjs/tegg-types 3.80.1 → 3.82.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.
|
@@ -47,6 +47,14 @@ export interface CreateRunInput {
|
|
|
47
47
|
messages: import('./AgentMessage').InputMessage[];
|
|
48
48
|
};
|
|
49
49
|
config?: AgentRunConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Metadata for the run. Stored verbatim on the run record, and additionally
|
|
52
|
+
* shallow-merged into the thread metadata (`meta.json`):
|
|
53
|
+
* - For an auto-created thread, it initializes the thread metadata.
|
|
54
|
+
* - For an existing thread, the keys are shallow-merged: new values overwrite
|
|
55
|
+
* matching keys, while keys not present are preserved.
|
|
56
|
+
* - An omitted or empty object leaves the thread metadata unchanged.
|
|
57
|
+
*/
|
|
50
58
|
metadata?: Record<string, unknown>;
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
@@ -54,8 +62,7 @@ export interface CreateRunInput {
|
|
|
54
62
|
*
|
|
55
63
|
* `metadata` is forwarded verbatim to {@link AgentStore.createThread} so callers
|
|
56
64
|
* can persist additional business semantics on the thread record (e.g. the
|
|
57
|
-
* resolved agent name, owning sandbox id, trace id).
|
|
58
|
-
* creation time and never overwritten by subsequent runs on the same thread.
|
|
65
|
+
* resolved agent name, owning sandbox id, trace id).
|
|
59
66
|
*/
|
|
60
67
|
export interface CreateThreadOptions {
|
|
61
68
|
metadata?: Record<string, unknown>;
|
|
@@ -31,6 +31,14 @@ export interface ThreadRecord {
|
|
|
31
31
|
messages: AgentMessage[];
|
|
32
32
|
metadata: Record<string, unknown>;
|
|
33
33
|
createdAt: number;
|
|
34
|
+
/**
|
|
35
|
+
* Id of the most recently created run on this thread, maintained by
|
|
36
|
+
* `createRun` as a best-effort pointer so callers can resolve a thread's
|
|
37
|
+
* latest run without an external index. Absent on threads that have no
|
|
38
|
+
* runs yet, and on threads created before this field existed — a missing
|
|
39
|
+
* value must be treated as "no recent run".
|
|
40
|
+
*/
|
|
41
|
+
latestRunId?: string;
|
|
34
42
|
}
|
|
35
43
|
export interface RunRecord {
|
|
36
44
|
id: string;
|
|
@@ -60,8 +68,20 @@ export interface AgentStore {
|
|
|
60
68
|
destroy?(): Promise<void>;
|
|
61
69
|
createThread(metadata?: Record<string, unknown>): Promise<ThreadRecord>;
|
|
62
70
|
getThread(threadId: string, options?: GetThreadOptions): Promise<ThreadRecord>;
|
|
71
|
+
/**
|
|
72
|
+
* Shallow-merge metadata into an existing thread.
|
|
73
|
+
* New values overwrite matching keys; omitted keys are preserved.
|
|
74
|
+
*/
|
|
75
|
+
updateThreadMetadata?(threadId: string, metadata: Record<string, unknown>): Promise<void>;
|
|
63
76
|
appendMessages(threadId: string, messages: AgentMessage[]): Promise<void>;
|
|
64
77
|
createRun(input: InputMessage[], threadId?: string, config?: AgentRunConfig, metadata?: Record<string, unknown>): Promise<RunRecord>;
|
|
65
78
|
getRun(runId: string): Promise<RunRecord>;
|
|
79
|
+
/**
|
|
80
|
+
* Id of the most recent run created on the thread, or `null` when the
|
|
81
|
+
* thread exists but has no recorded run (including threads created before
|
|
82
|
+
* run tracking existed). Throws AgentNotFoundError when the thread itself
|
|
83
|
+
* does not exist.
|
|
84
|
+
*/
|
|
85
|
+
getLatestRunId(threadId: string): Promise<string | null>;
|
|
66
86
|
updateRun(runId: string, updates: Partial<RunRecord>): Promise<void>;
|
|
67
87
|
}
|
|
@@ -7,6 +7,13 @@ export declare class AgentNotFoundError extends Error {
|
|
|
7
7
|
status: number;
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when an agent API request contains invalid input.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentInvalidRequestError extends Error {
|
|
14
|
+
status: number;
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* Error thrown when an operation conflicts with the current state
|
|
12
19
|
* (e.g., cancelling a completed run).
|
package/agent-runtime/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgentTimeoutError = exports.InvalidRunStateTransitionError = exports.AgentConflictError = exports.AgentNotFoundError = void 0;
|
|
3
|
+
exports.AgentTimeoutError = exports.InvalidRunStateTransitionError = exports.AgentConflictError = exports.AgentInvalidRequestError = exports.AgentNotFoundError = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Error thrown when a thread or run is not found.
|
|
6
6
|
* The `status` property is recognized by Koa/Egg error handling
|
|
@@ -14,6 +14,17 @@ class AgentNotFoundError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.AgentNotFoundError = AgentNotFoundError;
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when an agent API request contains invalid input.
|
|
19
|
+
*/
|
|
20
|
+
class AgentInvalidRequestError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.status = 400;
|
|
24
|
+
this.name = 'AgentInvalidRequestError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AgentInvalidRequestError = AgentInvalidRequestError;
|
|
17
28
|
/**
|
|
18
29
|
* Error thrown when an operation conflicts with the current state
|
|
19
30
|
* (e.g., cancelling a completed run).
|
|
@@ -53,4 +64,4 @@ class AgentTimeoutError extends Error {
|
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
66
|
exports.AgentTimeoutError = AgentTimeoutError;
|
|
56
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXJyb3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7O0dBSUc7QUFDSCxNQUFhLGtCQUFtQixTQUFRLEt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0FBQztRQUhqQixXQUFNLEdBQUcsR0FBRyxDQUFDO1FBSVgsSUFBSSxDQUFDLElBQUksR0FBRyxtQkFBbUIsQ0FBQztJQUNsQyxDQUFDO0NBQ0Y7QUFQRCw4Q0FPQyJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tegg-types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.82.0",
|
|
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": "19b3a51a3fb53ea6e2afa3798e838f229a3077b6"
|
|
49
49
|
}
|