veryfront 0.1.622 → 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/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +12 -1
- 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
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@ Purpose-built for TypeScript and React, Veryfront gives you everything you need
|
|
|
20
20
|
|
|
21
21
|
- [**Skills**](https://veryfront.com/docs/code/guides/skills) - Project-level agent capabilities defined as `SKILL.md` files following the agentskills.io specification. Skills provide prompt augmentation, tool allowlists, and script execution.
|
|
22
22
|
|
|
23
|
-
- [**
|
|
23
|
+
- [**Runs**](https://veryfront.com/docs/code/guides/runs) - Run durable project-scoped task and workflow definitions through the Veryfront platform.
|
|
24
24
|
|
|
25
|
-
- [**Tasks**](https://veryfront.com/docs/code/guides/tasks) - File-based background task definitions discovered automatically and executable
|
|
25
|
+
- [**Tasks**](https://veryfront.com/docs/code/guides/tasks) - File-based background task definitions discovered automatically and executable as task runs.
|
|
26
26
|
|
|
27
27
|
- [**Multi-Agent**](https://veryfront.com/docs/code/guides/multi-agent) - Compose agents that delegate to each other as tools for complex, coordinated tasks. AG-UI control-plane for hosted agent orchestration.
|
|
28
28
|
|
|
@@ -83,7 +83,7 @@ veryfront/
|
|
|
83
83
|
│ ├── chat/ # Chat UI components and streaming
|
|
84
84
|
│ ├── discovery/ # Auto-discovery of tools, agents, workflows
|
|
85
85
|
│ ├── sandbox/ # Ephemeral compute environments
|
|
86
|
-
│ ├──
|
|
86
|
+
│ ├── runs/ # Durable runs client
|
|
87
87
|
│ ├── task/ # Task definitions and runner
|
|
88
88
|
│ ├── channels/ # Control-plane agent routing
|
|
89
89
|
│ ├── integrations/ # Third-party connector metadata
|
|
@@ -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,WAwC3B,CAAC"}
|
|
@@ -35,8 +35,7 @@ export const knowledgeHelp = {
|
|
|
35
35
|
"Primary subcommand: ingest",
|
|
36
36
|
"`uploads/...` means a remote project upload; use `./uploads/...` or `/workspace/uploads/...` to force a local file",
|
|
37
37
|
"`ingest` orchestrates upload resolution, parsing, and project file writes",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"The Veryfront sandbox image includes `docling`, and knowledge ingest falls back to the built-in parser when `docling` is unavailable or extraction fails",
|
|
38
|
+
"Supported PDF, Office, and HTML sources are parsed through the built-in Kreuzberg document extension",
|
|
39
|
+
"Plain text, Markdown, JSON, CSV, TSV, and common code files are converted directly by the CLI",
|
|
41
40
|
],
|
|
42
41
|
};
|
|
@@ -8,32 +8,12 @@ type SafeParseResult<T> = {
|
|
|
8
8
|
issues: unknown[];
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
import { type CommandResult } from "../../../src/platform/index.js";
|
|
12
11
|
import { type ApiClient } from "../../shared/config.js";
|
|
13
12
|
import type { ParsedArgs } from "../../shared/types.js";
|
|
14
13
|
import * as commandHelpers from "./command-helpers.js";
|
|
15
14
|
import { type Logger } from "../../../src/utils/index.js";
|
|
15
|
+
import { runKnowledgeParser } from "./parser.js";
|
|
16
16
|
import { type KnowledgeIngestFailedFileResult, type KnowledgeIngestFileResult, type KnowledgeIngestSkippedFileResult } from "./result.js";
|
|
17
|
-
export interface KnowledgeParserResult {
|
|
18
|
-
success: true;
|
|
19
|
-
source_path: string;
|
|
20
|
-
source_filename: string;
|
|
21
|
-
source_type: string;
|
|
22
|
-
slug: string;
|
|
23
|
-
sandbox_output_path: string;
|
|
24
|
-
suggested_project_path: string;
|
|
25
|
-
description: string;
|
|
26
|
-
title: string;
|
|
27
|
-
summary: string;
|
|
28
|
-
stats: Record<string, unknown>;
|
|
29
|
-
warnings: string[];
|
|
30
|
-
}
|
|
31
|
-
export interface KnowledgeParserInput {
|
|
32
|
-
filePath: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
slug?: string;
|
|
35
|
-
sourceReference?: string;
|
|
36
|
-
}
|
|
37
17
|
type KnowledgeSource = {
|
|
38
18
|
kind: "local";
|
|
39
19
|
input: string;
|
|
@@ -79,31 +59,7 @@ export declare const buildSuggestedSlug: typeof commandHelpers.buildSuggestedSlu
|
|
|
79
59
|
export declare const ensureUniqueSlugs: typeof commandHelpers.ensureUniqueSlugs;
|
|
80
60
|
export declare const deriveKnowledgeRemotePath: typeof commandHelpers.deriveKnowledgeRemotePath;
|
|
81
61
|
export declare const createKnowledgeIngestResult: typeof commandHelpers.createKnowledgeIngestResult;
|
|
82
|
-
export
|
|
83
|
-
filePath: string;
|
|
84
|
-
outputDir: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
slug?: string;
|
|
87
|
-
sourceReference?: string;
|
|
88
|
-
env?: Record<string, string>;
|
|
89
|
-
}): Promise<KnowledgeParserResult>;
|
|
90
|
-
export declare function executeKnowledgeParserCommand(input: {
|
|
91
|
-
scriptPath: string;
|
|
92
|
-
inputJsonPath: string;
|
|
93
|
-
outputJsonPath: string;
|
|
94
|
-
env?: Record<string, string>;
|
|
95
|
-
}, deps?: {
|
|
96
|
-
runCommandFn?: (cmd: string, options: {
|
|
97
|
-
args: string[];
|
|
98
|
-
env?: Record<string, string>;
|
|
99
|
-
capture: true;
|
|
100
|
-
}) => Promise<CommandResult>;
|
|
101
|
-
}): Promise<void>;
|
|
102
|
-
export declare function runKnowledgeParsers(input: {
|
|
103
|
-
files: KnowledgeParserInput[];
|
|
104
|
-
outputDir: string;
|
|
105
|
-
env?: Record<string, string>;
|
|
106
|
-
}): Promise<KnowledgeParserResult[]>;
|
|
62
|
+
export { type KnowledgeParserInput, type KnowledgeParserResult, runKnowledgeParser, runKnowledgeParsers, } from "./parser.js";
|
|
107
63
|
export declare function collectKnowledgeSources(options: Pick<KnowledgeIngestOptions, "sources" | "path" | "all" | "recursive">, deps: {
|
|
108
64
|
client: ApiClient;
|
|
109
65
|
projectSlug: string;
|
|
@@ -123,5 +79,4 @@ export declare function ingestResolvedSources(sources: KnowledgeSource[], option
|
|
|
123
79
|
failed: KnowledgeIngestFailedFileResult[];
|
|
124
80
|
}>;
|
|
125
81
|
export declare function knowledgeCommand(args: ParsedArgs): Promise<void>;
|
|
126
|
-
export {};
|
|
127
82
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,KAAK,eAAe,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IACrD,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,KAAK,GAAG;QAAE,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command.ts"],"names":[],"mappings":"AAEA,OAAO,KAA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AAmB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1F,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,GACA,OAAO,CAAC;IACT,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,MAAM,EAAE,+BAA+B,EAAE,CAAC;CAC3C,CAAC,CAsGD;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwItE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { defineSchema, lazySchema } from "../../../src/schemas/index.js";
|
|
3
|
-
import { createFileSystem, getEnv
|
|
3
|
+
import { createFileSystem, getEnv } from "../../../src/platform/index.js";
|
|
4
4
|
import { basename } 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,13 +8,13 @@ import { createApiClient, resolveConfigWithAuth } from "../../shared/config.js";
|
|
|
8
8
|
import { getStringArg } from "../../shared/parsed-args.js";
|
|
9
9
|
import { downloadUploadToFile, listAllUploads } from "../uploads/command.js";
|
|
10
10
|
import { putRemoteFileFromLocal } from "../files/command.js";
|
|
11
|
-
import { knowledgeIngestPythonSource } from "./parser-source.js";
|
|
12
11
|
import * as commandHelpers from "./command-helpers.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { createRunUserLogger, serverLogger } from "../../../src/utils/index.js";
|
|
13
|
+
import { writeRunResultIfConfigured } from "../../utils/write-run-result.js";
|
|
15
14
|
import { classifyKnowledgeSourcePath } from "./source-policy.js";
|
|
16
|
-
import {
|
|
17
|
-
|
|
15
|
+
import { runKnowledgeParser } from "./parser.js";
|
|
16
|
+
import { buildKnowledgeIngestRunResult, } from "./result.js";
|
|
17
|
+
const knowledgeRunLogger = serverLogger.component("knowledge-ingest");
|
|
18
18
|
const getKnowledgeIngestArgsSchema = defineSchema((v) => v.object({
|
|
19
19
|
projectSlug: v.string().optional(),
|
|
20
20
|
projectDir: v.string().optional(),
|
|
@@ -71,15 +71,15 @@ function printJson(value) {
|
|
|
71
71
|
}
|
|
72
72
|
function createKnowledgeIngestEventLogger() {
|
|
73
73
|
const projectId = getEnv("TENANT_PROJECT_ID");
|
|
74
|
-
const
|
|
75
|
-
if (!projectId || !
|
|
74
|
+
const runExecutionId = getEnv("RUN_EXECUTION_ID");
|
|
75
|
+
if (!projectId || !runExecutionId) {
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return createRunUserLogger(knowledgeRunLogger, {
|
|
79
79
|
projectId,
|
|
80
|
-
|
|
81
|
-
batchId: getEnv("
|
|
82
|
-
|
|
80
|
+
runExecutionId: runExecutionId,
|
|
81
|
+
batchId: getEnv("RUN_BATCH_ID") ?? undefined,
|
|
82
|
+
runTarget: getEnv("RUN_TARGET") ?? undefined,
|
|
83
83
|
task: "knowledge-ingest",
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -139,6 +139,7 @@ export const buildSuggestedSlug = commandHelpers.buildSuggestedSlug;
|
|
|
139
139
|
export const ensureUniqueSlugs = commandHelpers.ensureUniqueSlugs;
|
|
140
140
|
export const deriveKnowledgeRemotePath = commandHelpers.deriveKnowledgeRemotePath;
|
|
141
141
|
export const createKnowledgeIngestResult = commandHelpers.createKnowledgeIngestResult;
|
|
142
|
+
export { runKnowledgeParser, runKnowledgeParsers, } from "./parser.js";
|
|
142
143
|
function resolveExplicitUploadPath(inputPath) {
|
|
143
144
|
return commandHelpers.resolveExplicitUploadPath(inputPath);
|
|
144
145
|
}
|
|
@@ -171,109 +172,6 @@ function classifyListedUploadsForKnowledge(uploads) {
|
|
|
171
172
|
function buildSourceReference(source) {
|
|
172
173
|
return commandHelpers.buildSourceReference(source);
|
|
173
174
|
}
|
|
174
|
-
export async function runKnowledgeParser(input) {
|
|
175
|
-
const [result] = await runKnowledgeParsers({
|
|
176
|
-
files: [{
|
|
177
|
-
filePath: input.filePath,
|
|
178
|
-
description: input.description,
|
|
179
|
-
slug: input.slug,
|
|
180
|
-
sourceReference: input.sourceReference,
|
|
181
|
-
}],
|
|
182
|
-
outputDir: input.outputDir,
|
|
183
|
-
env: input.env,
|
|
184
|
-
});
|
|
185
|
-
if (!result) {
|
|
186
|
-
throw new Error("knowledge ingest parser returned no results");
|
|
187
|
-
}
|
|
188
|
-
return result;
|
|
189
|
-
}
|
|
190
|
-
function isMissingPythonExecutableError(error) {
|
|
191
|
-
if (!(error instanceof Error)) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
const errorWithCode = error;
|
|
195
|
-
if (errorWithCode.code === "ENOENT") {
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
return error.name === "NotFound" ||
|
|
199
|
-
/\bENOENT\b/i.test(error.message) ||
|
|
200
|
-
/not found/i.test(error.message) ||
|
|
201
|
-
/no such file or directory/i.test(error.message);
|
|
202
|
-
}
|
|
203
|
-
export async function executeKnowledgeParserCommand(input, deps = {}) {
|
|
204
|
-
const runCommandFn = deps.runCommandFn ?? runCommand;
|
|
205
|
-
let result;
|
|
206
|
-
try {
|
|
207
|
-
result = await runCommandFn("python3", {
|
|
208
|
-
args: [
|
|
209
|
-
input.scriptPath,
|
|
210
|
-
"--input-json",
|
|
211
|
-
input.inputJsonPath,
|
|
212
|
-
"--output-json",
|
|
213
|
-
input.outputJsonPath,
|
|
214
|
-
],
|
|
215
|
-
...(input.env ? { env: input.env } : {}),
|
|
216
|
-
capture: true,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
if (isMissingPythonExecutableError(error)) {
|
|
221
|
-
throw new Error("python3 is required. Install python3 and the supported parser packages, or run the command inside the Veryfront sandbox.");
|
|
222
|
-
}
|
|
223
|
-
throw error;
|
|
224
|
-
}
|
|
225
|
-
if (result.success) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
const stderr = result.stderr?.trim();
|
|
229
|
-
const stdout = result.stdout?.trim();
|
|
230
|
-
if (result.code === 1 && !stderr && !stdout) {
|
|
231
|
-
throw new Error("python3 is required. Install python3 and the supported parser packages, or run the command inside the Veryfront sandbox.");
|
|
232
|
-
}
|
|
233
|
-
throw new Error(stderr || stdout || "parser exited unsuccessfully");
|
|
234
|
-
}
|
|
235
|
-
export async function runKnowledgeParsers(input) {
|
|
236
|
-
if (!input.files.length) {
|
|
237
|
-
return [];
|
|
238
|
-
}
|
|
239
|
-
const tempDir = await dntShim.Deno.makeTempDir({ prefix: "veryfront-knowledge-parser-" });
|
|
240
|
-
const inputJsonPath = `${tempDir}/input.json`;
|
|
241
|
-
const outputJsonPath = `${tempDir}/output.json`;
|
|
242
|
-
const scriptPath = `${tempDir}/ingest_document_to_knowledge.py`;
|
|
243
|
-
try {
|
|
244
|
-
try {
|
|
245
|
-
await dntShim.Deno.writeTextFile(inputJsonPath, JSON.stringify({
|
|
246
|
-
files: input.files.map((file) => ({
|
|
247
|
-
file_path: file.filePath,
|
|
248
|
-
description: file.description,
|
|
249
|
-
slug: file.slug,
|
|
250
|
-
source_reference: file.sourceReference,
|
|
251
|
-
})),
|
|
252
|
-
output_dir: input.outputDir,
|
|
253
|
-
}));
|
|
254
|
-
await dntShim.Deno.writeTextFile(scriptPath, knowledgeIngestPythonSource);
|
|
255
|
-
await executeKnowledgeParserCommand({
|
|
256
|
-
scriptPath,
|
|
257
|
-
inputJsonPath,
|
|
258
|
-
outputJsonPath,
|
|
259
|
-
env: input.env,
|
|
260
|
-
});
|
|
261
|
-
const raw = await dntShim.Deno.readTextFile(outputJsonPath);
|
|
262
|
-
const parsed = JSON.parse(raw);
|
|
263
|
-
return Array.isArray(parsed) ? parsed : [parsed];
|
|
264
|
-
}
|
|
265
|
-
catch (error) {
|
|
266
|
-
if (error instanceof Error && error.message.startsWith("knowledge ingest parser failed")) {
|
|
267
|
-
throw error;
|
|
268
|
-
}
|
|
269
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
270
|
-
throw new Error(`knowledge ingest parser failed: ${message}`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
finally {
|
|
274
|
-
await dntShim.Deno.remove(tempDir, { recursive: true }).catch(() => undefined);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
175
|
export async function collectKnowledgeSources(options, deps) {
|
|
278
176
|
const fs = createFileSystem();
|
|
279
177
|
if (options.sources.length > 0) {
|
|
@@ -513,7 +411,7 @@ export async function knowledgeCommand(args) {
|
|
|
513
411
|
eventLogger,
|
|
514
412
|
uploadKnowledgeFile: (remotePath, localPath) => putRemoteFileFromLocal(client, config.projectSlug, remotePath, localPath),
|
|
515
413
|
});
|
|
516
|
-
const
|
|
414
|
+
const runResult = buildKnowledgeIngestRunResult({
|
|
517
415
|
requestedCount,
|
|
518
416
|
sourceMode,
|
|
519
417
|
knowledgePath: options.knowledgePath,
|
|
@@ -525,28 +423,28 @@ export async function knowledgeCommand(args) {
|
|
|
525
423
|
phase: "completed",
|
|
526
424
|
progress_current: requestedCount,
|
|
527
425
|
progress_total: requestedCount,
|
|
528
|
-
ingested_count:
|
|
529
|
-
skipped_count:
|
|
530
|
-
failed_count:
|
|
426
|
+
ingested_count: runResult.summary.ingested_count,
|
|
427
|
+
skipped_count: runResult.summary.skipped_count,
|
|
428
|
+
failed_count: runResult.summary.failed_count,
|
|
531
429
|
});
|
|
532
|
-
await
|
|
430
|
+
await writeRunResultIfConfigured(runResult);
|
|
533
431
|
if (options.json) {
|
|
534
|
-
printJson(
|
|
432
|
+
printJson(runResult);
|
|
535
433
|
return;
|
|
536
434
|
}
|
|
537
|
-
for (const result of
|
|
435
|
+
for (const result of runResult.ingested) {
|
|
538
436
|
if (!options.quiet) {
|
|
539
437
|
cliLogger.info(`Ingested ${result.source} -> ${result.remotePath}`);
|
|
540
438
|
cliLogger.info(` ${result.summary}`);
|
|
541
439
|
}
|
|
542
440
|
}
|
|
543
|
-
for (const skipped of
|
|
441
|
+
for (const skipped of runResult.skipped) {
|
|
544
442
|
if (!options.quiet) {
|
|
545
443
|
cliLogger.warn(`Skipped ${skipped.source}`);
|
|
546
444
|
cliLogger.warn(` ${skipped.message}`);
|
|
547
445
|
}
|
|
548
446
|
}
|
|
549
|
-
for (const failure of
|
|
447
|
+
for (const failure of runResult.failed) {
|
|
550
448
|
if (!options.quiet) {
|
|
551
449
|
cliLogger.error(`Failed ${failure.source}`);
|
|
552
450
|
cliLogger.error(` ${failure.message}`);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface KnowledgeParserResult {
|
|
2
|
+
success: true;
|
|
3
|
+
source_path: string;
|
|
4
|
+
source_filename: string;
|
|
5
|
+
source_type: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
sandbox_output_path: string;
|
|
8
|
+
suggested_project_path: string;
|
|
9
|
+
description: string;
|
|
10
|
+
title: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
stats: Record<string, unknown>;
|
|
13
|
+
warnings: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface KnowledgeParserInput {
|
|
16
|
+
filePath: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
slug?: string;
|
|
19
|
+
sourceReference?: string;
|
|
20
|
+
}
|
|
21
|
+
export type ExtractDocumentText = (input: {
|
|
22
|
+
filePath: string;
|
|
23
|
+
mimeType: string;
|
|
24
|
+
}) => Promise<string>;
|
|
25
|
+
export interface RunKnowledgeParsersDeps {
|
|
26
|
+
extractDocumentText?: ExtractDocumentText;
|
|
27
|
+
}
|
|
28
|
+
export declare function slugifyKnowledgeValue(value: string): string;
|
|
29
|
+
export declare function runKnowledgeParser(input: {
|
|
30
|
+
filePath: string;
|
|
31
|
+
outputDir: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
slug?: string;
|
|
34
|
+
sourceReference?: string;
|
|
35
|
+
}, deps?: RunKnowledgeParsersDeps): Promise<KnowledgeParserResult>;
|
|
36
|
+
export declare function runKnowledgeParsers(input: {
|
|
37
|
+
files: KnowledgeParserInput[];
|
|
38
|
+
outputDir: string;
|
|
39
|
+
}, deps?: RunKnowledgeParsersDeps): Promise<KnowledgeParserResult[]>;
|
|
40
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/parser.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAC1C,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,WAAW,uBAAuB;IACtC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAqFD,wBAAgB,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