@adoptai/genui-components 0.1.56 → 0.1.58
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/builders/BuilderForm.d.ts.map +1 -1
- package/dist/composites/decision-card/resolver.cjs +634 -0
- package/dist/composites/decision-card/resolver.cjs.map +1 -0
- package/dist/composites/decision-card/resolver.d.ts +13 -0
- package/dist/composites/decision-card/resolver.d.ts.map +1 -0
- package/dist/composites/decision-card/resolver.js +627 -0
- package/dist/composites/decision-card/resolver.js.map +1 -0
- package/dist/composites/document-field-extraction/FieldAuditLog.d.ts +27 -0
- package/dist/composites/document-field-extraction/FieldAuditLog.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/FieldDetail.d.ts +22 -0
- package/dist/composites/document-field-extraction/FieldDetail.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/FieldDetails.d.ts +18 -0
- package/dist/composites/document-field-extraction/FieldDetails.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/bboxTransform.d.ts +25 -0
- package/dist/composites/document-field-extraction/bboxTransform.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/fieldLabels.d.ts +2 -0
- package/dist/composites/document-field-extraction/fieldLabels.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/resolver.d.ts +16 -0
- package/dist/composites/document-field-extraction/resolver.d.ts.map +1 -0
- package/dist/composites/workflow-stepper/resolver.cjs +4 -1
- package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
- package/dist/composites/workflow-stepper/resolver.js +4 -1
- package/dist/composites/workflow-stepper/resolver.js.map +1 -1
- package/dist/index.cjs +2735 -382
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2530 -183
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +2410 -178
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +2267 -35
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +2409 -177
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +2267 -35
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/decision-card.d.ts +149 -0
- package/dist/schemas/decision-card.d.ts.map +1 -0
- package/dist/schemas/document-field-extraction.d.ts +258 -0
- package/dist/schemas/document-field-extraction.d.ts.map +1 -0
- package/dist/schemas/index.cjs +283 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +407 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +283 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/shared/InteractionContext.d.ts +10 -0
- package/dist/shared/InteractionContext.d.ts.map +1 -1
- package/dist/tool-definitions.json +359 -3
- package/package.json +1 -1
package/dist/schemas/index.cjs
CHANGED
|
@@ -3455,6 +3455,286 @@ var workflowStepperTool = {
|
|
|
3455
3455
|
required: ["type", "title", "steps"]
|
|
3456
3456
|
}
|
|
3457
3457
|
};
|
|
3458
|
+
var bbox = zod.z.tuple([zod.z.number(), zod.z.number(), zod.z.number(), zod.z.number()]);
|
|
3459
|
+
var fieldSchema = zod.z.object({
|
|
3460
|
+
field_key: zod.z.string(),
|
|
3461
|
+
label: zod.z.string(),
|
|
3462
|
+
value: zod.z.string(),
|
|
3463
|
+
page: zod.z.number(),
|
|
3464
|
+
// 0-indexed, matches PageDimension.page
|
|
3465
|
+
bbox: bbox.nullable().optional(),
|
|
3466
|
+
confidence: zod.z.number().optional(),
|
|
3467
|
+
confidence_tier: zod.z.enum(["green", "amber", "red"]).optional(),
|
|
3468
|
+
badge: zod.z.enum(["SC", "CN", "AB", "SW"]).optional(),
|
|
3469
|
+
state: zod.z.enum(["ok", "corrected", "missing", "warn"]).optional(),
|
|
3470
|
+
entity_type: zod.z.string().optional(),
|
|
3471
|
+
is_primary: zod.z.boolean().optional(),
|
|
3472
|
+
// Set after a human correction (extractor output, or an optimistic in-card
|
|
3473
|
+
// edit) so the editable field card can show old → new and who changed it.
|
|
3474
|
+
previous_value: zod.z.string().nullable().optional(),
|
|
3475
|
+
corrected_by: zod.z.string().nullable().optional()
|
|
3476
|
+
});
|
|
3477
|
+
var pageSchema = zod.z.object({
|
|
3478
|
+
page: zod.z.number(),
|
|
3479
|
+
// 0-indexed
|
|
3480
|
+
imageUrl: zod.z.string().optional(),
|
|
3481
|
+
// host-resolved from the durable image_ref
|
|
3482
|
+
width_pt: zod.z.number(),
|
|
3483
|
+
height_pt: zod.z.number()
|
|
3484
|
+
});
|
|
3485
|
+
var summaryStatSchema = zod.z.object({
|
|
3486
|
+
field_key: zod.z.string(),
|
|
3487
|
+
label: zod.z.string(),
|
|
3488
|
+
value: zod.z.string(),
|
|
3489
|
+
caption: zod.z.string().nullable().optional()
|
|
3490
|
+
});
|
|
3491
|
+
var summaryFactSchema = zod.z.object({
|
|
3492
|
+
field_key: zod.z.string(),
|
|
3493
|
+
label: zod.z.string(),
|
|
3494
|
+
value: zod.z.string(),
|
|
3495
|
+
badge: zod.z.string().nullable().optional()
|
|
3496
|
+
});
|
|
3497
|
+
var summarySchema = zod.z.object({
|
|
3498
|
+
display_name: zod.z.string().nullable().optional(),
|
|
3499
|
+
short_name: zod.z.string().nullable().optional(),
|
|
3500
|
+
organization: zod.z.string().nullable().optional(),
|
|
3501
|
+
domain: zod.z.string().nullable().optional(),
|
|
3502
|
+
domain_group: zod.z.string().nullable().optional(),
|
|
3503
|
+
tax_year: zod.z.union([zod.z.string(), zod.z.number()]).nullable().optional(),
|
|
3504
|
+
crumbs: zod.z.array(zod.z.string()).optional(),
|
|
3505
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
3506
|
+
stats: zod.z.array(summaryStatSchema).optional(),
|
|
3507
|
+
facts: zod.z.array(summaryFactSchema).optional()
|
|
3508
|
+
});
|
|
3509
|
+
var documentFieldExtractionSchema = zod.z.object({
|
|
3510
|
+
type: zod.z.literal("document-field-extraction"),
|
|
3511
|
+
doc_type: zod.z.string().optional(),
|
|
3512
|
+
// Original uploaded filename (e.g. "2024_gl.pdf"); preferred over doc_type for
|
|
3513
|
+
// the card title since doc_type is often the "generic_fallback" schema name.
|
|
3514
|
+
file_name: zod.z.string().optional(),
|
|
3515
|
+
// Server-side token; resolved by the host into pages/fields before render.
|
|
3516
|
+
payload_ref: zod.z.string().optional(),
|
|
3517
|
+
// Present for persisted workstream docs; absent for pre-existing cards.
|
|
3518
|
+
store_id: zod.z.string().optional(),
|
|
3519
|
+
doc_id: zod.z.string().optional(),
|
|
3520
|
+
pages: zod.z.array(pageSchema).max(100).optional(),
|
|
3521
|
+
fields: zod.z.array(fieldSchema).max(1e3).optional(),
|
|
3522
|
+
// Page-count metadata for the Details tab ("N of M pages extracted").
|
|
3523
|
+
page_count: zod.z.number().optional(),
|
|
3524
|
+
pages_processed: zod.z.number().optional(),
|
|
3525
|
+
// Deterministic document summary for the Details tab.
|
|
3526
|
+
summary: summarySchema.nullable().optional()
|
|
3527
|
+
});
|
|
3528
|
+
var documentFieldExtractionTool = {
|
|
3529
|
+
name: "render_document_field_extraction",
|
|
3530
|
+
description: "Render extracted document fields as an interactive overlay on the page image(s) \u2014 colored bounding boxes per field plus a synced field-card list. Use after the extract_document tool returns; pass the returned payload_ref (the host expands it). For invoices, statements, tax forms, receipts, KYC/loan docs, POs where the user wants to SEE where each value sits on the page.",
|
|
3531
|
+
input_schema: {
|
|
3532
|
+
type: "object",
|
|
3533
|
+
properties: {
|
|
3534
|
+
type: { type: "string", enum: ["document-field-extraction"] },
|
|
3535
|
+
doc_type: { type: "string" },
|
|
3536
|
+
file_name: {
|
|
3537
|
+
type: "string",
|
|
3538
|
+
description: "Original uploaded filename; shown as the card title."
|
|
3539
|
+
},
|
|
3540
|
+
payload_ref: {
|
|
3541
|
+
type: "string",
|
|
3542
|
+
description: "Durable store key returned by extract_document; the GenUI host expands it into pages/fields at render time. Pass this verbatim \u2014 do NOT hand-build pages/fields."
|
|
3543
|
+
},
|
|
3544
|
+
store_id: {
|
|
3545
|
+
type: "string",
|
|
3546
|
+
description: "Docstore store id; present for persisted workstream docs. The host uses this to open the editable viewer."
|
|
3547
|
+
},
|
|
3548
|
+
doc_id: {
|
|
3549
|
+
type: "string",
|
|
3550
|
+
description: "Docstore document id; present for persisted workstream docs. Required for the editable viewer."
|
|
3551
|
+
},
|
|
3552
|
+
pages: {
|
|
3553
|
+
type: "array",
|
|
3554
|
+
items: {
|
|
3555
|
+
type: "object",
|
|
3556
|
+
properties: {
|
|
3557
|
+
page: { type: "number", description: "0-indexed page number" },
|
|
3558
|
+
imageUrl: { type: "string" },
|
|
3559
|
+
width_pt: { type: "number" },
|
|
3560
|
+
height_pt: { type: "number" }
|
|
3561
|
+
},
|
|
3562
|
+
required: ["page", "width_pt", "height_pt"]
|
|
3563
|
+
}
|
|
3564
|
+
},
|
|
3565
|
+
fields: {
|
|
3566
|
+
type: "array",
|
|
3567
|
+
items: {
|
|
3568
|
+
type: "object",
|
|
3569
|
+
properties: {
|
|
3570
|
+
field_key: { type: "string" },
|
|
3571
|
+
label: { type: "string" },
|
|
3572
|
+
value: { type: "string" },
|
|
3573
|
+
page: { type: "number", description: "0-indexed page number" },
|
|
3574
|
+
bbox: {
|
|
3575
|
+
type: "array",
|
|
3576
|
+
items: { type: "number" },
|
|
3577
|
+
description: "[x0,y0,x1,y1] PDF points, origin bottom-left; null if unlocated"
|
|
3578
|
+
},
|
|
3579
|
+
confidence: { type: "number" },
|
|
3580
|
+
confidence_tier: { type: "string", enum: ["green", "amber", "red"] },
|
|
3581
|
+
badge: { type: "string", enum: ["SC", "CN", "AB", "SW"] },
|
|
3582
|
+
state: { type: "string", enum: ["ok", "corrected", "missing", "warn"] },
|
|
3583
|
+
entity_type: { type: "string" },
|
|
3584
|
+
is_primary: { type: "boolean" }
|
|
3585
|
+
},
|
|
3586
|
+
required: ["field_key", "label", "value", "page"]
|
|
3587
|
+
}
|
|
3588
|
+
},
|
|
3589
|
+
page_count: { type: "number" },
|
|
3590
|
+
pages_processed: { type: "number" },
|
|
3591
|
+
summary: {
|
|
3592
|
+
type: "object",
|
|
3593
|
+
description: "Deterministic document summary for the Details tab (display_name, organization, domain, stats, facts, tags). Produced by the extractor \u2014 pass through verbatim.",
|
|
3594
|
+
properties: {
|
|
3595
|
+
display_name: { type: "string" },
|
|
3596
|
+
short_name: { type: "string" },
|
|
3597
|
+
organization: { type: "string" },
|
|
3598
|
+
domain: { type: "string" },
|
|
3599
|
+
domain_group: { type: "string" },
|
|
3600
|
+
tax_year: { type: "string" },
|
|
3601
|
+
crumbs: { type: "array", items: { type: "string" } },
|
|
3602
|
+
tags: { type: "array", items: { type: "string" } },
|
|
3603
|
+
stats: {
|
|
3604
|
+
type: "array",
|
|
3605
|
+
items: {
|
|
3606
|
+
type: "object",
|
|
3607
|
+
properties: {
|
|
3608
|
+
field_key: { type: "string" },
|
|
3609
|
+
label: { type: "string" },
|
|
3610
|
+
value: { type: "string" },
|
|
3611
|
+
caption: { type: "string" }
|
|
3612
|
+
},
|
|
3613
|
+
required: ["field_key", "label", "value"]
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
facts: {
|
|
3617
|
+
type: "array",
|
|
3618
|
+
items: {
|
|
3619
|
+
type: "object",
|
|
3620
|
+
properties: {
|
|
3621
|
+
field_key: { type: "string" },
|
|
3622
|
+
label: { type: "string" },
|
|
3623
|
+
value: { type: "string" },
|
|
3624
|
+
badge: { type: "string" }
|
|
3625
|
+
},
|
|
3626
|
+
required: ["field_key", "label", "value"]
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
},
|
|
3632
|
+
required: ["type"]
|
|
3633
|
+
}
|
|
3634
|
+
};
|
|
3635
|
+
var decisionCardSchema = zod.z.object({
|
|
3636
|
+
type: zod.z.literal("decision-card"),
|
|
3637
|
+
id: zod.z.string().optional(),
|
|
3638
|
+
decision_type: zod.z.string().optional(),
|
|
3639
|
+
title: zod.z.string(),
|
|
3640
|
+
question: zod.z.string(),
|
|
3641
|
+
amount: zod.z.number().optional(),
|
|
3642
|
+
currency: zod.z.string().optional(),
|
|
3643
|
+
amount_label: zod.z.string().optional(),
|
|
3644
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional(),
|
|
3645
|
+
flags: zod.z.array(
|
|
3646
|
+
zod.z.object({
|
|
3647
|
+
field: zod.z.string().optional(),
|
|
3648
|
+
issue: zod.z.string(),
|
|
3649
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional()
|
|
3650
|
+
})
|
|
3651
|
+
).max(6).optional(),
|
|
3652
|
+
options: zod.z.array(
|
|
3653
|
+
zod.z.object({
|
|
3654
|
+
id: zod.z.string().optional(),
|
|
3655
|
+
label: zod.z.string(),
|
|
3656
|
+
recommended: zod.z.boolean().optional()
|
|
3657
|
+
})
|
|
3658
|
+
).min(1).max(5),
|
|
3659
|
+
source: zod.z.object({
|
|
3660
|
+
label: zod.z.string().optional(),
|
|
3661
|
+
url: zod.z.string().optional()
|
|
3662
|
+
}).optional(),
|
|
3663
|
+
resolved: zod.z.object({
|
|
3664
|
+
option: zod.z.string()
|
|
3665
|
+
}).optional()
|
|
3666
|
+
});
|
|
3667
|
+
var decisionCardTool = {
|
|
3668
|
+
name: "render_decision_card",
|
|
3669
|
+
description: "Render an inline human-in-the-loop (HITL) decision card \u2014 a single judgment the agent needs from the user, resolved in-thread. Shows a titled question with an optional dollar amount at stake, optional data-quality flags, and 2-5 mutually-exclusive resolution options (the first or `recommended` one renders as the primary action), plus an optional 'view source' link. Use for inline approve/choose decisions the user resolves directly in the conversation. NOT for handing off to an external review portal (use escalation-card) and NOT for collecting multiple typed fields (use render_builder).",
|
|
3670
|
+
input_schema: {
|
|
3671
|
+
type: "object",
|
|
3672
|
+
properties: {
|
|
3673
|
+
type: { type: "string", enum: ["decision-card"] },
|
|
3674
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
3675
|
+
decision_type: {
|
|
3676
|
+
type: "string",
|
|
3677
|
+
description: "Short category shown in the eyebrow, e.g. 'Cross-check', 'Allocation', 'Reserve'"
|
|
3678
|
+
},
|
|
3679
|
+
title: { type: "string", description: "The decision headline, e.g. 'AR reserve adequacy'" },
|
|
3680
|
+
question: { type: "string", description: "The full question / context the user must judge" },
|
|
3681
|
+
amount: { type: "number", description: "Dollar value at stake, e.g. 27100" },
|
|
3682
|
+
currency: { type: "string", description: "ISO currency code; defaults to USD" },
|
|
3683
|
+
amount_label: { type: "string", description: "Caption above the amount, e.g. 'At stake'" },
|
|
3684
|
+
severity: {
|
|
3685
|
+
type: "string",
|
|
3686
|
+
enum: ["low", "medium", "high"],
|
|
3687
|
+
description: "Severity of the decision; tints the accent rail"
|
|
3688
|
+
},
|
|
3689
|
+
flags: {
|
|
3690
|
+
type: "array",
|
|
3691
|
+
maxItems: 6,
|
|
3692
|
+
description: "Optional data-quality flags surfaced on the card",
|
|
3693
|
+
items: {
|
|
3694
|
+
type: "object",
|
|
3695
|
+
properties: {
|
|
3696
|
+
field: { type: "string" },
|
|
3697
|
+
issue: { type: "string" },
|
|
3698
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
3699
|
+
},
|
|
3700
|
+
required: ["issue"]
|
|
3701
|
+
}
|
|
3702
|
+
},
|
|
3703
|
+
options: {
|
|
3704
|
+
type: "array",
|
|
3705
|
+
minItems: 1,
|
|
3706
|
+
maxItems: 5,
|
|
3707
|
+
description: "Mutually-exclusive resolution choices; mark one `recommended` to make it primary",
|
|
3708
|
+
items: {
|
|
3709
|
+
type: "object",
|
|
3710
|
+
properties: {
|
|
3711
|
+
id: { type: "string" },
|
|
3712
|
+
label: { type: "string" },
|
|
3713
|
+
recommended: { type: "boolean" }
|
|
3714
|
+
},
|
|
3715
|
+
required: ["label"]
|
|
3716
|
+
}
|
|
3717
|
+
},
|
|
3718
|
+
source: {
|
|
3719
|
+
type: "object",
|
|
3720
|
+
description: "Optional provenance link for the figure",
|
|
3721
|
+
properties: {
|
|
3722
|
+
label: { type: "string" },
|
|
3723
|
+
url: { type: "string" }
|
|
3724
|
+
}
|
|
3725
|
+
},
|
|
3726
|
+
resolved: {
|
|
3727
|
+
type: "object",
|
|
3728
|
+
description: "Pre-resolved state for transcript replay",
|
|
3729
|
+
properties: {
|
|
3730
|
+
option: { type: "string" }
|
|
3731
|
+
},
|
|
3732
|
+
required: ["option"]
|
|
3733
|
+
}
|
|
3734
|
+
},
|
|
3735
|
+
required: ["type", "title", "question", "options"]
|
|
3736
|
+
}
|
|
3737
|
+
};
|
|
3458
3738
|
|
|
3459
3739
|
// src/schemas/buildRenderUITool.ts
|
|
3460
3740
|
function buildRenderUITool(selectedSchemas) {
|
|
@@ -3573,7 +3853,9 @@ var schemaRegistry = {
|
|
|
3573
3853
|
"connect-integration": { schema: connectIntegrationSchema, tool: connectIntegrationTool },
|
|
3574
3854
|
"integrations-list": { schema: integrationsListSchema, tool: integrationsListTool },
|
|
3575
3855
|
"pipeline-preview": { schema: pipelinePreviewSchema, tool: pipelinePreviewTool },
|
|
3576
|
-
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool }
|
|
3856
|
+
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
3857
|
+
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
3858
|
+
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool }
|
|
3577
3859
|
};
|
|
3578
3860
|
|
|
3579
3861
|
exports.buildRenderUITool = buildRenderUITool;
|