feat(webui): make Events one page with three tabs
Inspector, Bindings and Mappings were three sibling destinations in a dropdown, for what is one chain read in order: an event, the mapping that names its fields, the binding that decides what runs. They are now three tabs on /events, and the bar carries Events as a link rather than a menu with one child sharing its name. The navigation entry is always live and the tabs prune themselves: each is a separate capability, so a composition that can back only some of them still reaches the ones it can, and an unreported section stays visible. Which tabs exist, and which one is showing, lives in tab-selection.ts and is unit-tested without a browser; the page owns the components and the address bar. The old paths survive as bookmarks that redirect to their tab, so a link or a learned URL still lands somewhere that works. Three pages become tab panels: they lose their page-level headers -- the page names the page -- and keep their own actions in a right-aligned row. CapturesHeader.vue is absorbed into the Inspector panel, which is where its stream status belongs.
This commit is contained in:
14 files changed
+262
-57
No files matched your search
@@ -32,9 +32,7 @@ var dashboardPages = []DashboardPage{
|
||||
{Path: "/workflows", Label: "Workflows", Description: "The routed workflows and their run history."},
|
||||
{Path: "/skills", Label: "Skills", Description: "The SKILL.md capabilities Archie can activate."},
|
||||
{Path: "/curators", Label: "Curators", Description: "Scheduled passes that curate Archie's memory and captures."},
|
||||
{Path: "/captures", Label: "Event inspector", Description: "Captured inbound events for inspection."},
|
||||
{Path: "/mappings", Label: "Field mappings", Description: "How inbound event fields map onto internal ones."},
|
||||
{Path: "/bindings", Label: "Playbook bindings", Description: "Which workflow a captured event starts."},
|
||||
{Path: "/events", Label: "Events", Description: "Captured inbound events, how their fields map, and which workflow they start."},
|
||||
{Path: "/logs", Label: "Logs", Description: "The daemon log stream, filterable by level and component."},
|
||||
{Path: "/channels", Label: "Channels", Description: "Inbound chat and notification channels, and their state."},
|
||||
{Path: "/system/status", Label: "Status", Description: "Update state, configuration sources, and the listen address."},
|
||||
|
||||
Vendored
+2
-2
@@ -15,5 +15,5 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
||||
Defaulting to \`null\`.`),null)}function Tx(e){return Cx(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${bx}\`.`),bx)}var Ex=N({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:bx},getValueLabel:{type:Function,required:!1,default:(e,t)=>Cx(e)?`${Math.round(e/t*bx)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;X();let i=yh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=yh(n,`max`,r,{passive:n.max===void 0});M(()=>i.value,async e=>{let t=wx(e,n.max);t!==e&&(await ar(),i.value=t)},{immediate:!0}),M(()=>n.max,e=>{let t=Tx(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=G(()=>Um(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return Sx({modelValue:i,max:a,progressState:o}),(e,t)=>(L(),z(A(Z),{"as-child":e.asChild,as:e.as,"aria-valuemax":A(a),"aria-valuemin":0,"aria-valuenow":Cx(A(i))?A(i):void 0,"aria-valuetext":e.getValueText?.(A(i),A(a)),"aria-label":e.getValueLabel(A(i),A(a)),role:`progressbar`,"data-state":o.value,"data-value":A(i)??void 0,"data-max":A(a)},{default:j(()=>[F(e.$slots,`default`,{modelValue:A(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),Dx=N({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=xx();return X(),(e,r)=>(L(),z(A(Z),W(t,{"data-state":A(n).progressState.value,"data-value":A(n).modelValue?.value??void 0,"data-max":A(n).max.value}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),Ox=[` `,`Enter`,`ArrowUp`,`ArrowDown`],kx=[` `,`Enter`];function Ax(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(e=>jx(e,t,n)):jx(e,t,n)}function jx(e,t,n){return e===void 0||t===void 0?!1:typeof e==`string`?e===t:typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]===t?.[n]:Rm(e,t)}function Mx(e){return e==null||e===``||Array.isArray(e)&&e.length===0}var Nx=[`value`],[Px,Fx]=Bm(`SelectRoot`),Ix=N({inheritAttrs:!1,__name:`SelectRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},nullableValue:{type:String,required:!1,default:``},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=e,r=t,{required:i,disabled:a,multiple:o,dir:s}=En(n),c=yh(n,`modelValue`,r,{defaultValue:n.defaultValue??(o.value?[]:void 0),passive:n.modelValue===void 0,deep:!0}),l=yh(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0}),u=k(),d=k(),f=k({x:0,y:0}),p=G(()=>o.value&&Array.isArray(c.value)?c.value?.length===0:Um(c.value));D_({isProvider:!0});let m=Fh(s),h=Bh(u),g=k(new Set),_=G(()=>Array.from(g.value).map(e=>e.value).join(`;`));function v(e){if(o.value){let t=Array.isArray(c.value)?[...c.value]:[],r=t.findIndex(t=>jx(t,e,n.by));r===-1?t.push(e):t.splice(r,1),c.value=[...t]}else c.value=e}function y(e){return Array.from(g.value).find(t=>Ax(e,t.value,n.by))}return Fx({triggerElement:u,onTriggerChange:e=>{u.value=e},valueElement:d,onValueElementChange:e=>{d.value=e},contentId:``,modelValue:c,onValueChange:v,by:n.by,open:l,multiple:o,required:i,onOpenChange:e=>{l.value=e},dir:m,triggerPointerDownPosRef:f,disabled:a,isEmptyModelValue:p,optionsSet:g,onOptionAdd:e=>{let t=y(e.value);t&&g.value.delete(t),g.value.add(e)},onOptionRemove:e=>{let t=y(e.value);t&&g.value.delete(t)}}),(e,t)=>(L(),z(A(B_),null,{default:j(()=>[F(e.$slots,`default`,{modelValue:A(c),open:A(l)}),A(h)&&e.name?(L(),z(Lx,{key:_.value,"aria-hidden":`true`,tabindex:`-1`,multiple:A(o),required:A(i),name:e.name,autocomplete:e.autocomplete,disabled:A(a),value:A(c)},{default:j(()=>[A(Um)(A(c))?(L(),R(`option`,{key:0,value:e.nullableValue},null,8,Nx)):U(`v-if`,!0),(L(!0),R(I,null,P(Array.from(g.value),e=>(L(),R(`option`,W({key:e.value??``},{ref_for:!0},e),null,16))),128))]),_:1},8,[`multiple`,`required`,`name`,`autocomplete`,`disabled`,`value`])):U(`v-if`,!0)]),_:3}))}}),Lx=N({__name:`BubbleSelect`,props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(e){let t=e,n=k(),r=Px();M(()=>t.value,(e,t)=>{let r=window.HTMLSelectElement.prototype,i=Object.getOwnPropertyDescrLine truncated
|
||||
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:nT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>nT(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
|
||||
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=iT(c),u=e+1<n.length?iT(n[e+1]):null;if(l&&u&&aT(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=iT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>nT(e)),rows:r.map(e=>e.map(e=>nT(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:nT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:nT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
|
||||
`)}),t}function iT(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function aT(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var oT={class:`[overflow-wrap:anywhere]`},sT={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},cT={class:`font-mono text-[0.85em]`},lT={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},uT={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},dT={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},fT={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},pT={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},mT={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},hT={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},gT={key:8,class:`mb-2.5 last:mb-0`},_T=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=G(()=>rT(t.text));return(e,t)=>(L(),R(`div`,oT,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(I,{key:t},[e.kind===`pre`?(L(),R(`pre`,sT,[B(`code`,cT,O(e.code),1)])):e.kind===`table`?(L(),R(`table`,lT,[B(`thead`,null,[B(`tr`,null,[(L(!0),R(I,null,P(e.head,(e,t)=>(L(),R(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[V(eT,{inline:e},null,8,[`inline`])]))),128))])]),B(`tbody`,null,[(L(!0),R(I,null,P(e.rows,(e,t)=>(L(),R(`tr`,{key:t},[(L(!0),R(I,null,P(e,(e,t)=>(L(),R(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[V(eT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),R(`blockquote`,uT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),R(`h1`,dT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),R(`h2`,fT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),R(`h3`,pT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),R(`ul`,mT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(eT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),R(`ol`,hT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(eT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),R(`p`,gT,[V(eT,{inline:e.inline},null,8,[`inline`])])):U(``,!0)],64))),128))]))}}),vT={class:`truncate`},yT=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ma(`RouterLink`);return L(),z(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[V(A(yd),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),B(`span`,vT,O(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),bT={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},xT={class:`font-semibold text-foreground`},ST={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},CT=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=G(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=G(()=>t.tool.parameters||t.tool.Parameters||``),i=G(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=G(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(L(),z(yT,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(L(),R(`div`,bT,[V(A(Kd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),B(`span`,xT,O(n.value),1),r.value?(L(),R(`code`,ST,O(r.value),1)):U(``,!0),B(`span`,{class:D(A(J)(`text-fg-muted`,i.value&&`text-danger`))},O(a.value),3)]))}}),wT={key:0,class:`mb-2 grid gap-0.5 text-xs`},TT={key:2,class:`whitespace-pre-wrap`},ET=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),R(`div`,{class:D([`flex`,e.assistant?`justify-start`:`justify-end`])},[B(`div`,{class:D(A(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(L(),R(`div`,wT,[(L(!0),R(I,null,P(e.tools,(t,n)=>(L(),z(CT,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):U(``,!0),e.assistant?(L(),z(_T,{key:1,text:e.text},null,8,[`text`])):(L(),R(`div`,TT,O(e.text),1)),F(t.$slots,`default`)],2)],2))}}),DT={class:`w-full self-center justify-self-center py-6 text-center`},OT={class:`grid gap-2`},kT=[`onClick`],AT=N({__name:`ChatEmptyState`,emits:[`prompt`],setup(e,{emit:t}){let n=t,r=[`Summarise active tasks`,`Show running agents`,`Check system status`];return(e,t)=>(L(),R(`div`,DT,[t[0]||=B(`span`,{"aria-hidden":`true`,class:`mx-auto mb-3 grid size-9 placLine truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Ej?`${n.slice(0,Ej).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var Oj=[`title`],kj=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>ZA(n.event)),a=G(()=>Dj(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=G(()=>n.event.at?ak(n.event.at):`—`);return(e,t)=>(L(),z(A(IO),{class:D(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[du(lu(o,[`prevent`]),[`enter`]),du(lu(o,[`prevent`]),[`space`])]},{default:j(()=>[V(A($),{class:`font-medium`},{default:j(()=>[H(O(n.event.kind||n.event.type||`event`),1)]),_:1}),V(A($),{class:`font-mono`},{default:j(()=>[H(O(i.value>0?`#${i.value}`:`—`),1)]),_:1}),V(A($),{class:`w-[55%] max-w-0`},{default:j(()=>[B(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},O(a.value.text),9,Oj)]),_:1}),V(A($),null,{default:j(()=>[H(O(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Aj={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},jj=N({__name:`LiveActivityCard`,setup(e){let t=$T(),{activity:n,streamKind:r,streamState:i}=ad(JD());function a(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(L(),z(A(_O),null,{default:j(()=>[V(A(SO),null,{default:j(()=>[V(A(CO),null,{default:j(()=>[...t[0]||=[H(`Live activity`,-1)]]),_:1}),V(A(bO),null,{default:j(()=>[...t[1]||=[H(`Last 50, newest first`,-1)]]),_:1}),V(A(vO),null,{default:j(()=>[V(A(zO),{variant:A(r)},{default:j(()=>[H(O(A(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),V(A(yO),null,{default:j(()=>[B(`div`,Aj,[V(A(PO),null,{default:j(()=>[V(A(RO),null,{default:j(()=>[V(A(IO),null,{default:j(()=>[V(A(LO),null,{default:j(()=>[...t[2]||=[H(`Event`,-1)]]),_:1}),V(A(LO),null,{default:j(()=>[...t[3]||=[H(`Task`,-1)]]),_:1}),V(A(LO),null,{default:j(()=>[...t[4]||=[H(`Detail`,-1)]]),_:1}),V(A(LO),null,{default:j(()=>[...t[5]||=[H(`When`,-1)]]),_:1})]),_:1})]),_:1}),V(A(FO),null,{default:j(()=>[A(n).length?(L(!0),R(I,{key:1},P(A(n),(e,t)=>(L(),z(kj,{key:t,event:e,onOpen:a},null,8,[`event`]))),128)):(L(),z(A(IO),{key:0},{default:j(()=>[V(A($),{colspan:`4`},{default:j(()=>[V(A(wO),null,{default:j(()=>[V(A(DO),null,{default:j(()=>[V(A(AO),null,{default:j(()=>[...t[6]||=[H(`Waiting for activity`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1})]),_:1})])]),_:1})]),_:1}))}}),Mj=N({__name:`Progress`,props:{modelValue:{default:0},max:{},getValueLabel:{},getValueText:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=QS(t,`class`);return(e,r)=>(L(),z(A(Ex),W({"data-slot":`progress`},A(n),{class:A(J)(`bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class)}),{default:j(()=>[V(A(Dx),{"data-slot":`progress-indicator`,class:`bg-primary size-full flex-1 transition-all`,style:ve(`transform: translateX(-${100-(t.modelValue??0)}%);`)},null,8,[`style`])]),_:1},16,[`class`]))}}),Nj=`archie.setup-complete.dismissed.v1`;function Pj(e,t=globalThis.localStorage){if(!e?.steps?.length)return{kind:`omit`,remaining:[]};let n=e.steps.filter(e=>!e.done);return n.length?(t?.removeItem?.(Nj),{kind:`incomplete`,remaining:n}):t?.getItem?.(`archie.setup-complete.dismissed.v1`)===`1`?{kind:`dismissed`,remaining:[]}:{kind:`complete`,remaining:[]}}function Fj(e=globalThis.localStorage){e?.setItem?.(Nj,`1`)}var Ij={class:`text-lg font-semibold text-link`},Lj={class:`flex flex-col gap-3`},Rj={key:0,class:`mt-0.5 text-xs text-fg-subtle`},zj=N({__name:`SetupPanel`,setup(e){let t=k(Pj(WA.value));M(WA,()=>{t.value=Pj(WA.value)});let n=G(()=>WA.value?.steps??[]),r=G(()=>{let e=n.value.length;return e?Math.round((e-t.value.remaining.length)/e*100):0});function i(){Fj(),t.value=Pj(WA.value)}return(e,a)=>t.value.kind===`incomplete`?(L(),z(A(_O),{key:0},{default:j(()=>[V(A(SO),null,{default:j(()=>[V(A(CO),null,{default:j(()=>[...a[0]||=[H(`Finish setting up`,-1)]]),_:1}),V(A(bO),null,{default:j(()=>[...a[1]||=[H(`Archie needs these before it can work on its own.`,-1)]]),_:1}),V(A(vO),null,{default:j(()=>[B(`span`,Ij,O(r.value)+`%`,1)]),_:1})]),_:1}),V(A(yO),null,{default:j(()=>[V(A(Mj),{"model-value":r.value,class:`mb-4`},null,8,[`model-value`]),B(`ul`,Lj,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(`li`,{key:t,class:`flex items-start gap-3`},[B(`span`,{class:D([`mt-px grid size-[18px] flex-none place-items-center rounded-full border-[1.5px] border-border-strong text-xs text-fg-subtle`,e.done?`border-transparent bg-ok-soft text-ok`:``])},[e.done?(L(),z(A(bd),{key:0,class:`size-3`})):U(``,!0)],2),B(`div`,null,[B(`div`,{class:D([`text-sm`,e.done?`text-fg-muted line-through`:``])},O(e.title),3),e.detail?(L(),R(`div`,Rj,O(e.detail),1)):U(``,!0)])]))),128))])]),_:1})]),_:1})):t.value.kind===`complete`?(L(),z(A(_O),{key:1},{default:j(()=>[V(A(SO),null,{default:j(()=>[V(A(CO),null,{default:j(()=>[...a[2]||=[H(`Setup complete`Line truncated
|
||||
`)}),t}function iT(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function aT(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var oT={class:`[overflow-wrap:anywhere]`},sT={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},cT={class:`font-mono text-[0.85em]`},lT={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},uT={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},dT={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},fT={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},pT={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},mT={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},hT={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},gT={key:8,class:`mb-2.5 last:mb-0`},_T=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=G(()=>rT(t.text));return(e,t)=>(L(),R(`div`,oT,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(I,{key:t},[e.kind===`pre`?(L(),R(`pre`,sT,[B(`code`,cT,O(e.code),1)])):e.kind===`table`?(L(),R(`table`,lT,[B(`thead`,null,[B(`tr`,null,[(L(!0),R(I,null,P(e.head,(e,t)=>(L(),R(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[V(eT,{inline:e},null,8,[`inline`])]))),128))])]),B(`tbody`,null,[(L(!0),R(I,null,P(e.rows,(e,t)=>(L(),R(`tr`,{key:t},[(L(!0),R(I,null,P(e,(e,t)=>(L(),R(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[V(eT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),R(`blockquote`,uT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),R(`h1`,dT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),R(`h2`,fT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),R(`h3`,pT,[V(eT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),R(`ul`,mT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(eT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),R(`ol`,hT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(eT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),R(`p`,gT,[V(eT,{inline:e.inline},null,8,[`inline`])])):U(``,!0)],64))),128))]))}}),vT={class:`truncate`},yT=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ma(`RouterLink`);return L(),z(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[V(A(yd),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),B(`span`,vT,O(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),bT={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},xT={class:`font-semibold text-foreground`},ST={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},CT=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=G(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=G(()=>t.tool.parameters||t.tool.Parameters||``),i=G(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=G(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(L(),z(yT,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(L(),R(`div`,bT,[V(A(Kd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),B(`span`,xT,O(n.value),1),r.value?(L(),R(`code`,ST,O(r.value),1)):U(``,!0),B(`span`,{class:D(A(J)(`text-fg-muted`,i.value&&`text-danger`))},O(a.value),3)]))}}),wT={key:0,class:`mb-2 grid gap-0.5 text-xs`},TT={key:2,class:`whitespace-pre-wrap`},ET=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),R(`div`,{class:D([`flex`,e.assistant?`justify-start`:`justify-end`])},[B(`div`,{class:D(A(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(L(),R(`div`,wT,[(L(!0),R(I,null,P(e.tools,(t,n)=>(L(),z(CT,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):U(``,!0),e.assistant?(L(),z(_T,{key:1,text:e.text},null,8,[`text`])):(L(),R(`div`,TT,O(e.text),1)),F(t.$slots,`default`)],2)],2))}}),DT={class:`w-full self-center justify-self-center py-6 text-center`},OT={class:`grid gap-2`},kT=[`onClick`],AT=N({__name:`ChatEmptyState`,emits:[`prompt`],setup(e,{emit:t}){let n=t,r=[`Summarise active tasks`,`Show running agents`,`Check system status`];return(e,t)=>(L(),R(`div`,DT,[t[0]||=B(`span`,{"aria-hidden":`true`,class:`mx-auto mb-3 grid size-9 placLine truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>cA?`${n.slice(0,cA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var uA=[`title`],dA=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>Dk(n.event)),a=G(()=>lA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=G(()=>n.event.at?vO(n.event.at):`—`);return(e,t)=>(L(),z(A(aA),{class:D(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[du(lu(o,[`prevent`]),[`enter`]),du(lu(o,[`prevent`]),[`space`])]},{default:j(()=>[V(A($),{class:`font-medium`},{default:j(()=>[H(O(n.event.kind||n.event.type||`event`),1)]),_:1}),V(A($),{class:`font-mono`},{default:j(()=>[H(O(i.value>0?`#${i.value}`:`—`),1)]),_:1}),V(A($),{class:`w-[55%] max-w-0`},{default:j(()=>[B(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},O(a.value.text),9,uA)]),_:1}),V(A($),null,{default:j(()=>[H(O(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),fA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},pA=N({__name:`LiveActivityCard`,setup(e){let t=$T(),{activity:n,streamKind:r,streamState:i}=ad(ek());function a(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(L(),z(A(uO),null,{default:j(()=>[V(A(hO),null,{default:j(()=>[V(A(gO),null,{default:j(()=>[...t[0]||=[H(`Live activity`,-1)]]),_:1}),V(A(pO),null,{default:j(()=>[...t[1]||=[H(`Last 50, newest first`,-1)]]),_:1}),V(A(dO),null,{default:j(()=>[V(A(XD),{variant:A(r)},{default:j(()=>[H(O(A(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),V(A(fO),null,{default:j(()=>[B(`div`,fA,[V(A(rA),null,{default:j(()=>[V(A(sA),null,{default:j(()=>[V(A(aA),null,{default:j(()=>[V(A(oA),null,{default:j(()=>[...t[2]||=[H(`Event`,-1)]]),_:1}),V(A(oA),null,{default:j(()=>[...t[3]||=[H(`Task`,-1)]]),_:1}),V(A(oA),null,{default:j(()=>[...t[4]||=[H(`Detail`,-1)]]),_:1}),V(A(oA),null,{default:j(()=>[...t[5]||=[H(`When`,-1)]]),_:1})]),_:1})]),_:1}),V(A(iA),null,{default:j(()=>[A(n).length?(L(!0),R(I,{key:1},P(A(n),(e,t)=>(L(),z(dA,{key:t,event:e,onOpen:a},null,8,[`event`]))),128)):(L(),z(A(aA),{key:0},{default:j(()=>[V(A($),{colspan:`4`},{default:j(()=>[V(A(HD),null,{default:j(()=>[V(A(GD),null,{default:j(()=>[V(A(JD),null,{default:j(()=>[...t[6]||=[H(`Waiting for activity`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1})]),_:1})])]),_:1})]),_:1}))}}),mA=N({__name:`Progress`,props:{modelValue:{default:0},max:{},getValueLabel:{},getValueText:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=QS(t,`class`);return(e,r)=>(L(),z(A(Ex),W({"data-slot":`progress`},A(n),{class:A(J)(`bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class)}),{default:j(()=>[V(A(Dx),{"data-slot":`progress-indicator`,class:`bg-primary size-full flex-1 transition-all`,style:ve(`transform: translateX(-${100-(t.modelValue??0)}%);`)},null,8,[`style`])]),_:1},16,[`class`]))}}),hA=`archie.setup-complete.dismissed.v1`;function gA(e,t=globalThis.localStorage){if(!e?.steps?.length)return{kind:`omit`,remaining:[]};let n=e.steps.filter(e=>!e.done);return n.length?(t?.removeItem?.(hA),{kind:`incomplete`,remaining:n}):t?.getItem?.(`archie.setup-complete.dismissed.v1`)===`1`?{kind:`dismissed`,remaining:[]}:{kind:`complete`,remaining:[]}}function _A(e=globalThis.localStorage){e?.setItem?.(hA,`1`)}var vA={class:`text-lg font-semibold text-link`},yA={class:`flex flex-col gap-3`},bA={key:0,class:`mt-0.5 text-xs text-fg-subtle`},xA=N({__name:`SetupPanel`,setup(e){let t=k(gA(bk.value));M(bk,()=>{t.value=gA(bk.value)});let n=G(()=>bk.value?.steps??[]),r=G(()=>{let e=n.value.length;return e?Math.round((e-t.value.remaining.length)/e*100):0});function i(){_A(),t.value=gA(bk.value)}return(e,a)=>t.value.kind===`incomplete`?(L(),z(A(uO),{key:0},{default:j(()=>[V(A(hO),null,{default:j(()=>[V(A(gO),null,{default:j(()=>[...a[0]||=[H(`Finish setting up`,-1)]]),_:1}),V(A(pO),null,{default:j(()=>[...a[1]||=[H(`Archie needs these before it can work on its own.`,-1)]]),_:1}),V(A(dO),null,{default:j(()=>[B(`span`,vA,O(r.value)+`%`,1)]),_:1})]),_:1}),V(A(fO),null,{default:j(()=>[V(A(mA),{"model-value":r.value,class:`mb-4`},null,8,[`model-value`]),B(`ul`,yA,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(`li`,{key:t,class:`flex items-start gap-3`},[B(`span`,{class:D([`mt-px grid size-[18px] flex-none place-items-center rounded-full border-[1.5px] border-border-strong text-xs text-fg-subtle`,e.done?`border-transparent bg-ok-soft text-ok`:``])},[e.done?(L(),z(A(bd),{key:0,class:`size-3`})):U(``,!0)],2),B(`div`,null,[B(`div`,{class:D([`text-sm`,e.done?`text-fg-muted line-through`:``])},O(e.title),3),e.detail?(L(),R(`div`,bA,O(e.detail),1)):U(``,!0)])]))),128))])]),_:1})]),_:1})):t.value.kind===`complete`?(L(),z(A(uO),{key:1},{default:j(()=>[V(A(hO),null,{default:j(()=>[V(A(gO),null,{default:j(()=>[...a[2]||=[H(`Setup complete`Line truncated
|
||||
@@ -2,7 +2,6 @@
|
||||
import { Plus } from "@lucide/vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
@@ -70,12 +69,14 @@ async function handleDelete(binding: Binding): Promise<void> {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Playbook bindings">
|
||||
<!-- The tab owns the actions that belong to it. The page's header names the
|
||||
page, not this panel, so nothing here repeats "Events". -->
|
||||
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<Button v-if="!failure" @click="startCreate">
|
||||
<Plus data-icon="inline-start" />
|
||||
New binding
|
||||
</Button>
|
||||
</PageHeader>
|
||||
</div>
|
||||
|
||||
<!-- A mutation that failed leaves the list on screen accurate, so its
|
||||
failure sits beside the list rather than replacing it. -->
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import CaptureStatus from "./CaptureStatus.vue";
|
||||
|
||||
/** The page title and stream status. */
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-5 flex flex-wrap items-start justify-between gap-5">
|
||||
<h1 class="text-3xl font-semibold tracking-[-0.03em]">Event inspector</h1>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<CaptureStatus />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,8 +4,8 @@ import { onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import CaptureDetail from "./CaptureDetail.vue";
|
||||
import CaptureStatus from "./CaptureStatus.vue";
|
||||
import CapturesCard from "./CapturesCard.vue";
|
||||
import CapturesHeader from "./CapturesHeader.vue";
|
||||
import { load, selectById, selectNewest, selected, useCaptures } from "./state";
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,11 @@ watch(selected, (capture) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CapturesHeader />
|
||||
<!-- The stream's state belongs to this panel, not the page: the page carries
|
||||
tabs whose other two have nothing to do with the capture stream. -->
|
||||
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<CaptureStatus />
|
||||
</div>
|
||||
<div class="grid min-w-0 items-start gap-4 min-[1100px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
||||
<div ref="listColumn" class="min-w-0">
|
||||
<CapturesCard />
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, watch, type Component } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import BindingsPage from "@/bindings/BindingsPage.vue";
|
||||
import CapturesPage from "@/captures/CapturesPage.vue";
|
||||
import { sections } from "@/lib/capabilities";
|
||||
import MappingsPage from "@/mappings/MappingsPage.vue";
|
||||
import { activeTab, availableTabs } from "./tab-selection";
|
||||
|
||||
/**
|
||||
* The Events surfaces: what arrived, how its fields are read, and which workflow
|
||||
* it starts. Three tabs on one page rather than three sibling destinations,
|
||||
* because they are one chain read in order -- an event, the mapping that names
|
||||
* its fields, the binding that decides what runs.
|
||||
*
|
||||
* The open tab is the query string's (`?tab=`), so a tab is a link and survives
|
||||
* a reload, and switching is a `replace`: walking the tabs adds no history to
|
||||
* back out through. A capture's own selection rides alongside it (`?capture=`),
|
||||
* so returning to the Inspector tab lands on the record that was open.
|
||||
*
|
||||
* Which tabs exist, and which one is showing, is decided in tab-selection.ts --
|
||||
* this file owns the components and the address bar, that file owns the rule,
|
||||
* and the rule is unit-tested without a browser.
|
||||
*/
|
||||
const PANELS: Record<string, Component> = {
|
||||
inspector: CapturesPage,
|
||||
bindings: BindingsPage,
|
||||
mappings: MappingsPage,
|
||||
};
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const tabs = computed(() => availableTabs(sections.value));
|
||||
const active = computed(() => activeTab(String(route.query.tab ?? ""), tabs.value));
|
||||
|
||||
function show(id: unknown): void {
|
||||
const next = String(id);
|
||||
if (!next || next === String(route.query.tab ?? "")) return;
|
||||
void router.replace({ query: { ...route.query, tab: next } });
|
||||
}
|
||||
|
||||
// A URL naming a tab this composition cannot back -- a bookmark from a fuller
|
||||
// deployment, or a capability that went away -- is written back to the tab that
|
||||
// is actually showing, so the address bar never describes a panel that is not
|
||||
// there.
|
||||
watch(active, (tab) => show(tab), { immediate: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Events" />
|
||||
<Tabs class="gap-4" :model-value="active" @update:model-value="show">
|
||||
<TabsList variant="line" class="w-full justify-start">
|
||||
<TabsTrigger v-for="tab in tabs" :key="tab.id" :value="tab.id">{{ tab.label }}</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent v-for="tab in tabs" :key="tab.id" :value="tab.id">
|
||||
<component :is="PANELS[tab.id]" />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Which Events tabs a composition offers, and which one is showing.
|
||||
*
|
||||
* Held apart from EventsPage so it can be tested without a browser: the page
|
||||
* owns the components and the query string, this owns the decision. It imports
|
||||
* nothing at all, which is what the test harness needs -- no Vue, no alias, no
|
||||
* component load.
|
||||
*/
|
||||
|
||||
export interface EventsTabSpec {
|
||||
id: string;
|
||||
label: string;
|
||||
/** The capability this tab needs, as GET /api/capabilities names it. */
|
||||
section: string;
|
||||
}
|
||||
|
||||
/** The tabs, in reading order: what arrived, where its fields go wrong, what
|
||||
* runs. */
|
||||
export const EVENTS_TABS: EventsTabSpec[] = [
|
||||
{ id: "inspector", label: "Inspector", section: "captures" },
|
||||
{ id: "bindings", label: "Bindings", section: "bindings" },
|
||||
{ id: "mappings", label: "Mappings", section: "mappings" },
|
||||
];
|
||||
|
||||
/**
|
||||
* availableTabs keeps the tabs the serving composition can back. A section the
|
||||
* server did not mention -- an older server, a failed read, a section added
|
||||
* after this build -- stays visible, because a tab that says "unavailable" is
|
||||
* recoverable and one that silently vanished is not.
|
||||
*/
|
||||
export function availableTabs(sections: Record<string, boolean> | null | undefined): EventsTabSpec[] {
|
||||
if (!sections) return [...EVENTS_TABS];
|
||||
return EVENTS_TABS.filter((tab) => sections[tab.section] !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* activeTab is the tab the URL asks for when that tab exists here, else the
|
||||
* first one that does. An empty result means this composition backs none of
|
||||
* them, which the page renders as an empty state rather than a broken tab.
|
||||
*/
|
||||
export function activeTab(requested: string, available: EventsTabSpec[]): string {
|
||||
if (available.some((tab) => tab.id === requested)) return requested;
|
||||
return available[0]?.id ?? "";
|
||||
}
|
||||
@@ -27,6 +27,18 @@ export interface SectionedRoute {
|
||||
/** hidden lists the route paths this composition cannot serve. */
|
||||
export const hidden = ref<string[]>([]);
|
||||
|
||||
/**
|
||||
* sections is the server's raw map, where `hidden` is that map already applied
|
||||
* to this route table. A surface that owns several capabilities rather than one
|
||||
* -- the Events page, whose tabs are separately backable -- reads this to decide
|
||||
* which parts of itself it can serve.
|
||||
*
|
||||
* Null means nothing has been reported (an older server, a failed read), and
|
||||
* every surface stays visible: a page that says "unavailable" is recoverable,
|
||||
* one that silently vanished is not.
|
||||
*/
|
||||
export const sections = ref<CapabilitySections | null>(null);
|
||||
|
||||
// hiddenRoutes returns the paths whose section the server reported it cannot
|
||||
// serve. An unreported section stays visible: a page that says "unavailable"
|
||||
// is recoverable, a navigation entry that silently vanished is not, so an
|
||||
@@ -44,6 +56,7 @@ export function hiddenRoutes(sections: CapabilitySections | null | undefined, ta
|
||||
export async function loadCapabilities(): Promise<void> {
|
||||
try {
|
||||
const body = await api.capabilities<{ sections?: CapabilitySections } | null>();
|
||||
sections.value = body?.sections ?? null;
|
||||
hidden.value = hiddenRoutes(body?.sections, routes as SectionedRoute[]);
|
||||
} catch {
|
||||
// Offline or an older server: every section stays visible.
|
||||
|
||||
+23
-16
@@ -33,19 +33,21 @@ interface RouteMeta {
|
||||
|
||||
const table = routes as Array<{ path: string; meta?: RouteMeta }>;
|
||||
|
||||
// The group owns the context, so the items inside it are named for what they
|
||||
// are rather than what they belong to. Order is the reading order of the menu.
|
||||
interface GroupSpec {
|
||||
label: string;
|
||||
paths: string[];
|
||||
dividerBefore?: { path: string; label: string };
|
||||
}
|
||||
// The bar reads left to right. A destination that is its own top-level thing is
|
||||
// a link rather than a group of one: Events carries the three surfaces that used
|
||||
// to sit in a dropdown, and a group whose only child shares its name is a menu
|
||||
// that says nothing.
|
||||
type NavSpec =
|
||||
| { kind: "link"; path: string }
|
||||
| { kind: "group"; label: string; paths: string[]; dividerBefore?: { path: string; label: string } };
|
||||
|
||||
const groups: GroupSpec[] = [
|
||||
{ label: "Work", paths: ["/tasks", "/workflows", "/channels", "/logs"] },
|
||||
{ label: "Agent", paths: ["/skills", "/curators"] },
|
||||
{ label: "Events", paths: ["/captures", "/mappings", "/bindings"] },
|
||||
const specs: NavSpec[] = [
|
||||
{ kind: "link", path: "/" },
|
||||
{ kind: "group", label: "Work", paths: ["/tasks", "/workflows", "/channels", "/logs"] },
|
||||
{ kind: "group", label: "Agent", paths: ["/skills", "/curators"] },
|
||||
{ kind: "link", path: "/events" },
|
||||
{
|
||||
kind: "group",
|
||||
label: "System",
|
||||
paths: [
|
||||
"/system/status",
|
||||
@@ -79,14 +81,19 @@ function entryFor(path: string): NavEntry {
|
||||
*/
|
||||
export function navTree(hidden: string[] = []): NavNode[] {
|
||||
const visible = (e: NavEntry) => !hidden.includes(e.path);
|
||||
const nodes: NavNode[] = [{ kind: "link", entry: entryFor("/") }];
|
||||
for (const group of groups) {
|
||||
const items = group.paths.map(entryFor).filter(visible);
|
||||
const nodes: NavNode[] = [];
|
||||
for (const spec of specs) {
|
||||
if (spec.kind === "link") {
|
||||
const entry = entryFor(spec.path);
|
||||
if (visible(entry)) nodes.push({ kind: "link", entry });
|
||||
continue;
|
||||
}
|
||||
const items = spec.paths.map(entryFor).filter(visible);
|
||||
const divided = items.map((item) => ({
|
||||
...item,
|
||||
dividerBefore: item.path === group.dividerBefore?.path ? group.dividerBefore.label : undefined,
|
||||
dividerBefore: item.path === spec.dividerBefore?.path ? spec.dividerBefore.label : undefined,
|
||||
}));
|
||||
if (divided.length > 0) nodes.push({ kind: "group", label: group.label, items: divided });
|
||||
if (divided.length > 0) nodes.push({ kind: "group", label: spec.label, items: divided });
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,12 @@ onMounted(loadMappings);
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="mb-5 flex flex-wrap items-start justify-between gap-5">
|
||||
<h1 class="text-3xl font-semibold tracking-[-0.03em]">Field mappings</h1>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Button @click="startCreate">
|
||||
<Plus data-icon="inline-start" />
|
||||
New mapping
|
||||
</Button>
|
||||
</div>
|
||||
<!-- The tab owns its own action row; the page header names the page. -->
|
||||
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<Button @click="startCreate">
|
||||
<Plus data-icon="inline-start" />
|
||||
New mapping
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<MappingActionError v-if="actionError" class="mb-4" :failure="actionError" />
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
|
||||
import BindingsPage from "@/bindings/BindingsPage.vue";
|
||||
import CapturesPage from "@/captures/CapturesPage.vue";
|
||||
import ChannelsPage from "@/channels/ChannelsPage.vue";
|
||||
import CuratorsPage from "@/curators/CuratorsPage.vue";
|
||||
import DashboardPage from "@/dashboard/DashboardPage.vue";
|
||||
import EventsPage from "@/events/EventsPage.vue";
|
||||
import LogsPage from "@/logs/LogsPage.vue";
|
||||
import MappingsPage from "@/mappings/MappingsPage.vue";
|
||||
import SystemAdvancedPage from "@/settings/SystemAdvancedPage.vue";
|
||||
import SystemIdentitiesPage from "@/settings/SystemIdentitiesPage.vue";
|
||||
import SystemAppearancePage from "@/settings/SystemAppearancePage.vue";
|
||||
@@ -37,9 +35,14 @@ const routes = [
|
||||
{ path: "/workflows", name: "workflows", component: WorkflowsPage, meta: { label: "Workflows", description: "The routed workflows and their run history.", section: "workflows" } },
|
||||
{ path: "/skills", name: "skills", component: SkillsPage, meta: { label: "Skills", description: "The SKILL.md capabilities Archie can activate.", section: "skills" } },
|
||||
{ path: "/curators", name: "curators", component: CuratorsPage, meta: { label: "Curators", description: "Scheduled passes that curate Archie's memory and captures.", section: "curators" } },
|
||||
{ path: "/captures", name: "captures", component: CapturesPage, meta: { label: "Inspector", description: "Captured inbound events for inspection.", section: "captures" } },
|
||||
{ path: "/mappings", name: "mappings", component: MappingsPage, meta: { label: "Mappings", description: "How inbound event fields map onto internal ones.", section: "mappings" } },
|
||||
{ path: "/bindings", name: "bindings", component: BindingsPage, meta: { label: "Bindings", description: "Which workflow a captured event starts.", section: "bindings" } },
|
||||
{ path: "/events", name: "events", component: EventsPage, meta: { label: "Events", description: "Captured inbound events, how their fields map, and which workflow they start." } },
|
||||
// The three former destinations, kept as bookmarks rather than removed: a
|
||||
// link, a bookmark or an agent that learned these URLs still lands somewhere
|
||||
// that works. `nav: false` is what the page registry's test reads to skip
|
||||
// them -- they are addressed by URL, not offered as destinations.
|
||||
{ path: "/captures", name: "captures", redirect: "/events?tab=inspector", meta: { label: "Inspector", nav: false } },
|
||||
{ path: "/mappings", name: "mappings", redirect: "/events?tab=mappings", meta: { label: "Mappings", nav: false } },
|
||||
{ path: "/bindings", name: "bindings", redirect: "/events?tab=bindings", meta: { label: "Bindings", nav: false } },
|
||||
{ path: "/system/status", name: "system-status", component: SystemStatusPage, meta: { label: "Status", description: "Update state, configuration sources, and the listen address.", section: "settings" } },
|
||||
{ path: "/logs", name: "logs", component: LogsPage, meta: { label: "Logs", description: "The daemon log stream, filterable by level and component.", section: "logs" } },
|
||||
{ path: "/system/appearance", name: "system-appearance", component: SystemAppearancePage, meta: { label: "Appearance", description: "Theme and display preferences." } },
|
||||
|
||||
@@ -28,9 +28,9 @@ onMounted(load);
|
||||
<StructuredResourceCard v-for="descriptor in resources" :key="descriptor.kind" :descriptor="descriptor" />
|
||||
<ConfigCard title="Managed elsewhere">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button as-child variant="outline"><RouterLink to="/captures">Captured events</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink to="/mappings">Capture mappings</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink to="/bindings">Capture bindings</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=inspector'">Captured events</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=mappings'">Capture mappings</RouterLink></Button>
|
||||
<Button as-child variant="outline"><RouterLink :to="'/events?tab=bindings'">Capture bindings</RouterLink></Button>
|
||||
</div>
|
||||
</ConfigCard>
|
||||
<DangerousActionsCard />
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
/**
|
||||
* The Events surfaces are one page with three tabs, and the navigation entry is
|
||||
* always live (Sam's call): the tabs behind it prune themselves per capability,
|
||||
* so an operator on a composition that can only back some of them still reaches
|
||||
* the ones it can. What must not come back is three sibling destinations.
|
||||
*/
|
||||
const router = await readFile(new URL("../src/router/index.ts", import.meta.url), "utf8");
|
||||
const nav = await readFile(new URL("../src/lib/nav.ts", import.meta.url), "utf8");
|
||||
const page = await readFile(new URL("../src/events/EventsPage.vue", import.meta.url), "utf8");
|
||||
const registry = await readFile(new URL("../../internal/gateway/dashboard_tools.go", import.meta.url), "utf8");
|
||||
|
||||
test("the Events page is the tab host, and the old paths only redirect", () => {
|
||||
assert.match(page, /Tabs/, "the page composes tabs");
|
||||
assert.match(page, /CapturesPage/, "the Inspector tab is the captures surface");
|
||||
assert.match(page, /BindingsPage/, "the Bindings tab is the bindings surface");
|
||||
assert.match(page, /MappingsPage/, "the Mappings tab is the mappings surface");
|
||||
|
||||
// Each former destination survives as a bookmark, never as a nav entry: the
|
||||
// registry test parses this table and skips exactly the lines marked so.
|
||||
for (const path of ["/captures", "/mappings", "/bindings"]) {
|
||||
const line = router.split("\n").find((l) => l.includes(`path: "${path}"`));
|
||||
assert.ok(line, `${path} is no longer routed at all, so its bookmarks break`);
|
||||
assert.match(line, /nav: false/, `${path} is still a navigation entry`);
|
||||
assert.match(line, /redirect/, `${path} does not redirect to the tab that replaced it`);
|
||||
}
|
||||
});
|
||||
|
||||
test("Events is one live navigation entry, not a group of three", () => {
|
||||
const entry = nav.split("\n").find((l) => l.includes('"/events"'));
|
||||
assert.ok(entry, "the navigation model does not reference /events");
|
||||
assert.doesNotMatch(nav, /label:\s*"Events",\s*paths:/, "Events is still a three-item group");
|
||||
});
|
||||
|
||||
test("the page registry and the route table still agree", () => {
|
||||
assert.match(registry, /Path: "\/events"/, "the agent's page registry does not know /events");
|
||||
for (const path of ["/captures", "/mappings", "/bindings"]) {
|
||||
assert.doesNotMatch(registry, new RegExp(`Path: "${path}"`), `${path} is still a registered page`);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
const { EVENTS_TABS, activeTab, availableTabs } = await import("../src/events/tab-selection.ts");
|
||||
|
||||
test("every tab stays when the composition reports nothing", () => {
|
||||
assert.deepEqual(availableTabs(null).map((t) => t.id), ["inspector", "bindings", "mappings"]);
|
||||
assert.deepEqual(availableTabs(undefined).map((t) => t.id), ["inspector", "bindings", "mappings"]);
|
||||
});
|
||||
|
||||
test("a tab is offered only when its own capability is backed", () => {
|
||||
const ids = availableTabs({ captures: true, bindings: false, mappings: true }).map((t) => t.id);
|
||||
assert.deepEqual(ids, ["inspector", "mappings"], "a capability the server refuses still shows its tab");
|
||||
});
|
||||
|
||||
test("a section the server never mentioned stays visible", () => {
|
||||
const ids = availableTabs({ captures: true }).map((t) => t.id);
|
||||
assert.deepEqual(ids, ["inspector", "bindings", "mappings"], "an unreported section hid its tab");
|
||||
});
|
||||
|
||||
test("the requested tab wins when it is available", () => {
|
||||
const available = availableTabs({ captures: true, bindings: true, mappings: true });
|
||||
assert.equal(activeTab("mappings", available), "mappings");
|
||||
});
|
||||
|
||||
test("a tab this composition cannot back falls back to the first it can", () => {
|
||||
const available = availableTabs({ captures: false, bindings: true, mappings: false });
|
||||
assert.equal(activeTab("inspector", available), "bindings", "a bookmark from a fuller deployment showed nothing");
|
||||
assert.equal(activeTab("", available), "bindings", "no tab named did not land on the first available one");
|
||||
});
|
||||
|
||||
test("nothing backed reports no tab rather than guessing one", () => {
|
||||
const available = availableTabs({ captures: false, bindings: false, mappings: false });
|
||||
assert.equal(available.length, 0);
|
||||
assert.equal(activeTab("bindings", available), "");
|
||||
});
|
||||
|
||||
test("the tabs are the three Events surfaces, in reading order", () => {
|
||||
assert.deepEqual(
|
||||
EVENTS_TABS.map(({ id, section }) => [id, section]),
|
||||
[["inspector", "captures"], ["bindings", "bindings"], ["mappings", "mappings"]],
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user