@nocobase/portal-template-default 1.0.7 → 1.0.9

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 (43) hide show
  1. package/dist/assets/CoordinateSystem-C8P-Cleg.js +1 -0
  2. package/dist/assets/LegendVisualProvider-Bdgkckq-.js +1 -0
  3. package/dist/assets/LineDraw-C0m1GONT.js +1 -0
  4. package/dist/assets/SymbolDraw-CCospe5G.js +1 -0
  5. package/dist/assets/VisualMapping-Cbv1v7Cd.js +1 -0
  6. package/dist/assets/ai-employee-shortcut-B253WWow.js +1 -0
  7. package/dist/assets/calendar-B3dXXyIv.js +1 -0
  8. package/dist/assets/chat-inline-xpQ9iq4p.js +1 -0
  9. package/dist/assets/chat-side-panel-layout-BVWsp5rr.js +1 -0
  10. package/dist/assets/components-ChhJaNRc.js +20 -0
  11. package/dist/assets/configuration-gate-Dwdq_lxf.js +1 -0
  12. package/dist/assets/createClipPathFromCoordSys-uEftn1Mq.js +1 -0
  13. package/dist/assets/createSeriesDataSimply-CI7l7Ufv.js +1 -0
  14. package/dist/assets/customGraphicKeyframeAnimation-DE3jSfMd.js +3 -0
  15. package/dist/assets/echarts-preview-C-cNUtJF.js +1 -0
  16. package/dist/assets/echarts-runtime-CEgJbv68.js +58 -0
  17. package/dist/assets/echarts-runtime-advanced-Buhm2BHz.js +1 -0
  18. package/dist/assets/echarts-runtime-common-DLAdBAIa.js +1 -0
  19. package/dist/assets/echarts-runtime-components-ypnyLkYx.js +1 -0
  20. package/dist/assets/echarts-runtime-hierarchy-ClStquCF.js +1 -0
  21. package/dist/assets/floating-BarTmn-b.js +13 -0
  22. package/dist/assets/index-BJIcYTdc.js +53 -0
  23. package/dist/assets/index-C6xNKxpg.js +656 -0
  24. package/dist/assets/index-D4JQi1TM.js +54 -0
  25. package/dist/assets/index-YA7-AUO8.css +1 -0
  26. package/dist/assets/index-g8zWVpP9.js +23 -0
  27. package/dist/assets/labelHelper-C137W5gU.js +1 -0
  28. package/dist/assets/nocobase-ai-chat-VTMaZFQB.svg +50 -0
  29. package/dist/assets/page-context-Cxx11gzg.js +73 -0
  30. package/dist/assets/prompt-card-BsYMW_rq.js +1 -0
  31. package/dist/assets/sectorHelper-Fqgz3uEk.js +1 -0
  32. package/dist/assets/shortcut-xtghDP63.js +47 -0
  33. package/dist/assets/static.browser-CfQQzERe.js +30 -0
  34. package/dist/assets/switch-DrxImI8F.js +1 -0
  35. package/dist/assets/tool-cards-BGfsY8JF.js +41 -0
  36. package/dist/favicon.ico +0 -0
  37. package/dist/index.html +40 -0
  38. package/dist/index.raw.html +46 -0
  39. package/dist/logo-dark.png +0 -0
  40. package/dist/logo-mark-dark.png +0 -0
  41. package/dist/logo-mark.png +0 -0
  42. package/dist/logo.png +0 -0
  43. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ <svg width="878" height="878" viewBox="0 0 878 878" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2002_119)">
3
+ <circle cx="439" cy="439" r="439" fill="url(#paint0_linear_2002_119)"/>
4
+ <mask id="mask0_2002_119" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="878" height="878">
5
+ <path d="M0 439C0 196.547 196.547 0 439 0C681.453 0 878 196.547 878 439C878 681.453 681.453 878 439 878C196.547 878 0 681.453 0 439Z" fill="url(#paint1_linear_2002_119)"/>
6
+ </mask>
7
+ <g mask="url(#mask0_2002_119)">
8
+ <path d="M159.539 597.752V635.001C159.539 642.174 57.0002 639.762 57.0002 629.419C57.0002 619.684 57.1917 575.572 57.0002 530.188C34.0374 499.434 34.0374 480.212 52.1937 460.346C70.3489 440.48 199.594 430.547 199.594 430.547C199.594 430.547 209.291 526.913 210.81 553.053C211.42 563.566 218.02 597.752 192.385 597.752H159.539Z" fill="#D1B9F0"/>
9
+ <g style="mix-blend-mode:multiply">
10
+ <path d="M159.501 594.57C138.626 592.216 118.452 585.408 100.258 574.574C100.258 574.574 113.075 606.029 159.501 614.565V594.57Z" fill="#A9A5A5"/>
11
+ </g>
12
+ <path d="M276.491 709.179C286.66 730.543 294.672 765.86 300.524 815.131H-84C-78.1446 765.855 -70.1337 730.537 -59.9672 709.179C-49.8351 687.89 44.1751 646.917 44.1751 646.917C44.1751 646.917 46.0459 628.189 50.5832 625.504C55.1205 622.819 160.537 622.82 165.941 625.504C171.345 628.187 172.35 646.907 172.35 646.907C172.35 646.907 266.379 687.934 276.491 709.179Z" fill="#9066ED"/>
13
+ <path d="M110.043 539.15C102.51 520.344 81.7101 442.202 105.803 442.202C125.737 456.505 137.339 461.708 163.674 433.567C168.878 449.972 179.314 452.938 197.425 455.486L206.888 496.108V446.392C217.781 447.525 226.438 448.753 228.565 441.044C230.692 433.336 216.952 423.763 216.952 423.763C216.952 423.763 237.172 428.326 236.875 417.291C236.578 406.256 216.918 398.121 216.918 398.121C216.918 398.121 240.567 401.572 240.08 385.273C239.595 368.974 120.799 335.204 61.8955 393.059C43.4601 389.953 33.4321 388.948 22.6513 404.113C15.7356 421.257 23.7293 428.994 35.9311 443.119C26.8545 443.818 25.5811 446.238 23.6146 452.927C21.6481 459.617 30.268 472.499 40.1055 483.145C31.7259 488.149 27.5177 488.165 28.5129 496.108C29.5081 504.049 40.2321 507.547 40.2321 507.547L57.9336 531.281V576.013L68.8192 500.923C81.5994 519.66 90.5075 538.781 95.6122 563.173C102.025 593.822 142.911 606.248 183.797 606.248C207.847 606.248 223.079 586.367 211.054 553.233C210.253 556.547 203.358 562.061 190.211 564.001C173.375 566.487 119.663 563.173 110.043 539.15Z" fill="black"/>
14
+ <path d="M110.043 539.15C102.51 520.344 81.7101 442.202 105.803 442.202C125.737 456.505 137.339 461.708 163.674 433.567C168.878 449.972 179.314 452.938 197.425 455.486L206.888 496.108V446.392C217.781 447.525 226.438 448.753 228.565 441.044C230.692 433.336 216.952 423.763 216.952 423.763C216.952 423.763 237.172 428.326 236.875 417.291C236.578 406.256 216.918 398.121 216.918 398.121C216.918 398.121 240.567 401.572 240.08 385.273C239.595 368.974 120.799 335.204 61.8955 393.059C43.4601 389.953 33.4321 388.948 22.6513 404.113C15.7356 421.257 23.7293 428.994 35.9311 443.119C26.8545 443.818 25.5811 446.238 23.6146 452.927C21.6481 459.617 30.268 472.499 40.1055 483.145C31.7259 488.149 27.5177 488.165 28.5129 496.108C29.5081 504.049 40.2321 507.547 40.2321 507.547L57.9336 531.281V576.013L68.8192 500.923C81.5994 519.66 90.5075 538.781 95.6122 563.173C102.025 593.822 142.911 606.248 183.797 606.248C207.847 606.248 223.079 586.367 211.054 553.233C210.253 556.547 203.358 562.061 190.211 564.001C173.375 566.487 119.663 563.173 110.043 539.15Z" fill="#644B85"/>
15
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M196.196 541.84C196.707 542.848 196.33 544.094 195.354 544.622C176.02 555.08 162.648 546.013 158.266 539.686C157.625 538.76 157.832 537.473 158.728 536.81C159.623 536.148 160.87 536.362 161.51 537.287C164.852 542.112 176.106 550.382 193.505 540.97C194.48 540.442 195.685 540.832 196.196 541.84Z" fill="white"/>
16
+ <path d="M800.108 409.771C788.692 373.235 768.964 361 738.848 361C683.204 361 619.222 404.799 623.145 468.797C627.354 537.442 613.508 572.319 594.223 584.629C594.223 584.629 634.771 610.274 714.717 605.851C696.088 590.271 686.276 565.652 685.976 545.035C685.787 532.138 689.398 483.926 689.66 476.918C753.943 480.935 788.097 455.857 788.097 455.857C788.097 455.857 760.834 507.024 764.93 531.742C769.026 556.461 761.872 582.422 759.673 590.727C758.274 596.015 846.798 590.957 852.722 584.629C856.103 581.018 838.5 549.238 836.522 525.644C834.281 498.915 846.908 479.995 842.654 460.314C836.488 431.782 825.643 411.778 800.108 409.771Z" fill="#644B85"/>
17
+ <path d="M682.801 617.325C682.801 602.148 682.303 527.288 682.328 526.023C642.156 532.165 642.969 452.906 683.614 472.3C692.556 478.201 717.755 472.3 715.317 423.396C759.213 472.3 810.176 415.26 814.546 461.74C820.514 525.205 814.511 591.624 776.485 591.629C772.325 591.576 768.177 591.147 764.09 590.344V617.325C764.09 634.189 793.354 642.62 793.354 642.62C793.354 642.62 742.805 692.031 721.82 691.757C700.834 691.484 653.537 642.62 653.537 642.62C653.537 642.62 682.801 634.189 682.801 617.325Z" fill="#D1B9F0"/>
18
+ <g style="mix-blend-mode:multiply">
19
+ <path d="M764.083 590.336C743.914 585.695 724.801 577.049 707.8 564.874C707.8 564.874 721.828 600.443 764.031 607.192L764.083 590.336Z" fill="#9F9F9F"/>
20
+ </g>
21
+ <path d="M873.111 715.2C884.91 752.604 891 866 891 866H556C556 866 562.09 752.604 573.888 715.2C584.225 682.434 652.335 644.813 672.295 634C683.82 652.392 700.336 664.159 723.5 664.159C746.663 664.159 763.18 652.392 774.704 634C794.664 644.813 862.775 682.434 873.111 715.2Z" fill="#E1CBED"/>
22
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M810.507 513.765C823.869 514.972 835.644 504.715 836.808 490.855C837.972 476.995 828.083 464.781 814.721 463.574C801.36 462.367 789.584 472.624 788.42 486.483C787.256 500.343 797.145 512.557 810.507 513.765ZM810.156 517.948C825.744 519.356 839.482 507.39 840.84 491.22C842.198 475.051 830.662 460.8 815.073 459.392C799.484 457.983 785.746 469.95 784.388 486.119C783.03 502.289 794.566 516.539 810.156 517.948Z" fill="white"/>
23
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M742.179 517.072C755.541 518.279 767.317 508.022 768.482 494.163C769.645 480.303 759.757 468.089 746.395 466.881C733.033 465.674 721.257 475.931 720.094 489.791C718.929 503.651 728.817 515.865 742.179 517.072ZM741.828 521.254C757.418 522.663 771.155 510.697 772.513 494.528C773.872 478.357 762.335 464.107 746.746 462.699C731.157 461.29 717.419 473.256 716.061 489.427C714.703 505.596 726.239 519.846 741.828 521.254Z" fill="white"/>
24
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M772.23 484.946C774.285 483.156 776.941 482.285 779.614 482.527C782.288 482.768 784.76 484.102 786.485 486.234C788.212 488.366 789.05 491.121 788.817 493.894L784.785 493.53C784.925 491.866 784.421 490.213 783.386 488.934C782.351 487.655 780.867 486.854 779.263 486.71C777.659 486.565 776.065 487.086 774.832 488.161C773.599 489.235 772.828 490.774 772.688 492.437L768.656 492.073C768.888 489.3 770.173 486.736 772.23 484.946Z" fill="white"/>
25
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M687.49 492.673L718.216 489.656L718.597 493.835L687.872 496.854L687.49 492.673Z" fill="white"/>
26
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M810.507 513.765C823.869 514.972 835.644 504.715 836.808 490.855C837.972 476.995 828.083 464.781 814.721 463.574C801.36 462.367 789.584 472.624 788.42 486.483C787.256 500.343 797.145 512.557 810.507 513.765ZM810.156 517.948C825.744 519.356 839.482 507.39 840.84 491.22C842.198 475.051 830.662 460.8 815.073 459.392C799.484 457.983 785.746 469.95 784.388 486.119C783.03 502.289 794.566 516.539 810.156 517.948Z" fill="white"/>
27
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M742.179 517.072C755.541 518.279 767.317 508.023 768.482 494.164C769.645 480.304 759.757 468.09 746.395 466.882C733.033 465.675 721.257 475.931 720.094 489.791C718.929 503.651 728.817 515.865 742.179 517.072ZM741.828 521.255C757.418 522.663 771.155 510.697 772.513 494.528C773.872 478.358 762.335 464.108 746.746 462.699C731.157 461.29 717.419 473.257 716.061 489.427C714.703 505.596 726.239 519.846 741.828 521.255Z" fill="white"/>
28
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M772.23 484.946C774.285 483.156 776.941 482.285 779.614 482.527C782.288 482.768 784.76 484.102 786.485 486.234C788.212 488.366 789.05 491.121 788.817 493.894L784.785 493.53C784.925 491.866 784.421 490.213 783.386 488.934C782.351 487.655 780.867 486.854 779.263 486.709C777.659 486.565 776.065 487.086 774.832 488.161C773.599 489.235 772.828 490.773 772.688 492.437L768.656 492.073C768.888 489.3 770.173 486.736 772.23 484.946Z" fill="white"/>
29
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M687.49 492.673L718.216 489.656L718.597 493.835L687.872 496.854L687.49 492.673Z" fill="white"/>
30
+ <path d="M612.419 368.971C612.419 437.401 538.694 459.726 496.644 408.286L531.072 546.095C644.606 610.588 726.741 719.073 724.77 755.925L612.419 878L478.386 792.778C189.822 708.017 217.548 527.13 267.481 447.283C259.597 233.536 389.773 220.01 478.386 286.051C579.305 258.412 609.791 329.813 612.419 368.971Z" fill="#644B85"/>
31
+ <path d="M180.406 720.095C162.803 754.212 154 878.494 154 878.494H648.497C648.497 878.494 639.694 754.212 622.091 720.095C595.687 668.921 401.249 603.124 401.249 603.124C401.249 603.124 206.811 668.921 180.406 720.095Z" fill="#E1CBED"/>
32
+ <path d="M343.645 632.11C343.645 632.11 374.877 671.364 403.068 671.364C431.26 671.364 458.867 632.11 458.867 632.11V578.968C464.932 579.932 471.075 580.3 477.211 580.064C534.794 580.06 556.506 495.66 545.284 392.973C538.083 392.973 521.279 392.973 497.275 359.155C503.275 406.258 433.662 399.011 407.258 361.571C420.459 406.258 385.653 436.453 355.647 418.336C296.809 382.81 283.582 491.106 343.645 492.009V632.11Z" fill="#D1B9F0"/>
33
+ <path d="M458.879 578.971C429.101 573.454 400.607 562.396 374.862 546.362C374.862 546.362 404.868 598.295 458.879 598.295V578.971Z" fill="#80728F"/>
34
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M282.556 506.505C282.556 488.239 297.272 473.43 315.425 473.43V467.416C293.972 467.416 276.579 484.918 276.579 506.505C276.579 528.093 293.972 545.595 315.425 545.595C336.878 545.595 354.271 528.093 354.271 506.505C354.271 496.741 349.363 488.796 345.13 481.944C344.751 481.329 344.376 480.723 344.011 480.125L344.005 480.116L342.619 477.86L337.536 481.027L338.918 483.273L338.921 483.277C339.257 483.826 339.592 484.372 339.923 484.913C344.296 492.03 348.294 498.537 348.294 506.505C348.294 524.772 333.578 539.581 315.425 539.581C297.272 539.581 282.556 524.772 282.556 506.505Z" fill="white"/>
35
+ </g>
36
+ </g>
37
+ <defs>
38
+ <linearGradient id="paint0_linear_2002_119" x1="726" y1="116" x2="63" y2="699.5" gradientUnits="userSpaceOnUse">
39
+ <stop stop-color="#9169EB"/>
40
+ <stop offset="1" stop-color="#FBC2EB"/>
41
+ </linearGradient>
42
+ <linearGradient id="paint1_linear_2002_119" x1="101.5" y1="712.5" x2="684.5" y2="81.5" gradientUnits="userSpaceOnUse">
43
+ <stop stop-color="#E6C1DC"/>
44
+ <stop offset="1" stop-color="#8E64EE"/>
45
+ </linearGradient>
46
+ <clipPath id="clip0_2002_119">
47
+ <rect width="878" height="878" fill="white"/>
48
+ </clipPath>
49
+ </defs>
50
+ </svg>
@@ -0,0 +1,73 @@
1
+ import{aZ as F,r as t,j as e,w as j,x as A,y as T,A as P,D as i,I as y,T as U,m as k,n as N,o as C,p as S,v as l,ae as R,a3 as ce,ag as de,ah as me,af as he,a_ as M,l as b,a9 as $,ak as _,a$ as J,b3 as ue,b4 as xe,B as pe,b5 as ge,b6 as je}from"./index-C6xNKxpg.js";import{C as B}from"./chat-inline-xpQ9iq4p.js";import{A as D}from"./ai-employee-shortcut-B253WWow.js";import{A as fe}from"./configuration-gate-Dwdq_lxf.js";import{S as ve}from"./switch-DrxImI8F.js";import{P as ye}from"./prompt-card-BsYMW_rq.js";const be=n=>!["nathan","dara"].includes(n.toLowerCase());function we(){var Z,X;const{employees:n}=F(),r=n.filter(a=>be(a.username)),[o,d]=t.useState(((Z=r[0])==null?void 0:Z.username)??((X=n[0])==null?void 0:X.username)??""),[x,c]=t.useState("Customer renewal workspace"),[p,g]=t.useState("Show a customer renewal detail with account health, contract value, renewal date, owner, recent activity, and a working AI conversation beside it."),[m,f]=t.useState("Review renewal risk"),[s,I]=t.useState("Review this customer renewal, identify risks, and recommend the next action."),[h,v]=t.useState(!1),[w,K]=t.useState("shortcut"),[u,z]=t.useState("renewal-detail"),[q,ee]=t.useState("Customer renewal detail"),[V,te]=t.useState("context"),[H,se]=t.useState("update_renewal_plan"),[W,ae]=t.useState("Update the renewal risk level and the visible follow-up note on the page."),[O,ne]=t.useState("ASK"),re=t.useMemo(()=>{var Y;const a=((Y=n.find(le=>le.username===o))==null?void 0:Y.nickname)??o,Q=`{ type: "page-element", id: "${u}", title: "${q}" }`,G=w==="manual"?!1:h,oe={shortcut:`Place an AIEmployeeShortcut in the page header, visually separated from the registered business element. Target the embedded chat controller and configure this task on its tasks prop:
2
+ - Title: ${m}
3
+ - User message: ${s}
4
+ - Auto send: ${G}
5
+ - Set task.message.workContext to [${Q}].
6
+
7
+ The Shortcut must remain outside the registered element so the scene clearly demonstrates an explicit task-to-context reference.`,preset:`Do not render an AIEmployeeShortcut. Configure AIChatProvider.employeeTasks for ${a} (${o}) and show this task in the embedded conversation empty state:
8
+ - Title: ${m}
9
+ - User message: ${s}
10
+ - Auto send: ${G}
11
+ - Set task.message.workContext to [${Q}].
12
+
13
+ The task should disappear after a conversation starts and must resolve the latest page values when triggered.`,scope:`Place an AIEmployeeShortcut in the scene header and wrap both the business work area and chat surface with:
14
+
15
+ <AIPageContextScope context={${Q}}>
16
+ {/* Complete business scene and conversation */}
17
+ </AIPageContextScope>
18
+
19
+ Configure the Shortcut task without message.workContext so it inherits the surrounding context. Keep the registered element and task visibly within the same scoped scene.`,manual:`Do not pre-attach workContext to a Shortcut or preset task. Add a "Pick page element" composer action using useAIPageElementPicker. When the user selects an element, call addWorkContext(item) and focusComposer().
20
+
21
+ Show "${s}" as a suggested prompt near the chat, but keep it in the composer for review. The user must pick context manually before sending, so this scene must not auto-send.`}[w],ie={context:"Build the primary work area as a polished, read-only business detail view based on the scene brief. Include at least five realistic fields, a status indicator, and a short recent-activity section. Register the complete detail region with useAIPageElementHandle and return its current serializable values from getContext. Reuse handle.ref on the visible element and handle.context wherever the scene needs a context reference.","form-filler":`Build the primary work area with two connected parts: realistic source material and an editable business form derived from the scene brief. Use React Hook Form and register the form with useAIForm using id "${u}", meaningful field definitions, getValues, and setValues.
22
+
23
+ Use the fixed built-in formFiller Tool. Do not register Form filler as a custom frontend Tool and do not add formFiller manually to task.skillSettings: the Registry activates it automatically when a registered form context is sent. The Tool may fill declared editable values only and must never submit or save the form. Include a visible reset action and import applyReactHookFormValues from the optional adapters/react-hook-form Registry item for setValues.`,"custom-tool":`Register a custom frontend Tool on the useAIPageElement descriptor:
24
+ - Name: ${H}
25
+ - Business action: ${W}
26
+ - Permission: ${O}
27
+ - Provide a concise description, JSON inputSchema, and execute(args).
28
+
29
+ Build visible state in the business work area that clearly changes when this Tool succeeds, including before/after values or a status/note update. Keep it separate from the fixed formFiller Tool. The execute function must update only the current React page state and return a serializable result. NocoBase runtime handles ASK / ALLOW execution behavior.
30
+ `}[V];return`Build a complete, self-contained NocoBase AI page-context scene.
31
+
32
+ Scene
33
+ - Title: ${x}
34
+ - Business brief: ${p}
35
+ - Create a dedicated demo page or scene component rather than adding an isolated integration snippet to an unspecified page.
36
+ - Use realistic fixed sample data so the scene works immediately without additional backend setup.
37
+ - Add a clear page header, a primary business work area, and an embedded AI conversation in a responsive two-column layout. Stack the conversation below the work area on smaller screens.
38
+ - Keep one AIChatProvider mounted for the entire scene and target the same chat controller from any Shortcut.
39
+
40
+ AI employee and task
41
+ - Employee: ${a} (${o})
42
+ - Task: ${m}
43
+ - Message: ${s}
44
+ - Auto send: ${G}
45
+
46
+ Business context
47
+ - Context id: ${u}
48
+ - Context title: ${q}
49
+ - Register a visible, meaningful business element with this stable id.
50
+ - Resolve its content at task or message send time so the AI always receives the latest displayed values.
51
+ - Prefer useAIPageElementHandle so the registered ref and context reference cannot drift apart.
52
+
53
+ AI interaction pattern
54
+ ${oe}
55
+
56
+ Business surface and capability
57
+ ${ie}
58
+
59
+ Implementation requirements
60
+ - Use AIProvider and AIPageElementProvider from the NocoBase AI Registry.
61
+ - Use AIChatProvider, ChatInline, AIChatWindow, and useAIChatController to create the working conversation beside the business surface.
62
+ - The finished result must demonstrate the entire user journey: inspect or edit the business surface, trigger or compose the AI request, see the selected context, and observe the response or page update.
63
+ - Keep page context serializable. Never pass React instances, DOM nodes, form instances, or callback functions to the backend.
64
+ - Public React APIs use context id, not Flow Model uid.
65
+ - Page-context resolution errors must block sending and remain visible to the user; do not silently send an unresolved reference.
66
+ - Explicit task message.workContext takes precedence over trigger context and AIPageContextScope.
67
+ - A task without explicit context inherits the surrounding scope.
68
+ - Manual Pick affects only the current composed message.
69
+ - Preserve NocoBase streaming, conversation history, Tool approval, and resume behavior.
70
+ - Use shadcn/Base UI components and the existing Registry components.
71
+ - Deliver the complete component code, including sample state, context registration, task configuration, chat layout, and all visible business UI.`},[h,V,u,q,o,n,w,p,x,s,m,W,H,O]);return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[390px_minmax(0,1fr)]",children:[e.jsxs(j,{className:"gap-0 py-0",children:[e.jsx(A,{className:"border-b py-4",children:e.jsx(T,{children:"Scene settings"})}),e.jsxs(P,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-title",children:"Scene title"}),e.jsx(y,{id:"context-generator-scene-title",value:x,onChange:a=>c(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-brief",children:"Business scene"}),e.jsx(U,{id:"context-generator-scene-brief",value:p,onChange:a=>g(a.target.value),className:"min-h-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"AI employee"}),e.jsxs(k,{value:o,onValueChange:a=>a&&d(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsx(S,{children:(r.length?r:n).map(a=>e.jsx(l,{value:a.username,children:a.nickname},a.username))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-title",children:"Task title"}),e.jsx(y,{id:"context-generator-task-title",value:m,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-message",children:"Task message"}),e.jsx(U,{id:"context-generator-task-message",value:s,onChange:a=>I(a.target.value),className:"min-h-24"})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise fill the composer for review."})]}),e.jsx(ve,{checked:w==="manual"?!1:h,disabled:w==="manual",onCheckedChange:v})]}),w==="manual"?e.jsx("p",{className:"-mt-3 text-xs leading-5 text-muted-foreground",children:"Manual Pick keeps the message in the composer so context can be selected before sending."}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Context integration"}),e.jsxs(k,{value:w,onValueChange:a=>a&&K(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"shortcut",children:"Shortcut task"}),e.jsx(l,{value:"preset",children:"Conversation preset task"}),e.jsx(l,{value:"scope",children:"Scope inheritance"}),e.jsx(l,{value:"manual",children:"Manual Pick"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-id",children:"Context id"}),e.jsx(y,{id:"context-generator-id",value:u,onChange:a=>z(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-title",children:"Context title"}),e.jsx(y,{id:"context-generator-title",value:q,onChange:a=>ee(a.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Page capability"}),e.jsxs(k,{value:V,onValueChange:a=>a&&te(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"context",children:"Context only"}),e.jsx(l,{value:"form-filler",children:"Built-in Form filler"}),e.jsx(l,{value:"custom-tool",children:"Custom frontend Tool"})]})]})]}),V==="custom-tool"?e.jsxs("div",{className:"space-y-4 rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-name",children:"Tool name"}),e.jsx(y,{id:"context-generator-tool-name",value:H,onChange:a=>se(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-action",children:"Business action"}),e.jsx(U,{id:"context-generator-tool-action",value:W,onChange:a=>ae(a.target.value),className:"min-h-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Permission"}),e.jsxs(k,{value:O,onValueChange:a=>a&&ne(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"ASK",children:"ASK"}),e.jsx(l,{value:"ALLOW",children:"ALLOW"})]})]})]})]}):null]})]}),e.jsx(ye,{title:"Complete page context scene prompt",description:"Copy this prompt to generate the business page, AI interaction, context binding, and working conversation as one complete scene.",prompt:re})]})}function ke(){return e.jsx(R,{id:"page-element-demo",children:e.jsx(Ne,{})})}function Ne(){const[n,r]=t.useState("Northwind Studio"),[o,d]=t.useState("ops@northwind.test"),[x,c]=t.useState("high"),[p,g]=t.useState(!1),{id:m,addWorkContext:f,focusComposer:s}=ce(),{registeredCount:I,startPicking:h}=de(),v=t.useMemo(()=>[{key:"pick-page-element",label:"Pick page element",icon:e.jsx(me,{}),disabled:I===0,onClick:()=>h({chatId:m,onSelect:u=>{f(u),s()}})},{key:"web-search",label:"Web search",icon:e.jsx(he,{}),active:p,onClick:()=>g(u=>!u)}],[f,m,s,I,h,p]),w=M({id:"customer-intake-form",title:"Customer intake form",kind:"form",getContext:()=>({form:"customer-intake",values:{customerName:n,contactEmail:o,priority:x}})}),K=M({id:"customer-health-summary",title:"Customer health summary",kind:"record-detail",getContext:()=>({resource:"customers",record:{name:n,plan:"Enterprise",healthScore:86,openRequests:3,renewalDate:"2026-09-30"}})});return e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] lg:grid-cols-[minmax(0,1fr)_390px]",children:[e.jsxs("div",{className:"space-y-4 bg-muted/15 p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Customer workspace"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"The form and detail card are registered page elements."})]}),e.jsx(b,{variant:"outline",children:"2 selectable elements"})]}),e.jsxs(j,{ref:w,className:"transition-shadow",children:[e.jsxs(A,{children:[e.jsx(T,{children:"Customer intake form"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Update a value, then pick this form to capture its current state."})]}),e.jsxs(P,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(i,{htmlFor:"page-context-customer-name",children:"Customer name"}),e.jsx(y,{id:"page-context-customer-name",value:n,onChange:u=>r(u.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"page-context-contact-email",children:"Contact email"}),e.jsx(y,{id:"page-context-contact-email",value:o,onChange:u=>d(u.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:x,onValueChange:u=>u&&c(u),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{ref:K,className:"transition-shadow",children:[e.jsx(A,{children:e.jsx(T,{children:"Customer health summary"})}),e.jsx(P,{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[["Plan","Enterprise"],["Health score","86 / 100"],["Open requests","3"],["Renewal","Sep 30, 2026"]].map(([u,z])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:u}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:z})]},u))})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card lg:border-l lg:border-t-0",children:e.jsx(B,{className:"h-[560px] rounded-none border-0",children:e.jsx($,{composerActions:v,showConversationToggle:!1,enableAttachments:!0,attachmentActionIndex:1,disclaimer:!1})})})]})})}const L=n=>!["nathan","dara"].includes(n.username.toLowerCase());function Le(){return e.jsx(fe,{children:e.jsx(Ce,{})})}function Ce(){return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"AI Components"}),e.jsx(b,{variant:"outline",children:"Conversation context"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Page context and frontend tools"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Connect AI employees to live React page state. Start with manual context selection, configure task context, then expose fixed or custom frontend capabilities that can safely update the page."})]})}),e.jsx(E,{eyebrow:"Manual context",title:"Pick page context while composing a message",description:"The user can pick any registered page element from the composer. Its current content is added to this message without changing task configuration.",children:e.jsx(ke,{})}),e.jsx(E,{eyebrow:"Task context · Shortcut",title:"Reference page context from a Shortcut task",description:"The Shortcut task stores a page-element reference in message.workContext and reads its latest content when the user starts the task.",children:e.jsx(Te,{})}),e.jsx(E,{eyebrow:"Task context · Conversation preset",title:"Reference page context from a conversation preset task",description:"The AIChatProvider employeeTasks configuration uses the same message.workContext reference, but exposes the task in the conversation empty state instead of through a Shortcut.",children:e.jsx(Pe,{})}),e.jsx(E,{eyebrow:"Task context · Scope inheritance",title:"Inherit the surrounding page context",description:"A Shortcut or AIChatProvider inside AIPageContextScope inherits that context. A task-level message.workContext still takes precedence when configured.",children:e.jsx(Ie,{})}),e.jsx(E,{eyebrow:"Built-in frontend tool",title:"Fill a registered React form with Form filler",description:"Form filler is registered once by AIProvider. The form exposes its identifier, field schema, live values, and setter through useAIForm; it is not part of the custom frontend Tool catalog.",children:e.jsx(Se,{})}),e.jsx(E,{eyebrow:"Custom frontend tool",title:"Expose a page-specific action to the AI employee",description:"A registered page element can advertise custom Tools through the NocoBase loadFrontendTool and executeFrontendTool protocol. The example uses ASK permission and updates only the local quote preview.",children:e.jsx(Ae,{})}),e.jsx(E,{eyebrow:"Prompt generator",title:"Generate a complete page context scene",description:"Describe the business scene, select the AI employee and task, then generate the full page surface, context binding, conversation layout, and optional frontend capability together.",children:e.jsx(we,{})})]})}function Se(){const{employees:n}=F(),r=n.find(s=>s.username==="form_assistant")??n.find(s=>s.username.toLowerCase()==="dex")??n.filter(L)[0],o=_(),[d,x]=t.useState("Acme Logistics is evaluating the enterprise plan. The main contact is Jordan Lee at jordan.lee@acme.test. This is a high-priority opportunity."),c=ue({defaultValues:{company:"",contactName:"",email:"",priority:"normal"}}),p=t.useMemo(()=>[{name:"company",title:"Company",type:"string",required:!0},{name:"contactName",title:"Contact name",type:"string",required:!0},{name:"email",title:"Email",type:"email"},{name:"priority",title:"Priority",type:"string",enum:["low","normal","high"]}],[]),g=xe({id:"lead-intake-form",title:"Lead intake form",fields:p,getValues:c.getValues,setValues:s=>je(c,s)}),m=t.useMemo(()=>({type:"page-element",id:"lead-intake-form",title:"Lead intake form",kind:"form"}),[]),f=t.useMemo(()=>({title:"Fill lead form",message:{user:`Extract the lead details from the following text and fill the current form. Do not submit it.
72
+
73
+ ${d}`},autoSend:!0}),[d]);return e.jsx(J,{context:m,children:e.jsx(R,{id:"form-filler-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[610px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"space-y-5 bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Source content"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Edit this text, then ask the AI employee to fill the registered form below."})]}),e.jsx(D,{aiEmployee:r.username,target:o,tasks:[f],label:`Ask ${r.nickname}`,size:34})]})}),e.jsx(P,{children:e.jsx(U,{value:d,onChange:s=>x(s.target.value),className:"min-h-28"})})]}),e.jsxs("form",{ref:g,className:"rounded-xl border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b p-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Lead intake form"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Form filler changes visible values only. It never submits the form."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"useAIForm"}),e.jsx(pe,{type:"button",variant:"outline",size:"sm",onClick:()=>c.reset({company:"",contactName:"",email:"",priority:"normal"}),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-4 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-company",children:"Company"}),e.jsx(y,{id:"form-filler-company",...c.register("company")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-contact",children:"Contact name"}),e.jsx(y,{id:"form-filler-contact",...c.register("contactName")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-email",children:"Email"}),e.jsx(y,{id:"form-filler-email",type:"email",...c.register("email")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:c.watch("priority"),onValueChange:s=>s&&c.setValue("priority",s,{shouldDirty:!0,shouldTouch:!0}),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx(B,{className:"h-[610px] rounded-none border-0",children:e.jsx($,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Ae(){const{employees:n}=F(),r=n.filter(L)[0],o=_(),[d,x]=t.useState(0),[c,p]=t.useState("Not reviewed"),g=24e3,m=g*(1-d/100),f=t.useMemo(()=>[{name:"update_quote_discount",title:"Update quote discount",description:"Update the discount percentage and review note shown on the current quote. This changes the page preview only and does not save the quote.",permission:"ASK",inputSchema:{type:"object",properties:{discountPercent:{type:"number",minimum:0,maximum:30,description:"Discount percentage applied to the quote."},note:{type:"string",description:"Short explanation shown in the review note."}},required:["discountPercent","note"],additionalProperties:!1},execute:h=>{const v=h&&typeof h=="object"&&!Array.isArray(h)?h:{};return typeof v.discountPercent!="number"||v.discountPercent<0||v.discountPercent>30||typeof v.note!="string"?{status:"error",content:"Provide a discount from 0 to 30 and a review note."}:(x(v.discountPercent),p(v.note),{status:"success",content:`Updated the quote preview to a ${v.discountPercent}% discount.`})}}],[]),s=ge({id:"quote-review-card",title:"Quote review",kind:"record-detail",tools:f,getContext:()=>({resource:"quotes",record:{quoteNumber:"QT-2026-1048",customer:"Northwind Studio",baseAmount:g,discountPercent:d,total:m,approvalNote:c}})}),I=t.useMemo(()=>({title:"Apply review discount",message:{user:"Update the current quote preview to use a 12% discount and set the review note to 'Approved for the renewal discussion'."},autoSend:!0}),[]);return e.jsx(J,{context:s.context,children:e.jsx(R,{id:"custom-frontend-tool-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:s.ref,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Quote review"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"QT-2026-1048 · Northwind Studio"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",children:"Custom Tool"}),e.jsx(b,{variant:"secondary",children:"ASK"})]})]})}),e.jsxs(P,{className:"space-y-5",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:[["Base amount",`$${g.toLocaleString()}`],["Discount",`${d}%`],["Preview total",`$${m.toLocaleString()}`]].map(([h,v])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:h}),e.jsx("div",{className:"mt-1 font-medium",children:v})]},h))}),e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Review note"}),e.jsx("div",{className:"mt-1 text-sm",children:c})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsx("p",{className:"max-w-lg text-xs leading-5 text-muted-foreground",children:"The page element registers update_quote_discount. Its full input schema is loaded only when the AI chooses this Tool. Approval is controlled by the ASK permission."}),e.jsx(D,{aiEmployee:r.username,target:o,tasks:[I],label:`Ask ${r.nickname}`,size:34})]})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx(B,{className:"h-[560px] rounded-none border-0",children:e.jsx($,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Te(){const{employees:n}=F(),r=n.filter(L)[0],o=_(),[d,x]=t.useState("Payment callback reached the order service twelve minutes late."),[c,p]=t.useState("high"),g=t.useMemo(()=>({type:"page-element",id:"selected-support-case",title:"Selected support case"}),[]),m=M({id:"selected-support-case",title:"Selected support case",kind:"editable-record",getContext:()=>({resource:"supportTickets",values:{summary:d,severity:c}})}),f=t.useMemo(()=>({title:"Analyze selected case",message:{user:"Analyze the selected support case.",workContext:[g]},autoSend:!1}),[g]);return e.jsx(R,{id:"shortcut-task-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected support case"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value before running either task."})]}),e.jsx(b,{variant:"secondary",children:"Task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"selected-context-summary",children:"Summary"}),e.jsx(y,{id:"selected-context-summary",value:d,onChange:s=>x(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Severity"}),e.jsxs(k,{value:c,onValueChange:s=>s&&p(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"medium",children:"Medium"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{className:"mt-5 border-dashed bg-background/80",children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Task shortcut area"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This button is outside the selected page element. Its task explicitly references “Selected support case”."})]}),e.jsx(b,{variant:"outline",children:"Explicit reference"})]})}),e.jsx(P,{children:e.jsx(D,{aiEmployee:r.username,target:o,tasks:[f],label:"Analyze selected case",size:34})})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx(B,{className:"h-[560px] rounded-none border-0",children:e.jsx($,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Pe(){const{employees:n}=F(),r=n.filter(L)[0],[o,d]=t.useState("Enterprise workspace expansion"),[x,c]=t.useState("likely"),p=t.useMemo(()=>({type:"page-element",id:"selected-opportunity",title:"Selected opportunity"}),[]),g=M({id:"selected-opportunity",title:"Selected opportunity",kind:"record-detail",getContext:()=>({resource:"opportunities",record:{name:o,forecast:x}})}),m=t.useMemo(()=>({title:"Prepare opportunity brief",message:{user:"Prepare a brief for the selected opportunity.",workContext:[p]},autoSend:!1}),[p]),f=t.useMemo(()=>({[r.username]:[m]}),[r.username,m]);return e.jsx(R,{id:"preset-task-context-demo",defaultEmployee:r.username,employeeTasks:f,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:g,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected opportunity"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value, then select the preset task in the chat."})]}),e.jsx(b,{variant:"secondary",children:"Preset task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"preset-context-opportunity",children:"Opportunity"}),e.jsx(y,{id:"preset-context-opportunity",value:o,onChange:s=>d(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Forecast"}),e.jsxs(k,{value:x,onValueChange:s=>s&&c(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"pipeline",children:"Pipeline"}),e.jsx(l,{value:"likely",children:"Likely"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"No Shortcut is used here. “Prepare opportunity brief” comes from AIChatProvider.employeeTasks and appears in the conversation empty state."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx(B,{className:"h-[560px] rounded-none border-0",children:e.jsx($,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Ie(){const{employees:n}=F(),r=n.filter(L)[0],o=_(),[d,x]=t.useState("Northwind Finance"),[c,p]=t.useState("negotiation"),g=t.useMemo(()=>({type:"page-element",id:"inherited-renewal-context",title:"Current account renewal"}),[]),m=M({id:"inherited-renewal-context",title:"Current account renewal",kind:"record-detail",getContext:()=>({resource:"accounts",record:{accountName:d,stage:c}})}),f=t.useMemo(()=>({title:"Review current renewal",message:{user:"Review the current account renewal."},autoSend:!1}),[]),s=t.useMemo(()=>({title:"Recommend next renewal action",message:{user:"Recommend the next renewal action."},autoSend:!1}),[]),I=t.useMemo(()=>({[r.username]:[s]}),[r.username,s]);return e.jsx(J,{context:g,children:e.jsx(R,{id:"inherited-context-demo",controller:o,defaultEmployee:r.username,employeeTasks:I,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Current account renewal"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Shortcut and conversation are inside this context scope."})]}),e.jsx(b,{variant:"outline",children:"Inherited"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"inherited-account-name",children:"Account"}),e.jsx(y,{id:"inherited-account-name",value:d,onChange:h=>x(h.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Renewal stage"}),e.jsxs(k,{value:c,onValueChange:h=>h&&p(h),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"discovery",children:"Discovery"}),e.jsx(l,{value:"negotiation",children:"Negotiation"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Shortcut task without message.workContext"}),e.jsx(D,{aiEmployee:r.username,target:o,tasks:[f],label:"Review current renewal",size:34})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"The preset task “Recommend next renewal action” also has no task context, so it inherits this scope."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx(B,{className:"h-[560px] rounded-none border-0",children:e.jsx($,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function E({eyebrow:n,title:r,description:o,children:d}){return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:n}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:r}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:o})]}),d]})}export{Le as PageContextPage};
@@ -0,0 +1 @@
1
+ import{r as i,j as e,w as d,B as n,E as x,F as c}from"./index-C6xNKxpg.js";function l({title:r,description:o,prompt:s}){const[t,a]=i.useState(!1);return e.jsxs(d,{className:"gap-0 overflow-hidden py-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:r}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o})]}),e.jsxs(n,{size:"sm",onClick:async()=>{await navigator.clipboard.writeText(s),a(!0),window.setTimeout(()=>a(!1),1500)},children:[t?e.jsx(x,{}):e.jsx(c,{}),t?"Copied":"Copy prompt"]})]}),e.jsx("pre",{className:"max-h-[620px] overflow-auto whitespace-pre-wrap bg-muted/25 p-5 font-mono text-xs leading-5 text-muted-foreground",children:s})]})}export{l as P};
@@ -0,0 +1 @@
1
+ import{_ as m,P as A,H as y,m as I,bA as R}from"./echarts-runtime-CEgJbv68.js";var b=(function(){function u(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return u})(),w=(function(u){m(s,u);function s(a){var r=u.call(this,a)||this;return r.type="sausage",r}return s.prototype.getDefaultShape=function(){return new b},s.prototype.buildPath=function(a,r){var e=r.cx,i=r.cy,o=Math.max(r.r0||0,0),h=Math.max(r.r,0),d=(h-o)*.5,v=o+d,t=r.startAngle,n=r.endAngle,c=r.clockwise,l=Math.PI*2,M=c?n-t<l:t-n<l;M||(t=n-(c?l:-l));var f=Math.cos(t),g=Math.sin(t),P=Math.cos(n),S=Math.sin(n);M?(a.moveTo(f*o+e,g*o+i),a.arc(f*v+e,g*v+i,d,-Math.PI+t,t,!c)):a.moveTo(f*h+e,g*h+i),a.arc(e,i,h,t,n,!c),a.arc(P*v+e,S*v+i,d,n-Math.PI*2,n-Math.PI,!c),o!==0&&a.arc(e,i,o,n,t,c)},s})(A);function k(u,s,a){var r=u.get("borderRadius");if(r==null)return a?{cornerRadius:0}:null;y(r)||(r=[r,r,r,r]);var e=Math.abs(s.r||0-s.r0||0);return{cornerRadius:I(r,function(i){return R(i,e)})}}export{w as S,k as g};
@@ -0,0 +1,47 @@
1
+ import{r as n,ao as ge,ap as St,aq as tt,ar as st,as as se,j as e,at as It,au as at,av as Pt,aw as At,ax as nt,ay as xe,az as Mt,aA as Tt,aB as rt,aC as ot,aD as fe,aE as Et,aF as Rt,aG as $t,c as le,b as Ut,aH as Bt,aI as it,aJ as Dt,aK as Vt,aL as Wt,aM as Ft,aN as Fe,aO as zt,aP as Ot,aQ as Lt,aR as qt,aS as ze,aT as Kt,aU as Gt,aV as Ht,aW as _t,aX as Xt,aY as Jt,E as Qt,aZ as lt,ak as Yt,a_ as Zt,l as Se,a$ as es,w as he,ae as Oe,x as Pe,y as Ae,A as Me,a9 as Le,ag as ts,b0 as Ie,m as Y,n as Z,o as ee,p as te,v as W,I as qe,B as pe,Q as ss,X as as,q as ns,b1 as rs,T as Ke,ah as os,b2 as is}from"./index-C6xNKxpg.js";import{C as Ge}from"./chat-inline-xpQ9iq4p.js";import{A as Te}from"./ai-employee-shortcut-B253WWow.js";import{u as ls,S as He}from"./switch-DrxImI8F.js";import{P as ds}from"./prompt-card-BsYMW_rq.js";import{A as cs}from"./configuration-gate-Dwdq_lxf.js";const us=n.createContext({disabled:!1});function ms(){return n.useContext(us)}const ps=n.createContext(void 0);function hs(s=!0){const a=n.useContext(ps);if(a===void 0&&!s)throw new Error(ge(3));return a}const dt=n.createContext(void 0);function ct(){const s=n.useContext(dt);if(s===void 0)throw new Error(ge(10));return s}const xs={value:()=>null},fs=n.forwardRef(function(a,l){const{render:x,className:P,disabled:m=!1,hiddenUntilFound:h,keepMounted:d,loopFocus:k,onValueChange:f,multiple:M=!1,orientation:v="vertical",value:T,defaultValue:j,style:S,...y}=a,E=St(),I=n.useMemo(()=>{if(T===void 0)return j??[]},[T,j]),C=n.useRef([]),[c,w]=tt({controlled:T,default:I,name:"Accordion",state:"value"}),V=st(($,L,g)=>{if(M)if(L){const N=c.slice();if(N.push($),f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c.filter(K=>K!==$);if(f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c[0]===$?[]:[$];if(f==null||f(N,g),g.isCanceled)return;w(N)}}),b=n.useMemo(()=>({value:c,disabled:m,orientation:v}),[c,m,v]),R=n.useMemo(()=>({disabled:m,handleValueChange:V,hiddenUntilFound:h??!1,keepMounted:d??!1,state:b,value:c}),[m,V,h,d,b,c]),p=se("div",a,{state:b,ref:l,props:[{dir:E},y],stateAttributesMapping:xs});return e.jsx(dt.Provider,{value:R,children:e.jsx(It,{elementsRef:C,children:p})})}),ut=n.createContext(void 0);function Ee(){const s=n.useContext(ut);if(s===void 0)throw new Error(ge(9));return s}let gs=(function(s){return s.index="data-index",s.disabled="data-disabled",s.open="data-open",s})({});const Re={...Pt,index:s=>Number.isInteger(s)?{[gs.index]:String(s)}:null,...at,value:()=>null},bs=n.forwardRef(function(a,l){const{className:x,disabled:P=!1,onOpenChange:m,render:h,value:d,style:k,...f}=a,{ref:M,index:v}=At(),T=nt(l,M),{disabled:j,handleValueChange:S,state:y,value:E}=ct(),I=xe(),C=d??I,c=P||j,w=n.useMemo(()=>{if(!E)return!1;for(let U=0;U<E.length;U+=1)if(E[U]===C)return!0;return!1},[E,C]),V=st((U,F)=>{m==null||m(U,F),!F.isCanceled&&S(C,U,F)}),b=Mt({open:w,onOpenChange:V,disabled:c}),R=n.useMemo(()=>({open:b.open,disabled:b.disabled,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.transitionStatus]),p=n.useMemo(()=>({...b,onOpenChange:V,state:R}),[b,R,V]),$=n.useMemo(()=>({...y,hidden:!w&&!b.mounted,index:v,disabled:c,open:w}),[b.mounted,c,v,w,y]),L=xe(),[g,N]=n.useState(),K=n.useMemo(()=>({open:w,state:$,setTriggerId:N,triggerId:g??L}),[L,w,$,N,g]),G=se("div",a,{state:$,ref:T,props:f,stateAttributesMapping:Re});return e.jsx(Tt.Provider,{value:p,children:e.jsx(ut.Provider,{value:K,children:G})})}),vs=n.forwardRef(function(a,l){const{render:x,className:P,style:m,...h}=a,{state:d}=Ee();return se("h3",a,{state:d,ref:l,props:h,stateAttributesMapping:Re})}),ks=n.forwardRef(function(a,l){const{disabled:x,className:P,id:m,render:h,nativeButton:d=!0,style:k,...f}=a,{panelId:M,open:v,handleTrigger:T,disabled:j}=rt(),S=x||j,{getButtonProps:y,buttonRef:E}=ot({disabled:S,focusableWhenDisabled:!0,native:d}),{state:I,setTriggerId:C,triggerId:c}=Ee();return fe(()=>(m&&C(m),()=>{C(void 0)}),[m,C]),se("button",a,{state:I,ref:[l,E],props:[{"aria-controls":v?M:void 0,"aria-expanded":v,id:c,onClick:T},f,y],stateAttributesMapping:Et})});let _e=(function(s){return s.accordionPanelHeight="--accordion-panel-height",s.accordionPanelWidth="--accordion-panel-width",s})({});const js=n.forwardRef(function(a,l){const{className:x,hiddenUntilFound:P,keepMounted:m,id:h,render:d,style:k,...f}=a,{hiddenUntilFound:M,keepMounted:v}=ct(),{mounted:T,onOpenChange:j,open:S,panelId:y,setMounted:E,setOpen:I,setPanelIdState:C,transitionStatus:c}=rt(),w=P??M,V=m??v;fe(()=>{if(h)return C(h),()=>{C(void 0)}},[h,C]);const{height:b,props:R,ref:p,shouldPreventOpenAnimation:$,shouldRender:L,transitionStatus:g,width:N}=Rt({externalRef:l,hiddenUntilFound:w,id:h??y,keepMounted:V,mounted:T,onOpenChange:j,open:S,setMounted:E,setOpen:I,transitionStatus:c}),{state:K,triggerId:G}=Ee(),U={...K,transitionStatus:g},F=$t(k,U),ae=se("div",{...a,style:void 0},{state:U,ref:p,props:[R,{"aria-labelledby":G,role:"region",style:{[_e.accordionPanelHeight]:b===void 0?"auto":`${b}px`,[_e.accordionPanelWidth]:N===void 0?"auto":`${N}px`}},f,F?{style:F}:void 0,$?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Re});return L?ae:null});function ys({className:s,...a}){return e.jsx(fs,{"data-slot":"accordion",className:le("flex w-full flex-col",s),...a})}function ws({className:s,...a}){return e.jsx(bs,{"data-slot":"accordion-item",className:le("not-last:border-b",s),...a})}function Cs({className:s,children:a,...l}){return e.jsx(vs,{className:"flex",children:e.jsxs(ks,{"data-slot":"accordion-trigger",className:le("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",s),...l,children:[a,e.jsx(Ut,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),e.jsx(Bt,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Ns({className:s,children:a,...l}){return e.jsx(js,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...l,children:e.jsx("div",{className:le("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",s),children:a})})}function Ss(s){if(!s)return null;for(const a of s.elements){const l=a.tagName;if(l==="BUTTON"||l==="INPUT"){const x=a;if(x.type==="submit")return x}}return null}let Xe=(function(s){return s.checked="data-checked",s.unchecked="data-unchecked",s.indeterminate="data-indeterminate",s.disabled="data-disabled",s.readonly="data-readonly",s.required="data-required",s.valid="data-valid",s.invalid="data-invalid",s.touched="data-touched",s.dirty="data-dirty",s.filled="data-filled",s.focused="data-focused",s})({});function mt(s){return n.useMemo(()=>({checked(a){return s.indeterminate?{}:a?{[Xe.checked]:""}:{[Xe.unchecked]:""}},...it}),[s.indeterminate])}const pt=n.createContext(void 0);function Is(){const s=n.useContext(pt);if(s===void 0)throw new Error(ge(14));return s}const Ps="data-parent",As=n.forwardRef(function(a,l){const{checked:x,className:P,defaultChecked:m=!1,"aria-labelledby":h,disabled:d=!1,form:k,id:f,indeterminate:M=!1,inputRef:v,name:T,onCheckedChange:j,parent:S=!1,readOnly:y=!1,render:E,required:I=!1,uncheckedValue:C,value:c,nativeButton:w=!1,style:V,...b}=a,{clearErrors:R}=Dt(),{disabled:p,name:$,setDirty:L,setFilled:g,setFocused:N,setTouched:K,state:G,validationMode:U,validityData:F,validation:ae}=Vt(),de=ms(),{labelId:ce,controlId:t,registerControlId:o,getDescriptionProps:r}=Wt(),i=hs(),z=i==null?void 0:i.parent,H=z&&i.allValues,A=p||de.disabled||(i==null?void 0:i.disabled)||d,ne=$??T,B=c??ne,$e=xe(),xt=xe();let _=t;H?_=S?xt:`${z.id}-${B}`:f&&(_=f);let be={};H&&(S?be=i.parent.getParentProps():B&&(be=i.parent.getChildProps(B)));const{checked:Ue=x,indeterminate:ft=M,onCheckedChange:ve,...gt}=be,re=i==null?void 0:i.value,Be=i==null?void 0:i.setValue,De=i==null?void 0:i.defaultValue,ke=n.useRef(null),ue=Ft(()=>Symbol("checkbox-control")),je=n.useRef(!1),{getButtonProps:bt,buttonRef:vt}=ot({disabled:A,native:w}),oe=(i==null?void 0:i.validation)??ae,[O,kt]=tt({controlled:B&&re&&!S?re.includes(B):Ue,default:B&&De&&!S?De.includes(B):m,name:"Checkbox",state:"checked"}),ye=H?!!Ue:O,ie=H&&ft||M;fe(()=>{o!==Fe&&(je.current=!0,o(ue.current,_))},[_,o,ue]),n.useEffect(()=>{const u=ue.current;return()=>{!je.current||o===Fe||(je.current=!1,o(u,void 0))}},[o,ue]),zt(ke,$e,O,void 0,!i&&!A,T);const X=n.useRef(null),jt=nt(v,X,oe.inputRef,oe.registerInput),yt=ls(h,ce,X,!w,_??void 0);fe(()=>{X.current&&(X.current.indeterminate=ie,O&&g(!0))},[O,ie,g]),Ot(O,()=>{i||(R(ne),g(O),L(O!==F.initialValue),oe.change(O))});const wt=Lt({checked:O,disabled:A,form:k,name:S?void 0:ne,id:w?void 0:_??void 0,required:I,ref:jt,style:ne?Kt:Gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(u){if(u.nativeEvent.defaultPrevented)return;if(y){u.preventDefault();return}const q=u.currentTarget.checked,J=Ht(_t,u.nativeEvent);if(j==null||j(q,J),!J.isCanceled&&(ve==null||ve(q,J),!J.isCanceled&&(kt(q),B&&re&&Be&&!S&&!H))){const Q=q?[...re,B]:re.filter(me=>me!==B);Be(Q,J)}},onFocus(){var u;(u=ke.current)==null||u.focus()}},c!==void 0?{value:(i?O&&c:c)||""}:qt,r,u=>oe.getValidationProps(A,u));n.useEffect(()=>{if(!z||!B)return;const u=z.disabledStatesRef.current;return u.set(B,A),()=>{u.delete(B)}},[z,A,B]);const we=n.useMemo(()=>({...G,checked:ye,disabled:A,readOnly:y,required:I,indeterminate:ie}),[G,ye,A,y,I,ie]),Ct=mt(we),Nt=se("span",a,{state:we,ref:[vt,ke,l,i==null?void 0:i.registerControlRef],props:[{id:w?_??void 0:$e,role:"checkbox","aria-checked":ie?"mixed":ye,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":yt,[Ps]:S?"":void 0,onFocus(){A||N(!0)},onBlur(){const u=X.current;u&&(K(!0),N(!1),U==="onBlur"&&oe.commit(i?re:u.checked))},onKeyDown(u){var Ve;if(u.key!=="Enter"||(u.preventBaseUIHandler(),u.defaultPrevented))return;const q=((Ve=X.current)==null?void 0:Ve.form)??null,J=u.currentTarget,Q=u.nativeEvent,me=u.preventDefault,Ce=Q.preventDefault;let Ne=!1;u.preventDefault=()=>{Ne=!0,me.call(u)},Q.preventDefault=()=>{Ne=!0,Ce.call(Q)},Ce.call(Q),ze(J).queueMicrotask(()=>{var We;u.preventDefault=me,Q.preventDefault=Ce,Ne||(We=Ss(q))==null||We.click()})},onClick(u){if(y||A)return;u.preventDefault();const q=X.current;q&&q.dispatchEvent(new(ze(q)).PointerEvent("click",{bubbles:!0,shiftKey:u.shiftKey,ctrlKey:u.ctrlKey,altKey:u.altKey,metaKey:u.metaKey}))}},b,gt,bt,r,u=>oe.getValidationProps(A,u)],stateAttributesMapping:Ct});return e.jsxs(pt.Provider,{value:we,children:[Nt,!O&&!i&&ne&&!S&&C!==void 0&&e.jsx("input",{type:"hidden",form:k,name:ne,value:C,disabled:A}),e.jsx("input",{...wt,suppressHydrationWarning:!0})]})}),Ms=n.forwardRef(function(a,l){const{render:x,className:P,style:m,keepMounted:h=!1,...d}=a,k=Is(),f=k.checked||k.indeterminate,{mounted:M,transitionStatus:v,setMounted:T}=Xt(f),j=n.useRef(null),S={...k,transitionStatus:v};Jt({open:f,ref:j,onComplete(){f||T(!1)}});const E={...mt(k),...at,...it},I=h||M,C=se("span",a,{ref:[l,j],state:S,stateAttributesMapping:E,props:d});return I?C:null});function Ts({className:s,...a}){return e.jsx(As,{"data-slot":"checkbox",className:le("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",s),...a,children:e.jsx(Ms,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(Qt,{})})})}const Je={title:"Analyze this ticket",message:{system:"Review the current ticket, identify operational risk, and suggest the next action.",user:"Analyze the current ticket and recommend the next action."},autoSend:!0,model:{llmService:"openai",model:"gpt-5"},webSearch:!0,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},Qe={title:"Draft a customer reply",message:{user:"Draft a concise customer reply for the current ticket."},autoSend:!1,skillSettings:{skills:["response-drafting"],tools:["inspect-record"]}},Ye={title:"Review operational risk",message:{system:"Review the current queue, identify operational risk, and prioritize the next actions.",user:"Review the current ticket queue and identify operational risk."},autoSend:!1,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},D={id:"TK-1042",title:"Payment callback delayed",status:"Open",requester:"Northwind Finance",createdAt:"July 22, 2026 · 09:42",description:"Payment succeeded, but the callback reached the order service twelve minutes late. The customer needs an impact assessment and a response before the next settlement window."},Es=[D,{id:"TK-1041",title:"Unable to update profile"},{id:"TK-1038",title:"Invoice export formatting"}],ht=s=>!["nathan","dara"].includes(s.username.toLowerCase());function Ls(){return e.jsx(cs,{children:e.jsx(Rs,{})})}function Rs(){const{employees:s}=lt(),a=Yt(),l=s.filter(ht),x=l.find(k=>k.username.toLowerCase()==="atlas")??l[0],P=l.find(k=>k.username!==x.username)??x,m=l.find(k=>k.username.toLowerCase()==="atlas")??l.find(k=>k.username!==x.username)??x,h=Zt({id:"support-ticket-detail",title:`${D.id} · ${D.title}`,kind:"record-detail",getContext:()=>({resource:"supportTickets",record:D})}),d=n.useMemo(()=>({[x.username]:[Je,Qe],...P.username!==x.username?{[P.username]:[Ye]}:{}}),[x.username,P.username]);return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Se,{variant:"secondary",children:"AI Components"}),e.jsx(Se,{variant:"outline",children:"Employee capability"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Employee tasks"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Bind reusable tasks to AI employees. Tasks can appear directly inside a chat when the employee is selected, or be triggered from contextual buttons elsewhere in the application."})]})}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 1 · Multiple tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Trigger employee tasks from a business record"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"The Shortcut component can still sit in a detail header and provide the current record as work context. Opening it shows the configured analysis and reply tasks below the employee greeting."})]}),e.jsx(es,{context:{type:"page-element",id:"support-ticket-detail",title:`${D.id} · ${D.title}`},children:e.jsxs(he,{ref:h,className:"gap-0 overflow-hidden py-0",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b p-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:D.id}),e.jsx(Se,{variant:"outline",children:D.status})]}),e.jsx("h3",{className:"mt-2 text-lg font-semibold tracking-tight",children:D.title})]}),e.jsx(Te,{aiEmployee:x.username,tasks:[Je,Qe],label:`Ask ${x.nickname}`,size:34})]}),e.jsxs("div",{className:"grid gap-5 p-5 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Requester"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:D.requester})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Created"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:D.createdAt})]})]}),e.jsxs("div",{className:"border-t p-5",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6",children:D.description})]})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 2 · Explicit target"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Send a shortcut task to a designated embedded chat"}),e.jsxs("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:["The shortcut receives the embedded chat Controller directly. Its Provider explicitly configures ",m.nickname," and an employee task set. It does not need a global target ID and cannot accidentally trigger another conversation on the same page."]})]}),e.jsx(Oe,{id:"shortcut-embedded-chat",controller:a,defaultEmployee:m.username,children:e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(he,{children:[e.jsx(Pe,{children:e.jsx(Ae,{className:"text-base",children:"Risk review workspace"})}),e.jsxs(Me,{className:"space-y-5",children:[e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"The embedded chat starts without preset tasks. Clicking the Shortcut injects “Review operational risk” into this specific conversation, where the user can choose it before the request is placed in the composer."}),e.jsx(Te,{aiEmployee:m.username,target:a,tasks:[Ye],auto:!1,context:[{type:"table",title:"Open ticket queue",content:Es}],label:`Ask ${m.nickname}`,size:36})]})]}),e.jsx(Ge,{className:"h-[560px] min-h-0",children:e.jsx(Le,{})})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 3 · Chat-bound tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Show tasks when the selected employee changes"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"This conversation window binds task lists directly to business AI employees. Starting a new conversation or switching employees in the composer immediately replaces the empty-state tasks. Employees without a binding keep the normal greeting-only state."})]}),e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(he,{children:[e.jsx(Pe,{children:e.jsx(Ae,{className:"text-base",children:"Employee task bindings"})}),e.jsxs(Me,{className:"space-y-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"rounded-lg border bg-muted/25 p-3 font-mono text-xs leading-5",children:[e.jsx("div",{children:x.username}),e.jsx("div",{className:"pl-4",children:"Analyze this ticket"}),e.jsx("div",{className:"pl-4",children:"Draft a customer reply"}),P.username!==x.username?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2",children:P.username}),e.jsx("div",{className:"pl-4",children:"Review operational risk"})]}):null]}),e.jsx("p",{children:"Switch employees from the bottom of the chat to preview each configured task list."}),e.jsxs("p",{children:["The same ",e.jsx("code",{children:"employeeTasks"})," parameter works in page, embedded, side-panel, dialog, and mobile containers."]})]})]}),e.jsx(Oe,{id:"employee-task-scenario-chat",defaultEmployee:x.username,employeeTasks:d,children:e.jsx(Ge,{className:"h-[620px] min-h-0",children:e.jsx(Le,{})})})]})]}),e.jsx(Bs,{embeddedController:a})]})}const $s=[{value:"ticket-analysis",label:"Ticket analysis"},{value:"response-drafting",label:"Response drafting"},{value:"workflow-design",label:"Workflow design"}],Us=[{value:"inspect-record",label:"Inspect record"},{value:"search-records",label:"Search records"},{value:"update-record",label:"Update record"}],Ze=[{id:"analyze-ticket",employee:"",title:"Analyze this ticket",background:"Identify operational risk and recommend the next action.",userMessage:"Analyze the current ticket and recommend the next action.",autoSend:!0,workContext:[{type:"page-element",id:"support-ticket-detail",title:`${D.id} · ${D.title}`}],model:"gpt-5",webSearch:!0,skillsMode:"custom",skills:["ticket-analysis"],toolsMode:"custom",tools:["inspect-record"]},{id:"draft-reply",employee:"",title:"Draft a customer reply",background:"Write a concise and helpful response using the ticket context.",userMessage:"Draft a customer reply for the current ticket.",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"custom",skills:["response-drafting"],toolsMode:"preset",tools:[]}];function Bs({embeddedController:s}){var U,F,ae,de,ce;const{employees:a,models:l}=lt(),{registeredCount:x,startPicking:P}=ts(),m=a.filter(ht),h=m.find(t=>t.username.toLowerCase()==="atlas")??m[0],[d,k]=n.useState("shortcut"),[f,M]=n.useState("the ticket detail header actions"),[v,T]=n.useState(h.username),[j,S]=n.useState(h.username),[y,E]=n.useState("global-side-panel"),[I,C]=n.useState("embedded"),[c,w]=n.useState(()=>Ze.map(t=>({...t,employee:h.username}))),[V,b]=n.useState(Ze[0].id),R=d==="chat-tasks"?c.filter(t=>t.employee===j):c,p=R.find(t=>t.id===V)??R[0],$=n.useMemo(()=>c.map(t=>{const o=Ie(l,t.model),r=t.skillsMode==="custom"||t.toolsMode==="custom";return{title:t.title,message:{system:t.background||void 0,user:t.userMessage||void 0,workContext:t.workContext.length?t.workContext:void 0},autoSend:t.autoSend,model:o?{llmService:o.llmService,model:o.value}:void 0,webSearch:t.webSearch,skillSettings:r?{skills:t.skillsMode==="custom"?t.skills:void 0,tools:t.toolsMode==="custom"?t.tools:void 0}:void 0}}),[l,c]),L=n.useMemo(()=>{const t=(r,i)=>{var H;const z=r.model==="default"?"Use the AI employee default":((H=l.find(A=>A.value===r.model))==null?void 0:H.label)??r.model;return`${i+1}. ${r.title}
2
+ - Background: ${r.background||"None"}
3
+ - Default user message: ${r.userMessage||"None"}
4
+ - Send automatically: ${r.autoSend}
5
+ - Work context: ${r.workContext.map(A=>A.title??A.id).join(", ")||"Inherit the surrounding context"}
6
+ - Model: ${z}
7
+ - Web search: ${r.webSearch}
8
+ - Skills: ${r.skillsMode==="preset"?"Use the AI employee defaults":r.skills.join(", ")||"Disabled"}
9
+ - Tools: ${r.toolsMode==="preset"?"Use the AI employee defaults":r.tools.join(", ")||"Disabled"}`},o=d==="chat-tasks"?Array.from(new Set(c.map(r=>r.employee))).map(r=>{const i=c.filter(z=>z.employee===r);return`AI employee: ${r}
10
+ ${i.map(t).join(`
11
+ `)}`}).join(`
12
+
13
+ `):c.map(t).join(`
14
+ `);if(d==="chat-tasks"){const r={page:"a dedicated page",embedded:"an embedded block in the page","side-panel":"a push side panel",dialog:"a dialog"}[I];return`Add an AI conversation window to ${f} using ${r}.
15
+
16
+ Employee task bindings:
17
+ ${o}
18
+
19
+ Implementation requirements:
20
+ - Render AIChatWindow in the selected container and wrap it with AIChatProvider.
21
+ - Configure AIChatProvider with employeeTasks grouped by AI employee username.
22
+ - When the user starts a new conversation or switches AI employees, show the matching tasks below that employee’s greeting.
23
+ - Employees without configured tasks must keep the greeting-only empty state.
24
+ - Selecting a task must respect autoSend: either send immediately or fill the composer for review.
25
+ - Resolve task message.workContext when the task starts so selected page elements use their latest values.
26
+ - When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
27
+ - Preserve every task’s background prompt, model override, Web search setting, Skills, Tools, and work context.
28
+ - Keep the employeeTasks capability independent of the container so the same configuration works in page, embedded, side-panel, dialog, and mobile layouts.
29
+ - Use the existing AIProvider/AIChatProvider runtime with shadcn/Base UI components.`}return`Add an AI employee shortcut to ${f}.
30
+
31
+ Shortcut configuration:
32
+ - AI employee: ${v}
33
+ - Target conversation: ${y==="global-side-panel"?"the default global push side panel":"the embedded chat rendered in this page section"}
34
+ - Include the current record or form values as work context.
35
+
36
+ Tasks:
37
+ ${o}
38
+
39
+ Implementation requirements:
40
+ - Use AIEmployeeShortcut and pass all configured tasks through its tasks prop.
41
+ - When multiple tasks are provided, open a new conversation and show the tasks below the AI employee greeting.
42
+ - Selecting a task must respect that task's autoSend setting: either send immediately or fill the composer for review.
43
+ - Resolve task message.workContext when the task starts so selected page elements use their latest values.
44
+ - When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
45
+ - Preserve each task's background prompt, work context, model override, Web search setting, Skills, and Tools.
46
+ - ${y==="global-side-panel"?"Use the global AI chat controller; do not pass a target prop.":"Create a dedicated controller with useAIChatController(), bind it to the embedded AIChatProvider, and pass it through the shortcut target prop."}
47
+ - Use the existing AIProvider and AIChatProvider runtime with shadcn/Base UI components.`},[I,v,d,f,l,y,c]),g=t=>{p&&w(o=>o.map(r=>r.id===p.id?{...r,...t}:r))},N=()=>{const t=`task-${crypto.randomUUID()}`;w(o=>[...o,{id:t,employee:d==="chat-tasks"?j:v,title:`Task ${o.length+1}`,background:"",userMessage:"",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"preset",skills:[],toolsMode:"preset",tools:[]}]),b(t)},K=t=>{if(c.length===1)return;const o=c.filter(r=>r.id!==t);if(w(o),V===t){const r=d==="chat-tasks"?o.find(i=>i.employee===j):o[0];b((r==null?void 0:r.id)??"")}},G=(t,o,r)=>{if(!p)return;const i=p[t];g({[t]:r?[...i,o]:i.filter(z=>z!==o)})};return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Employee tasks prompt"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Generate an integration prompt"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Choose whether tasks are exposed through a contextual Shortcut or directly by the selected employee in a chat. Both modes share the same task, model, Web search, Skills, and Tools configuration."})]}),e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[520px_minmax(0,1fr)]",children:[e.jsxs(he,{className:"gap-0 py-0",children:[e.jsx(Pe,{className:"py-4",children:e.jsx(Ae,{className:"text-base",children:"Employee task configuration"})}),e.jsxs(Me,{className:"space-y-4 pb-4",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Integration"}),e.jsxs(Y,{value:d,onValueChange:t=>{if(!t)return;const o=t;k(o),M(o==="shortcut"?"the ticket detail header actions":"the ticket detail page");const r=o==="chat-tasks"?c.find(i=>i.employee===j):c[0];b((r==null?void 0:r.id)??"")},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:d==="shortcut"?"Contextual Shortcut":"Tasks inside a chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"shortcut",children:"Contextual Shortcut"}),e.jsx(W,{value:"chat-tasks",children:"Tasks inside a chat"})]})]})]}),d==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 border-t pt-4 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(Y,{value:j,onValueChange:t=>{var o;t&&(S(t),b(((o=c.find(r=>r.employee===t))==null?void 0:o.id)??""))},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((U=m.find(t=>t.username===j))==null?void 0:U.nickname)??j})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{value:t.username,children:t.nickname},t.username))})]}),e.jsx("span",{className:"block font-normal leading-5 text-muted-foreground",children:"Select an employee first, then configure the tasks shown in that employee’s new-conversation state."})]}):null,e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(Y,{value:v,onValueChange:t=>t&&T(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((F=m.find(t=>t.username===v))==null?void 0:F.nickname)??v})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{value:t.username,children:t.nickname},t.username))})]})]}):null,e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Placement"}),e.jsx(qe,{value:f,onChange:t=>M(t.target.value)})]}),d==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Chat container"}),e.jsxs(Y,{value:I,onValueChange:t=>t&&C(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:{page:"Page",embedded:"Embedded block","side-panel":"Side panel",dialog:"Dialog"}[I]})}),e.jsxs(te,{children:[e.jsx(W,{value:"page",children:"Page"}),e.jsx(W,{value:"embedded",children:"Embedded block"}),e.jsx(W,{value:"side-panel",children:"Side panel"}),e.jsx(W,{value:"dialog",children:"Dialog"})]})]})]}):null]}),d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Target conversation"}),e.jsxs(Y,{value:y,onValueChange:t=>t&&E(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:y==="global-side-panel"?"Global side panel":"Embedded chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"global-side-panel",children:"Global side panel"}),e.jsx(W,{value:"embedded",children:"Embedded chat"})]})]})]}):null,e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Tasks"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[R.length," configured task",R.length===1?"":"s",d==="chat-tasks"?" for this employee":""]})]}),e.jsxs(pe,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(ss,{})," Add task"]})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:R.map((t,o)=>e.jsxs("div",{className:t.id===(p==null?void 0:p.id)?"flex items-center gap-2 rounded-lg border border-foreground/25 bg-muted/60 p-1":"flex items-center gap-2 rounded-lg border p-1",children:[e.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-1.5 text-left",onClick:()=>b(t.id),children:[e.jsxs("span",{className:"block truncate text-xs font-medium",children:[o+1,". ",t.title]}),e.jsxs("span",{className:"block text-[10px] text-muted-foreground",children:[t.autoSend?"Auto send":"Fill composer",t.workContext.length?" · Task context":"",t.webSearch?" · Web search":""]})]}),e.jsx(pe,{variant:"ghost",size:"icon-xs",disabled:c.length===1,"aria-label":`Remove ${t.title}`,onClick:()=>K(t.id),children:e.jsx(as,{})})]},t.id))})]}),p?e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Title"}),e.jsx(qe,{value:p.title,onChange:t=>g({title:t.target.value})})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Model"}),e.jsxs(Y,{value:p.model,onValueChange:t=>t&&g({model:t}),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{className:"min-w-0 overflow-hidden",children:e.jsx("span",{className:"block min-w-0 truncate",title:p.model==="default"?"Use employee default":((ae=Ie(l,p.model))==null?void 0:ae.label)??p.model,children:p.model==="default"?"Use employee default":((de=Ie(l,p.model))==null?void 0:de.label)??p.model})})}),e.jsxs(te,{children:[e.jsx(W,{value:"default",children:"Use employee default"}),e.jsx(ns,{}),e.jsx(rs,{models:l})]})]})]})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Default user message"}),e.jsx(Ke,{className:"min-h-16",value:p.userMessage,onChange:t=>g({userMessage:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise the message is placed in the composer."})]}),e.jsx(He,{size:"sm",checked:p.autoSend,onCheckedChange:t=>g({autoSend:t})})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Work context"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Select a page context for this task. Without one, the task inherits its surrounding context."})]}),e.jsxs(pe,{variant:"outline",size:"sm",disabled:x===0,onClick:()=>P({onSelect:t=>g({workContext:[{type:t.type,id:t.id,title:t.title,kind:t.kind}]})}),children:[e.jsx(os,{})," Pick context"]})]}),p.workContext.map((t,o)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted/50 px-2 py-1.5 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title??t.id??t.type}),e.jsx(pe,{variant:"ghost",size:"icon-xs","aria-label":"Remove task context",onClick:()=>g({workContext:[]}),children:e.jsx(is,{})})]},`${t.type}:${t.id??o}`))]}),e.jsx(ys,{children:e.jsxs(ws,{value:"advanced-task-settings",className:"rounded-lg border px-3",children:[e.jsx(Cs,{className:"no-underline hover:no-underline",children:e.jsxs("span",{children:[e.jsx("span",{className:"block",children:"Advanced task settings"}),e.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:"Background, Web search, Skills, and Tools"})]})}),e.jsxs(Ns,{className:"space-y-4 pt-1",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Background"}),e.jsx(Ke,{className:"min-h-16",value:p.background,onChange:t=>g({background:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Web search"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Subject to the selected LLM service capability."})]}),e.jsx(He,{size:"sm",checked:p.webSearch,onCheckedChange:t=>g({webSearch:t})})]}),e.jsx(et,{title:"Skills",mode:p.skillsMode,values:p.skills,options:$s,onModeChange:t=>g({skillsMode:t}),onToggle:(t,o)=>G("skills",t,o)}),e.jsx(et,{title:"Tools",mode:p.toolsMode,values:p.tools,options:Us,onModeChange:t=>g({toolsMode:t}),onToggle:(t,o)=>G("tools",t,o)})]})]})})]}):null,e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:d==="shortcut"?"Live shortcut preview":"Chat-bound task configuration"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:d==="shortcut"?"Multiple tasks appear in the chat empty state after opening.":"Use the third scenario above to preview employee switching."})]}),d==="shortcut"?e.jsx(Te,{aiEmployee:v,tasks:$,target:y==="embedded"?s:void 0,label:`Ask ${((ce=m.find(t=>t.username===v))==null?void 0:ce.nickname)??v}`,size:34}):null]})]})]}),e.jsx(ds,{title:d==="shortcut"?"Add an AI employee task shortcut":"Add employee tasks to a chat",description:d==="shortcut"?"The prompt includes every task, capability override, and target conversation.":"The prompt groups configured tasks by business AI employee and selected chat container.",prompt:L})]})]})}function et({title:s,mode:a,values:l,options:x,onModeChange:P,onToggle:m}){return e.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Preset inherits the AI employee configuration."})]}),e.jsxs(Y,{value:a,onValueChange:h=>h&&P(h),children:[e.jsx(Z,{size:"sm",className:"w-28",children:e.jsx(ee,{children:a==="preset"?"Preset":"Custom"})}),e.jsxs(te,{children:[e.jsx(W,{value:"preset",children:"Preset"}),e.jsx(W,{value:"custom",children:"Custom"})]})]})]}),a==="custom"?e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:x.map(h=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md bg-muted/40 px-2.5 py-2 text-xs",children:[e.jsx(Ts,{checked:l.includes(h.value),onCheckedChange:d=>m(h.value,d)}),e.jsx("span",{children:h.label})]},h.value))}):null]})}export{Ls as ShortcutPage};