@adoptai/genui-components 0.1.57 → 0.1.59

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.
Files changed (56) hide show
  1. package/dist/composites/document-field-extraction/FieldAuditLog.d.ts +27 -0
  2. package/dist/composites/document-field-extraction/FieldAuditLog.d.ts.map +1 -0
  3. package/dist/composites/document-field-extraction/FieldDetail.d.ts +22 -0
  4. package/dist/composites/document-field-extraction/FieldDetail.d.ts.map +1 -0
  5. package/dist/composites/document-field-extraction/FieldDetails.d.ts +18 -0
  6. package/dist/composites/document-field-extraction/FieldDetails.d.ts.map +1 -0
  7. package/dist/composites/document-field-extraction/bboxTransform.d.ts +25 -0
  8. package/dist/composites/document-field-extraction/bboxTransform.d.ts.map +1 -0
  9. package/dist/composites/document-field-extraction/fieldLabels.d.ts +2 -0
  10. package/dist/composites/document-field-extraction/fieldLabels.d.ts.map +1 -0
  11. package/dist/composites/document-field-extraction/resolver.cjs +1920 -0
  12. package/dist/composites/document-field-extraction/resolver.cjs.map +1 -0
  13. package/dist/composites/document-field-extraction/resolver.d.ts +16 -0
  14. package/dist/composites/document-field-extraction/resolver.d.ts.map +1 -0
  15. package/dist/composites/document-field-extraction/resolver.js +1913 -0
  16. package/dist/composites/document-field-extraction/resolver.js.map +1 -0
  17. package/dist/composites/tabby-auth/resolver.cjs +597 -0
  18. package/dist/composites/tabby-auth/resolver.cjs.map +1 -0
  19. package/dist/composites/tabby-auth/resolver.d.ts +3 -0
  20. package/dist/composites/tabby-auth/resolver.d.ts.map +1 -0
  21. package/dist/composites/tabby-auth/resolver.js +595 -0
  22. package/dist/composites/tabby-auth/resolver.js.map +1 -0
  23. package/dist/composites/workflow-stepper/resolver.cjs +86 -18
  24. package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
  25. package/dist/composites/workflow-stepper/resolver.d.ts.map +1 -1
  26. package/dist/composites/workflow-stepper/resolver.js +86 -18
  27. package/dist/composites/workflow-stepper/resolver.js.map +1 -1
  28. package/dist/index.cjs +2661 -345
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.ts +5 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2456 -144
  33. package/dist/index.js.map +1 -1
  34. package/dist/renderer.cjs +2482 -281
  35. package/dist/renderer.cjs.map +1 -1
  36. package/dist/renderer.js +2339 -138
  37. package/dist/renderer.js.map +1 -1
  38. package/dist/resolver.cjs +2481 -280
  39. package/dist/resolver.cjs.map +1 -1
  40. package/dist/resolver.d.ts.map +1 -1
  41. package/dist/resolver.js +2339 -138
  42. package/dist/resolver.js.map +1 -1
  43. package/dist/schemas/document-field-extraction.d.ts +258 -0
  44. package/dist/schemas/document-field-extraction.d.ts.map +1 -0
  45. package/dist/schemas/index.cjs +262 -3
  46. package/dist/schemas/index.cjs.map +1 -1
  47. package/dist/schemas/index.d.ts +376 -0
  48. package/dist/schemas/index.d.ts.map +1 -1
  49. package/dist/schemas/index.js +262 -3
  50. package/dist/schemas/index.js.map +1 -1
  51. package/dist/schemas/tabby-auth.d.ts +58 -0
  52. package/dist/schemas/tabby-auth.d.ts.map +1 -0
  53. package/dist/schemas/workflow-stepper.d.ts +60 -0
  54. package/dist/schemas/workflow-stepper.d.ts.map +1 -1
  55. package/dist/tool-definitions.json +326 -3
  56. package/package.json +1 -1
@@ -3393,7 +3393,32 @@ var workflowStepperSchema = z.object({
3393
3393
  n: z.number().int().positive().optional(),
3394
3394
  title: z.string(),
3395
3395
  sub: z.string().optional(),
3396
- status: z.enum(["done", "active", "review", "pending", "blocked", "failed"]),
3396
+ status: z.enum([
3397
+ "done",
3398
+ "active",
3399
+ "running",
3400
+ "review",
3401
+ "pending",
3402
+ "blocked",
3403
+ "failed"
3404
+ ]),
3405
+ // Optional quality-gate verdict for a step run by an executor (e.g. a
3406
+ // pipeline). Surfaces a subtle trust badge; flags hint at issues a human
3407
+ // should review (the full list lives in the escalation dock).
3408
+ eval: z.object({
3409
+ score: z.number().min(0).max(1).nullable().optional(),
3410
+ verdict: z.enum(["good", "bad"]).optional(),
3411
+ reasoning: z.string().optional(),
3412
+ judge_ok: z.boolean().optional(),
3413
+ data_quality_flags: z.array(
3414
+ z.object({
3415
+ field: z.string().optional(),
3416
+ issue: z.string().optional(),
3417
+ severity: z.enum(["low", "medium", "high"]).optional(),
3418
+ details: z.string().optional()
3419
+ })
3420
+ ).optional()
3421
+ }).optional(),
3397
3422
  assignees: z.array(
3398
3423
  z.object({
3399
3424
  name: z.string(),
@@ -3429,7 +3454,32 @@ var workflowStepperTool = {
3429
3454
  n: { type: "number", description: "Step number; defaults to index + 1" },
3430
3455
  title: { type: "string" },
3431
3456
  sub: { type: "string", description: "Short status caption, e.g. '7 accounts \xB7 2 exceptions'" },
3432
- status: { type: "string", enum: ["done", "active", "review", "pending", "blocked", "failed"] },
3457
+ status: {
3458
+ type: "string",
3459
+ enum: ["done", "active", "running", "review", "pending", "blocked", "failed"]
3460
+ },
3461
+ eval: {
3462
+ type: "object",
3463
+ description: "Optional quality-gate verdict for an executor-run step.",
3464
+ properties: {
3465
+ score: { type: "number" },
3466
+ verdict: { type: "string", enum: ["good", "bad"] },
3467
+ reasoning: { type: "string" },
3468
+ judge_ok: { type: "boolean" },
3469
+ data_quality_flags: {
3470
+ type: "array",
3471
+ items: {
3472
+ type: "object",
3473
+ properties: {
3474
+ field: { type: "string" },
3475
+ issue: { type: "string" },
3476
+ severity: { type: "string", enum: ["low", "medium", "high"] },
3477
+ details: { type: "string" }
3478
+ }
3479
+ }
3480
+ }
3481
+ }
3482
+ },
3433
3483
  assignees: {
3434
3484
  type: "array",
3435
3485
  maxItems: 6,
@@ -3453,6 +3503,183 @@ var workflowStepperTool = {
3453
3503
  required: ["type", "title", "steps"]
3454
3504
  }
3455
3505
  };
3506
+ var bbox = z.tuple([z.number(), z.number(), z.number(), z.number()]);
3507
+ var fieldSchema = z.object({
3508
+ field_key: z.string(),
3509
+ label: z.string(),
3510
+ value: z.string(),
3511
+ page: z.number(),
3512
+ // 0-indexed, matches PageDimension.page
3513
+ bbox: bbox.nullable().optional(),
3514
+ confidence: z.number().optional(),
3515
+ confidence_tier: z.enum(["green", "amber", "red"]).optional(),
3516
+ badge: z.enum(["SC", "CN", "AB", "SW"]).optional(),
3517
+ state: z.enum(["ok", "corrected", "missing", "warn"]).optional(),
3518
+ entity_type: z.string().optional(),
3519
+ is_primary: z.boolean().optional(),
3520
+ // Set after a human correction (extractor output, or an optimistic in-card
3521
+ // edit) so the editable field card can show old → new and who changed it.
3522
+ previous_value: z.string().nullable().optional(),
3523
+ corrected_by: z.string().nullable().optional()
3524
+ });
3525
+ var pageSchema = z.object({
3526
+ page: z.number(),
3527
+ // 0-indexed
3528
+ imageUrl: z.string().optional(),
3529
+ // host-resolved from the durable image_ref
3530
+ width_pt: z.number(),
3531
+ height_pt: z.number()
3532
+ });
3533
+ var summaryStatSchema = z.object({
3534
+ field_key: z.string(),
3535
+ label: z.string(),
3536
+ value: z.string(),
3537
+ caption: z.string().nullable().optional()
3538
+ });
3539
+ var summaryFactSchema = z.object({
3540
+ field_key: z.string(),
3541
+ label: z.string(),
3542
+ value: z.string(),
3543
+ badge: z.string().nullable().optional()
3544
+ });
3545
+ var summarySchema = z.object({
3546
+ display_name: z.string().nullable().optional(),
3547
+ short_name: z.string().nullable().optional(),
3548
+ organization: z.string().nullable().optional(),
3549
+ domain: z.string().nullable().optional(),
3550
+ domain_group: z.string().nullable().optional(),
3551
+ tax_year: z.union([z.string(), z.number()]).nullable().optional(),
3552
+ crumbs: z.array(z.string()).optional(),
3553
+ tags: z.array(z.string()).optional(),
3554
+ stats: z.array(summaryStatSchema).optional(),
3555
+ facts: z.array(summaryFactSchema).optional()
3556
+ });
3557
+ var documentFieldExtractionSchema = z.object({
3558
+ type: z.literal("document-field-extraction"),
3559
+ doc_type: z.string().optional(),
3560
+ // Original uploaded filename (e.g. "2024_gl.pdf"); preferred over doc_type for
3561
+ // the card title since doc_type is often the "generic_fallback" schema name.
3562
+ file_name: z.string().optional(),
3563
+ // Server-side token; resolved by the host into pages/fields before render.
3564
+ payload_ref: z.string().optional(),
3565
+ // Present for persisted workstream docs; absent for pre-existing cards.
3566
+ store_id: z.string().optional(),
3567
+ doc_id: z.string().optional(),
3568
+ pages: z.array(pageSchema).max(100).optional(),
3569
+ fields: z.array(fieldSchema).max(1e3).optional(),
3570
+ // Page-count metadata for the Details tab ("N of M pages extracted").
3571
+ page_count: z.number().optional(),
3572
+ pages_processed: z.number().optional(),
3573
+ // Deterministic document summary for the Details tab.
3574
+ summary: summarySchema.nullable().optional()
3575
+ });
3576
+ var documentFieldExtractionTool = {
3577
+ name: "render_document_field_extraction",
3578
+ 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.",
3579
+ input_schema: {
3580
+ type: "object",
3581
+ properties: {
3582
+ type: { type: "string", enum: ["document-field-extraction"] },
3583
+ doc_type: { type: "string" },
3584
+ file_name: {
3585
+ type: "string",
3586
+ description: "Original uploaded filename; shown as the card title."
3587
+ },
3588
+ payload_ref: {
3589
+ type: "string",
3590
+ 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."
3591
+ },
3592
+ store_id: {
3593
+ type: "string",
3594
+ description: "Docstore store id; present for persisted workstream docs. The host uses this to open the editable viewer."
3595
+ },
3596
+ doc_id: {
3597
+ type: "string",
3598
+ description: "Docstore document id; present for persisted workstream docs. Required for the editable viewer."
3599
+ },
3600
+ pages: {
3601
+ type: "array",
3602
+ items: {
3603
+ type: "object",
3604
+ properties: {
3605
+ page: { type: "number", description: "0-indexed page number" },
3606
+ imageUrl: { type: "string" },
3607
+ width_pt: { type: "number" },
3608
+ height_pt: { type: "number" }
3609
+ },
3610
+ required: ["page", "width_pt", "height_pt"]
3611
+ }
3612
+ },
3613
+ fields: {
3614
+ type: "array",
3615
+ items: {
3616
+ type: "object",
3617
+ properties: {
3618
+ field_key: { type: "string" },
3619
+ label: { type: "string" },
3620
+ value: { type: "string" },
3621
+ page: { type: "number", description: "0-indexed page number" },
3622
+ bbox: {
3623
+ type: "array",
3624
+ items: { type: "number" },
3625
+ description: "[x0,y0,x1,y1] PDF points, origin bottom-left; null if unlocated"
3626
+ },
3627
+ confidence: { type: "number" },
3628
+ confidence_tier: { type: "string", enum: ["green", "amber", "red"] },
3629
+ badge: { type: "string", enum: ["SC", "CN", "AB", "SW"] },
3630
+ state: { type: "string", enum: ["ok", "corrected", "missing", "warn"] },
3631
+ entity_type: { type: "string" },
3632
+ is_primary: { type: "boolean" }
3633
+ },
3634
+ required: ["field_key", "label", "value", "page"]
3635
+ }
3636
+ },
3637
+ page_count: { type: "number" },
3638
+ pages_processed: { type: "number" },
3639
+ summary: {
3640
+ type: "object",
3641
+ description: "Deterministic document summary for the Details tab (display_name, organization, domain, stats, facts, tags). Produced by the extractor \u2014 pass through verbatim.",
3642
+ properties: {
3643
+ display_name: { type: "string" },
3644
+ short_name: { type: "string" },
3645
+ organization: { type: "string" },
3646
+ domain: { type: "string" },
3647
+ domain_group: { type: "string" },
3648
+ tax_year: { type: "string" },
3649
+ crumbs: { type: "array", items: { type: "string" } },
3650
+ tags: { type: "array", items: { type: "string" } },
3651
+ stats: {
3652
+ type: "array",
3653
+ items: {
3654
+ type: "object",
3655
+ properties: {
3656
+ field_key: { type: "string" },
3657
+ label: { type: "string" },
3658
+ value: { type: "string" },
3659
+ caption: { type: "string" }
3660
+ },
3661
+ required: ["field_key", "label", "value"]
3662
+ }
3663
+ },
3664
+ facts: {
3665
+ type: "array",
3666
+ items: {
3667
+ type: "object",
3668
+ properties: {
3669
+ field_key: { type: "string" },
3670
+ label: { type: "string" },
3671
+ value: { type: "string" },
3672
+ badge: { type: "string" }
3673
+ },
3674
+ required: ["field_key", "label", "value"]
3675
+ }
3676
+ }
3677
+ }
3678
+ }
3679
+ },
3680
+ required: ["type"]
3681
+ }
3682
+ };
3456
3683
  var decisionCardSchema = z.object({
3457
3684
  type: z.literal("decision-card"),
3458
3685
  id: z.string().optional(),
@@ -3556,6 +3783,36 @@ var decisionCardTool = {
3556
3783
  required: ["type", "title", "question", "options"]
3557
3784
  }
3558
3785
  };
3786
+ var tabbyAuthSchema = z.object({
3787
+ type: z.literal("tabby-auth"),
3788
+ app: z.string(),
3789
+ url: z.string(),
3790
+ workspace: z.string().optional(),
3791
+ state: z.enum(["pending", "connected"]).optional(),
3792
+ ctaLabel: z.string().optional(),
3793
+ steps: z.array(z.string()).optional(),
3794
+ description: z.string().optional(),
3795
+ iconUrl: z.string().optional()
3796
+ });
3797
+ var tabbyAuthTool = {
3798
+ name: "render_tabby_auth",
3799
+ description: "Render a dedicated, trustworthy sign-in card when a harness skill needs the member to authenticate with a third-party app (e.g. Sage Intacct, Airbnb, an ERP) before a `call_web_api` request can proceed. Use this for the `login_required` path instead of a raw markdown link or a connect-integration card. `app` is the human display name (drives the title context, subtitle, and CTA). `url` is the login/short-link the prominent CTA opens in a new tab. `workspace` adds a subtitle suffix ('{app} \xB7 {workspace} workspace'). `state='pending'` (default) is the first-time connect; `state='connected'` is the verify/re-auth case (session already live) with a green badge and an Open deep-link. `steps` overrides the default numbered instructions; `description` is a one-line intro. The card title ('Authentication required') and the 'Credentials not stored by Adopt' trust footer are hardcoded brand constants \u2014 never supplied here.",
3800
+ input_schema: {
3801
+ type: "object",
3802
+ properties: {
3803
+ type: { type: "string", enum: ["tabby-auth"] },
3804
+ app: { type: "string" },
3805
+ url: { type: "string" },
3806
+ workspace: { type: "string" },
3807
+ state: { type: "string", enum: ["pending", "connected"] },
3808
+ ctaLabel: { type: "string" },
3809
+ steps: { type: "array", items: { type: "string" } },
3810
+ description: { type: "string" },
3811
+ iconUrl: { type: "string" }
3812
+ },
3813
+ required: ["type", "app", "url"]
3814
+ }
3815
+ };
3559
3816
 
3560
3817
  // src/schemas/buildRenderUITool.ts
3561
3818
  function buildRenderUITool(selectedSchemas) {
@@ -3675,7 +3932,9 @@ var schemaRegistry = {
3675
3932
  "integrations-list": { schema: integrationsListSchema, tool: integrationsListTool },
3676
3933
  "pipeline-preview": { schema: pipelinePreviewSchema, tool: pipelinePreviewTool },
3677
3934
  "workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
3678
- "decision-card": { schema: decisionCardSchema, tool: decisionCardTool }
3935
+ "document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
3936
+ "decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
3937
+ "tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
3679
3938
  };
3680
3939
 
3681
3940
  export { buildRenderUITool, schemaRegistry, validatePayload };