veryfront 0.1.478 → 0.1.480

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.478",
3
+ "version": "0.1.480",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -0,0 +1,84 @@
1
+ import type { HostedSandboxToolsOptions, HostedSandboxToolsResult } from "../sandbox/index.js";
2
+ import { createToolsFromRemoteDefinitions, type HostToolSet, type RemoteMCPToolSourceConfig, type RemoteToolSource, type ToolExecutionContext } from "../tool/index.js";
3
+ import { z } from "zod";
4
+ import type { ChildRunExecutionResult } from "./child-run-execution-snapshot.js";
5
+ import type { ConversationRunEvent } from "./conversation-run-events.js";
6
+ import { prepareDefaultHostedChildForkSandboxToolSources } from "./hosted-child-fork-tool-sources.js";
7
+ import { type MutableAgentProjectContext } from "./project-context.js";
8
+ import { type HostedDurableChildInvokeResult } from "./hosted-durable-child-fork-execution.js";
9
+ import { type HostedChildForkRuntimeConfig } from "./hosted-child-tool-input.js";
10
+ import type { RuntimeClientProfile } from "./runtime-client-profile.js";
11
+ export type DefaultHostedInvokeAgentContext = MutableAgentProjectContext & {
12
+ authToken: string;
13
+ clientProfile?: RuntimeClientProfile | null;
14
+ model?: string;
15
+ conversationId?: string;
16
+ parentRunId?: string;
17
+ parentMessageId?: string;
18
+ publishParentRunEvents?: (events: ConversationRunEvent[]) => Promise<void> | void;
19
+ availableToolNames?: string[];
20
+ steeringRevision?: number;
21
+ };
22
+ export type DefaultHostedInvokeAgentConfig = {
23
+ apiUrl: string;
24
+ apiMcpUrl: string;
25
+ studioMcpUrl?: string | null;
26
+ enableDurableInvokeAgent?: boolean;
27
+ };
28
+ export type DefaultHostedInvokeAgentLogger = {
29
+ debug(message: string, metadata?: Record<string, unknown>): void;
30
+ info(message: string, metadata?: Record<string, unknown>): void;
31
+ warn(message: string, metadata?: Record<string, unknown>): void;
32
+ error(message: string, metadata?: Record<string, unknown>): void;
33
+ };
34
+ export type DefaultHostedInvokeAgentTraceAttributes = Record<string, string | number | boolean | readonly (string | number | boolean)[] | null | undefined>;
35
+ export type DefaultHostedInvokeAgentTrace = <TResult>(operationName: string, operation: () => TResult) => TResult;
36
+ export type DefaultHostedInvokeAgentToolResult = ChildRunExecutionResult | HostedDurableChildInvokeResult;
37
+ export type DefaultHostedInvokeAgentProjectRefresh<TContext extends DefaultHostedInvokeAgentContext> = (context: TContext) => Promise<void> | void;
38
+ export type DefaultHostedInvokeAgentToolOptions<TContext extends DefaultHostedInvokeAgentContext> = {
39
+ context: TContext;
40
+ getConfig: () => DefaultHostedInvokeAgentConfig;
41
+ logger: DefaultHostedInvokeAgentLogger;
42
+ trace: DefaultHostedInvokeAgentTrace;
43
+ setTraceAttributes: (attributes: DefaultHostedInvokeAgentTraceAttributes) => void;
44
+ createBashTool: HostedSandboxToolsOptions["createBashTool"];
45
+ resolveModelId: (model: string) => string;
46
+ resolveProvider: (modelId: string) => string;
47
+ resolveProviderOptions?: (forkModel: string, thinkingConfig: HostedChildForkRuntimeConfig["thinkingConfig"]) => Record<string, unknown> | undefined;
48
+ shouldRethrowError?: (error: unknown) => boolean;
49
+ buildGlobalTools?: (context: TContext) => HostToolSet;
50
+ refreshProjectSkillIds?: DefaultHostedInvokeAgentProjectRefresh<TContext>;
51
+ defaultModel?: string;
52
+ defaultMaxSteps?: number;
53
+ resolveChildAgentId?: (input: DefaultHostedInvokeAgentInput) => string;
54
+ createHostedSandboxTools?: (input: HostedSandboxToolsOptions) => Promise<HostedSandboxToolsResult>;
55
+ createRemoteToolSource?: (config: RemoteMCPToolSourceConfig) => RemoteToolSource;
56
+ createToolsFromRemoteDefinitions?: typeof createToolsFromRemoteDefinitions;
57
+ createLiveStudioTools?: Parameters<typeof prepareDefaultHostedChildForkSandboxToolSources>[0]["createLiveStudioTools"];
58
+ };
59
+ export declare const defaultHostedInvokeAgentSelectionSchema: z.ZodObject<{
60
+ agent_id: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>;
62
+ export declare const defaultHostedInvokeAgentInputSchema: z.ZodObject<{
63
+ description: z.ZodString;
64
+ prompt: z.ZodString;
65
+ project_id: z.ZodOptional<z.ZodString>;
66
+ tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
+ model: z.ZodOptional<z.ZodString>;
68
+ thinking: z.ZodOptional<z.ZodNumber>;
69
+ max_steps: z.ZodOptional<z.ZodNumber>;
70
+ agent_id: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ export type DefaultHostedInvokeAgentInput = z.infer<typeof defaultHostedInvokeAgentInputSchema>;
73
+ export declare function executeDefaultHostedInvokeAgentTool<TContext extends DefaultHostedInvokeAgentContext>(options: DefaultHostedInvokeAgentToolOptions<TContext>, input: DefaultHostedInvokeAgentInput, childAgentId: string, executionContext?: ToolExecutionContext): Promise<DefaultHostedInvokeAgentToolResult>;
74
+ export declare function createDefaultHostedInvokeAgentTool<TContext extends DefaultHostedInvokeAgentContext>(options: DefaultHostedInvokeAgentToolOptions<TContext>): import("../tool/types.js").Tool<{
75
+ description: string;
76
+ prompt: string;
77
+ project_id?: string | undefined;
78
+ tools?: string[] | undefined;
79
+ model?: string | undefined;
80
+ thinking?: number | undefined;
81
+ max_steps?: number | undefined;
82
+ agent_id?: string | undefined;
83
+ }, DefaultHostedInvokeAgentToolResult>;
84
+ //# sourceMappingURL=default-hosted-invoke-agent-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-hosted-invoke-agent-tool.d.ts","sourceRoot":"","sources":["../../../src/src/agent/default-hosted-invoke-agent-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAEL,gCAAgC,EAChC,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B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EAEhD,OAAO,EAAE,mCAAmC,CAAC,QAAQ,CAAC,EACtD,KAAK,EAAE,6BAA6B,EACpC,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,oBAAoB,GACtC,OAAO,CAAC,kCAAkC,CAAC,CA6J7C;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,SAAS,+BAA+B,EAEhD,OAAO,EAAE,mCAAmC,CAAC,QAAQ,CAAC;;;;;;;;;uCAoBvD"}
@@ -0,0 +1,325 @@
1
+ import * as dntShim from "../../_dnt.shims.js";
2
+ import { createHostedSandboxTools } from "../sandbox/index.js";
3
+ import { createRemoteMCPToolSource, createToolsFromRemoteDefinitions, sleepTool, } from "../tool/index.js";
4
+ import { z } from "zod";
5
+ import { buildExecuteToolTraceAttributes } from "./agent-trace-attributes.js";
6
+ import { isChildRunAbortError, throwIfChildRunAborted } from "./child-run-execution-support.js";
7
+ import { createConversationChildLifecycleAdapter } from "./conversation-hosted-lifecycle.js";
8
+ import { bootstrapHostedChildRun } from "./hosted-child-bootstrap.js";
9
+ import { createHostedChildExecutionLogWriter } from "./hosted-child-execution-logging.js";
10
+ import { startHostedChildForkRuntimeWithHostTools } from "./hosted-child-fork-runtime-start.js";
11
+ import { prepareDefaultHostedChildForkSandboxToolSources, } from "./hosted-child-fork-tool-sources.js";
12
+ import { executeHostedChildForkToolInput } from "./hosted-child-fork-execution-runner.js";
13
+ import { createHostedChildInvokeTool } from "./hosted-child-invoke-tool.js";
14
+ import { runHostedChildExecutionLifecycle, shouldSkipHostedChildTerminalPersistence, } from "./hosted-child-lifecycle.js";
15
+ import { createLiveStudioMcpTools } from "./live-studio-mcp-tools.js";
16
+ import { applyAgentProjectContextChange, } from "./project-context.js";
17
+ import { buildHostedDurableChildInvokeFailureResult, createHostedDurableChildInvokeTraceRecorder, executeHostedDurableChildFork, executeHostedLocalChildInvoke, } from "./hosted-durable-child-fork-execution.js";
18
+ import { DEFAULT_HOSTED_CHILD_AGENT_ID, hostedChildForkToolInputSchema, } from "./hosted-child-tool-input.js";
19
+ import { prepareDefaultHostedChildForkToolAssembly } from "./hosted-child-requested-tools.js";
20
+ import { withRootOwnedChildResultHint } from "./conversation-delegation-policy.js";
21
+ export const defaultHostedInvokeAgentSelectionSchema = z.object({
22
+ agent_id: z.string().optional().describe("Built-in child agent type or user-defined agent id."),
23
+ });
24
+ export const defaultHostedInvokeAgentInputSchema = hostedChildForkToolInputSchema.extend(defaultHostedInvokeAgentSelectionSchema.shape);
25
+ const DEFAULT_USER_AGENT_MODEL = "opus";
26
+ const DEFAULT_USER_AGENT_MAX_STEPS = 80;
27
+ const DURABLE_INVOKE_CONTEXT_UNAVAILABLE = "DURABLE_INVOKE_CONTEXT_UNAVAILABLE";
28
+ const DURABLE_INVOKE_SETUP_FAILED = "DURABLE_INVOKE_SETUP_FAILED";
29
+ function resolveDefaultChildAgentId(input) {
30
+ return input.agent_id?.trim() || DEFAULT_HOSTED_CHILD_AGENT_ID;
31
+ }
32
+ function resolveChildAgentId(options, input) {
33
+ return options.resolveChildAgentId?.(input) ?? resolveDefaultChildAgentId(input);
34
+ }
35
+ async function refreshProjectSkillIds(options) {
36
+ await options.refreshProjectSkillIds?.(options.context);
37
+ }
38
+ async function applyRequestedProjectId(options, projectId) {
39
+ if (!applyAgentProjectContextChange(options.context, projectId)) {
40
+ return;
41
+ }
42
+ await refreshProjectSkillIds(options);
43
+ }
44
+ async function prepareForkToolSources(options, config, abortSignal) {
45
+ throwIfChildRunAborted(abortSignal);
46
+ const globalTools = {
47
+ ...(options.buildGlobalTools?.(options.context) ?? {}),
48
+ sleep: sleepTool,
49
+ };
50
+ return prepareDefaultHostedChildForkSandboxToolSources({
51
+ authToken: options.context.authToken,
52
+ apiUrl: config.apiUrl,
53
+ apiMcpUrl: config.apiMcpUrl,
54
+ studioMcpUrl: config.studioMcpUrl,
55
+ clientProfile: options.context.clientProfile,
56
+ getProjectId: () => options.context.projectId || null,
57
+ conversationId: options.context.conversationId,
58
+ globalTools,
59
+ abortSignal,
60
+ isAbortError: isChildRunAbortError,
61
+ logger: options.logger,
62
+ createBashTool: options.createBashTool,
63
+ createHostedSandboxTools: options.createHostedSandboxTools ?? createHostedSandboxTools,
64
+ createLiveStudioTools: options.createLiveStudioTools ?? createLiveStudioMcpTools,
65
+ createRemoteToolSource: options.createRemoteToolSource ?? createRemoteMCPToolSource,
66
+ createToolsFromRemoteDefinitions: options.createToolsFromRemoteDefinitions ??
67
+ createToolsFromRemoteDefinitions,
68
+ onConfirmedStudioProjectSwitch: (projectId) => applyRequestedProjectId(options, projectId),
69
+ });
70
+ }
71
+ async function prepareForkToolAssembly(options, config, input) {
72
+ const toolAssembly = await prepareDefaultHostedChildForkToolAssembly({
73
+ prepareToolSources: () => prepareForkToolSources(options, config, input.abortSignal),
74
+ provider: input.provider,
75
+ forkModel: input.forkModel,
76
+ effectivePrompt: input.effectivePrompt,
77
+ requestedTools: input.requestedTools,
78
+ activeProjectId: options.context.projectId || null,
79
+ activeBranchId: options.context.branchId,
80
+ logger: options.logger,
81
+ onSteeringMutation: async (mutation) => {
82
+ if (mutation.instructionsChanged || mutation.skillsChanged) {
83
+ options.context.steeringRevision = (options.context.steeringRevision ?? 0) + 1;
84
+ }
85
+ if (mutation.skillsChanged) {
86
+ await refreshProjectSkillIds(options);
87
+ }
88
+ },
89
+ });
90
+ if (toolAssembly.ok) {
91
+ options.context.availableToolNames = toolAssembly.availableToolNames;
92
+ }
93
+ return toolAssembly;
94
+ }
95
+ function buildInstrumentation(options) {
96
+ return {
97
+ trace: options.trace,
98
+ setTraceAttributes: options.setTraceAttributes,
99
+ buildToolTraceAttributes: ({ toolName, toolCallId }) => buildExecuteToolTraceAttributes({
100
+ toolName,
101
+ toolCallId,
102
+ }),
103
+ tracePart: async ({ partType }) => {
104
+ await options.trace("invoke_agent.childStreamPart", async () => {
105
+ options.setTraceAttributes({
106
+ "conversation.id": options.context.conversationId ?? "unknown",
107
+ "run.id": options.context.parentRunId ?? "unknown",
108
+ "stream.part.type": partType,
109
+ });
110
+ });
111
+ },
112
+ debug: (message, metadata) => options.logger.debug(message, metadata),
113
+ warn: (message, metadata) => options.logger.warn(message, metadata),
114
+ error: (message, metadata) => options.logger.error(message, metadata),
115
+ };
116
+ }
117
+ async function executeForkTask(options, input, execution, runtimeOptions = {}) {
118
+ const config = options.getConfig();
119
+ const instrumentation = buildInstrumentation(options);
120
+ const writeHostedChildExecutionLog = createHostedChildExecutionLogWriter(options.logger);
121
+ return executeHostedChildForkToolInput({
122
+ apiUrl: config.apiUrl,
123
+ authToken: options.context.authToken,
124
+ projectId: options.context.projectId || null,
125
+ forkInput: input,
126
+ toolCallId: execution.toolCallId,
127
+ contextModel: options.context.model,
128
+ defaultModel: options.defaultModel ?? DEFAULT_USER_AGENT_MODEL,
129
+ defaultMaxSteps: options.defaultMaxSteps ?? DEFAULT_USER_AGENT_MAX_STEPS,
130
+ resolveModelId: options.resolveModelId,
131
+ resolveProvider: options.resolveProvider,
132
+ onRequestedProjectId: (projectId) => applyRequestedProjectId(options, projectId),
133
+ onRuntimeConfig: (runtimeConfig) => {
134
+ options.logger.info("Starting child fork", {
135
+ conversationId: options.context.conversationId,
136
+ parentRunId: options.context.parentRunId,
137
+ description: runtimeConfig.description,
138
+ kind: "invoke_agent",
139
+ model: runtimeConfig.forkModel,
140
+ maxSteps: runtimeConfig.maxSteps,
141
+ requestedTools: runtimeConfig.requestedTools?.length,
142
+ });
143
+ },
144
+ prepareToolAssembly: ({ runtimeConfig, requestedTools, abortSignal }) => prepareForkToolAssembly(options, config, {
145
+ provider: runtimeConfig.provider,
146
+ forkModel: runtimeConfig.forkModel,
147
+ effectivePrompt: runtimeConfig.effectivePrompt,
148
+ requestedTools,
149
+ abortSignal,
150
+ }),
151
+ resolveProviderOptions: options.resolveProviderOptions,
152
+ forkContext: options.context,
153
+ abortSignal: execution.abortSignal,
154
+ durableChildRun: runtimeOptions.durableChildRun,
155
+ conversationId: options.context.conversationId,
156
+ parentRunId: options.context.parentRunId,
157
+ kind: "invoke_agent",
158
+ onSettled: runtimeOptions.onSettled,
159
+ logger: options.logger,
160
+ pendingToolLogWriter: options.logger,
161
+ writeLog: writeHostedChildExecutionLog,
162
+ startRuntime: startHostedChildForkRuntimeWithHostTools,
163
+ shouldRethrowError: options.shouldRethrowError,
164
+ instrumentation,
165
+ });
166
+ }
167
+ function getToolCallId(executionContext) {
168
+ return typeof executionContext?.toolCallId === "string" && executionContext.toolCallId.length > 0
169
+ ? executionContext.toolCallId
170
+ : `invoke_agent-${dntShim.crypto.randomUUID()}`;
171
+ }
172
+ function getAbortSignal(executionContext) {
173
+ return executionContext?.abortSignal instanceof AbortSignal
174
+ ? executionContext.abortSignal
175
+ : undefined;
176
+ }
177
+ export async function executeDefaultHostedInvokeAgentTool(options, input, childAgentId, executionContext) {
178
+ let executionSnapshot = null;
179
+ const config = options.getConfig();
180
+ const toolCallId = getToolCallId(executionContext);
181
+ const abortSignal = getAbortSignal(executionContext);
182
+ const durableInvokeRecorder = createHostedDurableChildInvokeTraceRecorder({
183
+ traceBase: {
184
+ conversationId: options.context.conversationId,
185
+ projectId: options.context.projectId,
186
+ runId: options.context.parentRunId,
187
+ toolCallId,
188
+ childAgentId,
189
+ },
190
+ executionFailedCode: "INVOKE_AGENT_FAILED",
191
+ setTraceAttributes: options.setTraceAttributes,
192
+ });
193
+ const executeLocalInvoke = (runtimeOptions = {}) => executeForkTask(options, input, {
194
+ toolCallId,
195
+ abortSignal,
196
+ }, {
197
+ onSettled: (snapshot) => {
198
+ executionSnapshot = snapshot;
199
+ },
200
+ durableChildRun: runtimeOptions.durableChildRun,
201
+ });
202
+ durableInvokeRecorder.annotate();
203
+ if (!config.enableDurableInvokeAgent) {
204
+ return executeHostedLocalChildInvoke({
205
+ forkInput: input,
206
+ abortSignal,
207
+ traceRecorder: durableInvokeRecorder,
208
+ execute: executeLocalInvoke,
209
+ });
210
+ }
211
+ executionSnapshot = null;
212
+ try {
213
+ return await executeHostedDurableChildFork({
214
+ authToken: options.context.authToken,
215
+ apiUrl: config.apiUrl,
216
+ forkInput: input,
217
+ executionOptions: {
218
+ toolCallId,
219
+ abortSignal,
220
+ },
221
+ childAgentId,
222
+ runProjectId: input.project_id ?? options.context.projectId,
223
+ parentConversationId: options.context.conversationId,
224
+ parentRunId: options.context.parentRunId,
225
+ parentMessageId: options.context.parentMessageId,
226
+ getProjectId: () => options.context.projectId,
227
+ getBranchId: () => options.context.branchId,
228
+ getContextModel: () => options.context.model,
229
+ defaultModel: options.defaultModel ?? DEFAULT_USER_AGENT_MODEL,
230
+ resolveModelId: options.resolveModelId,
231
+ resolveProvider: options.resolveProvider,
232
+ onRequestedProjectId: (projectId) => applyRequestedProjectId(options, projectId),
233
+ publishParentRunEvents: options.context.publishParentRunEvents,
234
+ contextUnavailableMessage: "invoke_agent requires durable conversation context when durable child runs are enabled.",
235
+ setupFailedCode: DURABLE_INVOKE_SETUP_FAILED,
236
+ executionFailedCode: "INVOKE_AGENT_FAILED",
237
+ executeLocal: executeLocalInvoke,
238
+ getExecutionSnapshot: () => executionSnapshot,
239
+ buildContextUnavailableResult: (message) => {
240
+ durableInvokeRecorder.annotate({
241
+ status: "failed",
242
+ terminalErrorCode: DURABLE_INVOKE_CONTEXT_UNAVAILABLE,
243
+ terminalErrorMessage: message,
244
+ });
245
+ return buildHostedDurableChildInvokeFailureResult({
246
+ terminalErrorCode: DURABLE_INVOKE_CONTEXT_UNAVAILABLE,
247
+ terminalErrorMessage: message,
248
+ });
249
+ },
250
+ buildSetupFailureResult: (failure) => durableInvokeRecorder.recordSetupFailure(failure),
251
+ buildTerminalFailureResult: (failure) => durableInvokeRecorder.recordTerminalFailure(failure),
252
+ buildSuccessResult: (success) => durableInvokeRecorder.recordSuccess(success),
253
+ runtime: {
254
+ bootstrapChildRun: bootstrapHostedChildRun,
255
+ createLifecycleAdapter: createConversationChildLifecycleAdapter,
256
+ runLifecycle: runHostedChildExecutionLifecycle,
257
+ shouldSkipTerminalPersistence: shouldSkipHostedChildTerminalPersistence,
258
+ },
259
+ bootstrap: {
260
+ runBootstrap: (operation) => options.trace("invoke_agent.durableChildSetup", async () => {
261
+ options.setTraceAttributes({
262
+ "conversation.id": options.context.conversationId,
263
+ "run.id": options.context.parentRunId,
264
+ "tool.call.id": toolCallId,
265
+ });
266
+ return operation();
267
+ }),
268
+ onBootstrapStart: (bootstrapContext) => {
269
+ options.logger.info("Bootstrapping durable child run", {
270
+ parentConversationId: bootstrapContext.parentConversationId,
271
+ parentRunId: bootstrapContext.parentRunId,
272
+ toolCallId,
273
+ childAgentId,
274
+ description: input.description,
275
+ });
276
+ },
277
+ onBootstrapComplete: (bootstrapContext) => {
278
+ options.logger.info("Durable child bootstrap complete", {
279
+ parentConversationId: bootstrapContext.parentConversationId,
280
+ childConversationId: bootstrapContext.identifiers.childConversationId,
281
+ childRunId: bootstrapContext.identifiers.childRunId,
282
+ childMessageId: bootstrapContext.identifiers.childMessageId,
283
+ toolCallId,
284
+ });
285
+ },
286
+ onBootstrapError: ({ error, parentConversationId }) => {
287
+ options.logger.warn("Durable child-run persistence failed", {
288
+ parentConversationId,
289
+ toolCallId,
290
+ error: error instanceof Error ? error.message : String(error),
291
+ });
292
+ },
293
+ },
294
+ onLifecycleError: (error) => {
295
+ options.logger.warn("Durable child lifecycle adapter failed", {
296
+ toolCallId,
297
+ error: error instanceof Error ? error.message : String(error),
298
+ });
299
+ },
300
+ onLifecycleFinalized: ({ identifiers, status }) => options.trace("invoke_agent.durableChildFinalize", async () => {
301
+ options.setTraceAttributes({
302
+ "child.conversation.id": identifiers.childConversationId,
303
+ "child.run.id": identifiers.childRunId,
304
+ "child.message.id": identifiers.childMessageId,
305
+ "agent.run.final_status": status,
306
+ });
307
+ }),
308
+ });
309
+ }
310
+ catch (error) {
311
+ durableInvokeRecorder.recordLocalFailure(error instanceof Error ? error.message : String(error));
312
+ throw error;
313
+ }
314
+ }
315
+ export function createDefaultHostedInvokeAgentTool(options) {
316
+ return createHostedChildInvokeTool({
317
+ inputSchema: defaultHostedInvokeAgentInputSchema,
318
+ additionalDescriptionParts: [
319
+ "Use agent_id to target a specific built-in or custom child agent.",
320
+ ],
321
+ buildFailureResult: buildHostedDurableChildInvokeFailureResult,
322
+ decorateResult: withRootOwnedChildResultHint,
323
+ execute: (input, executionOptions) => executeDefaultHostedInvokeAgentTool(options, input, resolveChildAgentId(options, input), executionOptions),
324
+ });
325
+ }
@@ -0,0 +1,53 @@
1
+ import { type AgentServiceRoute, type AgentServiceRuntime } from "./agent-service.js";
2
+ import { type DetachedRunShutdownLifecycle, type DetachedRunTracker } from "./detached-run-tracker.js";
3
+ import { type HostedAgentServiceActiveSpanAttributes, type HostedAgentServiceDetachedCleanupInput, type HostedAgentServiceDetachedExecutionInput, type HostedAgentServiceRouteSet, type HostedAgentServiceStreamExecutionInput } from "./hosted-agent-service-routes.js";
4
+ import { type HostedServiceAuth, type HostedServiceAuthConfig } from "./hosted-service-auth.js";
5
+ import type { ParsedHostedChatRequest } from "./hosted-chat-request-parser.js";
6
+ import type { AgUiResumeValue } from "./ag-ui-tool-shared.js";
7
+ import type { RuntimeAgentMarkdownDefinition } from "./runtime-agent-definition.js";
8
+ import { type NodeAgentServiceServer } from "./agent-service-server.js";
9
+ import type { VeryfrontServiceServerLogger } from "../server/service-server.js";
10
+ export type HostedAgentServiceRuntimeConfig = HostedServiceAuthConfig & {
11
+ PORT: number;
12
+ ALLOWED_ORIGINS: string[];
13
+ };
14
+ export type HostedAgentServiceRuntimeLogger = VeryfrontServiceServerLogger & {
15
+ info(message: string, metadata?: Record<string, unknown>): void;
16
+ error(message: string, metadata?: Record<string, unknown>): void;
17
+ };
18
+ export type HostedAgentServiceRuntimeTrace = <TResult>(operationName: string, operation: () => Promise<TResult>) => Promise<TResult>;
19
+ export type CreateHostedAgentServiceRuntimeOptions<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig> = {
20
+ serviceName: string;
21
+ getConfig: () => TConfig;
22
+ getAgentConfig: () => RuntimeAgentMarkdownDefinition;
23
+ forwardedConfigNamespace?: string;
24
+ logger: HostedAgentServiceRuntimeLogger;
25
+ trace?: HostedAgentServiceRuntimeTrace;
26
+ setActiveSpanAttributes?: (attributes: HostedAgentServiceActiveSpanAttributes) => void;
27
+ prepareExecution: (req: ParsedHostedChatRequest) => Promise<TExecution>;
28
+ streamExecutionToAgUiResponse: (input: HostedAgentServiceStreamExecutionInput<TExecution>) => Promise<Response> | Response;
29
+ startDetachedExecution: (input: HostedAgentServiceDetachedExecutionInput<TExecution>) => Promise<void>;
30
+ cleanupExecution?: (input: HostedAgentServiceDetachedCleanupInput<TExecution>) => Promise<void>;
31
+ tracker?: DetachedRunTracker<AgUiResumeValue>;
32
+ drainTimeoutMs?: number;
33
+ };
34
+ export type HostedAgentServiceRuntimeBundle<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig> = {
35
+ config: TConfig;
36
+ tracker: DetachedRunTracker<AgUiResumeValue>;
37
+ auth: HostedServiceAuth;
38
+ routeSet: HostedAgentServiceRouteSet<TExecution>;
39
+ routes: AgentServiceRoute[];
40
+ lifecycle: DetachedRunShutdownLifecycle;
41
+ runtime: AgentServiceRuntime;
42
+ };
43
+ export type StartNodeHostedAgentServiceOptions<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig> = CreateHostedAgentServiceRuntimeOptions<TExecution, TConfig> & {
44
+ bindAddress?: string;
45
+ hardShutdownTimeoutMs?: number;
46
+ signals?: readonly NodeJS.Signals[];
47
+ };
48
+ export type StartNodeHostedAgentServiceResult<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig> = HostedAgentServiceRuntimeBundle<TExecution, TConfig> & {
49
+ nodeServer: NodeAgentServiceServer;
50
+ };
51
+ export declare function createHostedAgentServiceRuntime<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig>(options: CreateHostedAgentServiceRuntimeOptions<TExecution, TConfig>): HostedAgentServiceRuntimeBundle<TExecution, TConfig>;
52
+ export declare function startNodeHostedAgentService<TExecution extends object, TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig>(options: StartNodeHostedAgentServiceOptions<TExecution, TConfig>): Promise<StartNodeHostedAgentServiceResult<TExecution, TConfig>>;
53
+ //# sourceMappingURL=hosted-agent-service-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-agent-service-runtime.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-agent-service-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,sCAAsC,EAC3C,KAAK,sCAAsC,EAC3C,KAAK,wCAAwC,EAC7C,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC5C,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAEhF,MAAM,MAAM,+BAA+B,GAAG,uBAAuB,GAAG;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,4BA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AAO,EAAE,kCAAkC,CAAC,UAAU,EAAE,OAAO,CAAC,GAC/D,OAAO,CAAC,iCAAiC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAiBjE"}
@@ -0,0 +1,80 @@
1
+ import { agent } from "./factory.js";
2
+ import { defineAgentService, } from "./agent-service.js";
3
+ import { createDetachedRunShutdownLifecycle, createDetachedRunTracker, } from "./detached-run-tracker.js";
4
+ import { createHostedAgentServiceRouteSet, } from "./hosted-agent-service-routes.js";
5
+ import { createHostedServiceAuth, } from "./hosted-service-auth.js";
6
+ import { startNodeAgentServiceServer, } from "./agent-service-server.js";
7
+ function defaultTrace(_operationName, operation) {
8
+ return operation();
9
+ }
10
+ export function createHostedAgentServiceRuntime(options) {
11
+ const config = options.getConfig();
12
+ const tracker = options.tracker ?? createDetachedRunTracker();
13
+ const trace = options.trace ?? defaultTrace;
14
+ const auth = createHostedServiceAuth({
15
+ getConfig: options.getConfig,
16
+ logger: options.logger,
17
+ trace,
18
+ });
19
+ const routeSet = createHostedAgentServiceRouteSet({
20
+ forwardedConfigNamespace: options.forwardedConfigNamespace,
21
+ authenticateRequest: auth.authenticateRequest,
22
+ verifyProjectAccess: (projectId, authToken) => auth.verifyProjectAccess(projectId, authToken),
23
+ tracker,
24
+ prepareExecution: options.prepareExecution,
25
+ streamExecutionToAgUiResponse: options.streamExecutionToAgUiResponse,
26
+ startDetachedExecution: options.startDetachedExecution,
27
+ cleanupExecution: options.cleanupExecution,
28
+ setActiveSpanAttributes: options.setActiveSpanAttributes,
29
+ trace,
30
+ logger: options.logger,
31
+ });
32
+ const agentConfig = options.getAgentConfig();
33
+ const service = defineAgentService({
34
+ serviceName: options.serviceName,
35
+ agent: agent({
36
+ id: agentConfig.id,
37
+ system: agentConfig.instructions,
38
+ model: agentConfig.model,
39
+ maxSteps: agentConfig.maxSteps,
40
+ }),
41
+ server: {
42
+ port: config.PORT,
43
+ cors: {
44
+ origins: config.ALLOWED_ORIGINS,
45
+ credentials: true,
46
+ },
47
+ },
48
+ });
49
+ const routes = routeSet.routes;
50
+ return {
51
+ config,
52
+ tracker,
53
+ auth,
54
+ routeSet,
55
+ routes,
56
+ lifecycle: createDetachedRunShutdownLifecycle({
57
+ tracker,
58
+ logger: options.logger,
59
+ drainTimeoutMs: options.drainTimeoutMs,
60
+ }),
61
+ runtime: service.createRuntime({ routes }),
62
+ };
63
+ }
64
+ export async function startNodeHostedAgentService(options) {
65
+ const bundle = createHostedAgentServiceRuntime(options);
66
+ const nodeServer = await startNodeAgentServiceServer({
67
+ runtime: bundle.runtime,
68
+ serviceName: options.serviceName,
69
+ lifecycle: bundle.lifecycle,
70
+ port: bundle.config.PORT,
71
+ bindAddress: options.bindAddress,
72
+ signals: options.signals,
73
+ logger: options.logger,
74
+ hardShutdownTimeoutMs: options.hardShutdownTimeoutMs,
75
+ });
76
+ return {
77
+ ...bundle,
78
+ nodeServer,
79
+ };
80
+ }
@@ -96,6 +96,7 @@ export { agent } from "./factory.js";
96
96
  export { isResponseLike } from "./response-like.js";
97
97
  export { type AgentContract, type AgentRegistry, type AgentServiceCorsConfig, type AgentServiceDefinition, type AgentServiceRegistryContract, type AgentServiceRoute, type AgentServiceRouteMethod, type AgentServiceServerConfig, type AgentServiceSingleAgentContract, defineAgentService, type DurableRunSink, type NormalizedAgentServiceContract, } from "./agent-service.js";
98
98
  export { type AgentServiceServerLifecycle, createAgentServiceServerRuntime, type CreateAgentServiceServerRuntimeOptions, type NodeAgentServiceServer, startNodeAgentServiceServer, type StartNodeAgentServiceServerOptions, } from "./agent-service-server.js";
99
+ export { createHostedAgentServiceRuntime, type CreateHostedAgentServiceRuntimeOptions, type HostedAgentServiceRuntimeBundle, type HostedAgentServiceRuntimeConfig, type HostedAgentServiceRuntimeLogger, type HostedAgentServiceRuntimeTrace, startNodeHostedAgentService, type StartNodeHostedAgentServiceOptions, type StartNodeHostedAgentServiceResult, } from "./hosted-agent-service-runtime.js";
99
100
  export { type AgentServiceBootstrapExit, type AgentServiceTraceContext, type AgentServiceTraceContextGetter, bootstrapAgentService, type BootstrapAgentServiceOptions, runAgentServiceMain, type RunAgentServiceMainOptions, } from "./agent-service-bootstrap.js";
100
101
  export { type AbortRejectionEvent, type AbortRejectionEventTarget, type AbortRejectionGuardLogger, type AbortRejectionProcessTarget, installAbortRejectionGuard, type InstallAbortRejectionGuardOptions, type InstalledAbortRejectionGuard, isAbortRejectionReason, } from "./abort-rejection-guard.js";
101
102
  export { type CachedRequestAuthResult, createRequestAuthCache, type CreateRequestAuthCacheOptions, type RequestAuthCache, } from "./request-auth-cache.js";
@@ -157,6 +158,7 @@ export { createHostedChildPendingToolLifecycle, createHostedChildPendingToolLife
157
158
  export { composeAbortSignals, HOSTED_CHILD_STREAM_TIMEOUT_TOKEN, HostedChildStreamIdleTimeoutError, type HostedChildStreamWatchdogPhase, type HostedChildStreamWatchdogState, resolveHostedChildPromiseWithTimeout, resolveHostedChildStreamWatchdogState, withHostedChildStreamIdleTimeout, } from "./hosted-child-stream-watchdog.js";
158
159
  export { DEFAULT_HOSTED_CHILD_AGENT_ID, type HostedChildForkRuntimeConfig, type HostedChildForkToolInput, hostedChildForkToolInputSchema, resolveHostedChildForkRuntimeConfig, type ResolveHostedChildForkRuntimeConfigInput, resolveHostedChildForkThinkingOverride, } from "./hosted-child-tool-input.js";
159
160
  export { createHostedChildInvokeTool, type CreateHostedChildInvokeToolOptions, type HostedChildInvokeFailure, } from "./hosted-child-invoke-tool.js";
161
+ export { createDefaultHostedInvokeAgentTool, type DefaultHostedInvokeAgentConfig, type DefaultHostedInvokeAgentContext, type DefaultHostedInvokeAgentInput, defaultHostedInvokeAgentInputSchema, type DefaultHostedInvokeAgentLogger, type DefaultHostedInvokeAgentProjectRefresh, defaultHostedInvokeAgentSelectionSchema, type DefaultHostedInvokeAgentToolOptions, type DefaultHostedInvokeAgentToolResult, type DefaultHostedInvokeAgentTrace, type DefaultHostedInvokeAgentTraceAttributes, executeDefaultHostedInvokeAgentTool, } from "./default-hosted-invoke-agent-tool.js";
160
162
  export { buildDefaultHostedChildForkToolSet, buildHostedChildToolDescription, DEFAULT_HOSTED_CHILD_EXCLUDED_TOOL_NAMES, DEFAULT_HOSTED_CHILD_REQUESTED_TOOL_COMPANIONS, DEFAULT_HOSTED_CHILD_SANDBOX_REQUIRED_CUE_PATTERN, type DefaultHostedChildForkRuntimeToolPreparationResult, type DefaultHostedChildForkToolAssemblyResult, type DefaultHostedChildForkToolAssemblySourceResult, expandHostedChildRequestedTools, type HostedChildForkRuntimeToolSelectionResult, type HostedChildRequestedToolsInput, prepareDefaultHostedChildForkRuntimeTools, prepareDefaultHostedChildForkToolAssembly, sanitizeDefaultHostedChildRequestedTools, sanitizeHostedChildRequestedTools, selectDefaultHostedChildForkRuntimeTools, selectHostedChildForkRuntimeTools, shouldPruneSandboxToolsFromHostedChildRequest, } from "./hosted-child-requested-tools.js";
161
163
  export { getHostedChildWrittenArtifactPath, type HostedChildFileWriteFallbackLogger, type HostedChildFileWriteFallbackTool, type HostedChildFileWriteFallbackToolExecute, type HostedChildWrittenArtifactPathInput, isHostedChildCreateFileAlreadyExistsResult, isHostedChildTextProjectArtifactPrompt, normalizeHostedChildArtifactPath, withHostedChildRerunnableFileWriteFallbacks, } from "./hosted-child-artifact-support.js";
162
164
  export { buildDefaultResearchArtifactPathReminder, buildDefaultResearchArtifactPaths, type DefaultResearchArtifactPaths, shouldInjectDefaultResearchArtifactPath, withDefaultResearchArtifactPath, } from "./default-research-artifact-policy.js";