veryfront 0.1.73 → 0.1.75
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/cli/commands/knowledge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command-help.js +3 -1
- package/esm/cli/commands/knowledge/command.d.ts +34 -5
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +151 -22
- package/esm/cli/commands/knowledge/parser-source.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/parser-source.js +110 -5
- package/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/data/data-fetcher.d.ts +11 -1
- package/esm/src/data/data-fetcher.d.ts.map +1 -1
- package/esm/src/data/data-fetcher.js +5 -2
- package/esm/src/data/index.d.ts +1 -1
- package/esm/src/data/index.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.d.ts +14 -1
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +49 -3
- package/esm/src/rendering/orchestrator/lifecycle.d.ts +4 -0
- package/esm/src/rendering/orchestrator/lifecycle.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/lifecycle.js +8 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +6 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +26 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +77 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +6 -2
- package/esm/src/routing/api/route-executor.d.ts +8 -2
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +131 -3
- package/esm/src/security/deno-permissions.d.ts +6 -0
- package/esm/src/security/deno-permissions.d.ts.map +1 -1
- package/esm/src/security/deno-permissions.js +10 -0
- package/esm/src/security/sandbox/project-worker.d.ts +61 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -0
- package/esm/src/security/sandbox/project-worker.js +318 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts +30 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-permissions.js +60 -0
- package/esm/src/security/sandbox/worker-pool.d.ts +87 -0
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-pool.js +356 -0
- package/esm/src/security/sandbox/worker-types.d.ts +165 -0
- package/esm/src/security/sandbox/worker-types.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-types.js +17 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts +2 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +6 -2
- package/esm/src/server/project-env/storage.d.ts +6 -0
- package/esm/src/server/project-env/storage.d.ts.map +1 -1
- package/esm/src/server/project-env/storage.js +8 -0
- package/esm/src/server/runtime-handler/adapter-factory.d.ts +3 -0
- package/esm/src/server/runtime-handler/adapter-factory.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/adapter-factory.js +6 -5
- package/esm/src/server/runtime-handler/index.d.ts +33 -0
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +103 -37
- package/esm/src/server/runtime-handler/local-project-discovery.d.ts +32 -4
- package/esm/src/server/runtime-handler/local-project-discovery.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/local-project-discovery.js +46 -16
- package/esm/src/server/runtime-handler/project-isolation.d.ts +5 -0
- package/esm/src/server/runtime-handler/project-isolation.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-isolation.js +44 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts +19 -1
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +9 -1
- package/esm/src/server/shared/renderer/adapter.d.ts +25 -0
- package/esm/src/server/shared/renderer/adapter.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/adapter.js +83 -10
- package/esm/src/server/shared/renderer/index.d.ts +1 -1
- package/esm/src/server/shared/renderer/index.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/index.js +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.d.ts +7 -0
- package/esm/src/server/shared/renderer/memory/pressure.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.js +7 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts +4 -4
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +15 -15
- package/esm/src/utils/index.d.ts +10 -1
- package/esm/src/utils/index.d.ts.map +1 -1
- package/esm/src/utils/index.js +9 -1
- package/esm/src/utils/logger/index.d.ts +1 -1
- package/esm/src/utils/logger/index.d.ts.map +1 -1
- package/esm/src/utils/logger/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +14 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +17 -0
- package/esm/src/workflow/claude-code/tool.d.ts +5 -5
- package/package.json +4 -1
- package/src/cli/commands/knowledge/command-help.ts +3 -1
- package/src/cli/commands/knowledge/command.ts +180 -22
- package/src/cli/commands/knowledge/parser-source.ts +110 -5
- package/src/deno.js +3 -1
- package/src/src/data/data-fetcher.ts +18 -2
- package/src/src/data/index.ts +1 -1
- package/src/src/data/server-data-fetcher.ts +78 -3
- package/src/src/rendering/orchestrator/lifecycle.ts +11 -0
- package/src/src/rendering/orchestrator/pipeline.ts +7 -2
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +119 -0
- package/src/src/routing/api/handler.ts +16 -3
- package/src/src/routing/api/route-executor.ts +222 -1
- package/src/src/security/deno-permissions.ts +11 -0
- package/src/src/security/sandbox/project-worker.ts +416 -0
- package/src/src/security/sandbox/worker-permissions.ts +74 -0
- package/src/src/security/sandbox/worker-pool.ts +451 -0
- package/src/src/security/sandbox/worker-types.ts +209 -0
- package/src/src/server/handlers/request/ssr/ssr.handler.ts +11 -2
- package/src/src/server/project-env/storage.ts +9 -0
- package/src/src/server/runtime-handler/adapter-factory.ts +13 -5
- package/src/src/server/runtime-handler/index.ts +132 -39
- package/src/src/server/runtime-handler/local-project-discovery.ts +51 -17
- package/src/src/server/runtime-handler/project-isolation.ts +53 -0
- package/src/src/server/services/rendering/ssr.service.ts +34 -3
- package/src/src/server/shared/renderer/adapter.ts +107 -8
- package/src/src/server/shared/renderer/index.ts +7 -1
- package/src/src/server/shared/renderer/memory/pressure.ts +8 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts +18 -12
- package/src/src/utils/index.ts +11 -0
- package/src/src/utils/logger/index.ts +1 -0
- package/src/src/utils/logger/logger.ts +34 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,WAuC3B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const knowledgeHelp = {
|
|
2
2
|
name: "knowledge",
|
|
3
3
|
description: "Ingest documents into the project knowledge base",
|
|
4
|
-
usage: "veryfront knowledge ingest <source
|
|
4
|
+
usage: "veryfront knowledge ingest <source...> [options]",
|
|
5
5
|
options: [
|
|
6
6
|
{
|
|
7
7
|
flag: "--project, -p <slug>",
|
|
@@ -26,6 +26,7 @@ export const knowledgeHelp = {
|
|
|
26
26
|
],
|
|
27
27
|
examples: [
|
|
28
28
|
"veryfront knowledge ingest uploads/contracts/q1.pdf --json",
|
|
29
|
+
"veryfront knowledge ingest uploads/contracts/a.pdf uploads/contracts/b.pdf uploads/contracts/c.pdf --json",
|
|
29
30
|
"veryfront knowledge ingest /workspace/uploads/q1.pdf --json",
|
|
30
31
|
"veryfront knowledge ingest --path uploads/ --all --json",
|
|
31
32
|
],
|
|
@@ -34,5 +35,6 @@ export const knowledgeHelp = {
|
|
|
34
35
|
"`uploads/...` means a remote project upload; use `./uploads/...` or `/workspace/uploads/...` to force a local file",
|
|
35
36
|
"`ingest` orchestrates upload resolution, parsing, and project file writes",
|
|
36
37
|
"Requires python3; non-text formats also require the supported parser packages unless you run inside the Veryfront sandbox",
|
|
38
|
+
"The Veryfront sandbox image includes `kreuzberg`, and knowledge ingest falls back to the built-in parser when `kreuzberg` is unavailable or extraction fails",
|
|
37
39
|
],
|
|
38
40
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type ApiClient } from "../../shared/config.js";
|
|
3
3
|
import type { ParsedArgs } from "../../shared/types.js";
|
|
4
|
+
import { type Logger } from "../../../src/utils/index.js";
|
|
4
5
|
export interface KnowledgeParserResult {
|
|
5
6
|
success: true;
|
|
6
7
|
source_path: string;
|
|
@@ -41,10 +42,10 @@ type DownloadResult = {
|
|
|
41
42
|
localPath: string;
|
|
42
43
|
bytes?: number;
|
|
43
44
|
};
|
|
44
|
-
declare const KnowledgeIngestArgsSchema: z.ZodObject<{
|
|
45
|
+
declare const KnowledgeIngestArgsSchema: z.ZodEffects<z.ZodObject<{
|
|
45
46
|
projectSlug: z.ZodOptional<z.ZodString>;
|
|
46
47
|
projectDir: z.ZodOptional<z.ZodString>;
|
|
47
|
-
|
|
48
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
48
49
|
path: z.ZodOptional<z.ZodString>;
|
|
49
50
|
all: z.ZodDefault<z.ZodBoolean>;
|
|
50
51
|
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -58,6 +59,7 @@ declare const KnowledgeIngestArgsSchema: z.ZodObject<{
|
|
|
58
59
|
json: boolean;
|
|
59
60
|
recursive: boolean;
|
|
60
61
|
all: boolean;
|
|
62
|
+
sources: string[];
|
|
61
63
|
quiet: boolean;
|
|
62
64
|
knowledgePath: string;
|
|
63
65
|
path?: string | undefined;
|
|
@@ -66,7 +68,6 @@ declare const KnowledgeIngestArgsSchema: z.ZodObject<{
|
|
|
66
68
|
outputDir?: string | undefined;
|
|
67
69
|
projectDir?: string | undefined;
|
|
68
70
|
slug?: string | undefined;
|
|
69
|
-
source?: string | undefined;
|
|
70
71
|
}, {
|
|
71
72
|
path?: string | undefined;
|
|
72
73
|
projectSlug?: string | undefined;
|
|
@@ -77,7 +78,33 @@ declare const KnowledgeIngestArgsSchema: z.ZodObject<{
|
|
|
77
78
|
projectDir?: string | undefined;
|
|
78
79
|
slug?: string | undefined;
|
|
79
80
|
all?: boolean | undefined;
|
|
80
|
-
|
|
81
|
+
sources?: string[] | undefined;
|
|
82
|
+
quiet?: boolean | undefined;
|
|
83
|
+
knowledgePath?: string | undefined;
|
|
84
|
+
}>, {
|
|
85
|
+
json: boolean;
|
|
86
|
+
recursive: boolean;
|
|
87
|
+
all: boolean;
|
|
88
|
+
sources: string[];
|
|
89
|
+
quiet: boolean;
|
|
90
|
+
knowledgePath: string;
|
|
91
|
+
path?: string | undefined;
|
|
92
|
+
projectSlug?: string | undefined;
|
|
93
|
+
description?: string | undefined;
|
|
94
|
+
outputDir?: string | undefined;
|
|
95
|
+
projectDir?: string | undefined;
|
|
96
|
+
slug?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
path?: string | undefined;
|
|
99
|
+
projectSlug?: string | undefined;
|
|
100
|
+
description?: string | undefined;
|
|
101
|
+
outputDir?: string | undefined;
|
|
102
|
+
json?: boolean | undefined;
|
|
103
|
+
recursive?: boolean | undefined;
|
|
104
|
+
projectDir?: string | undefined;
|
|
105
|
+
slug?: string | undefined;
|
|
106
|
+
all?: boolean | undefined;
|
|
107
|
+
sources?: string[] | undefined;
|
|
81
108
|
quiet?: boolean | undefined;
|
|
82
109
|
knowledgePath?: string | undefined;
|
|
83
110
|
}>;
|
|
@@ -102,8 +129,9 @@ export declare function runKnowledgeParser(input: {
|
|
|
102
129
|
description?: string;
|
|
103
130
|
slug?: string;
|
|
104
131
|
sourceReference?: string;
|
|
132
|
+
env?: Record<string, string>;
|
|
105
133
|
}): Promise<KnowledgeParserResult>;
|
|
106
|
-
export declare function collectKnowledgeSources(options: Pick<KnowledgeIngestOptions, "
|
|
134
|
+
export declare function collectKnowledgeSources(options: Pick<KnowledgeIngestOptions, "sources" | "path" | "all" | "recursive">, deps: {
|
|
107
135
|
client: ApiClient;
|
|
108
136
|
projectSlug: string;
|
|
109
137
|
downloadUploads: (uploadPaths: string[]) => Promise<DownloadResult[]>;
|
|
@@ -116,6 +144,7 @@ export declare function ingestResolvedSources(sources: KnowledgeSource[], option
|
|
|
116
144
|
uploadKnowledgeFile: (remotePath: string, localPath: string) => Promise<{
|
|
117
145
|
path: string;
|
|
118
146
|
}>;
|
|
147
|
+
eventLogger?: Logger | null;
|
|
119
148
|
}): Promise<KnowledgeIngestFileResult[]>;
|
|
120
149
|
export declare function knowledgeCommand(args: ParsedArgs): Promise<void>;
|
|
121
150
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,wBAAwB,CAAC;AAChG,OAAO,KAAK,EAAE,UAAU,EAA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AgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA+FtE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { createFileSystem } from "../../../src/platform/index.js";
|
|
3
|
+
import { createFileSystem, getEnv } from "../../../src/platform/index.js";
|
|
4
4
|
import { basename, extname, join, normalize, relative } from "../../../src/platform/compat/path/index.js";
|
|
5
5
|
import { withSpan } from "../../../src/observability/tracing/otlp-setup.js";
|
|
6
6
|
import { cliLogger } from "../../utils/index.js";
|
|
@@ -8,6 +8,7 @@ import { createApiClient, resolveConfigWithAuth } from "../../shared/config.js";
|
|
|
8
8
|
import { downloadUploadToFile, listAllUploads } from "../uploads/command.js";
|
|
9
9
|
import { putRemoteFileFromLocal } from "../files/command.js";
|
|
10
10
|
import { knowledgeIngestPythonSource } from "./parser-source.js";
|
|
11
|
+
import { createJobUserLogger, serverLogger } from "../../../src/utils/index.js";
|
|
11
12
|
const SUPPORTED_EXTENSIONS = new Set([
|
|
12
13
|
".pdf",
|
|
13
14
|
".csv",
|
|
@@ -23,10 +24,11 @@ const SUPPORTED_EXTENSIONS = new Set([
|
|
|
23
24
|
".md",
|
|
24
25
|
".mdx",
|
|
25
26
|
]);
|
|
27
|
+
const knowledgeJobLogger = serverLogger.component("knowledge-ingest");
|
|
26
28
|
const KnowledgeIngestArgsSchema = z.object({
|
|
27
29
|
projectSlug: z.string().optional(),
|
|
28
30
|
projectDir: z.string().optional(),
|
|
29
|
-
|
|
31
|
+
sources: z.array(z.string()).default([]),
|
|
30
32
|
path: z.string().optional(),
|
|
31
33
|
all: z.boolean().default(false),
|
|
32
34
|
recursive: z.boolean().default(false),
|
|
@@ -36,6 +38,39 @@ const KnowledgeIngestArgsSchema = z.object({
|
|
|
36
38
|
slug: z.string().optional(),
|
|
37
39
|
json: z.boolean().default(false),
|
|
38
40
|
quiet: z.boolean().default(false),
|
|
41
|
+
}).superRefine((value, ctx) => {
|
|
42
|
+
const hasExplicitSources = value.sources.length > 0;
|
|
43
|
+
const hasPath = typeof value.path === "string" && value.path.length > 0;
|
|
44
|
+
if (hasExplicitSources && (hasPath || value.all)) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: z.ZodIssueCode.custom,
|
|
47
|
+
message: "Use either explicit source paths or --path with --all, not both.",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!hasExplicitSources && !hasPath && !value.all) {
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
53
|
+
message: "Provide one or more source paths or use --path with --all.",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (hasPath && !value.all) {
|
|
57
|
+
ctx.addIssue({
|
|
58
|
+
code: z.ZodIssueCode.custom,
|
|
59
|
+
message: "--path requires --all.",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (!hasPath && value.all) {
|
|
63
|
+
ctx.addIssue({
|
|
64
|
+
code: z.ZodIssueCode.custom,
|
|
65
|
+
message: "--all requires --path.",
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (value.slug && value.sources.length !== 1) {
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
code: z.ZodIssueCode.custom,
|
|
71
|
+
message: "--slug can only be used with a single explicit source.",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
39
74
|
});
|
|
40
75
|
function getStringArg(args, ...keys) {
|
|
41
76
|
for (const key of keys) {
|
|
@@ -51,12 +86,29 @@ function getBooleanArg(args, ...keys) {
|
|
|
51
86
|
function printJson(value) {
|
|
52
87
|
console.log(JSON.stringify(value, null, 2));
|
|
53
88
|
}
|
|
89
|
+
function createKnowledgeIngestEventLogger() {
|
|
90
|
+
const projectId = getEnv("TENANT_PROJECT_ID");
|
|
91
|
+
const jobId = getEnv("JOB_ID");
|
|
92
|
+
if (!projectId || !jobId) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return createJobUserLogger(knowledgeJobLogger, {
|
|
96
|
+
projectId,
|
|
97
|
+
jobId,
|
|
98
|
+
batchId: getEnv("JOB_BATCH_ID") ?? undefined,
|
|
99
|
+
jobTarget: getEnv("JOB_TARGET") ?? undefined,
|
|
100
|
+
task: "knowledge-ingest",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function buildKnowledgeSourceName(source) {
|
|
104
|
+
return basename(source.kind === "upload" ? source.uploadPath : source.localPath);
|
|
105
|
+
}
|
|
54
106
|
function showKnowledgeUsage() {
|
|
55
107
|
console.log(`
|
|
56
108
|
Veryfront Knowledge
|
|
57
109
|
|
|
58
110
|
Usage:
|
|
59
|
-
veryfront knowledge ingest <source
|
|
111
|
+
veryfront knowledge ingest <source...> [options]
|
|
60
112
|
veryfront knowledge ingest --path <prefix-or-dir> --all [options]
|
|
61
113
|
|
|
62
114
|
Subcommands:
|
|
@@ -67,7 +119,7 @@ export function parseKnowledgeIngestArgs(args) {
|
|
|
67
119
|
return KnowledgeIngestArgsSchema.safeParse({
|
|
68
120
|
projectSlug: getStringArg(args, "project", "p", "project-slug"),
|
|
69
121
|
projectDir: getStringArg(args, "project-dir", "dir", "d"),
|
|
70
|
-
|
|
122
|
+
sources: args._.slice(2).filter((value) => typeof value === "string"),
|
|
71
123
|
path: getStringArg(args, "path"),
|
|
72
124
|
all: getBooleanArg(args, "all"),
|
|
73
125
|
recursive: getBooleanArg(args, "recursive"),
|
|
@@ -218,6 +270,7 @@ export async function runKnowledgeParser(input) {
|
|
|
218
270
|
try {
|
|
219
271
|
result = await new dntShim.Deno.Command("python3", {
|
|
220
272
|
args: [scriptPath, "--input-json", inputJsonPath, "--output-json", outputJsonPath],
|
|
273
|
+
...(input.env ? { env: input.env } : {}),
|
|
221
274
|
stdout: "piped",
|
|
222
275
|
stderr: "piped",
|
|
223
276
|
}).output();
|
|
@@ -241,27 +294,56 @@ export async function runKnowledgeParser(input) {
|
|
|
241
294
|
}
|
|
242
295
|
export async function collectKnowledgeSources(options, deps) {
|
|
243
296
|
const fs = createFileSystem();
|
|
244
|
-
if (options.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
297
|
+
if (options.sources.length > 0) {
|
|
298
|
+
const explicitSources = [];
|
|
299
|
+
const uploadTargets = [];
|
|
300
|
+
for (const input of options.sources) {
|
|
301
|
+
if (!isProjectUploadReference(input) && await fs.exists(input)) {
|
|
302
|
+
const localFiles = await collectLocalFiles(input, options.recursive);
|
|
303
|
+
if (!localFiles.length)
|
|
304
|
+
throw new Error(`No supported files found at ${input}`);
|
|
305
|
+
explicitSources.push({
|
|
306
|
+
kind: "local",
|
|
307
|
+
sources: localFiles.map((localPath) => ({ kind: "local", input, localPath })),
|
|
308
|
+
});
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (isLikelyLocalPath(input)) {
|
|
312
|
+
throw new Error(`Local file not found: ${input}`);
|
|
313
|
+
}
|
|
314
|
+
const uploadPath = normalizeProjectUploadPath(input);
|
|
315
|
+
explicitSources.push({ kind: "upload", input, uploadPath });
|
|
316
|
+
uploadTargets.push(uploadPath);
|
|
250
317
|
}
|
|
251
|
-
|
|
252
|
-
|
|
318
|
+
const downloads = uploadTargets.length > 0 ? await deps.downloadUploads(uploadTargets) : [];
|
|
319
|
+
const downloadsByPath = new Map();
|
|
320
|
+
for (const download of downloads) {
|
|
321
|
+
const existing = downloadsByPath.get(download.uploadPath) ?? [];
|
|
322
|
+
existing.push(download);
|
|
323
|
+
downloadsByPath.set(download.uploadPath, existing);
|
|
253
324
|
}
|
|
254
|
-
const
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
325
|
+
const resolvedSources = [];
|
|
326
|
+
for (const source of explicitSources) {
|
|
327
|
+
if (source.kind === "local") {
|
|
328
|
+
resolvedSources.push(...source.sources);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const matchingDownloads = downloadsByPath.get(source.uploadPath);
|
|
332
|
+
const download = matchingDownloads?.shift();
|
|
333
|
+
if (!download) {
|
|
334
|
+
throw new Error(`Upload not found: ${formatKnowledgeUploadSource(source.uploadPath)}`);
|
|
335
|
+
}
|
|
336
|
+
resolvedSources.push({
|
|
337
|
+
kind: "upload",
|
|
338
|
+
input: source.input,
|
|
339
|
+
uploadPath: download.uploadPath,
|
|
340
|
+
localPath: download.localPath,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
return resolvedSources;
|
|
262
344
|
}
|
|
263
345
|
if (!options.path || !options.all) {
|
|
264
|
-
throw new Error("Provide
|
|
346
|
+
throw new Error("Provide one or more source paths or use --path with --all.");
|
|
265
347
|
}
|
|
266
348
|
if (!isProjectUploadReference(options.path) && await fs.exists(options.path)) {
|
|
267
349
|
const localFiles = await collectLocalFiles(options.path, options.recursive);
|
|
@@ -298,9 +380,18 @@ export async function collectKnowledgeSources(options, deps) {
|
|
|
298
380
|
}));
|
|
299
381
|
}
|
|
300
382
|
export async function ingestResolvedSources(sources, options, deps) {
|
|
301
|
-
|
|
383
|
+
if (options.slug && sources.length !== 1) {
|
|
384
|
+
throw new Error("--slug can only be used with a single explicit source.");
|
|
385
|
+
}
|
|
386
|
+
const slugs = options.slug ? [options.slug] : ensureUniqueSlugs(sources);
|
|
302
387
|
const results = [];
|
|
303
388
|
for (const [index, source] of sources.entries()) {
|
|
389
|
+
deps.eventLogger?.info("Processing knowledge source", {
|
|
390
|
+
phase: "file_processing",
|
|
391
|
+
progress_current: index + 1,
|
|
392
|
+
progress_total: sources.length,
|
|
393
|
+
source_name: buildKnowledgeSourceName(source),
|
|
394
|
+
});
|
|
304
395
|
const parser = await deps.runParser({
|
|
305
396
|
filePath: source.localPath,
|
|
306
397
|
outputDir: deps.outputDir,
|
|
@@ -310,6 +401,23 @@ export async function ingestResolvedSources(sources, options, deps) {
|
|
|
310
401
|
});
|
|
311
402
|
const remotePath = deriveKnowledgeRemotePath(parser.sandbox_output_path, deps.outputDir, options.knowledgePath);
|
|
312
403
|
const uploaded = await deps.uploadKnowledgeFile(remotePath, parser.sandbox_output_path);
|
|
404
|
+
deps.eventLogger?.info("Knowledge source ingested", {
|
|
405
|
+
phase: "file_completed",
|
|
406
|
+
progress_current: index + 1,
|
|
407
|
+
progress_total: sources.length,
|
|
408
|
+
source_name: buildKnowledgeSourceName(source),
|
|
409
|
+
remote_path: uploaded.path,
|
|
410
|
+
warning_count: parser.warnings.length,
|
|
411
|
+
});
|
|
412
|
+
if (parser.warnings.length > 0) {
|
|
413
|
+
deps.eventLogger?.warn("Knowledge source emitted warnings", {
|
|
414
|
+
phase: "file_warning",
|
|
415
|
+
progress_current: index + 1,
|
|
416
|
+
progress_total: sources.length,
|
|
417
|
+
source_name: buildKnowledgeSourceName(source),
|
|
418
|
+
warning_count: parser.warnings.length,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
313
421
|
results.push(createKnowledgeIngestResult({
|
|
314
422
|
source: buildSourceReference(source),
|
|
315
423
|
localSourcePath: source.localPath,
|
|
@@ -341,19 +449,34 @@ export async function knowledgeCommand(args) {
|
|
|
341
449
|
const outputDir = options.outputDir ?? await defaultOutputRoot();
|
|
342
450
|
const shouldCleanupOutputDir = options.outputDir === undefined;
|
|
343
451
|
const downloadOutputDir = resolveKnowledgeDownloadOutputDir(outputDir);
|
|
452
|
+
const eventLogger = createKnowledgeIngestEventLogger();
|
|
344
453
|
try {
|
|
454
|
+
eventLogger?.info("Starting knowledge ingest", {
|
|
455
|
+
phase: "started",
|
|
456
|
+
mode: options.path ? "path_prefix" : "explicit_sources",
|
|
457
|
+
});
|
|
345
458
|
const sources = await collectKnowledgeSources(options, {
|
|
346
459
|
client,
|
|
347
460
|
projectSlug: config.projectSlug,
|
|
348
461
|
downloadUploads: (uploadPaths) => Promise.all(uploadPaths.map((uploadPath) => downloadUploadToFile(client, config.projectSlug, uploadPath, downloadOutputDir))),
|
|
349
462
|
});
|
|
463
|
+
eventLogger?.info("Resolved knowledge sources", {
|
|
464
|
+
phase: "sources_resolved",
|
|
465
|
+
progress_total: sources.length,
|
|
466
|
+
});
|
|
350
467
|
const results = await ingestResolvedSources(sources, options, {
|
|
351
468
|
client,
|
|
352
469
|
projectSlug: config.projectSlug,
|
|
353
470
|
outputDir,
|
|
354
471
|
runParser: runKnowledgeParser,
|
|
472
|
+
eventLogger,
|
|
355
473
|
uploadKnowledgeFile: (remotePath, localPath) => putRemoteFileFromLocal(client, config.projectSlug, remotePath, localPath),
|
|
356
474
|
});
|
|
475
|
+
eventLogger?.info("Completed knowledge ingest", {
|
|
476
|
+
phase: "completed",
|
|
477
|
+
progress_current: results.length,
|
|
478
|
+
progress_total: results.length,
|
|
479
|
+
});
|
|
357
480
|
if (options.json) {
|
|
358
481
|
printJson(results);
|
|
359
482
|
return;
|
|
@@ -365,6 +488,12 @@ export async function knowledgeCommand(args) {
|
|
|
365
488
|
}
|
|
366
489
|
}
|
|
367
490
|
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
eventLogger?.error("Knowledge ingest failed", {
|
|
493
|
+
phase: "failed",
|
|
494
|
+
});
|
|
495
|
+
throw error;
|
|
496
|
+
}
|
|
368
497
|
finally {
|
|
369
498
|
if (shouldCleanupOutputDir) {
|
|
370
499
|
await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-source.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/parser-source.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"parser-source.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/parser-source.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,QAugBvC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import argparse
|
|
|
3
3
|
import csv
|
|
4
4
|
import json
|
|
5
5
|
import re
|
|
6
|
+
import subprocess
|
|
6
7
|
from datetime import date
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from typing import Any, Optional
|
|
@@ -71,6 +72,107 @@ def build_frontmatter(source: str, source_type: str, description: str) -> str:
|
|
|
71
72
|
])
|
|
72
73
|
|
|
73
74
|
|
|
75
|
+
def metadata_int(metadata: dict[str, Any], *keys: str) -> Optional[int]:
|
|
76
|
+
for key in keys:
|
|
77
|
+
value = metadata.get(key)
|
|
78
|
+
if isinstance(value, int) and not isinstance(value, bool):
|
|
79
|
+
return value
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def metadata_string_list(metadata: dict[str, Any], *keys: str) -> Optional[list[str]]:
|
|
84
|
+
for key in keys:
|
|
85
|
+
value = metadata.get(key)
|
|
86
|
+
if isinstance(value, list) and all(isinstance(item, str) for item in value):
|
|
87
|
+
return value
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def build_kreuzberg_stats(source_type: str, content: str, metadata: dict[str, Any]):
|
|
92
|
+
stats: dict[str, Any] = {
|
|
93
|
+
"characters": len(content),
|
|
94
|
+
"lines": len(content.splitlines()) if content else 0,
|
|
95
|
+
"engine": "kreuzberg",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if isinstance(metadata.get("mime_type"), str):
|
|
99
|
+
stats["mime_type"] = metadata["mime_type"]
|
|
100
|
+
|
|
101
|
+
if source_type == "pdf":
|
|
102
|
+
stats["pages"] = metadata_int(metadata, "page_count") or 0
|
|
103
|
+
stats["tables"] = metadata_int(metadata, "table_count") or 0
|
|
104
|
+
elif source_type in {"xlsx", "xls"}:
|
|
105
|
+
stats["sheets"] = metadata_int(metadata, "sheet_count") or 0
|
|
106
|
+
stats["rows"] = metadata_int(metadata, "row_count") or 0
|
|
107
|
+
stats["sheet_names"] = metadata_string_list(metadata, "sheet_names") or []
|
|
108
|
+
elif source_type == "docx":
|
|
109
|
+
stats["paragraphs"] = metadata_int(metadata, "paragraph_count") or 0
|
|
110
|
+
stats["tables"] = metadata_int(metadata, "table_count") or 0
|
|
111
|
+
elif source_type == "pptx":
|
|
112
|
+
stats["slides"] = metadata_int(metadata, "slide_count", "page_count") or 0
|
|
113
|
+
stats["tables"] = metadata_int(metadata, "table_count") or 0
|
|
114
|
+
elif source_type == "html":
|
|
115
|
+
stats["tables"] = metadata_int(metadata, "table_count") or 0
|
|
116
|
+
|
|
117
|
+
return stats
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def parse_with_kreuzberg(path: str, source_type: str):
|
|
121
|
+
warnings: list[str] = []
|
|
122
|
+
completed = subprocess.run(
|
|
123
|
+
[
|
|
124
|
+
"kreuzberg",
|
|
125
|
+
"extract",
|
|
126
|
+
path,
|
|
127
|
+
"--format",
|
|
128
|
+
"json",
|
|
129
|
+
"--output-format",
|
|
130
|
+
"markdown",
|
|
131
|
+
],
|
|
132
|
+
capture_output=True,
|
|
133
|
+
text=True,
|
|
134
|
+
check=False,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
if completed.returncode != 0:
|
|
138
|
+
detail = completed.stderr.strip() or completed.stdout.strip() or f"exit code {completed.returncode}"
|
|
139
|
+
raise RuntimeError(f"kreuzberg extract failed: {detail}")
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
payload = json.loads(completed.stdout)
|
|
143
|
+
except json.JSONDecodeError as error:
|
|
144
|
+
raise RuntimeError(f"kreuzberg extract returned invalid JSON: {error}") from error
|
|
145
|
+
|
|
146
|
+
content = payload.get("content", "")
|
|
147
|
+
if not isinstance(content, str):
|
|
148
|
+
raise RuntimeError("kreuzberg extract did not return string content")
|
|
149
|
+
|
|
150
|
+
metadata = payload.get("metadata") if isinstance(payload.get("metadata"), dict) else {}
|
|
151
|
+
normalized_content = clean_text(content)
|
|
152
|
+
stats = build_kreuzberg_stats(source_type, normalized_content, metadata)
|
|
153
|
+
|
|
154
|
+
return normalized_content or "_No extractable text found in document._", stats, warnings
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def prefer_kreuzberg(source_type: str, fallback_parser):
|
|
158
|
+
def parser(path: str):
|
|
159
|
+
try:
|
|
160
|
+
return parse_with_kreuzberg(path, source_type)
|
|
161
|
+
except FileNotFoundError as error:
|
|
162
|
+
if getattr(error, "filename", "") == "kreuzberg":
|
|
163
|
+
return fallback_parser(path)
|
|
164
|
+
raise
|
|
165
|
+
except RuntimeError as error:
|
|
166
|
+
content, stats, warnings = fallback_parser(path)
|
|
167
|
+
warnings.append(
|
|
168
|
+
"kreuzberg extraction failed; fell back to the built-in parser: "
|
|
169
|
+
+ str(error)
|
|
170
|
+
)
|
|
171
|
+
return content, stats, warnings
|
|
172
|
+
|
|
173
|
+
return parser
|
|
174
|
+
|
|
175
|
+
|
|
74
176
|
def parse_csv_like(path: str, delimiter: str = ","):
|
|
75
177
|
warnings: list[str] = []
|
|
76
178
|
with open(path, newline="", encoding="utf-8-sig") as file:
|
|
@@ -305,18 +407,19 @@ def parse_json(path: str):
|
|
|
305
407
|
def select_parser(path: Path):
|
|
306
408
|
ext = path.suffix.lower()
|
|
307
409
|
if ext == ".pdf":
|
|
308
|
-
return "pdf", parse_pdf
|
|
410
|
+
return "pdf", prefer_kreuzberg("pdf", parse_pdf)
|
|
309
411
|
if ext in {".csv", ".tsv"}:
|
|
310
412
|
delimiter = "\t" if ext == ".tsv" else ","
|
|
311
413
|
return ext.lstrip("."), lambda file_path: parse_csv_like(file_path, delimiter)
|
|
312
414
|
if ext in {".xlsx", ".xls"}:
|
|
313
|
-
|
|
415
|
+
source_type = ext.lstrip(".")
|
|
416
|
+
return source_type, prefer_kreuzberg(source_type, parse_excel)
|
|
314
417
|
if ext == ".docx":
|
|
315
|
-
return "docx", parse_docx
|
|
418
|
+
return "docx", prefer_kreuzberg("docx", parse_docx)
|
|
316
419
|
if ext == ".pptx":
|
|
317
|
-
return "pptx", parse_pptx
|
|
420
|
+
return "pptx", prefer_kreuzberg("pptx", parse_pptx)
|
|
318
421
|
if ext in {".html", ".htm"}:
|
|
319
|
-
return "html", parse_html
|
|
422
|
+
return "html", prefer_kreuzberg("html", parse_html)
|
|
320
423
|
if ext in {".txt", ".md", ".mdx"}:
|
|
321
424
|
return ext.lstrip("."), parse_text
|
|
322
425
|
if ext == ".json":
|
|
@@ -325,6 +428,8 @@ def select_parser(path: Path):
|
|
|
325
428
|
|
|
326
429
|
|
|
327
430
|
def build_summary(source_type: str, stats: dict[str, Any]) -> str:
|
|
431
|
+
if stats.get("engine") == "kreuzberg":
|
|
432
|
+
return f"Converted {source_type.upper()} to markdown ({stats.get('characters', 0)} chars)."
|
|
328
433
|
if source_type in {"csv", "tsv"}:
|
|
329
434
|
return f"Parsed {stats.get('rows', 0)} rows across {stats.get('columns', 0)} columns."
|
|
330
435
|
if source_type in {"xlsx", "xls"}:
|
package/esm/deno.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare namespace _default {
|
|
|
24
24
|
"./resource": string;
|
|
25
25
|
"./mcp": string;
|
|
26
26
|
"./middleware": string;
|
|
27
|
+
"./utils": string;
|
|
27
28
|
"./oauth": string;
|
|
28
29
|
"./provider": string;
|
|
29
30
|
"./fs": string;
|
|
@@ -61,6 +62,7 @@ declare namespace _default {
|
|
|
61
62
|
"veryfront/workflow/claude-code": string;
|
|
62
63
|
"veryfront/workflow/claude-code/react": string;
|
|
63
64
|
"veryfront/workflow/discovery": string;
|
|
65
|
+
"veryfront/utils": string;
|
|
64
66
|
"veryfront/utils/box": string;
|
|
65
67
|
"veryfront/utils/case-utils": string;
|
|
66
68
|
"veryfront/utils/constants/server": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"exclude": [
|
|
@@ -34,6 +34,7 @@ export default {
|
|
|
34
34
|
"./resource": "./src/resource/index.ts",
|
|
35
35
|
"./mcp": "./src/mcp/index.ts",
|
|
36
36
|
"./middleware": "./src/middleware/index.ts",
|
|
37
|
+
"./utils": "./src/utils/index.ts",
|
|
37
38
|
"./oauth": "./src/oauth/index.ts",
|
|
38
39
|
"./provider": "./src/provider/index.ts",
|
|
39
40
|
"./fs": "./src/fs/index.ts",
|
|
@@ -71,6 +72,7 @@ export default {
|
|
|
71
72
|
"veryfront/workflow/claude-code": "./src/workflow/claude-code/index.ts",
|
|
72
73
|
"veryfront/workflow/claude-code/react": "./src/workflow/claude-code/react/index.ts",
|
|
73
74
|
"veryfront/workflow/discovery": "./src/workflow/discovery/index.ts",
|
|
75
|
+
"veryfront/utils": "./src/utils/index.ts",
|
|
74
76
|
"veryfront/utils/box": "./src/utils/box.ts",
|
|
75
77
|
"veryfront/utils/case-utils": "./src/utils/case-utils.ts",
|
|
76
78
|
"veryfront/utils/constants/server": "./src/utils/constants/server.ts",
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import type { DataContext, DataResult, PageWithData, StaticPathsResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for isolated data fetching. Passed through to ServerDataFetcher
|
|
4
|
+
* when worker isolation is enabled.
|
|
5
|
+
*/
|
|
6
|
+
export interface FetchDataOptions {
|
|
7
|
+
/** Absolute path to the module containing getServerData */
|
|
8
|
+
modulePath?: string;
|
|
9
|
+
/** Project directory for worker scoping */
|
|
10
|
+
projectDir?: string;
|
|
11
|
+
}
|
|
2
12
|
export declare class DataFetcher {
|
|
3
13
|
private cacheManager;
|
|
4
14
|
private serverFetcher;
|
|
5
15
|
private staticFetcher;
|
|
6
16
|
private pathsFetcher;
|
|
7
17
|
constructor(_adapter?: unknown);
|
|
8
|
-
fetchData(pageModule: PageWithData, context: DataContext, mode?: "development" | "production"): Promise<DataResult>;
|
|
18
|
+
fetchData(pageModule: PageWithData, context: DataContext, mode?: "development" | "production", options?: FetchDataOptions): Promise<DataResult>;
|
|
9
19
|
getStaticPaths(pageModule: PageWithData): Promise<StaticPathsResult | null>;
|
|
10
20
|
clearCache(pattern?: string): void;
|
|
11
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-fetcher.d.ts","sourceRoot":"","sources":["../../../src/src/data/data-fetcher.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3F,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,YAAY,CAAqB;gBAE7B,QAAQ,CAAC,EAAE,OAAO;IAO9B,SAAS,CACP,UAAU,EAAE,YAAY,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,GAAE,aAAa,GAAG,YAA4B,
|
|
1
|
+
{"version":3,"file":"data-fetcher.d.ts","sourceRoot":"","sources":["../../../src/src/data/data-fetcher.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,YAAY,CAAqB;gBAE7B,QAAQ,CAAC,EAAE,OAAO;IAO9B,SAAS,CACP,UAAU,EAAE,YAAY,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,GAAE,aAAa,GAAG,YAA4B,EAClD,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,UAAU,CAAC;IA8BtB,cAAc,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAI3E,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAQnC"}
|