@datalayer/agent-runtimes 1.3.94 → 1.3.95

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.
@@ -707,8 +707,8 @@ export const COMPREHENSIVE_SALES_ANALYTICS_TEAM_SPEC_0_0_1 = {
707
707
  export const CROP_MONITORING_TEAM_SPEC_0_0_1 = {
708
708
  id: 'crop-monitoring',
709
709
  version: '0.0.1',
710
- name: 'Crop monitoring',
711
- description: `One agent, its data: Crop monitoring follows crop vigour and growth over a season from the satellite imagery NASA Earthdata holds, and flags the fields that need attention.`,
710
+ name: 'Crop Monitoring',
711
+ description: `One agent, its data: Crop Monitoring follows crop vigour and growth over a season from the satellite imagery NASA Earthdata holds, and flags the fields that need attention.`,
712
712
  tags: [
713
713
  'example',
714
714
  'scene',
@@ -725,7 +725,7 @@ export const CROP_MONITORING_TEAM_SPEC_0_0_1 = {
725
725
  orchestrationProtocol: 'a2a',
726
726
  executionMode: 'supervisor',
727
727
  supervisor: {
728
- name: 'Crop monitoring',
728
+ name: 'Crop Monitoring',
729
729
  ref: '',
730
730
  app: 'crop-monitoring:0.0.1',
731
731
  model: '',
@@ -734,7 +734,7 @@ export const CROP_MONITORING_TEAM_SPEC_0_0_1 = {
734
734
  approval: 'auto',
735
735
  canTerminate: true,
736
736
  },
737
- routingInstructions: `Crop monitoring answers every request from the imagery itself, one search at a time, and reports what the granules show without adding to it.`,
737
+ routingInstructions: `Crop Monitoring answers every request from the imagery itself, one search at a time, and reports what the granules show without adding to it.`,
738
738
  entry: 'crop-monitoring',
739
739
  suggestions: [
740
740
  {
@@ -783,8 +783,8 @@ export const CROP_MONITORING_TEAM_SPEC_0_0_1 = {
783
783
  export const DISASTER_ASSESSMENT_TEAM_SPEC_0_0_1 = {
784
784
  id: 'disaster-assessment',
785
785
  version: '0.0.1',
786
- name: 'Disaster assessment',
787
- description: `An event desk in the browser that gets the area a disaster affected and the damage from Disaster assessment, and what changed on the ground from Change detection, each on a runtime over A2A, each reading NASA Earthdata. Event response takes the event and reports; the two others read the imagery and answer.`,
786
+ name: 'Disaster Assessment',
787
+ description: `An event desk in the browser that gets the area a disaster affected and the damage from Disaster Assessment, and what changed on the ground from Change detection, each on a runtime over A2A, each reading NASA Earthdata. Event response takes the event and reports; the two others read the imagery and answer.`,
788
788
  tags: [
789
789
  'example',
790
790
  'scene',
@@ -811,7 +811,7 @@ export const DISASTER_ASSESSMENT_TEAM_SPEC_0_0_1 = {
811
811
  approval: 'auto',
812
812
  canTerminate: true,
813
813
  },
814
- routingInstructions: `Event response asks Disaster assessment for the area and the damage, and Change detection for the change on the ground, one request each, and reports what they answer without adding to it.`,
814
+ routingInstructions: `Event response asks Disaster Assessment for the area and the damage, and Change detection for the change on the ground, one request each, and reports what they answer without adding to it.`,
815
815
  entry: 'event-response',
816
816
  suggestions: [
817
817
  {
@@ -850,7 +850,7 @@ export const DISASTER_ASSESSMENT_TEAM_SPEC_0_0_1 = {
850
850
  { member: 'change-detection', over: 'a2a' },
851
851
  ],
852
852
  role: 'initiator',
853
- goal: `Take the person's event, ask Disaster assessment and Change detection for it, and report what they answered.`,
853
+ goal: `Take the person's event, ask Disaster Assessment and Change detection for it, and report what they answered.`,
854
854
  dependsOn: [],
855
855
  subagents: [],
856
856
  model: '',
@@ -1120,8 +1120,8 @@ export const JUPYTER_TEAM_SPEC_0_0_1 = {
1120
1120
  export const MONTH_END_CLOSE_TEAM_SPEC_0_0_1 = {
1121
1121
  id: 'month-end-close',
1122
1122
  version: '0.0.1',
1123
- name: 'Month-end close',
1124
- description: `One agent, its data: Month-end close drives the close from the Odoo books, which it only reads — the checklist, the accruals to book, the reconciliation gaps that remain.`,
1123
+ name: 'Month-end Close',
1124
+ description: `One agent, its data: Month-end Close drives the close from the Odoo books, which it only reads — the checklist, the accruals to book, the reconciliation gaps that remain.`,
1125
1125
  tags: ['example', 'scene', 'accounting', 'finance', 'odoo', 'a2a'],
1126
1126
  enabled: true,
1127
1127
  icon: 'sync',
@@ -1131,7 +1131,7 @@ export const MONTH_END_CLOSE_TEAM_SPEC_0_0_1 = {
1131
1131
  orchestrationProtocol: 'a2a',
1132
1132
  executionMode: 'supervisor',
1133
1133
  supervisor: {
1134
- name: 'Month-end close',
1134
+ name: 'Month-end Close',
1135
1135
  ref: '',
1136
1136
  app: 'month-end-close:0.0.1',
1137
1137
  model: '',
@@ -1140,7 +1140,7 @@ export const MONTH_END_CLOSE_TEAM_SPEC_0_0_1 = {
1140
1140
  approval: 'auto',
1141
1141
  canTerminate: true,
1142
1142
  },
1143
- routingInstructions: `Month-end close answers every request from the books itself, one read at a time, and reports what the books hold without adding to it.`,
1143
+ routingInstructions: `Month-end Close answers every request from the books itself, one read at a time, and reports what the books hold without adding to it.`,
1144
1144
  entry: 'month-end-close',
1145
1145
  suggestions: [
1146
1146
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.3.94",
3
+ "version": "1.3.95",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -1 +0,0 @@
1
- import{r as f,j as e,bp as l,cP as re,eI as ie,T as c,bm as W,cO as F,L as D,I as oe,eJ as le,eK as V,c as U,P as ae,eL as de,k as ce,eM as ue,dw as H,bd as M,eN as xe,eO as fe,eP as K,eQ as pe,eR as he}from"../datalayer-app-main.js";import{B as $,U as B}from"./index-Begrz6qi.js";function E(t){const n=Number(t);return!isNaN(n)&&n>1e15?n/1e6:!isNaN(n)&&n>1e12?n/1e3:isNaN(n)?new Date(String(t)).getTime():n}function J(t){return t==null?"—":t<.001?"<1µs":t<1?`${(t*1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(1)}ms`:t<6e4?`${(t/1e3).toFixed(2)}s`:`${(t/6e4).toFixed(1)}m`}function me(t){if(t==null||t==="")return"—";try{const n=E(t),s=new Date(n);return isNaN(s.getTime())?String(t):s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return String(t)}}const X=["#0969da","#1a7f37","#cf222e","#8250df","#bf8700","#0550ae","#116329","#a40e26","#6639ba","#953800","#0e8a16","#e36209"];function ge(t){let n=0;for(let s=0;s<t.length;s++)n=n*31+t.charCodeAt(s)|0;return X[Math.abs(n)%X.length]}function Q(t){const n=new Map,s=t.map(o=>({...o,children:[],depth:0}));for(const o of s)n.set(o.span_id,o);const r=[];for(const o of s)if(o.parent_span_id&&n.has(o.parent_span_id)){const x=n.get(o.parent_span_id);x.children=x.children??[],x.children.push(o)}else r.push(o);function a(o,x){o.depth=x;for(const p of o.children??[])a(p,x+1)}for(const o of r)a(o,0);return r}const be="peer.service";function je(t,n){return t.service_name===n||t.attributes?.[be]===n}function Se(t,n){return n?t.filter(s=>je(s,n)):[...t]}const Y=[],_e=()=>()=>{};function we(t){return f.useSyncExternalStore(t?t.subscribe:_e,()=>t?t.spans():Y,()=>t?t.spans():Y)}const ye="140px 1fr 160px 90px",ve="96px minmax(0, 1fr) 96px 64px";function ke(t){const n=t.attributes;if(!n)return null;const s=n["gen_ai.usage.input_tokens"]!=null?Number(n["gen_ai.usage.input_tokens"]):void 0,r=n["gen_ai.usage.output_tokens"]!=null?Number(n["gen_ai.usage.output_tokens"]):void 0;return s==null&&r==null?null:{input:s,output:r}}const Ce=({spans:t,loading:n,selectedSpanId:s,onSelectSpan:r,emptyText:a,compact:o=!1,defaultExpanded:x=!1,renderSpanMark:p,describeSpan:u})=>{const[h,d]=f.useState(new Set),m=f.useMemo(()=>({has:i=>x?!h.has(i):h.has(i)}),[h,x]),j=o?ve:ye,S=f.useMemo(()=>Q(t),[t]),g=f.useMemo(()=>{const i=[];function y(b,A){const v=b.children??[];if(i.push({span:b,depth:A,hasChildren:v.length>0}),m.has(b.span_id))for(const T of v)y(T,A+1)}for(const b of S)y(b,0);return i},[S,m]),O=f.useCallback(i=>{d(y=>{const b=new Set(y);return b.has(i)?b.delete(i):b.add(i),b})},[]);return n?e.jsx(l,{sx:{display:"flex",justifyContent:"center",p:5},children:e.jsx(re,{size:"medium"})}):t.length===0?e.jsxs($,{children:[e.jsx($.Visual,{children:e.jsx(ie,{size:24})}),e.jsx($.Heading,{children:"No traces found"}),e.jsx($.Description,{children:a??"Send some telemetry data first."})]}):e.jsxs(l,{sx:{width:"100%",flex:1,minHeight:0,overflow:"auto"},children:[e.jsx(l,{sx:{display:"grid",gridTemplateColumns:j,gap:2,px:3,position:"sticky",top:0,bg:"canvas.subtle",zIndex:1,borderBottom:"2px solid",borderColor:"border.default"},children:["Time","Message","Scope","Duration"].map(i=>e.jsx(c,{sx:{fontWeight:"bold",fontSize:0,color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em",py:2,...i==="Duration"?{textAlign:"right"}:{}},children:i},i))}),g.map(({span:i,depth:y,hasChildren:b},A)=>{const v=s===i.span_id,T=m.has(i.span_id),C=y*(o?12:20),k=u?.(i);return e.jsxs(l,{"data-otel-span":i.span_id,"data-otel-span-name":i.span_name,onClick:()=>{b&&O(i.span_id),r?.(i)},sx:{display:"grid",gridTemplateColumns:j,gap:2,px:3,py:"5px",cursor:"pointer",bg:v?"accent.subtle":y>0?"canvas.inset":"canvas.default",borderBottom:"1px solid",borderColor:"border.muted",":hover":{bg:v?"accent.subtle":"canvas.subtle"}},children:[e.jsx(c,{sx:{fontSize:o?0:1,fontFamily:"mono",color:"fg.muted",whiteSpace:"nowrap",lineHeight:"22px"},children:me(i.start_time)}),e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1,overflow:"hidden",lineHeight:"22px",pl:`${C}px`},children:[b?e.jsx(l,{sx:{flexShrink:0,color:"fg.muted",display:"flex",alignItems:"center"},children:T?e.jsx(W,{size:14}):e.jsx(F,{size:14})}):y>0?e.jsx(l,{sx:{flexShrink:0,width:"14px",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.subtle",fontSize:0},children:"─"}):null,p?.(i),e.jsx(c,{sx:{fontSize:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:k?0:1,maxWidth:k?"60%":void 0},title:i.span_name,children:i.span_name}),i.in_progress&&e.jsx(D,{variant:"attention",size:"small",children:"running"}),i.status_code==="ERROR"&&e.jsx(D,{variant:"danger",size:"small",children:"ERROR"}),(()=>{const I=ke(i);return I?e.jsxs(l,{sx:{display:"inline-flex",alignItems:"center",gap:"2px",border:"1px solid",borderColor:"border.default",borderRadius:2,px:1,fontSize:"10px",fontFamily:"mono",color:"fg.muted",flexShrink:0,lineHeight:"16px"},children:[I.input!=null&&e.jsxs(l,{sx:{display:"inline-flex",alignItems:"center",gap:"1px"},children:[e.jsx(c,{sx:{fontSize:"9px",color:"fg.subtle"},children:"↗"}),e.jsx(c,{children:I.input})]}),I.output!=null&&e.jsxs(l,{sx:{display:"inline-flex",alignItems:"center",gap:"1px"},children:[e.jsx(c,{sx:{fontSize:"9px",color:"fg.subtle"},children:"↙"}),e.jsx(c,{children:I.output})]})]}):null})(),k&&e.jsx(c,{sx:{fontSize:1,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:k,"data-otel-span-description":"",children:k}),i.otel_scope_name&&!o&&e.jsx(D,{size:"small",variant:"secondary",sx:{flexShrink:0,fontSize:"10px"},children:i.otel_scope_name})]}),e.jsx(c,{sx:{fontSize:1,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"22px"},title:`${i.service_name} / ${i.otel_scope_name??""}`,children:i.service_name}),e.jsx(c,{sx:{fontSize:1,fontFamily:"mono",textAlign:"right",lineHeight:"22px",color:i.duration_ms!=null&&i.duration_ms>1e3?"danger.fg":"fg.default"},children:i.in_progress?"…":J(i.duration_ms)})]},`${i.trace_id}-${i.span_id}-${A}`)})]})},ze=20,Z=({span:t,depth:n,selectedSpanId:s,onSelectSpan:r,expandedIds:a,toggleExpanded:o,traceMinTime:x,traceDuration:p})=>{const u=(t.children?.length??0)>0,h=a.has(t.span_id),d=s===t.span_id,m=ge(t.service_name),j=(E(t.start_time)-x)/p*100,S=Math.max((t.duration_ms||0)/p*100,.5);return e.jsxs(e.Fragment,{children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",height:28,pl:`${n*ze}px`,pr:2,cursor:"pointer",bg:d?"accent.subtle":"canvas.default",borderBottom:"1px solid",borderColor:"border.muted",":hover":{bg:d?"accent.subtle":"canvas.subtle"}},onClick:()=>r?.(t),children:[e.jsx(l,{sx:{width:20,textAlign:"center",color:"fg.muted",userSelect:"none",flexShrink:0,cursor:u?"pointer":"default"},onClick:g=>{g.stopPropagation(),u&&o(t.span_id)},children:u?h?e.jsx(W,{size:12}):e.jsx(F,{size:12}):e.jsx(c,{sx:{color:"fg.subtle",fontSize:0},children:"·"})}),e.jsx(l,{sx:{width:8,height:8,borderRadius:"50%",bg:m,flexShrink:0,mr:1}}),e.jsx(c,{sx:{flex:"0 0 200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:1,fontWeight:d?"bold":"normal"},title:`${t.service_name} / ${t.span_name}`,children:t.span_name}),e.jsx(l,{sx:{flex:1,position:"relative",height:12,bg:"canvas.subtle",borderRadius:1,mx:2,overflow:"hidden"},children:e.jsx(l,{sx:{position:"absolute",left:`${j}%`,width:`${S}%`,height:"100%",bg:m,borderRadius:1,opacity:d?1:.7}})}),e.jsx(c,{sx:{minWidth:60,textAlign:"right",fontSize:0,fontFamily:"mono",color:"fg.muted",flexShrink:0},children:J(t.duration_ms)})]}),u&&h&&t.children.map(g=>e.jsx(Z,{span:g,depth:n+1,selectedSpanId:s,onSelectSpan:r,expandedIds:a,toggleExpanded:o,traceMinTime:x,traceDuration:p},g.span_id))]})},Ie=({spans:t,selectedSpanId:n,onSelectSpan:s,defaultExpandDepth:r=2})=>{const a=f.useMemo(()=>{const d=new Set;function m(j,S){for(const g of j)S<r&&d.add(g.span_id),g.children&&m(g.children,S+1)}return m(t,0),d},[t,r]),[o,x]=f.useState(a),p=f.useCallback(d=>{x(m=>{const j=new Set(m);return j.has(d)?j.delete(d):j.add(d),j})},[]),{traceMinTime:u,traceDuration:h}=f.useMemo(()=>{let d=1/0,m=-1/0;function j(S){for(const g of S){const O=E(g.start_time),i=E(g.end_time);O<d&&(d=O),i>m&&(m=i),g.children&&j(g.children)}}return j(t),d===1/0?{traceMinTime:0,traceDuration:1}:{traceMinTime:d,traceDuration:m-d||1}},[t]);return t.length===0?e.jsx(l,{sx:{p:3,color:"fg.muted",textAlign:"center"},children:e.jsx(c,{children:"No span tree to display."})}):e.jsxs(l,{sx:{width:"100%",overflow:"auto"},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",height:28,px:2,borderBottom:"2px solid",borderColor:"border.default",bg:"canvas.subtle"},children:[e.jsx(l,{sx:{width:20}}),e.jsx(l,{sx:{width:8,mr:1}}),e.jsx(c,{sx:{flex:"0 0 200px",fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Span"}),e.jsx(c,{sx:{flex:1,mx:2,fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Timeline"}),e.jsx(c,{sx:{minWidth:60,textAlign:"right",fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Duration"})]}),t.map(d=>e.jsx(Z,{span:d,depth:0,selectedSpanId:n,onSelectSpan:s,expandedIds:o,toggleExpanded:p,traceMinTime:u,traceDuration:h},d.span_id))]})},w=({label:t,value:n,mono:s=!1})=>n==null||n===""?null:e.jsxs(l,{sx:{display:"flex",py:1,borderBottom:"1px solid",borderColor:"border.muted",gap:2},children:[e.jsx(c,{sx:{width:140,minWidth:140,color:"fg.muted",fontSize:1,fontWeight:"bold"},children:t}),e.jsx(c,{sx:{fontSize:1,fontFamily:s?"mono":"normal",wordBreak:"break-all"},children:String(n)})]}),q=({title:t,data:n,defaultOpen:s=!1})=>{const[r,a]=f.useState(s);return!n||Object.keys(n).length===0?null:e.jsxs(l,{sx:{mt:3},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",py:1,userSelect:"none"},onClick:()=>a(!r),children:[r?e.jsx(W,{size:16}):e.jsx(F,{size:16}),e.jsx(c,{sx:{fontSize:1,fontWeight:"bold"},children:t}),e.jsx(V,{children:Object.keys(n).length})]}),r&&e.jsx(l,{sx:{bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",p:2,mt:1,overflowX:"auto"},children:Object.entries(n).map(([o,x])=>e.jsx(L,{attrKey:o,value:x,depth:0},o))})]})};function Te(t){if(typeof t!="string")return t;const n=t.trim();if(!/^[[{]/.test(n))return t;try{const s=JSON.parse(n);return typeof s=="object"&&s!==null?s:t}catch{return t}}const L=({attrKey:t,value:n,depth:s})=>{const r=f.useMemo(()=>Te(n),[n]),[a,o]=f.useState(s<1),x=typeof r=="object"&&r!==null&&!Array.isArray(r),p=Array.isArray(r),u=x||p;return e.jsxs(l,{sx:{borderBottom:s===0?"1px solid":"none",borderColor:"border.muted",pb:s===0?1:0,mb:s===0?1:0},children:[e.jsxs(l,{sx:{display:"flex",gap:2,py:1,pl:s*16+"px",alignItems:"flex-start"},children:[u?e.jsx(l,{sx:{cursor:"pointer",color:"fg.muted",userSelect:"none",width:16,flexShrink:0},onClick:()=>o(!a),children:a?e.jsx(W,{size:12}):e.jsx(F,{size:12})}):e.jsx(l,{sx:{width:16,flexShrink:0}}),e.jsx(c,{sx:{color:"accent.fg",fontSize:1,fontFamily:"mono",minWidth:180,wordBreak:"break-all",flexShrink:0},children:t}),!u&&e.jsx(c,{sx:{fontSize:1,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:typeof r=="string"?"accent.emphasis":"attention.fg"},children:typeof r=="string"?r:JSON.stringify(r)}),u&&!a&&e.jsx(c,{sx:{fontSize:0,color:"fg.muted",fontFamily:"mono"},children:p?`[${r.length} items]`:`{${Object.keys(r).length} keys}`})]}),u&&a&&e.jsx(l,{children:p?r.map((h,d)=>e.jsx(L,{attrKey:`[${d}]`,value:h,depth:s+1},d)):Object.entries(r).map(([h,d])=>e.jsx(L,{attrKey:h,value:d,depth:s+1},h))})]})},Oe=({span:t,traceSpans:n,onClose:s})=>{const[r,a]=f.useState("details");if(!t)return e.jsx(l,{sx:{p:5,color:"fg.muted",textAlign:"center"},children:e.jsx(c,{children:"Select a span to view details."})});const o={},x={};if(t.attributes)for(const[u,h]of Object.entries(t.attributes))u.startsWith("gen_ai.")||u.startsWith("model_request")?o[u]=h:x[u]=h;const p=n&&n.length>0?Q(n):void 0;return e.jsxs(l,{sx:{height:"100%",overflow:"auto",borderLeft:"1px solid",borderColor:"border.default",bg:"canvas.default",display:"flex",flexDirection:"column"},children:[e.jsxs(l,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",display:"flex",justifyContent:"space-between",alignItems:"center",bg:"canvas.subtle",flexShrink:0},children:[e.jsx(c,{sx:{fontSize:2,fontWeight:"bold"},children:t.span_name}),s&&e.jsx(oe,{icon:le,"aria-label":"Close detail panel",variant:"invisible",size:"small",onClick:s})]}),e.jsxs(B,{"aria-label":"Span detail tabs",children:[e.jsx(B.Item,{"aria-current":r==="details"?"page":void 0,onClick:()=>a("details"),children:"Details"}),p&&e.jsx(B.Item,{"aria-current":r==="tree"?"page":void 0,onClick:()=>a("tree"),children:"Trace Tree"}),e.jsx(B.Item,{"aria-current":r==="raw"?"page":void 0,onClick:()=>a("raw"),children:"Raw Data"})]}),e.jsxs(l,{sx:{flex:1,overflow:"auto"},children:[r==="details"&&e.jsxs(l,{sx:{p:3},children:[e.jsx(w,{label:"span_name",value:t.span_name}),e.jsx(w,{label:"service_name",value:t.service_name}),e.jsx(w,{label:"otel_scope_name",value:t.otel_scope_name}),e.jsx(w,{label:"kind",value:t.kind}),e.jsx(w,{label:"trace_id",value:t.trace_id,mono:!0}),e.jsx(w,{label:"span_id",value:t.span_id,mono:!0}),e.jsx(w,{label:"parent_span_id",value:t.parent_span_id,mono:!0}),e.jsx(w,{label:"duration",value:J(t.duration_ms)}),e.jsx(w,{label:"start_time",value:t.start_time,mono:!0}),e.jsx(w,{label:"end_time",value:t.end_time,mono:!0}),e.jsx(w,{label:"status_code",value:t.status_code}),e.jsx(w,{label:"status_message",value:t.status_message}),e.jsx(q,{title:"Arguments",data:o,defaultOpen:Object.keys(o).length>0}),e.jsx(q,{title:"Attributes",data:x}),t.events&&t.events.length>0&&e.jsxs(l,{sx:{mt:3},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(c,{sx:{fontWeight:"bold",fontSize:1},children:"Events"}),e.jsx(V,{children:t.events.length})]}),t.events.map((u,h)=>e.jsxs(l,{sx:{bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",p:2,mt:2},children:[e.jsxs(l,{sx:{display:"flex",gap:2},children:[e.jsx(D,{children:u.name}),e.jsx(c,{sx:{fontSize:0,color:"fg.muted",fontFamily:"mono"},children:u.timestamp})]}),u.attributes&&Object.keys(u.attributes).length>0&&e.jsx(l,{sx:{mt:1},children:Object.entries(u.attributes).map(([d,m])=>e.jsx(L,{attrKey:d,value:m,depth:0},d))})]},h))]}),t.links&&t.links.length>0&&e.jsxs(l,{sx:{mt:3},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(c,{sx:{fontWeight:"bold",fontSize:1},children:"Links"}),e.jsx(V,{children:t.links.length})]}),t.links.map((u,h)=>e.jsxs(c,{sx:{display:"block",fontSize:1,fontFamily:"mono",py:1,borderBottom:"1px solid",borderColor:"border.muted"},children:["trace: ",u.trace_id," → span: ",u.span_id]},h))]})]}),r==="tree"&&p&&e.jsx(Ie,{spans:p,selectedSpanId:t.span_id,defaultExpandDepth:4}),r==="raw"&&e.jsx(l,{as:"pre",sx:{p:3,fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",m:0,bg:"canvas.subtle"},children:JSON.stringify(t,null,2)})]})]})},Ae=[{label:"Service",value:t=>t.service_name},{label:"Kind",value:t=>t.kind}];function Ne(t,n,s){return t.filter(r=>n.every((a,o)=>{const x=s[o];if(!x?.size)return!0;const p=a.value(r);return p!==void 0&&x.has(p)}))}function Re(t,n){const s=new Set(t);return s.has(n)?s.delete(n):s.add(n),s}function Ee({facet:t,options:n,selected:s,onChange:r}){const a=t.name??(o=>o);return e.jsxs(H,{children:[e.jsxs(H.Button,{size:"small","data-otel-facet":t.label.toLowerCase(),children:[t.label,s.size?` · ${s.size}`:""]}),e.jsx(H.Overlay,{width:"auto",children:e.jsxs(M,{selectionVariant:"multiple","aria-label":t.label,children:[e.jsx(M.Item,{selected:!s.size,onSelect:()=>r(new Set),children:"All"}),e.jsx(M.Divider,{}),n.map(o=>e.jsx(M.Item,{selected:s.has(o),onSelect:()=>r(Re(s,o)),children:a(o)},o))]})})]})}function Me(t,n){const s=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),r=URL.createObjectURL(s),a=document.createElement("a");a.href=r,a.download=`${t}.json`,a.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}const $e=({tracer:t,spans:n,service:s,facets:r=Ae,compact:a=!1,maxHeight:o=420,detailPlacement:x="below",emptyText:p="Nothing recorded yet.",exportName:u="otel-spans",label:h="Spans",renderSpanMark:d,describeSpan:m})=>{const j=we(n?null:t),S=n??j,[g,O]=f.useState(0),[i,y]=f.useState(null),[b,A]=f.useState(()=>r.map(()=>new Set)),[v,T]=f.useState(null),C=f.useMemo(()=>{const _=Se(S,s);return g?_.filter(z=>E(z.start_time)>=g):_},[S,s,g]),k=i??C,I=i?C.length-i.length:0,ee=f.useMemo(()=>r.map(_=>[...new Set(C.map(z=>_.value(z)).filter(z=>z!==void 0))].sort()),[r,C]),N=f.useMemo(()=>Ne(k,r,b),[k,r,b]),R=f.useMemo(()=>v?S.find(_=>_.span_id===v)??null:null,[S,v]),te=f.useMemo(()=>R?S.filter(_=>_.trace_id===R.trace_id):[],[S,R]),P=x==="side"&&!a;return e.jsxs(l,{"data-otel-live-spans":"",sx:{border:"1px solid",borderColor:"border.default",borderRadius:2,bg:"canvas.default",color:"fg.default",minWidth:0},children:[e.jsxs(l,{role:"toolbar","aria-label":h,sx:{display:"flex",flexWrap:"wrap",gap:2,alignItems:"center",p:2,borderBottom:"1px solid",borderColor:"border.default"},children:[r.map((_,z)=>e.jsx(Ee,{facet:_,options:ee[z]??[],selected:b[z]??new Set,onChange:ne=>A(se=>r.map((Le,G)=>G===z?ne:se[G]??new Set))},_.label)),e.jsx(l,{sx:{flex:1}}),e.jsxs(c,{sx:{fontSize:0,color:"fg.muted"},"data-otel-span-count":"",children:[N.length===k.length?`${N.length} ${N.length===1?"span":"spans"}`:`${N.length} of ${k.length}`,I>0?` · ${I} new`:""]}),e.jsx(U,{size:"small",leadingVisual:i?ae:de,"aria-pressed":i!==null,onClick:()=>y(i?null:C),"data-otel-pause":"",children:i?"Resume":"Pause"}),e.jsx(U,{size:"small",leadingVisual:ce,onClick:()=>{y(null),T(null),t&&!n&&!s?t.clear():O(Date.now())},"data-otel-clear":"",children:"Clear"}),e.jsx(U,{size:"small",leadingVisual:ue,disabled:!C.length,onClick:()=>Me(u,{exportedAt:new Date().toISOString(),spans:[...C]}),"data-otel-export":"",children:"Export"})]}),e.jsxs(l,{sx:{display:P?"grid":"block",gridTemplateColumns:P?"minmax(0, 3fr) minmax(0, 2fr)":void 0},children:[e.jsx(l,{sx:{maxHeight:o,overflowY:"auto",minWidth:0},children:e.jsx(Ce,{spans:N,selectedSpanId:v,onSelectSpan:_=>T(_.span_id),emptyText:p,compact:a,defaultExpanded:!0,renderSpanMark:d,describeSpan:m})}),R&&e.jsx(l,{"data-otel-live-detail":"",sx:{maxHeight:o,overflowY:"auto",minWidth:0,borderTop:P?"none":"1px solid",borderColor:"border.default"},children:e.jsx(Oe,{span:R,traceSpans:te,onClose:()=>T(null)})})]})]})},Be=[{label:"Source",value:fe,name:t=>xe[t]??t},{label:"Operation",value:t=>{const n=t.attributes??{},s=n[K.operation]??n["rpc.method"];return s===void 0?void 0:String(s)}},{label:"Agent",value:t=>t.service_name}];function De(t){const n=t.attributes?.[K.markIcon],s=t.attributes?.[K.markEmoji];return n||s?e.jsx(he,{icon:typeof n=="string"?n:void 0,emoji:typeof s=="string"?s:void 0,size:14}):null}function Pe({tracer:t,spans:n,agent:s,maxHeight:r=420,compact:a=!1,emptyText:o="Nothing recorded yet.",exportName:x="agent-inspector"}){return e.jsx("div",{"data-agent-inspector":s??"",children:e.jsx($e,{tracer:t,spans:n,service:s,facets:Be,compact:a,maxHeight:r,detailPlacement:"side",emptyText:o,exportName:x,label:s?`${s}'s Agent Inspector`:"Agent Inspector",renderSpanMark:De,describeSpan:pe})})}export{Be as AGENT_INSPECTOR_FACETS,Pe as AgentInspector,Pe as default};
@@ -1,288 +0,0 @@
1
- import{y as $,f$ as cn,r as n,j as o,g0 as ln,g1 as dn,cf as yo,bp as A,H as ht,T as V,c as K,cP as _t,f9 as qt,g2 as se,cK as mt,e as un,g3 as pn,g4 as hn,eI as mn,g5 as gn,g6 as fn,g7 as yn,g8 as bn,g9 as vn,ga as wn,gb as xn,gc as kn,gd as Sn,aP as Cn,ey as Ao,ew as En,B as S,ez as $t,ge as Tn,gf as In,gg as Po,gh as jn,gi as bo,gj as Rn,gk as An,gl as Pn,dt as _n,c2 as On,gm as Nn,gn as Mn,go as Fn,gp as Un,gq as Ln,gr as qn,q as Ot,gs as $n,gt as zn,gu as Bn,gv as Gn,gw as Hn,gx as Dn,gy as Vn,gz as Wn,gA as Kn,gB as Yn,gC as Jn,gD as Qn,gE as Xn,gF as Zn,gG as ea,gH as Je,gI as ta,gJ as oa,gK as na,gL as aa,gM as sa,gN as je,gO as ra,gP as ia,gQ as ca,gR as vo,gS as la,gT as da,fh as ua,gU as Nt,gV as Re,gW as pa,c3 as wo,gX as ha,gY as ma,gZ as ga,g_ as fa,g$ as ya,h0 as ba,h1 as va,h2 as wa,h3 as xa,h4 as Mt,h5 as ka,h6 as Sa,I as Ca,h7 as Ea,h8 as Ta,h9 as xo,ha as Ia,hb as ja,hc as zt,hd as Ra,he as Aa,e_ as Ft,hf as Pa,hg as _a}from"../datalayer-app-main.js";import{S as Oa,E as Na,a as Ma}from"./SignInIcon-4HkE48mS.js";import{F as Fa,a as Ua,b as La}from"./LinkedInGreyIcon-BoWXE-HS.js";function qa(){const e=$(cn);return n.useMemo(()=>e.map(a=>a.value),[e])}const Ut={github:{name:"github",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/github/callback"},google:{name:"google",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/google/callback"},linkedin:{name:"linkedin",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/linkedin/callback"}},ko=()=>{if(typeof document>"u")return"";const e=document.getElementById("datalayer-config-data");if(!e?.textContent)return"";try{const a=JSON.parse(e.textContent);return String(a?.iamUrl||"").replace(/\/$/,"")}catch{return""}},$a=(e,a="Unable to start social sign-in.")=>{if(e instanceof Error&&e.message)return e.message;if(typeof e=="string"&&e.trim())return e;if(e&&typeof e=="object"&&"message"in e){const i=e.message;if(typeof i=="string"&&i.trim())return i}return a},za=gn`
2
- .signin-input-theme-scope input:-webkit-autofill,
3
- .signin-input-theme-scope input:-webkit-autofill:hover,
4
- .signin-input-theme-scope input:-webkit-autofill:focus,
5
- .signin-input-theme-scope input:-webkit-autofill:active,
6
- .signin-input-theme-scope input:-webkit-autofill:disabled,
7
- .signin-input-theme-scope textarea:-webkit-autofill,
8
- .signin-input-theme-scope textarea:-webkit-autofill:hover,
9
- .signin-input-theme-scope textarea:-webkit-autofill:focus,
10
- .signin-input-theme-scope textarea:-webkit-autofill:active,
11
- .signin-input-theme-scope textarea:-webkit-autofill:disabled {
12
- -webkit-text-fill-color: var(--fgColor-default) !important;
13
- caret-color: var(--fgColor-default) !important;
14
- -webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
15
- box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
16
- background-color: var(--bgColor-default) !important;
17
- transition: background-color 9999s ease-in-out 0s !important;
18
- }
19
-
20
- .signin-input-theme-scope input:disabled,
21
- .signin-input-theme-scope textarea:disabled {
22
- -webkit-text-fill-color: var(--fgColor-muted) !important;
23
- -webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
24
- box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
25
- background-color: var(--bgColor-default) !important;
26
- opacity: 1 !important;
27
- }
28
- `,Ba=({onSignIn:e,onApiKeySignIn:a,loginUrl:i,name:s,title:l="Datalayer OTEL",description:p="Sign in to access the observability dashboard.",icon:m,leadingIcon:f=o.jsx(mn,{size:24}),github:u=!1,google:Y=!1,linkedin:B=!1,apiKey:Qe=!1,signUp:N=!0,socialSignInNavigationTarget:ee,asDoc:y=!1,fillHeight:E=!0,hideHero:te=!1,calloutTitle:_e,calloutDescription:Xe,passwordToggleLabel:re="Sign in with a password",signUpTitle:Gt="Don't have an account?",signUpDescription:J="Create a free Datalayer account with your email address.",signUpLabel:gt="Sign up with email",signUpHref:Oe="https://datalayer.ai/signup",onSignUp:G,forgotPasswordHref:Q="/password",forgotPasswordLabel:Ne="Forgot password?",showForgotPassword:ft=!0,socialButtonMarginTop:w=3,actionButtonMaxWidth:X=320})=>{const oe=y&&!te,Ze=s??(y&&l==="Datalayer OTEL"?"Datalayer Sign In":l),yt=m??(y?o.jsx(Oa,{size:24}):f),M=n.useMemo(()=>{if(i)return i;const r=ko();return r?`${r}/api/iam/v1/login`:"/api/iam/v1/login"},[i]),[W,ye]=n.useState(""),[ie,bt]=n.useState(""),[et,ce]=n.useState(!1),[le,tt]=n.useState(!1),[C,be]=n.useState(!1),[de,Me]=n.useState(!1),[Fe,ot]=n.useState(null),[F,ve]=n.useState(null),[ne,nt]=n.useState(""),[we,xe]=n.useState(null),[Ue,U]=n.useState(null),{enqueueToast:x}=ln(),[ue,ae]=n.useState(!1),[_,Le]=n.useState(""),qe=n.useRef(null),$e=n.useCallback(r=>dn()?yo.URLExt.join(yo.PageConfig.getBaseUrl(),r.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${r.oauth2CallbackUIRoute}`,[]),O=n.useMemo(()=>{if(typeof window>"u")return"/";const r=`${window.location.pathname}${window.location.search}${window.location.hash}`;return r.startsWith("/")?r:"/"},[]),ze=n.useCallback(async r=>{if(!de){U(null),ot(r.name),Me(!0);try{const b=ko(),g=new URLSearchParams({provider:r.name,callback_uri:$e(r)}),L=ee===void 0?void 0:String(ee||"").trim(),Se=L===void 0?O&&O!=="/"?O:void 0:L&&L.startsWith("/")&&!L.startsWith("//")?L:void 0;Se&&g.set("post_auth_redirect",Se);const me=`${b||""}/api/iam/v1/oauth2/authz/url?${g.toString()}`,Ge=await fetch(me),He=await Ge.json(),De=He?.autorization_url;if(!Ge.ok||!De)throw new Error(He?.message||"Unable to start social sign-in.");window.location.assign(De)}catch(b){const g=$a(b);U(g),x(g,{variant:"error"}),ot(null),Me(!1)}}},[$e,O,x,de,ee]);n.useEffect(()=>{ue&&qe.current?.focus()},[ue]);const pe=n.useCallback(()=>{ae(!1),Le("")},[]),vt=n.useCallback(()=>{!_.trim()||!a||(a(_.trim()),pe())},[_,a,pe]),wt=n.useCallback(()=>{if(G){G();return}window.location.assign(Oe)},[G,Oe]),Be=n.useCallback(()=>{if(Q){if(Q.startsWith("http://")||Q.startsWith("https://")){window.open(Q,"_blank","noopener,noreferrer");return}window.location.assign(Q)}},[Q]),ke=n.useCallback(async()=>{if(!(y||!W||!ie||C)){be(!0),U(null);try{const r=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:W,password:ie})});if(!r.ok)throw new Error(`HTTP ${r.status}`);const b=await r.json();if(b.success&&b.token){const g=String(b?.user?.id||b?.user?.uid||"").trim();if(!!b?.user?.mfaUrl&&g){ve(g),xe(b.token),U(null);return}e&&e(b.token,W)}else U(b.message||"Invalid username or password.")}catch(r){U(r instanceof Error?r.message:String(r))}finally{be(!1)}}},[y,W,ie,C,M,e]),he=n.useCallback(async()=>{if(!(y||C||!F||!ne.trim()||!we)){be(!0),U(null);try{const r=new URL(M,window.location.origin),b=r.pathname.endsWith("/api/iam/v1/login")?r.href.replace(/\/api\/iam\/v1\/login$/,""):`${r.origin}`,g=await fetch(`${b}/api/iam/v1/users/${F}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:F,code:ne.trim()})}),L=await g.json();if(!g.ok||!L?.success)throw new Error(L?.message||"Failed to validate your MFA code.");e&&e(we,W)}catch(r){const b=r instanceof Error?r.message:String(r);U(b),x(b,{variant:"error"})}finally{be(!1)}}},[y,x,W,C,M,ne,we,F,e]),k=n.useCallback(r=>{r.key==="Enter"&&(F?he():ke())},[F,ke,he]),j=de||C||y;return o.jsxs(A,{className:"signin-input-theme-scope",sx:{display:"flex",alignItems:te||oe||!E?"flex-start":"center",justifyContent:"center",minHeight:te||oe||!E?"auto":"100vh",bg:te?"transparent":"canvas.default",color:"fg.default",py:te?0:oe?2:4},children:[o.jsx(za,{}),o.jsxs(A,{sx:{width:"100%",maxWidth:440,p:0},children:[!te&&o.jsxs(o.Fragment,{children:[o.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:2,mb:oe?2:3,justifyContent:"center"},children:[yt,o.jsx(ht,{sx:{fontSize:3},children:Ze})]}),o.jsx(V,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:oe?2:3,textAlign:"center"},children:p})]}),(_e||Xe)&&o.jsxs(A,{sx:{mb:3,textAlign:"center"},children:[_e&&o.jsx(ht,{as:"h3",sx:{fontSize:2,mb:1},children:_e}),Xe&&o.jsx(V,{sx:{color:"fg.muted",fontSize:1},children:Xe})]}),!F&&(u||Y||B)&&o.jsxs(o.Fragment,{children:[u&&o.jsx(K,{block:!0,size:"large",leadingVisual:Fe==="github"?()=>o.jsx(_t,{size:"small"}):Fa,disabled:j,onClick:()=>ze(Ut.github),sx:{mt:w,maxWidth:X,mx:"auto"},children:"Sign in with GitHub"}),Y&&o.jsx(K,{block:!0,size:"large",leadingVisual:Fe==="google"?()=>o.jsx(_t,{size:"small"}):Ua,disabled:j,onClick:()=>ze(Ut.google),sx:{mt:w,maxWidth:X,mx:"auto"},children:"Sign in with Google"}),B&&o.jsx(K,{block:!0,size:"large",leadingVisual:Fe==="linkedin"?()=>o.jsx(_t,{size:"small"}):La,disabled:j,onClick:()=>ze(Ut.linkedin),sx:{mt:w,maxWidth:X,mx:"auto"},children:"Sign in with LinkedIn"})]}),!F&&!et&&o.jsx(A,{sx:{mt:3,display:"flex",justifyContent:"center"},children:o.jsx(K,{leadingVisual:qt,size:"large",block:!0,disabled:y||C||de,onClick:()=>ce(!0),sx:{maxWidth:X,mx:"auto"},children:re})}),!F&&et&&o.jsxs(A,{sx:{mt:4},children:[o.jsxs(se,{required:!0,sx:{mb:3},children:[o.jsx(se.Label,{children:"Username"}),o.jsx(mt,{autoFocus:!0,block:!0,placeholder:"Your username",value:W,disabled:C||y,onChange:r=>ye(r.target.value),onKeyDown:k})]}),o.jsxs(se,{required:!0,sx:{mb:3},children:[o.jsx(se.Label,{children:"Password"}),o.jsx(mt,{block:!0,placeholder:"Your password",type:le?"text":"password",value:ie,disabled:C||y,onChange:r=>bt(r.target.value),onKeyDown:k,trailingAction:o.jsx(mt.Action,{onClick:()=>tt(!le),disabled:C||y,icon:le?Na:Ma,"aria-label":le?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),o.jsxs(A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3},children:[o.jsx(K,{variant:"primary",disabled:C||y||!W||!ie,onClick:ke,children:C?"Signing in…":"Sign In"}),ft&&o.jsx(un,{as:"button",sx:{fontSize:1,cursor:y?"not-allowed":"pointer",background:"none",border:"none",opacity:y?.6:1},onClick:()=>{y||C||Be()},children:Ne})]})]}),F&&o.jsxs(o.Fragment,{children:[o.jsxs(se,{required:!0,sx:{mb:3,mt:2},children:[o.jsx(se.Label,{children:"MFA Code"}),o.jsx(mt,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:ne,disabled:C||y,onChange:r=>nt(r.target.value),onKeyDown:k})]}),o.jsx(K,{variant:"primary",block:!0,disabled:C||y||!ne.trim(),onClick:he,sx:{maxWidth:X,mx:"auto"},children:C?"Validating…":"Validate MFA Code"})]}),Ue&&o.jsx(V,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:Ue}),N&&o.jsxs(A,{sx:{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted"},children:[o.jsx(ht,{as:"h3",sx:{fontSize:2,mb:2},children:Gt}),o.jsx(V,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:J}),o.jsx(A,{sx:{display:"flex",justifyContent:"center"},children:o.jsx(K,{variant:"primary",size:"large",leadingVisual:pn,disabled:y||C,onClick:wt,children:gt})})]}),Qe&&a&&o.jsxs(o.Fragment,{children:[o.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:2,my:3},children:[o.jsx(A,{sx:{flex:1,height:"1px",bg:"border.default"}}),o.jsx(V,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),o.jsx(A,{sx:{flex:1,height:"1px",bg:"border.default"}})]}),o.jsx(K,{block:!0,leadingVisual:qt,disabled:y||C||de,onClick:()=>ae(!0),sx:{maxWidth:X,mx:"auto"},children:"Sign in with an API Key"}),ue&&o.jsx(A,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:r=>{r.key==="Escape"&&pe()},onClick:pe,sx:{position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsxs(A,{as:"form",onClick:r=>r.stopPropagation(),onSubmit:r=>{r.preventDefault(),vt()},sx:{width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large"},children:[o.jsx(ht,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),o.jsxs(se,{required:!0,children:[o.jsx(se.Label,{children:"API Key"}),o.jsx(hn,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:_,onInput:r=>Le(r.currentTarget.value),ref:qe})]}),o.jsxs(A,{sx:{mt:3,display:"flex",justifyContent:"flex-end",gap:2},children:[o.jsx(K,{type:"button",onClick:pe,children:"Cancel"}),o.jsx(K,{type:"submit",variant:"primary",disabled:!_.trim(),children:"Authenticate"})]})]})})]})]})]})};function Ga(e){const{agentId:a,instructions:i,model:s,frontendTools:l,inference:p,subagents:m,sharing:f,onSubagentEvent:u,modeEffect:Y}=e;return{type:"browser-vercel-ai",endpoint:"",agentId:a,enableConfigQuery:!1,options:{instructions:i,model:s,frontendTools:l,inference:p,subagents:m,sharing:f,onSubagentEvent:u,modeEffect:Y}}}const Ha={"tavily:0.0.1":vn},z={"crawl:0.0.1":Sn,"events:0.0.1":wn,"github:0.0.1":kn,"text-summarizer:0.0.1":xn};function Ae(e){return{id:e.id,name:e.name,description:e.description,version:e.version??"0.0.1",tags:e.tags,enabled:e.enabled,requiredEnvVars:e.requiredEnvVars}}const _o={"runtime-echo:0.0.1":bn},Pe={"jupyter-notebook:0.0.1":fn,"lexical-document:0.0.1":yn},Da={id:"cog-crawler",version:"0.0.1",name:"Crawler Cog",description:"Researches the web and public repositories under the Web Research Frame: every finding rests on a source that was opened, is cited, and is checked before it is reported.",tags:["market-analyst","agent-worker","research","github","analysis","cog"],domain:"market-analyst",enabled:!0,model:"bedrock:us.anthropic.claude-sonnet-4-6",modelAdditionals:["alibaba:qwen-max"],mcpServers:[Ha["tavily:0.0.1"]],skills:[z["github:0.0.1"]?Ae(z["github:0.0.1"]):void 0,z["events:0.0.1"]?Ae(z["events:0.0.1"]):void 0,z["crawl:0.0.1"]?Ae(z["crawl:0.0.1"]):void 0].filter(Boolean),backendTools:[],frontendTools:[Pe["jupyter-notebook:0.0.1"],Pe["lexical-document:0.0.1"]],environmentName:"ai-agents-env",icon:"globe",emoji:"🌐",color:"#10B981",suggestions:[{text:"Search the web for recent news about AI agents",summary:"AI agent news"},{text:"Find trending open-source Python projects on GitHub",summary:"Trending Python projects"},{text:"Research best practices for building RAG applications",summary:"RAG best practices"},{text:"Compare popular JavaScript frameworks in 2024",summary:"JavaScript frameworks 2024"}],welcomeMessage:`Hi! I'm the Crawler Cog. I research the web and GitHub under the Web Research Frame: I open what I cite, I say which sources are primary, and I tell you where sources disagree.
29
- `,welcomeNotebook:void 0,welcomeDocument:void 0,sandboxVariant:"jupyter-server",harness:"pydantic-ai",systemPrompt:`You are a web crawling and research assistant with access to Tavily search and GitHub tools. Use Tavily to search the web for current information and search GitHub repositories for relevant projects. Synthesize information from multiple sources and provide clear summaries with sources cited.
30
-
31
- ## Frames
32
-
33
- You work under these Frames. They carry the context, the rules and the vocabulary of the people you work for, and they take precedence over your defaults.
34
-
35
- - Datalayer Company Frame — owned by Datalayer, Inc. <info@datalayer.io>
36
- - Web Research Frame — owned by Datalayer Research <info@datalayer.io>
37
-
38
- ### Rules
39
-
40
- - Never claim a capability, a tool or a result you have not verified.
41
- - Never put a secret, a credential or a token in an output.
42
- - Say what you did not do and what you could not check, as plainly as what you did.
43
- - Keep personal data out of an output unless the task is about that person and they are its audience.
44
- - Report a claim only with the address of the page or the repository it was read on.
45
- - Never present a search-result snippet as the content of the page; open the page.
46
- - Respect a site's terms and its robots policy; do not go around a paywall or a login.
47
- - Say when sources disagree, and report both sides rather than choosing silently.
48
-
49
- ### Terminology
50
-
51
- - **Agentspec**: The declarative YAML specification of an agent.
52
- - **Frame**: The context work happens in, written down, owned, versioned and inherited.
53
- - **Cog**: An AI worker you can hold to account — an agent equipped with Frames.
54
- - **Guard**: A check the output of a piece of work has to pass.
55
- - **Sandbox**: The isolated environment an agent runs code in, beside the data.
56
- - **Primary source**: The party a fact originates from — the vendor's own page, the repository itself, the paper.
57
- - **Secondary source**: A party reporting a primary source — a news article, a blog post, an aggregator.
58
- - **Recency window**: How old a source may be for the question asked; twelve months unless the task says otherwise.
59
-
60
- ### Goals
61
-
62
- - The reader can act on the output without asking what it means.
63
- - Every number can be traced to the code and the source it came from.
64
- - Each finding rests on at least one primary source.
65
- - The reader can open every source and find the claim there.
66
-
67
- ### Style
68
-
69
- - Plain, direct sentences; the conclusion first.
70
- - Name things by what they are; no marketing adjectives.
71
- - Structured output — headings, short lists, tables for figures — over long prose.
72
- - A short summary first, then findings, each with its sources as links.
73
- - Give the date of a source beside it when recency matters.
74
-
75
- ### Norms
76
-
77
- - Run the analysis in the sandbox and report the result, not the raw data.
78
- - Cite the source of every factual claim.
79
- - Prefer the smallest change, and the simplest explanation, that is correct.
80
- - Prefer a primary source to a secondary one, and say which a claim rests on.
81
- - Search more than one way before concluding that something does not exist.
82
- - Note the date the research was done.
83
-
84
- ### Process
85
-
86
- 1. Restate the question and what would count as an answer.
87
- 2. Search, then open and read the most relevant pages and repositories.
88
- 3. Extract the claims, each with its source and its date.
89
- 4. Cross-check each important claim against a second, independent source.
90
- 5. Summarize, with sources cited and disagreements said.
91
-
92
- ### Guards
93
-
94
- - **no-secrets** (policy-safety, required): The output contains no credential, token, API key or password.
95
- - **sources-cited** (source-grounding, required): Every factual claim in the output carries a link to the page or repository it was read on.
96
- - **source-supports-claim** (source-grounding, required): Each cited page was opened, and what it says supports the claim made from it.
97
- - **recency-stated** (algorithmic): Every source older than the recency window is marked with its date.
98
-
99
- Check your output against every Guard before you hand it over, and say which you could not satisfy.
100
- `,systemPromptCodemodeAddons:`## IMPORTANT: Be Honest About Your Capabilities NEVER claim to have tools or capabilities you haven't verified.
101
- ## Core Codemode Tools Use these 4 tools to accomplish any task: 1. **list_servers** - List available MCP servers
102
- Use this to see what MCP servers you can access.
103
-
104
- 2. **search_tools** - Progressive tool discovery by natural language query
105
- Use this to find relevant tools before executing tasks.
106
-
107
- 3. **get_tool_details** - Get full tool schema and documentation
108
- Use this to understand tool parameters before calling them.
109
-
110
- 4. **execute_code** - Run Python code that composes multiple tools
111
- Use this for complex multi-step operations. Code runs in a PERSISTENT sandbox.
112
- Variables, functions, and state PERSIST between execute_code calls.
113
- Import tools using: \`from generated.servers.<server_name> import <function_name>\`
114
- NEVER use \`import *\` - always use explicit named imports.
115
-
116
- ## Recommended Workflow 1. **Discover**: Use list_servers and search_tools to find relevant tools 2. **Understand**: Use get_tool_details to check parameters 3. **Execute**: Use execute_code to perform multi-step tasks, calling tools as needed
117
- ## Token Efficiency When possible, chain multiple tool calls in a single execute_code block. This reduces output tokens by processing intermediate results in code rather than returning them. If you want to examine results, print subsets, preview (maximum 20 first characters) and/or counts instead of full data, this is really important.
118
- `,goal:void 0,delegable:[{id:"data.acquire"},{id:"data.analyse"},{id:"document.extract"},{id:"research.gather"}],protocol:void 0,uiPlugin:void 0,trigger:void 0,modelConfig:void 0,mcpServerTools:void 0,guardrails:void 0,evals:void 0,codemode:void 0,output:void 0,advanced:void 0,checkpoints:void 0,authorizationPolicy:void 0,notifications:void 0,memory:"ephemeral",preHooks:void 0,postHooks:void 0,toolHooks:void 0,parameters:void 0,subagents:void 0},Va={id:"cog-customer-interviewer",version:"0.0.1",name:"Customer Interviewer Cog",description:"Conducts adaptive customer interviews under the Customer Research Frame: consent first, no leading question, and insights that each cite the interviewee's own words.",tags:["research","customer-support","analysis","cog"],domain:"market-analyst",enabled:!0,model:"bedrock:us.anthropic.claude-sonnet-4-6",modelAdditionals:["alibaba:qwen-max"],mcpServers:[],skills:[z["text-summarizer:0.0.1"]?Ae(z["text-summarizer:0.0.1"]):void 0,z["events:0.0.1"]?Ae(z["events:0.0.1"]):void 0].filter(Boolean),backendTools:[_o["runtime-echo:0.0.1"]],frontendTools:[Pe["jupyter-notebook:0.0.1"],Pe["lexical-document:0.0.1"]],environmentName:"ai-agents-env",icon:"comment-discussion",emoji:"🎙️",color:"#0EA5E9",suggestions:[{text:"Start an interview about why I chose this product",summary:"Why I chose this product"},{text:"Interview me about my onboarding experience",summary:"My onboarding experience"},{text:"Ask follow-up questions to understand my decision process",summary:"Follow-up questions"},{text:"Summarize this interview into structured insights",summary:"Structured insights"}],welcomeMessage:"Hi! I'm your Customer Interviewer. I'll ask a few open questions and adapt as we go — following up on what you share to understand your motivations and decisions. At the end, I'll turn our conversation into structured, actionable insights.",welcomeNotebook:void 0,welcomeDocument:void 0,sandboxVariant:"jupyter-server",harness:"pydantic-ai",systemPrompt:`You are an expert qualitative researcher conducting an adaptive customer interview. Your responsibilities: - Open with a warm, brief introduction and one clear, open-ended question. - Ask ONE question at a time and listen carefully to each answer. - Adapt dynamically: generate follow-up questions based on what the
119
- interviewee just said, probing for the "why" behind their answers.
120
- - Uncover motivations, pain points, decision-making criteria, and trade-offs
121
- rather than accepting surface-level responses.
122
- - Avoid leading questions and never put words in the interviewee's mouth. - Keep the interview to roughly {{max_questions}} questions, then close
123
- gracefully.
124
- - After the interview, transform the conversation into structured, actionable
125
- insights: key motivations, decision drivers, objections, notable quotes,
126
- and recommended next steps.
127
-
128
- ## Frames
129
-
130
- You work under these Frames. They carry the context, the rules and the vocabulary of the people you work for, and they take precedence over your defaults.
131
-
132
- - Datalayer Company Frame — owned by Datalayer, Inc. <info@datalayer.io>
133
- - Customer Research Frame — owned by Datalayer Product Research <info@datalayer.io>
134
-
135
- ### Rules
136
-
137
- - Never claim a capability, a tool or a result you have not verified.
138
- - Never put a secret, a credential or a token in an output.
139
- - Say what you did not do and what you could not check, as plainly as what you did.
140
- - Keep personal data out of an output unless the task is about that person and they are its audience.
141
- - Tell the interviewee at the start what the interview is for and how what they say will be used.
142
- - Never ask a leading question, and never put words in the interviewee's mouth.
143
- - Stop, or move on, when the interviewee declines to answer.
144
- - Report a quote verbatim, and never attribute one to a named person without their consent.
145
- - Keep personal data — names, employers, contact details — out of the insights unless consent covers it.
146
-
147
- ### Terminology
148
-
149
- - **Agentspec**: The declarative YAML specification of an agent.
150
- - **Frame**: The context work happens in, written down, owned, versioned and inherited.
151
- - **Cog**: An AI worker you can hold to account — an agent equipped with Frames.
152
- - **Guard**: A check the output of a piece of work has to pass.
153
- - **Sandbox**: The isolated environment an agent runs code in, beside the data.
154
- - **Insight**: A pattern in what interviewees said that explains a behavior or a decision, with its evidence.
155
- - **Motivation**: Why the interviewee does what they do; what an answer is probed for.
156
- - **Decision driver**: A criterion the interviewee weighed when choosing.
157
- - **Objection**: A reason the interviewee gave against choosing, or for hesitating.
158
- - **Verbatim**: The interviewee's own words, quoted exactly.
159
-
160
- ### Goals
161
-
162
- - The reader can act on the output without asking what it means.
163
- - Every number can be traced to the code and the source it came from.
164
- - Understand the why behind each answer, not only the what.
165
- - Every insight can be traced to what an interviewee actually said.
166
-
167
- ### Style
168
-
169
- - Plain, direct sentences; the conclusion first.
170
- - Name things by what they are; no marketing adjectives.
171
- - Structured output — headings, short lists, tables for figures — over long prose.
172
- - Warm, brief and neutral with the interviewee; one question at a time.
173
- - Insights as short statements, each with the verbatims that support it.
174
-
175
- ### Norms
176
-
177
- - Run the analysis in the sandbox and report the result, not the raw data.
178
- - Cite the source of every factual claim.
179
- - Prefer the smallest change, and the simplest explanation, that is correct.
180
- - Open-ended questions first; follow up on what was just said.
181
- - Separate what was said from what is inferred, and mark the inference.
182
- - Note what the interview did not cover.
183
-
184
- ### Process
185
-
186
- 1. Introduce the interview, its purpose and how the answers are used; ask for consent.
187
- 2. Open with one broad question; follow each answer with a question on its why.
188
- 3. Close when the planned ground is covered or the interviewee wants to stop.
189
- 4. Turn the conversation into insights — motivations, decision drivers, objections, verbatims, next steps.
190
-
191
- ### Guards
192
-
193
- - **no-secrets** (policy-safety, required): The output contains no credential, token, API key or password.
194
- - **no-leading-questions** (policy-safety, required): No question in the interview suggests its own answer.
195
- - **insights-grounded** (source-grounding, required): Every insight cites at least one verbatim from the interview that supports it.
196
- - **personal-data-removed** (policy-safety, required): The insights name no person, employer or contact detail that consent does not cover.
197
-
198
- Check your output against every Guard before you hand it over, and say which you could not satisfy.
199
- `,systemPromptCodemodeAddons:void 0,goal:"Conduct an adaptive, AI-led customer interview that reacts to each answer, asks relevant follow-up questions to uncover motivations and decision-making patterns, and produces a structured set of actionable insights.",delegable:[{id:"data.transform"},{id:"data.analyse"},{id:"document.extract"},{id:"research.gather"},{id:"support.respond"}],protocol:"vercel-ai",uiPlugin:"a2ui",trigger:void 0,modelConfig:{temperature:.7,max_tokens:4096},mcpServerTools:void 0,guardrails:void 0,evals:void 0,codemode:void 0,output:{type:"JSON",template:"interview_insights_schema.json"},advanced:void 0,checkpoints:void 0,authorizationPolicy:void 0,notifications:void 0,memory:"mem0",preHooks:void 0,postHooks:void 0,toolHooks:void 0,parameters:{type:"object",properties:{research_goal:{type:"string",title:"Research Goal",description:"What you want to learn from this interview.",default:"Understand why customers choose our product over alternatives."},persona:{type:"string",title:"Interviewee Persona",description:"Who is being interviewed.",default:"Recently onboarded customer"},max_questions:{type:"integer",title:"Max Questions",description:"Approximate number of questions to ask.",default:12}},required:["research_goal"]},subagents:void 0},Wa={id:"cog-sales-pipeline-board-report",version:"0.0.1",name:"Sales Pipeline Board Report Cog",description:"Builds the board's sales pipeline report under the Sales Pipeline and the Board Reporting Frames: figures computed by the definitions the sales organization uses, written the way the board reads.",tags:["market-analyst","agent-worker","sales","pipeline","reporting","cog"],domain:"market-analyst",enabled:!1,model:"bedrock:us.anthropic.claude-sonnet-4-6",mcpServers:[],skills:[z["events:0.0.1"]?Ae(z["events:0.0.1"]):void 0].filter(Boolean),backendTools:[_o["runtime-echo:0.0.1"]],frontendTools:[Pe["jupyter-notebook:0.0.1"],Pe["lexical-document:0.0.1"]],environmentName:"ai-agents-env",icon:"table",emoji:"📊",color:"#1F883D",suggestions:[{text:"Use /home/datalayer/datasets/datalayer-nfs/sales/sales_pipeline.csv to generate a board-ready pipeline report with stage health and key risks.",summary:"Board pipeline report"}],welcomeMessage:"Hi! I can help with sales pipeline board report. Share data, files, or context and I will run the workflow end-to-end, explain what matters, and suggest practical next steps.",welcomeNotebook:void 0,welcomeDocument:void 0,sandboxVariant:"jupyter-server",harness:"pydantic-ai",systemPrompt:`You are a specialized assistant for this gallery workflow: Sales Pipeline Board Report. Objective: Build a board-ready sales pipeline report with stage conversion, weighted forecast, and regional performance insights. Use the runtime tools and notebook execution environment when needed. Keep outputs concise, structured, and decision-oriented. Provide clear reasoning and recommended next actions.
200
-
201
- ## Frames
202
-
203
- You work under these Frames. They carry the context, the rules and the vocabulary of the people you work for, and they take precedence over your defaults.
204
-
205
- - Datalayer Company Frame — owned by Datalayer, Inc. <info@datalayer.io>
206
- - Sales Pipeline Frame — owned by Datalayer Sales <info@datalayer.io>
207
- - Board Reporting Frame — owned by Datalayer Finance <info@datalayer.io>
208
-
209
- ### Rules
210
-
211
- - Never claim a capability, a tool or a result you have not verified.
212
- - Never put a secret, a credential or a token in an output.
213
- - Say what you did not do and what you could not check, as plainly as what you did.
214
- - Keep personal data out of an output unless the task is about that person and they are its audience.
215
- - Compute every figure from the pipeline data in the sandbox; never estimate one.
216
- - Never change, drop or impute a deal to make totals agree; report the discrepancy.
217
- - Name a customer or a deal owner only when the audience of the report is internal.
218
- - State a risk as plainly as a result; never soften a miss.
219
- - Present a forecast as a forecast, with the assumption it rests on.
220
- - Keep individual employees and named customers out of the report unless the board asked for them.
221
-
222
- ### Terminology
223
-
224
- - **Agentspec**: The declarative YAML specification of an agent.
225
- - **Frame**: The context work happens in, written down, owned, versioned and inherited.
226
- - **Cog**: An AI worker you can hold to account — an agent equipped with Frames.
227
- - **Guard**: A check the output of a piece of work has to pass.
228
- - **Sandbox**: The isolated environment an agent runs code in, beside the data.
229
- - **Pipeline**: The open opportunities, each at a stage, with an amount and an expected close date.
230
- - **Stage**: Where an opportunity stands, from first qualification to closed won or closed lost.
231
- - **Stage conversion**: The share of opportunities that entered a stage and moved on to the next.
232
- - **Weighted pipeline**: The sum of each open opportunity's amount multiplied by its stage's probability of closing.
233
- - **Coverage**: Weighted or total open pipeline divided by the target of the period.
234
- - **Slippage**: Opportunities whose expected close date moved out of the period.
235
-
236
- ### Goals
237
-
238
- - The reader can act on the output without asking what it means.
239
- - Every number can be traced to the code and the source it came from.
240
- - Stage health and the risk to the forecast are visible at a glance.
241
- - A figure in the report is the same figure whoever computes it.
242
- - A director who reads only the first page knows the state, the risks and the decision asked for.
243
-
244
- ### Style
245
-
246
- - Plain, direct sentences; the conclusion first.
247
- - Name things by what they are; no marketing adjectives.
248
- - Structured output — headings, short lists, tables for figures — over long prose.
249
- - One page of summary first — the state, three to five key figures, the risks, the asks.
250
- - Figures in tables, with the period and the comparison beside each.
251
- - No jargon a director outside the function would not know; define a term at its first use.
252
- - Neutral and factual; no superlatives.
253
-
254
- ### Norms
255
-
256
- - Run the analysis in the sandbox and report the result, not the raw data.
257
- - Cite the source of every factual claim.
258
- - Prefer the smallest change, and the simplest explanation, that is correct.
259
- - State the period, the currency and the date of the data on every report.
260
- - Give a rate with its numerator and its denominator.
261
- - Break a total down by region and by segment when the data carries them.
262
- - Round to what the decision needs, and keep the units and the currency on every figure.
263
- - Compare each key figure with the target and with the previous period.
264
- - End with what is asked of the board, or say that nothing is.
265
-
266
- ### Process
267
-
268
- 1. Load the pipeline data and check it — stages known, amounts positive, dates valid, no duplicate opportunity.
269
- 2. Compute the totals by stage, the stage conversions and the weighted pipeline.
270
- 3. Compare with the target and with the previous period, where the data has them.
271
- 4. Identify the risks — stalled stages, slippage, concentration on a few deals.
272
-
273
- ### Guards
274
-
275
- - **no-secrets** (policy-safety, required): The output contains no credential, token, API key or password.
276
- - **totals-reconcile** (algorithmic, required): The totals by stage, by region and by segment each add up to the total pipeline.
277
- - **definitions-applied** (policy-safety, required): Conversion, weighted pipeline and coverage are computed as this Frame defines them.
278
- - **data-quality-reported** (algorithmic, required): Rows excluded from a figure, and why, are counted and reported.
279
- - **summary-first** (algorithmic, required): The report opens with a summary of at most one page, with the key figures, the risks and the asks.
280
- - **forecast-labelled** (policy-safety, required): Every forward-looking figure is labelled as a forecast and carries its assumption.
281
- - **finance-review** (expert, required): A person from Finance reviews the figures before the report is sent to the board.
282
-
283
- Check your output against every Guard before you hand it over, and say which you could not satisfy.
284
- `,systemPromptCodemodeAddons:"Compose focused execution steps, validate intermediate results, and summarize outcomes after each run. Prefer efficient, reproducible code paths.",goal:void 0,delegable:[{id:"data.transform"},{id:"data.analyse"},{id:"document.extract"},{id:"report.author"}],protocol:void 0,uiPlugin:void 0,trigger:void 0,modelConfig:void 0,mcpServerTools:void 0,guardrails:void 0,evals:void 0,codemode:{enabled:!0,token_reduction:"~80%",speedup:"~1.5x"},output:void 0,advanced:void 0,checkpoints:void 0,authorizationPolicy:void 0,notifications:void 0,memory:"ephemeral",preHooks:void 0,postHooks:void 0,toolHooks:void 0,parameters:void 0,subagents:void 0},Ka={id:"cog-crawler",version:"0.0.1",name:"Crawler Cog",description:"Researches the web and public repositories under the Web Research Frame: every finding rests on a source that was opened, is cited, and is checked before it is reported.",agent:"worker-crawler",frames:["web-research"],lineage:["datalayer","web-research"],kind:"context",enabled:!0,guards:[{id:"no-secrets",category:"policy-safety",description:"The output contains no credential, token, API key or password.",required:!0},{id:"sources-cited",category:"source-grounding",description:"Every factual claim in the output carries a link to the page or repository it was read on.",required:!0},{id:"source-supports-claim",category:"source-grounding",description:"Each cited page was opened, and what it says supports the claim made from it.",required:!0},{id:"recency-stated",category:"algorithmic",description:"Every source older than the recency window is marked with its date.",required:!1}],spec:Da},Ya={id:"cog-customer-interviewer",version:"0.0.1",name:"Customer Interviewer Cog",description:"Conducts adaptive customer interviews under the Customer Research Frame: consent first, no leading question, and insights that each cite the interviewee's own words.",agent:"worker-customer-interviewer",frames:["customer-research"],lineage:["datalayer","customer-research"],kind:"context",enabled:!0,guards:[{id:"no-secrets",category:"policy-safety",description:"The output contains no credential, token, API key or password.",required:!0},{id:"no-leading-questions",category:"policy-safety",description:"No question in the interview suggests its own answer.",required:!0},{id:"insights-grounded",category:"source-grounding",description:"Every insight cites at least one verbatim from the interview that supports it.",required:!0},{id:"personal-data-removed",category:"policy-safety",description:"The insights name no person, employer or contact detail that consent does not cover.",required:!0}],spec:Va},Ja={id:"cog-sales-pipeline-board-report",version:"0.0.1",name:"Sales Pipeline Board Report Cog",description:"Builds the board's sales pipeline report under the Sales Pipeline and the Board Reporting Frames: figures computed by the definitions the sales organization uses, written the way the board reads.",agent:"worker-sales-pipeline-board-report",frames:["sales-pipeline","board-reporting"],lineage:["datalayer","sales-pipeline","board-reporting"],kind:"context",enabled:!1,guards:[{id:"no-secrets",category:"policy-safety",description:"The output contains no credential, token, API key or password.",required:!0},{id:"totals-reconcile",category:"algorithmic",description:"The totals by stage, by region and by segment each add up to the total pipeline.",required:!0},{id:"definitions-applied",category:"policy-safety",description:"Conversion, weighted pipeline and coverage are computed as this Frame defines them.",required:!0},{id:"data-quality-reported",category:"algorithmic",description:"Rows excluded from a figure, and why, are counted and reported.",required:!0},{id:"summary-first",category:"algorithmic",description:"The report opens with a summary of at most one page, with the key figures, the risks and the asks.",required:!0},{id:"forecast-labelled",category:"policy-safety",description:"Every forward-looking figure is labelled as a forecast and carries its assumption.",required:!0},{id:"finance-review",category:"expert",description:"A person from Finance reviews the figures before the report is sent to the board.",required:!0}],spec:Wa},So={"cog-crawler":Ka,"cog-customer-interviewer":Ya,"cog-sales-pipeline-board-report":Ja};function Qa(e){const a=e.lastIndexOf(":");return a>0&&e.slice(a+1).includes(".")?e.slice(0,a):e}function Xa(e){const a=Qa(e);return Object.prototype.hasOwnProperty.call(So,a)?So[a]:void 0}const Co=Cn((e,a)=>({pending:void 0,suggest:(i,s)=>{const l=i.trim();l&&e({pending:{text:l,submit:s?.submit??!1,nonce:(a().pending?.nonce??0)+1}})},consume:()=>e({pending:void 0})}));function Za({agentName:e,sandboxStillRuns:a=!1,temporary:i=!0,onSignedIn:s,onSignUp:l}){const{configuration:p}=Ao(),m=n.useCallback(f=>{En.getState().checkIAMToken(f),s?.()},[s]);return o.jsx(S,{sx:{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4},children:o.jsxs(S,{sx:{maxWidth:440,mx:"auto"},children:[o.jsxs(S,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2},children:[o.jsx(qt,{size:20}),o.jsx(V,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:i?"This demo runs on a shared key":"Your key has expired"})]}),o.jsxs(V,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[i?`${e??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${e??"The agent"} stopped because your session ran out.`,a?" Your notebook is still running in this page.":""]}),o.jsx(Ba,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:p?.iamUrl?`${p.iamUrl}/api/iam/v1/login`:void 0,onSignIn:m,onSignUp:l})]})})}const es="https://r1.datalayer.run";function ts(e=!0){const{configuration:a}=Ao(),i=$t(f=>f.token),s=a?.aiInferenceUrl||es,l=Tn(s,e&&!i),p=i||l.token,m=n.useMemo(()=>({inferenceUrl:s,token:p||void 0}),[s,p]);return{inference:m,needsSignIn:In(m),anonymous:l,inferenceUrl:s}}function Eo(e){return Po(e)??Xa(e)?.spec}function os(e,a){const i=[e?.systemPrompt?.trim(),a?.trim()].filter(s=>!!s);return i.length>0?i.join(`
285
-
286
- `):void 0}function ns(e,a){return e&&!a?`There is no agent or Cog named “${e}” in this page, so it cannot answer here.`:void 0}const as={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function To(e){const a=e?.subagents;if(!a)return[];const i=(a.subagents??[]).map(s=>{const l=s.ref?Po(s.ref):void 0;return{name:s.name,description:s.description||l?.description||s.name,instructions:s.instructions??l?.systemPrompt,model:s.model??l?.model??a.defaultModel,icon:l?.icon}});return a.includeGeneralPurpose?[...i,as]:i}const Oo="datalayer-loop-visitor",ss=3e4;function Bt(e){return typeof e=="string"&&/^[A-Za-z0-9-]{8,64}$/.test(e)}function rs(){try{const e=window.sessionStorage.getItem(Oo);return Bt(e)?e:""}catch{return""}}function is(e){try{window.sessionStorage.setItem(Oo,e)}catch{}}function cs(e,a){return Bt(a)?{app:e,visitor:a}:{app:e}}async function ls(e,a,i=rs(),s=fetch){const l=e.replace(/\/+$/,""),p=await s(`${l}/api/ai-inference/v1/anonymous/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(cs(a,i))}),m=await p.json().catch(()=>({}));if(!p.ok||!m.token)throw new Error(m.detail||`A visitor's token was refused by ${l} (HTTP ${p.status}).`);Bt(m.visitor)&&is(m.visitor);const f=Math.max(6e4,(m.expires_in??300)*1e3);return{token:m.token,visitor:m.visitor??i,renewAt:Date.now()+f-ss}}function ds(e){const[a,i]=n.useState({}),s=e?.app,l=e?.inferenceUrl;return n.useEffect(()=>{if(!s||!l){i({});return}let p=!1,m;const f=()=>{ls(l,s).then(u=>{p||(i({token:u.token}),m=setTimeout(f,Math.max(5e3,u.renewAt-Date.now())))}).catch(u=>{p||i({error:u instanceof Error?u.message:String(u)})})};return f(),()=>{p=!0,m&&clearTimeout(m)}},[s,l]),a}function us(e){return e.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function ps(e){const a=us(e);return/^executeCodeIn(Notebook|Document)$/.test(a)||/^(read|list)[A-Z]/.test(a)}function hs(e,a){return e.filter(i=>a?.has(i.name)||ps(i.name))}function ms(e,a){const i=s=>a&&s.value.id===`${a}-tools`?0:s.value.id==="notebook-tools"?1:2;return e.map((s,l)=>({entry:s,index:l,rank:i(s)})).sort((s,l)=>s.rank-l.rank||s.index-l.index).map(s=>s.entry)}function gs(e,a,i){if(!i||!e.endsWith("-tools"))return!1;const s=e.slice(0,-6);return a.has(s)&&s!==i}const fs={type:"object",properties:{}};function ys(e,a){const i=new Set(e.toolset);return e.commands.filter(s=>i.has(s.name)).map(s=>({name:s.name,description:s.description,parameters:s.parameters??fs,location:"frontend",handler:async l=>{if(!a)throw new Error(`${s.name}: the ${e.plugin??e.id} plugin is not mounted on this page.`);const p=Object.keys(l??{}).length>0?l:void 0,m=await a.executeCommand(s.command,p);return m===void 0?{ok:!0,command:s.command,argument:p}:m}}))}function bs(e,a){return e.flatMap(i=>ys(i,a))}function vs(){const e=jn(),a=qa();return n.useMemo(()=>bs(a,e),[a,e])}const Io={opening:"Opening your conversation…",notOpened:e=>`Your conversation could not be opened, so this is a new one: ${e}`};function ws(e){let a;for(const i of e.split(/\r?\n\r?\n/)){const s=i.split(/\r?\n/).filter(l=>l.startsWith("data:")).map(l=>l.slice(5).trim()).join("");if(s)try{const l=JSON.parse(s);l.type==="MESSAGES_SNAPSHOT"&&Array.isArray(l.messages)&&(a=l.messages)}catch{}}return a}async function jo(e){try{const a=await e.json();if(typeof a.detail=="string"&&a.detail)return a.detail}catch{}return`${e.status}`}async function xs({agentBaseUrl:e,agentId:a,uid:i,token:s,fetcher:l=fetch}){const p=`${e.replace(/\/+$/,"")}/api/v1/apps/sessions/${encodeURIComponent(i)}`,m=s?{Authorization:`Bearer ${s}`}:{},f=await l(`${p}/messages`,{headers:m});if(f.ok){const B=await f.json();return bo(B.messages)}if(f.status!==404)throw new Error(await jo(f));const u=await l(`${p}/resume`,{method:"POST",headers:{"Content-Type":"application/json",...m},body:JSON.stringify({agent:a})});if(!u.ok)throw new Error(await jo(u));const Y=ws(await u.text());if(!Y)throw new Error(`The runtime said nothing of session ${i}.`);return bo(Y)}const ks="var(--theme-accent)";function No({face:e,size:a}){return typeof e=="string"?o.jsx(Rn,{emoji:e,size:a,label:""}):o.jsx(o.Fragment,{children:e})}function Ss({face:e,size:a,state:i}){const s=i==="thinking"||i==="working",l=i==="paused";return o.jsxs(S,{as:"span","aria-hidden":!0,"data-presence":i,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:a+8,height:a+8,flexShrink:0,fontSize:a,lineHeight:1,children:[o.jsx(S,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:l?"none":`0 0 0 2px ${ks}`,border:l?"2px dashed":"none",borderColor:"border.default",opacity:s||i==="waiting"||l?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:s?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),o.jsx(S,{as:"span",display:"inline-flex",opacity:l?.55:1,filter:l?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:o.jsx(No,{face:e,size:a})})]})}function Cs({state:e}){return o.jsx(V,{role:"status","aria-live":"polite","data-presence-line":e,sx:{fontSize:0,color:e==="waiting"?"fg.default":"fg.muted",fontWeight:e==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:An[e]})}const Es=zt(void 0),Ts=zt(""),Is=zt({}),Z="",js=1400,Ro=parseInt(Pa["--loop-face-large"],10);function Os({workspace:e}){const a=Pn(),i=_n(),s=n.useRef(null),{setViewControls:l}=e,[p,m]=n.useState(null),f=On(),u=f.getConfig(Nn),Y=u?.placeholder||a.placeholder,B=u?.defaultSurface??"notebook",Qe=f.getConfig(Mn),[N,ee]=n.useState(Z),y=n.useRef(!1),E=$(Fn),te=$(Un),_e=$(Ln),re=$(qn)[0]?.value,J=Ot(re?.promptStance??Es)??re?.prompt,gt=$($n),Oe=zn(gt[0]?.value),G=n.useRef(Oe);G.current=Oe;const Q=n.useRef(""),Ne=$(Bn),ft=n.useMemo(()=>Gn(()=>Ne.reduce((t,c)=>({...t,...c.value.extras.value}),{})),[Ne]),w=Ot(Ne.length>0?ft:Is),X=n.useRef(new Set),oe=Hn(Ra,e),Ze=!oe.allowed,yt=Ze?oe.reason??"Chat is unavailable for this sandbox":void 0,[M,W]=n.useState(!1),[ye,ie]=n.useState(!1),[bt,et]=n.useState({open:!1,pendingApproval:!1}),ce=Dn(M,bt,u?.presence?.paused===!0),le=u?.presence?.onPresence;n.useEffect(()=>{le?.(ce),G.current?.setPresence(ce)},[le,ce]);const tt=n.useRef(u?.presence?.onSaying);tt.current=u?.presence?.onSaying;const C=n.useRef({answering:!1}),be=n.useCallback(t=>{s.current=t,ie(!!t)},[]),de=n.useCallback(t=>{const{open:c,pendingApproval:d}=Vn(t);et(fe=>fe.open===c&&fe.pendingApproval===d?fe:{open:c,pendingApproval:d});const v={saying:Kn(t),answering:Wn(t)},h=C.current;(h.saying?.id!==v.saying?.id||h.saying?.text!==v.saying?.text||h.answering!==v.answering)&&(C.current=v,tt.current?.(v));const H=G.current;if(!H)return;H.items(t);const D=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),Ie={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let I;for(let fe=t.length-1;fe>=0;fe-=1){const pt=t[fe];if(typeof pt.toolName=="string"&&pt.toolCallId){D.has(String(pt.status).toLowerCase())||(I=pt);break}}if(!I){H.activity(void 0);return}const Pt=I.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),rn=Ie[Pt]??`using ${I.toolName}`;H.activity(`${Q.current||"The agent"} is ${rn}…`)},[]),Me=n.useRef(w);Me.current=w;const Fe=n.useCallback(t=>{Go(t),G.current?.usage(t),Me.current.onUsage?.(t)},[]),ot=n.useCallback(t=>{W(t),t||G.current?.end("done")},[]),F=n.useCallback(t=>{const c=G.current;if(!c)return;let d=-1;for(let h=t.length-1;h>=0;h-=1)if(t[h].role==="user"){d=h;break}const v=t.slice(d+1).filter(h=>h.role==="assistant").map(Yn).filter(h=>h.trim().length>0).join(`
287
-
288
- `);c.assistant(v)},[]),ve=n.useRef([]),ne=n.useRef(!1),nt=$(Jn),we=n.useRef(nt);we.current=nt;const xe=n.useCallback((t,c)=>{const d=Qn(we.current.map(H=>H.value),c),v=d?.loop;if(ne.current&&v?.files&&v.files.length>0)return"A file is given to an application running on a runtime: run it on Datalayer or on your machine to give it one.";G.current?.begin(t,s.current?.thread());const h=s.current?.send;if(!h){ve.current.push([t,d]);return}h(t,d)},[]);n.useEffect(()=>{l(ye?{busy:M,stop:s.current?.stop,newChat:s.current?.newChat,send:xe}:null)},[M,ye,l,xe]),n.useEffect(()=>()=>l(null),[l]),n.useEffect(()=>e.prompts.subscribe(xe),[e.prompts,xe]),n.useEffect(()=>{if(!ye||ve.current.length===0)return;const t=ve.current.splice(0,ve.current.length);for(const[c,d]of t)s.current?.send(c,d)},[ye]);const Ue=n.useRef(!1),U=n.useCallback(async t=>{Ue.current||(Ue.current=!0,Qe?.firstPromptHook?.()),m(null);const c=await e.submit(t);if(!c.handled){m(c.reason??null);return}jt(""),c.result?.content&&m(c.result.content)},[e,Qe?.firstPromptHook]),x=n.useMemo(()=>E.find(t=>t.value.surfaceId===N)?.value,[E,N]),ue=n.useCallback(t=>{y.current=!0,ee(t)},[]);n.useEffect(()=>Xn(ue),[ue]),n.useEffect(()=>{Zn(E.map(t=>t.value.surfaceId))},[E]),n.useEffect(()=>{ea(N&&N!==Z?N:_a)},[N]);const ae=n.useMemo(()=>B===Z||B==="none"?void 0:E.find(t=>t.value.surfaceId===B),[E,B]);n.useEffect(()=>{y.current||!ae||Je(ae.value,e)&&ee(B)},[ae,e,B]);const[_,Le]=n.useState(null),qe=n.useRef(null),$e=u?.fullScreenTopOffset??0,{fullScreen:O,usingApi:ze,toggle:pe,topOffsetPx:vt}=ta(qe,{forceOverlay:!!$e,topOffset:$e}),[wt,Be]=n.useState(!1),ke=n.useRef(!1);n.useEffect(()=>{!M||ke.current||O||(ke.current=!0,Be(!0))},[M,O]),n.useEffect(()=>{O&&Be(!1)},[O]),n.useEffect(()=>{x&&!Je(x,e)&&(Le(x.surfaceId),ee(Z))},[x,e]);const he=n.useMemo(()=>{if(_)return E.find(t=>t.value.surfaceId===_)?.value;if(!y.current&&N===Z)return ae?.value},[E,_,N,ae]);n.useEffect(()=>{if(!_||N!==Z)return;const t=E.find(c=>c.value.surfaceId===_);t&&Je(t.value,e)&&(Le(null),ee(_))},[E,N,_,e]);const k=e.agentId?.trim()||"default",j=oa(e.sandbox.target??"local");ne.current=j;const r=na(),b=Ot(r?.selected??Ts),g=r?.members.find(t=>t.id===b),L=$(aa)[0]?.value,Se=L?.specId,T=Eo(g?.specId??k)??(Se?Eo(Se):void 0),me=g?void 0:L,Ge=j&&!g?ns(Se,T):void 0;Q.current=g?.name??T?.name??k;const He=$(sa),De=w.hiddenOpeners,Ht=w.hideOpeners,xt=w.openers,kt=n.useMemo(()=>{if(Ht)return[];const t=new Set(De??[]),c=I=>t.size===0?I:I.filter(Pt=>!t.has(Pt.text));if(xt)return c(xt);const d=He.flatMap(I=>I.value.suggestions);if(d.length>0)return c(d);const v=c(T?.suggestions??[]),h=c(r?.team.suggestions??[]);if(h.length===0)return v;const H=new Set(h.map(I=>I.text)),D=r?.team.name??"Team",Ie=g?.name??T?.name??k;return[...h.map(I=>({...I,group:D})),...v.filter(I=>!H.has(I.text)).map(I=>({...I,group:Ie}))]},[He,r,T,g,k,De,Ht,xt]),at=n.useMemo(()=>kt.map(t=>({title:t.summary??t.text,message:t.message??t.text,group:t.group})),[kt]),St=je(T?.icon),q=u?.presence,Mo=je(r?.team.icon),Dt=$(ra),st=n.useMemo(()=>{const t=[],c=new Map,d=new Set,v=new Set(E.map(h=>h.value.surfaceId));for(const h of ms(Dt,x?.surfaceId)){if(gs(h.value.id,v,x?.surfaceId))continue;let H;try{H=h.value.tools(e)}catch(D){console.warn(`[loop] frontend tools from '${h.plugin}' failed:`,D);continue}for(const D of H){const Ie=c.get(D.name);if(Ie){console.warn(`[loop] frontend tool '${D.name}' from '${h.plugin}' is shadowed by the one from '${Ie}'.`);continue}c.set(D.name,h.plugin),t.push(D),h.value.chatView&&d.add(D.name)}}for(const h of w.frontendTools??[])c.has(h.name)||(c.set(h.name,"chat-extras"),t.push(h),d.add(h.name));return x?t:hs(t,d)},[Dt,e.surfaceId,e.agentId,w.frontendTools,x?.surfaceId,E]),Ct=vs(),rt=n.useMemo(()=>{if(Ct.length===0)return st;const t=new Set(st.map(c=>c.name));return[...st,...Ct.filter(c=>!t.has(c.name))]},[st,Ct]),R=ia(e.sandbox,e.serverUrl),Vt=$(ca),Fo=n.useMemo(()=>Vt.filter(t=>t.value.composer).map(t=>({name:t.value.name,description:t.value.description})),[Vt]),Uo=n.useMemo(()=>{if(!r||!g)return To(T).map(d=>({name:d.name,description:d.description,icon:je(d.icon)}));const t=r.members.map(d=>({name:d.name,description:d.description,emoji:d.emoji,icon:je(d.icon),disabled:d.id===g.id,disabledReason:d.id===g.id?`You are already talking to ${d.name}`:void 0})),c=vo(r.team,g.id).filter(d=>!r.members.some(v=>v.name===d.name)).map(d=>({name:d.name,description:d.description,icon:je(d.icon)}));return[...t,...c]},[r,g,T]),{inference:Wt,anonymous:Lo}=ts(j),qo=$t(t=>t.user),Et=j&&Lo.status==="expired",Kt=!qo,Tt=la(),It=R===void 0?da(e.sandbox,a):void 0,it=Ze||Et||!!Ge||!!It||Tt.disabled,Yt=Et?Kt?a.demoKeyExpired:a.keyExpired:Ge??It??yt??(Tt.disabled?Tt.disableReason:void 0),[Jt,jt]=n.useState(""),[$o,Qt]=n.useState(),ct=$o??me?.model??T?.model??e.model??"",Ce=ua(),Xt=n.useRef(Ce),Zt=n.useRef(b),eo=n.useRef(Ce);eo.current=Ce,n.useEffect(()=>{Zt.current!==b&&(Zt.current=b,Xt.current=eo.current,Qt(void 0))},[b]);const zo=Ce&&Ce!==Xt.current?Ce:null,[Bo,Go]=n.useState(),Ho=zo??Bo??null,Do=Nt(Re.inpromptMenu),Vo=Nt(Re.promptAction),Wo=Nt(Re.chatHeader),Ko=n.useMemo(()=>r?.members.map(t=>({id:t.id,name:t.name,description:t.description,icon:je(t.icon)}))??[],[r]),ge=Co(t=>t.pending),[to,Yo]=n.useState(0);n.useEffect(()=>pa(()=>Yo(t=>t+1)),[]),n.useEffect(()=>{ge&&(jt(ge.text),Co.getState().consume(),ge.submit&&U(ge.text))},[ge]);const Ve=!!me?.createPayload?.app_spec,Jo=$t(t=>t.token),oo=f.getConfig(wo)?.datalayerVisitors,Qo=ds(oo),Xo=f.getConfig(wo)?.embedToken,We=oo?Qo.token:Xo||Jo,P=u?.thread,[Ee,no]=n.useState(null),Zo=!!(P?.fromRuntime&&Ee?.given!==P.id);n.useEffect(()=>{if(!P?.fromRuntime||!Ve||!R)return;let t=!0;return(async()=>{let c="";for(let d=0;d<4&&t;d+=1)try{const v=await xs({agentBaseUrl:R,agentId:k,uid:P.id,token:We});t&&no({given:P.id,thread:{...P,fromRuntime:!1,messages:v}});return}catch(v){c=v instanceof Error?v.message:String(v),await new Promise(h=>setTimeout(h,1500))}t&&no({given:P.id,thread:{id:ha(),messages:[],onStarted:P.onStarted},said:Io.notOpened(c)})})(),()=>{t=!1}},[P?.id,P?.fromRuntime,Ve,R,k,We]);const ao=P?.fromRuntime?Ee?.given===P.id?Ee.thread:void 0:P,Rt=n.useMemo(()=>j?Ga({agentId:g?.specId??k,instructions:os(T,me?.instructions),model:ct||void 0,inference:Wt,frontendTools:rt,subagents:r&&g?vo(r.team,g.id):To(T),sharing:r?.sharing,onSubagentEvent:t=>Aa.getState().appendSubagentEvent(t),modeEffect:me?.modeEffect}):R!==void 0?{type:"ag-ui",endpoint:Ve?`${R}/api/v1/apps/agents/${encodeURIComponent(k)}/ag-ui/`:`${R}/api/v1/ag-ui/${k}/`,...Ve&&We?{authToken:We}:{},agentId:k,configEndpoint:`${R}/api/v1/configure`,enableConfigQuery:!0}:void 0,[k,j,Wt,g,rt,r,T,me,ct,R,Ve,We]),lt=ma(!j,Rt?.type==="ag-ui"?Rt.configEndpoint:void 0,void 0,k),Ke=ga(),dt=fa(k),[so,ro]=n.useState(void 0),[en,tn]=n.useState(void 0);n.useEffect(()=>{if(j||R===void 0)return;let t=!1;return fetch(`${R}/api/v1/configure/models?agent_id=${encodeURIComponent(k)}`).then(c=>c.ok?c.json():null).then(c=>{t||(ro(c?ya(c):[]),tn(c?ba(c):void 0))}).catch(()=>{t||ro([])}),()=>{t=!0}},[R,k,j]);const on=n.useMemo(()=>va(so,()=>Object.values(wa).filter(t=>t.available&&xa(t)).map(t=>({id:t.id,name:t.name,provider:t.provider}))),[so]),io=n.useMemo(()=>{const t=lt.data?.builtinTools??[],c=new Set(t.map(d=>d.name));return{runtime:t,frontend:rt.filter(d=>!c.has(d.name)).map(d=>({id:d.name,name:d.name}))}},[lt.data?.builtinTools,rt]),co=n.useMemo(()=>new Set((Ke.data?.skills??[]).filter(t=>t.status==="enabled"||t.status==="loaded").map(t=>t.id)),[Ke.data]),nn=n.useCallback(async t=>{Qt(t),!(j||R===void 0)&&await fetch(`${R}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:t})}).catch(()=>{})},[R,j]),lo=u?.promptPlacement==="bottom-chat",an=u?.promptPlacement==="floating",Te=u?.promptPlacement==="top",Ye=u?.hidePrompt===!0||w.hidePrompt===!0,sn={onSend:()=>{U(Jt)},input:Jt,setInput:jt,focusTrigger:ge||to?(ge?.nonce??0)+to:void 0,placement:an||J==="floating"||J==="floating-top"||J==="floating-bottom"?"floating":"docked",floatingAnchor:J==="floating-top"?"top":"bottom",isLoading:M,onStop:()=>e.viewControls.stop?.(),placeholder:Yt??Y,typingSuggestions:kt.map(t=>t.text),suggestions:at,disableInputPrompt:it,connectionConfirmed:!it,padding:Te||J==="floating-top"||J==="floating-bottom"||J==="docked-top"?2:3,promptVariant:"lexical",autoFocus:u?.autoFocusPrompt??!0,mentionableAgents:Uo,promptCommands:Fo,headerContent:Do.length>0?o.jsx(Mt,{slot:Re.inpromptMenu,props:{workspace:e}}):void 0,footerExtras:Vo.length>0?o.jsx(Mt,{slot:Re.promptAction,props:{workspace:e}}):void 0,showAgentsMenu:!q,showInlineAgentsMenu:!1,agents:Ko,selectedAgentId:b,onSelectAgent:t=>r?.select(t),showTokenUsage:w.showTokenUsage??u?.showTokenUsage??!0,showContextRing:!0,agentUsage:Ho??void 0,showModelSelector:!q,models:on,decisions:en,selectedModel:ct,onModelSelect:t=>{nn(t)},showToolsMenu:!q,availableTools:io.runtime,availableFrontendTools:io.frontend,mcpServers:lt.data?.mcpServers??[],mcpStatusData:w.mcpStatusData??void 0,showSkillsMenu:!q,skills:Ke.data?.skills??[],skillsLoading:Ke.isLoading,enabledSkills:co,onToggleSkill:t=>co.has(t)?dt.disableSkill(t):dt.enableSkill(t),onToggleAllSkills:(t,c)=>t.forEach(d=>c?dt.enableSkill(d):dt.disableSkill(d)),codemodeEnabled:w.codemodeEnabled??!1,onToggleCodemode:w.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!lt.data,hasSkillsData:!!Ke.data},uo=te[0]?.value.Component,At=_e[0]?.value.Component,ut=uo?o.jsx(uo,{workspace:e,composer:sn}):null,po=E.length>0&&u?.showSurfaceSelector!==!1?o.jsx(Rs,{surfaces:E.map(t=>t.value),active:x?.surfaceId??he?.surfaceId??Z,onChange:ue,workspace:e}):null,ho=o.jsxs(o.Fragment,{children:[E.map(t=>{const c=t.value,d=x?.surfaceId===c.surfaceId;return d||X.current.has(c.surfaceId)||Je(c,e)?(X.current.add(c.surfaceId),o.jsx(S,{sx:d?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:o.jsx(ka,{load:c.load,props:{surfaceId:c.surfaceId,workspace:e},fallback:o.jsxs(Lt,{children:["Loading ",c.title,"…"]}),errorFallback:h=>o.jsxs(Lt,{children:[c.title," failed to load: ",h.message]})})},c.surfaceId)):null}),!x&&he?o.jsx(S,{flex:"1 1 0",minWidth:0,minHeight:0,children:o.jsxs(Lt,{children:["Starting ",he.title,"…"]})}):null]}),mo=o.jsx(o.Fragment,{children:o.jsxs(S,{flex:Te&&x?"0 0 34%":"1 1 0",maxWidth:Te&&x?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:x?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[w.errorBanner?o.jsx(S,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:w.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:w.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:w.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:w.errorBanner.message}):null,Ee?.said&&Ee.given===P?.id?o.jsx(V,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:Ee.said}):null,o.jsx(S,{flex:"1 1 auto",minHeight:0,display:"flex",children:Zo?o.jsx(V,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:Io.opening}):o.jsx(Sa,{themeVariant:u?.themeVariant,themeOverrides:u?.themeOverrides,colorMode:u?.colorMode,thread:ao,disabled:it,disableReason:Yt,protocol:Rt,initialModel:ct||void 0,title:q?.name??g?.name??T?.name??k,description:q?.welcome??T?.description,brandIcon:q?.face?o.jsx(Ss,{face:q.face,size:20,state:ce}):o.jsx(St,{size:20}),headerContent:q&&!It?o.jsx(Cs,{state:ce}):void 0,emptyState:{icon:q?.face?o.jsx("span",{"aria-hidden":!0,style:{fontSize:Ro,lineHeight:1},children:o.jsx(No,{face:q.face,size:Ro})}):o.jsx(St,{size:48}),title:q?.name??g?.name??T?.name??k,...r&&g?{sections:[{group:r.team.name,icon:o.jsx(Mo,{size:48}),title:r.team.name,subtitle:r.team.description},{group:g.name,icon:o.jsx(St,{size:32}),title:g.name,subtitle:T?.description}]}:null},suggestions:Te||re||u?.suggestionLabels===!1?[]:at,showHeader:!u?.hideHeader&&!!At,headerButtons:{showNewChat:u?.headerButtons?.newChat??!1,showClear:u?.headerButtons?.clear??!1},renderHeader:At?t=>o.jsx(At,{workspace:e,header:t}):void 0,showInformation:!0,headerActions:o.jsxs(S,{display:"inline-flex",alignItems:"center",gap:2,children:[e.chatHeaderActions,Wo.length>0?o.jsx(Mt,{slot:Re.chatHeader,props:{workspace:e}}):null,o.jsx(Ca,{icon:O?Ea:Ta,"aria-label":O?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{Be(!1),pe()},sx:wt?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${i.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${i.primary}`,animation:`dla-fullscreen-hint ${js}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})]}),showInput:!1,onSendReady:be,notebookToolSurfacesId:x?void 0:e.surfaceId,renderToolResult:w.renderToolResult,showTurnFooter:w.showTokenUsage??u?.showTokenUsage??!0,onContextSnapshot:Fe,onLoadingChange:ot,onItemsChange:F,onDisplayItemsChange:de,enableStreaming:!0},ao?.id)}),lo&&!Ye?ut:null]})}),go=u?.suggestionLabels!==!1&&at.length>0?o.jsx(S,{"aria-label":a.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:at.map(t=>o.jsx(S,{as:"button",type:"button",title:t.message,disabled:M||it,onClick:()=>{U(t.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:xo,flex:`0 0 ${xo}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:o.jsx(Ia,{title:t.title,maxWidth:"100%",sx:{minWidth:0},children:t.title})},t.title))}):null,fo=p?o.jsx(S,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:p}):null;return o.jsxs(S,{ref:qe,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...O?{bg:"canvas.default"}:null,...O&&!ze.current?{position:"fixed",top:vt,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[re?o.jsx(re.Component,{workspace:e,editors:ho,hasEditor:!!x,transcript:mo,prompt:Ye?null:ut,chips:Ye?null:go,picker:po,transient:fo}):o.jsxs(o.Fragment,{children:[Te&&!Ye?o.jsxs(S,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[ut,go]}):null,po,o.jsxs(S,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[ho,mo]}),fo,lo||Ye||Te?null:ut]}),Et?o.jsx(S,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:o.jsx(Za,{agentName:g?.name??T?.name,sandboxStillRuns:j,temporary:Kt,onSignedIn:()=>ja.getState().clear()})}):null]})}function Rs({surfaces:e,active:a,onChange:i,workspace:s}){const l=[...e].sort((p,m)=>(p.order??100)-(m.order??100));return o.jsxs(S,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[o.jsx(V,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),o.jsxs(Ft,{"aria-label":"Editor beside the chat",size:"small",children:[o.jsx(Ft.Button,{selected:a===Z,onClick:()=>i(Z),children:"Chat"}),l.map(p=>{const m=Je(p,s),f=m?void 0:p.unavailableReason?.(s)??"Not available right now";return o.jsx(Ft.Button,{selected:a===p.surfaceId,"aria-disabled":!m,title:f??p.title,leadingIcon:p.icon,onClick:()=>{m&&i(p.surfaceId)},children:p.title},p.surfaceId)})]})]})}function Lt({children:e}){return o.jsx(S,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:e})}export{Os as default};