veryfront 0.1.623 → 0.1.624
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/README.md +3 -3
- package/esm/cli/commands/knowledge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command-help.js +2 -3
- package/esm/cli/commands/knowledge/command.d.ts +2 -47
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +22 -124
- package/esm/cli/commands/knowledge/parser.d.ts +40 -0
- package/esm/cli/commands/knowledge/parser.d.ts.map +1 -0
- package/esm/cli/commands/knowledge/parser.js +353 -0
- package/esm/cli/commands/knowledge/result.d.ts +3 -3
- package/esm/cli/commands/knowledge/result.js +1 -1
- package/esm/cli/commands/styles/command.js +2 -2
- package/esm/cli/commands/task/command.js +4 -4
- package/esm/cli/commands/worker/command-help.js +4 -4
- package/esm/cli/commands/worker/command.d.ts +1 -1
- package/esm/cli/commands/worker/command.js +9 -9
- package/esm/cli/commands/workflow/command.js +4 -4
- package/esm/cli/utils/sanitize-run-output.d.ts +2 -0
- package/esm/cli/utils/sanitize-run-output.d.ts.map +1 -0
- package/esm/cli/utils/{sanitize-job-output.js → sanitize-run-output.js} +1 -1
- package/esm/cli/utils/write-run-result.d.ts +2 -0
- package/esm/cli/utils/write-run-result.d.ts.map +1 -0
- package/esm/cli/utils/write-run-result.js +16 -0
- package/esm/deno.d.ts +4 -3
- package/esm/deno.js +6 -5
- package/esm/src/build/production-build/static-generation.d.ts.map +1 -1
- package/esm/src/build/production-build/static-generation.js +85 -0
- package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/renderer.js +37 -4
- package/esm/src/integrations/_data.js +1 -1
- package/esm/src/integrations/schema.d.ts +8 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +3 -0
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +15 -1
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +2 -2
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/operations.js +2 -2
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.js +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +1 -0
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +27 -11
- package/esm/src/react/components/chat/chat/index.d.ts +1 -0
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +2 -2
- package/esm/src/react/components/chat/theme.js +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/applicator.js +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts +8 -0
- package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.js +19 -0
- package/esm/src/rendering/rsc/client-boot.ts +23 -6
- package/esm/src/runs/index.d.ts +27 -0
- package/esm/src/runs/index.d.ts.map +1 -0
- package/esm/src/runs/index.js +26 -0
- package/esm/src/runs/runs-client.d.ts +95 -0
- package/esm/src/runs/runs-client.d.ts.map +1 -0
- package/esm/src/runs/runs-client.js +181 -0
- package/esm/src/{jobs → runs}/runtime-env.d.ts.map +1 -1
- package/esm/src/{jobs → runs}/runtime-env.js +2 -2
- package/esm/src/runs/schemas.d.ts +236 -0
- package/esm/src/runs/schemas.d.ts.map +1 -0
- package/esm/src/runs/schemas.js +61 -0
- package/esm/src/security/deno-permissions.d.ts +2 -2
- package/esm/src/security/deno-permissions.js +2 -2
- package/esm/src/security/index.d.ts +1 -1
- package/esm/src/security/index.js +1 -1
- package/esm/src/server/build-app-route-renderer.d.ts +2 -0
- package/esm/src/server/build-app-route-renderer.d.ts.map +1 -1
- package/esm/src/server/build-app-route-renderer.js +51 -28
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +54 -8
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
- package/esm/src/server/services/static/static-file.service.js +9 -4
- package/esm/src/skill/index.d.ts +1 -1
- package/esm/src/skill/index.d.ts.map +1 -1
- package/esm/src/skill/index.js +1 -1
- package/esm/src/skill/prompt-augmentation.js +2 -2
- package/esm/src/skill/tools.d.ts +1 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +11 -9
- package/esm/src/skill/types.d.ts +1 -0
- package/esm/src/skill/types.d.ts.map +1 -1
- package/esm/src/skill/types.js +1 -0
- package/esm/src/task/runner.js +1 -1
- package/esm/src/task/types.d.ts +4 -4
- package/esm/src/task/types.d.ts.map +1 -1
- package/esm/src/task/types.js +1 -1
- package/esm/src/utils/index.d.ts +1 -1
- package/esm/src/utils/index.js +1 -1
- package/esm/src/utils/logger/index.d.ts +1 -1
- package/esm/src/utils/logger/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +6 -6
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +10 -10
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/executor/workflow-executor.js +3 -3
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts → dynamic-run-entrypoint.d.ts} +2 -2
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts.map → dynamic-run-entrypoint.d.ts.map} +1 -1
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.js → dynamic-run-entrypoint.js} +1 -1
- package/esm/src/workflow/worker/executors/index.d.ts +8 -8
- package/esm/src/workflow/worker/executors/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/index.js +5 -5
- package/esm/src/workflow/worker/executors/k8s.d.ts +34 -34
- package/esm/src/workflow/worker/executors/k8s.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/k8s.js +59 -58
- package/esm/src/workflow/worker/executors/process.d.ts +15 -15
- package/esm/src/workflow/worker/executors/process.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/process.js +86 -86
- package/esm/src/workflow/worker/executors/types.d.ts +38 -39
- package/esm/src/workflow/worker/executors/types.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/types.js +9 -10
- package/esm/src/workflow/worker/index.d.ts +7 -7
- package/esm/src/workflow/worker/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/index.js +9 -9
- package/esm/src/workflow/worker/{job-entrypoint.d.ts → run-entrypoint.d.ts} +3 -3
- package/esm/src/workflow/worker/{job-entrypoint.d.ts.map → run-entrypoint.d.ts.map} +1 -1
- package/esm/src/workflow/worker/{job-entrypoint.js → run-entrypoint.js} +2 -2
- package/esm/src/workflow/worker/{job-manager.d.ts → run-manager.d.ts} +32 -32
- package/esm/src/workflow/worker/run-manager.d.ts.map +1 -0
- package/esm/src/workflow/worker/{job-manager.js → run-manager.js} +63 -63
- package/esm/src/workflow/worker/shared.js +1 -1
- package/package.json +4 -4
- package/esm/cli/commands/knowledge/parser-source.d.ts +0 -2
- package/esm/cli/commands/knowledge/parser-source.d.ts.map +0 -1
- package/esm/cli/commands/knowledge/parser-source.js +0 -641
- package/esm/cli/utils/sanitize-job-output.d.ts +0 -2
- package/esm/cli/utils/sanitize-job-output.d.ts.map +0 -1
- package/esm/cli/utils/write-job-result.d.ts +0 -2
- package/esm/cli/utils/write-job-result.d.ts.map +0 -1
- package/esm/cli/utils/write-job-result.js +0 -16
- package/esm/src/jobs/index.d.ts +0 -25
- package/esm/src/jobs/index.d.ts.map +0 -1
- package/esm/src/jobs/index.js +0 -24
- package/esm/src/jobs/jobs-client.d.ts +0 -182
- package/esm/src/jobs/jobs-client.d.ts.map +0 -1
- package/esm/src/jobs/jobs-client.js +0 -255
- package/esm/src/jobs/schemas.d.ts +0 -1146
- package/esm/src/jobs/schemas.d.ts.map +0 -1
- package/esm/src/jobs/schemas.js +0 -294
- package/esm/src/workflow/worker/job-manager.d.ts.map +0 -1
- /package/esm/src/{jobs → runs}/runtime-env.d.ts +0 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
+
import { basename, extname, join } from "../../../src/platform/compat/path/index.js";
|
|
3
|
+
import { KreuzbergDocumentExtractor } from "../../../extensions/ext-document-kreuzberg/src/index.js";
|
|
4
|
+
const CODE_FENCE = "`".repeat(3);
|
|
5
|
+
const TEXT_FILE_EXTENSIONS = new Set([
|
|
6
|
+
".c",
|
|
7
|
+
".cc",
|
|
8
|
+
".conf",
|
|
9
|
+
".cpp",
|
|
10
|
+
".cs",
|
|
11
|
+
".css",
|
|
12
|
+
".go",
|
|
13
|
+
".h",
|
|
14
|
+
".hpp",
|
|
15
|
+
".ini",
|
|
16
|
+
".java",
|
|
17
|
+
".js",
|
|
18
|
+
".jsonl",
|
|
19
|
+
".jsx",
|
|
20
|
+
".kt",
|
|
21
|
+
".less",
|
|
22
|
+
".lua",
|
|
23
|
+
".mjs",
|
|
24
|
+
".ndjson",
|
|
25
|
+
".php",
|
|
26
|
+
".pl",
|
|
27
|
+
".py",
|
|
28
|
+
".r",
|
|
29
|
+
".rb",
|
|
30
|
+
".rs",
|
|
31
|
+
".sass",
|
|
32
|
+
".scala",
|
|
33
|
+
".scss",
|
|
34
|
+
".sh",
|
|
35
|
+
".sql",
|
|
36
|
+
".swift",
|
|
37
|
+
".toml",
|
|
38
|
+
".ts",
|
|
39
|
+
".tsx",
|
|
40
|
+
".xml",
|
|
41
|
+
".yaml",
|
|
42
|
+
".yml",
|
|
43
|
+
".zsh",
|
|
44
|
+
]);
|
|
45
|
+
const TEXT_FILE_NAMES = new Set([
|
|
46
|
+
"dockerfile",
|
|
47
|
+
"makefile",
|
|
48
|
+
"readme",
|
|
49
|
+
"license",
|
|
50
|
+
"changelog",
|
|
51
|
+
]);
|
|
52
|
+
const MIME_BY_EXTENSION = {
|
|
53
|
+
".csv": "text/csv",
|
|
54
|
+
".doc": "application/msword",
|
|
55
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
56
|
+
".epub": "application/epub+zip",
|
|
57
|
+
".htm": "text/html",
|
|
58
|
+
".html": "text/html",
|
|
59
|
+
".json": "application/json",
|
|
60
|
+
".md": "text/markdown",
|
|
61
|
+
".mdx": "text/mdx",
|
|
62
|
+
".pdf": "application/pdf",
|
|
63
|
+
".ppt": "application/vnd.ms-powerpoint",
|
|
64
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
65
|
+
".rtf": "application/rtf",
|
|
66
|
+
".tsv": "text/tab-separated-values",
|
|
67
|
+
".txt": "text/plain",
|
|
68
|
+
".xls": "application/vnd.ms-excel",
|
|
69
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
70
|
+
".xml": "text/xml",
|
|
71
|
+
};
|
|
72
|
+
export function slugifyKnowledgeValue(value) {
|
|
73
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") ||
|
|
74
|
+
"document";
|
|
75
|
+
}
|
|
76
|
+
function titleizeFilename(path) {
|
|
77
|
+
const name = basename(path);
|
|
78
|
+
const dot = name.lastIndexOf(".");
|
|
79
|
+
const stem = dot > 0 ? name.slice(0, dot) : name;
|
|
80
|
+
const title = stem.replaceAll("_", " ").replaceAll("-", " ").trim();
|
|
81
|
+
return title
|
|
82
|
+
.split(/\s+/)
|
|
83
|
+
.filter(Boolean)
|
|
84
|
+
.map((word) => `${word.slice(0, 1).toUpperCase()}${word.slice(1)}`)
|
|
85
|
+
.join(" ") || name;
|
|
86
|
+
}
|
|
87
|
+
function cleanText(value) {
|
|
88
|
+
return value.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
89
|
+
}
|
|
90
|
+
function yamlQuote(value) {
|
|
91
|
+
return JSON.stringify(value == null ? "" : String(value));
|
|
92
|
+
}
|
|
93
|
+
function buildFrontmatter(source, sourceType, description) {
|
|
94
|
+
return [
|
|
95
|
+
"---",
|
|
96
|
+
`source: ${yamlQuote(source)}`,
|
|
97
|
+
`source_type: ${yamlQuote(sourceType)}`,
|
|
98
|
+
`added: ${yamlQuote(new Date().toISOString().slice(0, 10))}`,
|
|
99
|
+
`description: ${yamlQuote(description)}`,
|
|
100
|
+
"---",
|
|
101
|
+
].join("\n");
|
|
102
|
+
}
|
|
103
|
+
function tableToMarkdown(rows) {
|
|
104
|
+
if (!rows.length)
|
|
105
|
+
return "";
|
|
106
|
+
const maxColumns = Math.max(...rows.map((row) => row.length));
|
|
107
|
+
if (maxColumns === 0)
|
|
108
|
+
return "";
|
|
109
|
+
const normalized = rows.map((row) => Array.from({ length: maxColumns }, (_, index) => (row[index] ?? "").replaceAll("|", "\\|").replaceAll("\n", " ").trim()));
|
|
110
|
+
const [header = [], ...body] = normalized;
|
|
111
|
+
return [
|
|
112
|
+
`| ${header.join(" | ")} |`,
|
|
113
|
+
`| ${Array.from({ length: maxColumns }, () => "---").join(" | ")} |`,
|
|
114
|
+
...body.map((row) => `| ${row.join(" | ")} |`),
|
|
115
|
+
].join("\n");
|
|
116
|
+
}
|
|
117
|
+
function parseCsvLine(line) {
|
|
118
|
+
const values = [];
|
|
119
|
+
let current = "";
|
|
120
|
+
let inQuotes = false;
|
|
121
|
+
for (let index = 0; index < line.length; index += 1) {
|
|
122
|
+
const char = line[index];
|
|
123
|
+
if (char === '"') {
|
|
124
|
+
if (inQuotes && line[index + 1] === '"') {
|
|
125
|
+
current += '"';
|
|
126
|
+
index += 1;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
inQuotes = !inQuotes;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else if (char === "," && !inQuotes) {
|
|
133
|
+
values.push(current.trim());
|
|
134
|
+
current = "";
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
current += char;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
values.push(current.trim());
|
|
141
|
+
return values;
|
|
142
|
+
}
|
|
143
|
+
async function parseCsvLike(path, delimiter) {
|
|
144
|
+
const raw = await dntShim.Deno.readTextFile(path);
|
|
145
|
+
const lines = raw.split("\n").filter((line) => line.trim());
|
|
146
|
+
if (!lines.length) {
|
|
147
|
+
return { content: "_Empty file._", stats: { rows: 0, columns: 0 }, warnings: [] };
|
|
148
|
+
}
|
|
149
|
+
const parseLine = delimiter === ","
|
|
150
|
+
? parseCsvLine
|
|
151
|
+
: (line) => line.split("\t").map((value) => value.trim());
|
|
152
|
+
const header = parseLine(lines[0] ?? "");
|
|
153
|
+
const data = lines.slice(1).map(parseLine);
|
|
154
|
+
const limitedRows = [header, ...data.slice(0, 200)];
|
|
155
|
+
const warnings = data.length > 200
|
|
156
|
+
? [`Truncated ${data.length - 200} rows from markdown output`]
|
|
157
|
+
: [];
|
|
158
|
+
const parts = [
|
|
159
|
+
`**Rows:** ${data.length} | **Columns:** ${header.length}`,
|
|
160
|
+
"",
|
|
161
|
+
tableToMarkdown(limitedRows),
|
|
162
|
+
];
|
|
163
|
+
if (data.length > 200) {
|
|
164
|
+
parts.push(`\n_...and ${data.length - 200} more rows (truncated)._`);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
content: parts.join("\n").trim(),
|
|
168
|
+
stats: { rows: data.length, columns: header.length },
|
|
169
|
+
warnings,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
async function parseText(path) {
|
|
173
|
+
const content = cleanText(await dntShim.Deno.readTextFile(path));
|
|
174
|
+
return {
|
|
175
|
+
content,
|
|
176
|
+
stats: { characters: content.length, lines: content ? content.split("\n").length : 0 },
|
|
177
|
+
warnings: [],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async function parseJson(path) {
|
|
181
|
+
const raw = await dntShim.Deno.readTextFile(path);
|
|
182
|
+
const data = JSON.parse(raw);
|
|
183
|
+
if (Array.isArray(data) && data.length > 0 && data[0] != null && typeof data[0] === "object" &&
|
|
184
|
+
!Array.isArray(data[0])) {
|
|
185
|
+
const first = data[0];
|
|
186
|
+
const headers = Object.keys(first);
|
|
187
|
+
const rows = data.slice(0, 200).map((entry) => {
|
|
188
|
+
const record = entry != null && typeof entry === "object" && !Array.isArray(entry)
|
|
189
|
+
? entry
|
|
190
|
+
: {};
|
|
191
|
+
return headers.map((header) => String(record[header] ?? ""));
|
|
192
|
+
});
|
|
193
|
+
const warnings = data.length > 200
|
|
194
|
+
? [`Truncated ${data.length - 200} records from markdown output`]
|
|
195
|
+
: [];
|
|
196
|
+
const parts = [
|
|
197
|
+
`**Records:** ${data.length} | **Fields:** ${headers.length}`,
|
|
198
|
+
"",
|
|
199
|
+
tableToMarkdown([headers, ...rows]),
|
|
200
|
+
];
|
|
201
|
+
if (data.length > 200) {
|
|
202
|
+
parts.push(`\n_...and ${data.length - 200} more records (truncated)._`);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
content: parts.join("\n").trim(),
|
|
206
|
+
stats: { records: data.length, fields: headers.length },
|
|
207
|
+
warnings,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
const rendered = JSON.stringify(data, null, 2);
|
|
211
|
+
return {
|
|
212
|
+
content: `${CODE_FENCE}json\n${rendered}\n${CODE_FENCE}`,
|
|
213
|
+
stats: { top_level_type: Array.isArray(data) ? "list" : typeof data },
|
|
214
|
+
warnings: [],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
async function parseWithKreuzberg(path, deps) {
|
|
218
|
+
const mimeType = MIME_BY_EXTENSION[extname(path).toLowerCase()] ?? "application/octet-stream";
|
|
219
|
+
const content = cleanText(await deps.extractDocumentText({ filePath: path, mimeType }));
|
|
220
|
+
return {
|
|
221
|
+
content: content || "_No extractable text found in document._",
|
|
222
|
+
stats: {
|
|
223
|
+
characters: content.length,
|
|
224
|
+
lines: content ? content.split("\n").length : 0,
|
|
225
|
+
engine: "kreuzberg",
|
|
226
|
+
},
|
|
227
|
+
warnings: [],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function selectParserDefinition(path) {
|
|
231
|
+
const extension = extname(path).toLowerCase();
|
|
232
|
+
const name = basename(path).toLowerCase();
|
|
233
|
+
if (extension === ".csv" || extension === ".tsv") {
|
|
234
|
+
const delimiter = extension === ".tsv" ? "\t" : ",";
|
|
235
|
+
return {
|
|
236
|
+
sourceType: extension.slice(1),
|
|
237
|
+
parse: (filePath) => parseCsvLike(filePath, delimiter),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (extension === ".txt" || extension === ".md" || extension === ".mdx") {
|
|
241
|
+
return { sourceType: extension.slice(1), parse: parseText };
|
|
242
|
+
}
|
|
243
|
+
if (extension === ".json") {
|
|
244
|
+
return { sourceType: "json", parse: parseJson };
|
|
245
|
+
}
|
|
246
|
+
if (TEXT_FILE_EXTENSIONS.has(extension)) {
|
|
247
|
+
return { sourceType: extension.slice(1), parse: parseText };
|
|
248
|
+
}
|
|
249
|
+
if (!extension && TEXT_FILE_NAMES.has(name)) {
|
|
250
|
+
return { sourceType: "text", parse: parseText };
|
|
251
|
+
}
|
|
252
|
+
if (extension in MIME_BY_EXTENSION) {
|
|
253
|
+
return {
|
|
254
|
+
sourceType: extension.slice(1),
|
|
255
|
+
parse: (filePath, deps) => parseWithKreuzberg(filePath, deps),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
throw new Error(`Unsupported file type: ${extension || name}`);
|
|
259
|
+
}
|
|
260
|
+
function buildSummary(sourceType, stats) {
|
|
261
|
+
if (stats.engine === "kreuzberg") {
|
|
262
|
+
return `Extracted ${sourceType.toUpperCase()} text with Kreuzberg (${stats.characters ?? 0} chars).`;
|
|
263
|
+
}
|
|
264
|
+
if (sourceType === "csv" || sourceType === "tsv") {
|
|
265
|
+
return `Parsed ${stats.rows ?? 0} rows across ${stats.columns ?? 0} columns.`;
|
|
266
|
+
}
|
|
267
|
+
if (sourceType === "json") {
|
|
268
|
+
if ("records" in stats) {
|
|
269
|
+
return `Parsed ${stats.records ?? 0} record(s) across ${stats.fields ?? 0} fields.`;
|
|
270
|
+
}
|
|
271
|
+
return `Converted JSON (${stats.top_level_type ?? "object"}) to markdown.`;
|
|
272
|
+
}
|
|
273
|
+
return `Converted document to markdown (${stats.characters ?? 0} chars).`;
|
|
274
|
+
}
|
|
275
|
+
async function defaultExtractDocumentText(input) {
|
|
276
|
+
const bytes = await dntShim.Deno.readFile(input.filePath);
|
|
277
|
+
const extractor = new KreuzbergDocumentExtractor();
|
|
278
|
+
return await extractor.extractInWorker(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength), input.mimeType);
|
|
279
|
+
}
|
|
280
|
+
export async function runKnowledgeParser(input, deps = {}) {
|
|
281
|
+
const [result] = await runKnowledgeParsers({
|
|
282
|
+
files: [{
|
|
283
|
+
filePath: input.filePath,
|
|
284
|
+
description: input.description,
|
|
285
|
+
slug: input.slug,
|
|
286
|
+
sourceReference: input.sourceReference,
|
|
287
|
+
}],
|
|
288
|
+
outputDir: input.outputDir,
|
|
289
|
+
}, deps);
|
|
290
|
+
if (!result) {
|
|
291
|
+
throw new Error("knowledge ingest parser returned no results");
|
|
292
|
+
}
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
export async function runKnowledgeParsers(input, deps = {}) {
|
|
296
|
+
if (!input.files.length) {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
const parserDeps = {
|
|
300
|
+
extractDocumentText: deps.extractDocumentText ?? defaultExtractDocumentText,
|
|
301
|
+
};
|
|
302
|
+
await dntShim.Deno.mkdir(input.outputDir, { recursive: true });
|
|
303
|
+
const results = [];
|
|
304
|
+
for (const file of input.files) {
|
|
305
|
+
try {
|
|
306
|
+
const stat = await dntShim.Deno.stat(file.filePath);
|
|
307
|
+
if (!stat.isFile) {
|
|
308
|
+
throw new Error(`File not found: ${file.filePath}`);
|
|
309
|
+
}
|
|
310
|
+
const definition = selectParserDefinition(file.filePath);
|
|
311
|
+
const parsed = await definition.parse(file.filePath, parserDeps);
|
|
312
|
+
const content = cleanText(parsed.content);
|
|
313
|
+
const fileName = basename(file.filePath);
|
|
314
|
+
const extension = extname(fileName);
|
|
315
|
+
const stem = extension ? fileName.slice(0, -extension.length) : fileName;
|
|
316
|
+
const slug = file.slug ?? slugifyKnowledgeValue(stem);
|
|
317
|
+
const description = file.description ?? `Parsed from ${basename(file.filePath)}`;
|
|
318
|
+
const title = titleizeFilename(file.filePath);
|
|
319
|
+
const outputPath = join(input.outputDir, `${slug}.md`);
|
|
320
|
+
const markdown = [
|
|
321
|
+
buildFrontmatter(file.sourceReference ?? basename(file.filePath), definition.sourceType, description),
|
|
322
|
+
"",
|
|
323
|
+
`# ${title}`,
|
|
324
|
+
"",
|
|
325
|
+
content,
|
|
326
|
+
"",
|
|
327
|
+
].join("\n");
|
|
328
|
+
await dntShim.Deno.writeTextFile(outputPath, markdown);
|
|
329
|
+
results.push({
|
|
330
|
+
success: true,
|
|
331
|
+
source_path: file.filePath,
|
|
332
|
+
source_filename: basename(file.filePath),
|
|
333
|
+
source_type: definition.sourceType,
|
|
334
|
+
slug,
|
|
335
|
+
sandbox_output_path: outputPath,
|
|
336
|
+
suggested_project_path: `knowledge/${slug}.md`,
|
|
337
|
+
description,
|
|
338
|
+
title,
|
|
339
|
+
summary: buildSummary(definition.sourceType, parsed.stats),
|
|
340
|
+
stats: parsed.stats,
|
|
341
|
+
warnings: parsed.warnings,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
if (error instanceof Error && error.message.startsWith("knowledge ingest parser failed")) {
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
349
|
+
throw new Error(`knowledge ingest parser failed: ${message}`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return results;
|
|
353
|
+
}
|
|
@@ -34,7 +34,7 @@ export interface KnowledgeIngestResultMetadata {
|
|
|
34
34
|
source_mode: "explicit_sources" | "path_prefix";
|
|
35
35
|
knowledge_path: string;
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
37
|
+
export interface KnowledgeIngestRunResult {
|
|
38
38
|
kind: "knowledge_ingest";
|
|
39
39
|
version: 1;
|
|
40
40
|
metadata: KnowledgeIngestResultMetadata;
|
|
@@ -43,12 +43,12 @@ export interface KnowledgeIngestJobResult {
|
|
|
43
43
|
skipped: KnowledgeIngestSkippedFileResult[];
|
|
44
44
|
failed: KnowledgeIngestFailedFileResult[];
|
|
45
45
|
}
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function buildKnowledgeIngestRunResult(input: {
|
|
47
47
|
requestedCount: number;
|
|
48
48
|
sourceMode: KnowledgeIngestResultMetadata["source_mode"];
|
|
49
49
|
knowledgePath: string;
|
|
50
50
|
ingested: KnowledgeIngestFileResult[];
|
|
51
51
|
skipped?: KnowledgeIngestSkippedFileResult[];
|
|
52
52
|
failed?: KnowledgeIngestFailedFileResult[];
|
|
53
|
-
}):
|
|
53
|
+
}): KnowledgeIngestRunResult;
|
|
54
54
|
//# sourceMappingURL=result.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { getConfig } from "../../../src/config/index.js";
|
|
|
4
4
|
import { enhanceAdapterWithFS, getEnv, isExtendedFSAdapter, runtime, } from "../../../src/platform/index.js";
|
|
5
5
|
import { buildPreparedCSSArtifactFromFiles, createStyleScopeProfile, resolveStyleContentVersion, } from "../../../src/rendering/styles.js";
|
|
6
6
|
import { cliLogger, exitProcess } from "../../utils/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { writeRunResultIfConfigured } from "../../utils/write-run-result.js";
|
|
8
8
|
const getStyleArtifactBuildConfigSchema = defineSchema((v) => v.object({
|
|
9
9
|
style_profile_hash: v.string().min(1).optional(),
|
|
10
10
|
branch: v.string().min(1).optional(),
|
|
@@ -194,7 +194,7 @@ export async function stylesCommand(options) {
|
|
|
194
194
|
value: selector.value,
|
|
195
195
|
},
|
|
196
196
|
};
|
|
197
|
-
await
|
|
197
|
+
await writeRunResultIfConfigured(result);
|
|
198
198
|
cliLogger.info(`Built style artifact ${build.hash}`);
|
|
199
199
|
}
|
|
200
200
|
catch (error) {
|
|
@@ -8,8 +8,8 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
8
8
|
import { cliLogger } from "../../utils/index.js";
|
|
9
9
|
import { exitProcess } from "../../utils/index.js";
|
|
10
10
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { sanitizeRunOutputForLogging } from "../../utils/sanitize-run-output.js";
|
|
12
|
+
import { writeRunResultIfConfigured } from "../../utils/write-run-result.js";
|
|
13
13
|
export async function taskCommand(options) {
|
|
14
14
|
const { discoverTasks } = await import("../../../src/task/discovery.js");
|
|
15
15
|
const { runTask } = await import("../../../src/task/runner.js");
|
|
@@ -77,8 +77,8 @@ export async function taskCommand(options) {
|
|
|
77
77
|
if (result.success) {
|
|
78
78
|
cliLogger.info(`Task completed in ${result.durationMs}ms`);
|
|
79
79
|
if (result.result !== undefined) {
|
|
80
|
-
await
|
|
81
|
-
cliLogger.info(`Result: ${JSON.stringify(
|
|
80
|
+
await writeRunResultIfConfigured(result.result);
|
|
81
|
+
cliLogger.info(`Result: ${JSON.stringify(sanitizeRunOutputForLogging(result.result), null, 2)}`);
|
|
82
82
|
}
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -11,7 +11,7 @@ export const workerHelp = {
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
flag: "-c, --concurrency <number>",
|
|
14
|
-
description: "Maximum concurrent
|
|
14
|
+
description: "Maximum concurrent runs",
|
|
15
15
|
default: "3",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -26,13 +26,13 @@ export const workerHelp = {
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
flag: "-e, --executor <type>",
|
|
29
|
-
description: "
|
|
29
|
+
description: "Run executor type (process | k8s)",
|
|
30
30
|
default: "process",
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
flag: "--entrypoint <path>",
|
|
34
34
|
description: "Path to workflow run entrypoint script",
|
|
35
|
-
default: "./workflow-
|
|
35
|
+
default: "./workflow-run.ts",
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
flag: "--debug",
|
|
@@ -42,6 +42,6 @@ export const workerHelp = {
|
|
|
42
42
|
examples: [
|
|
43
43
|
"veryfront worker",
|
|
44
44
|
"veryfront worker --redis-url redis://prod:6379 --concurrency 5",
|
|
45
|
-
"veryfront worker --entrypoint ./src/
|
|
45
|
+
"veryfront worker --entrypoint ./src/runs/workflow-runner.ts --debug",
|
|
46
46
|
],
|
|
47
47
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Worker command - Start workflow run worker
|
|
3
3
|
*
|
|
4
4
|
* Polls Redis for pending/stalled workflow runs and executes them
|
|
5
|
-
* as isolated processes. Supports multi-tenant execution: each
|
|
5
|
+
* as isolated processes. Supports multi-tenant execution: each run
|
|
6
6
|
* runs with its own tenant context captured at workflow creation time.
|
|
7
7
|
*/
|
|
8
8
|
import type { WorkerArgs } from "./handler.js";
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Worker command - Start workflow run worker
|
|
3
3
|
*
|
|
4
4
|
* Polls Redis for pending/stalled workflow runs and executes them
|
|
5
|
-
* as isolated processes. Supports multi-tenant execution: each
|
|
5
|
+
* as isolated processes. Supports multi-tenant execution: each run
|
|
6
6
|
* runs with its own tenant context captured at workflow creation time.
|
|
7
7
|
*/
|
|
8
8
|
import { cliLogger } from "../../utils/index.js";
|
|
9
9
|
import { exitProcess, registerTerminationSignals, showLogo } from "../../utils/index.js";
|
|
10
10
|
export async function workerCommand(options) {
|
|
11
11
|
showLogo();
|
|
12
|
-
const { WorkflowRunManager } = await import("../../../src/workflow/worker/
|
|
13
|
-
const {
|
|
12
|
+
const { WorkflowRunManager } = await import("../../../src/workflow/worker/run-manager.js");
|
|
13
|
+
const { ProcessRunExecutor } = await import("../../../src/workflow/worker/executors/process.js");
|
|
14
14
|
const { RedisBackend } = await import("../../../src/workflow/backends/redis.js");
|
|
15
15
|
cliLogger.info("Starting workflow worker...");
|
|
16
16
|
cliLogger.info(` Redis: ${options.redisUrl}`);
|
|
@@ -25,18 +25,18 @@ export async function workerCommand(options) {
|
|
|
25
25
|
if (backend.initialize) {
|
|
26
26
|
await backend.initialize();
|
|
27
27
|
}
|
|
28
|
-
// Create
|
|
28
|
+
// Create run executor
|
|
29
29
|
// The entrypoint script runs inside each spawned process.
|
|
30
30
|
// It reads WORKFLOW_RUN_ID + TENANT_* env vars, discovers workflows
|
|
31
31
|
// from the user's project, and executes the matching one.
|
|
32
|
-
const entrypointPath = options.entrypoint ?? "./workflow-
|
|
32
|
+
const entrypointPath = options.entrypoint ?? "./workflow-run.ts";
|
|
33
33
|
if (options.executor === "k8s") {
|
|
34
34
|
cliLogger.error("K8s executor requires custom configuration. Use --executor process for local dev, " +
|
|
35
|
-
"or configure
|
|
35
|
+
"or configure K8sRunExecutor programmatically for production.");
|
|
36
36
|
exitProcess(1);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const executor = new
|
|
39
|
+
const executor = new ProcessRunExecutor({
|
|
40
40
|
entrypointPath,
|
|
41
41
|
env: {
|
|
42
42
|
REDIS_URL: options.redisUrl,
|
|
@@ -48,7 +48,7 @@ export async function workerCommand(options) {
|
|
|
48
48
|
backend,
|
|
49
49
|
executor,
|
|
50
50
|
pollInterval: options.pollInterval,
|
|
51
|
-
|
|
51
|
+
maxConcurrentExecutions: options.concurrency,
|
|
52
52
|
stalledThreshold: options.stalledThreshold,
|
|
53
53
|
debug: options.debug,
|
|
54
54
|
});
|
|
@@ -67,7 +67,7 @@ export async function workerCommand(options) {
|
|
|
67
67
|
await backend.destroy();
|
|
68
68
|
const stats = manager.getStats();
|
|
69
69
|
cliLogger.info("Worker stopped.");
|
|
70
|
-
cliLogger.info(`
|
|
70
|
+
cliLogger.info(` Runs: ${stats.executionsCreated} created, ${stats.executionsCompleted} completed, ${stats.executionsFailed} failed`);
|
|
71
71
|
}
|
|
72
72
|
catch (error) {
|
|
73
73
|
cliLogger.warn("Error during shutdown:", error);
|
|
@@ -2,8 +2,8 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
2
2
|
import { cliLogger } from "../../utils/index.js";
|
|
3
3
|
import { exitProcess } from "../../utils/index.js";
|
|
4
4
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { sanitizeRunOutputForLogging } from "../../utils/sanitize-run-output.js";
|
|
6
|
+
import { writeRunResultIfConfigured } from "../../utils/write-run-result.js";
|
|
7
7
|
import { getEnv } from "../../../src/platform/index.js";
|
|
8
8
|
const WORKFLOW_STATUS_POLL_INTERVAL_MS = 1_000;
|
|
9
9
|
const MAX_DISCOVERY_ERRORS_TO_PRINT = 5;
|
|
@@ -38,8 +38,8 @@ async function waitForWorkflowExit(client, runId) {
|
|
|
38
38
|
if (run.status === "completed") {
|
|
39
39
|
cliLogger.info(`Workflow completed: ${runId}`);
|
|
40
40
|
if (run.output !== undefined) {
|
|
41
|
-
await
|
|
42
|
-
cliLogger.info(`Result: ${JSON.stringify(
|
|
41
|
+
await writeRunResultIfConfigured(run.output);
|
|
42
|
+
cliLogger.info(`Result: ${JSON.stringify(sanitizeRunOutputForLogging(run.output), null, 2)}`);
|
|
43
43
|
}
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-run-output.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/sanitize-run-output.ts"],"names":[],"mappings":"AAoBA,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-run-result.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/write-run-result.ts"],"names":[],"mappings":"AAWA,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { dirname } from "../../src/platform/compat/path/index.js";
|
|
3
|
+
import { sanitizeRunOutputForLogging } from "./sanitize-run-output.js";
|
|
4
|
+
const RUN_RESULT_PATH_ENV = "VERYFRONT_RUN_RESULT_PATH";
|
|
5
|
+
function getRunResultPath() {
|
|
6
|
+
const value = dntShim.Deno.env.get(RUN_RESULT_PATH_ENV)?.trim();
|
|
7
|
+
return value ? value : null;
|
|
8
|
+
}
|
|
9
|
+
export async function writeRunResultIfConfigured(value) {
|
|
10
|
+
const resultPath = getRunResultPath();
|
|
11
|
+
if (!resultPath) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
await dntShim.Deno.mkdir(dirname(resultPath), { recursive: true });
|
|
15
|
+
await dntShim.Deno.writeTextFile(resultPath, JSON.stringify(sanitizeRunOutputForLogging(value), null, 2));
|
|
16
|
+
}
|
package/esm/deno.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ declare namespace _default {
|
|
|
34
34
|
"./schemas": string;
|
|
35
35
|
"./prompt": string;
|
|
36
36
|
"./resource": string;
|
|
37
|
-
"./
|
|
37
|
+
"./runs": string;
|
|
38
38
|
"./mcp": string;
|
|
39
39
|
"./middleware": string;
|
|
40
40
|
"./observability": string;
|
|
@@ -94,7 +94,7 @@ declare namespace _default {
|
|
|
94
94
|
"veryfront/components/chat": string;
|
|
95
95
|
"veryfront/sandbox": string;
|
|
96
96
|
"veryfront/embedding": string;
|
|
97
|
-
"veryfront/
|
|
97
|
+
"veryfront/runs": string;
|
|
98
98
|
"veryfront/agent/identity": string;
|
|
99
99
|
"veryfront/agent/react": string;
|
|
100
100
|
"veryfront/agent/testing": string;
|
|
@@ -179,7 +179,8 @@ declare namespace _default {
|
|
|
179
179
|
"#veryfront/react": string;
|
|
180
180
|
"#veryfront/rendering": string;
|
|
181
181
|
"#veryfront/resource": string;
|
|
182
|
-
"#veryfront/
|
|
182
|
+
"#veryfront/runs": string;
|
|
183
|
+
"#veryfront/runs/": string;
|
|
183
184
|
"#veryfront/routing": string;
|
|
184
185
|
"#veryfront/security": string;
|
|
185
186
|
"#veryfront/skill": string;
|