@eigenpal/cli 0.17.4 → 0.18.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eigenpal/cli
2
2
 
3
+ ## 0.17.5
4
+
5
+ ### Patch Changes
6
+
7
+ - e3c0246: CLI skill reference documents the new `ai.figure-crops` workflow step for cropping and captioning figures from parsed PDFs.
8
+
3
9
  ## 0.16.12
4
10
 
5
11
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -7800,8 +7800,10 @@ var init_ids = __esm(() => {
7800
7800
  CLASSIFY_PAGES: "builtin/classify-pages",
7801
7801
  VISION: "builtin/vision",
7802
7802
  SEARCH_FILES: "builtin/search-files",
7803
+ FIGURE_CROPS: "builtin/figure-crops",
7803
7804
  TEMPLATE: "builtin/template",
7804
7805
  PDF_EMBEDDER: "builtin/pdf-embedder",
7806
+ CROP_REGIONS: "builtin/crop-regions",
7805
7807
  XLSX_TO_JSON: "builtin/xlsx-to-json",
7806
7808
  JSON_TO_XLSX: "builtin/json-to-xlsx",
7807
7809
  ARCHIVE_LIST: "builtin/archive-list",
@@ -8163,7 +8165,8 @@ var init_parser = __esm(() => {
8163
8165
  ParseUsageSchema = object({
8164
8166
  pageCount: number2(),
8165
8167
  processingTimeMs: number2().optional(),
8166
- ocrPagesProcessed: number2().int().nonnegative().optional()
8168
+ ocrPagesProcessed: number2().int().nonnegative().optional(),
8169
+ cached: boolean2().optional()
8167
8170
  });
8168
8171
  StructuredDocumentSchema = record(string2(), unknown());
8169
8172
  CoordinateUnitSchema = _enum(["pixel", "inch", "point", "normalized"]);
@@ -8349,7 +8352,8 @@ var init_document_parser = __esm(() => {
8349
8352
  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."),
8350
8353
  figureInstructions: string2().optional().describe("Custom instruction for the figure-description pass."),
8351
8354
  languages: array(string2()).optional().describe('OCR language hints (e.g., ["en", "de"])'),
8352
- outputFormat: ParseOutputFormatSchema.default("markdown").optional().describe(PARSE_OUTPUT_FORMAT_DESCRIPTION)
8355
+ outputFormat: ParseOutputFormatSchema.default("markdown").optional().describe(PARSE_OUTPUT_FORMAT_DESCRIPTION),
8356
+ 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.")
8353
8357
  }).superRefine(refineNativeParseModeConflicts).superRefine(refineLayoutOutputFormat).prefault({});
8354
8358
  });
8355
8359
 
@@ -53679,7 +53683,8 @@ var init_steps = __esm(() => {
53679
53683
  "ai.classify",
53680
53684
  "ai.classify-pages",
53681
53685
  "ai.vision",
53682
- "ai.search-files"
53686
+ "ai.search-files",
53687
+ "ai.figure-crops"
53683
53688
  ];
53684
53689
  TRANSFORM_STEP_TYPES = [
53685
53690
  "transform.set",
@@ -53689,6 +53694,7 @@ var init_steps = __esm(() => {
53689
53694
  "transform.merge",
53690
53695
  "transform.template",
53691
53696
  "transform.pdf-embed",
53697
+ "transform.crop-regions",
53692
53698
  "transform.xlsx-to-json",
53693
53699
  "transform.json-to-xlsx",
53694
53700
  "transform.script",
@@ -53837,7 +53843,7 @@ function getStepSchema(stepType) {
53837
53843
  function listStepTypes() {
53838
53844
  return [...STEP_TYPES];
53839
53845
  }
53840
- var OptionalReasoningEffortSchema, AiParseConfigSchema, AiParseOutputSchema, AiExtractConfigSchema, AiExtractOutputSchema, VisionPageRangeSchema, AiVisionConfigSchema, AiVisionOutputSchema, AI_SEARCH_FILES_DEFAULT_MAX_ITERATIONS = 12, AI_SEARCH_FILES_MAX_ITERATIONS = 50, AI_SEARCH_FILES_DEFAULT_MAX_FILES = 50, AI_SEARCH_FILES_MAX_FILES = 200, AI_SEARCH_FILES_MAX_CITATION_EXCERPT_CHARS = 2000, AiSearchFilesConfigSchema, AiSearchFilesCitationSchema, AiSearchFilesOutputSchema, AiSplitConfigSchema, AiSplitSectionSchema, AiSplitOutputSchema, AiSegmentConfigSchema, AiSegmentOutputSchema, AiClassifyConfigSchema, AiClassifyOutputSchema, ClassifyPagesLabelSchema2, AiClassifyPagesConfigSchema, AiClassifyPagesOutputSchema, TransformSetConfigSchema, TransformSetOutputSchema, TransformRemoveConfigSchema, TransformRemoveOutputSchema, TransformCombineConfigSchema, TransformCombineOutputSchema, TransformSplitConfigSchema, TransformSplitOutputSchema, TransformMergeConfigSchema, TransformMergeOutputSchema, TransformTemplateConfigSchema, TransformTemplateOutputSchema, TransformPdfEmbedConfigSchema, TransformPdfEmbedOutputSchema, TransformXlsxToJsonConfigSchema, TransformXlsxToJsonOutputSchema, JsonToXlsxAuthoringRowsSchema, JsonToXlsxSheetConfigSchema, TransformJsonToXlsxConfigSchema, TransformJsonToXlsxOutputSchema, ARCHIVE_LIST_MAX_ENTRIES = 1e4, TransformArchiveListConfigSchema, TransformArchiveListEntrySchema, TransformArchiveListOutputSchema, TransformArchiveExtractConfigSchema, TransformArchiveExtractOutputSchema, TransformScriptConfigSchema, TransformScriptOutputSchema, ParsedDocPageSchema, TransformTextChunkerConfigSchema, TransformTextChunkerOutputSchema, RegexNormalizerSchema, RegexFormatSchema, REGEX_FLAGS, RegexFieldSchema, TransformRegexExtractConfigSchema, TransformRegexExtractOutputSchema, ActionHttpConfigSchema, ActionHttpOutputSchema, ActionInvokeWorkflowConfigSchema, ActionInvokeWorkflowOutputSchema, ActionWebsiteReaderConfigSchema, ActionWebsiteReaderOutputSchema, ACTION_EMAIL_MAX_ATTACHMENTS = 10, ACTION_EMAIL_MAX_ATTACHMENT_BYTES, ACTION_EMAIL_BODY_MAX_BYTES, emailBodyMaxBytes = (value) => new TextEncoder().encode(value).byteLength <= ACTION_EMAIL_BODY_MAX_BYTES, ActionEmailRecipientListSchema, ActionEmailToSchema, ActionEmailOptionalRecipientsSchema, ActionEmailAttachmentSchema, ActionEmailConfigSchema, ActionEmailOutputSchema, ControlIfConfigSchema, ControlIfOutputSchema, ControlSwitchConfigSchema, ControlSwitchOutputSchema, ControlForeachConfigSchema, ControlForeachOutputSchema, ControlParallelMapConfigSchema, ControlParallelMapOutputSchema, ControlParallelConfigSchema, ControlParallelOutputSchema, ControlWaitConfigSchema, ControlWaitOutputSchema, ControlHumanReviewConfigSchema, ControlHumanReviewOutputSchema, ControlFailConfigSchema, ControlFailOutputSchema, STEP_SCHEMAS;
53846
+ var OptionalReasoningEffortSchema, AiParseConfigSchema, AiParseOutputSchema, AiFigureCropsConfigSchema, AiFigureCropsFigureSchema, AiFigureCropsOutputSchema, AiExtractConfigSchema, AiExtractOutputSchema, VisionPageRangeSchema, AiVisionConfigSchema, AiVisionOutputSchema, AI_SEARCH_FILES_DEFAULT_MAX_ITERATIONS = 12, AI_SEARCH_FILES_MAX_ITERATIONS = 50, AI_SEARCH_FILES_DEFAULT_MAX_FILES = 50, AI_SEARCH_FILES_MAX_FILES = 200, AI_SEARCH_FILES_MAX_CITATION_EXCERPT_CHARS = 2000, AiSearchFilesConfigSchema, AiSearchFilesCitationSchema, AiSearchFilesOutputSchema, AiSplitConfigSchema, AiSplitSectionSchema, AiSplitOutputSchema, AiSegmentConfigSchema, AiSegmentOutputSchema, AiClassifyConfigSchema, AiClassifyOutputSchema, ClassifyPagesLabelSchema2, AiClassifyPagesConfigSchema, AiClassifyPagesOutputSchema, TransformSetConfigSchema, TransformSetOutputSchema, TransformRemoveConfigSchema, TransformRemoveOutputSchema, TransformCombineConfigSchema, TransformCombineOutputSchema, TransformSplitConfigSchema, TransformSplitOutputSchema, TransformMergeConfigSchema, TransformMergeOutputSchema, TransformTemplateConfigSchema, TransformTemplateOutputSchema, TransformPdfEmbedConfigSchema, TransformPdfEmbedOutputSchema, CropRegionBboxSchema, CropRegionSpecSchema, CropRegionSpecListSchema, CropRegionSpecListResolvedSchema, TransformCropRegionsConfigSchema, TransformCropRegionsCropSchema, TransformCropRegionsOutputSchema, CropRegionsProcessorConfigSchema, TransformXlsxToJsonConfigSchema, TransformXlsxToJsonOutputSchema, JsonToXlsxAuthoringRowsSchema, JsonToXlsxSheetConfigSchema, TransformJsonToXlsxConfigSchema, TransformJsonToXlsxOutputSchema, ARCHIVE_LIST_MAX_ENTRIES = 1e4, TransformArchiveListConfigSchema, TransformArchiveListEntrySchema, TransformArchiveListOutputSchema, TransformArchiveExtractConfigSchema, TransformArchiveExtractOutputSchema, TransformScriptConfigSchema, TransformScriptOutputSchema, ParsedDocPageSchema, TransformTextChunkerConfigSchema, TransformTextChunkerOutputSchema, RegexNormalizerSchema, RegexFormatSchema, REGEX_FLAGS, RegexFieldSchema, TransformRegexExtractConfigSchema, TransformRegexExtractOutputSchema, ActionHttpConfigSchema, ActionHttpOutputSchema, ActionInvokeWorkflowConfigSchema, ActionInvokeWorkflowOutputSchema, ActionWebsiteReaderConfigSchema, ActionWebsiteReaderOutputSchema, ACTION_EMAIL_MAX_ATTACHMENTS = 10, ACTION_EMAIL_MAX_ATTACHMENT_BYTES, ACTION_EMAIL_BODY_MAX_BYTES, emailBodyMaxBytes = (value) => new TextEncoder().encode(value).byteLength <= ACTION_EMAIL_BODY_MAX_BYTES, ActionEmailRecipientListSchema, ActionEmailToSchema, ActionEmailOptionalRecipientsSchema, ActionEmailAttachmentSchema, ActionEmailConfigSchema, ActionEmailOutputSchema, ControlIfConfigSchema, ControlIfOutputSchema, ControlSwitchConfigSchema, ControlSwitchOutputSchema, ControlForeachConfigSchema, ControlForeachOutputSchema, ControlParallelMapConfigSchema, ControlParallelMapOutputSchema, ControlParallelConfigSchema, ControlParallelOutputSchema, ControlWaitConfigSchema, ControlWaitOutputSchema, ControlHumanReviewConfigSchema, ControlHumanReviewOutputSchema, ControlFailConfigSchema, ControlFailOutputSchema, STEP_SCHEMAS;
53841
53847
  var init_step_configs = __esm(() => {
53842
53848
  init_zod();
53843
53849
  init_ai_client();
@@ -53868,9 +53874,38 @@ var init_step_configs = __esm(() => {
53868
53874
  outputFormat: ParseOutputFormatSchema.default("markdown").optional().describe(PARSE_OUTPUT_FORMAT_DESCRIPTION),
53869
53875
  nativeText: boolean2().default(false).optional().describe("Extract native/embedded text from PDFs without OCR/VLM. Faster and uses no credits. Falls back to OCR/VLM if the PDF has no embedded text."),
53870
53876
  describeFigures: boolean2().optional().describe("Opt-in (default off). After text extraction, detect which pages contain figures with an in-worker layout model, then caption those pages with a vision model and append `<figure>description</figure>` to their text — so image-only pages (property photos, signatures, charts) become findable by text-based steps like ai.split. Note: the layout scan runs over all pages, and the caption step and its vision calls are billed. Skipped for plaintext."),
53871
- figureInstructions: string2().optional().describe('Custom instruction for the figure-description pass, e.g. "Describe each figure; label a handwritten signature as `<figure>signature</figure>` and a stamp as `<figure>stamp</figure>`; for property photos note the room or exterior shown." Applied only when describeFigures runs.')
53877
+ figureInstructions: string2().optional().describe('Custom instruction for the figure-description pass, e.g. "Describe each figure; label a handwritten signature as `<figure>signature</figure>` and a stamp as `<figure>stamp</figure>`; for property photos note the room or exterior shown." Applied only when describeFigures runs.'),
53878
+ 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.")
53872
53879
  }).superRefine(refineNativeParseModeConflicts).superRefine(refineLayoutOutputFormat);
53873
53880
  AiParseOutputSchema = ParseResultSchema.omit({ rawResponse: true });
53881
+ AiFigureCropsConfigSchema = object({
53882
+ input: string2().describe("Storage reference or template expression for the source PDF"),
53883
+ parseOutput: unknown().describe("ai.parse output object (template {{steps.<parse>.output}}); figure elements are read from its `elements` array"),
53884
+ model: string2().optional().describe("Vision model for captions (defaults to workspace model)"),
53885
+ figureInstructions: string2().optional().describe("Custom caption instruction; applied per figure crop"),
53886
+ maxFigures: number2().int().min(1).max(100).default(40).optional().describe("Cap on figures processed per document"),
53887
+ minAreaFrac: number2().min(0).max(1).default(0).optional().describe("Skip figures below this page-area fraction (logos/decorations)"),
53888
+ includeCrops: boolean2().default(false).optional().describe("Include base64 JPEG crops in output (heavy; default off — captions + bboxes only)"),
53889
+ renderScale: number2().min(1).max(4).default(1).optional().describe("Scale factor for rendering PDF pages before cropping"),
53890
+ imageQuality: number2().int().min(1).max(100).default(85).optional().describe("JPEG quality for crops"),
53891
+ llmReasoningEffort: OptionalReasoningEffortSchema
53892
+ });
53893
+ AiFigureCropsFigureSchema = object({
53894
+ id: string2(),
53895
+ page: number2(),
53896
+ bboxNorm: tuple([number2(), number2(), number2(), number2()]).nullable(),
53897
+ areaFrac: number2(),
53898
+ caption: string2().nullable(),
53899
+ cropJpegBase64: string2().optional()
53900
+ });
53901
+ AiFigureCropsOutputSchema = object({
53902
+ figures: array(AiFigureCropsFigureSchema),
53903
+ _figureCrops: object({
53904
+ pages: array(number2()),
53905
+ model: string2().optional(),
53906
+ skippedSmall: number2()
53907
+ })
53908
+ });
53874
53909
  AiExtractConfigSchema = object({
53875
53910
  input: string2().describe("Text content or template expression"),
53876
53911
  schema: object({
@@ -54190,6 +54225,55 @@ var init_step_configs = __esm(() => {
54190
54225
  wordCount: number2().describe("Number of words embedded"),
54191
54226
  text: string2().describe("Extracted text from the document")
54192
54227
  });
54228
+ CropRegionBboxSchema = tuple([
54229
+ number2().min(0).max(1),
54230
+ number2().min(0).max(1),
54231
+ number2().min(0).max(1),
54232
+ number2().min(0).max(1)
54233
+ ]);
54234
+ CropRegionSpecSchema = object({
54235
+ id: string2().optional().describe("Stable region id used in output and crop filenames (defaults to region-N)"),
54236
+ pageIndex: number2().int().min(0).default(0).optional().describe("0-based page index to crop from (images use page 0)"),
54237
+ bbox: CropRegionBboxSchema.describe("Normalized axis-aligned bbox [x0, y0, x1, y1]")
54238
+ });
54239
+ CropRegionSpecListSchema = array(CropRegionSpecSchema).min(1).describe("Regions to crop from the rendered document");
54240
+ CropRegionSpecListResolvedSchema = array(CropRegionSpecSchema).describe("Regions to crop from the rendered document (may be empty)");
54241
+ TransformCropRegionsConfigSchema = object({
54242
+ input: string2().describe("File input — template expression e.g. {{ input.document }} resolving to a PDF or image"),
54243
+ regions: union([
54244
+ string2().min(1).describe("Template expression resolving to a region array, e.g. {{ steps.list-figures.output.regions }}"),
54245
+ CropRegionSpecListSchema
54246
+ ]).describe("Regions to crop — pageIndex + normalized bbox per entry"),
54247
+ renderScale: number2().min(0.5).max(4).default(1).optional().describe("Scale factor when rasterizing PDF pages before cropping"),
54248
+ imageQuality: number2().int().min(1).max(100).default(85).optional().describe("JPEG quality for cropped outputs"),
54249
+ paddingFrac: number2().min(0).max(0.2).default(0.02).optional().describe("Padding around each bbox as a fraction of the shorter page edge"),
54250
+ minCropPx: number2().int().min(1).default(8).optional().describe("Minimum crop width/height in pixels; smaller crops fall back to the full page"),
54251
+ maxRegions: number2().int().min(1).max(200).default(100).optional().describe("Maximum regions processed per invocation")
54252
+ });
54253
+ TransformCropRegionsCropSchema = object({
54254
+ id: string2().describe("Region id (from input or auto-generated)"),
54255
+ pageIndex: number2().int().min(0).describe("0-based page index the crop was taken from"),
54256
+ bbox: CropRegionBboxSchema.describe("Normalized bbox that was cropped"),
54257
+ width: number2().int().min(1).describe("Crop width in pixels"),
54258
+ height: number2().int().min(1).describe("Crop height in pixels"),
54259
+ fileId: string2().describe("Run output file id for the JPEG crop"),
54260
+ filename: string2().describe("Stored crop filename"),
54261
+ mimeType: literal("image/jpeg").describe("Always image/jpeg"),
54262
+ size: number2().int().min(0).describe("JPEG size in bytes")
54263
+ });
54264
+ TransformCropRegionsOutputSchema = object({
54265
+ regions: array(TransformCropRegionsCropSchema).describe("Successfully cropped regions"),
54266
+ skipped: number2().int().min(0).optional().describe("Regions skipped (invalid bbox or missing page)")
54267
+ });
54268
+ CropRegionsProcessorConfigSchema = TransformCropRegionsConfigSchema.omit({
54269
+ input: true,
54270
+ regions: true
54271
+ }).extend({
54272
+ regions: union([
54273
+ string2().min(1).describe("Template expression resolving to a region array, e.g. {{ steps.list-figures.output.regions }}"),
54274
+ CropRegionSpecListResolvedSchema
54275
+ ]).describe("Regions to crop — may be empty when upstream scripts find no figures")
54276
+ });
54193
54277
  TransformXlsxToJsonConfigSchema = object({
54194
54278
  input: string2().min(1, "Input is required").describe("File input - template expression e.g. {{input.document}} resolving to a scoped $file artifact at runtime")
54195
54279
  }).extend(XlsxToJsonConfigSchema.shape).extend({
@@ -54596,6 +54680,15 @@ var init_step_configs = __esm(() => {
54596
54680
  outputSchema: AiSearchFilesOutputSchema,
54597
54681
  configInWith: true
54598
54682
  },
54683
+ "ai.figure-crops": {
54684
+ type: "ai.figure-crops",
54685
+ category: "ai",
54686
+ name: "Figure Crops",
54687
+ description: "Crop and caption figure elements from a parsed PDF. Renders the source document, crops each kind=figure bbox from ai.parse output, and describes the crop with a vision model. Output is captions plus normalized bboxes for evidence viewers.",
54688
+ configSchema: AiFigureCropsConfigSchema,
54689
+ outputSchema: AiFigureCropsOutputSchema,
54690
+ configInWith: true
54691
+ },
54599
54692
  "transform.set": {
54600
54693
  type: "transform.set",
54601
54694
  category: "transform",
@@ -54659,6 +54752,15 @@ var init_step_configs = __esm(() => {
54659
54752
  outputSchema: TransformPdfEmbedOutputSchema,
54660
54753
  configInWith: true
54661
54754
  },
54755
+ "transform.crop-regions": {
54756
+ type: "transform.crop-regions",
54757
+ category: "transform",
54758
+ name: "Crop Regions",
54759
+ description: "Render a PDF or image and crop normalized bounding boxes into JPEG run output artifacts. Pair with transform.script (bbox lists from ai.parse layout) and ai.extract or ai.vision for captions.",
54760
+ configSchema: TransformCropRegionsConfigSchema,
54761
+ outputSchema: TransformCropRegionsOutputSchema,
54762
+ configInWith: true
54763
+ },
54662
54764
  "transform.xlsx-to-json": {
54663
54765
  type: "transform.xlsx-to-json",
54664
54766
  category: "transform",
@@ -206278,7 +206380,7 @@ import { fileURLToPath as fileURLToPath8 } from "url";
206278
206380
  // package.json
206279
206381
  var package_default = {
206280
206382
  name: "@eigenpal/cli",
206281
- version: "0.17.4",
206383
+ version: "0.18.0",
206282
206384
  description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
206283
206385
  keywords: [
206284
206386
  "eigenpal",