veryfront 0.1.1011 → 0.1.1013
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.js +1 -1
- package/esm/src/agent/hosted/chat-execution-runtime.d.ts +4 -0
- package/esm/src/agent/hosted/chat-execution-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-execution-runtime.js +54 -2
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.d.ts +4 -0
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.js +21 -1
- package/esm/src/agent/hosted/prepared-chat-execution.d.ts +1 -1
- package/esm/src/agent/hosted/prepared-chat-execution.d.ts.map +1 -1
- package/esm/src/agent/hosted/prepared-chat-execution.js +6 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -48,6 +48,8 @@ export interface CreateHostedChatExecutionRuntimeBootstrapInput {
|
|
|
48
48
|
abortSignal: AbortSignal;
|
|
49
49
|
traceStream?: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
50
50
|
createRootStreamWatchdog?: () => HostedChatExecutionRootStreamWatchdog;
|
|
51
|
+
streamBootstrapKeepaliveIntervalMs?: number;
|
|
52
|
+
streamBootstrapTimeoutMs?: number;
|
|
51
53
|
}
|
|
52
54
|
/** Input payload for create hosted chat execution runtime. */
|
|
53
55
|
export interface CreateHostedChatExecutionRuntimeInput {
|
|
@@ -92,6 +94,8 @@ export interface CreateBootstrappedHostedChatExecutionRuntimeInput {
|
|
|
92
94
|
terminalErrorCode?: string;
|
|
93
95
|
incompleteToolCallsPartErrorText?: string;
|
|
94
96
|
createRootStreamWatchdog?: CreateHostedChatExecutionRuntimeBootstrapInput["createRootStreamWatchdog"];
|
|
97
|
+
streamBootstrapKeepaliveIntervalMs?: CreateHostedChatExecutionRuntimeBootstrapInput["streamBootstrapKeepaliveIntervalMs"];
|
|
98
|
+
streamBootstrapTimeoutMs?: CreateHostedChatExecutionRuntimeBootstrapInput["streamBootstrapTimeoutMs"];
|
|
95
99
|
createTerminalAdapter?: CreateHostedRootRunLifecycleRuntimeAdapterInput["createTerminalAdapter"];
|
|
96
100
|
}
|
|
97
101
|
/** Public API contract for bootstrapped hosted chat execution runtime. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-execution-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-execution-runtime.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAGL,KAAK,+CAA+C,EACpD,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAE9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACL,KAAK,oCAAoC,EAK1C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAC/F,Y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AC,CAAC,CA4BhG;AAED,4DAA4D;AAC5D,wBAAgB,0CAA0C,CAAC,KAAK,EAAE;IAChE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,mCAAmC,CAAC;IACtD,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gCAAgC,EAAE,MAAM,CAAC;CAC1C,GAAG,CACF,SAAS,EAAE,OAAO,KACf,OAAO,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,CA2BjF;AAmJD,4CAA4C;AAC5C,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,qCAAqC,GAC3C,0BAA0B,CAwH5B"}
|
|
@@ -6,9 +6,11 @@ import { dispatchConversationHostedStreamErrorState, dispatchConversationHostedT
|
|
|
6
6
|
import { createHostedMirroredUiStream, createMirroredToolChunkState, } from "../streaming/mirrored-tool-chunk-state.js";
|
|
7
7
|
import { finalizeHostedDetached, finalizeHostedResponse, } from "./stream-finalization.js";
|
|
8
8
|
import { getEmptyHostedFinalizedMessageTerminalError, getHostedStreamErrorText, shouldFailEmptyHostedFinalizedMessage, } from "./stream-terminal-error.js";
|
|
9
|
-
import { createChatStreamWatchdog } from "../../chat/stream-watchdog.js";
|
|
9
|
+
import { createChatStreamWatchdog, DEFAULT_CHAT_STREAM_TOOL_RUNNING_TIMEOUT_MS, } from "../../chat/stream-watchdog.js";
|
|
10
10
|
const INCOMPLETE_TOOL_CALLS_PART_ERROR_TEXT = "Assistant ended before tool execution completed";
|
|
11
11
|
const FINALIZATION_TERMINAL_STATE_FALLBACK_MODEL_ID = "";
|
|
12
|
+
const DEFAULT_STREAM_BOOTSTRAP_KEEPALIVE_INTERVAL_MS = 30_000;
|
|
13
|
+
const DEFAULT_STREAM_BOOTSTRAP_TIMEOUT_MS = DEFAULT_CHAT_STREAM_TOOL_RUNNING_TIMEOUT_MS;
|
|
12
14
|
/** State for to hosted chat execution final. */
|
|
13
15
|
export function toHostedChatExecutionFinalState(input) {
|
|
14
16
|
return toConversationHostedTerminalState({
|
|
@@ -37,6 +39,42 @@ function createHostedChatExecutionCleanup(cleanup) {
|
|
|
37
39
|
function createDefaultHostedChatExecutionRootStreamWatchdog() {
|
|
38
40
|
return createChatStreamWatchdog();
|
|
39
41
|
}
|
|
42
|
+
function resolveStreamBootstrapKeepaliveIntervalMs(intervalMs) {
|
|
43
|
+
if (typeof intervalMs !== "number" || !Number.isFinite(intervalMs) || intervalMs <= 0) {
|
|
44
|
+
return DEFAULT_STREAM_BOOTSTRAP_KEEPALIVE_INTERVAL_MS;
|
|
45
|
+
}
|
|
46
|
+
return intervalMs;
|
|
47
|
+
}
|
|
48
|
+
function resolveStreamBootstrapTimeoutMs(timeoutMs) {
|
|
49
|
+
if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
50
|
+
return DEFAULT_STREAM_BOOTSTRAP_TIMEOUT_MS;
|
|
51
|
+
}
|
|
52
|
+
return timeoutMs;
|
|
53
|
+
}
|
|
54
|
+
function createStreamBootstrapWatchdogKeepalive(input) {
|
|
55
|
+
const intervalMs = resolveStreamBootstrapKeepaliveIntervalMs(input.intervalMs);
|
|
56
|
+
const timeoutMs = resolveStreamBootstrapTimeoutMs(input.timeoutMs);
|
|
57
|
+
const timeoutController = new AbortController();
|
|
58
|
+
const interval = globalThis.setInterval(() => {
|
|
59
|
+
input.rootStreamWatchdog.observe({
|
|
60
|
+
type: "message-metadata",
|
|
61
|
+
messageMetadata: {
|
|
62
|
+
createdAt: new Date().toISOString(),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}, intervalMs);
|
|
66
|
+
const timeout = globalThis.setTimeout(() => {
|
|
67
|
+
timeoutController.abort(new DOMException(`Chat stream bootstrap timeout after ${timeoutMs}ms`, "AbortError"));
|
|
68
|
+
clearInterval(interval);
|
|
69
|
+
}, timeoutMs);
|
|
70
|
+
return {
|
|
71
|
+
signal: timeoutController.signal,
|
|
72
|
+
dispose: () => {
|
|
73
|
+
clearInterval(interval);
|
|
74
|
+
clearTimeout(timeout);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
40
78
|
function traceHostedChatRuntimeStream(traceStream, operation) {
|
|
41
79
|
if (!traceStream) {
|
|
42
80
|
return operation();
|
|
@@ -53,7 +91,16 @@ export async function createHostedChatExecutionRuntimeBootstrap(input) {
|
|
|
53
91
|
const rootStreamWatchdog = input.createRootStreamWatchdog
|
|
54
92
|
? input.createRootStreamWatchdog()
|
|
55
93
|
: createDefaultHostedChatExecutionRootStreamWatchdog();
|
|
56
|
-
const
|
|
94
|
+
const bootstrapKeepalive = createStreamBootstrapWatchdogKeepalive({
|
|
95
|
+
rootStreamWatchdog,
|
|
96
|
+
intervalMs: input.streamBootstrapKeepaliveIntervalMs,
|
|
97
|
+
timeoutMs: input.streamBootstrapTimeoutMs,
|
|
98
|
+
});
|
|
99
|
+
const streamAbortSignal = AbortSignal.any([
|
|
100
|
+
input.abortSignal,
|
|
101
|
+
rootStreamWatchdog.signal,
|
|
102
|
+
bootstrapKeepalive.signal,
|
|
103
|
+
]);
|
|
57
104
|
let streamResult;
|
|
58
105
|
try {
|
|
59
106
|
streamResult = await traceHostedChatRuntimeStream(input.traceStream, () => input.agent.stream({
|
|
@@ -65,6 +112,9 @@ export async function createHostedChatExecutionRuntimeBootstrap(input) {
|
|
|
65
112
|
rootStreamWatchdog.dispose();
|
|
66
113
|
throw error;
|
|
67
114
|
}
|
|
115
|
+
finally {
|
|
116
|
+
bootstrapKeepalive.dispose();
|
|
117
|
+
}
|
|
68
118
|
return {
|
|
69
119
|
cleanup,
|
|
70
120
|
lifecycleAdapter: input.lifecycleAdapter,
|
|
@@ -100,6 +150,8 @@ async function createBootstrappedHostedChatRuntime(input, agentRunSpan) {
|
|
|
100
150
|
...(input.createRootStreamWatchdog
|
|
101
151
|
? { createRootStreamWatchdog: input.createRootStreamWatchdog }
|
|
102
152
|
: {}),
|
|
153
|
+
streamBootstrapKeepaliveIntervalMs: input.streamBootstrapKeepaliveIntervalMs,
|
|
154
|
+
streamBootstrapTimeoutMs: input.streamBootstrapTimeoutMs,
|
|
103
155
|
});
|
|
104
156
|
}
|
|
105
157
|
catch (error) {
|
|
@@ -9,6 +9,8 @@ export declare const VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV = "VERYFRONT_CHAT_ST
|
|
|
9
9
|
type ChatStreamWatchdogEnv = Record<string, string | undefined>;
|
|
10
10
|
/** Resolve Veryfront Cloud chat stream watchdog timeout overrides from environment values. */
|
|
11
11
|
export declare function resolveVeryfrontCloudChatStreamWatchdogOptions(env?: ChatStreamWatchdogEnv): Pick<ChatStreamWatchdogOptions, "idleTimeoutMs" | "toolRunningTimeoutMs">;
|
|
12
|
+
/** Derive hosted chat bootstrap watchdog options from resolved root stream watchdog options. */
|
|
13
|
+
export declare function resolveVeryfrontCloudStreamBootstrapWatchdogOptions(options: Pick<ChatStreamWatchdogOptions, "idleTimeoutMs" | "toolRunningTimeoutMs">): Pick<PreparedHostedChatExecutionRuntimeOptions, "streamBootstrapKeepaliveIntervalMs" | "streamBootstrapTimeoutMs">;
|
|
12
14
|
/** Input payload for create Veryfront Cloud prepared hosted chat execution runtime options. */
|
|
13
15
|
export type CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput = {
|
|
14
16
|
apiUrl: string | URL;
|
|
@@ -18,6 +20,8 @@ export type CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput =
|
|
|
18
20
|
traceStream?: <TResult>(operation: () => Promise<TResult>) => Promise<TResult>;
|
|
19
21
|
setActiveSpanAttributes?: (attributes: AgentTraceAttributes) => void;
|
|
20
22
|
createRootStreamWatchdog?: PreparedHostedChatExecutionRuntimeOptions["createRootStreamWatchdog"];
|
|
23
|
+
streamBootstrapKeepaliveIntervalMs?: PreparedHostedChatExecutionRuntimeOptions["streamBootstrapKeepaliveIntervalMs"];
|
|
24
|
+
streamBootstrapTimeoutMs?: PreparedHostedChatExecutionRuntimeOptions["streamBootstrapTimeoutMs"];
|
|
21
25
|
};
|
|
22
26
|
/** Options accepted by create Veryfront Cloud prepared hosted chat execution runtime. */
|
|
23
27
|
export declare function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(input: CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput): PreparedHostedChatExecutionRuntimeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-prepared-chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-prepared-chat-execution-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,8BAA8B,CAAC;AAE9F,2DAA2D;AAC3D,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAC9F,kEAAkE;AAClE,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAE9F,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAWhE,8FAA8F;AAC9F,wBAAgB,8CAA8C,CAC5D,GAAG,GAAE,qBAGJ,GACA,IAAI,CAAC,yBAAyB,EAAE,eAAe,GAAG,sBAAsB,CAAC,CAQ3E;AAED,+FAA+F;AAC/F,MAAM,MAAM,kEAAkE,GAAG;IAC/E,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAM,EAAE,yCAAyC,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,gCAAgC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChG,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrE,wBAAwB,CAAC,EAAE,yCAAyC,CAAC,0BAA0B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-prepared-chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-prepared-chat-execution-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,8BAA8B,CAAC;AAE9F,2DAA2D;AAC3D,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAC9F,kEAAkE;AAClE,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAE9F,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAWhE,8FAA8F;AAC9F,wBAAgB,8CAA8C,CAC5D,GAAG,GAAE,qBAGJ,GACA,IAAI,CAAC,yBAAyB,EAAE,eAAe,GAAG,sBAAsB,CAAC,CAQ3E;AAED,gGAAgG;AAChG,wBAAgB,mDAAmD,CACjE,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,eAAe,GAAG,sBAAsB,CAAC,GACjF,IAAI,CACL,yCAAyC,EACzC,oCAAoC,GAAG,0BAA0B,CAClE,CAaA;AAED,+FAA+F;AAC/F,MAAM,MAAM,kEAAkE,GAAG;IAC/E,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAM,EAAE,yCAAyC,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,gCAAgC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChG,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrE,wBAAwB,CAAC,EAAE,yCAAyC,CAAC,0BAA0B,CAAC,CAAC;IACjG,kCAAkC,CAAC,EAAE,yCAAyC,CAC5E,oCAAoC,CACrC,CAAC;IACF,wBAAwB,CAAC,EAAE,yCAAyC,CAClE,0BAA0B,CAC3B,CAAC;CACH,CAAC;AAEF,yFAAyF;AACzF,wBAAgB,6DAA6D,CAC3E,KAAK,EAAE,kEAAkE,GACxE,yCAAyC,CA0B3C"}
|
|
@@ -25,8 +25,24 @@ export function resolveVeryfrontCloudChatStreamWatchdogOptions(env = {
|
|
|
25
25
|
...(toolRunningTimeoutMs !== undefined ? { toolRunningTimeoutMs } : {}),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
/** Derive hosted chat bootstrap watchdog options from resolved root stream watchdog options. */
|
|
29
|
+
export function resolveVeryfrontCloudStreamBootstrapWatchdogOptions(options) {
|
|
30
|
+
const streamBootstrapKeepaliveIntervalMs = typeof options.idleTimeoutMs === "number"
|
|
31
|
+
? Math.max(1, Math.floor(options.idleTimeoutMs / 2))
|
|
32
|
+
: undefined;
|
|
33
|
+
return {
|
|
34
|
+
...(streamBootstrapKeepaliveIntervalMs !== undefined
|
|
35
|
+
? { streamBootstrapKeepaliveIntervalMs }
|
|
36
|
+
: {}),
|
|
37
|
+
...(options.toolRunningTimeoutMs !== undefined
|
|
38
|
+
? { streamBootstrapTimeoutMs: options.toolRunningTimeoutMs }
|
|
39
|
+
: {}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
28
42
|
/** Options accepted by create Veryfront Cloud prepared hosted chat execution runtime. */
|
|
29
43
|
export function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(input) {
|
|
44
|
+
const watchdogOptions = resolveVeryfrontCloudChatStreamWatchdogOptions();
|
|
45
|
+
const streamBootstrapOptions = resolveVeryfrontCloudStreamBootstrapWatchdogOptions(watchdogOptions);
|
|
30
46
|
return {
|
|
31
47
|
apiUrl: input.apiUrl,
|
|
32
48
|
tracer: input.tracer,
|
|
@@ -35,10 +51,14 @@ export function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(in
|
|
|
35
51
|
traceStream: input.traceStream,
|
|
36
52
|
createRootStreamWatchdog: input.createRootStreamWatchdog ??
|
|
37
53
|
(() => createChatStreamWatchdog({
|
|
38
|
-
...
|
|
54
|
+
...watchdogOptions,
|
|
39
55
|
setTimeoutFn: dntShim.dntGlobalThis.setTimeout,
|
|
40
56
|
clearTimeoutFn: globalThis.clearTimeout,
|
|
41
57
|
})),
|
|
58
|
+
streamBootstrapKeepaliveIntervalMs: input.streamBootstrapKeepaliveIntervalMs ??
|
|
59
|
+
streamBootstrapOptions.streamBootstrapKeepaliveIntervalMs,
|
|
60
|
+
streamBootstrapTimeoutMs: input.streamBootstrapTimeoutMs ??
|
|
61
|
+
streamBootstrapOptions.streamBootstrapTimeoutMs,
|
|
42
62
|
logger: input.logger,
|
|
43
63
|
setActiveSpanAttributes: input.setActiveSpanAttributes,
|
|
44
64
|
};
|
|
@@ -6,7 +6,7 @@ export type PreparedHostedChatExecution = Omit<CreateBootstrappedHostedChatExecu
|
|
|
6
6
|
runtimeKind?: string;
|
|
7
7
|
};
|
|
8
8
|
/** Options accepted by prepared hosted chat execution runtime. */
|
|
9
|
-
export type PreparedHostedChatExecutionRuntimeOptions = Pick<CreateBootstrappedHostedChatExecutionRuntimeInput, "tracer" | "resolveProvider" | "traceStream" | "logger" | "spanName" | "terminalErrorCode" | "incompleteToolCallsPartErrorText" | "createRootStreamWatchdog" | "createTerminalAdapter"> & {
|
|
9
|
+
export type PreparedHostedChatExecutionRuntimeOptions = Pick<CreateBootstrappedHostedChatExecutionRuntimeInput, "tracer" | "resolveProvider" | "traceStream" | "logger" | "spanName" | "terminalErrorCode" | "incompleteToolCallsPartErrorText" | "createRootStreamWatchdog" | "streamBootstrapKeepaliveIntervalMs" | "streamBootstrapTimeoutMs" | "createTerminalAdapter"> & {
|
|
10
10
|
apiUrl: string | URL;
|
|
11
11
|
trace?: <TResult>(operationName: string, operation: () => Promise<TResult>) => Promise<TResult>;
|
|
12
12
|
setActiveSpanAttributes?: (attributes: AgentTraceAttributes) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-chat-execution.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/prepared-chat-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAGL,KAAK,iDAAiD,EACvD,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GACnC,IAAI,CACJ,iDAAiD,EAC/C,QAAQ,GACR,aAAa,GACb,mBAAmB,GACnB,QAAQ,GACR,iBAAiB,GACjB,aAAa,GACb,QAAQ,GACR,UAAU,GACV,mBAAmB,GACnB,kCAAkC,GAClC,0BAA0B,GAC1B,uBAAuB,CAC1B,GACC;IACA,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEJ,kEAAkE;AAClE,MAAM,MAAM,yCAAyC,GACjD,IAAI,CACJ,iDAAiD,EAC/C,QAAQ,GACR,iBAAiB,GACjB,aAAa,GACb,QAAQ,GACR,UAAU,GACV,mBAAmB,GACnB,kCAAkC,GAClC,0BAA0B,GAC1B,uBAAuB,CAC1B,GACC;IACA,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChG,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACtE,CAAC;AAEJ,+DAA+D;AAC/D,MAAM,MAAM,sCAAsC,CAChD,UAAU,SAAS,2BAA2B,GAAG,2BAA2B,IAC1E,UAAU,GAAG;IACf,kBAAkB,EAAE,WAAW,CAAC;IAChC,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,wCAAwC,CAClD,UAAU,SAAS,2BAA2B,GAAG,2BAA2B,IAC1E,UAAU,GAAG;IACf,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"prepared-chat-execution.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/prepared-chat-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAGL,KAAK,iDAAiD,EACvD,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GACnC,IAAI,CACJ,iDAAiD,EAC/C,QAAQ,GACR,aAAa,GACb,mBAAmB,GACnB,QAAQ,GACR,iBAAiB,GACjB,aAAa,GACb,QAAQ,GACR,UAAU,GACV,m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ACP,SAAS,EAAE,wCAAwC,CAAC,UAAU,CAAC,CAAC;IAChE,OAAO,EAAE,yCAAyC,CAAC;CACpD,GAAG,OAAO,CAAC,IAAI,CAAC,CAyChB"}
|
|
@@ -28,6 +28,12 @@ function createBootstrappedPreparedHostedChatExecutionRuntime(input) {
|
|
|
28
28
|
terminalErrorCode: input.runtime.terminalErrorCode,
|
|
29
29
|
incompleteToolCallsPartErrorText: input.runtime.incompleteToolCallsPartErrorText,
|
|
30
30
|
createRootStreamWatchdog: input.runtime.createRootStreamWatchdog,
|
|
31
|
+
...(input.runtime.streamBootstrapKeepaliveIntervalMs !== undefined
|
|
32
|
+
? { streamBootstrapKeepaliveIntervalMs: input.runtime.streamBootstrapKeepaliveIntervalMs }
|
|
33
|
+
: {}),
|
|
34
|
+
...(input.runtime.streamBootstrapTimeoutMs !== undefined
|
|
35
|
+
? { streamBootstrapTimeoutMs: input.runtime.streamBootstrapTimeoutMs }
|
|
36
|
+
: {}),
|
|
31
37
|
createTerminalAdapter: input.runtime.createTerminalAdapter,
|
|
32
38
|
...(input.responseMessageId ? { responseMessageId: input.responseMessageId } : {}),
|
|
33
39
|
});
|