veryfront 0.1.629 → 0.1.631

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.
Files changed (113) hide show
  1. package/esm/cli/commands/worker/command-help.d.ts.map +1 -1
  2. package/esm/cli/commands/worker/command-help.js +0 -5
  3. package/esm/cli/commands/worker/command.d.ts.map +1 -1
  4. package/esm/cli/commands/worker/command.js +0 -6
  5. package/esm/cli/commands/worker/handler.js +1 -1
  6. package/esm/deno.d.ts +6 -0
  7. package/esm/deno.js +11 -5
  8. package/esm/src/agent/ag-ui/handler.d.ts.map +1 -1
  9. package/esm/src/agent/ag-ui/handler.js +36 -3
  10. package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.d.ts.map +1 -1
  11. package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.js +9 -1
  12. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
  13. package/esm/src/agent/hosted/child-fork-execution-runner.js +1 -0
  14. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
  15. package/esm/src/agent/hosted/child-requested-tools.d.ts +1 -0
  16. package/esm/src/agent/hosted/child-requested-tools.d.ts.map +1 -1
  17. package/esm/src/agent/hosted/child-requested-tools.js +15 -5
  18. package/esm/src/agent/react/use-chat/streaming/handler.d.ts.map +1 -1
  19. package/esm/src/agent/react/use-chat/streaming/handler.js +32 -3
  20. package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts +2 -2
  21. package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts.map +1 -1
  22. package/esm/src/agent/react/use-chat/streaming/parts-builder.js +8 -1
  23. package/esm/src/agent/react/use-chat/streaming/types.d.ts +4 -0
  24. package/esm/src/agent/react/use-chat/streaming/types.d.ts.map +1 -1
  25. package/esm/src/agent/react/use-chat/types.d.ts +2 -2
  26. package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
  27. package/esm/src/agent/runtime/chat-stream-handler.d.ts +2 -0
  28. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  29. package/esm/src/agent/runtime/chat-stream-handler.js +151 -15
  30. package/esm/src/agent/runtime/index.d.ts +15 -0
  31. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  32. package/esm/src/agent/runtime/index.js +55 -1
  33. package/esm/src/agent/runtime/provider-native-tool-inventory.d.ts +1 -1
  34. package/esm/src/agent/runtime/provider-native-tool-inventory.d.ts.map +1 -1
  35. package/esm/src/agent/runtime/provider-native-tool-inventory.js +2 -7
  36. package/esm/src/agent/runtime/runtime-tool-types.d.ts +11 -0
  37. package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -1
  38. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +1 -0
  39. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  40. package/esm/src/agent/streaming/fork-runtime-stream.js +7 -5
  41. package/esm/src/agent/streaming/tool-execution-data-event-bridge.d.ts.map +1 -1
  42. package/esm/src/agent/streaming/tool-execution-data-event-bridge.js +4 -0
  43. package/esm/src/cache/registry.d.ts +13 -2
  44. package/esm/src/cache/registry.d.ts.map +1 -1
  45. package/esm/src/channels/control-plane.d.ts +9 -7
  46. package/esm/src/channels/control-plane.d.ts.map +1 -1
  47. package/esm/src/channels/control-plane.js +3 -1
  48. package/esm/src/channels/invoke.d.ts +2 -2
  49. package/esm/src/chat/protocol.d.ts +6 -1
  50. package/esm/src/chat/protocol.d.ts.map +1 -1
  51. package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
  52. package/esm/src/discovery/import-rewriter.js +8 -1
  53. package/esm/src/embedding/veryfront-cloud/rag-store.d.ts.map +1 -1
  54. package/esm/src/embedding/veryfront-cloud/rag-store.js +4 -1
  55. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
  56. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +5 -1
  57. package/esm/src/html/utils.d.ts.map +1 -1
  58. package/esm/src/html/utils.js +11 -1
  59. package/esm/src/internal-agents/control-plane-auth.d.ts +3 -2
  60. package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
  61. package/esm/src/internal-agents/control-plane-auth.js +1 -1
  62. package/esm/src/mcp/server.d.ts.map +1 -1
  63. package/esm/src/mcp/server.js +8 -2
  64. package/esm/src/modules/react-loader/ssr-module-loader/cache/memory.d.ts.map +1 -1
  65. package/esm/src/modules/react-loader/ssr-module-loader/cache/memory.js +1 -0
  66. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts.map +1 -1
  67. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.js +2 -1
  68. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +2 -2
  69. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
  70. package/esm/src/platform/adapters/veryfront-api-client/operations.js +2 -2
  71. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +1 -1
  72. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +1 -1
  73. package/esm/src/platform/compat/fs.d.ts.map +1 -1
  74. package/esm/src/platform/compat/fs.js +27 -27
  75. package/esm/src/provider/local/local-embedding-engine.d.ts.map +1 -1
  76. package/esm/src/provider/local/local-embedding-engine.js +18 -32
  77. package/esm/src/provider/local/local-engine.d.ts.map +1 -1
  78. package/esm/src/provider/local/local-engine.js +14 -26
  79. package/esm/src/provider/local/pipeline-cache.d.ts +27 -0
  80. package/esm/src/provider/local/pipeline-cache.d.ts.map +1 -0
  81. package/esm/src/provider/local/pipeline-cache.js +61 -0
  82. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  83. package/esm/src/server/handlers/dev/framework-candidates.generated.js +1 -0
  84. package/esm/src/server/handlers/request/internal-agents-list.handler.d.ts.map +1 -1
  85. package/esm/src/server/handlers/request/internal-agents-list.handler.js +1 -0
  86. package/esm/src/server/handlers/request/project-run-execute.handler.d.ts +74 -0
  87. package/esm/src/server/handlers/request/project-run-execute.handler.d.ts.map +1 -0
  88. package/esm/src/server/handlers/request/project-run-execute.handler.js +460 -0
  89. package/esm/src/server/runtime-handler/index.d.ts +1 -1
  90. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  91. package/esm/src/server/runtime-handler/index.js +3 -0
  92. package/esm/src/transforms/mdx/esm-module-loader/module-writer.d.ts.map +1 -1
  93. package/esm/src/transforms/mdx/esm-module-loader/module-writer.js +8 -2
  94. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.d.ts.map +1 -1
  95. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.js +8 -1
  96. package/esm/src/utils/version-constant.d.ts +1 -1
  97. package/esm/src/utils/version-constant.js +1 -1
  98. package/esm/src/workflow/worker/executors/index.d.ts +0 -2
  99. package/esm/src/workflow/worker/executors/index.d.ts.map +1 -1
  100. package/esm/src/workflow/worker/executors/index.js +0 -2
  101. package/esm/src/workflow/worker/executors/types.d.ts +7 -17
  102. package/esm/src/workflow/worker/executors/types.d.ts.map +1 -1
  103. package/esm/src/workflow/worker/executors/types.js +0 -1
  104. package/esm/src/workflow/worker/index.d.ts +3 -9
  105. package/esm/src/workflow/worker/index.d.ts.map +1 -1
  106. package/esm/src/workflow/worker/index.js +3 -9
  107. package/esm/src/workflow/worker/run-manager.d.ts +1 -16
  108. package/esm/src/workflow/worker/run-manager.d.ts.map +1 -1
  109. package/esm/src/workflow/worker/run-manager.js +2 -19
  110. package/package.json +1 -1
  111. package/esm/src/workflow/worker/executors/k8s.d.ts +0 -157
  112. package/esm/src/workflow/worker/executors/k8s.d.ts.map +0 -1
  113. package/esm/src/workflow/worker/executors/k8s.js +0 -198
@@ -0,0 +1,460 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { CONTROL_PLANE_RUNS_PATH_PREFIX } from "../../../channels/control-plane.js";
3
+ import { getEnvironmentConfig } from "../../../config/index.js";
4
+ import { ControlPlaneRequestError, verifyControlPlaneRequest, } from "../../../internal-agents/control-plane-auth.js";
5
+ import { INTERNAL_AGENT_CONTROL_PLANE_MAX_BODY_BYTES, InternalAgentRequestBodyTooLargeError, readInternalAgentRequestBody, } from "../../../internal-agents/request-body.js";
6
+ import { getHostEnv } from "../../../platform/compat/process.js";
7
+ import { findTaskById } from "../../../task/discovery.js";
8
+ import { runTask } from "../../../task/runner.js";
9
+ import { findWorkflowById } from "../../../workflow/discovery/index.js";
10
+ import { createWorkflowClient, RedisBackend } from "../../../workflow/index.js";
11
+ import { BaseHandler } from "../response/base.js";
12
+ import { PRIORITY_MEDIUM_API } from "../../../utils/constants/index.js";
13
+ const EXECUTE_PATH_REGEX = /^\/api\/control-plane\/runs\/([^/]+)\/execute$/;
14
+ const DEFAULT_WORKFLOW_STATUS_POLL_INTERVAL_MS = 100;
15
+ const DEFAULT_WORKFLOW_STATUS_TIMEOUT_MS = 15 * 60 * 1_000;
16
+ const WORKFLOW_PERSISTENCE_REQUIRED_ERROR = "Workflow paused but runtime workflow persistence is not configured";
17
+ function isRecord(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19
+ }
20
+ function parseRecord(value) {
21
+ if (value === undefined)
22
+ return undefined;
23
+ if (!isRecord(value))
24
+ throw new Error("Expected object");
25
+ return value;
26
+ }
27
+ function parseExecuteRequest(value, pathRunId) {
28
+ if (!isRecord(value))
29
+ throw new Error("Expected object");
30
+ const runId = value.runId;
31
+ const kind = value.kind;
32
+ const target = value.target;
33
+ const projectId = value.projectId;
34
+ if (typeof runId !== "string" || !runId)
35
+ throw new Error("Invalid runId");
36
+ if (runId !== pathRunId)
37
+ throw new Error("Run id does not match request path");
38
+ if (kind !== "task" && kind !== "workflow")
39
+ throw new Error("Invalid run kind");
40
+ if (typeof target !== "string" || !target)
41
+ throw new Error("Invalid target");
42
+ if (typeof projectId !== "string" || !projectId)
43
+ throw new Error("Invalid projectId");
44
+ if (kind === "task" && !target.startsWith("task:"))
45
+ throw new Error("Invalid task target");
46
+ if (kind === "workflow" && !target.startsWith("workflow:")) {
47
+ throw new Error("Invalid workflow target");
48
+ }
49
+ return {
50
+ runId,
51
+ kind,
52
+ target,
53
+ projectId,
54
+ config: parseRecord(value.config),
55
+ input: parseRecord(value.input),
56
+ };
57
+ }
58
+ function getRunId(pathname) {
59
+ return EXECUTE_PATH_REGEX.exec(pathname)?.[1] ?? null;
60
+ }
61
+ function stripTargetPrefix(target, prefix) {
62
+ return target.slice(prefix.length);
63
+ }
64
+ function errorMessage(error) {
65
+ return error instanceof Error ? error.message : String(error);
66
+ }
67
+ function createExecutionFailure(error, durationMs) {
68
+ return {
69
+ success: false,
70
+ error: errorMessage(error),
71
+ logs: null,
72
+ duration_ms: durationMs,
73
+ };
74
+ }
75
+ async function createRuntimeWorkflowClient(config) {
76
+ const redisUrl = getHostEnv("REDIS_URL")?.trim();
77
+ if (!redisUrl) {
78
+ return Object.assign(createWorkflowClient(config), {
79
+ statePersistence: "ephemeral",
80
+ });
81
+ }
82
+ const backend = new RedisBackend({ url: redisUrl, debug: config?.debug });
83
+ if (backend.initialize) {
84
+ await backend.initialize();
85
+ }
86
+ return Object.assign(createWorkflowClient({ backend, debug: config?.debug }), {
87
+ statePersistence: "durable",
88
+ });
89
+ }
90
+ async function executeTaskRun(request, ctx, deps) {
91
+ const taskId = stripTargetPrefix(request.target, "task:");
92
+ if (taskId === "knowledge-ingest") {
93
+ throw new Error("Knowledge ingest must be executed through the knowledge ingest executor");
94
+ }
95
+ const task = await deps.findTaskById(taskId, {
96
+ projectDir: ctx.projectDir,
97
+ adapter: ctx.adapter,
98
+ config: ctx.config,
99
+ debug: ctx.debug,
100
+ });
101
+ if (!task) {
102
+ return {
103
+ success: false,
104
+ error: `Task not found: ${taskId}`,
105
+ logs: null,
106
+ duration_ms: 0,
107
+ };
108
+ }
109
+ const result = await deps.runTask({
110
+ task,
111
+ config: request.config ?? {},
112
+ projectId: request.projectId,
113
+ debug: ctx.debug,
114
+ });
115
+ return {
116
+ success: result.success,
117
+ result: result.result,
118
+ error: result.error,
119
+ duration_ms: result.durationMs,
120
+ logs: null,
121
+ };
122
+ }
123
+ async function waitForWorkflowResult(client, runId, deps) {
124
+ const deadline = deps.now() + DEFAULT_WORKFLOW_STATUS_TIMEOUT_MS;
125
+ while (true) {
126
+ const run = await client.getRun(runId);
127
+ if (!run)
128
+ throw new Error(`Workflow run not found: ${runId}`);
129
+ if (run.status === "completed" ||
130
+ run.status === "failed" ||
131
+ run.status === "cancelled" ||
132
+ run.status === "waiting") {
133
+ return run;
134
+ }
135
+ if (deps.now() >= deadline) {
136
+ throw new Error(`Workflow run timed out: ${runId}`);
137
+ }
138
+ await deps.sleep(DEFAULT_WORKFLOW_STATUS_POLL_INTERVAL_MS);
139
+ }
140
+ }
141
+ async function executeWorkflowRun(request, ctx, deps) {
142
+ const startedAt = deps.now();
143
+ const workflowId = stripTargetPrefix(request.target, "workflow:");
144
+ const workflow = await deps.findWorkflowById(workflowId, {
145
+ projectDir: ctx.projectDir,
146
+ adapter: ctx.adapter,
147
+ config: ctx.config,
148
+ debug: ctx.debug,
149
+ });
150
+ if (!workflow) {
151
+ return {
152
+ success: false,
153
+ error: `Workflow not found: ${workflowId}`,
154
+ logs: null,
155
+ duration_ms: 0,
156
+ };
157
+ }
158
+ const client = await deps.createWorkflowClient({ debug: ctx.debug });
159
+ try {
160
+ client.register(workflow.definition);
161
+ const handle = await client.start(workflow.id, request.input ?? {}, { runId: request.runId });
162
+ const run = await waitForWorkflowResult(client, handle.runId, deps);
163
+ const durationMs = Math.max(0, deps.now() - startedAt);
164
+ if (run.status === "waiting") {
165
+ if (client.statePersistence !== "durable") {
166
+ return {
167
+ success: false,
168
+ error: WORKFLOW_PERSISTENCE_REQUIRED_ERROR,
169
+ logs: null,
170
+ duration_ms: durationMs,
171
+ };
172
+ }
173
+ return {
174
+ success: true,
175
+ result: run.output,
176
+ logs: null,
177
+ duration_ms: durationMs,
178
+ };
179
+ }
180
+ if (run.status === "completed") {
181
+ return {
182
+ success: true,
183
+ result: run.output,
184
+ logs: null,
185
+ duration_ms: durationMs,
186
+ };
187
+ }
188
+ return {
189
+ success: false,
190
+ result: run.output,
191
+ error: run.error?.message ?? `Workflow ended with status: ${run.status}`,
192
+ logs: null,
193
+ duration_ms: durationMs,
194
+ };
195
+ }
196
+ finally {
197
+ await client.destroy();
198
+ }
199
+ }
200
+ function createRuntimeApiClient(req, ctx) {
201
+ const apiUrl = getEnvironmentConfig().apiBaseUrl;
202
+ const token = req.headers.get("x-token") ?? ctx.proxyToken ?? ctx.requestContext?.token ?? "";
203
+ if (!token) {
204
+ throw new Error("Missing project runtime API token");
205
+ }
206
+ async function requestJson(method, path, body, params) {
207
+ const url = new URL(`${apiUrl}${path}`);
208
+ for (const [key, value] of Object.entries(params ?? {})) {
209
+ url.searchParams.set(key, value);
210
+ }
211
+ const response = await fetch(url.toString(), {
212
+ method,
213
+ headers: {
214
+ Authorization: `Bearer ${token}`,
215
+ Accept: "application/json",
216
+ "Content-Type": "application/json",
217
+ },
218
+ body: body === undefined ? undefined : JSON.stringify(body),
219
+ });
220
+ if (!response.ok) {
221
+ throw new Error(`Veryfront API request failed: ${response.status} ${response.statusText}`);
222
+ }
223
+ if (response.status === 204)
224
+ return undefined;
225
+ return response.json();
226
+ }
227
+ return {
228
+ get(path, params) {
229
+ return requestJson("GET", path, undefined, params);
230
+ },
231
+ post(path, body) {
232
+ return requestJson("POST", path, body);
233
+ },
234
+ put(path, body) {
235
+ return requestJson("PUT", path, body);
236
+ },
237
+ patch(path, body) {
238
+ return requestJson("PATCH", path, body);
239
+ },
240
+ delete(path) {
241
+ return requestJson("DELETE", path);
242
+ },
243
+ };
244
+ }
245
+ function getStringArrayConfig(config, keys) {
246
+ for (const key of keys) {
247
+ const value = config[key];
248
+ if (Array.isArray(value)) {
249
+ return value.filter((item) => typeof item === "string" && item.length > 0);
250
+ }
251
+ }
252
+ return [];
253
+ }
254
+ function getStringConfig(config, keys) {
255
+ for (const key of keys) {
256
+ const value = config[key];
257
+ if (typeof value === "string" && value.length > 0)
258
+ return value;
259
+ }
260
+ return undefined;
261
+ }
262
+ async function resolveUploadIdsToPaths(client, projectReference, uploadIds) {
263
+ const paths = [];
264
+ for (const uploadId of uploadIds) {
265
+ const upload = await client.get(`/projects/${encodeURIComponent(projectReference)}/uploads/${encodeURIComponent(uploadId)}`);
266
+ if (!upload.path) {
267
+ throw new Error(`Upload not found: ${uploadId}`);
268
+ }
269
+ paths.push(upload.path);
270
+ }
271
+ return paths;
272
+ }
273
+ function createKnowledgeEventLogger(lines) {
274
+ const append = (level, message, metadata) => {
275
+ lines.push(JSON.stringify({ level, message, ...(metadata ?? {}) }));
276
+ };
277
+ const logger = {
278
+ info: (message, metadata) => append("info", message, metadata),
279
+ warn: (message, metadata) => append("warn", message, metadata),
280
+ error: (message, metadata) => append("error", message, metadata),
281
+ debug: (message, metadata) => append("debug", message, metadata),
282
+ async time(_label, fn) {
283
+ return fn();
284
+ },
285
+ child: () => logger,
286
+ component: () => logger,
287
+ };
288
+ return logger;
289
+ }
290
+ async function executeKnowledgeIngestRun(input) {
291
+ const startedAt = Date.now();
292
+ const config = input.request.config ?? {};
293
+ const client = createRuntimeApiClient(input.req, input.ctx);
294
+ const projectReference = input.ctx.projectSlug ?? input.request.projectId;
295
+ const outputDir = await dntShim.Deno.makeTempDir({ prefix: "veryfront-knowledge-run-" });
296
+ const logLines = [];
297
+ try {
298
+ const { buildKnowledgeIngestRunResult, } = await import("../../../../cli/commands/knowledge/result.js");
299
+ const { collectKnowledgeSources, ingestResolvedSources, resolveKnowledgeDownloadOutputDir, runKnowledgeParser, } = await import("../../../../cli/commands/knowledge/command.js");
300
+ const { downloadUploadToFile } = await import("../../../../cli/commands/uploads/command.js");
301
+ const { putRemoteFileFromLocal } = await import("../../../../cli/commands/files/command.js");
302
+ const uploadIds = getStringArrayConfig(config, ["upload_ids", "uploadIds"]);
303
+ const paths = getStringArrayConfig(config, ["paths", "upload_paths", "uploadPaths"]);
304
+ const uploadPaths = [
305
+ ...paths,
306
+ ...await resolveUploadIdsToPaths(client, projectReference, uploadIds),
307
+ ];
308
+ const pathPrefix = getStringConfig(config, [
309
+ "path_prefix",
310
+ "upload_prefix",
311
+ "pathPrefix",
312
+ "uploadPrefix",
313
+ ]);
314
+ const knowledgePath = getStringConfig(config, ["knowledge_path", "knowledgePath"]) ??
315
+ "knowledge";
316
+ const description = getStringConfig(config, ["description"]);
317
+ const recursive = config.recursive === undefined ? true : Boolean(config.recursive);
318
+ if (uploadPaths.length > 0 && pathPrefix) {
319
+ throw new Error("Use upload paths or upload prefix, not both.");
320
+ }
321
+ const options = {
322
+ projectSlug: projectReference,
323
+ projectDir: input.ctx.projectDir,
324
+ sources: uploadPaths,
325
+ path: pathPrefix,
326
+ all: pathPrefix !== undefined,
327
+ recursive,
328
+ outputDir,
329
+ knowledgePath,
330
+ description,
331
+ slug: getStringConfig(config, ["slug"]),
332
+ json: true,
333
+ quiet: true,
334
+ };
335
+ const downloadOutputDir = resolveKnowledgeDownloadOutputDir(outputDir);
336
+ const sourceMode = pathPrefix ? "path_prefix" : "explicit_sources";
337
+ const collection = await collectKnowledgeSources(options, {
338
+ client,
339
+ projectSlug: projectReference,
340
+ downloadUploads: (uploadTargets) => Promise.all(uploadTargets.map((uploadPath) => downloadUploadToFile(client, projectReference, uploadPath, downloadOutputDir))),
341
+ });
342
+ const requestedCount = collection.sources.length + collection.skipped.length;
343
+ if (requestedCount === 0) {
344
+ throw new Error("No supported knowledge sources were found.");
345
+ }
346
+ const results = await ingestResolvedSources(collection.sources, options, {
347
+ client,
348
+ projectSlug: projectReference,
349
+ outputDir,
350
+ runParser: runKnowledgeParser,
351
+ eventLogger: createKnowledgeEventLogger(logLines),
352
+ uploadKnowledgeFile: (remotePath, localPath) => putRemoteFileFromLocal(client, projectReference, remotePath, localPath),
353
+ });
354
+ const result = buildKnowledgeIngestRunResult({
355
+ requestedCount,
356
+ sourceMode,
357
+ knowledgePath,
358
+ ingested: results.ingested,
359
+ skipped: collection.skipped,
360
+ failed: results.failed,
361
+ });
362
+ const failedCount = result.summary.failed_count;
363
+ const ingestedCount = result.summary.ingested_count;
364
+ return {
365
+ success: failedCount === 0 && ingestedCount > 0,
366
+ result,
367
+ error: failedCount > 0
368
+ ? `${failedCount} knowledge source${failedCount === 1 ? "" : "s"} failed`
369
+ : ingestedCount === 0
370
+ ? "No knowledge sources were ingested"
371
+ : null,
372
+ logs: logLines.length > 0 ? logLines.join("\n") : null,
373
+ duration_ms: Date.now() - startedAt,
374
+ };
375
+ }
376
+ catch (error) {
377
+ return {
378
+ success: false,
379
+ error: errorMessage(error),
380
+ logs: logLines.length > 0 ? logLines.join("\n") : null,
381
+ duration_ms: Date.now() - startedAt,
382
+ };
383
+ }
384
+ finally {
385
+ await dntShim.Deno.remove(outputDir, { recursive: true }).catch(() => undefined);
386
+ }
387
+ }
388
+ const defaultDeps = {
389
+ findTaskById,
390
+ runTask,
391
+ findWorkflowById,
392
+ createWorkflowClient: createRuntimeWorkflowClient,
393
+ executeKnowledgeIngest: executeKnowledgeIngestRun,
394
+ sleep: (ms) => new Promise((resolve) => dntShim.setTimeout(resolve, ms)),
395
+ now: () => Date.now(),
396
+ };
397
+ export class ProjectRunExecuteHandler extends BaseHandler {
398
+ deps;
399
+ metadata = {
400
+ name: "ProjectRunExecuteHandler",
401
+ priority: PRIORITY_MEDIUM_API,
402
+ patterns: [
403
+ { pattern: CONTROL_PLANE_RUNS_PATH_PREFIX, prefix: true, method: "POST" },
404
+ ],
405
+ };
406
+ constructor(deps = defaultDeps) {
407
+ super();
408
+ this.deps = deps;
409
+ }
410
+ async handle(req, ctx) {
411
+ if (!this.shouldHandle(req, ctx)) {
412
+ return this.continue();
413
+ }
414
+ const runId = getRunId(new URL(req.url).pathname);
415
+ if (!runId) {
416
+ return this.continue();
417
+ }
418
+ return this.withProxyContext(ctx, async () => {
419
+ const builder = this.createResponseBuilder(ctx)
420
+ .withCORS(req, ctx.securityConfig?.cors)
421
+ .withSecurity(ctx.securityConfig ?? undefined, req);
422
+ try {
423
+ const rawBody = await readInternalAgentRequestBody(req, INTERNAL_AGENT_CONTROL_PLANE_MAX_BODY_BYTES);
424
+ const request = parseExecuteRequest(JSON.parse(rawBody), runId);
425
+ const claims = await verifyControlPlaneRequest(req, ctx, rawBody, {
426
+ expectedSubject: runId,
427
+ expectedSurface: "studio",
428
+ });
429
+ if (request.projectId !== claims.project_id ||
430
+ (ctx.projectId !== undefined && request.projectId !== ctx.projectId)) {
431
+ return this.respond(builder.json({ error: "Invalid control-plane signature" }, 401));
432
+ }
433
+ const startedAt = this.deps.now();
434
+ try {
435
+ const response = request.kind === "task" && request.target === "task:knowledge-ingest"
436
+ ? await this.deps.executeKnowledgeIngest({ request, ctx, req })
437
+ : request.kind === "task"
438
+ ? await executeTaskRun(request, ctx, this.deps)
439
+ : await executeWorkflowRun(request, ctx, this.deps);
440
+ return this.respond(builder.json(response, 200));
441
+ }
442
+ catch (error) {
443
+ return this.respond(builder.json(createExecutionFailure(error, Math.max(0, this.deps.now() - startedAt)), 200));
444
+ }
445
+ }
446
+ catch (error) {
447
+ if (error instanceof InternalAgentRequestBodyTooLargeError) {
448
+ return this.respond(builder.json({ error: error.message }, error.status));
449
+ }
450
+ if (error instanceof ControlPlaneRequestError) {
451
+ return this.respond(builder.json({ error: error.message }, error.status));
452
+ }
453
+ if (error instanceof SyntaxError || error instanceof Error) {
454
+ return this.respond(builder.json({ error: "Invalid project run execute request" }, 400));
455
+ }
456
+ return this.respond(builder.json({ error: "Invalid project run execute request" }, 400));
457
+ }
458
+ });
459
+ }
460
+ }
@@ -13,7 +13,7 @@ import type { Handler } from "../../types/index.js";
13
13
  import { ApiHandlerWrapper } from "../handlers/request/api/index.js";
14
14
  export { parseProxyEnvironment, type ProxyEnvironment } from "./proxy-environment.js";
15
15
  /** Handler names in registration order. */
16
- export declare const HANDLER_NAMES: readonly ["AuthHandler", "CsrfHandler", "HMRHandler", "CorsHandler", "HealthHandler", "MetricsHandler", "MemoryDebugHandler", "ClientLogHandler", "DevEndpointsHandler", "StylesCSSHandler", "DebugContextHandler", "OpenAPIHandler", "OpenAPIDocsHandler", "InternalAgentsListHandler", "AgentStreamHandler", "AgentRunResumeHandler", "AgentRunCancelHandler", "ChannelInvokeHandler", "DevDashboardHandler", "ProjectsHandler", "StudioBridgeModulesHandler", "ProdHydrationModuleHandler", "CSSHandler", "DevFileHandler", "SnippetHandler", "StaticHandler", "LibModulesHandler", "RSCHandler", "ModuleHandler", "ApiHandlerWrapper", "MarkdownPreviewHandler", "SSRHandler", "NotFoundHandler"];
16
+ export declare const HANDLER_NAMES: readonly ["AuthHandler", "CsrfHandler", "HMRHandler", "CorsHandler", "HealthHandler", "MetricsHandler", "MemoryDebugHandler", "ClientLogHandler", "DevEndpointsHandler", "StylesCSSHandler", "DebugContextHandler", "OpenAPIHandler", "OpenAPIDocsHandler", "InternalAgentsListHandler", "AgentStreamHandler", "AgentRunResumeHandler", "AgentRunCancelHandler", "ProjectRunExecuteHandler", "ChannelInvokeHandler", "DevDashboardHandler", "ProjectsHandler", "StudioBridgeModulesHandler", "ProdHydrationModuleHandler", "CSSHandler", "DevFileHandler", "SnippetHandler", "StaticHandler", "LibModulesHandler", "RSCHandler", "ModuleHandler", "ApiHandlerWrapper", "MarkdownPreviewHandler", "SSRHandler", "NotFoundHandler"];
17
17
  /** Union of all registered handler names. */
18
18
  export type HandlerName = (typeof HANDLER_NAMES)[number];
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAgCpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,k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CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAA;CAAE,CAuB5D;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;CAC/C;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,IAAI,GAAE,qBAAsC,GAC3C,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAibnE;AAGD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC"}
@@ -48,6 +48,7 @@ import { InternalAgentsListHandler } from "../handlers/request/internal-agents-l
48
48
  import { AgentStreamHandler } from "../handlers/request/agent-stream.handler.js";
49
49
  import { AgentRunResumeHandler } from "../handlers/request/agent-run-resume.handler.js";
50
50
  import { AgentRunCancelHandler } from "../handlers/request/agent-run-cancel.handler.js";
51
+ import { ProjectRunExecuteHandler } from "../handlers/request/project-run-execute.handler.js";
51
52
  import { ChannelInvokeHandler } from "../handlers/request/channel-invoke.handler.js";
52
53
  import { DevDashboardHandler } from "../handlers/dev/dashboard/index.js";
53
54
  import { ProjectsHandler } from "../handlers/dev/projects/index.js";
@@ -89,6 +90,7 @@ export const HANDLER_NAMES = [
89
90
  "AgentStreamHandler",
90
91
  "AgentRunResumeHandler",
91
92
  "AgentRunCancelHandler",
93
+ "ProjectRunExecuteHandler",
92
94
  "ChannelInvokeHandler",
93
95
  "DevDashboardHandler",
94
96
  "ProjectsHandler",
@@ -125,6 +127,7 @@ const handlerFactories = {
125
127
  AgentStreamHandler: () => new AgentStreamHandler(),
126
128
  AgentRunResumeHandler: () => new AgentRunResumeHandler(),
127
129
  AgentRunCancelHandler: () => new AgentRunCancelHandler(),
130
+ ProjectRunExecuteHandler: () => new ProjectRunExecuteHandler(),
128
131
  ChannelInvokeHandler: () => new ChannelInvokeHandler(),
129
132
  DevDashboardHandler: () => new DevDashboardHandler(),
130
133
  ProjectsHandler: () => new ProjectsHandler(),
@@ -1 +1 @@
1
- {"version":3,"file":"module-writer.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/esm-module-loader/module-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiDnD,wBAAsB,eAAe,CACnC,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,CAAC,CAkVpB"}
1
+ {"version":3,"file":"module-writer.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/esm-module-loader/module-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiDnD,wBAAsB,eAAe,CACnC,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,CAAC,CA4VpB"}
@@ -184,7 +184,10 @@ export async function doLoadModuleESM(compiledProgramCode, context) {
184
184
  compositeKey = `${namespaceKey}:${codeHash}`;
185
185
  // Clean up orphaned module file if path changed
186
186
  if (refreshedPath !== originalFilePath) {
187
- getLocalFs().remove(originalFilePath).catch(() => { });
187
+ getLocalFs().remove(originalFilePath).catch((error) => logger.debug(`${LOG_PREFIX_MDX_LOADER} orphaned module file cleanup failed`, {
188
+ originalFilePath,
189
+ error,
190
+ }));
188
191
  }
189
192
  // Verify bundles exist after re-fetch
190
193
  const refreshedBundles = extractHttpBundlePaths(rewritten);
@@ -241,7 +244,10 @@ export async function doLoadModuleESM(compiledProgramCode, context) {
241
244
  compositeKey = `${namespaceKey}:${codeHash}`;
242
245
  // Clean up orphaned module file if path changed
243
246
  if (refreshedPath !== originalFilePath) {
244
- getLocalFs().remove(originalFilePath).catch(() => { });
247
+ getLocalFs().remove(originalFilePath).catch((error) => logger.debug(`${LOG_PREFIX_MDX_LOADER} orphaned module file cleanup failed`, {
248
+ originalFilePath,
249
+ error,
250
+ }));
245
251
  }
246
252
  // Verify bundles now exist
247
253
  const stillMissing = await findMissingFrameworkBundles(extractFrameworkBundlePaths(rewritten));
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAarE,OAAO,EAOL,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAKxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAwED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,MAAM,GAAG,IAAI,CAKf;AAwMD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,gBAAgB,EACrB,oBAAoB,UAAQ,EAC5B,KAAK,SAAI,GACR,OAAO,CAAC,MAAM,CAAC,CAsPjB;AAED;;;GAGG;AACH,wBAAsB,kCAAkC,CACtD,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CxB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CAEjB"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAcrE,OAAO,EAOL,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAKxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AA8ED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,MAAM,GAAG,IAAI,CAKf;AAwMD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,gBAAgB,EACrB,oBAAoB,UAAQ,EAC5B,KAAK,SAAI,GACR,OAAO,CAAC,MAAM,CAAC,CAsPjB;AAED;;;GAGG;AACH,wBAAsB,kCAAkC,CACtD,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CxB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CAEjB"}
@@ -10,6 +10,7 @@ import { rendererLogger as logger } from "../../../../utils/index.js";
10
10
  import { IMPORT_RESOLUTION_ERROR } from "../../../../errors/index.js";
11
11
  import { replaceSpecifiers } from "../../../esm/lexer.js";
12
12
  import { hashCodeHex } from "../../../../utils/hash-utils.js";
13
+ import { LRUCache } from "../../../../utils/lru-wrapper.js";
13
14
  import { getHttpBundleCacheDir, getMdxEsmCacheDir } from "../../../../utils/cache-dir.js";
14
15
  import { cacheHttpImportsToLocal } from "../../../esm/http-cache.js";
15
16
  import { loadImportMap } from "../../../../modules/import-map/index.js";
@@ -69,7 +70,13 @@ export async function cacheTransformedCode(transformed, vfModulePath, fs) {
69
70
  // React, HTTP imports all rewritten). The fallback still reads
70
71
  // `frameworkFileCache` first, so when the main path has already produced
71
72
  // a high-quality entry the fallback prefers it.
72
- const fallbackTransformCache = new Map();
73
+ // Bounded so the fallback's per-path output cannot grow memory without limit
74
+ // in a long-running dev server. Entries are deterministic per resolved path and
75
+ // safe to evict/recompute.
76
+ const FALLBACK_TRANSFORM_CACHE_MAX_ENTRIES = 2000;
77
+ const fallbackTransformCache = new LRUCache({
78
+ maxEntries: FALLBACK_TRANSFORM_CACHE_MAX_ENTRIES,
79
+ });
73
80
  /**
74
81
  * Resolve a bare `react` / `react-dom` (or subpath) specifier to its esm.sh
75
82
  * URL for the given React version. Returns `null` for anything that is not a
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.629";
2
+ export declare const VERSION = "0.1.631";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.629";
4
+ export const VERSION = "0.1.631";
@@ -6,8 +6,6 @@
6
6
  */
7
7
  export type { RunExecutionConfig, RunExecutionInfo, RunExecutionStatus, RunExecutor, } from "./types.js";
8
8
  export { isRunExecutor } from "./types.js";
9
- export { K8sRunExecutor } from "./k8s.js";
10
- export type { K8sClient, K8sRunExecutionSpec, K8sRunExecutionStatusResponse, K8sRunExecutorConfig, } from "./k8s.js";
11
9
  export { ProcessRunExecutor } from "./process.js";
12
10
  export type { ProcessRunExecutorConfig } from "./process.js";
13
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
@@ -5,7 +5,5 @@
5
5
  * environments.
6
6
  */
7
7
  export { isRunExecutor } from "./types.js";
8
- // K8s Executor
9
- export { K8sRunExecutor } from "./k8s.js";
10
8
  // Process Executor (local dev)
11
9
  export { ProcessRunExecutor } from "./process.js";
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * Abstraction layer for executing workflow runs in isolated environments.
5
5
  * Implementations can target different runtimes:
6
- * - Kubernetes Jobs
7
6
  * - Docker containers
8
7
  * - Local processes
9
8
  * - Cloud Run / Lambda / Fargate
@@ -57,22 +56,6 @@ export interface RunExecutionInfo {
57
56
  * Abstracts the runtime environment for executing workflow runs.
58
57
  * Each implementation handles the specifics of its target platform.
59
58
  *
60
- * @example K8s
61
- * ```typescript
62
- * const executor = new K8sRunExecutor({
63
- * namespace: "workflows",
64
- * image: "my-app:latest",
65
- * });
66
- * ```
67
- *
68
- * @example Docker
69
- * ```typescript
70
- * const executor = new DockerRunExecutor({
71
- * image: "my-app:latest",
72
- * network: "workflow-network",
73
- * });
74
- * ```
75
- *
76
59
  * @example Local Process
77
60
  * ```typescript
78
61
  * const executor = new ProcessRunExecutor({
@@ -80,6 +63,13 @@ export interface RunExecutionInfo {
80
63
  * args: ["run", "run-entrypoint.ts"],
81
64
  * });
82
65
  * ```
66
+ *
67
+ * @example Custom runtime target
68
+ * ```typescript
69
+ * const executor = new RuntimeTargetExecutor({
70
+ * invokeUrl: "https://project.example.com/api/control-plane/runs",
71
+ * });
72
+ * ```
83
73
  */
84
74
  export interface RunExecutor {
85
75
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IAEpB,8BAA8B;IAC9B,GAAG,EAAE,WAAW,CAAC;IAEjB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAElB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IAEpB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAE3B,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;IAEhB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,+BA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