@eigenpal/cli 0.16.0 → 0.16.2

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 CHANGED
@@ -2845,7 +2845,7 @@ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid = (version) => {
2845
2845
  }, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, httpProtocol, e164, dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`, date, string = (params) => {
2846
2846
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
2847
2847
  return new RegExp(`^${regex}$`);
2848
- }, bigint, integer, number, boolean, lowercase, uppercase;
2848
+ }, bigint, integer, number, boolean, _null, lowercase, uppercase;
2849
2849
  var init_regexes = __esm(() => {
2850
2850
  cuid = /^[cC][0-9a-z]{6,}$/;
2851
2851
  cuid2 = /^[0-9a-z]+$/;
@@ -2869,6 +2869,7 @@ var init_regexes = __esm(() => {
2869
2869
  integer = /^-?\d+$/;
2870
2870
  number = /^-?\d+(?:\.\d+)?$/;
2871
2871
  boolean = /^(?:true|false)$/i;
2872
+ _null = /^null$/i;
2872
2873
  lowercase = /^[^A-Z]*$/;
2873
2874
  uppercase = /^[^a-z]*$/;
2874
2875
  });
@@ -3630,7 +3631,7 @@ function handleRefineResult(result, payload, input, inst) {
3630
3631
  payload.issues.push(issue(_iss));
3631
3632
  }
3632
3633
  }
3633
- var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodLazy, $ZodCustom;
3634
+ var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodLazy, $ZodCustom;
3634
3635
  var init_schemas = __esm(() => {
3635
3636
  init_checks();
3636
3637
  init_core();
@@ -4080,6 +4081,23 @@ var init_schemas = __esm(() => {
4080
4081
  return payload;
4081
4082
  };
4082
4083
  });
4084
+ $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
4085
+ $ZodType.init(inst, def);
4086
+ inst._zod.pattern = _null;
4087
+ inst._zod.values = new Set([null]);
4088
+ inst._zod.parse = (payload, _ctx) => {
4089
+ const input = payload.value;
4090
+ if (input === null)
4091
+ return payload;
4092
+ payload.issues.push({
4093
+ expected: "null",
4094
+ code: "invalid_type",
4095
+ input,
4096
+ inst
4097
+ });
4098
+ return payload;
4099
+ };
4100
+ });
4083
4101
  $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
4084
4102
  $ZodType.init(inst, def);
4085
4103
  inst._zod.parse = (payload) => payload;
@@ -5409,6 +5427,12 @@ function _coercedBigint(Class, params) {
5409
5427
  ...normalizeParams(params)
5410
5428
  });
5411
5429
  }
5430
+ function _null2(Class, params) {
5431
+ return new Class({
5432
+ type: "null",
5433
+ ...normalizeParams(params)
5434
+ });
5435
+ }
5412
5436
  function _unknown(Class) {
5413
5437
  return new Class({
5414
5438
  type: "unknown"
@@ -6637,6 +6661,9 @@ function int(params) {
6637
6661
  function boolean2(params) {
6638
6662
  return _boolean(ZodBoolean, params);
6639
6663
  }
6664
+ function _null3(params) {
6665
+ return _null2(ZodNull, params);
6666
+ }
6640
6667
  function unknown() {
6641
6668
  return _unknown(ZodUnknown);
6642
6669
  }
@@ -6824,7 +6851,7 @@ function _instanceof(cls, params = {}) {
6824
6851
  };
6825
6852
  return inst;
6826
6853
  }
6827
- var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodLazy, ZodCustom;
6854
+ var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodLazy, ZodCustom;
6828
6855
  var init_schemas2 = __esm(() => {
6829
6856
  init_core2();
6830
6857
  init_core2();
@@ -7219,6 +7246,11 @@ var init_schemas2 = __esm(() => {
7219
7246
  inst.maxValue = bag.maximum ?? null;
7220
7247
  inst.format = bag.format ?? null;
7221
7248
  });
7249
+ ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
7250
+ $ZodNull.init(inst, def);
7251
+ ZodType.init(inst, def);
7252
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
7253
+ });
7222
7254
  ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
7223
7255
  $ZodUnknown.init(inst, def);
7224
7256
  ZodType.init(inst, def);
@@ -7672,6 +7704,9 @@ var init_common = __esm(() => {
7672
7704
  EVAL_BATCH: "evb",
7673
7705
  RUN_REVIEW: "rev",
7674
7706
  RUN_REVIEW_CORRECTION: "rvc",
7707
+ HUMAN_REVIEW_TASK: "hrt",
7708
+ HUMAN_REVIEW_FIELD_DECISION: "hrd",
7709
+ HUMAN_REVIEW_FIELD_MUTATION: "hrm",
7675
7710
  TABLE_ROW: "row",
7676
7711
  FOLDER: "fldr",
7677
7712
  AGENT_WORKFLOW: "awf",
@@ -7804,7 +7839,11 @@ var init_ai_client = __esm(() => {
7804
7839
  ];
7805
7840
  ReasoningEffortSchema = _enum(REASONING_EFFORTS);
7806
7841
  ModelReasoningConfigSchema = object({
7807
- supportedEfforts: array(ReasoningEffortSchema).min(1)
7842
+ supportedEfforts: array(ReasoningEffortSchema).min(1),
7843
+ defaultEffort: ReasoningEffortSchema.optional()
7844
+ }).refine((config) => config.defaultEffort === undefined || config.supportedEfforts.includes(config.defaultEffort), {
7845
+ message: "defaultEffort must be included in supportedEfforts",
7846
+ path: ["defaultEffort"]
7808
7847
  }).strict();
7809
7848
  });
7810
7849
 
@@ -8271,13 +8310,14 @@ var init_extract = __esm(() => {
8271
8310
  ExtractInputSchema = object({
8272
8311
  content: string2().optional().describe("Text content to extract from"),
8273
8312
  text: string2().optional().describe("Text content (alternative to content, e.g., from document parser)"),
8313
+ structured: unknown().optional().describe("Optional structured document (ParsedDocument or parser-owned structured output). Validated at the extract use boundary."),
8274
8314
  contentType: _enum(["text", "image"]).default("text"),
8275
8315
  imageData: string2().optional(),
8276
8316
  imageMimeType: string2().optional()
8277
- }).refine((data) => data.content || data.text, {
8278
- message: "Either content or text must be provided"
8317
+ }).refine((data) => data.content || data.text || data.structured !== undefined, {
8318
+ message: "Either content, text, or structured must be provided"
8279
8319
  });
8280
- ExtractOutputSchema = record(string2(), unknown()).describe("Extracted structured data matching the provided schema. Unless grounding is disabled (grounded: false), the output also carries a reserved `_grounding` map keyed by field name: `_grounding.<field> = { confidence: high|medium|low, needsReview, reason?, source_span: { start, end, text, alignment } | null }`, plus reserved `_degraded: true` / `_reason` markers when the grounding LLM pass could not run.");
8320
+ ExtractOutputSchema = record(string2(), unknown()).describe('Extracted structured data matching the provided schema. Unless grounding is disabled (grounded: false), the output also carries a reserved `_grounding` map keyed by dotted field path: `_grounding["line_items.0.amount"] = { confidence: high|medium|low, score?, needsReview, reason?, quote?, citations?, source_span }`, plus reserved `_degraded: true` / `_reason` markers when grounding could not run the shared algorithm or the Eigenpal text pass. Lineage is never included in this JSON.');
8281
8321
  ExtractConfigSchema = object({
8282
8322
  schema: record(string2(), unknown()).describe("JSON Schema defining the structure to extract"),
8283
8323
  prompt: string2().optional().describe("Custom prompt template for extraction"),
@@ -15674,6 +15714,310 @@ var init_email_servers = __esm(() => {
15674
15714
  ]).meta({ id: "TestEmailServerResponse" });
15675
15715
  });
15676
15716
 
15717
+ // ../types/src/human-review.ts
15718
+ function jsonByteLength(value) {
15719
+ return new TextEncoder().encode(JSON.stringify(value)).byteLength;
15720
+ }
15721
+ function countJsonPointerPatternSegments(pointer) {
15722
+ return pointer.length <= 1 ? 0 : pointer.slice(1).split("/").length;
15723
+ }
15724
+ function selectionPatternLimitMessage(limit, label, actual) {
15725
+ return `${label} exceeds the ${limit} limit (${actual} provided)`;
15726
+ }
15727
+ function refineHumanReviewSelectionSize(selection, ctx) {
15728
+ const selectionBytes = jsonByteLength(selection);
15729
+ if (selectionBytes > HUMAN_REVIEW_LIMITS.selectionBytes) {
15730
+ ctx.addIssue({
15731
+ code: ZodIssueCode.custom,
15732
+ message: `Review selection exceeds the ${HUMAN_REVIEW_LIMITS.selectionBytes} byte limit (${selectionBytes} bytes)`,
15733
+ path: []
15734
+ });
15735
+ }
15736
+ }
15737
+ function createHumanReviewSelectionBaseSchema(fieldPolicySchema) {
15738
+ return object({
15739
+ include: array(HumanReviewJsonPointerPatternSchema).default([]).superRefine((patterns, ctx) => {
15740
+ if (patterns.length > HUMAN_REVIEW_LIMITS.selectionIncludePatterns) {
15741
+ ctx.addIssue({
15742
+ code: ZodIssueCode.custom,
15743
+ message: selectionPatternLimitMessage(HUMAN_REVIEW_LIMITS.selectionIncludePatterns, "selection.include pattern count", patterns.length)
15744
+ });
15745
+ }
15746
+ }).optional().describe("RFC 6901 pointers or wildcard patterns (for example `/items/*/amount`)"),
15747
+ exclude: array(HumanReviewJsonPointerPatternSchema).default([]).superRefine((patterns, ctx) => {
15748
+ if (patterns.length > HUMAN_REVIEW_LIMITS.selectionExcludePatterns) {
15749
+ ctx.addIssue({
15750
+ code: ZodIssueCode.custom,
15751
+ message: selectionPatternLimitMessage(HUMAN_REVIEW_LIMITS.selectionExcludePatterns, "selection.exclude pattern count", patterns.length)
15752
+ });
15753
+ }
15754
+ }).optional().describe("RFC 6901 pointers removed after include expansion"),
15755
+ fields: record(HumanReviewJsonPointerPatternSchema, fieldPolicySchema).superRefine((fields, ctx) => {
15756
+ const count = Object.keys(fields).length;
15757
+ if (count > HUMAN_REVIEW_LIMITS.selectionFieldPolicies) {
15758
+ ctx.addIssue({
15759
+ code: ZodIssueCode.custom,
15760
+ message: selectionPatternLimitMessage(HUMAN_REVIEW_LIMITS.selectionFieldPolicies, "selection.fields policy count", count)
15761
+ });
15762
+ }
15763
+ }).optional().describe("Per-field selection policy keyed by exact pointers or wildcard patterns. Exact beats the most specific wildcard; equally specific overlapping wildcards are rejected.")
15764
+ }).strict().superRefine((selection, ctx) => {
15765
+ refineHumanReviewSelectionSize(selection, ctx);
15766
+ });
15767
+ }
15768
+ var HUMAN_REVIEW_LIMITS, FEATURE_OFF_VALUES, INVALID_JSON_POINTER_ESCAPE, HumanReviewJsonPointerSchema, HumanReviewJsonPointerPatternSchema, HumanReviewCategoricalConfidenceSchema, HumanReviewNumericConfidenceSchema, HumanReviewMetadataFromSchema, HumanReviewResolvedConfidenceSchema, HumanReviewConfidenceValueSchema, HumanReviewFieldMetadataSchema, HumanReviewFieldPolicySchema, HumanReviewSelectionBaseSchema, HumanReviewSelectionSchema, HumanReviewFilesSchema, HumanReviewResolvedRequestSchema, HumanReviewFieldMetadataInputSchema, HumanReviewFieldPolicyInputSchema, HumanReviewSelectionInputBaseSchema, HumanReviewSelectionInputSchema, HumanReviewStepConfigSchema, HumanReviewSelectionReasonSchema, HumanReviewTaskStatusSchema, HumanReviewSourceKindSchema, HumanReviewScalarSchema, HUMAN_REVIEW_FILE_ROLES, HumanReviewFileRoleSchema, HumanReviewFileSchema, HumanReviewInputProjectionSchema, HumanReviewFieldDecisionSchema, HumanReviewTaskSummarySchema, HumanReviewTaskListResponseSchema, HumanReviewConflictSchema, HumanReviewLineageSourceSchema, HumanReviewMutationBaseSchema, HumanReviewConfirmFieldSchema, HumanReviewApproveSchema, HumanReviewRejectSchema, HumanReviewAgentContinuationManifestSchema;
15769
+ var init_human_review = __esm(() => {
15770
+ init_zod();
15771
+ init_common();
15772
+ HUMAN_REVIEW_LIMITS = {
15773
+ dataBytes: 2 * 1024 * 1024,
15774
+ scalarLeaves: 1e4,
15775
+ metadataBytes: 1024 * 1024,
15776
+ requiredFields: 2000,
15777
+ selectionIncludePatterns: 200,
15778
+ selectionExcludePatterns: 200,
15779
+ selectionFieldPolicies: 500,
15780
+ selectionPatternChars: 512,
15781
+ selectionPatternSegments: 32,
15782
+ selectionBytes: 256 * 1024,
15783
+ attachments: 100,
15784
+ agentContinuationBytes: 10 * 1024 * 1024,
15785
+ agentContinuationRetentionDays: 30
15786
+ };
15787
+ FEATURE_OFF_VALUES = new Set(["0", "false", "off", "no"]);
15788
+ INVALID_JSON_POINTER_ESCAPE = /~(?![01])/;
15789
+ HumanReviewJsonPointerSchema = string2().refine((value) => value.startsWith("/") && !INVALID_JSON_POINTER_ESCAPE.test(value), {
15790
+ message: 'Expected an RFC 6901 JSON Pointer beginning with "/"'
15791
+ });
15792
+ HumanReviewJsonPointerPatternSchema = HumanReviewJsonPointerSchema.max(HUMAN_REVIEW_LIMITS.selectionPatternChars, {
15793
+ message: `JSON Pointer pattern exceeds the ${HUMAN_REVIEW_LIMITS.selectionPatternChars} character limit`
15794
+ }).superRefine((value, ctx) => {
15795
+ const segmentCount = countJsonPointerPatternSegments(value);
15796
+ if (segmentCount > HUMAN_REVIEW_LIMITS.selectionPatternSegments) {
15797
+ ctx.addIssue({
15798
+ code: ZodIssueCode.custom,
15799
+ message: selectionPatternLimitMessage(HUMAN_REVIEW_LIMITS.selectionPatternSegments, "JSON Pointer pattern segment count", segmentCount)
15800
+ });
15801
+ }
15802
+ }).refine((value) => value.slice(1).split("/").every((segment) => segment === "*" || !segment.includes("*")), { message: "A wildcard must occupy an entire JSON Pointer segment" });
15803
+ HumanReviewCategoricalConfidenceSchema = _enum(["low", "medium", "high"]);
15804
+ HumanReviewNumericConfidenceSchema = number2().finite().min(0).max(1);
15805
+ HumanReviewMetadataFromSchema = _enum(["ai.extract"]).describe("Producer adapter. `ai.extract` derives field confidence from `_grounding` and strips that reserved key from review data. Grounding is not stripped unless this is set.");
15806
+ HumanReviewResolvedConfidenceSchema = union([
15807
+ HumanReviewNumericConfidenceSchema,
15808
+ HumanReviewCategoricalConfidenceSchema,
15809
+ string2().min(1)
15810
+ ]);
15811
+ HumanReviewConfidenceValueSchema = union([
15812
+ HumanReviewNumericConfidenceSchema,
15813
+ HumanReviewCategoricalConfidenceSchema
15814
+ ]);
15815
+ HumanReviewFieldMetadataSchema = object({
15816
+ confidence: HumanReviewResolvedConfidenceSchema.optional().describe("Producer-supplied confidence: 0–1 numeric (legacy) or categorical low|medium|high from ai.extract grounding. Not calibrated by Eigenpal."),
15817
+ label: string2().max(500).optional().describe("Short label shown in the review UI"),
15818
+ description: string2().max(5000).optional().describe("Longer reviewer guidance for this field"),
15819
+ review: _enum(["auto", "always", "never"]).default("auto").optional().describe("Legacy per-field override kept for existing tasks. Prefer selection.fields.review."),
15820
+ display: record(string2(), unknown()).optional().describe("Opaque display metadata preserved for the review UI")
15821
+ }).strict();
15822
+ HumanReviewFieldPolicySchema = object({
15823
+ review: _enum(["always", "never", "skip"]).optional().describe("Always require review, or never/skip review for matching paths"),
15824
+ threshold: HumanReviewResolvedConfidenceSchema.optional().describe("Per-field confidence threshold; overrides the global threshold for matching paths")
15825
+ }).strict();
15826
+ HumanReviewSelectionBaseSchema = createHumanReviewSelectionBaseSchema(HumanReviewFieldPolicySchema);
15827
+ HumanReviewSelectionSchema = discriminatedUnion("mode", [
15828
+ HumanReviewSelectionBaseSchema.extend({
15829
+ mode: literal("confidence"),
15830
+ threshold: HumanReviewResolvedConfidenceSchema,
15831
+ missingConfidence: _enum(["review", "skip"]).default("review").optional()
15832
+ }),
15833
+ HumanReviewSelectionBaseSchema.extend({
15834
+ mode: literal("explicit")
15835
+ }),
15836
+ HumanReviewSelectionBaseSchema.extend({
15837
+ mode: literal("all")
15838
+ })
15839
+ ]);
15840
+ HumanReviewFilesSchema = object({
15841
+ includeRunInputs: boolean2().default(true).optional().describe("Attach every authorized run input file to the review task"),
15842
+ attachments: array(string2().min(1)).max(HUMAN_REVIEW_LIMITS.attachments).default([]).optional().describe("Additional current-run file or artifact template expressions")
15843
+ }).strict();
15844
+ HumanReviewResolvedRequestSchema = object({
15845
+ data: union([record(string2(), unknown()), array(unknown())]),
15846
+ schema: JsonSchemaSchema.optional(),
15847
+ metadataFrom: HumanReviewMetadataFromSchema.optional(),
15848
+ fieldMetadata: record(HumanReviewJsonPointerSchema, HumanReviewFieldMetadataSchema).default({}).optional(),
15849
+ selection: HumanReviewSelectionSchema,
15850
+ files: HumanReviewFilesSchema.default({ includeRunInputs: true, attachments: [] }).optional(),
15851
+ instructions: string2().max(1e4).optional()
15852
+ }).strict();
15853
+ HumanReviewFieldMetadataInputSchema = object({
15854
+ confidence: union([
15855
+ HumanReviewNumericConfidenceSchema,
15856
+ HumanReviewCategoricalConfidenceSchema,
15857
+ string2().min(1)
15858
+ ]).optional(),
15859
+ label: string2().max(500).optional(),
15860
+ description: string2().max(5000).optional(),
15861
+ review: _enum(["auto", "always", "never"]).default("auto").optional(),
15862
+ display: record(string2(), unknown()).optional()
15863
+ }).strict();
15864
+ HumanReviewFieldPolicyInputSchema = object({
15865
+ review: _enum(["always", "never", "skip"]).optional(),
15866
+ threshold: union([
15867
+ HumanReviewNumericConfidenceSchema,
15868
+ HumanReviewCategoricalConfidenceSchema,
15869
+ string2().min(1)
15870
+ ]).optional()
15871
+ }).strict();
15872
+ HumanReviewSelectionInputBaseSchema = createHumanReviewSelectionBaseSchema(HumanReviewFieldPolicyInputSchema);
15873
+ HumanReviewSelectionInputSchema = discriminatedUnion("mode", [
15874
+ HumanReviewSelectionInputBaseSchema.extend({
15875
+ mode: literal("confidence").describe("Review fields below threshold or missing confidence"),
15876
+ threshold: union([
15877
+ HumanReviewNumericConfidenceSchema,
15878
+ HumanReviewCategoricalConfidenceSchema,
15879
+ string2().min(1)
15880
+ ]).describe("Fields with confidence strictly below this value require review. Equality auto-approves. Numeric 0–1 or categorical low|medium|high. Template strings are resolved at runtime."),
15881
+ missingConfidence: _enum(["review", "skip"]).default("review").optional().describe("Whether unscored or type-mismatched fields require review (default review)")
15882
+ }),
15883
+ HumanReviewSelectionInputBaseSchema.extend({
15884
+ mode: literal("explicit").describe("Review only paths matched by include/exclude")
15885
+ }),
15886
+ HumanReviewSelectionInputBaseSchema.extend({
15887
+ mode: literal("all").describe("Review every scalar leaf unless excluded or review: never")
15888
+ })
15889
+ ]).describe("Field selection policy resolved once when the task is created");
15890
+ HumanReviewStepConfigSchema = object({
15891
+ data: union([string2().min(1), record(string2(), unknown()), array(unknown())]).describe("Structured data or a template expression resolving to an object or array"),
15892
+ schema: JsonSchemaSchema.optional().describe("Optional JSON Schema for validating edits and exposing downstream autocomplete. When omitted with metadataFrom: ai.extract and a direct whole-output data expression, the extract step schema is reused."),
15893
+ metadataFrom: HumanReviewMetadataFromSchema.optional(),
15894
+ fieldMetadata: record(HumanReviewJsonPointerSchema, HumanReviewFieldMetadataInputSchema).default({}).optional().describe("RFC 6901 pointer map of producer facts (labels, confidence, display). Selection policy belongs under selection.fields; fieldMetadata.review is a legacy alias."),
15895
+ selection: HumanReviewSelectionInputSchema,
15896
+ files: HumanReviewFilesSchema.default({ includeRunInputs: true, attachments: [] }).optional().describe("Run input files and optional current-run attachments for reviewers"),
15897
+ instructions: string2().max(1e4).optional().describe("Free-form guidance shown above the review workspace")
15898
+ }).strict();
15899
+ HumanReviewSelectionReasonSchema = _enum([
15900
+ "always",
15901
+ "explicit",
15902
+ "low_confidence",
15903
+ "missing_confidence",
15904
+ "all",
15905
+ "reviewer_edit",
15906
+ "threshold_met",
15907
+ "never",
15908
+ "excluded",
15909
+ "unmatched",
15910
+ "missing_confidence_skip"
15911
+ ]);
15912
+ HumanReviewTaskStatusSchema = _enum(["pending", "approved", "rejected", "cancelled"]);
15913
+ HumanReviewSourceKindSchema = _enum(["workflow_step", "agent_tool"]);
15914
+ HumanReviewScalarSchema = union([
15915
+ string2(),
15916
+ number2().finite(),
15917
+ boolean2(),
15918
+ _null3()
15919
+ ]);
15920
+ HUMAN_REVIEW_FILE_ROLES = ["run_input", "attachment"];
15921
+ HumanReviewFileRoleSchema = _enum(HUMAN_REVIEW_FILE_ROLES);
15922
+ HumanReviewFileSchema = object({
15923
+ fileId: string2().min(1),
15924
+ filename: string2().min(1),
15925
+ mimeType: string2().optional(),
15926
+ size: number2().int().nonnegative().optional(),
15927
+ fieldName: string2().optional(),
15928
+ artifactPath: string2().min(1),
15929
+ role: HumanReviewFileRoleSchema.optional().describe("run_input for authorized run input files; attachment for extra current-run files. Omitted on historical tasks and inferred at read time.")
15930
+ }).strict();
15931
+ HumanReviewInputProjectionSchema = discriminatedUnion("status", [
15932
+ object({
15933
+ status: literal("available"),
15934
+ data: union([record(string2(), unknown()), array(unknown())])
15935
+ }).strict(),
15936
+ object({
15937
+ status: literal("omitted_too_large")
15938
+ }).strict()
15939
+ ]);
15940
+ HumanReviewFieldDecisionSchema = object({
15941
+ id: string2().min(1),
15942
+ path: HumanReviewJsonPointerSchema,
15943
+ originalValue: HumanReviewScalarSchema,
15944
+ currentValue: HumanReviewScalarSchema,
15945
+ required: boolean2(),
15946
+ reason: HumanReviewSelectionReasonSchema,
15947
+ confirmedBy: string2().nullable(),
15948
+ confirmedAt: string2().nullable(),
15949
+ version: number2().int().positive()
15950
+ }).strict();
15951
+ HumanReviewTaskSummarySchema = object({
15952
+ id: string2().min(1),
15953
+ executionId: string2().min(1),
15954
+ automationId: string2().min(1),
15955
+ automationName: string2().min(1),
15956
+ sourceKind: HumanReviewSourceKindSchema,
15957
+ sourceLabel: string2().min(1),
15958
+ status: HumanReviewTaskStatusSchema,
15959
+ requiredCount: number2().int().nonnegative(),
15960
+ confirmedCount: number2().int().nonnegative(),
15961
+ version: number2().int().positive(),
15962
+ createdAt: string2(),
15963
+ updatedAt: string2()
15964
+ }).strict();
15965
+ HumanReviewTaskListResponseSchema = object({
15966
+ tasks: array(HumanReviewTaskSummarySchema),
15967
+ nextCursor: string2().nullable()
15968
+ }).strict();
15969
+ HumanReviewConflictSchema = object({
15970
+ error: string2(),
15971
+ currentVersion: number2().int().positive().optional(),
15972
+ status: HumanReviewTaskStatusSchema.optional()
15973
+ }).strict();
15974
+ HumanReviewLineageSourceSchema = object({
15975
+ stepExecutionId: string2().min(1),
15976
+ stepName: string2().min(1),
15977
+ lineageArtifactKey: string2().min(1).nullable(),
15978
+ parsedDocumentArtifactKey: string2().min(1).nullable()
15979
+ }).strict();
15980
+ HumanReviewMutationBaseSchema = object({
15981
+ expectedVersion: number2().int().positive(),
15982
+ idempotencyKey: string2().min(1).max(200)
15983
+ }).strict();
15984
+ HumanReviewConfirmFieldSchema = HumanReviewMutationBaseSchema.extend({
15985
+ path: HumanReviewJsonPointerSchema,
15986
+ value: HumanReviewScalarSchema,
15987
+ confirmed: boolean2().default(true).optional()
15988
+ });
15989
+ HumanReviewApproveSchema = object({
15990
+ expectedVersion: number2().int().positive()
15991
+ }).strict();
15992
+ HumanReviewRejectSchema = HumanReviewMutationBaseSchema.extend({
15993
+ reason: string2().trim().min(1).max(5000)
15994
+ });
15995
+ HumanReviewAgentContinuationManifestSchema = object({
15996
+ version: literal(1),
15997
+ toolCallId: string2().min(1),
15998
+ taskId: string2().min(1),
15999
+ executionId: string2().min(1),
16000
+ createdAt: string2().min(1),
16001
+ expiresAt: string2().min(1),
16002
+ cost: object({
16003
+ totalInputTokens: number2().nonnegative(),
16004
+ totalOutputTokens: number2().nonnegative(),
16005
+ totalCacheReadTokens: number2().nonnegative(),
16006
+ totalCacheWriteTokens: number2().nonnegative(),
16007
+ agentTurns: number2().nonnegative(),
16008
+ durationMs: number2().nonnegative().optional(),
16009
+ e2bCostUsd: number2().nonnegative().nullable().optional()
16010
+ }).optional(),
16011
+ traceByteLength: number2().int().nonnegative().optional(),
16012
+ artifacts: array(object({ name: string2().min(1) })).default([]),
16013
+ reconstruction: object({
16014
+ requestedSourceRef: string2().optional(),
16015
+ resolvedGitRef: string2().optional(),
16016
+ resolvedCommitSha: string2().optional()
16017
+ }).optional()
16018
+ }).strict();
16019
+ });
16020
+
15677
16021
  // ../../node_modules/@babel/parser/lib/index.js
15678
16022
  var require_lib = __commonJS(function(exports) {
15679
16023
  Object.defineProperty(exports, "__esModule", {
@@ -53268,7 +53612,7 @@ var init_retry = __esm(() => {
53268
53612
  });
53269
53613
 
53270
53614
  // ../types/src/workflow/steps.ts
53271
- var AI_STEP_TYPES, TRANSFORM_STEP_TYPES, ACTION_STEP_TYPES, CONTROL_STEP_TYPES, STEP_TYPES, StepTypeSchema, BaseStepSchema, ControlContainerBaseStepSchema, AIStepSchema, TransformStepSchema, HttpMethodSchema, ActionStepSchema, WaitStepSchema, FailStepSchema, LegacyBlockStepSchemaInner, IfStepSchemaInner, SwitchCaseSchemaInner, SwitchStepSchemaInner, ParallelBranchSchemaInner, ParallelStepSchemaInner, ForeachStepSchemaInner, ParallelMapStepSchemaInner, StepSchema;
53615
+ var AI_STEP_TYPES, TRANSFORM_STEP_TYPES, ACTION_STEP_TYPES, CONTROL_STEP_TYPES, STEP_TYPES, StepTypeSchema, BaseStepSchema, ControlContainerBaseStepSchema, AIStepSchema, TransformStepSchema, HttpMethodSchema, ActionStepSchema, WaitStepSchema, HumanReviewStepSchema, FailStepSchema, LegacyBlockStepSchemaInner, IfStepSchemaInner, SwitchCaseSchemaInner, SwitchStepSchemaInner, ParallelBranchSchemaInner, ParallelStepSchemaInner, ForeachStepSchemaInner, ParallelMapStepSchemaInner, StepSchema;
53272
53616
  var init_steps = __esm(() => {
53273
53617
  init_zod();
53274
53618
  init_retry();
@@ -53308,6 +53652,7 @@ var init_steps = __esm(() => {
53308
53652
  "control.parallel",
53309
53653
  "control.parallel_map",
53310
53654
  "control.wait",
53655
+ "control.human_review",
53311
53656
  "control.fail"
53312
53657
  ];
53313
53658
  STEP_TYPES = [
@@ -53343,6 +53688,10 @@ var init_steps = __esm(() => {
53343
53688
  type: literal("control.wait"),
53344
53689
  duration: number2().positive().optional()
53345
53690
  });
53691
+ HumanReviewStepSchema = BaseStepSchema.extend({
53692
+ type: literal("control.human_review"),
53693
+ with: record(string2(), unknown())
53694
+ });
53346
53695
  FailStepSchema = BaseStepSchema.extend({
53347
53696
  type: literal("control.fail"),
53348
53697
  condition: string2().optional(),
@@ -53400,6 +53749,7 @@ var init_steps = __esm(() => {
53400
53749
  TransformStepSchema,
53401
53750
  ActionStepSchema,
53402
53751
  WaitStepSchema,
53752
+ HumanReviewStepSchema,
53403
53753
  FailStepSchema,
53404
53754
  LegacyBlockStepSchemaInner,
53405
53755
  IfStepSchemaInner,
@@ -53429,19 +53779,20 @@ function getStepSchema(stepType) {
53429
53779
  function listStepTypes() {
53430
53780
  return [...STEP_TYPES];
53431
53781
  }
53432
- var OptionalReasoningEffortSchema, AiParseConfigSchema, AiParseOutputSchema, AiExtractConfigSchema, AiExtractOutputSchema, VisionPageRangeSchema, AiVisionConfigSchema, AiVisionOutputSchema, 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, 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, ControlFailConfigSchema, ControlFailOutputSchema, STEP_SCHEMAS;
53782
+ var OptionalReasoningEffortSchema, AiParseConfigSchema, AiParseOutputSchema, AiExtractConfigSchema, AiExtractOutputSchema, VisionPageRangeSchema, AiVisionConfigSchema, AiVisionOutputSchema, 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, 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;
53433
53783
  var init_step_configs = __esm(() => {
53434
53784
  init_zod();
53435
53785
  init_ai_client();
53436
53786
  init_common();
53437
53787
  init_email_servers();
53788
+ init_human_review();
53438
53789
  init_parser();
53439
53790
  init_json_to_xlsx();
53440
53791
  init_xlsx_to_json();
53441
53792
  init_typed_script();
53442
53793
  init_email_recipients();
53443
53794
  init_steps();
53444
- OptionalReasoningEffortSchema = ReasoningEffortSchema.optional().describe("Reasoning effort for models that support it. Omit to preserve the current provider default.");
53795
+ OptionalReasoningEffortSchema = ReasoningEffortSchema.optional().describe("Reasoning effort for models that support it. Omit to use the selected model's default.");
53445
53796
  AiParseConfigSchema = object({
53446
53797
  input: string2().describe("Storage reference or template expression for the document"),
53447
53798
  parseMode: ParseModeSchema.optional().describe('Base parser for PDF/image inputs. OCR is the default; vision uses the selected LLM. `native` extracts PDF embedded text only and never calls OCR or vision. `native-or-ocr` extracts native text, runs page-quality diagnostics, and requests OCR when pages have detectable anomalies (empty, U+FFFD, lone surrogates, forbidden controls, unassigned/noncharacter, heavy PUA). Page selection, subset egress, and billing are provider-dependent. Valid-looking wrong text and literal "?" are not flagged. Text and Office files always use local parsing.'),
@@ -53485,7 +53836,7 @@ var init_step_configs = __esm(() => {
53485
53836
  })).optional().describe("Optional few-shot examples pinning grounding to verbatim source text per field."),
53486
53837
  reviewOn: _enum(["medium_or_low", "low_only"]).optional().describe("Which grounding confidences set needsReview on a field. Default: low_only (only fields whose value could not be located in the source). Use medium_or_low to also flag approximate and derived matches.")
53487
53838
  });
53488
- AiExtractOutputSchema = record(string2(), unknown()).describe("Extracted structured data matching the provided schema. Unless grounding is disabled (grounded: false), the output also carries a reserved `_grounding` map keyed by field name: `_grounding.<field> = { confidence: high|medium|low, needsReview, reason?, source_span: { start, end, text, alignment } | null }`, plus reserved `_degraded: true` / `_reason` markers when the grounding LLM pass could not run.");
53839
+ AiExtractOutputSchema = record(string2(), unknown()).describe('Extracted structured data matching the provided schema. Unless grounding is disabled (grounded: false), the output also carries a reserved `_grounding` map keyed by dotted field path: `_grounding["line_items.0.amount"] = { confidence: high|medium|low, score?, needsReview, reason?, quote?, citations?, source_span }`, plus reserved `_degraded: true` / `_reason` markers when grounding could not run the shared algorithm or the Eigenpal text pass. Lineage is never included in this JSON.');
53489
53840
  VisionPageRangeSchema = tuple([number2().int().min(0), number2().int().min(0)]).describe("Inclusive 0-based [start, end] page range, matching ai.split page_range.");
53490
53841
  AiVisionConfigSchema = object({
53491
53842
  document: string2().describe("Template expression resolving to the input file (PDF, image, or Office document)."),
@@ -53905,7 +54256,7 @@ var init_step_configs = __esm(() => {
53905
54256
  execution: _enum(["inline", "child"]).optional().describe("inline: run target steps in this execution (default). child: spawn a separate run with lineage."),
53906
54257
  input: record(string2(), unknown()).optional().describe("Input record keyed by the invoked workflow's declared inputs"),
53907
54258
  wait: boolean2().optional().describe("Child mode only. Wait for the invoked workflow to complete and return its output (default: true). Set false for fire-and-forget."),
53908
- timeout: number2().optional().describe("Child mode only. Max wait time in ms when waiting (default: 300000)"),
54259
+ timeout: number2().optional().describe("Child mode only. Max wait time in ms while the child is queued or running (default: 300000). Once the child pauses for human review, the parent pauses durably instead of using this timeout."),
53909
54260
  pollInterval: number2().optional().describe("Child mode only. How often to poll status in ms when waiting (default: 1000)")
53910
54261
  }).superRefine((data, ctx) => {
53911
54262
  const hasWorkflow = typeof data.workflow === "string" && data.workflow.length > 0;
@@ -54060,6 +54411,8 @@ var init_step_configs = __esm(() => {
54060
54411
  ControlWaitOutputSchema = object({
54061
54412
  waited: number2().describe("Actual milliseconds waited")
54062
54413
  });
54414
+ ControlHumanReviewConfigSchema = HumanReviewStepConfigSchema;
54415
+ ControlHumanReviewOutputSchema = unknown().describe("The complete reviewed data in the same object or array shape as the input.");
54063
54416
  ControlFailConfigSchema = object({
54064
54417
  condition: string2().optional().describe("Optional LiquidJS expression. When set, the step only fails if this evaluates truthy; when omitted, it always fails when reached (compose with control.if for legacy gating)."),
54065
54418
  statusCode: number2().int().min(400).max(599).default(422).describe("HTTP-style status code returned to the caller (sync runs) and persisted on the execution. Default 422 (Unprocessable Entity)."),
@@ -54328,6 +54681,15 @@ var init_step_configs = __esm(() => {
54328
54681
  outputSchema: ControlWaitOutputSchema,
54329
54682
  configInWith: false
54330
54683
  },
54684
+ "control.human_review": {
54685
+ type: "control.human_review",
54686
+ category: "control",
54687
+ name: "Human Review",
54688
+ description: "Pause the run for selective field confirmation or correction, then continue with the reviewed data.",
54689
+ configSchema: ControlHumanReviewConfigSchema,
54690
+ outputSchema: ControlHumanReviewOutputSchema,
54691
+ configInWith: true
54692
+ },
54331
54693
  "control.fail": {
54332
54694
  type: "control.fail",
54333
54695
  category: "control",
@@ -54632,16 +54994,52 @@ function evalPathIsDescendant(descendant, ancestor) {
54632
54994
  var MAX_UNORDERED_ARRAY_ITEMS = 1000, MAX_UNORDERED_PAIR_COMPARISONS = 1e6, MAX_UNORDERED_COMPARISON_OPERATIONS = 2000000;
54633
54995
  var init_compare_output = () => {};
54634
54996
 
54997
+ // ../types/src/human-review-evaluation.ts
54998
+ var HumanReviewEvaluationFieldFixtureSchema, HumanReviewEvaluationStepFixtureSchema, HumanReviewEvaluationFixtureSchema, HumanReviewEvaluationObservationSchema;
54999
+ var init_human_review_evaluation = __esm(() => {
55000
+ init_zod();
55001
+ init_human_review();
55002
+ HumanReviewEvaluationFieldFixtureSchema = object({
55003
+ expectedRoute: _enum(["review", "skip"]).optional(),
55004
+ expectedReason: HumanReviewSelectionReasonSchema.optional(),
55005
+ expectedValue: HumanReviewScalarSchema.optional()
55006
+ }).strict();
55007
+ HumanReviewEvaluationStepFixtureSchema = object({
55008
+ fields: record(HumanReviewJsonPointerSchema, HumanReviewEvaluationFieldFixtureSchema).default({}),
55009
+ simulate: object({
55010
+ outcome: literal("approved").optional(),
55011
+ edits: record(HumanReviewJsonPointerSchema, HumanReviewScalarSchema).optional()
55012
+ }).strict().optional()
55013
+ }).strict();
55014
+ HumanReviewEvaluationFixtureSchema = object({
55015
+ version: literal(1),
55016
+ steps: record(string2().min(1), HumanReviewEvaluationStepFixtureSchema)
55017
+ }).strict();
55018
+ HumanReviewEvaluationObservationSchema = object({
55019
+ version: literal(1),
55020
+ stepPath: string2().min(1),
55021
+ fields: record(HumanReviewJsonPointerSchema, object({
55022
+ route: _enum(["review", "skip"]),
55023
+ reason: HumanReviewSelectionReasonSchema,
55024
+ rawCorrect: boolean2().optional(),
55025
+ corrected: boolean2().optional()
55026
+ }).strict()),
55027
+ simulated: boolean2()
55028
+ }).strict();
55029
+ });
55030
+
54635
55031
  // ../types/src/eval/dataset-archive.ts
54636
55032
  var DATASET_NAME_PATTERN, DatasetNameSchema, DatasetMetaSchema, DatasetImportModeSchema, DatasetImportRequestSchema, EvaluatorsImportRequestSchema, EvalResultsExportFormatSchema, BooleanQueryFlagSchema, ExperimentExportBaseQuerySchema, ExperimentExportQuerySchema, EvalResultExportRowSchema, EvalResultsExportJsonSchema;
54637
55033
  var init_dataset_archive = __esm(() => {
54638
55034
  init_zod();
55035
+ init_human_review_evaluation();
54639
55036
  DATASET_NAME_PATTERN = /^[a-z0-9][a-z0-9-_]*$/;
54640
55037
  DatasetNameSchema = string2().min(1).max(128).regex(DATASET_NAME_PATTERN, "name must be lowercase kebab/snake-case").describe("Example folder name: 1-128 lowercase letters, digits, hyphens, or underscores; must start with a letter or digit.");
54641
55038
  DatasetMetaSchema = object({
54642
55039
  rowOrder: number2().int().min(0).optional().describe("Non-negative display order hint for this example."),
54643
55040
  annotation: string2().max(2000).optional().describe("Free-form example note, limited to 2000 characters."),
54644
- overrides: record(string2(), unknown()).optional().describe('Per-step output overrides as `{ "steps": { "<stepName>": <outputObject> } }`; overridden steps are skipped or partially merged during evaluation.')
55041
+ overrides: record(string2(), unknown()).optional().describe('Per-step output overrides as `{ "steps": { "<stepName>": <outputObject> } }`; overridden steps are skipped or partially merged during evaluation.'),
55042
+ review: HumanReviewEvaluationFixtureSchema.optional().describe("Optional human-review evaluation fixture: expected field routes and simulated approvals or edits for this example.")
54645
55043
  });
54646
55044
  DatasetImportModeSchema = _enum(["append", "replace"]).describe("append keeps existing examples; replace removes them before import.");
54647
55045
  DatasetImportRequestSchema = object({
@@ -54664,7 +55062,7 @@ var init_dataset_archive = __esm(() => {
54664
55062
  exampleName: string2().nullable(),
54665
55063
  batchId: string2().min(1).nullable(),
54666
55064
  evaluatorName: string2().min(1),
54667
- evaluatorType: _enum(["exact-diff", "llm-judge", "custom-script"]),
55065
+ evaluatorType: _enum(["exact-diff", "llm-judge", "custom-script", "human-review"]),
54668
55066
  score: number2().nullable(),
54669
55067
  passed: boolean2().nullable(),
54670
55068
  label: string2().nullable(),
@@ -54815,7 +55213,7 @@ var init_evaluator_config = __esm(() => {
54815
55213
  LabelsRecord = record(string2().min(1), ScoreInUnitInterval);
54816
55214
  LlmJudgeConfigSchema = object({
54817
55215
  model: string2().min(1).optional().describe("Which LLM grades the output. Falls back to the workspace's default LLM provider when unset."),
54818
- reasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for models that support it. Omit to preserve the current provider default."),
55216
+ reasoningEffort: ReasoningEffortSchema.optional().describe("Reasoning effort for models that support it. Omit to use the selected model's default."),
54819
55217
  mode: JudgeModeSchema.default("continuous").describe("Continuous = the LLM returns a free-form score in [0, 1]. Discrete = the LLM picks one of your labels and the score is looked up from the table."),
54820
55218
  labels: LabelsRecord.optional().describe("Allowed labels and the score each maps to. Required in discrete mode. The judge MUST return one of these labels; each score must be in [0, 1]."),
54821
55219
  passThreshold: ScoreInUnitInterval.optional().describe(LEGACY_EVALUATOR_THRESHOLD_DESCRIPTION),
@@ -55612,10 +56010,11 @@ function validateWebhookHeaderCollection(input, ctx) {
55612
56010
  }
55613
56011
  }
55614
56012
  }
55615
- var WEBHOOK_API_VERSION = "2026-07-01", WEBHOOK_MAX_PAYLOAD_BYTES, WEBHOOK_MAX_HEADERS = 20, WEBHOOK_MAX_HEADER_BYTES, WEBHOOK_EVENT_TYPES, WEBHOOK_DELIVERY_STATES, WEBHOOK_RESERVED_HEADERS, RESERVED_HEADER_SET, WebhookEventTypeSchema, WebhookDeliveryStateSchema, WebhookEndpointIdSchema, WebhookEventIdSchema, WebhookDeliveryIdSchema, WebhookAttemptIdSchema, HeaderNameSchema, WebhookCustomHeaderSchema, RetainedWebhookCustomHeaderSchema, RedactedWebhookCustomHeaderSchema, PublicWebhookRunSchema, EnvelopeBaseSchema, RunCreatedWebhookEventSchema, RunStatusChangedWebhookEventSchema, WebhookEventEnvelopeSchema, WebhookEndpointSchema, WebhookDestinationUrlSchema, CreateWebhookEndpointSchema, UpdateWebhookEndpointSchema, CreateWebhookEndpointResponseSchema, WebhookDeliverySchema, WebhookDeliveryAttemptSchema;
56013
+ var WEBHOOK_API_VERSION = "2026-07-01", WEBHOOK_MAX_PAYLOAD_BYTES, WEBHOOK_MAX_HEADERS = 20, WEBHOOK_MAX_HEADER_BYTES, WEBHOOK_EVENT_TYPES, WEBHOOK_DELIVERY_STATES, WEBHOOK_RESERVED_HEADERS, RESERVED_HEADER_SET, WebhookEventTypeSchema, WebhookDeliveryStateSchema, WebhookEndpointIdSchema, WebhookEventIdSchema, WebhookDeliveryIdSchema, WebhookAttemptIdSchema, HeaderNameSchema, WebhookCustomHeaderSchema, RetainedWebhookCustomHeaderSchema, RedactedWebhookCustomHeaderSchema, PublicWebhookRunSchema, HUMAN_REVIEW_WEBHOOK_OUTCOMES, PublicHumanReviewEventMetadataSchema, PublicWebhookHumanReviewSchema, EnvelopeBaseSchema, RunCreatedWebhookEventSchema, RunStatusChangedWebhookEventSchema, WebhookEventEnvelopeSchema, WebhookEndpointSchema, WebhookDestinationUrlSchema, CreateWebhookEndpointSchema, UpdateWebhookEndpointSchema, CreateWebhookEndpointResponseSchema, WebhookDeliverySchema, WebhookDeliveryAttemptSchema;
55616
56014
  var init_webhooks = __esm(() => {
55617
56015
  init_zod();
55618
56016
  init_execution_row();
56017
+ init_human_review();
55619
56018
  WEBHOOK_MAX_PAYLOAD_BYTES = 1024 * 1024;
55620
56019
  WEBHOOK_MAX_HEADER_BYTES = 16 * 1024;
55621
56020
  WEBHOOK_EVENT_TYPES = ["run.created", "run.status_changed"];
@@ -55677,6 +56076,23 @@ var init_webhooks = __esm(() => {
55677
56076
  output: unknown().optional(),
55678
56077
  outputOmitted: boolean2().optional()
55679
56078
  });
56079
+ HUMAN_REVIEW_WEBHOOK_OUTCOMES = [
56080
+ "created",
56081
+ "approved",
56082
+ "rejected",
56083
+ "cancelled"
56084
+ ];
56085
+ PublicHumanReviewEventMetadataSchema = object({
56086
+ taskId: string2().min(1),
56087
+ sourceKind: HumanReviewSourceKindSchema,
56088
+ sourceLabel: string2().min(1),
56089
+ requiredCount: number2().int().nonnegative(),
56090
+ confirmedCount: number2().int().nonnegative().optional(),
56091
+ actorUserId: string2().nullable().optional()
56092
+ }).strict();
56093
+ PublicWebhookHumanReviewSchema = PublicHumanReviewEventMetadataSchema.extend({
56094
+ outcome: _enum(HUMAN_REVIEW_WEBHOOK_OUTCOMES)
56095
+ }).strict();
55680
56096
  EnvelopeBaseSchema = object({
55681
56097
  id: WebhookEventIdSchema,
55682
56098
  apiVersion: literal(WEBHOOK_API_VERSION),
@@ -55692,7 +56108,8 @@ var init_webhooks = __esm(() => {
55692
56108
  data: object({
55693
56109
  run: PublicWebhookRunSchema,
55694
56110
  previousStatus: _enum(EXECUTION_STATUSES),
55695
- currentStatus: _enum(EXECUTION_STATUSES)
56111
+ currentStatus: _enum(EXECUTION_STATUSES),
56112
+ humanReview: PublicWebhookHumanReviewSchema.optional()
55696
56113
  })
55697
56114
  });
55698
56115
  WebhookEventEnvelopeSchema = discriminatedUnion("type", [
@@ -205729,7 +206146,7 @@ import { fileURLToPath as fileURLToPath8 } from "url";
205729
206146
  // package.json
205730
206147
  var package_default = {
205731
206148
  name: "@eigenpal/cli",
205732
- version: "0.16.0",
206149
+ version: "0.16.2",
205733
206150
  description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
205734
206151
  keywords: [
205735
206152
  "eigenpal",
@@ -205786,7 +206203,7 @@ var package_default = {
205786
206203
  "@clack/prompts": "^1.3.0",
205787
206204
  ajv: "^8.17.1",
205788
206205
  commander: "^14.0.3",
205789
- fflate: "0.8.2",
206206
+ fflate: "0.8.3",
205790
206207
  picocolors: "^1.1.1",
205791
206208
  yaml: "^2.7.0",
205792
206209
  xlsx: "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
@@ -208498,9 +208915,11 @@ function registerGitCommands(program) {
208498
208915
  // ../../node_modules/fflate/esm/index.mjs
208499
208916
  import { createRequire as createRequire2 } from "module";
208500
208917
  var require2 = createRequire2("/");
208918
+ var _a3;
208501
208919
  var Worker;
208920
+ var isMarkedAsUntransferable;
208502
208921
  try {
208503
- Worker = require2("worker_threads").Worker;
208922
+ _a3 = require2("worker_threads"), Worker = _a3.Worker, isMarkedAsUntransferable = _a3.isMarkedAsUntransferable;
208504
208923
  } catch (e) {}
208505
208924
  var u8 = Uint8Array;
208506
208925
  var u16 = Uint16Array;
@@ -208986,7 +209405,7 @@ var fltn = function(d, p, t, o) {
208986
209405
  var val2 = d[k], n = p + k, op = o;
208987
209406
  if (Array.isArray(val2))
208988
209407
  op = mrg(o, val2[1]), val2 = val2[0];
208989
- if (val2 instanceof u8)
209408
+ if (ArrayBuffer.isView(val2))
208990
209409
  t[n] = [val2, op];
208991
209410
  else {
208992
209411
  t[n += "/"] = [new u8(0), op];
@@ -241470,11 +241889,19 @@ import {
241470
241889
  } from "node:fs";
241471
241890
  import { dirname as dirname4, join as join7, relative as relative2, resolve as resolve5 } from "node:path";
241472
241891
  import { fileURLToPath as fileURLToPath6 } from "node:url";
241473
- var TEMPLATE_NAMES = ["blank", "pdf-extraction", "text-classification"];
241892
+ var TEMPLATE_NAMES = [
241893
+ "blank",
241894
+ "pdf-extraction",
241895
+ "text-classification",
241896
+ "human-review-confidence-exception",
241897
+ "human-review-explicit-critical"
241898
+ ];
241474
241899
  var TEMPLATE_DESCRIPTIONS = {
241475
241900
  blank: "Single-step pass-through. Good starting point when you know what you want to build.",
241476
241901
  "pdf-extraction": "Parse a PDF/image with the auto parser, then ai.extract structured fields against a JSON schema.",
241477
- "text-classification": "Classify free-form text into one of a fixed set of labels (positive/neutral/negative)."
241902
+ "text-classification": "Classify free-form text into one of a fixed set of labels (positive/neutral/negative).",
241903
+ "human-review-confidence-exception": "Parse and extract an invoice, then pause for human review only on low-confidence fields.",
241904
+ "human-review-explicit-critical": "Parse and extract payment fields, then pause for explicit review of total and IBAN only."
241478
241905
  };
241479
241906
  function isValidProjectName(name) {
241480
241907
  return /^[a-z0-9][a-z0-9-_]*$/.test(name) && name.length <= 60;
@@ -242268,7 +242695,7 @@ async function installSkillTools(opts) {
242268
242695
  initialValues: initial,
242269
242696
  required: false
242270
242697
  });
242271
- if (q(picked)) {
242698
+ if (q(picked) || !Array.isArray(picked)) {
242272
242699
  me("Aborted.");
242273
242700
  return;
242274
242701
  }
@@ -242343,7 +242770,7 @@ async function uninstallSkillTools(opts) {
242343
242770
  })),
242344
242771
  required: false
242345
242772
  });
242346
- if (q(picked)) {
242773
+ if (q(picked) || !Array.isArray(picked)) {
242347
242774
  me("Aborted.");
242348
242775
  return;
242349
242776
  }
@@ -242887,6 +243314,13 @@ function validateStepConfigsRecursive(steps, pathPrefix) {
242887
243314
  if (step.type === "control.block") {
242888
243315
  continue;
242889
243316
  }
243317
+ if (step.type === "control.human_review" && pathPrefix.length > 1) {
243318
+ issues.push({
243319
+ path: [...stepPath, "type"],
243320
+ message: "control.human_review is supported only in the top-level step sequence; nested and concurrent review checkpoints are not supported",
243321
+ code: "custom"
243322
+ });
243323
+ }
242890
243324
  const schemaDef = getStepSchema(step.type);
242891
243325
  if (schemaDef?.configInWith) {
242892
243326
  const cfg = step.with ?? {};