@eigenpal/cli 0.20.26 → 0.20.28
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/CHANGELOG.md +12 -0
- package/dist/cli.js +740 -442
- package/dist/docs-bundle.json +37 -16
- package/dist/skill/SKILL.md +17 -0
- package/dist/skill/reference/cli/models.md +17 -3
- package/dist/skill/reference/cli/surface.md +2 -0
- package/dist/skill/reference/cli/workflow.md +21 -0
- package/dist/skill/reference/step-types.md +1442 -11
- package/dist/skill/reference/workflow-yaml.md +1 -0
- package/dist/templates/human-review-confidence-exception/workflow.yaml +1 -1
- package/dist/templates/human-review-explicit-critical/workflow.yaml +1 -1
- package/dist/templates/pdf-extraction/workflow.yaml +6 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6684,6 +6684,14 @@ function object(shape, params) {
|
|
|
6684
6684
|
};
|
|
6685
6685
|
return new ZodObject(def);
|
|
6686
6686
|
}
|
|
6687
|
+
function strictObject(shape, params) {
|
|
6688
|
+
return new ZodObject({
|
|
6689
|
+
type: "object",
|
|
6690
|
+
shape,
|
|
6691
|
+
catchall: never(),
|
|
6692
|
+
...normalizeParams(params)
|
|
6693
|
+
});
|
|
6694
|
+
}
|
|
6687
6695
|
function union(options, params) {
|
|
6688
6696
|
return new ZodUnion({
|
|
6689
6697
|
type: "union",
|
|
@@ -7671,6 +7679,637 @@ var require_picocolors = __commonJS(function(exports, module) {
|
|
|
7671
7679
|
module.exports.createColors = createColors;
|
|
7672
7680
|
});
|
|
7673
7681
|
|
|
7682
|
+
// ../types/src/client/ai-client.ts
|
|
7683
|
+
var REASONING_EFFORTS, ReasoningEffortSchema, ModelReasoningConfigSchema;
|
|
7684
|
+
var init_ai_client = __esm(() => {
|
|
7685
|
+
init_zod();
|
|
7686
|
+
REASONING_EFFORTS = [
|
|
7687
|
+
"none",
|
|
7688
|
+
"minimal",
|
|
7689
|
+
"low",
|
|
7690
|
+
"medium",
|
|
7691
|
+
"high",
|
|
7692
|
+
"xhigh",
|
|
7693
|
+
"max"
|
|
7694
|
+
];
|
|
7695
|
+
ReasoningEffortSchema = _enum(REASONING_EFFORTS);
|
|
7696
|
+
ModelReasoningConfigSchema = object({
|
|
7697
|
+
supportedEfforts: array(ReasoningEffortSchema).min(1),
|
|
7698
|
+
defaultEffort: ReasoningEffortSchema.optional()
|
|
7699
|
+
}).refine((config) => config.defaultEffort === undefined || config.supportedEfforts.includes(config.defaultEffort), {
|
|
7700
|
+
message: "defaultEffort must be included in supportedEfforts",
|
|
7701
|
+
path: ["defaultEffort"]
|
|
7702
|
+
}).strict();
|
|
7703
|
+
});
|
|
7704
|
+
|
|
7705
|
+
// ../types/src/parser/native-text-quality.ts
|
|
7706
|
+
var NativeTextQualityStatusSchema, NativeTextQualityReasonSchema, NativeTextQualityCountsSchema, NativeTextQualityProfileSchema, NativeTextQualitySchema;
|
|
7707
|
+
var init_native_text_quality = __esm(() => {
|
|
7708
|
+
init_zod();
|
|
7709
|
+
NativeTextQualityStatusSchema = _enum(["clean", "empty", "suspect"]);
|
|
7710
|
+
NativeTextQualityReasonSchema = _enum([
|
|
7711
|
+
"empty",
|
|
7712
|
+
"replacement-character",
|
|
7713
|
+
"lone-surrogate",
|
|
7714
|
+
"forbidden-control",
|
|
7715
|
+
"unassigned",
|
|
7716
|
+
"noncharacter",
|
|
7717
|
+
"private-use"
|
|
7718
|
+
]);
|
|
7719
|
+
NativeTextQualityCountsSchema = object({
|
|
7720
|
+
codePoints: number2().int().nonnegative(),
|
|
7721
|
+
nonWhitespace: number2().int().nonnegative(),
|
|
7722
|
+
replacement: number2().int().nonnegative(),
|
|
7723
|
+
loneSurrogate: number2().int().nonnegative(),
|
|
7724
|
+
forbiddenControl: number2().int().nonnegative(),
|
|
7725
|
+
unassigned: number2().int().nonnegative(),
|
|
7726
|
+
noncharacter: number2().int().nonnegative(),
|
|
7727
|
+
privateUse: number2().int().nonnegative()
|
|
7728
|
+
});
|
|
7729
|
+
NativeTextQualityProfileSchema = object({
|
|
7730
|
+
replacementRatio: number2().nonnegative(),
|
|
7731
|
+
loneSurrogateRatio: number2().nonnegative(),
|
|
7732
|
+
forbiddenControlRatio: number2().nonnegative(),
|
|
7733
|
+
unassignedRatio: number2().nonnegative(),
|
|
7734
|
+
noncharacterRatio: number2().nonnegative(),
|
|
7735
|
+
privateUseRatio: number2().nonnegative()
|
|
7736
|
+
});
|
|
7737
|
+
NativeTextQualitySchema = object({
|
|
7738
|
+
status: NativeTextQualityStatusSchema,
|
|
7739
|
+
reasons: array(NativeTextQualityReasonSchema),
|
|
7740
|
+
counts: NativeTextQualityCountsSchema,
|
|
7741
|
+
profile: NativeTextQualityProfileSchema
|
|
7742
|
+
});
|
|
7743
|
+
});
|
|
7744
|
+
|
|
7745
|
+
// ../types/src/parser/spreadsheet-evidence.ts
|
|
7746
|
+
var SpreadsheetCellEvidenceSchema, SpreadsheetPageEvidenceSchema;
|
|
7747
|
+
var init_spreadsheet_evidence = __esm(() => {
|
|
7748
|
+
init_zod();
|
|
7749
|
+
SpreadsheetCellEvidenceSchema = object({
|
|
7750
|
+
address: string2().describe("Original A1 cell address"),
|
|
7751
|
+
type: string2().describe("Excel storage type: n=number, s=string, b=boolean, e=error, d=date, z=blank. A numeric date remains type n."),
|
|
7752
|
+
rawValue: union([string2(), number2(), boolean2(), _null3()]).optional().describe("Stored cached value; formulas are never evaluated"),
|
|
7753
|
+
displayedValue: string2().describe("Value formatted using the workbook number format and date system"),
|
|
7754
|
+
numberFormat: string2().optional(),
|
|
7755
|
+
formula: string2().optional(),
|
|
7756
|
+
dateValue: string2().optional().describe("Calendar rendering for a valid date-formatted serial, without a timezone. Evidence of Excel formatting, not a business classification."),
|
|
7757
|
+
excelLeapDay: boolean2().optional().describe("True for the fictitious 1900-02-29 in the Excel 1900 date system")
|
|
7758
|
+
});
|
|
7759
|
+
SpreadsheetPageEvidenceSchema = object({
|
|
7760
|
+
dateSystem: _enum(["1900", "1904"]),
|
|
7761
|
+
declaredRange: string2().optional(),
|
|
7762
|
+
cells: array(SpreadsheetCellEvidenceSchema)
|
|
7763
|
+
});
|
|
7764
|
+
});
|
|
7765
|
+
|
|
7766
|
+
// ../types/src/parser/parser.ts
|
|
7767
|
+
function refineNativeParseModeConflicts(config, ctx) {
|
|
7768
|
+
if (config.parseMode === "native" && config.describeFigures === true) {
|
|
7769
|
+
ctx.addIssue({
|
|
7770
|
+
code: ZodIssueCode.custom,
|
|
7771
|
+
path: ["describeFigures"],
|
|
7772
|
+
message: 'parseMode "native" cannot be combined with describeFigures because figure captions require vision egress'
|
|
7773
|
+
});
|
|
7774
|
+
}
|
|
7775
|
+
}
|
|
7776
|
+
function isNativeLayoutCompatible(config) {
|
|
7777
|
+
return config.parseMode === "native" || config.parseMode === "native-or-ocr";
|
|
7778
|
+
}
|
|
7779
|
+
function refineLayoutOutputFormat(config, ctx) {
|
|
7780
|
+
if (config.outputFormat !== "layout")
|
|
7781
|
+
return;
|
|
7782
|
+
if (isNativeLayoutCompatible(config))
|
|
7783
|
+
return;
|
|
7784
|
+
ctx.addIssue({
|
|
7785
|
+
code: ZodIssueCode.custom,
|
|
7786
|
+
path: ["outputFormat"],
|
|
7787
|
+
message: LAYOUT_OUTPUT_PARSE_MODE_ERROR
|
|
7788
|
+
});
|
|
7789
|
+
}
|
|
7790
|
+
function mimeTypeForExtension(extension) {
|
|
7791
|
+
return EXTENSION_TO_MIME[extension.replace(/^\./, "").toLowerCase()];
|
|
7792
|
+
}
|
|
7793
|
+
var OFFICE_MIME_TYPES, ParserCategory, ParserTypeSchema, ParseModeSchema, PARSE_OUTPUT_FORMATS, ParseOutputFormatSchema, PageProvenanceSourceSchema, PageProvenanceSchema, ProcessingStrategySchema, LAYOUT_OUTPUT_PARSE_MODE_ERROR = 'outputFormat "layout" is native PDF-only. Set parseMode to "native" or "native-or-ocr". Omitted parseMode, OCR, vision, and nativeText: true cannot request layout.', PARSE_OUTPUT_FORMAT_DESCRIPTION = "Format for extracted text. `markdown` (default) keeps structure; `plain` is unstyled text; `djot`/`html` preserve more markup. `layout` is native-PDF spatial text with column gaps preserved as spaces. It requires `parseMode: native` or `parseMode: native-or-ocr` and a PDF — omitted parseMode and `nativeText: true` are not enough. Native mode is layout-only and fail-closed. `native-or-ocr` keeps layout text on accepted native pages and uses OCR markdown on suspect or empty pages, so the document can mix fixed-width layout and markdown. Extractor failure never falls back to another parser. Office, plaintext, and images fail. OCR/vision cannot request `layout`.", DocumentMetadataSchema, ParseUsageSchema, StructuredDocumentSchema, CoordinateUnitSchema, PointSchema, BoundingRegionSchema, PositionedTextSchema, TableCellSchema, ExtractedTableSchema, LayoutElementTypeSchema, LayoutElementSchema, PageResultSchema, ParseResultSchema, ParseOptionsSchema, ParserInputSchema, EXTENSION_TO_MIME, MIME_TO_EXTENSION;
|
|
7794
|
+
var init_parser = __esm(() => {
|
|
7795
|
+
init_zod();
|
|
7796
|
+
init_ai_client();
|
|
7797
|
+
init_native_text_quality();
|
|
7798
|
+
init_spreadsheet_evidence();
|
|
7799
|
+
OFFICE_MIME_TYPES = [
|
|
7800
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
7801
|
+
"application/msword",
|
|
7802
|
+
"application/vnd.oasis.opendocument.text",
|
|
7803
|
+
"application/rtf",
|
|
7804
|
+
"text/rtf",
|
|
7805
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
7806
|
+
"application/vnd.ms-excel",
|
|
7807
|
+
"application/vnd.ms-excel.sheet.macroenabled.12",
|
|
7808
|
+
"application/vnd.ms-excel.sheet.binary.macroenabled.12",
|
|
7809
|
+
"application/vnd.oasis.opendocument.spreadsheet",
|
|
7810
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
7811
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
7812
|
+
"application/vnd.ms-powerpoint.presentation.macroenabled.12",
|
|
7813
|
+
"application/vnd.ms-powerpoint",
|
|
7814
|
+
"application/vnd.oasis.opendocument.presentation",
|
|
7815
|
+
"message/rfc822",
|
|
7816
|
+
"application/vnd.ms-outlook",
|
|
7817
|
+
"application/epub+zip"
|
|
7818
|
+
];
|
|
7819
|
+
ParserCategory = {
|
|
7820
|
+
PLAINTEXT: [
|
|
7821
|
+
"text/plain",
|
|
7822
|
+
"text/markdown",
|
|
7823
|
+
"text/csv",
|
|
7824
|
+
"text/tab-separated-values",
|
|
7825
|
+
"text/html",
|
|
7826
|
+
"text/xml",
|
|
7827
|
+
"application/json",
|
|
7828
|
+
"application/x-yaml",
|
|
7829
|
+
"application/toml",
|
|
7830
|
+
"image/svg+xml",
|
|
7831
|
+
"text/x-rst",
|
|
7832
|
+
"text/x-org",
|
|
7833
|
+
"application/x-latex",
|
|
7834
|
+
"application/x-ipynb+json",
|
|
7835
|
+
"application/x-bibtex",
|
|
7836
|
+
"application/docbook+xml",
|
|
7837
|
+
"application/x-fictionbook+xml"
|
|
7838
|
+
],
|
|
7839
|
+
OFFICE: [...OFFICE_MIME_TYPES],
|
|
7840
|
+
DOCUMENT: [
|
|
7841
|
+
"application/pdf",
|
|
7842
|
+
"image/png",
|
|
7843
|
+
"image/jpeg",
|
|
7844
|
+
"image/webp",
|
|
7845
|
+
"image/tiff",
|
|
7846
|
+
"image/gif",
|
|
7847
|
+
"image/bmp"
|
|
7848
|
+
]
|
|
7849
|
+
};
|
|
7850
|
+
ParserTypeSchema = _enum([
|
|
7851
|
+
"plaintext",
|
|
7852
|
+
"office",
|
|
7853
|
+
"llm-vision",
|
|
7854
|
+
"ocr"
|
|
7855
|
+
]);
|
|
7856
|
+
ParseModeSchema = _enum(["ocr", "vision", "native", "native-or-ocr"]);
|
|
7857
|
+
PARSE_OUTPUT_FORMATS = ["plain", "markdown", "djot", "html", "layout"];
|
|
7858
|
+
ParseOutputFormatSchema = _enum(PARSE_OUTPUT_FORMATS);
|
|
7859
|
+
PageProvenanceSourceSchema = _enum(["native", "ocr", "vision"]);
|
|
7860
|
+
PageProvenanceSchema = object({
|
|
7861
|
+
source: PageProvenanceSourceSchema
|
|
7862
|
+
});
|
|
7863
|
+
ProcessingStrategySchema = _enum(["native", "ocr", "vision", "hybrid"]);
|
|
7864
|
+
DocumentMetadataSchema = object({
|
|
7865
|
+
filename: string2(),
|
|
7866
|
+
mimeType: string2(),
|
|
7867
|
+
size: number2().describe("File size in bytes"),
|
|
7868
|
+
storageRef: string2().optional().describe("Storage reference for the original file")
|
|
7869
|
+
});
|
|
7870
|
+
ParseUsageSchema = object({
|
|
7871
|
+
pageCount: number2(),
|
|
7872
|
+
processingTimeMs: number2().optional(),
|
|
7873
|
+
ocrPagesProcessed: number2().int().nonnegative().optional(),
|
|
7874
|
+
visionPagesProcessed: number2().int().nonnegative().optional(),
|
|
7875
|
+
visionPromptTokens: number2().int().nonnegative().optional(),
|
|
7876
|
+
visionCompletionTokens: number2().int().nonnegative().optional(),
|
|
7877
|
+
cached: boolean2().optional()
|
|
7878
|
+
});
|
|
7879
|
+
StructuredDocumentSchema = record(string2(), unknown());
|
|
7880
|
+
CoordinateUnitSchema = _enum(["pixel", "inch", "point", "normalized"]);
|
|
7881
|
+
PointSchema = object({
|
|
7882
|
+
x: number2(),
|
|
7883
|
+
y: number2()
|
|
7884
|
+
});
|
|
7885
|
+
BoundingRegionSchema = object({
|
|
7886
|
+
polygon: array(PointSchema).min(3),
|
|
7887
|
+
unit: CoordinateUnitSchema,
|
|
7888
|
+
pageIndex: number2()
|
|
7889
|
+
});
|
|
7890
|
+
PositionedTextSchema = object({
|
|
7891
|
+
text: string2(),
|
|
7892
|
+
confidence: number2().min(0).max(1).optional(),
|
|
7893
|
+
boundingRegion: BoundingRegionSchema.optional()
|
|
7894
|
+
});
|
|
7895
|
+
TableCellSchema = object({
|
|
7896
|
+
content: string2(),
|
|
7897
|
+
rowIndex: number2(),
|
|
7898
|
+
columnIndex: number2(),
|
|
7899
|
+
rowSpan: number2().default(1),
|
|
7900
|
+
columnSpan: number2().default(1),
|
|
7901
|
+
boundingRegion: BoundingRegionSchema.optional()
|
|
7902
|
+
});
|
|
7903
|
+
ExtractedTableSchema = object({
|
|
7904
|
+
cells: array(TableCellSchema),
|
|
7905
|
+
rowCount: number2(),
|
|
7906
|
+
columnCount: number2(),
|
|
7907
|
+
boundingRegion: BoundingRegionSchema.optional()
|
|
7908
|
+
});
|
|
7909
|
+
LayoutElementTypeSchema = _enum([
|
|
7910
|
+
"paragraph",
|
|
7911
|
+
"title",
|
|
7912
|
+
"sectionHeading",
|
|
7913
|
+
"pageHeader",
|
|
7914
|
+
"pageFooter",
|
|
7915
|
+
"pageNumber",
|
|
7916
|
+
"footnote",
|
|
7917
|
+
"table",
|
|
7918
|
+
"figure",
|
|
7919
|
+
"formulaBlock"
|
|
7920
|
+
]);
|
|
7921
|
+
LayoutElementSchema = object({
|
|
7922
|
+
type: LayoutElementTypeSchema,
|
|
7923
|
+
content: string2(),
|
|
7924
|
+
table: ExtractedTableSchema.optional(),
|
|
7925
|
+
caption: string2().optional(),
|
|
7926
|
+
figureId: string2().optional(),
|
|
7927
|
+
boundingRegion: BoundingRegionSchema.optional()
|
|
7928
|
+
});
|
|
7929
|
+
PageResultSchema = object({
|
|
7930
|
+
spreadsheet: SpreadsheetPageEvidenceSchema.optional().describe("Opt-in original spreadsheet cell evidence"),
|
|
7931
|
+
pageIndex: number2().describe("0-based page index"),
|
|
7932
|
+
text: string2().describe("Extracted page text (markdown/HTML/plain, or spatial layout text)"),
|
|
7933
|
+
pageName: string2().optional().describe("Page/sheet name (e.g., Excel sheet name)"),
|
|
7934
|
+
layoutElements: array(LayoutElementSchema).optional().describe("Semantic layout elements in reading order"),
|
|
7935
|
+
words: array(PositionedTextSchema).optional().describe("Word-level positions"),
|
|
7936
|
+
lines: array(PositionedTextSchema).optional().describe("Line-level positions"),
|
|
7937
|
+
tables: array(ExtractedTableSchema).optional().describe("Extracted tables"),
|
|
7938
|
+
width: number2().optional().describe("Page width"),
|
|
7939
|
+
height: number2().optional().describe("Page height"),
|
|
7940
|
+
unit: CoordinateUnitSchema.optional().describe("Unit for width/height and bounding regions"),
|
|
7941
|
+
confidence: number2().min(0).max(1).optional().describe("Overall page confidence"),
|
|
7942
|
+
nativeTextQuality: NativeTextQualitySchema.optional().describe('Per-page diagnosis of native-extracted text. Reports objectively detectable anomalies (empty, U+FFFD, forbidden controls, unassigned/noncharacter code points, heavy private-use). Does not certify semantic correctness — valid-looking wrong mappings and literal "?" cannot be distinguished from legitimate text.'),
|
|
7943
|
+
provenance: PageProvenanceSchema.optional().describe("Which extractor produced the final text/layout on this page")
|
|
7944
|
+
});
|
|
7945
|
+
ParseResultSchema = object({
|
|
7946
|
+
document: DocumentMetadataSchema,
|
|
7947
|
+
usage: ParseUsageSchema,
|
|
7948
|
+
pages: array(PageResultSchema),
|
|
7949
|
+
text: string2().describe("Combined text from all pages"),
|
|
7950
|
+
parserType: ParserTypeSchema,
|
|
7951
|
+
parserVersion: string2().optional(),
|
|
7952
|
+
model: string2().optional().describe("Model used (for LLM/OCR parsers)"),
|
|
7953
|
+
processingStrategy: ProcessingStrategySchema.optional().describe("How this result was produced: `native` (local PDF text only), `ocr`, `vision`, or `hybrid` (native pages merged with OCR on fallback pages)."),
|
|
7954
|
+
structured: StructuredDocumentSchema.optional().describe("Canonical structured document with ordered blocks, regions, bounding boxes, tables, figures, and chunks when supported by the parser"),
|
|
7955
|
+
rawResponse: unknown().optional()
|
|
7956
|
+
});
|
|
7957
|
+
ParseOptionsSchema = object({
|
|
7958
|
+
includeCellMetadata: boolean2().optional(),
|
|
7959
|
+
outputFormat: ParseOutputFormatSchema.default("markdown"),
|
|
7960
|
+
ocrProvider: string2().optional().describe("OCR provider ID to use"),
|
|
7961
|
+
includeWordPositions: boolean2().default(false),
|
|
7962
|
+
includeLinePositions: boolean2().default(false),
|
|
7963
|
+
extractTables: boolean2().default(true),
|
|
7964
|
+
provider: string2().optional().describe("LLM provider ID to use"),
|
|
7965
|
+
model: string2().optional(),
|
|
7966
|
+
reasoningEffort: ReasoningEffortSchema.optional(),
|
|
7967
|
+
maxConcurrency: number2().min(1).max(30).default(3),
|
|
7968
|
+
pagesPerBatch: number2().min(1).max(20).default(5),
|
|
7969
|
+
pdfRenderScale: number2().min(1).max(4).default(1).describe("Scale factor used when rendering PDF pages for VLM parsing"),
|
|
7970
|
+
imageQuality: number2().int().min(1).max(100).default(85).describe("JPEG quality used for PDF page images sent to VLM parsing"),
|
|
7971
|
+
prompt: string2().optional().describe("Custom prompt for LLM-based parsing"),
|
|
7972
|
+
languages: array(string2()).optional().describe("OCR language hints"),
|
|
7973
|
+
pages: array(number2().int().min(1)).optional().describe("1-indexed pages to OCR; omit or empty to analyze the whole document"),
|
|
7974
|
+
tenantId: string2().optional(),
|
|
7975
|
+
requireCompletePages: boolean2().optional()
|
|
7976
|
+
});
|
|
7977
|
+
ParserInputSchema = object({
|
|
7978
|
+
data: _instanceof(Buffer).or(_instanceof(Uint8Array)),
|
|
7979
|
+
filename: string2(),
|
|
7980
|
+
mimeType: string2(),
|
|
7981
|
+
options: ParseOptionsSchema.optional()
|
|
7982
|
+
});
|
|
7983
|
+
EXTENSION_TO_MIME = {
|
|
7984
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
7985
|
+
doc: "application/msword",
|
|
7986
|
+
odt: "application/vnd.oasis.opendocument.text",
|
|
7987
|
+
rtf: "application/rtf",
|
|
7988
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
7989
|
+
xls: "application/vnd.ms-excel",
|
|
7990
|
+
xlsm: "application/vnd.ms-excel.sheet.macroenabled.12",
|
|
7991
|
+
xlsb: "application/vnd.ms-excel.sheet.binary.macroenabled.12",
|
|
7992
|
+
ods: "application/vnd.oasis.opendocument.spreadsheet",
|
|
7993
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
7994
|
+
ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
7995
|
+
pptm: "application/vnd.ms-powerpoint.presentation.macroenabled.12",
|
|
7996
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
7997
|
+
odp: "application/vnd.oasis.opendocument.presentation",
|
|
7998
|
+
eml: "message/rfc822",
|
|
7999
|
+
msg: "application/vnd.ms-outlook",
|
|
8000
|
+
epub: "application/epub+zip",
|
|
8001
|
+
pdf: "application/pdf",
|
|
8002
|
+
png: "image/png",
|
|
8003
|
+
jpg: "image/jpeg",
|
|
8004
|
+
jpeg: "image/jpeg",
|
|
8005
|
+
webp: "image/webp",
|
|
8006
|
+
tiff: "image/tiff",
|
|
8007
|
+
tif: "image/tiff",
|
|
8008
|
+
gif: "image/gif",
|
|
8009
|
+
bmp: "image/bmp",
|
|
8010
|
+
svg: "image/svg+xml",
|
|
8011
|
+
txt: "text/plain",
|
|
8012
|
+
md: "text/markdown",
|
|
8013
|
+
markdown: "text/markdown",
|
|
8014
|
+
csv: "text/csv",
|
|
8015
|
+
tsv: "text/tab-separated-values",
|
|
8016
|
+
html: "text/html",
|
|
8017
|
+
htm: "text/html",
|
|
8018
|
+
xml: "text/xml",
|
|
8019
|
+
json: "application/json",
|
|
8020
|
+
yaml: "application/x-yaml",
|
|
8021
|
+
yml: "application/x-yaml",
|
|
8022
|
+
toml: "application/toml",
|
|
8023
|
+
rst: "text/x-rst",
|
|
8024
|
+
org: "text/x-org",
|
|
8025
|
+
tex: "application/x-latex",
|
|
8026
|
+
latex: "application/x-latex",
|
|
8027
|
+
ipynb: "application/x-ipynb+json",
|
|
8028
|
+
bib: "application/x-bibtex",
|
|
8029
|
+
dbk: "application/docbook+xml",
|
|
8030
|
+
docbook: "application/docbook+xml",
|
|
8031
|
+
fb2: "application/x-fictionbook+xml",
|
|
8032
|
+
zip: "application/zip"
|
|
8033
|
+
};
|
|
8034
|
+
MIME_TO_EXTENSION = Object.entries(EXTENSION_TO_MIME).reduce((acc, [ext, mime]) => {
|
|
8035
|
+
if (!(mime in acc))
|
|
8036
|
+
acc[mime] = ext;
|
|
8037
|
+
return acc;
|
|
8038
|
+
}, {});
|
|
8039
|
+
});
|
|
8040
|
+
|
|
8041
|
+
// ../types/src/files/runtime-file-ref.ts
|
|
8042
|
+
var DbFileRefSchema, LegacyFileIdInputSchema, LocalFileRefSchema, S3FileRefSchema, InlineFileRefSchema, RuntimeFileRefSchema, FilePathDescriptorSchema, ResolvedProcessorFileSchema;
|
|
8043
|
+
var init_runtime_file_ref = __esm(() => {
|
|
8044
|
+
init_zod();
|
|
8045
|
+
DbFileRefSchema = object({
|
|
8046
|
+
kind: literal("file"),
|
|
8047
|
+
fileId: string2().describe("File ID from files table"),
|
|
8048
|
+
filename: string2().optional().describe("Original filename"),
|
|
8049
|
+
mimeType: string2().optional().describe("MIME type")
|
|
8050
|
+
});
|
|
8051
|
+
LegacyFileIdInputSchema = object({
|
|
8052
|
+
kind: never().optional(),
|
|
8053
|
+
fileId: string2().describe("File ID from files table"),
|
|
8054
|
+
filename: string2().optional().describe("Original filename"),
|
|
8055
|
+
mimeType: string2().optional().describe("MIME type")
|
|
8056
|
+
});
|
|
8057
|
+
LocalFileRefSchema = object({
|
|
8058
|
+
kind: literal("local"),
|
|
8059
|
+
path: string2().describe("Absolute path to a file on disk"),
|
|
8060
|
+
filename: string2().describe("Original filename"),
|
|
8061
|
+
mimeType: string2().describe("MIME type of the file")
|
|
8062
|
+
});
|
|
8063
|
+
S3FileRefSchema = object({
|
|
8064
|
+
kind: literal("s3"),
|
|
8065
|
+
ref: string2().describe("Storage key (suffix-only, prefix added by adapter)"),
|
|
8066
|
+
filename: string2().describe("Original filename"),
|
|
8067
|
+
mimeType: string2().describe("MIME type of the file")
|
|
8068
|
+
});
|
|
8069
|
+
InlineFileRefSchema = object({
|
|
8070
|
+
kind: literal("inline"),
|
|
8071
|
+
base64: string2().describe("Base64-encoded file bytes"),
|
|
8072
|
+
filename: string2().describe("Original filename"),
|
|
8073
|
+
mimeType: string2().describe("MIME type of the file")
|
|
8074
|
+
});
|
|
8075
|
+
RuntimeFileRefSchema = discriminatedUnion("kind", [
|
|
8076
|
+
DbFileRefSchema,
|
|
8077
|
+
LocalFileRefSchema,
|
|
8078
|
+
S3FileRefSchema,
|
|
8079
|
+
InlineFileRefSchema
|
|
8080
|
+
]);
|
|
8081
|
+
FilePathDescriptorSchema = discriminatedUnion("kind", [
|
|
8082
|
+
LocalFileRefSchema,
|
|
8083
|
+
S3FileRefSchema,
|
|
8084
|
+
InlineFileRefSchema
|
|
8085
|
+
]);
|
|
8086
|
+
ResolvedProcessorFileSchema = object({
|
|
8087
|
+
__eigenpalFile: literal(true),
|
|
8088
|
+
source: _enum(["db", "tenant-s3", "local", "inline"]),
|
|
8089
|
+
filename: string2().describe("Display filename for processor logs and parser routing"),
|
|
8090
|
+
mimeType: string2().describe("MIME type for processor routing"),
|
|
8091
|
+
fileId: string2().optional().describe("Legacy files-table id for db-backed handles"),
|
|
8092
|
+
ref: string2().optional().describe("Tenant-scoped storage key suffix for S3-backed handles"),
|
|
8093
|
+
path: string2().optional().describe("Local filesystem path for headless/CLI handles"),
|
|
8094
|
+
base64: string2().optional().describe("Base64 bytes for inline handles"),
|
|
8095
|
+
size: number2().int().nonnegative().optional().describe("Byte size when a file-producing step recorded it")
|
|
8096
|
+
}).strict();
|
|
8097
|
+
});
|
|
8098
|
+
|
|
8099
|
+
// ../types/src/processor/configs/document-parser.ts
|
|
8100
|
+
var DocumentParserInputSchema, DocumentParserOutputSchema, DocumentParserConfigSchema;
|
|
8101
|
+
var init_document_parser = __esm(() => {
|
|
8102
|
+
init_zod();
|
|
8103
|
+
init_ai_client();
|
|
8104
|
+
init_runtime_file_ref();
|
|
8105
|
+
init_parser();
|
|
8106
|
+
DocumentParserInputSchema = ResolvedProcessorFileSchema;
|
|
8107
|
+
DocumentParserOutputSchema = ParseResultSchema;
|
|
8108
|
+
DocumentParserConfigSchema = object({
|
|
8109
|
+
parseMode: ParseModeSchema.optional().describe('Base parser for PDF/image inputs. OCR is the default. `native` extracts PDF text only (never OCR/vision). `native-or-ocr` requests OCR when pages have detectable native-text anomalies (empty, U+FFFD, lone surrogates, forbidden controls, unassigned/noncharacter, heavy PUA). Page selection, subset egress, and billing are provider-dependent. Valid-looking wrong text and literal "?" are not flagged.'),
|
|
8110
|
+
ocrModel: string2().optional().describe("OCR provider ID for PDF/image parsing"),
|
|
8111
|
+
llmModel: string2().optional().describe("LLM provider ID for vision-based parsing"),
|
|
8112
|
+
llmReasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for vision-based parsing. Omit to use the model default."),
|
|
8113
|
+
figureModel: string2().optional().describe("Vision model used only for the optional figure-description pass"),
|
|
8114
|
+
figureReasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for figure descriptions. Omit to use the model default."),
|
|
8115
|
+
maxConcurrency: number2().min(1).max(10).default(3).describe("Max concurrent VLM batch requests"),
|
|
8116
|
+
pagesPerBatch: number2().min(1).max(20).default(5).describe("Number of page images per VLM request"),
|
|
8117
|
+
pdfRenderScale: number2().min(1).max(4).default(1).optional().describe("Scale factor used when rendering PDF pages for VLM parsing"),
|
|
8118
|
+
imageQuality: number2().int().min(1).max(100).default(85).optional().describe("JPEG quality used for PDF page images sent to VLM parsing"),
|
|
8119
|
+
prompt: string2().optional().describe("Custom extraction prompt"),
|
|
8120
|
+
nativeText: boolean2().default(false).optional().describe("Use native text extraction for PDFs with embedded text (no OCR/VLM)"),
|
|
8121
|
+
describeFigures: boolean2().optional().describe("Opt-in (default off). After text extraction, detect figure pages with a layout model and caption them with a vision model, appending `<figure>description</figure>` to their text. Skipped for plaintext. The caption vision calls are billed."),
|
|
8122
|
+
figureInstructions: string2().optional().describe("Custom instruction for the figure-description pass."),
|
|
8123
|
+
languages: array(string2()).optional().describe('OCR language hints (e.g., ["en", "de"])'),
|
|
8124
|
+
outputFormat: ParseOutputFormatSchema.default("markdown").optional().describe(PARSE_OUTPUT_FORMAT_DESCRIPTION),
|
|
8125
|
+
cache: boolean2().default(false).optional().describe("When true, reuse a prior parse for identical file bytes and parse settings. Skips OCR/vision on cache hit. Stored in tenant blob storage with no automatic expiry (TTL/lifecycle is a follow-up). Default off.")
|
|
8126
|
+
}).superRefine(refineNativeParseModeConflicts).superRefine(refineLayoutOutputFormat).prefault({});
|
|
8127
|
+
});
|
|
8128
|
+
|
|
8129
|
+
// ../types/src/processor/configs/document-parser-v2.ts
|
|
8130
|
+
var ImageReadingBackendSchema, ParseV2TextFormatSchema, ParseV2SettingsSchema, DocumentParserV2ConfigSchema, AiParseV2ConfigSchema, ParseV2PageSchema, ParseV2ResultSchema, DocumentParserV2InputSchema;
|
|
8131
|
+
var init_document_parser_v2 = __esm(() => {
|
|
8132
|
+
init_zod();
|
|
8133
|
+
init_ai_client();
|
|
8134
|
+
init_parser();
|
|
8135
|
+
init_document_parser();
|
|
8136
|
+
ImageReadingBackendSchema = _enum(["ocr", "vision"]);
|
|
8137
|
+
ParseV2TextFormatSchema = _enum(["plain", "markdown", "html", "djot"]);
|
|
8138
|
+
ParseV2SettingsSchema = strictObject({
|
|
8139
|
+
policy: strictObject({
|
|
8140
|
+
native: _enum(["prefer", "require", "skip"]).default("prefer").describe("Prefer local text extraction, require local text extraction with no image transcription, or skip native PDF extraction. Figure enrichment is independent."),
|
|
8141
|
+
imageReading: strictObject({
|
|
8142
|
+
order: array(ImageReadingBackendSchema).min(1).max(2).refine((v) => new Set(v).size === v.length, "Backends must be unique").default(["ocr", "vision"]).describe("Ordered allowed backends. A single entry prohibits the other backend.")
|
|
8143
|
+
}).prefault({})
|
|
8144
|
+
}).prefault({}),
|
|
8145
|
+
providers: strictObject({
|
|
8146
|
+
ocr: string2().min(1).optional().describe("Exact configured OCR provider ID. Missing pins fail; they never resolve to another provider."),
|
|
8147
|
+
vision: string2().min(1).optional().describe("Exact configured vision provider ID. Otherwise uses the deployment parsing default or vision role.")
|
|
8148
|
+
}).prefault({}),
|
|
8149
|
+
output: strictObject({
|
|
8150
|
+
textFormat: ParseV2TextFormatSchema.default("markdown"),
|
|
8151
|
+
includeCellMetadata: boolean2().default(false).describe("Include spreadsheet cell evidence in pages[].spreadsheet and annotate text for downstream extraction. Preserves raw/displayed values and workbook date system."),
|
|
8152
|
+
nativeWhitespace: _enum(["reading-order", "spatial"]).default("reading-order").describe("Spatial preserves native PDF column spacing. It does not promise OCR/vision coordinates."),
|
|
8153
|
+
require: array(_enum(["wordCoordinates", "tables"])).default([]).describe("Required evidence capabilities on nonblank pages. Backends unable to satisfy them are rejected.")
|
|
8154
|
+
}).prefault({}),
|
|
8155
|
+
enrichment: strictObject({
|
|
8156
|
+
figures: strictObject({
|
|
8157
|
+
enabled: boolean2().default(false),
|
|
8158
|
+
provider: string2().min(1).optional(),
|
|
8159
|
+
instructions: string2().optional(),
|
|
8160
|
+
reasoningEffort: ReasoningEffortSchema.optional()
|
|
8161
|
+
}).prefault({})
|
|
8162
|
+
}).prefault({}),
|
|
8163
|
+
advanced: strictObject({
|
|
8164
|
+
vision: strictObject({
|
|
8165
|
+
maxConcurrency: number2().int().min(1).max(10).default(3),
|
|
8166
|
+
pagesPerBatch: number2().int().min(1).max(20).default(5),
|
|
8167
|
+
renderScale: number2().min(1).max(4).default(2),
|
|
8168
|
+
imageQuality: number2().int().min(1).max(100).default(85),
|
|
8169
|
+
instructions: string2().optional().describe("Transcription instructions, never document-specific extraction/schema instructions."),
|
|
8170
|
+
reasoningEffort: ReasoningEffortSchema.optional()
|
|
8171
|
+
}).prefault({}),
|
|
8172
|
+
languages: array(string2().min(1)).optional(),
|
|
8173
|
+
allowPartial: boolean2().default(false).describe("Return unresolved pages explicitly instead of failing. Default false."),
|
|
8174
|
+
cache: boolean2().default(false)
|
|
8175
|
+
}).prefault({})
|
|
8176
|
+
}).superRefine((config, ctx) => {
|
|
8177
|
+
if (config.output.nativeWhitespace === "spatial" && config.output.textFormat !== "plain") {
|
|
8178
|
+
ctx.addIssue({
|
|
8179
|
+
code: "custom",
|
|
8180
|
+
path: ["output"],
|
|
8181
|
+
message: "Spatial native whitespace requires textFormat: plain."
|
|
8182
|
+
});
|
|
8183
|
+
}
|
|
8184
|
+
});
|
|
8185
|
+
DocumentParserV2ConfigSchema = ParseV2SettingsSchema.prefault({});
|
|
8186
|
+
AiParseV2ConfigSchema = ParseV2SettingsSchema.safeExtend({
|
|
8187
|
+
input: string2().min(1).describe("File reference or template expression for the document")
|
|
8188
|
+
});
|
|
8189
|
+
ParseV2PageSchema = PageResultSchema.extend({
|
|
8190
|
+
provenance: object({
|
|
8191
|
+
source: _enum(["native", "ocr", "vision"]),
|
|
8192
|
+
provider: string2().optional(),
|
|
8193
|
+
model: string2().optional(),
|
|
8194
|
+
reason: string2(),
|
|
8195
|
+
textFormat: ParseV2TextFormatSchema,
|
|
8196
|
+
capabilities: array(_enum(["wordCoordinates", "tables"]))
|
|
8197
|
+
}),
|
|
8198
|
+
status: _enum(["complete", "blank", "no-text", "unresolved"]),
|
|
8199
|
+
warnings: array(string2()).default([])
|
|
8200
|
+
});
|
|
8201
|
+
ParseV2ResultSchema = ParseResultSchema.omit({ rawResponse: true }).extend({
|
|
8202
|
+
parserVersion: literal("2"),
|
|
8203
|
+
pages: array(ParseV2PageSchema),
|
|
8204
|
+
completeness: object({
|
|
8205
|
+
status: _enum(["complete", "partial"]),
|
|
8206
|
+
unresolvedPageIndexes: array(number2().int().nonnegative())
|
|
8207
|
+
}),
|
|
8208
|
+
usage: ParseResultSchema.shape.usage.extend({
|
|
8209
|
+
visionPagesProcessed: number2().int().nonnegative()
|
|
8210
|
+
})
|
|
8211
|
+
});
|
|
8212
|
+
DocumentParserV2InputSchema = DocumentParserInputSchema;
|
|
8213
|
+
});
|
|
8214
|
+
|
|
8215
|
+
// ../types/src/processor/configs/parse-v2-migration.ts
|
|
8216
|
+
function migrateWorkflowParsers(definition, policy) {
|
|
8217
|
+
const warnings = [];
|
|
8218
|
+
const migratedSteps = [];
|
|
8219
|
+
function walk(value) {
|
|
8220
|
+
if (Array.isArray(value))
|
|
8221
|
+
return value.map(walk);
|
|
8222
|
+
if (!value || typeof value !== "object")
|
|
8223
|
+
return value;
|
|
8224
|
+
const record = value;
|
|
8225
|
+
const result = { ...record };
|
|
8226
|
+
for (const key of ["steps", "then", "else", "branches", "cases", "default"])
|
|
8227
|
+
if (Array.isArray(record[key]))
|
|
8228
|
+
result[key] = walk(record[key]);
|
|
8229
|
+
if (record.type !== "ai.parse")
|
|
8230
|
+
return result;
|
|
8231
|
+
const name = String(record.name ?? "parse");
|
|
8232
|
+
const config = record.with ?? {};
|
|
8233
|
+
const unknown = Object.keys(config).filter((k) => !LEGACY_FIELDS.has(k));
|
|
8234
|
+
if (unknown.length)
|
|
8235
|
+
throw new Error(`Cannot migrate '${name}': unsupported settings ${unknown.join(", ")}. Review them before migrating.`);
|
|
8236
|
+
const mode = config.parseMode;
|
|
8237
|
+
let native = mode === "native" ? "require" : mode === "native-or-ocr" || config.nativeText === true ? "prefer" : "skip";
|
|
8238
|
+
if (mode !== undefined && !["native", "ocr", "vision", "native-or-ocr"].includes(String(mode)))
|
|
8239
|
+
throw new Error(`Cannot migrate '${name}': unknown legacy parseMode '${String(mode)}'.`);
|
|
8240
|
+
let order = mode === "vision" || !mode && !config.ocrModel && config.llmModel ? ["vision"] : ["ocr"];
|
|
8241
|
+
if (policy === "auto") {
|
|
8242
|
+
if (native === "require" || order.length === 1)
|
|
8243
|
+
warnings.push(`${name}: automatic policy broadens allowed image-reading backends; review egress and cost restrictions.`);
|
|
8244
|
+
native = "prefer";
|
|
8245
|
+
order = ["ocr", "vision"];
|
|
8246
|
+
}
|
|
8247
|
+
if (config.nativeText)
|
|
8248
|
+
warnings.push(`${name}: v2 checks every page; legacy document-wide nativeText success is intentionally not preserved.`);
|
|
8249
|
+
if (config.outputFormat === "layout")
|
|
8250
|
+
warnings.push(`${name}: layout becomes plain text with spatial native whitespace. Image-reading pages use plain transcription without invented geometry.`);
|
|
8251
|
+
warnings.push(`${name}: completeness validation may expose unread content; compare downstream outputs before publishing.`);
|
|
8252
|
+
const next = {
|
|
8253
|
+
input: config.input,
|
|
8254
|
+
policy: { native, imageReading: { order } },
|
|
8255
|
+
providers: { ocr: config.ocrModel, vision: config.llmModel },
|
|
8256
|
+
output: {
|
|
8257
|
+
textFormat: config.outputFormat === "layout" ? "plain" : config.outputFormat ?? "markdown",
|
|
8258
|
+
nativeWhitespace: config.outputFormat === "layout" ? "spatial" : "reading-order"
|
|
8259
|
+
},
|
|
8260
|
+
enrichment: {
|
|
8261
|
+
figures: {
|
|
8262
|
+
enabled: config.describeFigures ?? false,
|
|
8263
|
+
provider: config.figureModel ?? (mode === "vision" ? config.llmModel : undefined),
|
|
8264
|
+
instructions: config.figureInstructions,
|
|
8265
|
+
reasoningEffort: config.figureReasoningEffort
|
|
8266
|
+
}
|
|
8267
|
+
},
|
|
8268
|
+
advanced: {
|
|
8269
|
+
cache: config.cache ?? false,
|
|
8270
|
+
languages: config.languages,
|
|
8271
|
+
vision: {
|
|
8272
|
+
maxConcurrency: config.maxConcurrency,
|
|
8273
|
+
pagesPerBatch: config.pagesPerBatch,
|
|
8274
|
+
renderScale: config.pdfRenderScale,
|
|
8275
|
+
imageQuality: config.imageQuality,
|
|
8276
|
+
instructions: config.prompt,
|
|
8277
|
+
reasoningEffort: config.llmReasoningEffort
|
|
8278
|
+
}
|
|
8279
|
+
}
|
|
8280
|
+
};
|
|
8281
|
+
result.type = "ai.parse-v2";
|
|
8282
|
+
result.with = AiParseV2ConfigSchema.parse(next);
|
|
8283
|
+
migratedSteps.push(name);
|
|
8284
|
+
return result;
|
|
8285
|
+
}
|
|
8286
|
+
return { definition: walk(definition), migratedSteps, warnings };
|
|
8287
|
+
}
|
|
8288
|
+
var LEGACY_FIELDS;
|
|
8289
|
+
var init_parse_v2_migration = __esm(() => {
|
|
8290
|
+
init_document_parser_v2();
|
|
8291
|
+
LEGACY_FIELDS = new Set([
|
|
8292
|
+
"input",
|
|
8293
|
+
"parseMode",
|
|
8294
|
+
"nativeText",
|
|
8295
|
+
"ocrModel",
|
|
8296
|
+
"llmModel",
|
|
8297
|
+
"llmReasoningEffort",
|
|
8298
|
+
"figureModel",
|
|
8299
|
+
"figureReasoningEffort",
|
|
8300
|
+
"describeFigures",
|
|
8301
|
+
"figureInstructions",
|
|
8302
|
+
"maxConcurrency",
|
|
8303
|
+
"pagesPerBatch",
|
|
8304
|
+
"pdfRenderScale",
|
|
8305
|
+
"imageQuality",
|
|
8306
|
+
"prompt",
|
|
8307
|
+
"languages",
|
|
8308
|
+
"outputFormat",
|
|
8309
|
+
"cache"
|
|
8310
|
+
]);
|
|
8311
|
+
});
|
|
8312
|
+
|
|
7674
8313
|
// ../../node_modules/nanoid/index.js
|
|
7675
8314
|
import { webcrypto as crypto } from "node:crypto";
|
|
7676
8315
|
function fillPool(bytes) {
|
|
@@ -7781,6 +8420,8 @@ var init_common = __esm(() => {
|
|
|
7781
8420
|
HUMAN_REVIEW_FIELD_MUTATION: "hrm",
|
|
7782
8421
|
TABLE_ROW: "row",
|
|
7783
8422
|
FOLDER: "fldr",
|
|
8423
|
+
ACCESS_GRANT: "agr",
|
|
8424
|
+
ACCESS_GROUP: "grp",
|
|
7784
8425
|
AGENT_WORKFLOW: "awf",
|
|
7785
8426
|
AGENT_EXECUTION: "aex",
|
|
7786
8427
|
AGENT_EXAMPLE: "aeg",
|
|
@@ -7823,6 +8464,7 @@ var init_ids = __esm(() => {
|
|
|
7823
8464
|
PROCESSOR_IDS = {
|
|
7824
8465
|
MERGE: "builtin/merge",
|
|
7825
8466
|
DOCUMENT_PARSER: "builtin/parser",
|
|
8467
|
+
DOCUMENT_PARSER_V2: "builtin/parser-v2",
|
|
7826
8468
|
EXTRACT: "builtin/extract",
|
|
7827
8469
|
SPLIT: "builtin/split",
|
|
7828
8470
|
SEGMENT: "builtin/segment",
|
|
@@ -15177,29 +15819,6 @@ var init_scoped_file_ref = __esm(() => {
|
|
|
15177
15819
|
]);
|
|
15178
15820
|
});
|
|
15179
15821
|
|
|
15180
|
-
// ../types/src/client/ai-client.ts
|
|
15181
|
-
var REASONING_EFFORTS, ReasoningEffortSchema, ModelReasoningConfigSchema;
|
|
15182
|
-
var init_ai_client = __esm(() => {
|
|
15183
|
-
init_zod();
|
|
15184
|
-
REASONING_EFFORTS = [
|
|
15185
|
-
"none",
|
|
15186
|
-
"minimal",
|
|
15187
|
-
"low",
|
|
15188
|
-
"medium",
|
|
15189
|
-
"high",
|
|
15190
|
-
"xhigh",
|
|
15191
|
-
"max"
|
|
15192
|
-
];
|
|
15193
|
-
ReasoningEffortSchema = _enum(REASONING_EFFORTS);
|
|
15194
|
-
ModelReasoningConfigSchema = object({
|
|
15195
|
-
supportedEfforts: array(ReasoningEffortSchema).min(1),
|
|
15196
|
-
defaultEffort: ReasoningEffortSchema.optional()
|
|
15197
|
-
}).refine((config) => config.defaultEffort === undefined || config.supportedEfforts.includes(config.defaultEffort), {
|
|
15198
|
-
message: "defaultEffort must be included in supportedEfforts",
|
|
15199
|
-
path: ["defaultEffort"]
|
|
15200
|
-
}).strict();
|
|
15201
|
-
});
|
|
15202
|
-
|
|
15203
15822
|
// ../types/src/processor/configs/classify.ts
|
|
15204
15823
|
var ClassifyInputSchema, ClassifyLabelSchema, ClassifyConfigSchema, ClassifyOutputSchema;
|
|
15205
15824
|
var init_classify = __esm(() => {
|
|
@@ -15266,402 +15885,6 @@ var init_classify_pages = __esm(() => {
|
|
|
15266
15885
|
});
|
|
15267
15886
|
});
|
|
15268
15887
|
|
|
15269
|
-
// ../types/src/files/runtime-file-ref.ts
|
|
15270
|
-
var DbFileRefSchema, LegacyFileIdInputSchema, LocalFileRefSchema, S3FileRefSchema, InlineFileRefSchema, RuntimeFileRefSchema, FilePathDescriptorSchema, ResolvedProcessorFileSchema;
|
|
15271
|
-
var init_runtime_file_ref = __esm(() => {
|
|
15272
|
-
init_zod();
|
|
15273
|
-
DbFileRefSchema = object({
|
|
15274
|
-
kind: literal("file"),
|
|
15275
|
-
fileId: string2().describe("File ID from files table"),
|
|
15276
|
-
filename: string2().optional().describe("Original filename"),
|
|
15277
|
-
mimeType: string2().optional().describe("MIME type")
|
|
15278
|
-
});
|
|
15279
|
-
LegacyFileIdInputSchema = object({
|
|
15280
|
-
kind: never().optional(),
|
|
15281
|
-
fileId: string2().describe("File ID from files table"),
|
|
15282
|
-
filename: string2().optional().describe("Original filename"),
|
|
15283
|
-
mimeType: string2().optional().describe("MIME type")
|
|
15284
|
-
});
|
|
15285
|
-
LocalFileRefSchema = object({
|
|
15286
|
-
kind: literal("local"),
|
|
15287
|
-
path: string2().describe("Absolute path to a file on disk"),
|
|
15288
|
-
filename: string2().describe("Original filename"),
|
|
15289
|
-
mimeType: string2().describe("MIME type of the file")
|
|
15290
|
-
});
|
|
15291
|
-
S3FileRefSchema = object({
|
|
15292
|
-
kind: literal("s3"),
|
|
15293
|
-
ref: string2().describe("Storage key (suffix-only, prefix added by adapter)"),
|
|
15294
|
-
filename: string2().describe("Original filename"),
|
|
15295
|
-
mimeType: string2().describe("MIME type of the file")
|
|
15296
|
-
});
|
|
15297
|
-
InlineFileRefSchema = object({
|
|
15298
|
-
kind: literal("inline"),
|
|
15299
|
-
base64: string2().describe("Base64-encoded file bytes"),
|
|
15300
|
-
filename: string2().describe("Original filename"),
|
|
15301
|
-
mimeType: string2().describe("MIME type of the file")
|
|
15302
|
-
});
|
|
15303
|
-
RuntimeFileRefSchema = discriminatedUnion("kind", [
|
|
15304
|
-
DbFileRefSchema,
|
|
15305
|
-
LocalFileRefSchema,
|
|
15306
|
-
S3FileRefSchema,
|
|
15307
|
-
InlineFileRefSchema
|
|
15308
|
-
]);
|
|
15309
|
-
FilePathDescriptorSchema = discriminatedUnion("kind", [
|
|
15310
|
-
LocalFileRefSchema,
|
|
15311
|
-
S3FileRefSchema,
|
|
15312
|
-
InlineFileRefSchema
|
|
15313
|
-
]);
|
|
15314
|
-
ResolvedProcessorFileSchema = object({
|
|
15315
|
-
__eigenpalFile: literal(true),
|
|
15316
|
-
source: _enum(["db", "tenant-s3", "local", "inline"]),
|
|
15317
|
-
filename: string2().describe("Display filename for processor logs and parser routing"),
|
|
15318
|
-
mimeType: string2().describe("MIME type for processor routing"),
|
|
15319
|
-
fileId: string2().optional().describe("Legacy files-table id for db-backed handles"),
|
|
15320
|
-
ref: string2().optional().describe("Tenant-scoped storage key suffix for S3-backed handles"),
|
|
15321
|
-
path: string2().optional().describe("Local filesystem path for headless/CLI handles"),
|
|
15322
|
-
base64: string2().optional().describe("Base64 bytes for inline handles"),
|
|
15323
|
-
size: number2().int().nonnegative().optional().describe("Byte size when a file-producing step recorded it")
|
|
15324
|
-
}).strict();
|
|
15325
|
-
});
|
|
15326
|
-
|
|
15327
|
-
// ../types/src/parser/native-text-quality.ts
|
|
15328
|
-
var NativeTextQualityStatusSchema, NativeTextQualityReasonSchema, NativeTextQualityCountsSchema, NativeTextQualityProfileSchema, NativeTextQualitySchema;
|
|
15329
|
-
var init_native_text_quality = __esm(() => {
|
|
15330
|
-
init_zod();
|
|
15331
|
-
NativeTextQualityStatusSchema = _enum(["clean", "empty", "suspect"]);
|
|
15332
|
-
NativeTextQualityReasonSchema = _enum([
|
|
15333
|
-
"empty",
|
|
15334
|
-
"replacement-character",
|
|
15335
|
-
"lone-surrogate",
|
|
15336
|
-
"forbidden-control",
|
|
15337
|
-
"unassigned",
|
|
15338
|
-
"noncharacter",
|
|
15339
|
-
"private-use"
|
|
15340
|
-
]);
|
|
15341
|
-
NativeTextQualityCountsSchema = object({
|
|
15342
|
-
codePoints: number2().int().nonnegative(),
|
|
15343
|
-
nonWhitespace: number2().int().nonnegative(),
|
|
15344
|
-
replacement: number2().int().nonnegative(),
|
|
15345
|
-
loneSurrogate: number2().int().nonnegative(),
|
|
15346
|
-
forbiddenControl: number2().int().nonnegative(),
|
|
15347
|
-
unassigned: number2().int().nonnegative(),
|
|
15348
|
-
noncharacter: number2().int().nonnegative(),
|
|
15349
|
-
privateUse: number2().int().nonnegative()
|
|
15350
|
-
});
|
|
15351
|
-
NativeTextQualityProfileSchema = object({
|
|
15352
|
-
replacementRatio: number2().nonnegative(),
|
|
15353
|
-
loneSurrogateRatio: number2().nonnegative(),
|
|
15354
|
-
forbiddenControlRatio: number2().nonnegative(),
|
|
15355
|
-
unassignedRatio: number2().nonnegative(),
|
|
15356
|
-
noncharacterRatio: number2().nonnegative(),
|
|
15357
|
-
privateUseRatio: number2().nonnegative()
|
|
15358
|
-
});
|
|
15359
|
-
NativeTextQualitySchema = object({
|
|
15360
|
-
status: NativeTextQualityStatusSchema,
|
|
15361
|
-
reasons: array(NativeTextQualityReasonSchema),
|
|
15362
|
-
counts: NativeTextQualityCountsSchema,
|
|
15363
|
-
profile: NativeTextQualityProfileSchema
|
|
15364
|
-
});
|
|
15365
|
-
});
|
|
15366
|
-
|
|
15367
|
-
// ../types/src/parser/parser.ts
|
|
15368
|
-
function refineNativeParseModeConflicts(config, ctx) {
|
|
15369
|
-
if (config.parseMode === "native" && config.describeFigures === true) {
|
|
15370
|
-
ctx.addIssue({
|
|
15371
|
-
code: ZodIssueCode.custom,
|
|
15372
|
-
path: ["describeFigures"],
|
|
15373
|
-
message: 'parseMode "native" cannot be combined with describeFigures because figure captions require vision egress'
|
|
15374
|
-
});
|
|
15375
|
-
}
|
|
15376
|
-
}
|
|
15377
|
-
function isNativeLayoutCompatible(config) {
|
|
15378
|
-
return config.parseMode === "native" || config.parseMode === "native-or-ocr";
|
|
15379
|
-
}
|
|
15380
|
-
function refineLayoutOutputFormat(config, ctx) {
|
|
15381
|
-
if (config.outputFormat !== "layout")
|
|
15382
|
-
return;
|
|
15383
|
-
if (isNativeLayoutCompatible(config))
|
|
15384
|
-
return;
|
|
15385
|
-
ctx.addIssue({
|
|
15386
|
-
code: ZodIssueCode.custom,
|
|
15387
|
-
path: ["outputFormat"],
|
|
15388
|
-
message: LAYOUT_OUTPUT_PARSE_MODE_ERROR
|
|
15389
|
-
});
|
|
15390
|
-
}
|
|
15391
|
-
function mimeTypeForExtension(extension) {
|
|
15392
|
-
return EXTENSION_TO_MIME[extension.replace(/^\./, "").toLowerCase()];
|
|
15393
|
-
}
|
|
15394
|
-
var OFFICE_MIME_TYPES, ParserCategory, ParserTypeSchema, ParseModeSchema, PARSE_OUTPUT_FORMATS, ParseOutputFormatSchema, PageProvenanceSourceSchema, PageProvenanceSchema, ProcessingStrategySchema, LAYOUT_OUTPUT_PARSE_MODE_ERROR = 'outputFormat "layout" is native PDF-only. Set parseMode to "native" or "native-or-ocr". Omitted parseMode, OCR, vision, and nativeText: true cannot request layout.', PARSE_OUTPUT_FORMAT_DESCRIPTION = "Format for extracted text. `markdown` (default) keeps structure; `plain` is unstyled text; `djot`/`html` preserve more markup. `layout` is native-PDF spatial text with column gaps preserved as spaces. It requires `parseMode: native` or `parseMode: native-or-ocr` and a PDF — omitted parseMode and `nativeText: true` are not enough. Native mode is layout-only and fail-closed. `native-or-ocr` keeps layout text on accepted native pages and uses OCR markdown on suspect or empty pages, so the document can mix fixed-width layout and markdown. Extractor failure never falls back to another parser. Office, plaintext, and images fail. OCR/vision cannot request `layout`.", DocumentMetadataSchema, ParseUsageSchema, StructuredDocumentSchema, CoordinateUnitSchema, PointSchema, BoundingRegionSchema, PositionedTextSchema, TableCellSchema, ExtractedTableSchema, LayoutElementTypeSchema, LayoutElementSchema, PageResultSchema, ParseResultSchema, ParseOptionsSchema, ParserInputSchema, EXTENSION_TO_MIME, MIME_TO_EXTENSION;
|
|
15395
|
-
var init_parser = __esm(() => {
|
|
15396
|
-
init_zod();
|
|
15397
|
-
init_ai_client();
|
|
15398
|
-
init_native_text_quality();
|
|
15399
|
-
OFFICE_MIME_TYPES = [
|
|
15400
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
15401
|
-
"application/msword",
|
|
15402
|
-
"application/vnd.oasis.opendocument.text",
|
|
15403
|
-
"application/rtf",
|
|
15404
|
-
"text/rtf",
|
|
15405
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
15406
|
-
"application/vnd.ms-excel",
|
|
15407
|
-
"application/vnd.ms-excel.sheet.macroenabled.12",
|
|
15408
|
-
"application/vnd.ms-excel.sheet.binary.macroenabled.12",
|
|
15409
|
-
"application/vnd.oasis.opendocument.spreadsheet",
|
|
15410
|
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
15411
|
-
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
15412
|
-
"application/vnd.ms-powerpoint.presentation.macroenabled.12",
|
|
15413
|
-
"application/vnd.ms-powerpoint",
|
|
15414
|
-
"application/vnd.oasis.opendocument.presentation",
|
|
15415
|
-
"message/rfc822",
|
|
15416
|
-
"application/vnd.ms-outlook",
|
|
15417
|
-
"application/epub+zip"
|
|
15418
|
-
];
|
|
15419
|
-
ParserCategory = {
|
|
15420
|
-
PLAINTEXT: [
|
|
15421
|
-
"text/plain",
|
|
15422
|
-
"text/markdown",
|
|
15423
|
-
"text/csv",
|
|
15424
|
-
"text/tab-separated-values",
|
|
15425
|
-
"text/html",
|
|
15426
|
-
"text/xml",
|
|
15427
|
-
"application/json",
|
|
15428
|
-
"application/x-yaml",
|
|
15429
|
-
"application/toml",
|
|
15430
|
-
"image/svg+xml",
|
|
15431
|
-
"text/x-rst",
|
|
15432
|
-
"text/x-org",
|
|
15433
|
-
"application/x-latex",
|
|
15434
|
-
"application/x-ipynb+json",
|
|
15435
|
-
"application/x-bibtex",
|
|
15436
|
-
"application/docbook+xml",
|
|
15437
|
-
"application/x-fictionbook+xml"
|
|
15438
|
-
],
|
|
15439
|
-
OFFICE: [...OFFICE_MIME_TYPES],
|
|
15440
|
-
DOCUMENT: [
|
|
15441
|
-
"application/pdf",
|
|
15442
|
-
"image/png",
|
|
15443
|
-
"image/jpeg",
|
|
15444
|
-
"image/webp",
|
|
15445
|
-
"image/tiff",
|
|
15446
|
-
"image/gif",
|
|
15447
|
-
"image/bmp"
|
|
15448
|
-
]
|
|
15449
|
-
};
|
|
15450
|
-
ParserTypeSchema = _enum([
|
|
15451
|
-
"plaintext",
|
|
15452
|
-
"office",
|
|
15453
|
-
"llm-vision",
|
|
15454
|
-
"ocr"
|
|
15455
|
-
]);
|
|
15456
|
-
ParseModeSchema = _enum(["ocr", "vision", "native", "native-or-ocr"]);
|
|
15457
|
-
PARSE_OUTPUT_FORMATS = ["plain", "markdown", "djot", "html", "layout"];
|
|
15458
|
-
ParseOutputFormatSchema = _enum(PARSE_OUTPUT_FORMATS);
|
|
15459
|
-
PageProvenanceSourceSchema = _enum(["native", "ocr", "vision"]);
|
|
15460
|
-
PageProvenanceSchema = object({
|
|
15461
|
-
source: PageProvenanceSourceSchema
|
|
15462
|
-
});
|
|
15463
|
-
ProcessingStrategySchema = _enum(["native", "ocr", "vision", "hybrid"]);
|
|
15464
|
-
DocumentMetadataSchema = object({
|
|
15465
|
-
filename: string2(),
|
|
15466
|
-
mimeType: string2(),
|
|
15467
|
-
size: number2().describe("File size in bytes"),
|
|
15468
|
-
storageRef: string2().optional().describe("Storage reference for the original file")
|
|
15469
|
-
});
|
|
15470
|
-
ParseUsageSchema = object({
|
|
15471
|
-
pageCount: number2(),
|
|
15472
|
-
processingTimeMs: number2().optional(),
|
|
15473
|
-
ocrPagesProcessed: number2().int().nonnegative().optional(),
|
|
15474
|
-
cached: boolean2().optional()
|
|
15475
|
-
});
|
|
15476
|
-
StructuredDocumentSchema = record(string2(), unknown());
|
|
15477
|
-
CoordinateUnitSchema = _enum(["pixel", "inch", "point", "normalized"]);
|
|
15478
|
-
PointSchema = object({
|
|
15479
|
-
x: number2(),
|
|
15480
|
-
y: number2()
|
|
15481
|
-
});
|
|
15482
|
-
BoundingRegionSchema = object({
|
|
15483
|
-
polygon: array(PointSchema).min(3),
|
|
15484
|
-
unit: CoordinateUnitSchema,
|
|
15485
|
-
pageIndex: number2()
|
|
15486
|
-
});
|
|
15487
|
-
PositionedTextSchema = object({
|
|
15488
|
-
text: string2(),
|
|
15489
|
-
confidence: number2().min(0).max(1).optional(),
|
|
15490
|
-
boundingRegion: BoundingRegionSchema.optional()
|
|
15491
|
-
});
|
|
15492
|
-
TableCellSchema = object({
|
|
15493
|
-
content: string2(),
|
|
15494
|
-
rowIndex: number2(),
|
|
15495
|
-
columnIndex: number2(),
|
|
15496
|
-
rowSpan: number2().default(1),
|
|
15497
|
-
columnSpan: number2().default(1),
|
|
15498
|
-
boundingRegion: BoundingRegionSchema.optional()
|
|
15499
|
-
});
|
|
15500
|
-
ExtractedTableSchema = object({
|
|
15501
|
-
cells: array(TableCellSchema),
|
|
15502
|
-
rowCount: number2(),
|
|
15503
|
-
columnCount: number2(),
|
|
15504
|
-
boundingRegion: BoundingRegionSchema.optional()
|
|
15505
|
-
});
|
|
15506
|
-
LayoutElementTypeSchema = _enum([
|
|
15507
|
-
"paragraph",
|
|
15508
|
-
"title",
|
|
15509
|
-
"sectionHeading",
|
|
15510
|
-
"pageHeader",
|
|
15511
|
-
"pageFooter",
|
|
15512
|
-
"pageNumber",
|
|
15513
|
-
"footnote",
|
|
15514
|
-
"table",
|
|
15515
|
-
"figure",
|
|
15516
|
-
"formulaBlock"
|
|
15517
|
-
]);
|
|
15518
|
-
LayoutElementSchema = object({
|
|
15519
|
-
type: LayoutElementTypeSchema,
|
|
15520
|
-
content: string2(),
|
|
15521
|
-
table: ExtractedTableSchema.optional(),
|
|
15522
|
-
caption: string2().optional(),
|
|
15523
|
-
figureId: string2().optional(),
|
|
15524
|
-
boundingRegion: BoundingRegionSchema.optional()
|
|
15525
|
-
});
|
|
15526
|
-
PageResultSchema = object({
|
|
15527
|
-
pageIndex: number2().describe("0-based page index"),
|
|
15528
|
-
text: string2().describe("Extracted page text (markdown/HTML/plain, or spatial layout text)"),
|
|
15529
|
-
pageName: string2().optional().describe("Page/sheet name (e.g., Excel sheet name)"),
|
|
15530
|
-
layoutElements: array(LayoutElementSchema).optional().describe("Semantic layout elements in reading order"),
|
|
15531
|
-
words: array(PositionedTextSchema).optional().describe("Word-level positions"),
|
|
15532
|
-
lines: array(PositionedTextSchema).optional().describe("Line-level positions"),
|
|
15533
|
-
tables: array(ExtractedTableSchema).optional().describe("Extracted tables"),
|
|
15534
|
-
width: number2().optional().describe("Page width"),
|
|
15535
|
-
height: number2().optional().describe("Page height"),
|
|
15536
|
-
unit: CoordinateUnitSchema.optional().describe("Unit for width/height and bounding regions"),
|
|
15537
|
-
confidence: number2().min(0).max(1).optional().describe("Overall page confidence"),
|
|
15538
|
-
nativeTextQuality: NativeTextQualitySchema.optional().describe('Per-page diagnosis of native-extracted text. Reports objectively detectable anomalies (empty, U+FFFD, forbidden controls, unassigned/noncharacter code points, heavy private-use). Does not certify semantic correctness — valid-looking wrong mappings and literal "?" cannot be distinguished from legitimate text.'),
|
|
15539
|
-
provenance: PageProvenanceSchema.optional().describe("Which extractor produced the final text/layout on this page")
|
|
15540
|
-
});
|
|
15541
|
-
ParseResultSchema = object({
|
|
15542
|
-
document: DocumentMetadataSchema,
|
|
15543
|
-
usage: ParseUsageSchema,
|
|
15544
|
-
pages: array(PageResultSchema),
|
|
15545
|
-
text: string2().describe("Combined text from all pages"),
|
|
15546
|
-
parserType: ParserTypeSchema,
|
|
15547
|
-
parserVersion: string2().optional(),
|
|
15548
|
-
model: string2().optional().describe("Model used (for LLM/OCR parsers)"),
|
|
15549
|
-
processingStrategy: ProcessingStrategySchema.optional().describe("How this result was produced: `native` (local PDF text only), `ocr`, `vision`, or `hybrid` (native pages merged with OCR on fallback pages)."),
|
|
15550
|
-
structured: StructuredDocumentSchema.optional().describe("Canonical structured document with ordered blocks, regions, bounding boxes, tables, figures, and chunks when supported by the parser"),
|
|
15551
|
-
rawResponse: unknown().optional()
|
|
15552
|
-
});
|
|
15553
|
-
ParseOptionsSchema = object({
|
|
15554
|
-
outputFormat: ParseOutputFormatSchema.default("markdown"),
|
|
15555
|
-
ocrProvider: string2().optional().describe("OCR provider ID to use"),
|
|
15556
|
-
includeWordPositions: boolean2().default(false),
|
|
15557
|
-
includeLinePositions: boolean2().default(false),
|
|
15558
|
-
extractTables: boolean2().default(true),
|
|
15559
|
-
provider: string2().optional().describe("LLM provider ID to use"),
|
|
15560
|
-
model: string2().optional(),
|
|
15561
|
-
reasoningEffort: ReasoningEffortSchema.optional(),
|
|
15562
|
-
maxConcurrency: number2().min(1).max(30).default(3),
|
|
15563
|
-
pagesPerBatch: number2().min(1).max(20).default(5),
|
|
15564
|
-
pdfRenderScale: number2().min(1).max(4).default(1).describe("Scale factor used when rendering PDF pages for VLM parsing"),
|
|
15565
|
-
imageQuality: number2().int().min(1).max(100).default(85).describe("JPEG quality used for PDF page images sent to VLM parsing"),
|
|
15566
|
-
prompt: string2().optional().describe("Custom prompt for LLM-based parsing"),
|
|
15567
|
-
languages: array(string2()).optional().describe("OCR language hints"),
|
|
15568
|
-
pages: array(number2().int().min(1)).optional().describe("1-indexed pages to OCR; omit or empty to analyze the whole document"),
|
|
15569
|
-
tenantId: string2().optional()
|
|
15570
|
-
});
|
|
15571
|
-
ParserInputSchema = object({
|
|
15572
|
-
data: _instanceof(Buffer).or(_instanceof(Uint8Array)),
|
|
15573
|
-
filename: string2(),
|
|
15574
|
-
mimeType: string2(),
|
|
15575
|
-
options: ParseOptionsSchema.optional()
|
|
15576
|
-
});
|
|
15577
|
-
EXTENSION_TO_MIME = {
|
|
15578
|
-
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
15579
|
-
doc: "application/msword",
|
|
15580
|
-
odt: "application/vnd.oasis.opendocument.text",
|
|
15581
|
-
rtf: "application/rtf",
|
|
15582
|
-
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
15583
|
-
xls: "application/vnd.ms-excel",
|
|
15584
|
-
xlsm: "application/vnd.ms-excel.sheet.macroenabled.12",
|
|
15585
|
-
xlsb: "application/vnd.ms-excel.sheet.binary.macroenabled.12",
|
|
15586
|
-
ods: "application/vnd.oasis.opendocument.spreadsheet",
|
|
15587
|
-
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
15588
|
-
ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
15589
|
-
pptm: "application/vnd.ms-powerpoint.presentation.macroenabled.12",
|
|
15590
|
-
ppt: "application/vnd.ms-powerpoint",
|
|
15591
|
-
odp: "application/vnd.oasis.opendocument.presentation",
|
|
15592
|
-
eml: "message/rfc822",
|
|
15593
|
-
msg: "application/vnd.ms-outlook",
|
|
15594
|
-
epub: "application/epub+zip",
|
|
15595
|
-
pdf: "application/pdf",
|
|
15596
|
-
png: "image/png",
|
|
15597
|
-
jpg: "image/jpeg",
|
|
15598
|
-
jpeg: "image/jpeg",
|
|
15599
|
-
webp: "image/webp",
|
|
15600
|
-
tiff: "image/tiff",
|
|
15601
|
-
tif: "image/tiff",
|
|
15602
|
-
gif: "image/gif",
|
|
15603
|
-
bmp: "image/bmp",
|
|
15604
|
-
svg: "image/svg+xml",
|
|
15605
|
-
txt: "text/plain",
|
|
15606
|
-
md: "text/markdown",
|
|
15607
|
-
markdown: "text/markdown",
|
|
15608
|
-
csv: "text/csv",
|
|
15609
|
-
tsv: "text/tab-separated-values",
|
|
15610
|
-
html: "text/html",
|
|
15611
|
-
htm: "text/html",
|
|
15612
|
-
xml: "text/xml",
|
|
15613
|
-
json: "application/json",
|
|
15614
|
-
yaml: "application/x-yaml",
|
|
15615
|
-
yml: "application/x-yaml",
|
|
15616
|
-
toml: "application/toml",
|
|
15617
|
-
rst: "text/x-rst",
|
|
15618
|
-
org: "text/x-org",
|
|
15619
|
-
tex: "application/x-latex",
|
|
15620
|
-
latex: "application/x-latex",
|
|
15621
|
-
ipynb: "application/x-ipynb+json",
|
|
15622
|
-
bib: "application/x-bibtex",
|
|
15623
|
-
dbk: "application/docbook+xml",
|
|
15624
|
-
docbook: "application/docbook+xml",
|
|
15625
|
-
fb2: "application/x-fictionbook+xml",
|
|
15626
|
-
zip: "application/zip"
|
|
15627
|
-
};
|
|
15628
|
-
MIME_TO_EXTENSION = Object.entries(EXTENSION_TO_MIME).reduce((acc, [ext, mime]) => {
|
|
15629
|
-
if (!(mime in acc))
|
|
15630
|
-
acc[mime] = ext;
|
|
15631
|
-
return acc;
|
|
15632
|
-
}, {});
|
|
15633
|
-
});
|
|
15634
|
-
|
|
15635
|
-
// ../types/src/processor/configs/document-parser.ts
|
|
15636
|
-
var DocumentParserInputSchema, DocumentParserOutputSchema, DocumentParserConfigSchema;
|
|
15637
|
-
var init_document_parser = __esm(() => {
|
|
15638
|
-
init_zod();
|
|
15639
|
-
init_ai_client();
|
|
15640
|
-
init_runtime_file_ref();
|
|
15641
|
-
init_parser();
|
|
15642
|
-
DocumentParserInputSchema = ResolvedProcessorFileSchema;
|
|
15643
|
-
DocumentParserOutputSchema = ParseResultSchema;
|
|
15644
|
-
DocumentParserConfigSchema = object({
|
|
15645
|
-
parseMode: ParseModeSchema.optional().describe('Base parser for PDF/image inputs. OCR is the default. `native` extracts PDF text only (never OCR/vision). `native-or-ocr` requests OCR when pages have detectable native-text anomalies (empty, U+FFFD, lone surrogates, forbidden controls, unassigned/noncharacter, heavy PUA). Page selection, subset egress, and billing are provider-dependent. Valid-looking wrong text and literal "?" are not flagged.'),
|
|
15646
|
-
ocrModel: string2().optional().describe("OCR provider ID for PDF/image parsing"),
|
|
15647
|
-
llmModel: string2().optional().describe("LLM provider ID for vision-based parsing"),
|
|
15648
|
-
llmReasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for vision-based parsing. Omit to use the model default."),
|
|
15649
|
-
figureModel: string2().optional().describe("Vision model used only for the optional figure-description pass"),
|
|
15650
|
-
figureReasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for figure descriptions. Omit to use the model default."),
|
|
15651
|
-
maxConcurrency: number2().min(1).max(10).default(3).describe("Max concurrent VLM batch requests"),
|
|
15652
|
-
pagesPerBatch: number2().min(1).max(20).default(5).describe("Number of page images per VLM request"),
|
|
15653
|
-
pdfRenderScale: number2().min(1).max(4).default(1).optional().describe("Scale factor used when rendering PDF pages for VLM parsing"),
|
|
15654
|
-
imageQuality: number2().int().min(1).max(100).default(85).optional().describe("JPEG quality used for PDF page images sent to VLM parsing"),
|
|
15655
|
-
prompt: string2().optional().describe("Custom extraction prompt"),
|
|
15656
|
-
nativeText: boolean2().default(false).optional().describe("Use native text extraction for PDFs with embedded text (no OCR/VLM)"),
|
|
15657
|
-
describeFigures: boolean2().optional().describe("Opt-in (default off). After text extraction, detect figure pages with a layout model and caption them with a vision model, appending `<figure>description</figure>` to their text. Skipped for plaintext. The caption vision calls are billed."),
|
|
15658
|
-
figureInstructions: string2().optional().describe("Custom instruction for the figure-description pass."),
|
|
15659
|
-
languages: array(string2()).optional().describe('OCR language hints (e.g., ["en", "de"])'),
|
|
15660
|
-
outputFormat: ParseOutputFormatSchema.default("markdown").optional().describe(PARSE_OUTPUT_FORMAT_DESCRIPTION),
|
|
15661
|
-
cache: boolean2().default(false).optional().describe("When true, reuse a prior parse for identical file bytes and parse settings. Skips OCR/vision on cache hit. Stored in tenant blob storage with no automatic expiry (TTL/lifecycle is a follow-up). Default off.")
|
|
15662
|
-
}).superRefine(refineNativeParseModeConflicts).superRefine(refineLayoutOutputFormat).prefault({});
|
|
15663
|
-
});
|
|
15664
|
-
|
|
15665
15888
|
// ../types/src/processor/configs/extract.ts
|
|
15666
15889
|
var ExtractInputSchema, ExtractOutputSchema, ExtractConfigSchema;
|
|
15667
15890
|
var init_extract = __esm(() => {
|
|
@@ -16042,6 +16265,7 @@ var XLSX_TO_JSON_DEFAULT_LIMITS, A1_RANGE_RE, XlsxToJsonColumnSchema, XlsxToJson
|
|
|
16042
16265
|
var init_xlsx_to_json = __esm(() => {
|
|
16043
16266
|
init_zod();
|
|
16044
16267
|
init_runtime_file_ref();
|
|
16268
|
+
init_spreadsheet_evidence();
|
|
16045
16269
|
XLSX_TO_JSON_DEFAULT_LIMITS = {
|
|
16046
16270
|
maxInputBytes: 50 * 1024 * 1024,
|
|
16047
16271
|
maxRows: 1e5,
|
|
@@ -16080,6 +16304,8 @@ var init_xlsx_to_json = __esm(() => {
|
|
|
16080
16304
|
XlsxToJsonInputSchema = ResolvedProcessorFileSchema;
|
|
16081
16305
|
XlsxToJsonSheetMetaSchema = object({
|
|
16082
16306
|
name: string2().describe("Selected sheet name"),
|
|
16307
|
+
declaredRange: string2().optional().describe("Worksheet declared extent before empty trailing rows/columns were removed"),
|
|
16308
|
+
dateSystem: _enum(["1900", "1904"]).optional().describe("Workbook Excel date system"),
|
|
16083
16309
|
index: number2().int().min(0).describe("0-based sheet index in the workbook"),
|
|
16084
16310
|
range: string2().describe("Effective rectangular A1 range that was read"),
|
|
16085
16311
|
rowCount: number2().int().min(0).describe("Number of data rows returned in rows"),
|
|
@@ -16094,15 +16320,20 @@ var init_xlsx_to_json = __esm(() => {
|
|
|
16094
16320
|
column: number2().int().optional().describe("0-based worksheet column when applicable")
|
|
16095
16321
|
});
|
|
16096
16322
|
XlsxToJsonOutputSchema = object({
|
|
16323
|
+
cellMetadata: array(SpreadsheetCellEvidenceSchema.extend({
|
|
16324
|
+
key: string2(),
|
|
16325
|
+
outputRowIndex: number2().int().nonnegative()
|
|
16326
|
+
})).optional().describe("Evidence for nonblank projected data cells, linked to rows by outputRowIndex and key. Present when includeCellMetadata is true."),
|
|
16097
16327
|
rows: array(record(string2(), unknown())).describe("Array of row objects (first row = headers as keys unless headerRow is false)"),
|
|
16098
16328
|
fileId: string2().optional().describe("File ID of stored CSV when outputCsv is true"),
|
|
16099
|
-
sheet: XlsxToJsonSheetMetaSchema.optional().describe("Selected sheet metadata after projection. Present
|
|
16100
|
-
diagnostics: array(XlsxToJsonDiagnosticSchema).optional().describe("Non-fatal warnings collected while reading the sheet. Present
|
|
16329
|
+
sheet: XlsxToJsonSheetMetaSchema.optional().describe("Selected sheet metadata after projection. Present when includeMetadata or includeCellMetadata is true."),
|
|
16330
|
+
diagnostics: array(XlsxToJsonDiagnosticSchema).optional().describe("Non-fatal warnings collected while reading the sheet. Present when includeMetadata or includeCellMetadata is true. Warnings are still logged when metadata is omitted.")
|
|
16101
16331
|
});
|
|
16102
16332
|
XlsxToJsonConfigSchema = object({
|
|
16103
16333
|
sheet: union([number2().int().min(0), string2()]).optional().describe("Sheet to read: 0-based index or exact sheet name. Omit for the first sheet."),
|
|
16104
|
-
outputCsv: boolean2().default(false).optional().describe("If true, also write CSV to storage and include fileId. Zero-config uses the
|
|
16105
|
-
|
|
16334
|
+
outputCsv: boolean2().default(false).optional().describe("If true, also write CSV to storage and include fileId. Zero-config uses SheetJS CSV of the effective sheet extent, excluding empty trailing rows and columns. When columns, range, headerRow, valueMode, blankCells, or blankRows are set, CSV matches that projection."),
|
|
16335
|
+
includeCellMetadata: boolean2().default(false).optional().describe("Include original cell address, type, raw/displayed value, number format and date rendering. Also includes sheet metadata with the workbook date system. Does not classify identifiers or clean names."),
|
|
16336
|
+
includeMetadata: boolean2().default(false).optional().describe("If true, include sheet metadata and diagnostics in the step output. includeCellMetadata also enables these. Omit to keep output as rows (and fileId when outputCsv is true). Warnings are still logged when this is false."),
|
|
16106
16337
|
outputFilename: string2().optional().describe("Output CSV filename when outputCsv is true"),
|
|
16107
16338
|
headerRow: union([literal(false), number2().int().min(1)]).optional().describe("Header row: a positive 1-based Excel row, or false to keep the first effective row as data. Omit to use the first effective row as the header. When range is set and this is omitted, the first range row is the header."),
|
|
16108
16339
|
columns: array(XlsxToJsonColumnSchema).min(1).optional().superRefine(refineUniqueOutputKeys).describe("Ordered output columns. Each item needs a key and exactly one source: index (0-based absolute column) or header (exact displayed header text). Named header sources require a header row. Omit to keep every column in the effective range."),
|
|
@@ -16125,6 +16356,7 @@ var init_xlsx_to_json = __esm(() => {
|
|
|
16125
16356
|
var PROCESSOR_SCHEMAS;
|
|
16126
16357
|
var init_configs = __esm(() => {
|
|
16127
16358
|
init_ids();
|
|
16359
|
+
init_document_parser_v2();
|
|
16128
16360
|
init_classify();
|
|
16129
16361
|
init_classify_pages();
|
|
16130
16362
|
init_document_parser();
|
|
@@ -16139,6 +16371,7 @@ var init_configs = __esm(() => {
|
|
|
16139
16371
|
init_classify();
|
|
16140
16372
|
init_classify_pages();
|
|
16141
16373
|
init_document_parser();
|
|
16374
|
+
init_document_parser_v2();
|
|
16142
16375
|
init_extract();
|
|
16143
16376
|
init_json_to_xlsx();
|
|
16144
16377
|
init_merge();
|
|
@@ -16148,6 +16381,12 @@ var init_configs = __esm(() => {
|
|
|
16148
16381
|
init_template();
|
|
16149
16382
|
init_xlsx_to_json();
|
|
16150
16383
|
PROCESSOR_SCHEMAS = {
|
|
16384
|
+
[PROCESSOR_IDS.DOCUMENT_PARSER_V2]: {
|
|
16385
|
+
id: PROCESSOR_IDS.DOCUMENT_PARSER_V2,
|
|
16386
|
+
inputSchema: DocumentParserV2InputSchema,
|
|
16387
|
+
outputSchema: ParseV2ResultSchema,
|
|
16388
|
+
configSchema: DocumentParserV2ConfigSchema
|
|
16389
|
+
},
|
|
16151
16390
|
[PROCESSOR_IDS.EXTRACT]: {
|
|
16152
16391
|
id: PROCESSOR_IDS.EXTRACT,
|
|
16153
16392
|
inputSchema: ExtractInputSchema,
|
|
@@ -53803,7 +54042,7 @@ function describeUnsupportedType(nodeType) {
|
|
|
53803
54042
|
function compileTypedScript(opts) {
|
|
53804
54043
|
let ast;
|
|
53805
54044
|
try {
|
|
53806
|
-
ast =
|
|
54045
|
+
ast = import_parser5.parse(opts.source, {
|
|
53807
54046
|
sourceType: "script",
|
|
53808
54047
|
plugins: ["typescript"],
|
|
53809
54048
|
ranges: true
|
|
@@ -54056,9 +54295,9 @@ function stripCommentsAndStrings(s) {
|
|
|
54056
54295
|
out = out.replace(/`(\\.|[^`\\])*`/g, "``");
|
|
54057
54296
|
return out;
|
|
54058
54297
|
}
|
|
54059
|
-
var
|
|
54298
|
+
var import_parser5, import_sucrase, EVALUATOR_FN_NAME = "scoreScript", EVALUATOR_PARAM_NAMES, TRANSFORM_FN_NAME = "script";
|
|
54060
54299
|
var init_compile = __esm(() => {
|
|
54061
|
-
|
|
54300
|
+
import_parser5 = __toESM(require_lib(), 1);
|
|
54062
54301
|
import_sucrase = __toESM(require_dist3(), 1);
|
|
54063
54302
|
EVALUATOR_PARAM_NAMES = ["expected", "actual"];
|
|
54064
54303
|
});
|
|
@@ -54205,6 +54444,7 @@ var init_steps = __esm(() => {
|
|
|
54205
54444
|
init_retry();
|
|
54206
54445
|
AI_STEP_TYPES = [
|
|
54207
54446
|
"ai.parse",
|
|
54447
|
+
"ai.parse-v2",
|
|
54208
54448
|
"ai.extract",
|
|
54209
54449
|
"ai.split",
|
|
54210
54450
|
"ai.segment",
|
|
@@ -54379,6 +54619,7 @@ var init_step_configs = __esm(() => {
|
|
|
54379
54619
|
init_email_servers();
|
|
54380
54620
|
init_human_review();
|
|
54381
54621
|
init_parser();
|
|
54622
|
+
init_document_parser_v2();
|
|
54382
54623
|
init_json_to_xlsx();
|
|
54383
54624
|
init_xlsx_to_json();
|
|
54384
54625
|
init_typed_script();
|
|
@@ -55143,10 +55384,19 @@ var init_step_configs = __esm(() => {
|
|
|
55143
55384
|
});
|
|
55144
55385
|
ControlFailOutputSchema = never().describe("control.fail never produces output — it terminates the workflow when triggered.");
|
|
55145
55386
|
STEP_SCHEMAS = {
|
|
55387
|
+
"ai.parse-v2": {
|
|
55388
|
+
type: "ai.parse-v2",
|
|
55389
|
+
category: "ai",
|
|
55390
|
+
name: "Parse Document",
|
|
55391
|
+
description: "Automatically read native, scanned, and mixed documents with capability-aware OCR/vision fallback and explicit completeness.",
|
|
55392
|
+
configSchema: AiParseV2ConfigSchema,
|
|
55393
|
+
outputSchema: ParseV2ResultSchema,
|
|
55394
|
+
configInWith: true
|
|
55395
|
+
},
|
|
55146
55396
|
"ai.parse": {
|
|
55147
55397
|
type: "ai.parse",
|
|
55148
55398
|
category: "ai",
|
|
55149
|
-
name: "Parse Document",
|
|
55399
|
+
name: "Parse Document — legacy",
|
|
55150
55400
|
description: "Extract text from documents (PDF, DOCX, images) using native extraction, OCR, or vision models",
|
|
55151
55401
|
configSchema: AiParseConfigSchema,
|
|
55152
55402
|
outputSchema: AiParseOutputSchema,
|
|
@@ -56974,6 +57224,8 @@ var init_src = __esm(() => {
|
|
|
56974
57224
|
init_execution_row();
|
|
56975
57225
|
init_run_expand();
|
|
56976
57226
|
init_execution_tags();
|
|
57227
|
+
init_document_parser_v2();
|
|
57228
|
+
init_parse_v2_migration();
|
|
56977
57229
|
init_validation();
|
|
56978
57230
|
init_workflow2();
|
|
56979
57231
|
init_file_source();
|
|
@@ -56983,6 +57235,7 @@ var init_src = __esm(() => {
|
|
|
56983
57235
|
init_email_servers();
|
|
56984
57236
|
init_webhooks();
|
|
56985
57237
|
init_typed_script();
|
|
57238
|
+
init_spreadsheet_evidence();
|
|
56986
57239
|
});
|
|
56987
57240
|
|
|
56988
57241
|
// node_modules/yaml/dist/nodes/identity.js
|
|
@@ -207033,7 +207286,7 @@ import { fileURLToPath as fileURLToPath8 } from "url";
|
|
|
207033
207286
|
// package.json
|
|
207034
207287
|
var package_default = {
|
|
207035
207288
|
name: "@eigenpal/cli",
|
|
207036
|
-
version: "0.20.
|
|
207289
|
+
version: "0.20.28",
|
|
207037
207290
|
description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
|
|
207038
207291
|
keywords: [
|
|
207039
207292
|
"eigenpal",
|
|
@@ -243861,6 +244114,20 @@ var COLUMNS = [
|
|
|
243861
244114
|
];
|
|
243862
244115
|
function registerModelsCommands(program) {
|
|
243863
244116
|
const models = program.command("models").description("Inspect models and providers configured for the current tenant environment (text, vision, OCR).");
|
|
244117
|
+
addJsonFlag(withBaseUrl(models.command("parser-readiness").description("Inspect deployment-approved ai.parse-v2 defaults. Catalog state only; document smoke tests are required for live readiness."))).action(action(async (opts) => {
|
|
244118
|
+
const config = resolveConfig(opts);
|
|
244119
|
+
requireApiKey(config);
|
|
244120
|
+
const result = await new ApiClient(config).get("/api/v1/parsing/readiness");
|
|
244121
|
+
if (opts.json)
|
|
244122
|
+
console.log(JSON.stringify(result));
|
|
244123
|
+
else {
|
|
244124
|
+
console.log(`Image reading: ${result.imageReading}
|
|
244125
|
+
OCR: ${result.providers.ocr ?? "none"}
|
|
244126
|
+
Vision: ${result.providers.vision ?? "none"}`);
|
|
244127
|
+
for (const warning of result.warnings)
|
|
244128
|
+
console.error(warning);
|
|
244129
|
+
}
|
|
244130
|
+
}));
|
|
243864
244131
|
addJsonFlag(withBaseUrl(models.command("list").description("List configured text, vision, and OCR models. This is a catalog inventory from the server, not a live provider health probe. `health` is `configured` or `unconfigured` from local credentials. Pair with `--json` for scripting.").option("--capability <kind>", "Filter to `text`, `vision`, or `ocr` (matches the API `capability` query).").addHelpText("after", `
|
|
243865
244132
|
Health
|
|
243866
244133
|
configured Credentials for this model are present in the environment.
|
|
@@ -247115,6 +247382,36 @@ async function deleteWorkflowFolder(pathOrId, opts) {
|
|
|
247115
247382
|
success(`Deleted folder ${ui.bold(pathLabel)}`);
|
|
247116
247383
|
}
|
|
247117
247384
|
|
|
247385
|
+
// src/commands/workflow/migrate-parser.ts
|
|
247386
|
+
init_src();
|
|
247387
|
+
import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
|
|
247388
|
+
import { resolve as resolve9 } from "node:path";
|
|
247389
|
+
function registerParserMigrationCommand(workflow) {
|
|
247390
|
+
workflow.command("migrate-parser <file>").description("Write a reviewable ai.parse-v2 workflow migration to a new file. Never pushes or changes the source.").requiredOption("--policy <policy>", "preserve backend restrictions, or auto to adopt automatic native/OCR/vision parsing").requiredOption("--out <file>", "New YAML output file (must not already exist)").option("--json", "Emit migration summary as JSON").action(action(async (file, options) => {
|
|
247391
|
+
if (options.policy !== "preserve" && options.policy !== "auto")
|
|
247392
|
+
throw new Error("--policy must be preserve or auto");
|
|
247393
|
+
if (resolve9(file) === resolve9(options.out))
|
|
247394
|
+
throw new Error("Migration output must differ from the source");
|
|
247395
|
+
const source = $parse(await readFile4(file, "utf8"));
|
|
247396
|
+
if (!source || typeof source !== "object" || Array.isArray(source))
|
|
247397
|
+
throw new Error("Expected a workflow YAML object");
|
|
247398
|
+
const migration = migrateWorkflowParsers(source, options.policy);
|
|
247399
|
+
await writeFile3(options.out, $stringify(migration.definition), { flag: "wx" });
|
|
247400
|
+
const summary = {
|
|
247401
|
+
out: resolve9(options.out),
|
|
247402
|
+
migratedSteps: migration.migratedSteps,
|
|
247403
|
+
warnings: migration.warnings
|
|
247404
|
+
};
|
|
247405
|
+
if (options.json)
|
|
247406
|
+
console.log(JSON.stringify(summary));
|
|
247407
|
+
else {
|
|
247408
|
+
console.log(`Wrote ${summary.out}; migrated ${summary.migratedSteps.length} parser step(s). Review and test before publishing.`);
|
|
247409
|
+
for (const warning of summary.warnings)
|
|
247410
|
+
console.error(warning);
|
|
247411
|
+
}
|
|
247412
|
+
}));
|
|
247413
|
+
}
|
|
247414
|
+
|
|
247118
247415
|
// src/commands/workflow/step-exec.ts
|
|
247119
247416
|
init_src();
|
|
247120
247417
|
var UNSUPPORTED_TYPE_EXIT = 2;
|
|
@@ -247144,7 +247441,7 @@ function registerStepExecCommands(workflow) {
|
|
|
247144
247441
|
// src/commands/workflow/templates.ts
|
|
247145
247442
|
init_src();
|
|
247146
247443
|
import { existsSync as existsSync20, promises as fs20 } from "node:fs";
|
|
247147
|
-
import { basename as basename4, resolve as
|
|
247444
|
+
import { basename as basename4, resolve as resolve10 } from "node:path";
|
|
247148
247445
|
function buildClient5(opts) {
|
|
247149
247446
|
const config = resolveConfig(opts);
|
|
247150
247447
|
requireApiKey(config);
|
|
@@ -247156,11 +247453,11 @@ function printJson5(value) {
|
|
|
247156
247453
|
async function readJsonFixtureFile(fixturePath) {
|
|
247157
247454
|
let raw;
|
|
247158
247455
|
try {
|
|
247159
|
-
raw = await fs20.readFile(
|
|
247456
|
+
raw = await fs20.readFile(resolve10(fixturePath), "utf8");
|
|
247160
247457
|
} catch (err) {
|
|
247161
247458
|
const code = err && typeof err === "object" && "code" in err ? String(err.code) : "";
|
|
247162
247459
|
if (code === "ENOENT") {
|
|
247163
|
-
throw new Error(`JSON fixture file not found: ${
|
|
247460
|
+
throw new Error(`JSON fixture file not found: ${resolve10(fixturePath)}`);
|
|
247164
247461
|
}
|
|
247165
247462
|
throw err;
|
|
247166
247463
|
}
|
|
@@ -247207,7 +247504,7 @@ function registerTemplateCommands(parent) {
|
|
|
247207
247504
|
const templates = parent.command("templates").description("Manage workspace DOCX/XLSX templates (tmpl_…): upload, list, inspect, download, replace, delete, and smoke-fill.").addHelpText("after", TEMPLATES_EXAMPLES);
|
|
247208
247505
|
const uploadCmd = templates.command("upload <file>").description("Upload a DOCX or XLSX file as a new tmpl_… resource with an immutable tmpr_… revision.").option("--name <name>", "Display name (defaults to the filename without extension)").option("--description <text>", "Optional description");
|
|
247209
247506
|
addJsonFlag(withBaseUrl(uploadCmd)).action(action(async (file, opts) => {
|
|
247210
|
-
const filePath =
|
|
247507
|
+
const filePath = resolve10(file);
|
|
247211
247508
|
const bytes = await fs20.readFile(filePath);
|
|
247212
247509
|
const client = buildClient5(opts);
|
|
247213
247510
|
const template = await uploadWorkspaceTemplate(client, {
|
|
@@ -247272,7 +247569,7 @@ function registerTemplateCommands(parent) {
|
|
|
247272
247569
|
}));
|
|
247273
247570
|
const replaceCmd = templates.command("replace <template-id> <file>").description("Append an immutable revision and advance the tmpl_… pointer.");
|
|
247274
247571
|
addJsonFlag(withBaseUrl(replaceCmd)).action(action(async (templateId, file, opts) => {
|
|
247275
|
-
const filePath =
|
|
247572
|
+
const filePath = resolve10(file);
|
|
247276
247573
|
const bytes = await fs20.readFile(filePath);
|
|
247277
247574
|
const client = buildClient5(opts);
|
|
247278
247575
|
const current = await getPublicTemplate(client, templateId);
|
|
@@ -247323,7 +247620,7 @@ function registerTemplateCommands(parent) {
|
|
|
247323
247620
|
bytes = downloaded.bytes;
|
|
247324
247621
|
filename = downloaded.filename;
|
|
247325
247622
|
} else {
|
|
247326
|
-
const filePath =
|
|
247623
|
+
const filePath = resolve10(templateArg);
|
|
247327
247624
|
if (!existsSync20(filePath)) {
|
|
247328
247625
|
throw new Error(`Template file not found: ${filePath}. Pass a local .docx/.xlsx path or a tmpl_… id.`);
|
|
247329
247626
|
}
|
|
@@ -247367,7 +247664,7 @@ function registerTemplateCommands(parent) {
|
|
|
247367
247664
|
// src/commands/workflow/validation.ts
|
|
247368
247665
|
init_src();
|
|
247369
247666
|
import { existsSync as existsSync22, readdirSync as readdirSync7, readFileSync as readFileSync19, statSync as statSync7 } from "fs";
|
|
247370
|
-
import { join as join13, resolve as
|
|
247667
|
+
import { join as join13, resolve as resolve11 } from "path";
|
|
247371
247668
|
|
|
247372
247669
|
// src/lib/template-diagnostics.ts
|
|
247373
247670
|
init_src();
|
|
@@ -247984,7 +248281,7 @@ function parseDatasetFileRef(path, root) {
|
|
|
247984
248281
|
return parts.join("/");
|
|
247985
248282
|
}
|
|
247986
248283
|
function rootDir(opts) {
|
|
247987
|
-
return
|
|
248284
|
+
return resolve11(opts.dir ?? process.cwd());
|
|
247988
248285
|
}
|
|
247989
248286
|
async function onlineInvokeIssues(yamlText, opts) {
|
|
247990
248287
|
const config = resolveConfig(opts);
|
|
@@ -247994,7 +248291,7 @@ async function onlineInvokeIssues(yamlText, opts) {
|
|
|
247994
248291
|
return res.issues ?? [];
|
|
247995
248292
|
}
|
|
247996
248293
|
function discoverWorkflowProjectRoots(rootPath) {
|
|
247997
|
-
const root =
|
|
248294
|
+
const root = resolve11(rootPath);
|
|
247998
248295
|
if (existsSync22(join13(root, "workflow.yaml")))
|
|
247999
248296
|
return [root];
|
|
248000
248297
|
const candidates = [
|
|
@@ -248041,8 +248338,8 @@ Note
|
|
|
248041
248338
|
` + ` project unless you pass --allow-external-templates.
|
|
248042
248339
|
`);
|
|
248043
248340
|
withBaseUrl(cmd).action(action(async (path, opts) => {
|
|
248044
|
-
if (path && (!existsSync22(
|
|
248045
|
-
const target =
|
|
248341
|
+
if (path && (!existsSync22(resolve11(path)) || !statSync7(resolve11(path)).isDirectory())) {
|
|
248342
|
+
const target = resolve11(path);
|
|
248046
248343
|
const wfResult = validateWorkflowYaml(target);
|
|
248047
248344
|
const wfOk = printIssues("workflow.yaml", target, wfResult.issues);
|
|
248048
248345
|
if (wfOk) {
|
|
@@ -248058,7 +248355,7 @@ Note
|
|
|
248058
248355
|
process.exit(1);
|
|
248059
248356
|
return;
|
|
248060
248357
|
}
|
|
248061
|
-
const requestedRoot = path ?
|
|
248358
|
+
const requestedRoot = path ? resolve11(path) : rootDir(opts);
|
|
248062
248359
|
const projects = discoverWorkflowProjectRoots(requestedRoot);
|
|
248063
248360
|
if (projects.length === 0) {
|
|
248064
248361
|
if (!await validateProjectRoot(requestedRoot, opts))
|
|
@@ -248080,14 +248377,14 @@ Note
|
|
|
248080
248377
|
}
|
|
248081
248378
|
function registerEvaluatorsValidateCommand(parent) {
|
|
248082
248379
|
parent.command("validate [path]").description("Validate an evaluators YAML file against the EvalConfig schema. Defaults to ./evaluators.yaml.").action((path) => {
|
|
248083
|
-
const target =
|
|
248380
|
+
const target = resolve11(path ?? "evaluators.yaml");
|
|
248084
248381
|
if (!printIssues("evaluators", target, validateEvaluatorsYaml(target)))
|
|
248085
248382
|
process.exit(1);
|
|
248086
248383
|
});
|
|
248087
248384
|
}
|
|
248088
248385
|
function registerDatasetValidateCommand(parent) {
|
|
248089
248386
|
parent.command("validate [path]").description("Validate a dataset folder against the examples/<name>/{input,expected,meta} convention. Defaults to ./dataset/.").action((path) => {
|
|
248090
|
-
const target =
|
|
248387
|
+
const target = resolve11(path ?? "dataset");
|
|
248091
248388
|
if (!printIssues("dataset", target, validateDatasetFolder(target)))
|
|
248092
248389
|
process.exit(1);
|
|
248093
248390
|
});
|
|
@@ -248201,6 +248498,7 @@ YAML's \`name:\` field). Both:
|
|
|
248201
248498
|
$ eigenpal workflow pull my-extraction
|
|
248202
248499
|
`);
|
|
248203
248500
|
registerWorkflowCoreCommands(workflow);
|
|
248501
|
+
registerParserMigrationCommand(workflow);
|
|
248204
248502
|
registerWorkflowFolderCommands(workflow);
|
|
248205
248503
|
registerEvaluatorsCommands(workflow);
|
|
248206
248504
|
registerDatasetCommands2(workflow);
|