@axiom-lattice/gateway 4.4.2 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{a2a-standard-RWR5JTMH.mjs → a2a-standard-PIOKEHPS.mjs} +1 -1
- package/dist/a2a-standard-PIOKEHPS.mjs.map +1 -0
- package/dist/embed/{embed-page-AgentDetailSideApp-2BDEWFQ6.js → embed-page-AgentDetailSideApp-I4ZT3MQQ.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-WG7E3G5T.js → embed-page-AgentGovernanceWorkbench-HVFB6EPY.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-5SWPEQ4V.js → embed-page-MessageGraph-CZQROEO7.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-ZYWRXIMC.js → embed-page-ReactChart-WMWBSL54.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-TKBMB5VV.js → embed-page-SkillFlow-5JLJ5R57.js} +1 -1
- package/dist/embed/embed-page-TasksSideApp-5BYTO4KT.js +254 -0
- package/dist/embed/{embed-page-TeamWorkspace-XNZM7AV7.js → embed-page-TeamWorkspace-5KN7ZZWQ.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-DGSHSTIU.js → embed-page-TopologyRuntimeView-S6XAQHDF.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-BHIRIWV3.js → embed-page-WorkflowAutomationView-E6G446HW.js} +1 -1
- package/dist/embed/embed-page-chunk-2JOGNXZT.js +245 -0
- package/dist/embed/embed-page-chunk-7GAD6Q52.js +6986 -0
- package/dist/embed/{embed-page-chunk-JMZ7OODN.js → embed-page-chunk-DSQ4DIQY.js} +1 -1
- package/dist/embed/{embed-page-chunk-YCX5YZRP.js → embed-page-chunk-KDWA6VOG.js} +1 -1
- package/dist/embed/embed-page-chunk-MUE3GWJV.js +153 -0
- package/dist/embed/{embed-page-chunk-HMTKPZ5B.js → embed-page-chunk-QU52HUXW.js} +1 -1
- package/dist/embed/{embed-page-chunk-XUXEGF3S.js → embed-page-chunk-YQ3BA27D.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +210 -2
- package/dist/index.d.ts +210 -2
- package/dist/index.js +5757 -5237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5765 -5247
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/a2a-standard-RWR5JTMH.mjs.map +0 -1
- package/dist/embed/embed-page-TasksSideApp-X6255GEF.js +0 -241
- package/dist/embed/embed-page-chunk-DEDTYRZE.js +0 -245
- package/dist/embed/embed-page-chunk-HEO7X7LH.js +0 -153
- package/dist/embed/embed-page-chunk-SPC4BYNU.js +0 -6974
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Aa as K,Ca as Q,Q as q,a as E,b as T,c as H,d as j,e as $,f as F,
|
|
1
|
+
import{Aa as K,Ca as Q,Q as q,a as E,b as T,c as H,d as j,e as $,f as F,ub as V,v as z,vb as J,xa as G,ya as L}from"./embed-page-chunk-7GAD6Q52.js";import{f as v,l as B,p as X}from"./embed-page-chunk-QU52HUXW.js";import{a as P}from"./embed-page-chunk-MB65DZAX.js";import{va as O}from"./embed-page-chunk-O4QK5LWZ.js";import{a as N}from"./embed-page-chunk-4BKXE5ON.js";import{e as R}from"./embed-page-chunk-6Y3UYJ6Z.js";var A=R(N());var f=class extends Error{code;retryable;status;constructor(t,n,r,o){super(n),this.name="AgentWebAppRuntimeClientError",this.code=t,this.retryable=r,this.status=o}};function C(){return new f("STREAM_FAILED","Stream failed",!0)}var ae=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e,t){return Object.keys(e).length===t.length&&t.every(r=>r in e)}function ie(e){return S(e)&&y(e,["code","message","retryable"])&&typeof e.code=="string"&&ae.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function de(e){if(!S(e))return!1;let t=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return y(e,t)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||S(e.data))}var pe=new Set([E.HUMAN,E.AI,E.TOOL,E.INTERRUPT,E.MESSAGE_COMPLETED,E.MESSAGE_FAILED,E.THREAD_IDLE]);function ce(e,t){let n;try{n=JSON.parse(e)}catch{throw C()}if(!S(n)||typeof n.type!="string")throw C();if(pe.has(n.type)||n.type==="error"&&S(n.data)&&!S(n.error)){let r=j(n,t);return r.length===0?[]:r}switch(n.type){case"message.delta":if(y(n,["type","text"])&&typeof n.text=="string")return[n];break;case"message.completed":if(y(n,["type","messageId"])&&typeof n.messageId=="string")return[n];break;case"tool.started":if(y(n,["type","id","name"])&&typeof n.id=="string"&&typeof n.name=="string")return[n];break;case"tool.completed":if(y(n,["type","id"])&&typeof n.id=="string")return[n];break;case"interrupt.created":if(y(n,["type","interrupt"])&&de(n.interrupt))return[n];break;case"genui.render":if(y(n,["type","block"])&&T(n.block))return[n];break;case"error":if(y(n,["type","error"])&&ie(n.error))return[n];break;case"stream.completed":if(y(n,["type"]))return[n];break}throw C()}function ue(e){return e instanceof Error&&e.name==="AbortError"}async function Y(e,t){let n=H({allowGenUI:!0,allowInterrupts:!0}),r=e.getReader(),o=new TextDecoder,s="",a=!1,d=!1;try{for(;!a;){let p;try{p=await r.read()}catch(b){if(ue(b))return;throw C()}p.done&&(d=!0);try{s+=o.decode(p.value,{stream:!p.done})}catch{throw C()}let c=s.split(/\r?\n\r?\n/);s=p.done?"":c.pop()??"";for(let b of c){let w=b.split(/\r?\n/).filter(h=>h==="data"||h.startsWith("data:")).map(h=>h==="data"?"":h.slice(5).replace(/^ /,""));if(w.length!==0){for(let h of ce(w.join(`
|
|
2
2
|
`),n))if(await t(h),a=h.type==="stream.completed",a)break;if(a)break}}if(p.done)break}if(!a)throw C()}finally{if(!d)try{await r.cancel()}catch{}r.releaseLock()}}var le=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function m(e,t,n=[]){let r=Object.keys(e);return t.every(o=>o in e)&&r.every(o=>t.includes(o)||n.includes(o))}function i(e){return typeof e=="string"}function M(e){if(!l(e)||!m(e,["id","projectId","createdAt","updatedAt"],["label"])||!i(e.id)||!i(e.projectId)||e.label!==void 0&&!i(e.label)||!i(e.createdAt)||!i(e.updatedAt))return;let t=new Date(e.createdAt),n=new Date(e.updatedAt);if(!(Number.isNaN(t.getTime())||Number.isNaN(n.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:t,updatedAt:n}}function Z(e){if(!l(e)||e.success!==!1||!l(e.error))return!1;let t=e.error;return m(e,["success","error"])&&m(t,["code","message","retryable"])&&typeof t.code=="string"&&le.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Ae(e){if(!l(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return m(e,t,["files"])&&t.every(n=>typeof e[n]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function fe(e){return Array.isArray(e)&&e.length<=6&&e.every(t=>l(t)&&m(t,["label","text"])&&i(t.label)&&t.label.length>=1&&t.label.length<=40&&i(t.text)&&t.text.length>=1&&t.text.length<=500)}function me(e){return l(e)&&m(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||i(e.title))&&(e.welcomeMessage===void 0||i(e.welcomeMessage))&&(e.primaryColor===void 0||i(e.primaryColor))&&(e.quickPrompts===void 0||fe(e.quickPrompts))}function ge(e){if(!l(e)||!m(e,["webApp","projects","models"],["thread"])||!l(e.webApp))return;let t=e.webApp;if(!m(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!i(t.id)||!i(t.name)||!i(t.defaultProjectId)||t.description!==void 0&&!i(t.description)||t.defaultModelKey!==void 0&&!i(t.defaultModelKey)||t.identityAssurance!=="unverified"||!l(t.assistant)||!m(t.assistant,["id","name"],["description"])||!i(t.assistant.id)||!i(t.assistant.name)||t.assistant.description!==void 0&&!i(t.assistant.description)||!Ae(t.features)||!me(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>l(r)&&m(r,["id","name"])&&i(r.id)&&i(r.name))||!Array.isArray(e.models)||!e.models.every(r=>l(r)&&m(r,["key","label"])&&i(r.key)&&i(r.label)))return;let n=e.thread===void 0?void 0:M(e.thread);if(!(e.thread!==void 0&&!n))return{...e,...n?{thread:n}:{}}}function he(e){if(!l(e)||!m(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(M);return t.every(n=>n!==void 0)?{records:t,total:e.total}:void 0}function be(e){return l(e)&&i(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||i(e.content)||Array.isArray(e.content)&&e.content.every(t=>T(t)!==void 0))}function ye(e){return l(e)&&m(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(be)?e:void 0}function we(e){return l(e)&&m(e,["ref","name","mimeType","size"])&&i(e.ref)&&i(e.name)&&i(e.mimeType)&&typeof e.size=="number"?e:void 0}function ee(e,t){return n=>l(n)&&m(n,e)&&t(n)?n:void 0}var D=class{constructor(t){this.options=t;this.baseUrl=`${t.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(t.webAppId)}/runtime`,this.fetchImplementation=t.fetch??globalThis.fetch.bind(globalThis)}baseUrl;fetchImplementation;async bootstrap(t={},n){return this.request("bootstrap",ge,{query:t,signal:n})}async listThreads(t={},n){return this.request("threads",he,{query:t,signal:n})}async createThread(t={},n){return this.request("threads",M,{method:"POST",body:t,signal:n})}async updateThread(t,n,r){return this.request(`threads/${encodeURIComponent(t)}`,M,{method:"PATCH",body:n,signal:r})}async deleteThread(t,n={},r){await this.request(`threads/${encodeURIComponent(t)}`,ee(["id"],o=>i(o.id)),{method:"DELETE",query:n,signal:r})}async getMessages(t,n={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,ye,{query:n,signal:r})}async streamMessage(t,n,r,o){return this.streamRequest(`threads/${encodeURIComponent(t)}/messages/stream`,n,r,o)}async resumeInterrupt(t,n,r,o,s){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(n)}/resume`,r,o,s)}async streamRequest(t,n,r,o){let s;try{s=await this.fetchRequest(t,{method:"POST",body:n,signal:o})}catch(a){throw te(a)||a instanceof f?a:new f("STREAM_FAILED","Stream failed",!0)}if(s.ok||await this.throwResponseError(s),!s.body||!s.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(s.body)try{await s.body.cancel()}catch{}throw new f("STREAM_FAILED","Stream failed",!0,s.status)}await Y(s.body,r)}async abort(t,n={},r){await this.request(`threads/${encodeURIComponent(t)}/abort`,ee(["aborted"],o=>typeof o.aborted=="boolean"),{method:"POST",query:n,signal:r})}async uploadAttachment(t,n,r={},o){let s=new FormData,a=typeof File<"u"&&n instanceof File?n.name:"attachment";return s.append("file",n,a),this.request(`threads/${encodeURIComponent(t)}/attachments`,we,{method:"POST",query:r,body:s,signal:o})}async request(t,n,r={}){let o;try{o=await this.fetchRequest(t,r)}catch(d){throw te(d)||d instanceof f?d:new f("INTERNAL_ERROR","Request failed",!0)}let s;try{s=await o.json()}catch{throw this.internalError(o.status)}if(Z(s))throw new f(s.error.code,s.error.message,s.error.retryable,o.status);if(!o.ok||!l(s)||!m(s,["success","data"])||s.success!==!0)throw this.internalError(o.status);let a=n(s.data);if(a===void 0)throw this.internalError(o.status);return a}async fetchRequest(t,n){let r=await this.options.identityProvider.getIdentity(n.signal),o=new URL(`${this.baseUrl}/${t}`);for(let[d,p]of Object.entries(n.query??{}))p!==void 0&&o.searchParams.set(d,p);let s=new Headers;r.bearerToken!==void 0?s.set("Authorization",`Bearer ${r.bearerToken}`):s.set("X-Axiom-External-User-Id",r.externalUserId??"");let a;return n.body instanceof FormData?a=n.body:n.body!==void 0&&(s.set("Content-Type","application/json"),a=JSON.stringify(n.body)),this.fetchImplementation(o,{method:n.method??"GET",headers:s,body:a,signal:n.signal,credentials:"omit"})}async throwResponseError(t){let n;try{n=await t.json()}catch{throw this.internalError(t.status)}throw Z(n)?new f(n.error.code,n.error.message,n.error.retryable,t.status):this.internalError(t.status)}internalError(t){return new f("INTERNAL_ERROR","Invalid server response",!1,t)}};function te(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var _=R(N());var I=R(P());function ne(){let{createThread:e}=L(),{menuCollapsed:t,setMenuCollapsed:n}=K();(0,_.useEffect)(()=>{t===void 0&&n(!0)},[t,n]);let r=(0,_.useCallback)(async()=>{try{await e("New Thread")}catch(c){console.error("Failed to create new thread:",c)}},[e]),o=t??!0,p=[{id:"new-analysis",builtin:"new-analysis",type:"action",name:"New Thread",icon:(0,I.jsx)(z,{size:20}),order:0},...o?[{id:"thread-history-toggle",type:"action",name:"History",icon:(0,I.jsx)(q,{size:20}),order:1}]:[{id:"thread-history",builtin:"thread-history",type:"drawer",name:"History",icon:(0,I.jsx)(q,{size:20}),order:1,title:"Conversation History",width:320,inline:!0,inlineDefaultExpanded:!0,content:(0,I.jsx)(V,{})}]];return(0,I.jsx)(Q,{items:p,showBranding:!1,showToggle:!0,showNewAnalysis:!1,defaultExpanded:!o,collapsed:o,onCollapsedChange:n,onNewAnalysis:r,onItemClick:c=>{c.type==="action"&&c.builtin==="new-analysis"?r():c.type==="action"&&c.id==="thread-history-toggle"&&n(!1)}},o?"agent-chat-sidebar-collapsed":"agent-chat-sidebar-expanded")}function re(e){if(typeof window>"u"||typeof XMLHttpRequest>"u")return()=>{};let t=`${e.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(e.webAppId)}/runtime/`,n=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.send,o=new WeakMap;return XMLHttpRequest.prototype.open=function(a,d){o.set(this,String(d)),n.call(this,a,d,!0)},XMLHttpRequest.prototype.send=function(a){let d=o.get(this)??"";if(!d.startsWith(t)||!/\/sandbox\/uploadfile$/.test(d)){r.call(this,a);return}if(e.identity.mode==="unverified"){this.setRequestHeader("X-Axiom-External-User-Id",e.identity.userId),r.call(this,a);return}e.identity.tokenProvider().then(p=>{this.setRequestHeader("Authorization",`Bearer ${p}`),r.call(this,a)}).catch(()=>{r.call(this,a)})},()=>{XMLHttpRequest.prototype.open=n,XMLHttpRequest.prototype.send=r}}var u=R(P());function Ee(e,t){let r=oe(e.welcome)??oe(t.welcomeMessage),o=e.quickPrompts??t.quickPrompts??[];return{...r!==void 0?{welcome:r}:{},quickPrompts:o}}function oe(e){return typeof e=="string"&&e.length>0?e:void 0}function Ce(e){if(!e.gatewayUrl.trim())throw new Error("AgentChatApp requires gatewayUrl");try{new URL(e.gatewayUrl)}catch{throw new Error("AgentChatApp gatewayUrl must be a valid URL")}if(!e.webAppId.trim())throw new Error("AgentChatApp requires webAppId");if(e.identity.mode==="unverified"){if(!e.identity.userId.trim())throw new Error("AgentChatApp requires identity.userId")}else if(typeof e.identity.tokenProvider!="function")throw new Error("AgentChatApp requires identity.tokenProvider");if(!e.fetch&&typeof globalThis.fetch!="function")throw new Error("AgentChatApp requires a fetch implementation")}function Re(e){return e instanceof f?e:new f("INTERNAL_ERROR","Request failed",!0)}function Se(e){return e.mode==="unverified"?`unverified:${e.userId}`:"verified:token"}function rt(e){Ce(e);let t=`${e.gatewayUrl}\0${e.webAppId}\0${Se(e.identity)}`;return(0,u.jsx)(Ie,{...e},t)}function Ie({gatewayUrl:e,webAppId:t,identity:n,onError:r,onChatReady:o,onChatMessage:s,fetch:a,className:d,welcome:p,quickPrompts:c}){let[b,w]=(0,A.useState)({status:"loading"}),h=(0,A.useRef)(n);h.current=n;let W=(0,A.useRef)(r);W.current=r;let k=(0,A.useRef)();return k.current||(k.current=new D({gatewayUrl:e,webAppId:t,identityProvider:{getIdentity:async()=>{let g=h.current;if(g.mode!=="verified")return{externalUserId:g.userId};try{return{bearerToken:await g.tokenProvider()}}catch{throw new f("USER_ID_REQUIRED","Identity token provider failed",!0)}}},...a?{fetch:a}:{}})),(0,A.useEffect)(()=>re({gatewayUrl:e,webAppId:t,identity:n}),[e,t,n]),(0,A.useEffect)(()=>{let g=!1,se=k.current;return(async()=>{try{let U=await se.bootstrap({});if(g)return;w({status:"ready",bootstrap:U})}catch(U){if(g)return;let x=Re(U);w({status:"error",error:x}),W.current?.(x)}})(),()=>{g=!0}},[]),b.status==="loading"?(0,u.jsx)("div",{className:d}):b.status==="error"?(0,u.jsxs)("div",{className:d,role:"alert",children:[(0,u.jsx)("strong",{children:"Unable to load the assistant"}),(0,u.jsx)("div",{children:b.error.code}),(0,u.jsx)("button",{type:"button",onClick:()=>w({status:"loading"}),children:"Retry"})]}):(0,u.jsx)(ke,{className:d,gatewayUrl:e,webAppId:t,identity:n,bootstrap:b.bootstrap,onChatReady:o,onChatMessage:s,welcome:p,quickPrompts:c})}function We(e){return{id:e.id,name:e.name,...e.description!==void 0?{description:e.description}:{},graphDefinition:void 0,createdAt:new Date(0),updatedAt:new Date(0)}}function ke({gatewayUrl:e,webAppId:t,identity:n,bootstrap:r,onChatReady:o,onChatMessage:s,className:a,welcome:d,quickPrompts:p}){let c=(0,A.useMemo)(()=>We(r.webApp.assistant),[r.webApp.assistant]),b=(0,A.useMemo)(()=>Ee({welcome:d,quickPrompts:p},r.webApp.appearance),[d,p,r.webApp.appearance]),w=(0,A.useMemo)(()=>n.mode==="unverified"?{mode:"unverified",userId:n.userId}:{mode:"verified",tokenProvider:n.tokenProvider},[n]),h=(0,A.useCallback)(g=>new v({gatewayUrl:e,webAppId:t,identity:w,assistantId:g.assistantId,transport:g.transport,...g.timeout!==void 0?{timeout:g.timeout}:{},...g.headers!==void 0?{headers:g.headers}:{}}),[e,t,w]),W=(0,A.useMemo)(()=>({baseURL:`${e.replace(/\/$/,"")}/api/web-apps/${t}/runtime`,apiKey:"",transport:"sse",assistantId:c.id,enableSkillSlot:!1,enableDatabaseSlot:!1,enableAgentSlot:!1,enableMetricsDataSourceSlot:!1,enableModelSelector:!1,enableWorkspace:!1,enableCustomMenu:!1,showSideMenu:!1,enableAssistantCreation:!1,enableAssistantEditing:!1,enableThreadCreation:!0,enableThreadList:!0}),[c.id,e,t]),k=(0,A.useMemo)(()=>({assistants:[c],currentAssistant:c,isLoading:!1,error:null,listAssistants:async()=>{},getAssistant:async()=>c,createAssistant:async()=>{throw new Error("Not implemented in a Web App")},updateAssistant:async()=>{throw new Error("Not implemented in a Web App")},deleteAssistant:async()=>{},selectAssistant:async()=>{},clearCurrentAssistant:()=>{},refresh:async()=>{}}),[c]);return(0,u.jsx)(B,{config:{baseURL:W.baseURL,apiKey:"",assistantId:"__BASE__",transport:"sse"},createClient:h,children:(0,u.jsx)(X,{initialConfig:W,persistToLocalStorage:!1,children:(0,u.jsx)($.Provider,{value:k,children:(0,u.jsx)(G,{children:(0,u.jsx)(Te,{className:a,onChatReady:o,onChatMessage:s,welcome:b.welcome,quickPrompts:b.quickPrompts})})})})})}function Te({className:e,onChatReady:t,onChatMessage:n,welcome:r,quickPrompts:o=[]}){let{threadId:s}=L(),{currentAssistant:a}=F();if(!a)return null;let d=s??"";return d?(0,u.jsx)("div",{className:e,children:(0,u.jsx)(J,{thread_id:d,assistant_id:a.id,name:a.name,description:a.description,menu:(0,u.jsx)(ne,{}),showProjectSelector:!1,showSkillSlot:!1,showDatabaseSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,headerRight:null,emptyStateGreeting:r?(0,u.jsx)("span",{children:r}):void 0,senderPromptsItems:o.length>0?o.map((p,c)=>({key:`quick-${c}`,label:p.label,description:p.text})):void 0,showSkillPrompts:!1,showQuickAnalysis:!1,onChatReady:t,onChatMessage:n})}):(0,u.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,u.jsx)(O,{tip:"Creating conversation..."})})}export{rt as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Ra as S,Za as x,_a as P,za as I}from"./embed-page-chunk-
|
|
1
|
+
import{Ra as S,Za as x,_a as P,za as I}from"./embed-page-chunk-7GAD6Q52.js";import{m as v}from"./embed-page-chunk-QU52HUXW.js";import{a as s}from"./embed-page-chunk-MB65DZAX.js";import{La as y,U as f,W as h,mb as b}from"./embed-page-chunk-O4QK5LWZ.js";import{a as $}from"./embed-page-chunk-4BKXE5ON.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var m=a($());var t=a(s()),{Text:l}=y,z=({workflowContext:e,onClose:d,onToolCompleted:p,initialMessageRequest:i,onInitialMessageSubmitted:g,attemptedInitialMessageRequestIdsRef:c,rawInitialMessage:r,showHeader:C=!0})=>{let T=v("agent-architect"),u=e?.id?`${T.tenantId}:${e.id}`:null,A=(0,m.useMemo)(()=>{if(e?.id&&e?.name)return e.type==="agent"?`[Context: You're viewing agent "${e.name}" (assistant: ${e.id})]`:`[Context: You're viewing workflow "${e.name}" (agent: ${e.id})]`},[e]),j=(0,m.useMemo)(()=>{if(!i||!e?.id)return null;if(r)return i;let o;return e.type==="workflow"?o=[`Purpose: ${i.content.trim()}`,"",`Workflow "${e.id}" has been created with an empty YAML DSL. Based on the purpose above, load the 'create-workflow' skill, design the workflow using the YAML needs+if DSL, and update it via update_workflow. Make sure to include a descriptive name.`].join(`
|
|
2
2
|
`):o=[`Purpose: ${i.content.trim()}`,"",`Configure the topology for workflow "${e.id}" based on this purpose. Create sub-agents, set up the processing pipeline, and wire them together with topology edges.`,"The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one."].join(`
|
|
3
3
|
`),{...i,content:o}},[i?.requestId,i?.content,e?.id,e?.type,r]);return(0,t.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0",background:"rgba(255, 255, 255, 0.92)"},children:[C&&(0,t.jsxs)("div",{style:{padding:"12px 12px",borderBottom:"1px solid #f0f0f0",display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l,{strong:!0,children:"Agent Builder"}),e&&(0,t.jsx)("div",{children:(0,t.jsxs)(l,{type:"secondary",style:{fontSize:12},children:["Viewing: ",e.name]})})]}),d&&(0,t.jsx)(h,{type:"text",size:"small","aria-label":"Close copilot",icon:(0,t.jsx)(b,{}),onClick:d})]}),u?(0,t.jsxs)(I,{threadId:u,assistantId:"agent-architect",options:{streaming:!0},onToolCompleted:p,children:[(0,t.jsx)(x,{request:j,onSubmitted:g,attemptedRequestIdsRef:c}),(0,t.jsx)(P,{showHeader:!1,showEmptyState:!1,showDatabaseSlot:!1,showSkillSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,systemContext:A})]}):(0,t.jsxs)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",textAlign:"center",gap:4,padding:"0 8px"},children:[(0,t.jsx)(l,{strong:!0,children:"Agent Builder"}),(0,t.jsx)(l,{type:"secondary",children:"Select a workflow to start"})]})]})};var n=a(s()),_=({project:e,projects:d,value:p,onChange:i,selectable:g=!0,loading:c})=>e?(0,n.jsxs)("div",{"data-testid":"training-context-card",style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{style:{fontSize:12,color:"rgba(0,0,0,0.45)",flexShrink:0},children:"Learning project"}),g?(0,n.jsx)(S,{kind:"training",value:p??e.id,onChange:r=>{r&&i?.(r)},style:{minWidth:0}}):(0,n.jsx)("span",{style:{fontSize:12,fontWeight:500},children:e.name})]}):c?null:(0,n.jsx)(f,{type:"warning",showIcon:!0,message:"No learning project is available",description:"A learning project is required before starting a learning task."});export{_ as a,z as b};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import{ab as L,cb as I,db as v,gb as M,hb as b,o as R,q as B,va as O}from"./embed-page-chunk-7GAD6Q52.js";import{a as P}from"./embed-page-chunk-MB65DZAX.js";import{Fa as C,La as $,Z as N,va as S}from"./embed-page-chunk-O4QK5LWZ.js";import{a as V}from"./embed-page-chunk-4BKXE5ON.js";import{e as w}from"./embed-page-chunk-6Y3UYJ6Z.js";var m=w(V());function X(t,o){if(t.parentId&&t.parentId!==t.id&&o.has(t.parentId))return t.parentId;for(let c of t.dependencies??[])if(c!==t.id&&o.has(c))return c}function D(t,o){let u=o?.hideCompleted??!1?t.filter(e=>!b(e.status)):t,g=new Map(u.map(e=>[e.id,e])),d=new Map;for(let e of u)d.set(e.id,X(e,g));let r=new Set;for(let e of d.keys()){if(r.has(e))continue;let l=new Map,p=e,h=0;for(;p!==void 0&&!r.has(p)&&!l.has(p);)l.set(p,h),h+=1,p=d.get(p);if(p!==void 0&&l.has(p)){let y=l.get(p);for(let[i,f]of l)f>=y&&r.add(i)}}for(let e of r)d.set(e,void 0);let x=new Map;for(let e of u)x.set(e.id,[]);for(let e of u){let l=d.get(e.id);l!==void 0&&x.get(l).push(e.id)}let s=e=>({task:g.get(e),children:(x.get(e)??[]).map(s)});return u.filter(e=>d.get(e.id)===void 0).map(e=>s(e.id))}var n=w(P()),{Text:z}=$,Y=16,q=3,J=O(({css:t,token:o})=>({root:t`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: 100%;
|
|
5
|
+
`,toolbar:t`
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: flex-end;
|
|
9
|
+
gap: 8px;
|
|
10
|
+
padding: 0 0 12px;
|
|
11
|
+
flex-shrink: 0;
|
|
12
|
+
`,list:t`
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
list-style: none;
|
|
16
|
+
flex: 1;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
overflow-x: hidden;
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 2px;
|
|
24
|
+
`,listItem:t`
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
min-width: 0;
|
|
28
|
+
list-style: none;
|
|
29
|
+
`,childList:t`
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
list-style: none;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 2px;
|
|
37
|
+
`,spinner:t`
|
|
38
|
+
flex: 1;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
`,empty:t`
|
|
43
|
+
flex: 1;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
`,row:t`
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
min-width: 0;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
padding: 4px 10px;
|
|
55
|
+
border-radius: 8px;
|
|
56
|
+
transition: background 0.15s ease;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
background: ${o.colorFillTertiary};
|
|
60
|
+
}
|
|
61
|
+
`,toggle:t`
|
|
62
|
+
appearance: none;
|
|
63
|
+
padding: 0;
|
|
64
|
+
border: 0;
|
|
65
|
+
background: transparent;
|
|
66
|
+
font: inherit;
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
width: 32px;
|
|
71
|
+
height: 32px;
|
|
72
|
+
flex-shrink: 0;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
color: ${o.colorTextTertiary};
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
color: ${o.colorText};
|
|
79
|
+
background: ${o.colorFillSecondary};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:active {
|
|
83
|
+
background: ${o.colorFill};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
outline: 2px solid ${o.colorPrimary};
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
90
|
+
`,togglePlaceholder:t`
|
|
91
|
+
width: 32px;
|
|
92
|
+
height: 32px;
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
`,open:t`
|
|
95
|
+
appearance: none;
|
|
96
|
+
padding: 0;
|
|
97
|
+
border: 0;
|
|
98
|
+
background: transparent;
|
|
99
|
+
font: inherit;
|
|
100
|
+
color: inherit;
|
|
101
|
+
text-align: left;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
flex: 1;
|
|
106
|
+
min-width: 0;
|
|
107
|
+
min-height: 32px;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
border-radius: 4px;
|
|
111
|
+
|
|
112
|
+
&:hover {
|
|
113
|
+
color: ${o.colorText};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:active {
|
|
117
|
+
opacity: 0.75;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:focus-visible {
|
|
121
|
+
outline: 2px solid ${o.colorPrimary};
|
|
122
|
+
outline-offset: 2px;
|
|
123
|
+
}
|
|
124
|
+
`,statusDot:t`
|
|
125
|
+
width: 8px;
|
|
126
|
+
height: 8px;
|
|
127
|
+
border-radius: 50%;
|
|
128
|
+
flex-shrink: 0;
|
|
129
|
+
`,title:t`
|
|
130
|
+
flex: 1;
|
|
131
|
+
min-width: 8ch;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
text-overflow: ellipsis;
|
|
134
|
+
white-space: nowrap;
|
|
135
|
+
font-size: 14px;
|
|
136
|
+
`,priorityBadge:t`
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
padding: 1px 6px;
|
|
140
|
+
border-radius: 4px;
|
|
141
|
+
font-size: 11px;
|
|
142
|
+
font-weight: 500;
|
|
143
|
+
flex-shrink: 0;
|
|
144
|
+
`,depBadge:t`
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 3px;
|
|
148
|
+
padding: 1px 6px;
|
|
149
|
+
border-radius: 4px;
|
|
150
|
+
font-size: 11px;
|
|
151
|
+
font-weight: 500;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
`}));function K(t,o){let c=(t.dependencies??[]).filter(g=>o.has(g));if(c.length===0)return null;let u=c.filter(g=>{let d=o.get(g);return d?!b(d.status):!1});return u.length>0?{type:"warning",count:u.length}:{type:"ok",count:c.length}}function E({node:t,depth:o,groupIdPrefix:c,collapsedIds:u,onToggle:g,onTaskClick:d,onRun:r,allById:x,styles:s}){let{task:e,children:l}=t,p=l.length>0,h=u.has(e.id),y=I[e.status]??I.pending,i=v[e.priority]??v.medium,f=M(e),a=K(e,x),k=`${c}-${encodeURIComponent(e.id)}`,A=e.status.replace(/_/g," "),H=a?`${a.count} ${a.type==="warning"?"incomplete":"completed"} ${a.count===1?"dependency":"dependencies"}`:"no dependencies",_=`Open task ${e.title}, status ${A}, priority ${i.label}, ${H}`,F=Math.min(o,q),j=o<2,U=a&&(a.type==="warning"||o<3);return(0,n.jsxs)("li",{className:s.listItem,children:[(0,n.jsxs)("div",{"data-testid":"outline-row",className:s.row,style:{paddingLeft:10+F*Y},children:[p?(0,n.jsx)("button",{type:"button","data-testid":"outline-toggle","aria-label":`${h?"Expand":"Collapse"} subtasks for ${e.title}`,"aria-expanded":!h,"aria-controls":k,className:s.toggle,onClick:()=>g(e.id),children:h?(0,n.jsx)(B,{size:14}):(0,n.jsx)(R,{size:14})}):(0,n.jsx)("span",{className:s.togglePlaceholder}),(0,n.jsxs)("button",{type:"button","data-testid":"outline-open","aria-label":_,className:s.open,onClick:()=>d(e),children:[(0,n.jsx)("span",{"data-testid":"outline-status-dot","aria-hidden":"true",className:s.statusDot,style:{background:y}}),(0,n.jsx)(z,{className:s.title,ellipsis:{tooltip:e.title},children:e.title}),(0,n.jsx)("span",{"data-testid":"outline-origin-dot",className:s.statusDot,style:{background:f.color},title:f.label}),j&&(0,n.jsx)("span",{className:s.priorityBadge,style:{background:`${i.color}18`,color:i.color},children:i.label}),U&&(0,n.jsxs)("span",{className:s.depBadge,style:a.type==="warning"?{background:"#f59e0b18",color:"#f59e0b"}:{background:"#22c55e18",color:"#22c55e"},children:[a.type==="warning"?"\u26A0 \u7B49\u5F85 ":"\u2713 ",a.count]})]}),r&&(0,n.jsx)(L,{task:e,onRun:(T,G)=>r(e,T,G)})]}),p&&(0,n.jsx)("ul",{id:k,className:s.childList,hidden:h,children:!h&&l.map(T=>(0,n.jsx)(E,{node:T,depth:o+1,groupIdPrefix:c,collapsedIds:u,onToggle:g,onTaskClick:d,onRun:r,allById:x,styles:s},T.task.id))})]})}var re=({tasks:t,loading:o,onTaskClick:c,onRun:u,hideCompleted:g=!1,onHideCompletedChange:d})=>{let{styles:r}=J(),x=`outline-subtasks-${(0,m.useId)()}`,s=(0,m.useMemo)(()=>D(t,{hideCompleted:g}),[t,g]),e=(0,m.useMemo)(()=>new Map(t.map(i=>[i.id,i])),[t]),l=(0,m.useMemo)(()=>{let i=new Map,f=a=>{i.set(a.task.id,a.task),a.children.forEach(f)};return s.forEach(f),i},[s]),[p,h]=(0,m.useState)(new Set);(0,m.useEffect)(()=>{h(i=>{let f=!1,a=new Set;for(let k of i)l.has(k)?a.add(k):f=!0;return f?a:i})},[l]);let y=(0,m.useCallback)(i=>{h(f=>{let a=new Set(f);return a.has(i)?a.delete(i):a.add(i),a})},[]);return o?(0,n.jsx)("div",{className:r.spinner,children:(0,n.jsx)(S,{size:"large"})}):(0,n.jsxs)("div",{className:r.root,children:[(0,n.jsxs)("div",{className:r.toolbar,children:[(0,n.jsx)(C,{size:"small",checked:g,onChange:i=>d?.(i),"aria-label":"Hide completed"}),(0,n.jsx)(z,{type:"secondary",style:{fontSize:13},children:"Hide completed"})]}),s.length===0?(0,n.jsx)("div",{className:r.empty,children:(0,n.jsx)(N,{description:"No tasks"})}):(0,n.jsx)("ul",{className:r.list,children:s.map(i=>(0,n.jsx)(E,{node:i,depth:0,groupIdPrefix:x,collapsedIds:p,onToggle:y,onTaskClick:c,onRun:u,allById:e,styles:r},i.task.id))})]})};export{re as a};
|