@eigenpal/cli 0.10.39 → 0.10.42
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/dist/cli.js +534 -622
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20215,7 +20215,16 @@ var init_semantic_conventions = __esm(() => {
|
|
|
20215
20215
|
PROCESSOR_ID: "eigenpal.processor.id",
|
|
20216
20216
|
OCR_PROVIDER: "eigenpal.ocr.provider",
|
|
20217
20217
|
OCR_PAGES_PROCESSED: "eigenpal.ocr.pages_processed",
|
|
20218
|
-
PAGE_INDEX: "eigenpal.page_index"
|
|
20218
|
+
PAGE_INDEX: "eigenpal.page_index",
|
|
20219
|
+
LLM_ATTEMPT: "eigenpal.llm.attempt",
|
|
20220
|
+
LLM_MAX_ATTEMPTS: "eigenpal.llm.max_attempts",
|
|
20221
|
+
LLM_OUTCOME: "eigenpal.llm.outcome",
|
|
20222
|
+
LLM_TIMEOUT_MS: "eigenpal.llm.timeout_ms",
|
|
20223
|
+
LLM_QUEUE_WAIT_MS: "eigenpal.llm.queue_wait_ms",
|
|
20224
|
+
LLM_LANE: "eigenpal.llm.lane",
|
|
20225
|
+
PAGE_NUMBERS: "eigenpal.page_numbers",
|
|
20226
|
+
PAGE_COUNT: "eigenpal.page_count",
|
|
20227
|
+
BISECT_DEPTH: "eigenpal.bisect.depth"
|
|
20219
20228
|
};
|
|
20220
20229
|
OpenInferenceSpanKinds = {
|
|
20221
20230
|
LLM: "llm",
|
|
@@ -69065,9 +69074,213 @@ var init_webhooks = __esm(() => {
|
|
|
69065
69074
|
});
|
|
69066
69075
|
});
|
|
69067
69076
|
|
|
69068
|
-
// ../
|
|
69069
|
-
|
|
69070
|
-
|
|
69077
|
+
// ../openparser-schema/dist/index.js
|
|
69078
|
+
function applyPaddleOcrOptionDefaults(requested) {
|
|
69079
|
+
const source = requested && typeof requested === "object" ? requested : undefined;
|
|
69080
|
+
return {
|
|
69081
|
+
image_block_ocr: typeof source?.image_block_ocr === "boolean" ? source.image_block_ocr : PADDLE_OCR_OPTION_DEFAULTS.image_block_ocr,
|
|
69082
|
+
chart_recognition: typeof source?.chart_recognition === "boolean" ? source.chart_recognition : PADDLE_OCR_OPTION_DEFAULTS.chart_recognition,
|
|
69083
|
+
merge_layout_blocks: typeof source?.merge_layout_blocks === "boolean" ? source.merge_layout_blocks : PADDLE_OCR_OPTION_DEFAULTS.merge_layout_blocks
|
|
69084
|
+
};
|
|
69085
|
+
}
|
|
69086
|
+
function isPlainObject3(value) {
|
|
69087
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
69088
|
+
}
|
|
69089
|
+
function typeList(schema) {
|
|
69090
|
+
if (typeof schema.type === "string")
|
|
69091
|
+
return [schema.type];
|
|
69092
|
+
if (Array.isArray(schema.type)) {
|
|
69093
|
+
return schema.type.filter((t) => typeof t === "string");
|
|
69094
|
+
}
|
|
69095
|
+
return [];
|
|
69096
|
+
}
|
|
69097
|
+
function isObjectRootSchema(schema) {
|
|
69098
|
+
const types = typeList(schema);
|
|
69099
|
+
if (types.includes("object"))
|
|
69100
|
+
return true;
|
|
69101
|
+
return types.length === 0 && isPlainObject3(schema.properties);
|
|
69102
|
+
}
|
|
69103
|
+
function pipelineExtractionSchemaRootPropertyCount(schema) {
|
|
69104
|
+
if (!isPlainObject3(schema))
|
|
69105
|
+
return null;
|
|
69106
|
+
if (!isObjectRootSchema(schema))
|
|
69107
|
+
return null;
|
|
69108
|
+
if (!isPlainObject3(schema.properties))
|
|
69109
|
+
return null;
|
|
69110
|
+
return Object.keys(schema.properties).length;
|
|
69111
|
+
}
|
|
69112
|
+
function hasPipelineExtractionSchemaProperties(schema) {
|
|
69113
|
+
const count = pipelineExtractionSchemaRootPropertyCount(schema);
|
|
69114
|
+
return count !== null && count > 0;
|
|
69115
|
+
}
|
|
69116
|
+
function refinePipelineExtractionSchema(schema, ctx, path = ["schema"]) {
|
|
69117
|
+
if (!isPlainObject3(schema)) {
|
|
69118
|
+
ctx.addIssue({
|
|
69119
|
+
code: "custom",
|
|
69120
|
+
message: "schema must be an object",
|
|
69121
|
+
path
|
|
69122
|
+
});
|
|
69123
|
+
return;
|
|
69124
|
+
}
|
|
69125
|
+
const count = pipelineExtractionSchemaRootPropertyCount(schema);
|
|
69126
|
+
if (count === null) {
|
|
69127
|
+
ctx.addIssue({
|
|
69128
|
+
code: "custom",
|
|
69129
|
+
message: "schema root must be an object schema with explicit properties",
|
|
69130
|
+
path
|
|
69131
|
+
});
|
|
69132
|
+
return;
|
|
69133
|
+
}
|
|
69134
|
+
if (count === 0) {
|
|
69135
|
+
ctx.addIssue({
|
|
69136
|
+
code: "custom",
|
|
69137
|
+
message: PIPELINE_EXTRACTION_SCHEMA_EMPTY_PROPERTIES_MESSAGE,
|
|
69138
|
+
path
|
|
69139
|
+
});
|
|
69140
|
+
}
|
|
69141
|
+
}
|
|
69142
|
+
function refineExtractPipelineXor(value, ctx, options) {
|
|
69143
|
+
const hasPipeline = value.pipeline_id !== undefined;
|
|
69144
|
+
const presentInline = EXTRACT_INLINE_CONFIG_KEYS.filter((key) => value[key] !== undefined);
|
|
69145
|
+
const requireOcrModel = options?.requireOcrModel !== false;
|
|
69146
|
+
if (hasPipeline && presentInline.length > 0) {
|
|
69147
|
+
ctx.addIssue({
|
|
69148
|
+
code: "custom",
|
|
69149
|
+
message: "pipeline_inline_conflict",
|
|
69150
|
+
path: ["pipeline_id"]
|
|
69151
|
+
});
|
|
69152
|
+
return;
|
|
69153
|
+
}
|
|
69154
|
+
if (hasPipeline)
|
|
69155
|
+
return;
|
|
69156
|
+
if (requireOcrModel && value.ocr_model === undefined) {
|
|
69157
|
+
ctx.addIssue({ code: "custom", message: "Required", path: ["ocr_model"] });
|
|
69158
|
+
}
|
|
69159
|
+
if (value.llm_model === undefined) {
|
|
69160
|
+
ctx.addIssue({ code: "custom", message: "Required", path: ["llm_model"] });
|
|
69161
|
+
}
|
|
69162
|
+
if (value.schema === undefined) {
|
|
69163
|
+
ctx.addIssue({ code: "custom", message: "Required", path: ["schema"] });
|
|
69164
|
+
}
|
|
69165
|
+
}
|
|
69166
|
+
function migratedOcrJobIdFromUuid(uuid3) {
|
|
69167
|
+
return `opj_${uuid3.toLowerCase().replace(/-/g, "")}`;
|
|
69168
|
+
}
|
|
69169
|
+
function normalizeOcrJobIdInput(id) {
|
|
69170
|
+
const trimmed = id.trim();
|
|
69171
|
+
if (LEGACY_OCR_JOB_UUID_PATTERN.test(trimmed)) {
|
|
69172
|
+
return migratedOcrJobIdFromUuid(trimmed);
|
|
69173
|
+
}
|
|
69174
|
+
return trimmed;
|
|
69175
|
+
}
|
|
69176
|
+
function isOcrJobIdInput(id) {
|
|
69177
|
+
return JobIdInputSchema.safeParse(id).success;
|
|
69178
|
+
}
|
|
69179
|
+
function isPreferredOcrJobId(id) {
|
|
69180
|
+
return OCR_JOB_ID_PATTERN.test(id);
|
|
69181
|
+
}
|
|
69182
|
+
function normalizeOcrPipelineIdInput(id) {
|
|
69183
|
+
const trimmed = id.trim();
|
|
69184
|
+
if (trimmed.startsWith(LEGACY_OCR_PIPELINE_ID_PREFIX)) {
|
|
69185
|
+
return `oppl_${trimmed.slice(LEGACY_OCR_PIPELINE_ID_PREFIX.length)}`;
|
|
69186
|
+
}
|
|
69187
|
+
return trimmed;
|
|
69188
|
+
}
|
|
69189
|
+
function getDefaultOcrModelId() {
|
|
69190
|
+
const defaults = OCR_MODEL_CATALOG.filter((entry) => entry.is_default);
|
|
69191
|
+
if (defaults.length !== 1) {
|
|
69192
|
+
throw new Error("OCR_MODEL_CATALOG must declare exactly one default model");
|
|
69193
|
+
}
|
|
69194
|
+
return defaults[0].id;
|
|
69195
|
+
}
|
|
69196
|
+
function getOcrModelUsdPerPage(modelId) {
|
|
69197
|
+
const entry = OCR_MODEL_CATALOG.find((model) => model.id === modelId);
|
|
69198
|
+
const usd = entry?.pricing.usd_per_page;
|
|
69199
|
+
if (usd == null || !Number.isFinite(usd) || usd < 0)
|
|
69200
|
+
return null;
|
|
69201
|
+
return usd;
|
|
69202
|
+
}
|
|
69203
|
+
function requireOcrModelUsdPerPage(modelId) {
|
|
69204
|
+
const usd = getOcrModelUsdPerPage(modelId);
|
|
69205
|
+
if (usd == null) {
|
|
69206
|
+
throw new Error(`OCR model ${modelId} is missing customer retail page pricing`);
|
|
69207
|
+
}
|
|
69208
|
+
return usd;
|
|
69209
|
+
}
|
|
69210
|
+
function requireExactlyOneSource(item, ctx) {
|
|
69211
|
+
const hasIndex = item.file_index !== undefined;
|
|
69212
|
+
const hasFileId = item.file_id !== undefined;
|
|
69213
|
+
if (hasIndex === hasFileId) {
|
|
69214
|
+
ctx.addIssue({
|
|
69215
|
+
code: "custom",
|
|
69216
|
+
message: "each batch item requires exactly one of file_index or file_id",
|
|
69217
|
+
path: hasIndex ? ["file_id"] : ["file_index"]
|
|
69218
|
+
});
|
|
69219
|
+
}
|
|
69220
|
+
}
|
|
69221
|
+
function getOpenParserRoute(method, path) {
|
|
69222
|
+
const normalizedMethod = method.toLowerCase();
|
|
69223
|
+
return OPENPARSER_ROUTE_MANIFEST.find((route) => {
|
|
69224
|
+
if (route.method !== normalizedMethod)
|
|
69225
|
+
return false;
|
|
69226
|
+
const pattern = route.path.replace(/\{[^/]+\}/g, "[^/]+");
|
|
69227
|
+
return new RegExp(`^${pattern}$`).test(path);
|
|
69228
|
+
});
|
|
69229
|
+
}
|
|
69230
|
+
function canonicalParseRequestExample() {
|
|
69231
|
+
return {
|
|
69232
|
+
ocr_model: getDefaultOcrModelId(),
|
|
69233
|
+
output_format: OPENPARSER_DEFAULT_OUTPUT_FORMAT
|
|
69234
|
+
};
|
|
69235
|
+
}
|
|
69236
|
+
function shellSingleQuote(value) {
|
|
69237
|
+
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
69238
|
+
}
|
|
69239
|
+
function serializeOpenParserMultipartRequest(body) {
|
|
69240
|
+
return `request=${JSON.stringify(body)};type=application/json`;
|
|
69241
|
+
}
|
|
69242
|
+
function buildOpenParserMultipartCurl(input) {
|
|
69243
|
+
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
69244
|
+
const filePath = input.filePath ?? "./document.pdf";
|
|
69245
|
+
return [
|
|
69246
|
+
`curl -X POST ${shellSingleQuote(`${baseUrl}${input.path}`)} \\`,
|
|
69247
|
+
` -H ${shellSingleQuote(`Authorization: Bearer ${OPENPARSER_CURL_API_KEY_PLACEHOLDER}`)} \\`,
|
|
69248
|
+
` -H "Idempotency-Key: ${OPENPARSER_CURL_IDEMPOTENCY_KEY_EXPR}" \\`,
|
|
69249
|
+
` -F ${shellSingleQuote(serializeOpenParserMultipartRequest(input.requestBody))} \\`,
|
|
69250
|
+
` -F ${shellSingleQuote(`file=@${filePath}`)}`
|
|
69251
|
+
].join(`
|
|
69252
|
+
`);
|
|
69253
|
+
}
|
|
69254
|
+
function buildParseCurl(input) {
|
|
69255
|
+
return buildOpenParserMultipartCurl({
|
|
69256
|
+
baseUrl: input.baseUrl,
|
|
69257
|
+
path: input.path ?? "/parse",
|
|
69258
|
+
requestBody: canonicalParseRequestExample(),
|
|
69259
|
+
filePath: input.filePath
|
|
69260
|
+
});
|
|
69261
|
+
}
|
|
69262
|
+
function buildExtractPipelineCurl(input) {
|
|
69263
|
+
return buildOpenParserMultipartCurl({
|
|
69264
|
+
baseUrl: input.baseUrl,
|
|
69265
|
+
path: "/extract/async",
|
|
69266
|
+
requestBody: { pipeline_id: input.pipelineId },
|
|
69267
|
+
filePath: input.filePath
|
|
69268
|
+
});
|
|
69269
|
+
}
|
|
69270
|
+
var BoundingBoxSchema, PointSchema2, PolygonSchema, PAGE_BLOCK_KINDS, PageBlockKindSchema, PageBlockSchema, REGION_TYPES, RegionTypeSchema, RegionSchema, CONTENT_KINDS, ContentKindSchema, RegionContentSchema, Sha256HexSchema, ChunkProvenanceSpanSchema, ExtractionChunkSchema, ParsedDocumentSchema, OCR_JOB_ID_PREFIX = "opj", OCR_JOB_ID_PATTERN, JobIdSchema, EXTRACTION_GROUNDING_MODES, ExtractionGroundingModeSchema, EXTRACTION_CITATION_GRANULARITIES, ExtractionCitationGranularitySchema, CitationSourceTypeSchema, ExtractionCitationSchema, ExtractionGroundingFieldSchema, ExtractionGroundingResultSchema, OCR_LLM_REASONING_EFFORTS, OcrLlmReasoningEffortSchema, OcrLlmReasoningEffortRequestSchema, OcrLlmRecommendationTierSchema, OcrLlmPublicPricingBasisSchema, OcrLlmModelPricingSchema, OcrLlmModelReasoningSchema, OcrLlmModelCatalogEntrySchema, OcrLlmModelsListModeSchema, OcrLlmModelsQuerySchema, OcrLlmModelsResponseSchema, EXTRACTION_ATTEMPT_KINDS, ExtractionAttemptKindSchema, EXTRACTION_ATTEMPT_STATUSES, ExtractionAttemptStatusSchema, LlmModelSchema, ExtractionAttemptSchema, ExtractionUsageTotalsSchema, ExtractionTerminalResultSchema, PaddleOcrOptionsRequestSchema, PaddleOcrOptionsEffectiveSchema, PADDLE_OCR_OPTION_DEFAULTS, OcrOptionsRequestSchema, OcrOptionsEffectiveSchema, LlmOptionsRequestSchema, LlmOptionsStoredSchema, OcrModelOptionCapabilitySchema, PIPELINE_EXTRACTION_SCHEMA_EMPTY_PROPERTIES_MESSAGE = "extraction pipeline schema must include at least one named property", ExtractionPipelineIdSchema, ExtractionPipelineNameSchema, ExtractionPipelineSlugSchema, PipelineExtractionSchemaObjectSchema, PipelineConfigFields, CreateExtractionPipelineRequestSchema, UpdateExtractionPipelineRequestSchema, ExtractionPipelineSchema, ExtractionPipelineListResponseSchema, DeleteExtractionPipelineResponseSchema, EXTRACT_INLINE_CONFIG_KEYS, LEGACY_OCR_JOB_UUID_PATTERN, JobIdInputSchema, LEGACY_OCR_PIPELINE_ID_PREFIX = "oep_", ExtractionPipelineIdInputSchema, OCR_OUTPUT_FORMATS, OcrOutputFormatSchema, PaddleRawProfileSchema, RawParseResultSchema, SUGGEST_SCHEMA_HINT_MAX_CHARS = 500, SUGGEST_SCHEMA_PREVIEW_MAX_PAGES = 2, SUGGEST_SCHEMA_PREVIEW_MAX_CHARS = 24000, SuggestSchemaHintSchema, SuggestSchemaRequestSchema, SuggestSchemaResponseSchema, SuggestSchemaPreviewMetaSchema, SuggestSchemaTerminalResultSchema, OCR_OPENAPI_RELATIVE_PATH = "docs/OCR_API_OPENAPI.yaml", OCR_JOB_STATUSES, JobStatusSchema, OCR_JOB_OPERATIONS, JobOperationSchema, OCR_JOB_HISTORY_OPERATIONS, JobHistoryOperationSchema, JobFailureSchema, JobAcceptedSchema, BatchJobAcceptedSchema, BatchChildSummarySchema, BatchChildPageSchema, BatchSummaryCountsSchema, JobProgressSchema, RelatedExtractionSummarySchema, JobSchema, OCR_JOB_LIST_DEFAULT_LIMIT = 25, OCR_JOB_LIST_MAX_LIMIT = 100, JobSummarySchema, JobListResponseSchema, JobListQuerySchema, ErrorBodySchema, ErrorResponseSchema, OCR_SYNC_STATUS_CODES, OCR_MODELS, OcrModelAvailabilitySchema, OcrModelPricingBasisSchema, OcrModelPricingSchema, PADDLE_OCR_USD_PER_PAGE = 0.001, OcrModelCatalogEntrySchema, OcrModelsResponseSchema, PADDLE_OPTION_CAPABILITIES, OCR_MODEL_CATALOG, OcrModelSchema, OcrFileIdSchema, RepairAttemptsSchema, ExtractionJsonSchemaObjectSchema, ParseRequestSchema, ExtractRequestSchema, ParseBatchItemSchema, ExtractBatchItemSchema, ParseBatchRequestSchema, ExtractBatchRequestSchema, PublicFileSchema, DeleteFileResponseSchema, OpenParserParseResultSchema, OPENPARSER_COMPONENT_SCHEMAS, admissionErrors, OPENPARSER_ROUTE_MANIFEST, OPENPARSER_DEFAULT_OUTPUT_FORMAT = "openparser@1", OPENPARSER_CURL_API_KEY_PLACEHOLDER = "YOUR_API_KEY", OPENPARSER_CURL_IDEMPOTENCY_KEY_EXPR = "$(uuidgen 2>/dev/null || openssl rand -hex 16)", OPENPARSER_IDEMPOTENCY_KEY_GUIDANCE = "Use a unique Idempotency-Key for each distinct request body. Reuse the same key only when retrying an identical admission.";
|
|
69271
|
+
var init_dist = __esm(() => {
|
|
69272
|
+
init_zod();
|
|
69273
|
+
init_zod();
|
|
69274
|
+
init_zod();
|
|
69275
|
+
init_zod();
|
|
69276
|
+
init_zod();
|
|
69277
|
+
init_zod();
|
|
69278
|
+
init_zod();
|
|
69279
|
+
init_zod();
|
|
69280
|
+
init_zod();
|
|
69281
|
+
init_zod();
|
|
69282
|
+
init_zod();
|
|
69283
|
+
init_zod();
|
|
69071
69284
|
init_zod();
|
|
69072
69285
|
BoundingBoxSchema = exports_external.object({
|
|
69073
69286
|
left: exports_external.number().int().min(0),
|
|
@@ -69262,21 +69475,8 @@ var init_parsed_document = __esm(() => {
|
|
|
69262
69475
|
}
|
|
69263
69476
|
}
|
|
69264
69477
|
});
|
|
69265
|
-
});
|
|
69266
|
-
|
|
69267
|
-
// ../types/src/ocr/job-id.ts
|
|
69268
|
-
var OCR_JOB_ID_PREFIX = "opj", OCR_JOB_ID_PATTERN, JobIdSchema;
|
|
69269
|
-
var init_job_id = __esm(() => {
|
|
69270
|
-
init_zod();
|
|
69271
69478
|
OCR_JOB_ID_PATTERN = /^opj_[A-Za-z0-9_-]+$/;
|
|
69272
69479
|
JobIdSchema = exports_external.string().regex(OCR_JOB_ID_PATTERN, "job id must be an opj_… id").max(128);
|
|
69273
|
-
});
|
|
69274
|
-
|
|
69275
|
-
// ../types/src/ocr/grounding.ts
|
|
69276
|
-
var EXTRACTION_GROUNDING_MODES, ExtractionGroundingModeSchema, EXTRACTION_CITATION_GRANULARITIES, ExtractionCitationGranularitySchema, CitationSourceTypeSchema, ExtractionCitationSchema, ExtractionGroundingFieldSchema, ExtractionGroundingResultSchema;
|
|
69277
|
-
var init_grounding = __esm(() => {
|
|
69278
|
-
init_zod();
|
|
69279
|
-
init_parsed_document();
|
|
69280
69480
|
EXTRACTION_GROUNDING_MODES = ["none", "field"];
|
|
69281
69481
|
ExtractionGroundingModeSchema = exports_external.enum(EXTRACTION_GROUNDING_MODES);
|
|
69282
69482
|
EXTRACTION_CITATION_GRANULARITIES = ["block", "region"];
|
|
@@ -69302,51 +69502,6 @@ var init_grounding = __esm(() => {
|
|
|
69302
69502
|
mode: exports_external.literal("field"),
|
|
69303
69503
|
fields: exports_external.array(ExtractionGroundingFieldSchema)
|
|
69304
69504
|
}).strict();
|
|
69305
|
-
});
|
|
69306
|
-
|
|
69307
|
-
// ../types/src/ocr/llm-models.ts
|
|
69308
|
-
function getDefaultOcrLlmModelId() {
|
|
69309
|
-
const defaults = OCR_LLM_EMERGENCY_CATALOG.filter((entry) => entry.is_default);
|
|
69310
|
-
if (defaults.length !== 1) {
|
|
69311
|
-
throw new Error("OCR_LLM_EMERGENCY_CATALOG must declare exactly one default model");
|
|
69312
|
-
}
|
|
69313
|
-
return defaults[0].id;
|
|
69314
|
-
}
|
|
69315
|
-
function toCustomerRetailCatalogEntry(entry, markup = OCR_LLM_RETAIL_MARKUP) {
|
|
69316
|
-
if (entry.pricing.basis === "customer_retail") {
|
|
69317
|
-
return entry;
|
|
69318
|
-
}
|
|
69319
|
-
if (!Number.isFinite(markup) || markup <= 0) {
|
|
69320
|
-
throw new Error("OCR retail markup must be a positive finite number");
|
|
69321
|
-
}
|
|
69322
|
-
return {
|
|
69323
|
-
...entry,
|
|
69324
|
-
pricing: {
|
|
69325
|
-
prompt_usd_per_1m: entry.pricing.prompt_usd_per_1m * markup,
|
|
69326
|
-
completion_usd_per_1m: entry.pricing.completion_usd_per_1m * markup,
|
|
69327
|
-
basis: "customer_retail"
|
|
69328
|
-
}
|
|
69329
|
-
};
|
|
69330
|
-
}
|
|
69331
|
-
function toOcrLlmRequestSnapshot(input) {
|
|
69332
|
-
if (input.entry.pricing.basis !== "provider_list") {
|
|
69333
|
-
throw new Error("OCR LLM request snapshot requires provider_list pricing (refuse retail rates to avoid double markup)");
|
|
69334
|
-
}
|
|
69335
|
-
return {
|
|
69336
|
-
catalog_version: input.catalogVersion,
|
|
69337
|
-
model_id: input.entry.id,
|
|
69338
|
-
pricing: {
|
|
69339
|
-
prompt_usd_per_token: input.entry.pricing.prompt_usd_per_1m / 1e6,
|
|
69340
|
-
completion_usd_per_token: input.entry.pricing.completion_usd_per_1m / 1e6,
|
|
69341
|
-
source: "openrouter_provider_list"
|
|
69342
|
-
},
|
|
69343
|
-
reasoning_effort_requested: input.reasoningEffortRequested,
|
|
69344
|
-
reasoning_effort_resolved: input.reasoningEffortResolved
|
|
69345
|
-
};
|
|
69346
|
-
}
|
|
69347
|
-
var OCR_LLM_REASONING_EFFORTS, OcrLlmReasoningEffortSchema, OcrLlmReasoningEffortRequestSchema, OcrLlmRecommendationTierSchema, OcrLlmPublicPricingBasisSchema, OcrLlmProviderListPricingBasisSchema, OcrLlmPricingBasisSchema, OCR_LLM_RETAIL_MARKUP = 2, OcrLlmModelPricingSchema, OcrLlmProviderListPricingSchema, OcrLlmModelReasoningSchema, ocrLlmCatalogEntryFields, OcrLlmModelCatalogEntrySchema, OcrLlmProviderCatalogEntrySchema, OcrLlmModelsListModeSchema, OcrLlmModelsQuerySchema, OcrLlmModelsResponseSchema, OcrLlmRequestSnapshotSchema, OCR_LLM_EMERGENCY_CATALOG, OCR_LLM_CATALOG, OCR_LLM_MODEL_IDS, OCR_LLM_CERTIFIED_MODEL_IDS, OCR_LLM_SUGGESTED_PROVIDERS, OCR_LLM_SUGGESTED_MAX_AGE_DAYS = 90;
|
|
69348
|
-
var init_llm_models = __esm(() => {
|
|
69349
|
-
init_zod();
|
|
69350
69505
|
OCR_LLM_REASONING_EFFORTS = [
|
|
69351
69506
|
"none",
|
|
69352
69507
|
"minimal",
|
|
@@ -69363,25 +69518,18 @@ var init_llm_models = __esm(() => {
|
|
|
69363
69518
|
]);
|
|
69364
69519
|
OcrLlmRecommendationTierSchema = exports_external.enum(["suggested", "compatible"]);
|
|
69365
69520
|
OcrLlmPublicPricingBasisSchema = exports_external.literal("customer_retail");
|
|
69366
|
-
OcrLlmProviderListPricingBasisSchema = exports_external.literal("provider_list");
|
|
69367
|
-
OcrLlmPricingBasisSchema = exports_external.enum(["customer_retail", "provider_list"]);
|
|
69368
69521
|
OcrLlmModelPricingSchema = exports_external.object({
|
|
69369
69522
|
prompt_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
69370
69523
|
completion_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
69371
69524
|
basis: OcrLlmPublicPricingBasisSchema
|
|
69372
69525
|
}).strict();
|
|
69373
|
-
OcrLlmProviderListPricingSchema = exports_external.object({
|
|
69374
|
-
prompt_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
69375
|
-
completion_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
69376
|
-
basis: OcrLlmProviderListPricingBasisSchema
|
|
69377
|
-
}).strict();
|
|
69378
69526
|
OcrLlmModelReasoningSchema = exports_external.object({
|
|
69379
69527
|
supported_efforts: exports_external.array(OcrLlmReasoningEffortSchema).nullable(),
|
|
69380
69528
|
default_effort: OcrLlmReasoningEffortSchema.nullable(),
|
|
69381
69529
|
mandatory: exports_external.boolean(),
|
|
69382
69530
|
supports_max_tokens: exports_external.boolean()
|
|
69383
69531
|
}).strict();
|
|
69384
|
-
|
|
69532
|
+
OcrLlmModelCatalogEntrySchema = exports_external.object({
|
|
69385
69533
|
id: exports_external.string().min(1).max(200),
|
|
69386
69534
|
label: exports_external.string().min(1).max(120),
|
|
69387
69535
|
provider: exports_external.string().min(1).max(64),
|
|
@@ -69395,16 +69543,9 @@ var init_llm_models = __esm(() => {
|
|
|
69395
69543
|
supports_suggest: exports_external.boolean(),
|
|
69396
69544
|
pricing_known: exports_external.literal(true),
|
|
69397
69545
|
reasoning: OcrLlmModelReasoningSchema.nullable(),
|
|
69398
|
-
deprecated_at: exports_external.string().datetime().nullable()
|
|
69399
|
-
};
|
|
69400
|
-
OcrLlmModelCatalogEntrySchema = exports_external.object({
|
|
69401
|
-
...ocrLlmCatalogEntryFields,
|
|
69546
|
+
deprecated_at: exports_external.string().datetime().nullable(),
|
|
69402
69547
|
pricing: OcrLlmModelPricingSchema
|
|
69403
69548
|
}).strict();
|
|
69404
|
-
OcrLlmProviderCatalogEntrySchema = exports_external.object({
|
|
69405
|
-
...ocrLlmCatalogEntryFields,
|
|
69406
|
-
pricing: OcrLlmProviderListPricingSchema
|
|
69407
|
-
}).strict();
|
|
69408
69549
|
OcrLlmModelsListModeSchema = exports_external.enum(["suggested", "search"]);
|
|
69409
69550
|
OcrLlmModelsQuerySchema = exports_external.object({
|
|
69410
69551
|
mode: OcrLlmModelsListModeSchema.default("suggested"),
|
|
@@ -69423,114 +69564,6 @@ var init_llm_models = __esm(() => {
|
|
|
69423
69564
|
total: exports_external.number().int().min(0),
|
|
69424
69565
|
has_more: exports_external.boolean()
|
|
69425
69566
|
}).strict();
|
|
69426
|
-
OcrLlmRequestSnapshotSchema = exports_external.object({
|
|
69427
|
-
catalog_version: exports_external.string().min(1),
|
|
69428
|
-
model_id: exports_external.string().min(1).max(200),
|
|
69429
|
-
pricing: exports_external.object({
|
|
69430
|
-
prompt_usd_per_token: exports_external.number().finite().nonnegative(),
|
|
69431
|
-
completion_usd_per_token: exports_external.number().finite().nonnegative(),
|
|
69432
|
-
source: exports_external.literal("openrouter_provider_list")
|
|
69433
|
-
}).strict(),
|
|
69434
|
-
reasoning_effort_requested: OcrLlmReasoningEffortRequestSchema.nullable(),
|
|
69435
|
-
reasoning_effort_resolved: OcrLlmReasoningEffortSchema.nullable()
|
|
69436
|
-
}).strict();
|
|
69437
|
-
OCR_LLM_EMERGENCY_CATALOG = [
|
|
69438
|
-
{
|
|
69439
|
-
id: "openai/gpt-5.6-terra",
|
|
69440
|
-
label: "GPT-5.6 Terra",
|
|
69441
|
-
provider: "openai",
|
|
69442
|
-
created_at: null,
|
|
69443
|
-
context_length: 1050000,
|
|
69444
|
-
pricing: {
|
|
69445
|
-
prompt_usd_per_1m: 2.5,
|
|
69446
|
-
completion_usd_per_1m: 15,
|
|
69447
|
-
basis: "provider_list"
|
|
69448
|
-
},
|
|
69449
|
-
recommendation: "suggested",
|
|
69450
|
-
is_default: true,
|
|
69451
|
-
certified_grounding: true,
|
|
69452
|
-
certified_suggest: true,
|
|
69453
|
-
supports_grounding: true,
|
|
69454
|
-
supports_suggest: true,
|
|
69455
|
-
pricing_known: true,
|
|
69456
|
-
reasoning: {
|
|
69457
|
-
supported_efforts: [
|
|
69458
|
-
"none",
|
|
69459
|
-
"low",
|
|
69460
|
-
"medium",
|
|
69461
|
-
"high",
|
|
69462
|
-
"xhigh",
|
|
69463
|
-
"max"
|
|
69464
|
-
],
|
|
69465
|
-
default_effort: "medium",
|
|
69466
|
-
mandatory: false,
|
|
69467
|
-
supports_max_tokens: false
|
|
69468
|
-
},
|
|
69469
|
-
deprecated_at: null
|
|
69470
|
-
},
|
|
69471
|
-
{
|
|
69472
|
-
id: "openai/gpt-4.1-mini",
|
|
69473
|
-
label: "GPT-4.1 Mini",
|
|
69474
|
-
provider: "openai",
|
|
69475
|
-
created_at: null,
|
|
69476
|
-
context_length: 1047576,
|
|
69477
|
-
pricing: {
|
|
69478
|
-
prompt_usd_per_1m: 0.4,
|
|
69479
|
-
completion_usd_per_1m: 1.6,
|
|
69480
|
-
basis: "provider_list"
|
|
69481
|
-
},
|
|
69482
|
-
recommendation: "suggested",
|
|
69483
|
-
is_default: false,
|
|
69484
|
-
certified_grounding: true,
|
|
69485
|
-
certified_suggest: true,
|
|
69486
|
-
supports_grounding: true,
|
|
69487
|
-
supports_suggest: true,
|
|
69488
|
-
pricing_known: true,
|
|
69489
|
-
reasoning: null,
|
|
69490
|
-
deprecated_at: null
|
|
69491
|
-
},
|
|
69492
|
-
{
|
|
69493
|
-
id: "openai/gpt-4.1",
|
|
69494
|
-
label: "GPT-4.1",
|
|
69495
|
-
provider: "openai",
|
|
69496
|
-
created_at: null,
|
|
69497
|
-
context_length: 1047576,
|
|
69498
|
-
pricing: {
|
|
69499
|
-
prompt_usd_per_1m: 2,
|
|
69500
|
-
completion_usd_per_1m: 8,
|
|
69501
|
-
basis: "provider_list"
|
|
69502
|
-
},
|
|
69503
|
-
recommendation: "suggested",
|
|
69504
|
-
is_default: false,
|
|
69505
|
-
certified_grounding: true,
|
|
69506
|
-
certified_suggest: true,
|
|
69507
|
-
supports_grounding: true,
|
|
69508
|
-
supports_suggest: true,
|
|
69509
|
-
pricing_known: true,
|
|
69510
|
-
reasoning: null,
|
|
69511
|
-
deprecated_at: null
|
|
69512
|
-
}
|
|
69513
|
-
];
|
|
69514
|
-
OCR_LLM_CATALOG = OCR_LLM_EMERGENCY_CATALOG;
|
|
69515
|
-
OCR_LLM_MODEL_IDS = OCR_LLM_EMERGENCY_CATALOG.map((entry) => entry.id);
|
|
69516
|
-
OCR_LLM_CERTIFIED_MODEL_IDS = OCR_LLM_EMERGENCY_CATALOG.filter((entry) => entry.certified_grounding || entry.certified_suggest).map((entry) => entry.id);
|
|
69517
|
-
OCR_LLM_SUGGESTED_PROVIDERS = [
|
|
69518
|
-
"openai",
|
|
69519
|
-
"anthropic",
|
|
69520
|
-
"google",
|
|
69521
|
-
"x-ai",
|
|
69522
|
-
"moonshotai"
|
|
69523
|
-
];
|
|
69524
|
-
});
|
|
69525
|
-
|
|
69526
|
-
// ../types/src/ocr/extraction.ts
|
|
69527
|
-
var EXTRACTION_ATTEMPT_KINDS, ExtractionAttemptKindSchema, EXTRACTION_ATTEMPT_STATUSES, ExtractionAttemptStatusSchema, LlmModelSchema, ExtractionAttemptSchema, ExtractionUsageTotalsSchema, ExtractionTerminalResultSchema;
|
|
69528
|
-
var init_extraction = __esm(() => {
|
|
69529
|
-
init_zod();
|
|
69530
|
-
init_grounding();
|
|
69531
|
-
init_job_id();
|
|
69532
|
-
init_llm_models();
|
|
69533
|
-
init_parsed_document();
|
|
69534
69567
|
EXTRACTION_ATTEMPT_KINDS = ["primary", "repair"];
|
|
69535
69568
|
ExtractionAttemptKindSchema = exports_external.enum(EXTRACTION_ATTEMPT_KINDS);
|
|
69536
69569
|
EXTRACTION_ATTEMPT_STATUSES = ["succeeded", "failed", "indeterminate"];
|
|
@@ -69560,22 +69593,6 @@ var init_extraction = __esm(() => {
|
|
|
69560
69593
|
usage: ExtractionUsageTotalsSchema.optional(),
|
|
69561
69594
|
grounding: ExtractionGroundingResultSchema.optional()
|
|
69562
69595
|
}).strict();
|
|
69563
|
-
});
|
|
69564
|
-
|
|
69565
|
-
// ../types/src/ocr/model-options.ts
|
|
69566
|
-
function applyPaddleOcrOptionDefaults(requested) {
|
|
69567
|
-
const source = requested && typeof requested === "object" ? requested : undefined;
|
|
69568
|
-
return {
|
|
69569
|
-
image_block_ocr: typeof source?.image_block_ocr === "boolean" ? source.image_block_ocr : PADDLE_OCR_OPTION_DEFAULTS.image_block_ocr,
|
|
69570
|
-
chart_recognition: typeof source?.chart_recognition === "boolean" ? source.chart_recognition : PADDLE_OCR_OPTION_DEFAULTS.chart_recognition,
|
|
69571
|
-
merge_layout_blocks: typeof source?.merge_layout_blocks === "boolean" ? source.merge_layout_blocks : PADDLE_OCR_OPTION_DEFAULTS.merge_layout_blocks
|
|
69572
|
-
};
|
|
69573
|
-
}
|
|
69574
|
-
var OcrFigureAssetsModeSchema, PaddleOcrOptionsRequestSchema, PaddleOcrOptionsEffectiveSchema, PADDLE_OCR_OPTION_DEFAULTS, OcrOptionsRequestSchema, OcrOptionsEffectiveSchema, LlmOptionsRequestSchema, LlmOptionsStoredSchema, OcrModelOptionCapabilitySchema;
|
|
69575
|
-
var init_model_options = __esm(() => {
|
|
69576
|
-
init_zod();
|
|
69577
|
-
init_llm_models();
|
|
69578
|
-
OcrFigureAssetsModeSchema = exports_external.enum(["none", "stored"]);
|
|
69579
69596
|
PaddleOcrOptionsRequestSchema = exports_external.object({
|
|
69580
69597
|
image_block_ocr: exports_external.boolean().optional(),
|
|
69581
69598
|
chart_recognition: exports_external.boolean().optional(),
|
|
@@ -69600,98 +69617,6 @@ var init_model_options = __esm(() => {
|
|
|
69600
69617
|
chart_recognition: exports_external.boolean(),
|
|
69601
69618
|
merge_layout_blocks: exports_external.boolean()
|
|
69602
69619
|
}).strict();
|
|
69603
|
-
});
|
|
69604
|
-
|
|
69605
|
-
// ../types/src/ocr/pipeline-extraction-schema.ts
|
|
69606
|
-
function isPlainObject3(value) {
|
|
69607
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
69608
|
-
}
|
|
69609
|
-
function typeList(schema) {
|
|
69610
|
-
if (typeof schema.type === "string")
|
|
69611
|
-
return [schema.type];
|
|
69612
|
-
if (Array.isArray(schema.type)) {
|
|
69613
|
-
return schema.type.filter((t) => typeof t === "string");
|
|
69614
|
-
}
|
|
69615
|
-
return [];
|
|
69616
|
-
}
|
|
69617
|
-
function isObjectRootSchema(schema) {
|
|
69618
|
-
const types = typeList(schema);
|
|
69619
|
-
if (types.includes("object"))
|
|
69620
|
-
return true;
|
|
69621
|
-
return types.length === 0 && isPlainObject3(schema.properties);
|
|
69622
|
-
}
|
|
69623
|
-
function pipelineExtractionSchemaRootPropertyCount(schema) {
|
|
69624
|
-
if (!isPlainObject3(schema))
|
|
69625
|
-
return null;
|
|
69626
|
-
if (!isObjectRootSchema(schema))
|
|
69627
|
-
return null;
|
|
69628
|
-
if (!isPlainObject3(schema.properties))
|
|
69629
|
-
return null;
|
|
69630
|
-
return Object.keys(schema.properties).length;
|
|
69631
|
-
}
|
|
69632
|
-
function hasPipelineExtractionSchemaProperties(schema) {
|
|
69633
|
-
const count = pipelineExtractionSchemaRootPropertyCount(schema);
|
|
69634
|
-
return count !== null && count > 0;
|
|
69635
|
-
}
|
|
69636
|
-
function refinePipelineExtractionSchema(schema, ctx, path = ["schema"]) {
|
|
69637
|
-
if (!isPlainObject3(schema)) {
|
|
69638
|
-
ctx.addIssue({
|
|
69639
|
-
code: "custom",
|
|
69640
|
-
message: "schema must be an object",
|
|
69641
|
-
path
|
|
69642
|
-
});
|
|
69643
|
-
return;
|
|
69644
|
-
}
|
|
69645
|
-
const count = pipelineExtractionSchemaRootPropertyCount(schema);
|
|
69646
|
-
if (count === null) {
|
|
69647
|
-
ctx.addIssue({
|
|
69648
|
-
code: "custom",
|
|
69649
|
-
message: "schema root must be an object schema with explicit properties",
|
|
69650
|
-
path
|
|
69651
|
-
});
|
|
69652
|
-
return;
|
|
69653
|
-
}
|
|
69654
|
-
if (count === 0) {
|
|
69655
|
-
ctx.addIssue({
|
|
69656
|
-
code: "custom",
|
|
69657
|
-
message: PIPELINE_EXTRACTION_SCHEMA_EMPTY_PROPERTIES_MESSAGE,
|
|
69658
|
-
path
|
|
69659
|
-
});
|
|
69660
|
-
}
|
|
69661
|
-
}
|
|
69662
|
-
var PIPELINE_EXTRACTION_SCHEMA_EMPTY_PROPERTIES_MESSAGE = "extraction pipeline schema must include at least one named property";
|
|
69663
|
-
|
|
69664
|
-
// ../types/src/ocr/pipelines.ts
|
|
69665
|
-
function refineExtractPipelineXor(value, ctx, options) {
|
|
69666
|
-
const hasPipeline = value.pipeline_id !== undefined;
|
|
69667
|
-
const presentInline = EXTRACT_INLINE_CONFIG_KEYS.filter((key) => value[key] !== undefined);
|
|
69668
|
-
const requireOcrModel = options?.requireOcrModel !== false;
|
|
69669
|
-
if (hasPipeline && presentInline.length > 0) {
|
|
69670
|
-
ctx.addIssue({
|
|
69671
|
-
code: "custom",
|
|
69672
|
-
message: "pipeline_inline_conflict",
|
|
69673
|
-
path: ["pipeline_id"]
|
|
69674
|
-
});
|
|
69675
|
-
return;
|
|
69676
|
-
}
|
|
69677
|
-
if (hasPipeline)
|
|
69678
|
-
return;
|
|
69679
|
-
if (requireOcrModel && value.ocr_model === undefined) {
|
|
69680
|
-
ctx.addIssue({ code: "custom", message: "Required", path: ["ocr_model"] });
|
|
69681
|
-
}
|
|
69682
|
-
if (value.llm_model === undefined) {
|
|
69683
|
-
ctx.addIssue({ code: "custom", message: "Required", path: ["llm_model"] });
|
|
69684
|
-
}
|
|
69685
|
-
if (value.schema === undefined) {
|
|
69686
|
-
ctx.addIssue({ code: "custom", message: "Required", path: ["schema"] });
|
|
69687
|
-
}
|
|
69688
|
-
}
|
|
69689
|
-
var ExtractionPipelineIdSchema, ExtractionPipelineNameSchema, ExtractionPipelineSlugSchema, PipelineExtractionSchemaObjectSchema, PipelineConfigFields, CreateExtractionPipelineRequestSchema, UpdateExtractionPipelineRequestSchema, ExtractionPipelineSchema, ExtractionPipelineListResponseSchema, DeleteExtractionPipelineResponseSchema, EXTRACT_INLINE_CONFIG_KEYS;
|
|
69690
|
-
var init_pipelines = __esm(() => {
|
|
69691
|
-
init_zod();
|
|
69692
|
-
init_extraction();
|
|
69693
|
-
init_grounding();
|
|
69694
|
-
init_model_options();
|
|
69695
69620
|
ExtractionPipelineIdSchema = exports_external.string().regex(/^oppl_[A-Za-z0-9_-]+$/, "pipeline_id must be an oppl_… id").max(128);
|
|
69696
69621
|
ExtractionPipelineNameSchema = exports_external.string().trim().min(1).max(128);
|
|
69697
69622
|
ExtractionPipelineSlugSchema = exports_external.string().trim().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/, "slug must be lowercase alphanumeric with _ or -");
|
|
@@ -69759,75 +69684,6 @@ var init_pipelines = __esm(() => {
|
|
|
69759
69684
|
"repair_attempts",
|
|
69760
69685
|
"grounding"
|
|
69761
69686
|
];
|
|
69762
|
-
});
|
|
69763
|
-
|
|
69764
|
-
// ../types/src/ocr/id-compat.ts
|
|
69765
|
-
function migratedOcrJobIdFromUuid(uuid3) {
|
|
69766
|
-
return `opj_${uuid3.toLowerCase().replace(/-/g, "")}`;
|
|
69767
|
-
}
|
|
69768
|
-
function legacyUuidFromMigratedOcrJobId(jobId) {
|
|
69769
|
-
const match = /^opj_([0-9a-f]{32})$/.exec(jobId);
|
|
69770
|
-
if (!match)
|
|
69771
|
-
return null;
|
|
69772
|
-
const hex3 = match[1];
|
|
69773
|
-
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-${hex3.slice(12, 16)}-${hex3.slice(16, 20)}-${hex3.slice(20)}`;
|
|
69774
|
-
}
|
|
69775
|
-
function normalizeOcrJobIdInput(id) {
|
|
69776
|
-
const trimmed = id.trim();
|
|
69777
|
-
if (LEGACY_OCR_JOB_UUID_PATTERN.test(trimmed)) {
|
|
69778
|
-
return migratedOcrJobIdFromUuid(trimmed);
|
|
69779
|
-
}
|
|
69780
|
-
return trimmed;
|
|
69781
|
-
}
|
|
69782
|
-
function ocrJobIdLookupCandidates(id) {
|
|
69783
|
-
const trimmed = id.trim();
|
|
69784
|
-
const canonical = normalizeOcrJobIdInput(trimmed);
|
|
69785
|
-
const out = new Set;
|
|
69786
|
-
if (trimmed.length > 0)
|
|
69787
|
-
out.add(trimmed);
|
|
69788
|
-
if (canonical.length > 0)
|
|
69789
|
-
out.add(canonical);
|
|
69790
|
-
const legacy = legacyUuidFromMigratedOcrJobId(canonical);
|
|
69791
|
-
if (legacy)
|
|
69792
|
-
out.add(legacy);
|
|
69793
|
-
return [...out];
|
|
69794
|
-
}
|
|
69795
|
-
function isOcrJobIdInput(id) {
|
|
69796
|
-
return JobIdInputSchema.safeParse(id).success;
|
|
69797
|
-
}
|
|
69798
|
-
function isPreferredOcrJobId(id) {
|
|
69799
|
-
return OCR_JOB_ID_PATTERN.test(id);
|
|
69800
|
-
}
|
|
69801
|
-
function normalizeOcrPipelineIdInput(id) {
|
|
69802
|
-
const trimmed = id.trim();
|
|
69803
|
-
if (trimmed.startsWith(LEGACY_OCR_PIPELINE_ID_PREFIX)) {
|
|
69804
|
-
return `oppl_${trimmed.slice(LEGACY_OCR_PIPELINE_ID_PREFIX.length)}`;
|
|
69805
|
-
}
|
|
69806
|
-
return trimmed;
|
|
69807
|
-
}
|
|
69808
|
-
function legacyOepFromMigratedOcrPipelineId(pipelineId) {
|
|
69809
|
-
if (!pipelineId.startsWith("oppl_"))
|
|
69810
|
-
return null;
|
|
69811
|
-
return `${LEGACY_OCR_PIPELINE_ID_PREFIX}${pipelineId.slice("oppl_".length)}`;
|
|
69812
|
-
}
|
|
69813
|
-
function ocrPipelineIdLookupCandidates(id) {
|
|
69814
|
-
const trimmed = id.trim();
|
|
69815
|
-
const canonical = normalizeOcrPipelineIdInput(trimmed);
|
|
69816
|
-
const out = new Set;
|
|
69817
|
-
if (trimmed.length > 0)
|
|
69818
|
-
out.add(trimmed);
|
|
69819
|
-
if (canonical.length > 0)
|
|
69820
|
-
out.add(canonical);
|
|
69821
|
-
const legacy = legacyOepFromMigratedOcrPipelineId(canonical);
|
|
69822
|
-
if (legacy)
|
|
69823
|
-
out.add(legacy);
|
|
69824
|
-
return [...out];
|
|
69825
|
-
}
|
|
69826
|
-
var LEGACY_OCR_JOB_UUID_PATTERN, JobIdInputSchema, LEGACY_OCR_PIPELINE_ID_PREFIX = "oep_", ExtractionPipelineIdInputSchema;
|
|
69827
|
-
var init_id_compat = __esm(() => {
|
|
69828
|
-
init_zod();
|
|
69829
|
-
init_job_id();
|
|
69830
|
-
init_pipelines();
|
|
69831
69687
|
LEGACY_OCR_JOB_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
69832
69688
|
JobIdInputSchema = exports_external.string().max(128).transform((value, ctx) => {
|
|
69833
69689
|
const normalized = normalizeOcrJobIdInput(value);
|
|
@@ -69852,12 +69708,6 @@ var init_id_compat = __esm(() => {
|
|
|
69852
69708
|
}
|
|
69853
69709
|
return parsed.data;
|
|
69854
69710
|
});
|
|
69855
|
-
});
|
|
69856
|
-
|
|
69857
|
-
// ../types/src/ocr/raw-result.ts
|
|
69858
|
-
var OCR_OUTPUT_FORMATS, OcrOutputFormatSchema, PaddleRawProfileSchema, RawParseResultSchema;
|
|
69859
|
-
var init_raw_result = __esm(() => {
|
|
69860
|
-
init_zod();
|
|
69861
69711
|
OCR_OUTPUT_FORMATS = ["openparser@1", "raw"];
|
|
69862
69712
|
OcrOutputFormatSchema = exports_external.enum(OCR_OUTPUT_FORMATS);
|
|
69863
69713
|
PaddleRawProfileSchema = exports_external.object({
|
|
@@ -69880,16 +69730,6 @@ var init_raw_result = __esm(() => {
|
|
|
69880
69730
|
profile: PaddleRawProfileSchema,
|
|
69881
69731
|
result: exports_external.record(exports_external.string(), exports_external.unknown())
|
|
69882
69732
|
}).strict();
|
|
69883
|
-
});
|
|
69884
|
-
|
|
69885
|
-
// ../types/src/ocr/suggest-schema.ts
|
|
69886
|
-
var SUGGEST_SCHEMA_HINT_MAX_CHARS = 500, SUGGEST_SCHEMA_PREVIEW_MAX_PAGES = 2, SUGGEST_SCHEMA_PREVIEW_MAX_CHARS = 24000, SUGGEST_SCHEMA_LLM_MODEL = "anthropic/claude-haiku-4.5", SuggestSchemaHintSchema, SuggestSchemaRequestSchema, SuggestSchemaResponseSchema, SuggestSchemaPreviewMetaSchema, SuggestSchemaTerminalResultSchema;
|
|
69887
|
-
var init_suggest_schema = __esm(() => {
|
|
69888
|
-
init_zod();
|
|
69889
|
-
init_extraction();
|
|
69890
|
-
init_id_compat();
|
|
69891
|
-
init_job_id();
|
|
69892
|
-
init_llm_models();
|
|
69893
69733
|
SuggestSchemaHintSchema = exports_external.string().min(1).max(SUGGEST_SCHEMA_HINT_MAX_CHARS);
|
|
69894
69734
|
SuggestSchemaRequestSchema = exports_external.object({
|
|
69895
69735
|
parse_job_id: JobIdInputSchema,
|
|
@@ -69916,19 +69756,6 @@ var init_suggest_schema = __esm(() => {
|
|
|
69916
69756
|
attempts: exports_external.array(ExtractionAttemptSchema).min(1),
|
|
69917
69757
|
usage: ExtractionUsageTotalsSchema.optional()
|
|
69918
69758
|
}).strict();
|
|
69919
|
-
});
|
|
69920
|
-
|
|
69921
|
-
// ../types/src/ocr/jobs.ts
|
|
69922
|
-
var OCR_OPENAPI_RELATIVE_PATH = "docs/OCR_API_OPENAPI.yaml", OCR_JOB_STATUSES, JobStatusSchema, OCR_JOB_OPERATIONS, JobOperationSchema, OCR_JOB_HISTORY_OPERATIONS, JobHistoryOperationSchema, JobFailureSchema, JobAcceptedSchema, BatchJobAcceptedSchema, BatchChildSummarySchema, BatchChildPageSchema, BatchSummaryCountsSchema, JobProgressSchema, RelatedExtractionSummarySchema, JobSchema, OCR_JOB_LIST_DEFAULT_LIMIT = 25, OCR_JOB_LIST_MAX_LIMIT = 100, JobSummarySchema, JobListResponseSchema, JobListQuerySchema, ErrorBodySchema, ErrorResponseSchema, OCR_SYNC_STATUS_CODES;
|
|
69923
|
-
var init_jobs = __esm(() => {
|
|
69924
|
-
init_zod();
|
|
69925
|
-
init_extraction();
|
|
69926
|
-
init_job_id();
|
|
69927
|
-
init_parsed_document();
|
|
69928
|
-
init_pipelines();
|
|
69929
|
-
init_raw_result();
|
|
69930
|
-
init_suggest_schema();
|
|
69931
|
-
init_job_id();
|
|
69932
69759
|
OCR_JOB_STATUSES = [
|
|
69933
69760
|
"queued",
|
|
69934
69761
|
"running",
|
|
@@ -70078,34 +69905,6 @@ var init_jobs = __esm(() => {
|
|
|
70078
69905
|
failed: 422,
|
|
70079
69906
|
indeterminate: 504
|
|
70080
69907
|
};
|
|
70081
|
-
});
|
|
70082
|
-
|
|
70083
|
-
// ../types/src/ocr/ocr-models.ts
|
|
70084
|
-
function getDefaultOcrModelId() {
|
|
70085
|
-
const defaults = OCR_MODEL_CATALOG.filter((entry) => entry.is_default);
|
|
70086
|
-
if (defaults.length !== 1) {
|
|
70087
|
-
throw new Error("OCR_MODEL_CATALOG must declare exactly one default model");
|
|
70088
|
-
}
|
|
70089
|
-
return defaults[0].id;
|
|
70090
|
-
}
|
|
70091
|
-
function getOcrModelUsdPerPage(modelId) {
|
|
70092
|
-
const entry = OCR_MODEL_CATALOG.find((model) => model.id === modelId);
|
|
70093
|
-
const usd = entry?.pricing.usd_per_page;
|
|
70094
|
-
if (usd == null || !Number.isFinite(usd) || usd < 0)
|
|
70095
|
-
return null;
|
|
70096
|
-
return usd;
|
|
70097
|
-
}
|
|
70098
|
-
function requireOcrModelUsdPerPage(modelId) {
|
|
70099
|
-
const usd = getOcrModelUsdPerPage(modelId);
|
|
70100
|
-
if (usd == null) {
|
|
70101
|
-
throw new Error(`OCR model ${modelId} is missing customer retail page pricing`);
|
|
70102
|
-
}
|
|
70103
|
-
return usd;
|
|
70104
|
-
}
|
|
70105
|
-
var OCR_MODELS, OcrModelAvailabilitySchema, OcrModelPricingBasisSchema, OcrModelPricingSchema, PADDLE_OCR_USD_PER_PAGE = 0.001, OcrModelCatalogEntrySchema, OcrModelsResponseSchema, PADDLE_OPTION_CAPABILITIES, OCR_MODEL_CATALOG;
|
|
70106
|
-
var init_ocr_models = __esm(() => {
|
|
70107
|
-
init_zod();
|
|
70108
|
-
init_model_options();
|
|
70109
69908
|
OCR_MODELS = ["paddleocr-vl-1.6"];
|
|
70110
69909
|
OcrModelAvailabilitySchema = exports_external.enum(["available", "degraded", "unavailable"]);
|
|
70111
69910
|
OcrModelPricingBasisSchema = exports_external.literal("customer_retail");
|
|
@@ -70158,47 +69957,8 @@ var init_ocr_models = __esm(() => {
|
|
|
70158
69957
|
availability: "available"
|
|
70159
69958
|
}
|
|
70160
69959
|
];
|
|
70161
|
-
});
|
|
70162
|
-
|
|
70163
|
-
// ../types/src/ocr/contracts.ts
|
|
70164
|
-
function requireExactlyOneSource(item, ctx) {
|
|
70165
|
-
const hasIndex = item.file_index !== undefined;
|
|
70166
|
-
const hasFileId = item.file_id !== undefined;
|
|
70167
|
-
if (hasIndex === hasFileId) {
|
|
70168
|
-
ctx.addIssue({
|
|
70169
|
-
code: "custom",
|
|
70170
|
-
message: "each batch item requires exactly one of file_index or file_id",
|
|
70171
|
-
path: hasIndex ? ["file_id"] : ["file_index"]
|
|
70172
|
-
});
|
|
70173
|
-
}
|
|
70174
|
-
}
|
|
70175
|
-
function getOpenParserRoute(method, path) {
|
|
70176
|
-
const normalizedMethod = method.toLowerCase();
|
|
70177
|
-
return OPENPARSER_ROUTE_MANIFEST.find((route) => {
|
|
70178
|
-
if (route.method !== normalizedMethod)
|
|
70179
|
-
return false;
|
|
70180
|
-
const pattern = route.path.replace(/\{[^/]+\}/g, "[^/]+");
|
|
70181
|
-
return new RegExp(`^${pattern}$`).test(path);
|
|
70182
|
-
});
|
|
70183
|
-
}
|
|
70184
|
-
var OcrModelSchema, OcrFileIdSchema, RepairAttemptsSchema, ExtractionJsonSchemaObjectSchema, ParseRequestSchema, ExtractRequestSchema, ParseBatchItemSchema, ExtractBatchItemSchema, ParseBatchRequestSchema, ExtractBatchRequestSchema, PublicFileSchema, DeleteFileResponseSchema, OpenParserParseResultSchema, OPENPARSER_COMPONENT_SCHEMAS, admissionErrors, OPENPARSER_ROUTE_MANIFEST;
|
|
70185
|
-
var init_contracts = __esm(() => {
|
|
70186
|
-
init_zod();
|
|
70187
|
-
init_extraction();
|
|
70188
|
-
init_grounding();
|
|
70189
|
-
init_id_compat();
|
|
70190
|
-
init_jobs();
|
|
70191
|
-
init_llm_models();
|
|
70192
|
-
init_model_options();
|
|
70193
|
-
init_ocr_models();
|
|
70194
|
-
init_parsed_document();
|
|
70195
|
-
init_pipelines();
|
|
70196
|
-
init_raw_result();
|
|
70197
|
-
init_suggest_schema();
|
|
70198
|
-
init_suggest_schema();
|
|
70199
|
-
init_pipelines();
|
|
70200
69960
|
OcrModelSchema = exports_external.string().min(1).max(128);
|
|
70201
|
-
OcrFileIdSchema = exports_external.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/, "file_id must be a valid
|
|
69961
|
+
OcrFileIdSchema = exports_external.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/, "file_id must be a valid OpenParser file id");
|
|
70202
69962
|
RepairAttemptsSchema = exports_external.number().int().min(0).max(2).default(0);
|
|
70203
69963
|
ExtractionJsonSchemaObjectSchema = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
70204
69964
|
ParseRequestSchema = exports_external.object({
|
|
@@ -70724,65 +70484,218 @@ var init_contracts = __esm(() => {
|
|
|
70724
70484
|
];
|
|
70725
70485
|
});
|
|
70726
70486
|
|
|
70727
|
-
// ../types/src/ocr
|
|
70728
|
-
|
|
70729
|
-
|
|
70730
|
-
|
|
70731
|
-
|
|
70732
|
-
|
|
70487
|
+
// ../types/src/private/ocr-figure-assets.ts
|
|
70488
|
+
var OcrFigureAssetsModeSchema;
|
|
70489
|
+
var init_ocr_figure_assets = __esm(() => {
|
|
70490
|
+
init_zod();
|
|
70491
|
+
OcrFigureAssetsModeSchema = exports_external.enum(["none", "stored"]);
|
|
70492
|
+
});
|
|
70493
|
+
|
|
70494
|
+
// ../types/src/private/ocr-id-lookup.ts
|
|
70495
|
+
function legacyUuidFromMigratedOcrJobId(jobId) {
|
|
70496
|
+
const match = /^opj_([0-9a-f]{32})$/.exec(jobId);
|
|
70497
|
+
if (!match)
|
|
70498
|
+
return null;
|
|
70499
|
+
const hex3 = match[1];
|
|
70500
|
+
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-${hex3.slice(12, 16)}-${hex3.slice(16, 20)}-${hex3.slice(20)}`;
|
|
70733
70501
|
}
|
|
70734
|
-
function
|
|
70735
|
-
|
|
70502
|
+
function ocrJobIdLookupCandidates(id) {
|
|
70503
|
+
const trimmed = id.trim();
|
|
70504
|
+
const canonical = normalizeOcrJobIdInput(trimmed);
|
|
70505
|
+
const out = new Set;
|
|
70506
|
+
if (trimmed.length > 0)
|
|
70507
|
+
out.add(trimmed);
|
|
70508
|
+
if (canonical.length > 0)
|
|
70509
|
+
out.add(canonical);
|
|
70510
|
+
const legacy = legacyUuidFromMigratedOcrJobId(canonical);
|
|
70511
|
+
if (legacy)
|
|
70512
|
+
out.add(legacy);
|
|
70513
|
+
return [...out];
|
|
70736
70514
|
}
|
|
70737
|
-
function
|
|
70738
|
-
|
|
70515
|
+
function legacyOepFromMigratedOcrPipelineId(pipelineId) {
|
|
70516
|
+
if (!pipelineId.startsWith("oppl_"))
|
|
70517
|
+
return null;
|
|
70518
|
+
return `${LEGACY_OCR_PIPELINE_ID_PREFIX}${pipelineId.slice("oppl_".length)}`;
|
|
70739
70519
|
}
|
|
70740
|
-
function
|
|
70741
|
-
const
|
|
70742
|
-
const
|
|
70743
|
-
|
|
70744
|
-
|
|
70745
|
-
|
|
70746
|
-
|
|
70747
|
-
|
|
70748
|
-
|
|
70749
|
-
|
|
70750
|
-
|
|
70520
|
+
function ocrPipelineIdLookupCandidates(id) {
|
|
70521
|
+
const trimmed = id.trim();
|
|
70522
|
+
const canonical = normalizeOcrPipelineIdInput(trimmed);
|
|
70523
|
+
const out = new Set;
|
|
70524
|
+
if (trimmed.length > 0)
|
|
70525
|
+
out.add(trimmed);
|
|
70526
|
+
if (canonical.length > 0)
|
|
70527
|
+
out.add(canonical);
|
|
70528
|
+
const legacy = legacyOepFromMigratedOcrPipelineId(canonical);
|
|
70529
|
+
if (legacy)
|
|
70530
|
+
out.add(legacy);
|
|
70531
|
+
return [...out];
|
|
70751
70532
|
}
|
|
70752
|
-
|
|
70753
|
-
|
|
70754
|
-
|
|
70755
|
-
|
|
70756
|
-
|
|
70757
|
-
|
|
70758
|
-
|
|
70533
|
+
var init_ocr_id_lookup = __esm(() => {
|
|
70534
|
+
init_dist();
|
|
70535
|
+
});
|
|
70536
|
+
|
|
70537
|
+
// ../types/src/private/ocr-llm.ts
|
|
70538
|
+
function getDefaultOcrLlmModelId() {
|
|
70539
|
+
const defaults = OCR_LLM_EMERGENCY_CATALOG.filter((entry) => entry.is_default);
|
|
70540
|
+
if (defaults.length !== 1) {
|
|
70541
|
+
throw new Error("OCR_LLM_EMERGENCY_CATALOG must declare exactly one default model");
|
|
70542
|
+
}
|
|
70543
|
+
return defaults[0].id;
|
|
70759
70544
|
}
|
|
70760
|
-
function
|
|
70761
|
-
|
|
70762
|
-
|
|
70763
|
-
|
|
70764
|
-
|
|
70765
|
-
|
|
70766
|
-
}
|
|
70545
|
+
function toCustomerRetailCatalogEntry(entry, markup = OCR_LLM_RETAIL_MARKUP) {
|
|
70546
|
+
if (entry.pricing.basis === "customer_retail") {
|
|
70547
|
+
return entry;
|
|
70548
|
+
}
|
|
70549
|
+
if (!Number.isFinite(markup) || markup <= 0) {
|
|
70550
|
+
throw new Error("OCR retail markup must be a positive finite number");
|
|
70551
|
+
}
|
|
70552
|
+
return {
|
|
70553
|
+
...entry,
|
|
70554
|
+
pricing: {
|
|
70555
|
+
prompt_usd_per_1m: entry.pricing.prompt_usd_per_1m * markup,
|
|
70556
|
+
completion_usd_per_1m: entry.pricing.completion_usd_per_1m * markup,
|
|
70557
|
+
basis: "customer_retail"
|
|
70558
|
+
}
|
|
70559
|
+
};
|
|
70560
|
+
}
|
|
70561
|
+
function toOcrLlmRequestSnapshot(input) {
|
|
70562
|
+
if (input.entry.pricing.basis !== "provider_list") {
|
|
70563
|
+
throw new Error("OCR LLM request snapshot requires provider_list pricing (refuse retail rates to avoid double markup)");
|
|
70564
|
+
}
|
|
70565
|
+
return {
|
|
70566
|
+
catalog_version: input.catalogVersion,
|
|
70567
|
+
model_id: input.entry.id,
|
|
70568
|
+
pricing: {
|
|
70569
|
+
prompt_usd_per_token: input.entry.pricing.prompt_usd_per_1m / 1e6,
|
|
70570
|
+
completion_usd_per_token: input.entry.pricing.completion_usd_per_1m / 1e6,
|
|
70571
|
+
source: "openrouter_provider_list"
|
|
70572
|
+
},
|
|
70573
|
+
reasoning_effort_requested: input.reasoningEffortRequested,
|
|
70574
|
+
reasoning_effort_resolved: input.reasoningEffortResolved
|
|
70575
|
+
};
|
|
70767
70576
|
}
|
|
70768
|
-
var
|
|
70769
|
-
var
|
|
70770
|
-
|
|
70577
|
+
var SUGGEST_SCHEMA_LLM_MODEL = "anthropic/claude-haiku-4.5", OcrLlmProviderListPricingBasisSchema, OcrLlmPricingBasisSchema, OCR_LLM_RETAIL_MARKUP = 2, OcrLlmProviderListPricingSchema, OcrLlmProviderCatalogEntrySchema, OcrLlmRequestSnapshotSchema, OCR_LLM_EMERGENCY_CATALOG, OCR_LLM_CATALOG, OCR_LLM_MODEL_IDS, OCR_LLM_CERTIFIED_MODEL_IDS, OCR_LLM_SUGGESTED_PROVIDERS, OCR_LLM_SUGGESTED_MAX_AGE_DAYS = 90;
|
|
70578
|
+
var init_ocr_llm = __esm(() => {
|
|
70579
|
+
init_dist();
|
|
70580
|
+
init_zod();
|
|
70581
|
+
OcrLlmProviderListPricingBasisSchema = exports_external.literal("provider_list");
|
|
70582
|
+
OcrLlmPricingBasisSchema = exports_external.enum(["customer_retail", "provider_list"]);
|
|
70583
|
+
OcrLlmProviderListPricingSchema = exports_external.object({
|
|
70584
|
+
prompt_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
70585
|
+
completion_usd_per_1m: exports_external.number().finite().nonnegative(),
|
|
70586
|
+
basis: OcrLlmProviderListPricingBasisSchema
|
|
70587
|
+
}).strict();
|
|
70588
|
+
OcrLlmProviderCatalogEntrySchema = OcrLlmModelCatalogEntrySchema.omit({
|
|
70589
|
+
pricing: true
|
|
70590
|
+
}).extend({
|
|
70591
|
+
pricing: OcrLlmProviderListPricingSchema
|
|
70592
|
+
});
|
|
70593
|
+
OcrLlmRequestSnapshotSchema = exports_external.object({
|
|
70594
|
+
catalog_version: exports_external.string().min(1),
|
|
70595
|
+
model_id: exports_external.string().min(1).max(200),
|
|
70596
|
+
pricing: exports_external.object({
|
|
70597
|
+
prompt_usd_per_token: exports_external.number().finite().nonnegative(),
|
|
70598
|
+
completion_usd_per_token: exports_external.number().finite().nonnegative(),
|
|
70599
|
+
source: exports_external.literal("openrouter_provider_list")
|
|
70600
|
+
}).strict(),
|
|
70601
|
+
reasoning_effort_requested: OcrLlmReasoningEffortRequestSchema.nullable(),
|
|
70602
|
+
reasoning_effort_resolved: OcrLlmReasoningEffortSchema.nullable()
|
|
70603
|
+
}).strict();
|
|
70604
|
+
OCR_LLM_EMERGENCY_CATALOG = [
|
|
70605
|
+
{
|
|
70606
|
+
id: "openai/gpt-5.6-terra",
|
|
70607
|
+
label: "GPT-5.6 Terra",
|
|
70608
|
+
provider: "openai",
|
|
70609
|
+
created_at: null,
|
|
70610
|
+
context_length: 1050000,
|
|
70611
|
+
pricing: {
|
|
70612
|
+
prompt_usd_per_1m: 2.5,
|
|
70613
|
+
completion_usd_per_1m: 15,
|
|
70614
|
+
basis: "provider_list"
|
|
70615
|
+
},
|
|
70616
|
+
recommendation: "suggested",
|
|
70617
|
+
is_default: true,
|
|
70618
|
+
certified_grounding: true,
|
|
70619
|
+
certified_suggest: true,
|
|
70620
|
+
supports_grounding: true,
|
|
70621
|
+
supports_suggest: true,
|
|
70622
|
+
pricing_known: true,
|
|
70623
|
+
reasoning: {
|
|
70624
|
+
supported_efforts: [
|
|
70625
|
+
"none",
|
|
70626
|
+
"low",
|
|
70627
|
+
"medium",
|
|
70628
|
+
"high",
|
|
70629
|
+
"xhigh",
|
|
70630
|
+
"max"
|
|
70631
|
+
],
|
|
70632
|
+
default_effort: "medium",
|
|
70633
|
+
mandatory: false,
|
|
70634
|
+
supports_max_tokens: false
|
|
70635
|
+
},
|
|
70636
|
+
deprecated_at: null
|
|
70637
|
+
},
|
|
70638
|
+
{
|
|
70639
|
+
id: "openai/gpt-4.1-mini",
|
|
70640
|
+
label: "GPT-4.1 Mini",
|
|
70641
|
+
provider: "openai",
|
|
70642
|
+
created_at: null,
|
|
70643
|
+
context_length: 1047576,
|
|
70644
|
+
pricing: {
|
|
70645
|
+
prompt_usd_per_1m: 0.4,
|
|
70646
|
+
completion_usd_per_1m: 1.6,
|
|
70647
|
+
basis: "provider_list"
|
|
70648
|
+
},
|
|
70649
|
+
recommendation: "suggested",
|
|
70650
|
+
is_default: false,
|
|
70651
|
+
certified_grounding: true,
|
|
70652
|
+
certified_suggest: true,
|
|
70653
|
+
supports_grounding: true,
|
|
70654
|
+
supports_suggest: true,
|
|
70655
|
+
pricing_known: true,
|
|
70656
|
+
reasoning: null,
|
|
70657
|
+
deprecated_at: null
|
|
70658
|
+
},
|
|
70659
|
+
{
|
|
70660
|
+
id: "openai/gpt-4.1",
|
|
70661
|
+
label: "GPT-4.1",
|
|
70662
|
+
provider: "openai",
|
|
70663
|
+
created_at: null,
|
|
70664
|
+
context_length: 1047576,
|
|
70665
|
+
pricing: {
|
|
70666
|
+
prompt_usd_per_1m: 2,
|
|
70667
|
+
completion_usd_per_1m: 8,
|
|
70668
|
+
basis: "provider_list"
|
|
70669
|
+
},
|
|
70670
|
+
recommendation: "suggested",
|
|
70671
|
+
is_default: false,
|
|
70672
|
+
certified_grounding: true,
|
|
70673
|
+
certified_suggest: true,
|
|
70674
|
+
supports_grounding: true,
|
|
70675
|
+
supports_suggest: true,
|
|
70676
|
+
pricing_known: true,
|
|
70677
|
+
reasoning: null,
|
|
70678
|
+
deprecated_at: null
|
|
70679
|
+
}
|
|
70680
|
+
];
|
|
70681
|
+
OCR_LLM_CATALOG = OCR_LLM_EMERGENCY_CATALOG;
|
|
70682
|
+
OCR_LLM_MODEL_IDS = OCR_LLM_EMERGENCY_CATALOG.map((entry) => entry.id);
|
|
70683
|
+
OCR_LLM_CERTIFIED_MODEL_IDS = OCR_LLM_EMERGENCY_CATALOG.filter((entry) => entry.certified_grounding || entry.certified_suggest).map((entry) => entry.id);
|
|
70684
|
+
OCR_LLM_SUGGESTED_PROVIDERS = [
|
|
70685
|
+
"openai",
|
|
70686
|
+
"anthropic",
|
|
70687
|
+
"google",
|
|
70688
|
+
"x-ai",
|
|
70689
|
+
"moonshotai"
|
|
70690
|
+
];
|
|
70771
70691
|
});
|
|
70772
70692
|
|
|
70773
70693
|
// ../types/src/ocr/index.ts
|
|
70774
70694
|
var init_ocr = __esm(() => {
|
|
70775
|
-
|
|
70776
|
-
|
|
70777
|
-
|
|
70778
|
-
|
|
70779
|
-
init_model_options();
|
|
70780
|
-
init_ocr_models();
|
|
70781
|
-
init_raw_result();
|
|
70782
|
-
init_request_examples();
|
|
70783
|
-
init_extraction();
|
|
70784
|
-
init_grounding();
|
|
70785
|
-
init_jobs();
|
|
70695
|
+
init_dist();
|
|
70696
|
+
init_ocr_figure_assets();
|
|
70697
|
+
init_ocr_id_lookup();
|
|
70698
|
+
init_ocr_llm();
|
|
70786
70699
|
});
|
|
70787
70700
|
|
|
70788
70701
|
// ../types/src/storage/s3-paths.ts
|
|
@@ -71501,7 +71414,6 @@ __export(exports_src, {
|
|
|
71501
71414
|
PositionedTextSchema: () => PositionedTextSchema,
|
|
71502
71415
|
PolygonSchema: () => PolygonSchema,
|
|
71503
71416
|
PointSchema: () => PointSchema,
|
|
71504
|
-
PipelineExtractionSchemaObjectSchema: () => PipelineExtractionSchemaObjectSchema,
|
|
71505
71417
|
PdfEmbedderOutputSchema: () => PdfEmbedderOutputSchema,
|
|
71506
71418
|
PdfEmbedderInputSchema: () => PdfEmbedderInputSchema,
|
|
71507
71419
|
PdfEmbedderConfigSchema: () => PdfEmbedderConfigSchema,
|
|
@@ -72526,7 +72438,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
72526
72438
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
72527
72439
|
value = value.valueOf();
|
|
72528
72440
|
}
|
|
72529
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
72441
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema2, sourceObjects } = ctx;
|
|
72530
72442
|
let ref = undefined;
|
|
72531
72443
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
72532
72444
|
ref = sourceObjects.get(value);
|
|
@@ -72540,7 +72452,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
72540
72452
|
}
|
|
72541
72453
|
if (tagName?.startsWith("!!"))
|
|
72542
72454
|
tagName = defaultTagPrefix + tagName.slice(2);
|
|
72543
|
-
let tagObj = findTagObject(value, tagName,
|
|
72455
|
+
let tagObj = findTagObject(value, tagName, schema2.tags);
|
|
72544
72456
|
if (!tagObj) {
|
|
72545
72457
|
if (value && typeof value.toJSON === "function") {
|
|
72546
72458
|
value = value.toJSON();
|
|
@@ -72551,7 +72463,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
72551
72463
|
ref.node = node2;
|
|
72552
72464
|
return node2;
|
|
72553
72465
|
}
|
|
72554
|
-
tagObj = value instanceof Map ?
|
|
72466
|
+
tagObj = value instanceof Map ? schema2[identity.MAP] : (Symbol.iterator in Object(value)) ? schema2[identity.SEQ] : schema2[identity.MAP];
|
|
72555
72467
|
}
|
|
72556
72468
|
if (onTagObj) {
|
|
72557
72469
|
onTagObj(tagObj);
|
|
@@ -72574,7 +72486,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
72574
72486
|
var createNode = require_createNode();
|
|
72575
72487
|
var identity = require_identity();
|
|
72576
72488
|
var Node = require_Node();
|
|
72577
|
-
function collectionFromPath(
|
|
72489
|
+
function collectionFromPath(schema2, path, value) {
|
|
72578
72490
|
let v = value;
|
|
72579
72491
|
for (let i = path.length - 1;i >= 0; --i) {
|
|
72580
72492
|
const k = path[i];
|
|
@@ -72592,27 +72504,27 @@ var require_Collection = __commonJS((exports) => {
|
|
|
72592
72504
|
onAnchor: () => {
|
|
72593
72505
|
throw new Error("This should not happen, please report a bug.");
|
|
72594
72506
|
},
|
|
72595
|
-
schema,
|
|
72507
|
+
schema: schema2,
|
|
72596
72508
|
sourceObjects: new Map
|
|
72597
72509
|
});
|
|
72598
72510
|
}
|
|
72599
72511
|
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
72600
72512
|
|
|
72601
72513
|
class Collection extends Node.NodeBase {
|
|
72602
|
-
constructor(type,
|
|
72514
|
+
constructor(type, schema2) {
|
|
72603
72515
|
super(type);
|
|
72604
72516
|
Object.defineProperty(this, "schema", {
|
|
72605
|
-
value:
|
|
72517
|
+
value: schema2,
|
|
72606
72518
|
configurable: true,
|
|
72607
72519
|
enumerable: false,
|
|
72608
72520
|
writable: true
|
|
72609
72521
|
});
|
|
72610
72522
|
}
|
|
72611
|
-
clone(
|
|
72523
|
+
clone(schema2) {
|
|
72612
72524
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
72613
|
-
if (
|
|
72614
|
-
copy.schema =
|
|
72615
|
-
copy.items = copy.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(
|
|
72525
|
+
if (schema2)
|
|
72526
|
+
copy.schema = schema2;
|
|
72527
|
+
copy.items = copy.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(schema2) : it);
|
|
72616
72528
|
if (this.range)
|
|
72617
72529
|
copy.range = this.range.slice();
|
|
72618
72530
|
return copy;
|
|
@@ -73548,12 +73460,12 @@ var require_Pair = __commonJS((exports) => {
|
|
|
73548
73460
|
this.key = key;
|
|
73549
73461
|
this.value = value;
|
|
73550
73462
|
}
|
|
73551
|
-
clone(
|
|
73463
|
+
clone(schema2) {
|
|
73552
73464
|
let { key, value } = this;
|
|
73553
73465
|
if (identity.isNode(key))
|
|
73554
|
-
key = key.clone(
|
|
73466
|
+
key = key.clone(schema2);
|
|
73555
73467
|
if (identity.isNode(value))
|
|
73556
|
-
value = value.clone(
|
|
73468
|
+
value = value.clone(schema2);
|
|
73557
73469
|
return new Pair(key, value);
|
|
73558
73470
|
}
|
|
73559
73471
|
toJSON(_, ctx) {
|
|
@@ -73745,13 +73657,13 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
73745
73657
|
static get tagName() {
|
|
73746
73658
|
return "tag:yaml.org,2002:map";
|
|
73747
73659
|
}
|
|
73748
|
-
constructor(
|
|
73749
|
-
super(identity.MAP,
|
|
73660
|
+
constructor(schema2) {
|
|
73661
|
+
super(identity.MAP, schema2);
|
|
73750
73662
|
this.items = [];
|
|
73751
73663
|
}
|
|
73752
|
-
static from(
|
|
73664
|
+
static from(schema2, obj, ctx) {
|
|
73753
73665
|
const { keepUndefined, replacer } = ctx;
|
|
73754
|
-
const map2 = new this(
|
|
73666
|
+
const map2 = new this(schema2);
|
|
73755
73667
|
const add2 = (key, value) => {
|
|
73756
73668
|
if (typeof replacer === "function")
|
|
73757
73669
|
value = replacer.call(obj, key, value);
|
|
@@ -73767,8 +73679,8 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
73767
73679
|
for (const key of Object.keys(obj))
|
|
73768
73680
|
add2(key, obj[key]);
|
|
73769
73681
|
}
|
|
73770
|
-
if (typeof
|
|
73771
|
-
map2.items.sort(
|
|
73682
|
+
if (typeof schema2.sortMapEntries === "function") {
|
|
73683
|
+
map2.items.sort(schema2.sortMapEntries);
|
|
73772
73684
|
}
|
|
73773
73685
|
return map2;
|
|
73774
73686
|
}
|
|
@@ -73861,7 +73773,7 @@ var require_map = __commonJS((exports) => {
|
|
|
73861
73773
|
onError("Expected a mapping for this tag");
|
|
73862
73774
|
return map3;
|
|
73863
73775
|
},
|
|
73864
|
-
createNode: (
|
|
73776
|
+
createNode: (schema2, obj, ctx) => YAMLMap.YAMLMap.from(schema2, obj, ctx)
|
|
73865
73777
|
};
|
|
73866
73778
|
exports.map = map2;
|
|
73867
73779
|
});
|
|
@@ -73879,8 +73791,8 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
73879
73791
|
static get tagName() {
|
|
73880
73792
|
return "tag:yaml.org,2002:seq";
|
|
73881
73793
|
}
|
|
73882
|
-
constructor(
|
|
73883
|
-
super(identity.SEQ,
|
|
73794
|
+
constructor(schema2) {
|
|
73795
|
+
super(identity.SEQ, schema2);
|
|
73884
73796
|
this.items = [];
|
|
73885
73797
|
}
|
|
73886
73798
|
add(value) {
|
|
@@ -73934,9 +73846,9 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
73934
73846
|
onComment
|
|
73935
73847
|
});
|
|
73936
73848
|
}
|
|
73937
|
-
static from(
|
|
73849
|
+
static from(schema2, obj, ctx) {
|
|
73938
73850
|
const { replacer } = ctx;
|
|
73939
|
-
const seq = new this(
|
|
73851
|
+
const seq = new this(schema2);
|
|
73940
73852
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
73941
73853
|
let i = 0;
|
|
73942
73854
|
for (let it of obj) {
|
|
@@ -73973,7 +73885,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
73973
73885
|
onError("Expected a sequence for this tag");
|
|
73974
73886
|
return seq2;
|
|
73975
73887
|
},
|
|
73976
|
-
createNode: (
|
|
73888
|
+
createNode: (schema2, obj, ctx) => YAMLSeq.YAMLSeq.from(schema2, obj, ctx)
|
|
73977
73889
|
};
|
|
73978
73890
|
exports.seq = seq;
|
|
73979
73891
|
});
|
|
@@ -74148,7 +74060,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
74148
74060
|
var bool = require_bool();
|
|
74149
74061
|
var float = require_float();
|
|
74150
74062
|
var int2 = require_int();
|
|
74151
|
-
var
|
|
74063
|
+
var schema2 = [
|
|
74152
74064
|
map2.map,
|
|
74153
74065
|
seq.seq,
|
|
74154
74066
|
string4.string,
|
|
@@ -74161,7 +74073,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
74161
74073
|
float.floatExp,
|
|
74162
74074
|
float.float
|
|
74163
74075
|
];
|
|
74164
|
-
exports.schema =
|
|
74076
|
+
exports.schema = schema2;
|
|
74165
74077
|
});
|
|
74166
74078
|
|
|
74167
74079
|
// ../../node_modules/yaml/dist/schema/json/schema.js
|
|
@@ -74224,8 +74136,8 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
74224
74136
|
return str;
|
|
74225
74137
|
}
|
|
74226
74138
|
};
|
|
74227
|
-
var
|
|
74228
|
-
exports.schema =
|
|
74139
|
+
var schema2 = [map2.map, seq.seq].concat(jsonScalars, jsonError);
|
|
74140
|
+
exports.schema = schema2;
|
|
74229
74141
|
});
|
|
74230
74142
|
|
|
74231
74143
|
// ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
@@ -74315,9 +74227,9 @@ ${cn.comment}` : item.comment;
|
|
|
74315
74227
|
onError("Expected a sequence for this tag");
|
|
74316
74228
|
return seq;
|
|
74317
74229
|
}
|
|
74318
|
-
function createPairs(
|
|
74230
|
+
function createPairs(schema2, iterable, ctx) {
|
|
74319
74231
|
const { replacer } = ctx;
|
|
74320
|
-
const pairs2 = new YAMLSeq.YAMLSeq(
|
|
74232
|
+
const pairs2 = new YAMLSeq.YAMLSeq(schema2);
|
|
74321
74233
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
74322
74234
|
let i = 0;
|
|
74323
74235
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
@@ -74396,8 +74308,8 @@ var require_omap = __commonJS((exports) => {
|
|
|
74396
74308
|
}
|
|
74397
74309
|
return map2;
|
|
74398
74310
|
}
|
|
74399
|
-
static from(
|
|
74400
|
-
const pairs$1 = pairs.createPairs(
|
|
74311
|
+
static from(schema2, iterable, ctx) {
|
|
74312
|
+
const pairs$1 = pairs.createPairs(schema2, iterable, ctx);
|
|
74401
74313
|
const omap2 = new this;
|
|
74402
74314
|
omap2.items = pairs$1.items;
|
|
74403
74315
|
return omap2;
|
|
@@ -74424,7 +74336,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
74424
74336
|
}
|
|
74425
74337
|
return Object.assign(new YAMLOMap, pairs$1);
|
|
74426
74338
|
},
|
|
74427
|
-
createNode: (
|
|
74339
|
+
createNode: (schema2, iterable, ctx) => YAMLOMap.from(schema2, iterable, ctx)
|
|
74428
74340
|
};
|
|
74429
74341
|
exports.YAMLOMap = YAMLOMap;
|
|
74430
74342
|
exports.omap = omap;
|
|
@@ -74588,8 +74500,8 @@ var require_set = __commonJS((exports) => {
|
|
|
74588
74500
|
var YAMLMap = require_YAMLMap();
|
|
74589
74501
|
|
|
74590
74502
|
class YAMLSet extends YAMLMap.YAMLMap {
|
|
74591
|
-
constructor(
|
|
74592
|
-
super(
|
|
74503
|
+
constructor(schema2) {
|
|
74504
|
+
super(schema2);
|
|
74593
74505
|
this.tag = YAMLSet.tag;
|
|
74594
74506
|
}
|
|
74595
74507
|
add(key) {
|
|
@@ -74629,9 +74541,9 @@ var require_set = __commonJS((exports) => {
|
|
|
74629
74541
|
else
|
|
74630
74542
|
throw new Error("Set items must all have null values");
|
|
74631
74543
|
}
|
|
74632
|
-
static from(
|
|
74544
|
+
static from(schema2, iterable, ctx) {
|
|
74633
74545
|
const { replacer } = ctx;
|
|
74634
|
-
const set3 = new this(
|
|
74546
|
+
const set3 = new this(schema2);
|
|
74635
74547
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
74636
74548
|
for (let value of iterable) {
|
|
74637
74549
|
if (typeof replacer === "function")
|
|
@@ -74648,7 +74560,7 @@ var require_set = __commonJS((exports) => {
|
|
|
74648
74560
|
nodeClass: YAMLSet,
|
|
74649
74561
|
default: false,
|
|
74650
74562
|
tag: "tag:yaml.org,2002:set",
|
|
74651
|
-
createNode: (
|
|
74563
|
+
createNode: (schema2, iterable, ctx) => YAMLSet.from(schema2, iterable, ctx),
|
|
74652
74564
|
resolve(map2, onError) {
|
|
74653
74565
|
if (identity.isMap(map2)) {
|
|
74654
74566
|
if (map2.hasAllNullValues(true))
|
|
@@ -74761,7 +74673,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
74761
74673
|
var pairs = require_pairs();
|
|
74762
74674
|
var set2 = require_set();
|
|
74763
74675
|
var timestamp = require_timestamp();
|
|
74764
|
-
var
|
|
74676
|
+
var schema2 = [
|
|
74765
74677
|
map2.map,
|
|
74766
74678
|
seq.seq,
|
|
74767
74679
|
string4.string,
|
|
@@ -74784,7 +74696,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
74784
74696
|
timestamp.floatTime,
|
|
74785
74697
|
timestamp.timestamp
|
|
74786
74698
|
];
|
|
74787
|
-
exports.schema =
|
|
74699
|
+
exports.schema = schema2;
|
|
74788
74700
|
});
|
|
74789
74701
|
|
|
74790
74702
|
// ../../node_modules/yaml/dist/schema/tags.js
|
|
@@ -74796,7 +74708,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
74796
74708
|
var bool = require_bool();
|
|
74797
74709
|
var float = require_float();
|
|
74798
74710
|
var int2 = require_int();
|
|
74799
|
-
var
|
|
74711
|
+
var schema2 = require_schema();
|
|
74800
74712
|
var schema$1 = require_schema2();
|
|
74801
74713
|
var binary = require_binary();
|
|
74802
74714
|
var merge3 = require_merge();
|
|
@@ -74806,7 +74718,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
74806
74718
|
var set2 = require_set();
|
|
74807
74719
|
var timestamp = require_timestamp();
|
|
74808
74720
|
var schemas3 = new Map([
|
|
74809
|
-
["core",
|
|
74721
|
+
["core", schema2.schema],
|
|
74810
74722
|
["failsafe", [map2.map, seq.seq, string4.string]],
|
|
74811
74723
|
["json", schema$1.schema],
|
|
74812
74724
|
["yaml11", schema$2.schema],
|
|
@@ -74888,9 +74800,9 @@ var require_Schema = __commonJS((exports) => {
|
|
|
74888
74800
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
74889
74801
|
|
|
74890
74802
|
class Schema {
|
|
74891
|
-
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
74803
|
+
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema: schema2, sortMapEntries, toStringDefaults }) {
|
|
74892
74804
|
this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
|
|
74893
|
-
this.name = typeof
|
|
74805
|
+
this.name = typeof schema2 === "string" && schema2 || "core";
|
|
74894
74806
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
74895
74807
|
this.tags = tags.getTags(customTags, this.name, merge3);
|
|
74896
74808
|
this.toStringOptions = toStringDefaults ?? null;
|
|
@@ -76383,11 +76295,11 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
76383
76295
|
scalar.comment = comment;
|
|
76384
76296
|
return scalar;
|
|
76385
76297
|
}
|
|
76386
|
-
function findScalarTagByName(
|
|
76298
|
+
function findScalarTagByName(schema2, value, tagName, tagToken, onError) {
|
|
76387
76299
|
if (tagName === "!")
|
|
76388
|
-
return
|
|
76300
|
+
return schema2[identity.SCALAR];
|
|
76389
76301
|
const matchWithTest = [];
|
|
76390
|
-
for (const tag of
|
|
76302
|
+
for (const tag of schema2.tags) {
|
|
76391
76303
|
if (!tag.collection && tag.tag === tagName) {
|
|
76392
76304
|
if (tag.default && tag.test)
|
|
76393
76305
|
matchWithTest.push(tag);
|
|
@@ -76398,18 +76310,18 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
76398
76310
|
for (const tag of matchWithTest)
|
|
76399
76311
|
if (tag.test?.test(value))
|
|
76400
76312
|
return tag;
|
|
76401
|
-
const kt =
|
|
76313
|
+
const kt = schema2.knownTags[tagName];
|
|
76402
76314
|
if (kt && !kt.collection) {
|
|
76403
|
-
|
|
76315
|
+
schema2.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
|
|
76404
76316
|
return kt;
|
|
76405
76317
|
}
|
|
76406
76318
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
76407
|
-
return
|
|
76319
|
+
return schema2[identity.SCALAR];
|
|
76408
76320
|
}
|
|
76409
|
-
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
76410
|
-
const tag =
|
|
76411
|
-
if (
|
|
76412
|
-
const compat2 =
|
|
76321
|
+
function findScalarTagByTest({ atKey, directives, schema: schema2 }, value, token, onError) {
|
|
76322
|
+
const tag = schema2.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema2[identity.SCALAR];
|
|
76323
|
+
if (schema2.compat) {
|
|
76324
|
+
const compat2 = schema2.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema2[identity.SCALAR];
|
|
76413
76325
|
if (tag.tag !== compat2.tag) {
|
|
76414
76326
|
const ts = directives.tagString(tag.tag);
|
|
76415
76327
|
const cs = directives.tagString(compat2.tag);
|
|
@@ -78904,7 +78816,7 @@ var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE,
|
|
|
78904
78816
|
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
78905
78817
|
};
|
|
78906
78818
|
}, dist_default;
|
|
78907
|
-
var
|
|
78819
|
+
var init_dist2 = __esm(() => {
|
|
78908
78820
|
init_utils2();
|
|
78909
78821
|
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
78910
78822
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
@@ -78921,8 +78833,8 @@ var init_dist = __esm(() => {
|
|
|
78921
78833
|
var NO_TRUNCATION2, fastStringWidth = (input, options = {}) => {
|
|
78922
78834
|
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
78923
78835
|
}, dist_default2;
|
|
78924
|
-
var
|
|
78925
|
-
|
|
78836
|
+
var init_dist3 = __esm(() => {
|
|
78837
|
+
init_dist2();
|
|
78926
78838
|
NO_TRUNCATION2 = {
|
|
78927
78839
|
limit: Infinity,
|
|
78928
78840
|
ellipsis: "",
|
|
@@ -79128,7 +79040,7 @@ var ESC = "\x1B", CSI = "", END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI
|
|
|
79128
79040
|
return returnValue;
|
|
79129
79041
|
}, CRLF_OR_LF;
|
|
79130
79042
|
var init_main = __esm(() => {
|
|
79131
|
-
|
|
79043
|
+
init_dist3();
|
|
79132
79044
|
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
79133
79045
|
GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
79134
79046
|
CRLF_OR_LF = /\r?\n/;
|
|
@@ -79476,7 +79388,7 @@ var import_sisteransi, G, K, h, Y, k, A = (r) => ("columns" in r) && typeof r.co
|
|
|
79476
79388
|
}
|
|
79477
79389
|
}
|
|
79478
79390
|
}, Q, X, Z, et, it, rt, nt, ot, ut, at, ht;
|
|
79479
|
-
var
|
|
79391
|
+
var init_dist4 = __esm(() => {
|
|
79480
79392
|
init_main();
|
|
79481
79393
|
import_sisteransi = __toESM(require_src2(), 1);
|
|
79482
79394
|
G = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
@@ -80816,11 +80728,11 @@ ${c2}
|
|
|
80816
80728
|
}
|
|
80817
80729
|
}
|
|
80818
80730
|
} }).prompt();
|
|
80819
|
-
var
|
|
80820
|
-
|
|
80821
|
-
|
|
80731
|
+
var init_dist5 = __esm(() => {
|
|
80732
|
+
init_dist4();
|
|
80733
|
+
init_dist4();
|
|
80822
80734
|
init_main();
|
|
80823
|
-
|
|
80735
|
+
init_dist3();
|
|
80824
80736
|
import_sisteransi2 = __toESM(require_src2(), 1);
|
|
80825
80737
|
tt2 = te();
|
|
80826
80738
|
_t = w2("◆", "*");
|
|
@@ -169674,11 +169586,11 @@ function chooseDescription(descriptions, printWidth) {
|
|
|
169674
169586
|
return firstWidth > printWidth && firstWidth > secondWidth ? secondDescription : firstDescription;
|
|
169675
169587
|
}
|
|
169676
169588
|
function createSchema(SchemaConstructor, parameters) {
|
|
169677
|
-
const
|
|
169678
|
-
const subSchema = Object.create(
|
|
169589
|
+
const schema2 = new SchemaConstructor(parameters);
|
|
169590
|
+
const subSchema = Object.create(schema2);
|
|
169679
169591
|
for (const handlerKey of HANDLER_KEYS) {
|
|
169680
169592
|
if (handlerKey in parameters) {
|
|
169681
|
-
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey],
|
|
169593
|
+
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema2, Schema.prototype[handlerKey].length);
|
|
169682
169594
|
}
|
|
169683
169595
|
}
|
|
169684
169596
|
return subSchema;
|
|
@@ -173018,9 +172930,9 @@ function optionInfoToSchema(optionInfo, {
|
|
|
173018
172930
|
throw new Error(`Unexpected type ${optionInfo.type}`);
|
|
173019
172931
|
}
|
|
173020
172932
|
if (optionInfo.exception) {
|
|
173021
|
-
parameters.validate = (value,
|
|
172933
|
+
parameters.validate = (value, schema2, utils2) => optionInfo.exception(value) || schema2.validate(value, utils2);
|
|
173022
172934
|
} else {
|
|
173023
|
-
parameters.validate = (value,
|
|
172935
|
+
parameters.validate = (value, schema2, utils2) => value === undefined || schema2.validate(value, utils2);
|
|
173024
172936
|
}
|
|
173025
172937
|
if (optionInfo.redirect) {
|
|
173026
172938
|
handlers.redirect = (value) => !value ? undefined : {
|
|
@@ -173035,7 +172947,7 @@ function optionInfoToSchema(optionInfo, {
|
|
|
173035
172947
|
}
|
|
173036
172948
|
if (isCLI && !optionInfo.array) {
|
|
173037
172949
|
const originalPreprocess = parameters.preprocess || ((x10) => x10);
|
|
173038
|
-
parameters.preprocess = (value,
|
|
172950
|
+
parameters.preprocess = (value, schema2, utils2) => schema2.preprocess(originalPreprocess(Array.isArray(value) ? method_at_default2(0, value, -1) : value), utils2);
|
|
173039
172951
|
}
|
|
173040
172952
|
return optionInfo.array ? ArraySchema.create({
|
|
173041
172953
|
...isCLI ? {
|
|
@@ -174612,9 +174524,9 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174612
174524
|
};
|
|
174613
174525
|
applyNormalization();
|
|
174614
174526
|
for (const key2 of Object.keys(this._utils.schemas)) {
|
|
174615
|
-
const
|
|
174527
|
+
const schema2 = this._utils.schemas[key2];
|
|
174616
174528
|
if (!(key2 in newOptions)) {
|
|
174617
|
-
const defaultResult = normalizeDefaultResult(
|
|
174529
|
+
const defaultResult = normalizeDefaultResult(schema2.default(this._utils));
|
|
174618
174530
|
if ("value" in defaultResult) {
|
|
174619
174531
|
restOptionsArray.push({ [key2]: defaultResult.value });
|
|
174620
174532
|
}
|
|
@@ -174625,13 +174537,13 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174625
174537
|
if (!(key2 in newOptions)) {
|
|
174626
174538
|
continue;
|
|
174627
174539
|
}
|
|
174628
|
-
const
|
|
174540
|
+
const schema2 = this._utils.schemas[key2];
|
|
174629
174541
|
const value = newOptions[key2];
|
|
174630
|
-
const newValue =
|
|
174542
|
+
const newValue = schema2.postprocess(value, this._utils);
|
|
174631
174543
|
if (newValue === VALUE_UNCHANGED) {
|
|
174632
174544
|
continue;
|
|
174633
174545
|
}
|
|
174634
|
-
this._applyValidation(newValue, key2,
|
|
174546
|
+
this._applyValidation(newValue, key2, schema2);
|
|
174635
174547
|
newOptions[key2] = newValue;
|
|
174636
174548
|
}
|
|
174637
174549
|
this._applyPostprocess(newOptions);
|
|
@@ -174642,14 +174554,14 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174642
174554
|
const transferredOptionsArray = [];
|
|
174643
174555
|
const { knownKeys, unknownKeys } = this._partitionOptionKeys(options8);
|
|
174644
174556
|
for (const key2 of knownKeys) {
|
|
174645
|
-
const
|
|
174646
|
-
const value =
|
|
174647
|
-
this._applyValidation(value, key2,
|
|
174557
|
+
const schema2 = this._utils.schemas[key2];
|
|
174558
|
+
const value = schema2.preprocess(options8[key2], this._utils);
|
|
174559
|
+
this._applyValidation(value, key2, schema2);
|
|
174648
174560
|
const appendTransferredOptions = ({ from, to: to5 }) => {
|
|
174649
174561
|
transferredOptionsArray.push(typeof to5 === "string" ? { [to5]: from } : { [to5.key]: to5.value });
|
|
174650
174562
|
};
|
|
174651
174563
|
const warnDeprecated = ({ value: currentValue, redirectTo }) => {
|
|
174652
|
-
const deprecatedResult = normalizeDeprecatedResult(
|
|
174564
|
+
const deprecatedResult = normalizeDeprecatedResult(schema2.deprecated(currentValue, this._utils), value, true);
|
|
174653
174565
|
if (deprecatedResult === false) {
|
|
174654
174566
|
return;
|
|
174655
174567
|
}
|
|
@@ -174667,13 +174579,13 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174667
174579
|
}
|
|
174668
174580
|
}
|
|
174669
174581
|
};
|
|
174670
|
-
const forwardResult = normalizeForwardResult(
|
|
174582
|
+
const forwardResult = normalizeForwardResult(schema2.forward(value, this._utils), value);
|
|
174671
174583
|
forwardResult.forEach(appendTransferredOptions);
|
|
174672
|
-
const redirectResult = normalizeRedirectResult(
|
|
174584
|
+
const redirectResult = normalizeRedirectResult(schema2.redirect(value, this._utils), value);
|
|
174673
174585
|
redirectResult.redirect.forEach(appendTransferredOptions);
|
|
174674
174586
|
if ("remain" in redirectResult) {
|
|
174675
174587
|
const remainingValue = redirectResult.remain;
|
|
174676
|
-
newOptions[key2] = key2 in newOptions ?
|
|
174588
|
+
newOptions[key2] = key2 in newOptions ? schema2.overlap(newOptions[key2], remainingValue, this._utils) : remainingValue;
|
|
174677
174589
|
warnDeprecated({ value: remainingValue });
|
|
174678
174590
|
}
|
|
174679
174591
|
for (const { from, to: to5 } of redirectResult.redirect) {
|
|
@@ -174701,8 +174613,8 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174701
174613
|
const [knownKeys, unknownKeys] = partition(Object.keys(options8).filter((key2) => !this._identifyMissing(key2, options8)), (key2) => (key2 in this._utils.schemas));
|
|
174702
174614
|
return { knownKeys, unknownKeys };
|
|
174703
174615
|
}
|
|
174704
|
-
_applyValidation(value, key2,
|
|
174705
|
-
const validateResult = normalizeValidateResult(
|
|
174616
|
+
_applyValidation(value, key2, schema2) {
|
|
174617
|
+
const validateResult = normalizeValidateResult(schema2.validate(value, this._utils), value);
|
|
174706
174618
|
if (validateResult !== true) {
|
|
174707
174619
|
throw this._invalidHandler(key2, validateResult.value, this._utils);
|
|
174708
174620
|
}
|
|
@@ -174744,8 +174656,8 @@ var require3, __filename2, __dirname2, __create2, __defProp3, __getOwnPropDesc,
|
|
|
174744
174656
|
for (const key2 of unknownKeys) {
|
|
174745
174657
|
const value = postprocessed.override[key2];
|
|
174746
174658
|
this._applyUnknownHandler(key2, value, options8, (knownResultKey, knownResultValue) => {
|
|
174747
|
-
const
|
|
174748
|
-
this._applyValidation(knownResultValue, knownResultKey,
|
|
174659
|
+
const schema2 = this._utils.schemas[knownResultKey];
|
|
174660
|
+
this._applyValidation(knownResultValue, knownResultKey, schema2);
|
|
174749
174661
|
options8[knownResultKey] = knownResultValue;
|
|
174750
174662
|
});
|
|
174751
174663
|
}
|
|
@@ -186538,7 +186450,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
186538
186450
|
// package.json
|
|
186539
186451
|
var package_default = {
|
|
186540
186452
|
name: "@eigenpal/cli",
|
|
186541
|
-
version: "0.10.
|
|
186453
|
+
version: "0.10.42",
|
|
186542
186454
|
description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
|
|
186543
186455
|
keywords: [
|
|
186544
186456
|
"eigenpal",
|
|
@@ -188233,7 +188145,7 @@ async function readSecretInput(opts) {
|
|
|
188233
188145
|
if (opts.valueFile)
|
|
188234
188146
|
return readFileSync5(opts.valueFile, "utf8").replace(/\n$/, "");
|
|
188235
188147
|
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
188236
|
-
const { password, isCancel, cancel } = await Promise.resolve().then(() => (
|
|
188148
|
+
const { password, isCancel, cancel } = await Promise.resolve().then(() => (init_dist5(), exports_dist));
|
|
188237
188149
|
const answer = await password({ message: "Secret value" });
|
|
188238
188150
|
if (isCancel(answer)) {
|
|
188239
188151
|
cancel("Cancelled");
|
|
@@ -190207,8 +190119,8 @@ async function loadOptionalWorkspaceSchema(agentDir, filename, errors3) {
|
|
|
190207
190119
|
return null;
|
|
190208
190120
|
return JSON.parse(raw);
|
|
190209
190121
|
}
|
|
190210
|
-
function schemaProperties(
|
|
190211
|
-
const props =
|
|
190122
|
+
function schemaProperties(schema2) {
|
|
190123
|
+
const props = schema2.properties;
|
|
190212
190124
|
if (!props || typeof props !== "object" || Array.isArray(props))
|
|
190213
190125
|
return {};
|
|
190214
190126
|
return props;
|
|
@@ -190243,8 +190155,8 @@ function allowFileRefsInSchema(node) {
|
|
|
190243
190155
|
out[key] = allowFileRefsInSchema(value);
|
|
190244
190156
|
return out;
|
|
190245
190157
|
}
|
|
190246
|
-
function validateValuesAgainstSchemaProps(data,
|
|
190247
|
-
const props = schemaProperties(
|
|
190158
|
+
function validateValuesAgainstSchemaProps(data, schema2, label) {
|
|
190159
|
+
const props = schemaProperties(schema2);
|
|
190248
190160
|
const errors3 = [];
|
|
190249
190161
|
for (const [key, value] of Object.entries(data)) {
|
|
190250
190162
|
const propSchema = props[key];
|
|
@@ -190258,9 +190170,9 @@ function validateValuesAgainstSchemaProps(data, schema, label) {
|
|
|
190258
190170
|
}
|
|
190259
190171
|
return errors3;
|
|
190260
190172
|
}
|
|
190261
|
-
function validateValueAgainstSchema(value,
|
|
190173
|
+
function validateValueAgainstSchema(value, schema2, label) {
|
|
190262
190174
|
try {
|
|
190263
|
-
const validate = eigenpalAjv.compile(
|
|
190175
|
+
const validate = eigenpalAjv.compile(schema2);
|
|
190264
190176
|
if (validate(value))
|
|
190265
190177
|
return [];
|
|
190266
190178
|
return (validate.errors ?? []).map((err2) => {
|
|
@@ -193025,7 +192937,7 @@ async function validateAgentCommand(dir = ".", opts) {
|
|
|
193025
192937
|
}
|
|
193026
192938
|
|
|
193027
192939
|
// src/commands/auth/index.ts
|
|
193028
|
-
|
|
192940
|
+
init_dist5();
|
|
193029
192941
|
import { exec as exec2 } from "child_process";
|
|
193030
192942
|
var CLOUD_BASE_URL = "https://studio.eigenpal.com";
|
|
193031
192943
|
function openBrowser(url3) {
|
|
@@ -193474,7 +193386,7 @@ async function completion(shell, program2) {
|
|
|
193474
193386
|
}
|
|
193475
193387
|
|
|
193476
193388
|
// src/commands/init/index.ts
|
|
193477
|
-
|
|
193389
|
+
init_dist5();
|
|
193478
193390
|
import {
|
|
193479
193391
|
copyFileSync,
|
|
193480
193392
|
existsSync as existsSync13,
|
|
@@ -193818,7 +193730,7 @@ async function rerunTarget(runId, opts) {
|
|
|
193818
193730
|
}
|
|
193819
193731
|
|
|
193820
193732
|
// src/commands/skill/index.ts
|
|
193821
|
-
|
|
193733
|
+
init_dist5();
|
|
193822
193734
|
import { createHash as createHash4 } from "node:crypto";
|
|
193823
193735
|
import {
|
|
193824
193736
|
existsSync as existsSync15,
|
|
@@ -195097,9 +195009,9 @@ function scanValue(value, path16, inScope, out) {
|
|
|
195097
195009
|
}
|
|
195098
195010
|
function walkStep(step, basePath, out) {
|
|
195099
195011
|
if (step.type === "ai.extract") {
|
|
195100
|
-
const
|
|
195101
|
-
if (
|
|
195102
|
-
walkSchema(
|
|
195012
|
+
const schema2 = step.with?.schema;
|
|
195013
|
+
if (schema2 && typeof schema2 === "object") {
|
|
195014
|
+
walkSchema(schema2, `${basePath}.with.schema`, out);
|
|
195103
195015
|
}
|
|
195104
195016
|
return;
|
|
195105
195017
|
}
|
|
@@ -195122,8 +195034,8 @@ function walkStep(step, basePath, out) {
|
|
|
195122
195034
|
});
|
|
195123
195035
|
}
|
|
195124
195036
|
}
|
|
195125
|
-
const
|
|
195126
|
-
if (
|
|
195037
|
+
const schema2 = compiled.result.returnSchema;
|
|
195038
|
+
if (schema2.type === "object" && (!schema2.properties || Object.keys(schema2.properties).length === 0) && schema2.additionalProperties !== false) {
|
|
195127
195039
|
out.push({
|
|
195128
195040
|
code: "untyped-object",
|
|
195129
195041
|
field: `${basePath}.with.function`,
|
|
@@ -195156,9 +195068,9 @@ function walkStep(step, basePath, out) {
|
|
|
195156
195068
|
}
|
|
195157
195069
|
}
|
|
195158
195070
|
}
|
|
195159
|
-
function walkSchema(
|
|
195160
|
-
const type =
|
|
195161
|
-
if (type === "object" && (!
|
|
195071
|
+
function walkSchema(schema2, basePath, out) {
|
|
195072
|
+
const type = schema2.type;
|
|
195073
|
+
if (type === "object" && (!schema2.properties || Object.keys(schema2.properties).length === 0) && schema2.additionalProperties !== false) {
|
|
195162
195074
|
out.push({
|
|
195163
195075
|
code: "untyped-object",
|
|
195164
195076
|
field: basePath,
|
|
@@ -195166,7 +195078,7 @@ function walkSchema(schema, basePath, out) {
|
|
|
195166
195078
|
hint: "Add concrete fields under `properties`, or set `additionalProperties: false` if the object is intentionally open."
|
|
195167
195079
|
});
|
|
195168
195080
|
}
|
|
195169
|
-
if (type === "array" && (
|
|
195081
|
+
if (type === "array" && (schema2.items === undefined || isEmptyObject(schema2.items))) {
|
|
195170
195082
|
out.push({
|
|
195171
195083
|
code: "untyped-array-items",
|
|
195172
195084
|
field: basePath,
|
|
@@ -195174,8 +195086,8 @@ function walkSchema(schema, basePath, out) {
|
|
|
195174
195086
|
hint: "Add an `items:` block describing the element type, e.g. `items: { type: object, properties: { ... } }`."
|
|
195175
195087
|
});
|
|
195176
195088
|
}
|
|
195177
|
-
if (
|
|
195178
|
-
for (const [name, raw] of Object.entries(
|
|
195089
|
+
if (schema2.properties && typeof schema2.properties === "object") {
|
|
195090
|
+
for (const [name, raw] of Object.entries(schema2.properties)) {
|
|
195179
195091
|
if (!raw || typeof raw !== "object")
|
|
195180
195092
|
continue;
|
|
195181
195093
|
const prop = raw;
|
|
@@ -195197,8 +195109,8 @@ function walkSchema(schema, basePath, out) {
|
|
|
195197
195109
|
walkSchema(prop, `${basePath}.properties.${name}`, out);
|
|
195198
195110
|
}
|
|
195199
195111
|
}
|
|
195200
|
-
if (
|
|
195201
|
-
walkSchema(
|
|
195112
|
+
if (schema2.items && typeof schema2.items === "object" && !Array.isArray(schema2.items)) {
|
|
195113
|
+
walkSchema(schema2.items, `${basePath}.items`, out);
|
|
195202
195114
|
}
|
|
195203
195115
|
}
|
|
195204
195116
|
function isEmptyObject(v11) {
|
|
@@ -195813,7 +195725,7 @@ flag would otherwise shadow it. Validation failures come back as
|
|
|
195813
195725
|
let filePath = opts.file;
|
|
195814
195726
|
if (!filePath) {
|
|
195815
195727
|
if (process.stdout.isTTY && process.stdin.isTTY) {
|
|
195816
|
-
const { text, isCancel, cancel } = await Promise.resolve().then(() => (
|
|
195728
|
+
const { text, isCancel, cancel } = await Promise.resolve().then(() => (init_dist5(), exports_dist));
|
|
195817
195729
|
const answer = await text({
|
|
195818
195730
|
message: "Path to workflow YAML",
|
|
195819
195731
|
placeholder: "workflow.yaml",
|