veryfront 0.1.232 → 0.1.234
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/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/agent/conversation-bootstrap.d.ts +61 -0
- package/esm/src/agent/conversation-bootstrap.d.ts.map +1 -0
- package/esm/src/agent/conversation-bootstrap.js +131 -0
- package/esm/src/agent/durable.d.ts +84 -0
- package/esm/src/agent/durable.d.ts.map +1 -1
- package/esm/src/agent/durable.js +193 -12
- package/esm/src/agent/index.d.ts +3 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +3 -1
- package/esm/src/agent/invoke-agent-child-runs.d.ts +145 -0
- package/esm/src/agent/invoke-agent-child-runs.d.ts.map +1 -0
- package/esm/src/agent/invoke-agent-child-runs.js +101 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +9 -1
- package/src/deno.js +3 -1
- package/src/src/agent/conversation-bootstrap.ts +195 -0
- package/src/src/agent/durable.ts +257 -12
- package/src/src/agent/index.ts +35 -0
- package/src/src/agent/invoke-agent-child-runs.ts +170 -0
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ declare namespace _default {
|
|
|
17
17
|
"./markdown": string;
|
|
18
18
|
"./mdx": string;
|
|
19
19
|
"./agent": string;
|
|
20
|
+
"./agent/conversation-bootstrap": string;
|
|
20
21
|
"./agent/durable": string;
|
|
22
|
+
"./agent/invoke-agent-child-runs": string;
|
|
21
23
|
"./channels/control-plane": string;
|
|
22
24
|
"./channels/invoke": string;
|
|
23
25
|
"./tool": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.234",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"workspace": [
|
|
@@ -30,7 +30,9 @@ export default {
|
|
|
30
30
|
"./markdown": "./src/markdown/index.ts",
|
|
31
31
|
"./mdx": "./src/mdx/index.ts",
|
|
32
32
|
"./agent": "./src/agent/index.ts",
|
|
33
|
+
"./agent/conversation-bootstrap": "./src/agent/conversation-bootstrap.ts",
|
|
33
34
|
"./agent/durable": "./src/agent/durable.ts",
|
|
35
|
+
"./agent/invoke-agent-child-runs": "./src/agent/invoke-agent-child-runs.ts",
|
|
34
36
|
"./channels/control-plane": "./src/channels/control-plane.ts",
|
|
35
37
|
"./channels/invoke": "./src/channels/invoke.ts",
|
|
36
38
|
"./tool": "./src/tool/index.ts",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type ConversationRunProjection } from "./durable.js";
|
|
4
|
+
export declare const ConversationRecordSchema: z.ZodPipe<z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
projectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
project_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
9
|
+
id: string;
|
|
10
|
+
projectId: string | null;
|
|
11
|
+
}, {
|
|
12
|
+
[x: string]: unknown;
|
|
13
|
+
id: string;
|
|
14
|
+
projectId?: string | null | undefined;
|
|
15
|
+
project_id?: string | null | undefined;
|
|
16
|
+
}>>;
|
|
17
|
+
export declare const ConversationMessageRecordSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type ConversationRecord = z.infer<typeof ConversationRecordSchema>;
|
|
21
|
+
export type ConversationMessageRecord = z.infer<typeof ConversationMessageRecordSchema>;
|
|
22
|
+
export declare function fetchConversationRecord(input: {
|
|
23
|
+
authToken: string;
|
|
24
|
+
apiUrl: string;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
}): Promise<ConversationRecord>;
|
|
27
|
+
export declare function ensureConversationProjectLink(input: {
|
|
28
|
+
authToken: string;
|
|
29
|
+
apiUrl: string;
|
|
30
|
+
conversationId: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
export declare function createConversationRecord(input: {
|
|
34
|
+
authToken: string;
|
|
35
|
+
apiUrl: string;
|
|
36
|
+
body: unknown;
|
|
37
|
+
}): Promise<ConversationRecord>;
|
|
38
|
+
export declare function createConversationMessage(input: {
|
|
39
|
+
authToken: string;
|
|
40
|
+
apiUrl: string;
|
|
41
|
+
conversationId: string;
|
|
42
|
+
body: unknown;
|
|
43
|
+
}): Promise<ConversationMessageRecord>;
|
|
44
|
+
export interface BootstrapConversationAgentRunResult {
|
|
45
|
+
conversation: ConversationRecord;
|
|
46
|
+
message: ConversationMessageRecord;
|
|
47
|
+
run: ConversationRunProjection;
|
|
48
|
+
}
|
|
49
|
+
export declare function bootstrapConversationAgentRun(input: {
|
|
50
|
+
authToken: string;
|
|
51
|
+
apiUrl: string;
|
|
52
|
+
parentConversationId?: string;
|
|
53
|
+
ensureProjectId?: string;
|
|
54
|
+
conversationBody: unknown;
|
|
55
|
+
handoffMessageBody: unknown;
|
|
56
|
+
runId?: string;
|
|
57
|
+
agentId: string;
|
|
58
|
+
projectId?: string | null;
|
|
59
|
+
branchId?: string | null;
|
|
60
|
+
}): Promise<BootstrapConversationAgentRunResult>;
|
|
61
|
+
//# sourceMappingURL=conversation-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/src/agent/conversation-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,yBA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AAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAiC/C"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import "../../_dnt.polyfills.js";
|
|
2
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { createConversationAgentRun } from "./durable.js";
|
|
5
|
+
const CONVERSATION_API_TIMEOUT_MS = 15_000;
|
|
6
|
+
export const ConversationRecordSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
projectId: z.string().nullable().optional(),
|
|
10
|
+
project_id: z.string().nullable().optional(),
|
|
11
|
+
})
|
|
12
|
+
.passthrough()
|
|
13
|
+
.transform((data) => ({
|
|
14
|
+
id: data.id,
|
|
15
|
+
projectId: data.projectId ?? data.project_id ?? null,
|
|
16
|
+
}));
|
|
17
|
+
export const ConversationMessageRecordSchema = z.object({
|
|
18
|
+
id: z.string().uuid(),
|
|
19
|
+
});
|
|
20
|
+
async function controlPlaneJson(input) {
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
const timeout = dntShim.setTimeout(() => controller.abort(), CONVERSATION_API_TIMEOUT_MS);
|
|
23
|
+
let response;
|
|
24
|
+
try {
|
|
25
|
+
response = await fetch(input.url, {
|
|
26
|
+
method: input.method ?? "GET",
|
|
27
|
+
headers: {
|
|
28
|
+
Authorization: `Bearer ${input.authToken}`,
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
},
|
|
31
|
+
...(input.body !== undefined ? { body: JSON.stringify(input.body) } : {}),
|
|
32
|
+
signal: controller.signal,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
37
|
+
throw new Error(`${input.operation} timed out after ${CONVERSATION_API_TIMEOUT_MS}ms`);
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
}
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
const body = await response.text().catch(() => "");
|
|
46
|
+
throw new Error(`${input.operation} failed (${response.status}): ${body || response.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
return input.responseSchema.parse(await response.json());
|
|
49
|
+
}
|
|
50
|
+
function buildConversationPath(apiUrl, conversationId) {
|
|
51
|
+
return `${apiUrl}/conversations/${conversationId}`;
|
|
52
|
+
}
|
|
53
|
+
function buildConversationMessagesPath(apiUrl, conversationId) {
|
|
54
|
+
return `${buildConversationPath(apiUrl, conversationId)}/messages`;
|
|
55
|
+
}
|
|
56
|
+
export async function fetchConversationRecord(input) {
|
|
57
|
+
return controlPlaneJson({
|
|
58
|
+
authToken: input.authToken,
|
|
59
|
+
url: buildConversationPath(input.apiUrl, input.conversationId),
|
|
60
|
+
responseSchema: ConversationRecordSchema,
|
|
61
|
+
operation: "Fetch conversation",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export async function ensureConversationProjectLink(input) {
|
|
65
|
+
const conversation = await fetchConversationRecord(input);
|
|
66
|
+
if (conversation.projectId === input.projectId)
|
|
67
|
+
return;
|
|
68
|
+
if (conversation.projectId !== null) {
|
|
69
|
+
throw new Error(`Conversation ${input.conversationId} is already linked to a different project (${conversation.projectId})`);
|
|
70
|
+
}
|
|
71
|
+
await controlPlaneJson({
|
|
72
|
+
authToken: input.authToken,
|
|
73
|
+
url: buildConversationPath(input.apiUrl, input.conversationId),
|
|
74
|
+
method: "PATCH",
|
|
75
|
+
body: { project_id: input.projectId },
|
|
76
|
+
responseSchema: ConversationRecordSchema,
|
|
77
|
+
operation: "Link conversation to project",
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export async function createConversationRecord(input) {
|
|
81
|
+
return controlPlaneJson({
|
|
82
|
+
authToken: input.authToken,
|
|
83
|
+
url: `${input.apiUrl}/conversations`,
|
|
84
|
+
method: "POST",
|
|
85
|
+
body: input.body,
|
|
86
|
+
responseSchema: ConversationRecordSchema,
|
|
87
|
+
operation: "Create conversation",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
export async function createConversationMessage(input) {
|
|
91
|
+
return controlPlaneJson({
|
|
92
|
+
authToken: input.authToken,
|
|
93
|
+
url: buildConversationMessagesPath(input.apiUrl, input.conversationId),
|
|
94
|
+
method: "POST",
|
|
95
|
+
body: input.body,
|
|
96
|
+
responseSchema: ConversationMessageRecordSchema,
|
|
97
|
+
operation: "Create conversation message",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export async function bootstrapConversationAgentRun(input) {
|
|
101
|
+
if (input.parentConversationId && input.ensureProjectId) {
|
|
102
|
+
await ensureConversationProjectLink({
|
|
103
|
+
authToken: input.authToken,
|
|
104
|
+
apiUrl: input.apiUrl,
|
|
105
|
+
conversationId: input.parentConversationId,
|
|
106
|
+
projectId: input.ensureProjectId,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const conversation = await createConversationRecord({
|
|
110
|
+
authToken: input.authToken,
|
|
111
|
+
apiUrl: input.apiUrl,
|
|
112
|
+
body: input.conversationBody,
|
|
113
|
+
});
|
|
114
|
+
const effectiveProjectId = input.projectId ?? conversation.projectId;
|
|
115
|
+
const message = await createConversationMessage({
|
|
116
|
+
authToken: input.authToken,
|
|
117
|
+
apiUrl: input.apiUrl,
|
|
118
|
+
conversationId: conversation.id,
|
|
119
|
+
body: input.handoffMessageBody,
|
|
120
|
+
});
|
|
121
|
+
const run = await createConversationAgentRun({
|
|
122
|
+
authToken: input.authToken,
|
|
123
|
+
apiUrl: input.apiUrl,
|
|
124
|
+
conversationId: conversation.id,
|
|
125
|
+
runId: input.runId,
|
|
126
|
+
agentId: input.agentId,
|
|
127
|
+
projectId: effectiveProjectId,
|
|
128
|
+
branchId: input.branchId,
|
|
129
|
+
});
|
|
130
|
+
return { conversation, message, run };
|
|
131
|
+
}
|
|
@@ -16,6 +16,14 @@ export declare function resolveConversationRunTargets(input: {
|
|
|
16
16
|
projectId?: string | null;
|
|
17
17
|
branchId?: string | null;
|
|
18
18
|
}): ConversationRunTargets;
|
|
19
|
+
export declare const ConversationRunStatusSchema: z.ZodEnum<{
|
|
20
|
+
failed: "failed";
|
|
21
|
+
pending: "pending";
|
|
22
|
+
completed: "completed";
|
|
23
|
+
running: "running";
|
|
24
|
+
cancelled: "cancelled";
|
|
25
|
+
waiting_for_tool: "waiting_for_tool";
|
|
26
|
+
}>;
|
|
19
27
|
export declare const ConversationRunProjectionSchema: z.ZodPipe<z.ZodObject<{
|
|
20
28
|
runId: z.ZodOptional<z.ZodString>;
|
|
21
29
|
run_id: z.ZodOptional<z.ZodString>;
|
|
@@ -87,6 +95,53 @@ export declare const CompleteConversationRunResponseSchema: z.ZodObject<{
|
|
|
87
95
|
}>;
|
|
88
96
|
}, z.core.$loose>;
|
|
89
97
|
}, z.core.$loose>;
|
|
98
|
+
export declare const AppendConversationRunEventsResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
99
|
+
latestEventId: z.ZodNumber;
|
|
100
|
+
latestExternalEventSequence: z.ZodNumber;
|
|
101
|
+
appendedCount: z.ZodNumber;
|
|
102
|
+
run: z.ZodObject<{
|
|
103
|
+
runId: z.ZodString;
|
|
104
|
+
conversationId: z.ZodString;
|
|
105
|
+
latestEventId: z.ZodNumber;
|
|
106
|
+
latestExternalEventSequence: z.ZodNumber;
|
|
107
|
+
}, z.core.$loose>;
|
|
108
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
109
|
+
latest_event_id: z.ZodNumber;
|
|
110
|
+
latest_external_event_sequence: z.ZodNumber;
|
|
111
|
+
appended_count: z.ZodNumber;
|
|
112
|
+
run: z.ZodObject<{
|
|
113
|
+
run_id: z.ZodString;
|
|
114
|
+
conversation_id: z.ZodString;
|
|
115
|
+
latest_event_id: z.ZodNumber;
|
|
116
|
+
latest_external_event_sequence: z.ZodNumber;
|
|
117
|
+
}, z.core.$loose>;
|
|
118
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
119
|
+
latestEventId: number;
|
|
120
|
+
latestExternalEventSequence: number;
|
|
121
|
+
appendedCount: number;
|
|
122
|
+
run: {
|
|
123
|
+
runId: string;
|
|
124
|
+
conversationId: string;
|
|
125
|
+
latestEventId: number;
|
|
126
|
+
latestExternalEventSequence: number;
|
|
127
|
+
run_id: string;
|
|
128
|
+
conversation_id: string;
|
|
129
|
+
latest_event_id: number;
|
|
130
|
+
latest_external_event_sequence: number;
|
|
131
|
+
};
|
|
132
|
+
}, {
|
|
133
|
+
latest_event_id: number;
|
|
134
|
+
latest_external_event_sequence: number;
|
|
135
|
+
appended_count: number;
|
|
136
|
+
run: {
|
|
137
|
+
[x: string]: unknown;
|
|
138
|
+
run_id: string;
|
|
139
|
+
conversation_id: string;
|
|
140
|
+
latest_event_id: number;
|
|
141
|
+
latest_external_event_sequence: number;
|
|
142
|
+
};
|
|
143
|
+
}>>]>;
|
|
144
|
+
export type AppendConversationRunEventsResponse = z.infer<typeof AppendConversationRunEventsResponseSchema>;
|
|
90
145
|
export interface ConversationAgentRunUsage {
|
|
91
146
|
inputTokens: number;
|
|
92
147
|
outputTokens: number;
|
|
@@ -113,6 +168,35 @@ export interface FinalizeConversationAgentRunInput {
|
|
|
113
168
|
terminalErrorCode?: string | null;
|
|
114
169
|
terminalErrorMessage?: string | null;
|
|
115
170
|
}
|
|
171
|
+
export declare class AppendConversationRunEventsError extends Error {
|
|
172
|
+
readonly status: number;
|
|
173
|
+
readonly detail: string | null;
|
|
174
|
+
constructor(input: {
|
|
175
|
+
status: number;
|
|
176
|
+
detail?: string | null;
|
|
177
|
+
statusText?: string;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
export declare function parseAppendConversationRunEventsErrorBody(bodyText: string): string | null;
|
|
181
|
+
export declare function isIgnorableConversationRunAppendError(error: unknown): error is AppendConversationRunEventsError;
|
|
182
|
+
export declare function isCursorMismatchConversationRunAppendError(error: unknown): error is AppendConversationRunEventsError;
|
|
183
|
+
export declare function getConversationRun(input: {
|
|
184
|
+
authToken: string;
|
|
185
|
+
apiUrl: string;
|
|
186
|
+
conversationId: string;
|
|
187
|
+
runId: string;
|
|
188
|
+
abortSignal?: AbortSignal;
|
|
189
|
+
}): Promise<ConversationRunProjection>;
|
|
190
|
+
export declare function appendConversationRunEvents(input: {
|
|
191
|
+
authToken: string;
|
|
192
|
+
apiUrl: string;
|
|
193
|
+
conversationId: string;
|
|
194
|
+
runId: string;
|
|
195
|
+
expectedPreviousEventId?: number;
|
|
196
|
+
expectedPreviousExternalEventSequence?: number;
|
|
197
|
+
events: unknown[];
|
|
198
|
+
abortSignal?: AbortSignal;
|
|
199
|
+
}): Promise<AppendConversationRunEventsResponse>;
|
|
116
200
|
export declare function createConversationAgentRun(input: CreateConversationAgentRunInput): Promise<ConversationRunProjection>;
|
|
117
201
|
export declare function finalizeConversationAgentRun(input: FinalizeConversationAgentRunInput): Promise<void>;
|
|
118
202
|
//# sourceMappingURL=durable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable.d.ts","sourceRoot":"","sources":["../../../src/src/agent/durable.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"durable.d.ts","sourceRoot":"","sources":["../../../src/src/agent/durable.ts"],"names":[],"m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C;AAED,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,qCAAqC,CAAC,EAAE,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAyD/C;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,yBAAyB,CAAC,CA0CpC;AAED,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
package/esm/src/agent/durable.js
CHANGED
|
@@ -2,6 +2,31 @@ import "../../_dnt.polyfills.js";
|
|
|
2
2
|
import * as dntShim from "../../_dnt.shims.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const AGENT_RUN_API_TIMEOUT_MS = 15_000;
|
|
5
|
+
function createTimedAbortSignal(timeoutMs, abortSignal) {
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
let abortedByCaller = false;
|
|
8
|
+
const timeout = dntShim.setTimeout(() => {
|
|
9
|
+
controller.abort();
|
|
10
|
+
}, timeoutMs);
|
|
11
|
+
const onAbort = () => {
|
|
12
|
+
abortedByCaller = true;
|
|
13
|
+
controller.abort();
|
|
14
|
+
};
|
|
15
|
+
if (abortSignal?.aborted) {
|
|
16
|
+
onAbort();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
signal: controller.signal,
|
|
23
|
+
wasAbortedByCaller: () => abortedByCaller,
|
|
24
|
+
cleanup: () => {
|
|
25
|
+
clearTimeout(timeout);
|
|
26
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
5
30
|
export const ConversationRunTargetsSchema = z.object({
|
|
6
31
|
sourceTargetKind: z.enum(["project", "preview_branch"]).nullable(),
|
|
7
32
|
runtimeTargetKind: z.enum(["production", "preview_branch"]).nullable(),
|
|
@@ -26,6 +51,14 @@ export function resolveConversationRunTargets(input) {
|
|
|
26
51
|
targetBranchId: null,
|
|
27
52
|
});
|
|
28
53
|
}
|
|
54
|
+
export const ConversationRunStatusSchema = z.enum([
|
|
55
|
+
"pending",
|
|
56
|
+
"running",
|
|
57
|
+
"waiting_for_tool",
|
|
58
|
+
"completed",
|
|
59
|
+
"failed",
|
|
60
|
+
"cancelled",
|
|
61
|
+
]);
|
|
29
62
|
export const ConversationRunProjectionSchema = z
|
|
30
63
|
.object({
|
|
31
64
|
runId: z.string().min(1).optional(),
|
|
@@ -38,7 +71,7 @@ export const ConversationRunProjectionSchema = z
|
|
|
38
71
|
latest_event_id: z.number().int().nonnegative().optional(),
|
|
39
72
|
latestExternalEventSequence: z.number().int().nonnegative().optional(),
|
|
40
73
|
latest_external_event_sequence: z.number().int().nonnegative().optional(),
|
|
41
|
-
status:
|
|
74
|
+
status: ConversationRunStatusSchema,
|
|
42
75
|
})
|
|
43
76
|
.passthrough()
|
|
44
77
|
.transform((data) => {
|
|
@@ -92,11 +125,100 @@ export const CompleteConversationRunResponseSchema = z
|
|
|
92
125
|
.passthrough(),
|
|
93
126
|
})
|
|
94
127
|
.passthrough();
|
|
128
|
+
const AppendConversationRunEventsCamelRunSchema = z
|
|
129
|
+
.object({
|
|
130
|
+
runId: z.string().min(1),
|
|
131
|
+
conversationId: z.string().uuid(),
|
|
132
|
+
latestEventId: z.number().int().nonnegative(),
|
|
133
|
+
latestExternalEventSequence: z.number().int().nonnegative(),
|
|
134
|
+
})
|
|
135
|
+
.passthrough();
|
|
136
|
+
const AppendConversationRunEventsSnakeRunSchema = z
|
|
137
|
+
.object({
|
|
138
|
+
run_id: z.string().min(1),
|
|
139
|
+
conversation_id: z.string().uuid(),
|
|
140
|
+
latest_event_id: z.number().int().nonnegative(),
|
|
141
|
+
latest_external_event_sequence: z.number().int().nonnegative(),
|
|
142
|
+
})
|
|
143
|
+
.passthrough();
|
|
144
|
+
export const AppendConversationRunEventsResponseSchema = z.union([
|
|
145
|
+
z.object({
|
|
146
|
+
latestEventId: z.number().int().nonnegative(),
|
|
147
|
+
latestExternalEventSequence: z.number().int().nonnegative(),
|
|
148
|
+
appendedCount: z.number().int().nonnegative(),
|
|
149
|
+
run: AppendConversationRunEventsCamelRunSchema,
|
|
150
|
+
}),
|
|
151
|
+
z.object({
|
|
152
|
+
latest_event_id: z.number().int().nonnegative(),
|
|
153
|
+
latest_external_event_sequence: z.number().int().nonnegative(),
|
|
154
|
+
appended_count: z.number().int().nonnegative(),
|
|
155
|
+
run: AppendConversationRunEventsSnakeRunSchema,
|
|
156
|
+
}).transform((data) => ({
|
|
157
|
+
latestEventId: data.latest_event_id,
|
|
158
|
+
latestExternalEventSequence: data.latest_external_event_sequence,
|
|
159
|
+
appendedCount: data.appended_count,
|
|
160
|
+
run: {
|
|
161
|
+
...data.run,
|
|
162
|
+
runId: data.run.run_id,
|
|
163
|
+
conversationId: data.run.conversation_id,
|
|
164
|
+
latestEventId: data.run.latest_event_id,
|
|
165
|
+
latestExternalEventSequence: data.run.latest_external_event_sequence,
|
|
166
|
+
},
|
|
167
|
+
})),
|
|
168
|
+
]);
|
|
169
|
+
const ConversationRunErrorSchema = z.object({
|
|
170
|
+
detail: z.string().min(1).optional(),
|
|
171
|
+
error: z.string().min(1).optional(),
|
|
172
|
+
});
|
|
173
|
+
export class AppendConversationRunEventsError extends Error {
|
|
174
|
+
status;
|
|
175
|
+
detail;
|
|
176
|
+
constructor(input) {
|
|
177
|
+
const detail = input.detail?.trim() || input.statusText || `HTTP ${input.status}`;
|
|
178
|
+
super(`Append conversation run events failed (${input.status}): ${detail}`);
|
|
179
|
+
this.name = "AppendConversationRunEventsError";
|
|
180
|
+
this.status = input.status;
|
|
181
|
+
this.detail = input.detail?.trim() || null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export function parseAppendConversationRunEventsErrorBody(bodyText) {
|
|
185
|
+
if (!bodyText) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const parsed = ConversationRunErrorSchema.safeParse(JSON.parse(bodyText));
|
|
190
|
+
if (parsed.success) {
|
|
191
|
+
return parsed.data.detail ?? parsed.data.error ?? null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return bodyText;
|
|
196
|
+
}
|
|
197
|
+
return bodyText;
|
|
198
|
+
}
|
|
199
|
+
export function isIgnorableConversationRunAppendError(error) {
|
|
200
|
+
if (!(error instanceof AppendConversationRunEventsError)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
if (error.status === 404) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
if (error.status !== 400) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
return (error.detail === "Cannot append external events to a terminal run" ||
|
|
210
|
+
error.detail === "Cannot append external events while the run is waiting for a tool result");
|
|
211
|
+
}
|
|
212
|
+
export function isCursorMismatchConversationRunAppendError(error) {
|
|
213
|
+
return (error instanceof AppendConversationRunEventsError &&
|
|
214
|
+
error.status === 400 &&
|
|
215
|
+
error.detail === "External run event cursor mismatch");
|
|
216
|
+
}
|
|
95
217
|
async function controlPlaneJson(input) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
218
|
+
if (input.abortSignal?.aborted) {
|
|
219
|
+
throw new DOMException("This operation was aborted", "AbortError");
|
|
220
|
+
}
|
|
221
|
+
const timedAbort = createTimedAbortSignal(AGENT_RUN_API_TIMEOUT_MS, input.abortSignal);
|
|
100
222
|
let response;
|
|
101
223
|
try {
|
|
102
224
|
response = await fetch(input.url, {
|
|
@@ -106,17 +228,19 @@ async function controlPlaneJson(input) {
|
|
|
106
228
|
"Content-Type": "application/json",
|
|
107
229
|
},
|
|
108
230
|
...(input.body !== undefined ? { body: JSON.stringify(input.body) } : {}),
|
|
109
|
-
signal:
|
|
231
|
+
signal: timedAbort.signal,
|
|
110
232
|
});
|
|
111
233
|
}
|
|
112
234
|
catch (error) {
|
|
113
|
-
if (error instanceof DOMException &&
|
|
235
|
+
if (error instanceof DOMException &&
|
|
236
|
+
error.name === "AbortError" &&
|
|
237
|
+
!timedAbort.wasAbortedByCaller()) {
|
|
114
238
|
throw new Error(`${input.operation} timed out after ${AGENT_RUN_API_TIMEOUT_MS}ms`);
|
|
115
239
|
}
|
|
116
240
|
throw error;
|
|
117
241
|
}
|
|
118
242
|
finally {
|
|
119
|
-
|
|
243
|
+
timedAbort.cleanup();
|
|
120
244
|
}
|
|
121
245
|
if (!response.ok) {
|
|
122
246
|
const body = await response.text().catch(() => "");
|
|
@@ -124,6 +248,63 @@ async function controlPlaneJson(input) {
|
|
|
124
248
|
}
|
|
125
249
|
return input.responseSchema.parse(await response.json());
|
|
126
250
|
}
|
|
251
|
+
export async function getConversationRun(input) {
|
|
252
|
+
return controlPlaneJson({
|
|
253
|
+
authToken: input.authToken,
|
|
254
|
+
url: `${input.apiUrl}/conversations/${input.conversationId}/runs/${input.runId}`,
|
|
255
|
+
responseSchema: ConversationRunProjectionSchema,
|
|
256
|
+
operation: "Read conversation durable run projection",
|
|
257
|
+
abortSignal: input.abortSignal,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
export async function appendConversationRunEvents(input) {
|
|
261
|
+
if (input.abortSignal?.aborted) {
|
|
262
|
+
throw new DOMException("This operation was aborted", "AbortError");
|
|
263
|
+
}
|
|
264
|
+
const timedAbort = createTimedAbortSignal(AGENT_RUN_API_TIMEOUT_MS, input.abortSignal);
|
|
265
|
+
let response;
|
|
266
|
+
try {
|
|
267
|
+
response = await fetch(`${input.apiUrl}/conversations/${input.conversationId}/runs/${input.runId}/events`, {
|
|
268
|
+
method: "POST",
|
|
269
|
+
headers: {
|
|
270
|
+
Authorization: `Bearer ${input.authToken}`,
|
|
271
|
+
"Content-Type": "application/json",
|
|
272
|
+
},
|
|
273
|
+
body: JSON.stringify({
|
|
274
|
+
...(input.expectedPreviousEventId !== undefined
|
|
275
|
+
? { expected_previous_event_id: input.expectedPreviousEventId }
|
|
276
|
+
: {}),
|
|
277
|
+
...(input.expectedPreviousExternalEventSequence !== undefined
|
|
278
|
+
? {
|
|
279
|
+
expected_previous_external_event_sequence: input.expectedPreviousExternalEventSequence,
|
|
280
|
+
}
|
|
281
|
+
: {}),
|
|
282
|
+
events: input.events,
|
|
283
|
+
}),
|
|
284
|
+
signal: timedAbort.signal,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
if (error instanceof DOMException &&
|
|
289
|
+
error.name === "AbortError" &&
|
|
290
|
+
!timedAbort.wasAbortedByCaller()) {
|
|
291
|
+
throw new Error(`Append conversation run events timed out after ${AGENT_RUN_API_TIMEOUT_MS}ms`);
|
|
292
|
+
}
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
timedAbort.cleanup();
|
|
297
|
+
}
|
|
298
|
+
if (!response.ok) {
|
|
299
|
+
const body = await response.text().catch(() => "");
|
|
300
|
+
throw new AppendConversationRunEventsError({
|
|
301
|
+
status: response.status,
|
|
302
|
+
detail: parseAppendConversationRunEventsErrorBody(body),
|
|
303
|
+
statusText: response.statusText,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
return AppendConversationRunEventsResponseSchema.parse(await response.json());
|
|
307
|
+
}
|
|
127
308
|
export async function createConversationAgentRun(input) {
|
|
128
309
|
const targets = resolveConversationRunTargets({
|
|
129
310
|
projectId: input.projectId ?? null,
|
|
@@ -158,11 +339,11 @@ export async function createConversationAgentRun(input) {
|
|
|
158
339
|
responseSchema: CreateConversationRunAcceptedSchema,
|
|
159
340
|
operation: "Create canonical durable run",
|
|
160
341
|
});
|
|
161
|
-
return
|
|
342
|
+
return getConversationRun({
|
|
162
343
|
authToken: input.authToken,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
344
|
+
apiUrl: input.apiUrl,
|
|
345
|
+
conversationId: input.conversationId,
|
|
346
|
+
runId,
|
|
166
347
|
});
|
|
167
348
|
}
|
|
168
349
|
export async function finalizeConversationAgentRun(input) {
|
package/esm/src/agent/index.d.ts
CHANGED
|
@@ -89,7 +89,9 @@ export { type AgUiRuntimeContextItem, AgUiRuntimeContextItemSchema, type AgUiRun
|
|
|
89
89
|
export { normalizeAgUiRuntimeMessages } from "./ag-ui-runtime-support.js";
|
|
90
90
|
export { type AgUiBrowserEncodedEvent, type AgUiBrowserEncoderState, type AgUiBrowserRunFinishedMetadata, type AgUiRuntimeStreamEvent, buildAgUiBrowserFinalizeResponse, createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
|
|
91
91
|
export { type AgUiBrowserResponseEncoder, type AgUiBrowserResponseExecution, type AgUiBrowserResponseRequestState, createAgUiBrowserResponseStream, type CreateAgUiBrowserResponseStreamInput, } from "./ag-ui-browser-response-stream.js";
|
|
92
|
-
export {
|
|
92
|
+
export { bootstrapConversationAgentRun, type BootstrapConversationAgentRunResult, type ConversationMessageRecord, ConversationMessageRecordSchema, type ConversationRecord, ConversationRecordSchema, createConversationMessage, createConversationRecord, ensureConversationProjectLink, fetchConversationRecord, } from "./conversation-bootstrap.js";
|
|
93
|
+
export { appendConversationRunEvents, AppendConversationRunEventsError, type AppendConversationRunEventsResponse, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, type ConversationAgentRunUsage, type ConversationRunProjection, ConversationRunProjectionSchema, ConversationRunStatusSchema, type ConversationRunTargets, ConversationRunTargetsSchema, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, parseAppendConversationRunEventsErrorBody, resolveConversationRunTargets, } from "./durable.js";
|
|
94
|
+
export { buildInvokeAgentChildRunLifecycleCustomEvent, buildInvokeAgentChildRunProgressEvents, buildInvokeAgentChildRunStateDelta, type InvokeAgentChildRunLifecycleCustomEvent, InvokeAgentChildRunLifecycleCustomEventSchema, type InvokeAgentChildRunLifecycleValue, InvokeAgentChildRunLifecycleValueSchema, type InvokeAgentChildRunProgressEvent, type InvokeAgentChildRunProgressInput, type InvokeAgentChildRunStateDelta, InvokeAgentChildRunStateDeltaSchema, publishInvokeAgentChildRunProgress, } from "./invoke-agent-child-runs.js";
|
|
93
95
|
export { type HostedChildLifecycleAdapter, type HostedChildLifecycleRunnerOptions, type HostedChildLifecycleRunResult, type HostedChildLifecycleTerminalState, runHostedChildLifecycle, } from "./hosted-child-lifecycle.js";
|
|
94
96
|
export { type HostedLifecycleAdapter, type HostedLifecycleExecution, type HostedLifecycleRunnerOptions, type HostedLifecycleRunResult, type HostedLifecycleTerminalState, runHostedLifecycle, } from "./hosted-lifecycle.js";
|
|
95
97
|
export { mergeToolCallInput, mergeToolInputDelta, parseDataStreamSseEvents, parseToolInputObject, streamDataStreamEvents, stripLeadingEmptyObjectPlaceholder, } from "./data-stream.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI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BAAgB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,YAAY,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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qB,EACrB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
package/esm/src/agent/index.js
CHANGED
|
@@ -88,7 +88,9 @@ export { AgUiRuntimeContextItemSchema, AgUiRuntimeInjectedToolSchema, AgUiRuntim
|
|
|
88
88
|
export { normalizeAgUiRuntimeMessages } from "./ag-ui-runtime-support.js";
|
|
89
89
|
export { buildAgUiBrowserFinalizeResponse, createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
|
|
90
90
|
export { createAgUiBrowserResponseStream, } from "./ag-ui-browser-response-stream.js";
|
|
91
|
-
export {
|
|
91
|
+
export { bootstrapConversationAgentRun, ConversationMessageRecordSchema, ConversationRecordSchema, createConversationMessage, createConversationRecord, ensureConversationProjectLink, fetchConversationRecord, } from "./conversation-bootstrap.js";
|
|
92
|
+
export { appendConversationRunEvents, AppendConversationRunEventsError, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, ConversationRunStatusSchema, ConversationRunTargetsSchema, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, parseAppendConversationRunEventsErrorBody, resolveConversationRunTargets, } from "./durable.js";
|
|
93
|
+
export { buildInvokeAgentChildRunLifecycleCustomEvent, buildInvokeAgentChildRunProgressEvents, buildInvokeAgentChildRunStateDelta, InvokeAgentChildRunLifecycleCustomEventSchema, InvokeAgentChildRunLifecycleValueSchema, InvokeAgentChildRunStateDeltaSchema, publishInvokeAgentChildRunProgress, } from "./invoke-agent-child-runs.js";
|
|
92
94
|
export { runHostedChildLifecycle, } from "./hosted-child-lifecycle.js";
|
|
93
95
|
export { runHostedLifecycle, } from "./hosted-lifecycle.js";
|
|
94
96
|
export { mergeToolCallInput, mergeToolInputDelta, parseDataStreamSseEvents, parseToolInputObject, streamDataStreamEvents, stripLeadingEmptyObjectPlaceholder, } from "./data-stream.js";
|