feat(daemon): the timeline names and links the binding and capture that started a task
This commit is contained in:
1 parent
8613d2564c
commit
e16d06d588
8 files changed
+47
-25
No files matched your search
+11
-10
@@ -708,9 +708,7 @@ func (d *Daemon) claimAndEnqueue(ctx context.Context, b binding.Binding, c store
|
||||
if err := d.BindingDispatcher.SetDispatchTask(ctx, b.ID, c.ID, task.ID); err != nil {
|
||||
d.Log.Warn("binding dispatch: record task", "binding", b.ID, "capture", c.ID, "task", task.ID, "error", err)
|
||||
}
|
||||
if c.Unsigned {
|
||||
d.markUnsignedStart(ctx, task.ID, b, c)
|
||||
}
|
||||
d.markBindingStart(ctx, task.ID, b, c)
|
||||
}
|
||||
|
||||
// authorizeDispatch checks the identity may run the workflow. A denial is
|
||||
@@ -762,16 +760,19 @@ func signatureOf(c storecontract.CapturedEvent) string {
|
||||
return "unverified"
|
||||
}
|
||||
|
||||
// markUnsignedStart records on a task's timeline that an unsigned event
|
||||
// started it.
|
||||
func (d *Daemon) markUnsignedStart(ctx context.Context, taskID int64, b binding.Binding, c storecontract.CapturedEvent) {
|
||||
// markBindingStart records on a task's timeline the binding and captured
|
||||
// event that started it.
|
||||
func (d *Daemon) markBindingStart(ctx context.Context, taskID int64, b binding.Binding, c storecontract.CapturedEvent) {
|
||||
if _, err := d.Store.InsertEvent(ctx, events.Event{
|
||||
TaskID: taskID,
|
||||
Kind: events.KindUnsignedEvent,
|
||||
Detail: fmt.Sprintf("started by an unsigned event from source %q", c.Source),
|
||||
Data: map[string]any{"source": c.Source, "capture_id": c.ID, "binding_id": b.ID},
|
||||
Kind: events.KindBindingStarted,
|
||||
Detail: fmt.Sprintf("started by binding %q from source %q", b.Name, c.Source),
|
||||
Data: map[string]any{
|
||||
"binding_id": b.ID, "binding_name": b.Name, "binding_version": b.Version,
|
||||
"capture_id": c.ID, "source": c.Source, "unsigned": c.Unsigned,
|
||||
},
|
||||
}); err != nil {
|
||||
d.Log.Warn("binding dispatch: unsigned marker", "task", taskID, "error", err)
|
||||
d.Log.Warn("binding dispatch: start marker", "task", taskID, "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,12 @@ const (
|
||||
KindBindingChanged = "binding_changed"
|
||||
KindMappingChanged = "mapping_changed"
|
||||
|
||||
// KindUnsignedEvent marks a task started by an event from an approved
|
||||
// unsigned source, so its timeline shows that nothing authenticated
|
||||
// the sender. data: source, capture_id, binding_id.
|
||||
KindUnsignedEvent = "unsigned_event"
|
||||
// KindBindingStarted marks a task a binding started from a captured
|
||||
// event, naming both so the timeline links to them; unsigned flags an
|
||||
// event from an approved unsigned source, which nothing authenticated.
|
||||
// data: binding_id, binding_name, binding_version, capture_id, source,
|
||||
// unsigned.
|
||||
KindBindingStarted = "binding_started"
|
||||
|
||||
// KindWorkflowCallStarted marks the moment a workflow.call step
|
||||
// started its callee run. data:
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharray:none;animation:none}.vue-flow__edge.inactive{pointer-events:none}.vue-flow__edge.selected,.vue-flow__edge:focus,.vue-flow__edge:focus-visible{outline:none}.vue-flow__edge.selected .vue-flow__edge-path,.vue-flow__edge:focus .vue-flow__edge-path,.vue-flow__edge:focus-visible .vue-flow__edge-path{stroke:#555}.vue-flow__edge-textwrapper{pointer-events:all}.vue-flow__edge-textbg{fill:#fff}.vue-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.vue-flow__connection{pointer-events:none}.vue-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__connectionline{z-index:1001}.vue-flow__nodes{pointer-events:none;transform-origin:0 0}.vue-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.vue-flow__node.draggable{cursor:grab;pointer-events:all}.vue-flow__node.draggable.dragging{cursor:grabbing}.vue-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.vue-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.vue-flow__nodesselection-rect.dragging{cursor:grabbing}.vue-flow__handle{pointer-events:none;min-width:5px;min-height:5px;position:absolute}.vue-flow__handle.connectable{pointer-events:all;cursor:crosshair}.vue-flow__handle-bottom{bottom:0;left:50%;transform:translate(-50%,50%)}.vue-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.vue-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.vue-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.vue-flow__edgeupdater{cursor:move;pointer-events:all}.vue-flow__panel{z-index:5;margin:15px;position:absolute}.vue-flow__panel.top{top:0}.vue-flow__panel.bottom{bottom:0}.vue-flow__panel.left{left:0}.vue-flow__panel.right{right:0}.vue-flow__panel.center{left:50%;transform:translate(-50%)}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.vue-flow__controls{box-shadow:0 0 2px 1px #00000014}.vue-flow__controls-button{box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;background:#fefefe;border:none;border-bottom:1px solid #eee;justify-content:center;align-items:center;width:16px;height:16px;padding:5px;display:flex}.vue-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.vue-flow__controls-button:hover{background:#f4f4f4}.vue-flow__controls-button:disabled{pointer-events:none}.vue-flow__controls-button:disabled svg{fill-opacity:.4}.workflow-flow-edge path{stroke:var(--color-muted-foreground);stroke-width:1.5px}.workflow-data-edge path{stroke:var(--color-primary);stroke-dasharray:5 4;stroke-width:1.25px}@keyframes step-running{50%{box-shadow:0 0 0 4px color-mix(in oklab, var(--color-info) 30%, transparent)}}.step-running{animation:1.6s ease-in-out infinite step-running}.workflow-canvas .vue-flow__controls{box-shadow:none}.workflow-canvas .vue-flow__controls-button{background:var(--color-card);border-color:var(--color-border);fill:var(--color-foreground)}.workflow-canvas .vue-flow__controls-button:hover{background:var(--color-secondary)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--twLine truncated
|
||||
.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharray:none;animation:none}.vue-flow__edge.inactive{pointer-events:none}.vue-flow__edge.selected,.vue-flow__edge:focus,.vue-flow__edge:focus-visible{outline:none}.vue-flow__edge.selected .vue-flow__edge-path,.vue-flow__edge:focus .vue-flow__edge-path,.vue-flow__edge:focus-visible .vue-flow__edge-path{stroke:#555}.vue-flow__edge-textwrapper{pointer-events:all}.vue-flow__edge-textbg{fill:#fff}.vue-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.vue-flow__connection{pointer-events:none}.vue-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__connectionline{z-index:1001}.vue-flow__nodes{pointer-events:none;transform-origin:0 0}.vue-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.vue-flow__node.draggable{cursor:grab;pointer-events:all}.vue-flow__node.draggable.dragging{cursor:grabbing}.vue-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.vue-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.vue-flow__nodesselection-rect.dragging{cursor:grabbing}.vue-flow__handle{pointer-events:none;min-width:5px;min-height:5px;position:absolute}.vue-flow__handle.connectable{pointer-events:all;cursor:crosshair}.vue-flow__handle-bottom{bottom:0;left:50%;transform:translate(-50%,50%)}.vue-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.vue-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.vue-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.vue-flow__edgeupdater{cursor:move;pointer-events:all}.vue-flow__panel{z-index:5;margin:15px;position:absolute}.vue-flow__panel.top{top:0}.vue-flow__panel.bottom{bottom:0}.vue-flow__panel.left{left:0}.vue-flow__panel.right{right:0}.vue-flow__panel.center{left:50%;transform:translate(-50%)}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.vue-flow__controls{box-shadow:0 0 2px 1px #00000014}.vue-flow__controls-button{box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;background:#fefefe;border:none;border-bottom:1px solid #eee;justify-content:center;align-items:center;width:16px;height:16px;padding:5px;display:flex}.vue-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.vue-flow__controls-button:hover{background:#f4f4f4}.vue-flow__controls-button:disabled{pointer-events:none}.vue-flow__controls-button:disabled svg{fill-opacity:.4}.workflow-flow-edge path{stroke:var(--color-muted-foreground);stroke-width:1.5px}.workflow-data-edge path{stroke:var(--color-primary);stroke-dasharray:5 4;stroke-width:1.25px}@keyframes step-running{50%{box-shadow:0 0 0 4px color-mix(in oklab, var(--color-info) 30%, transparent)}}.step-running{animation:1.6s ease-in-out infinite step-running}.workflow-canvas .vue-flow__controls{box-shadow:none}.workflow-canvas .vue-flow__controls-button{background:var(--color-card);border-color:var(--color-border);fill:var(--color-foreground)}.workflow-canvas .vue-flow__controls-button:hover{background:var(--color-secondary)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--twLine truncated
|
||||
Vendored
+2
-2
@@ -16,9 +16,9 @@ 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 TS(e){return CS(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 \`${bS}\`.`),bS)}var ES=L({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:bS},getValueLabel:{type:Function,required:!1,default:(e,t)=>CS(e)?`${Math.round(e/t*bS)}%`: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;Q();let i=wh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=wh(n,`max`,r,{passive:n.max===void 0});I(()=>i.value,async e=>{let t=wS(e,n.max);t!==e&&(await qn(),i.value=t)},{immediate:!0}),I(()=>n.max,e=>{let t=TS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=Y(()=>Hm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return SS({modelValue:i,max:a,progressState:o}),(e,t)=>(V(),U(P(kg),{"as-child":e.asChild,as:e.as,"aria-valuemax":P(a),"aria-valuemin":0,"aria-valuenow":CS(P(i))?P(i):void 0,"aria-valuetext":e.getValueText?.(P(i),P(a)),"aria-label":e.getValueLabel(P(i),P(a)),role:`progressbar`,"data-state":o.value,"data-value":P(i)??void 0,"data-max":P(a)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),DS=L({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=xS();return Q(),(e,r)=>(V(),U(P(kg),J(t,{"data-state":P(n).progressState.value,"data-value":P(n).modelValue?.value??void 0,"data-max":P(n).max.value}),{default:F(()=>[z(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),OS=`radio.select`;function kS(e,t,n){Vm(OS,n,{originalEvent:e,value:t})}var AS=L({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=wh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Q(),c=Jh(s),l=Zh(),u=Y(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||kS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(V(),H(B,null,[G(P(kg),J({id:e.id,ref:P(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":P(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":P(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:P(a),required:e.required,name:e.name},{...P(l),...e.$attrs},{onClick:Vl(d,[`stop`])}),{default:F(()=>[z(e.$slots,`default`,{checked:P(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),P(c)&&e.name?(V(),U(P(iv),J({key:0,type:`radio`,tabindex:`-1`,value:P(a),checked:!!P(i),name:e.name,disabled:e.disabled,required:e.required},P(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):q(`v-if`,!0)],64))}}),[jS,MS]=zm(`RadioGroupRoot`),NS=L({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Q(),o=wh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=Uh(f),m=Jh(a);return MS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(V(),U(P(Bb),{"as-child":``,orientation:P(l),dir:P(p),loop:P(c)},{default:F(()=>[G(P(kg),{ref:P(i),role:`radiogroup`,"data-disabled":P(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":P(l),"aria-required":P(d),dir:P(p)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(o)}),P(m)&&P(u)?(V(),U(P(iv),{key:0,required:P(d),disabled:P(s),value:P(o),name:P(u)},null,8,[`required`,`disabled`,`value`,`name`])):q(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Iee,PS]=zm(`RadioGroupItem`),FS=L({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
|
||||
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:kE(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>kE(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=jE(c),u=e+1<n.length?jE(n[e+1]):null;if(l&&u&&ME(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=jE(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>kE(e)),rows:r.map(e=>e.map(e=>kE(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:kE(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:kE(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
|
||||
`)}),t}function jE(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 ME(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var NE={class:`[overflow-wrap:anywhere]`},PE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},FE={class:`font-mono text-[0.85em]`},IE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},LE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},RE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Ree={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},zee={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Bee={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Vee={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Hee={key:8,class:`mb-2.5 last:mb-0`},Uee=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>AE(t.text));return(e,t)=>(V(),H(`div`,NE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,PE,[W(`code`,FE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,IE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(DE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(DE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,LE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,RE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,Ree,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,zee,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,Bee,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,Vee,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,Hee,[G(DE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),Wee={class:`truncate`},Gee=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=$i(`RouterLink`);return V(),U(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:F(()=>[G(P(Xu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,Wee,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Kee={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},qee={class:`font-semibold text-foreground`},Jee={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Yee=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>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?(V(),U(Gee,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,Kee,[G(P(Zd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,qee,M(n.value),1),r.value?(V(),H(`code`,Jee,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),Xee={key:0,class:`mb-2 grid gap-0.5 text-xs`},Zee={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Qee={key:3,class:`whitespace-pre-wrap`},zE=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`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?(V(),H(`div`,Xee,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(Yee,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,Zee,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(bE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(Uee,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,Qee,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),$ee={class:`w-full self-center justify-self-center py-6 text-center`},ete={class:`grid gap-2`},tte=[`onClick`],nte=L({_
Line truncated
|
||||
`)}),t}function jE(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 ME(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var NE={class:`[overflow-wrap:anywhere]`},PE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},FE={class:`font-mono text-[0.85em]`},IE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},LE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},RE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Ree={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},zee={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Bee={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Vee={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Hee={key:8,class:`mb-2.5 last:mb-0`},Uee=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>AE(t.text));return(e,t)=>(V(),H(`div`,NE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,PE,[W(`code`,FE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,IE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(DE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(DE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,LE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,RE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,Ree,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,zee,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,Bee,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,Vee,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,Hee,[G(DE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),Wee={class:`truncate`},Gee=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=$i(`RouterLink`);return V(),U(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:F(()=>[G(P(Xu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,Wee,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Kee={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},qee={class:`font-semibold text-foreground`},Jee={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Yee=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>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?(V(),U(Gee,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,Kee,[G(P(Zd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,qee,M(n.value),1),r.value?(V(),H(`code`,Jee,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),Xee={key:0,class:`mb-2 grid gap-0.5 text-xs`},Zee={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Qee={key:3,class:`whitespace-pre-wrap`},zE=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`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?(V(),H(`div`,Xee,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(Yee,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,Zee,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(bE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(Uee,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,Qee,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),$ee={class:`w-full self-center justify-self-center py-6 text-center`},ete={class:`grid gap-2`},tte=[`onClick`],nte=L({_
Line truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Pj?`${n.slice(0,Pj).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var Ij=[`title`],Lj=L({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>oj(n.event)),a=Y(()=>Fj(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=Y(()=>n.event.at?mA(n.event.at):`—`);return(e,t)=>(V(),U(P(jj),{class:j(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:[Hl(Vl(o,[`prevent`]),[`enter`]),Hl(Vl(o,[`prevent`]),[`space`])]},{default:F(()=>[G(P(Aj),{class:`font-medium`},{default:F(()=>[K(M(n.event.kind||n.event.type||`event`),1)]),_:1}),G(P(Aj),{class:`font-mono`},{default:F(()=>[K(M(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(P(Aj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},M(a.value.text),9,Ij)]),_:1}),G(P(Aj),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Rj=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function zj(e){return(Number(e?.task_id)||0)>0}function Bj(e,t){return t===`tasks`?zj(e):t!==`system`||!zj(e)}function Vj(e,t){return e.filter(e=>Bj(e,t))}function Hj(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Uj(e,t){return`${e}:${t??0}`}function Wj(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Uj(Fj(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var Gj={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},Kj={class:`max-h-[28rem] overflow-y-auto`},qj=[`aria-expanded`,`aria-label`,`onClick`],Jj=[`title`],Yj=L({__name:`LiveActivityCard`,setup(e){let t=eD(),{activity:n,streamKind:r,streamState:i}=Fu(gk()),a=N(`all`),o=Y(()=>Vj(n.value,a.value)),s=Y(()=>Hj(o.value.length,a.value)),c=Jt(new Set),l=Y(()=>Wj(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return Fj(e.representative)}function p(e){return e.representative.at?mA(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(V(),U(P(sA),null,{default:F(()=>[G(P(fA),null,{default:F(()=>[G(P(pA),null,{default:F(()=>[...t[1]||=[K(`Live activity`,-1)]]),_:1}),G(P(cA),{class:`flex items-center gap-2`},{default:F(()=>[G(P(Ej),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:P(Rj)},null,8,[`modelValue`,`options`]),G(P(iA),{variant:P(r)},{default:F(()=>[K(M(P(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(P(lA),null,{default:F(()=>[W(`div`,Gj,[W(`div`,Kj,[G(P(Oj),null,{default:F(()=>[G(P(Nj),{class:`sticky top-0 z-10 bg-card`},{default:F(()=>[G(P(jj),null,{default:F(()=>[G(P(Mj),null,{default:F(()=>[...t[2]||=[K(`Event`,-1)]]),_:1}),G(P(Mj),null,{default:F(()=>[...t[3]||=[K(`Task`,-1)]]),_:1}),G(P(Mj),null,{default:F(()=>[...t[4]||=[K(`Detail`,-1)]]),_:1}),G(P(Mj),null,{default:F(()=>[...t[5]||=[K(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(P(kj),null,{default:F(()=>[o.value.length?q(``,!0):(V(),U(P(jj),{key:0},{default:F(()=>[G(P(Aj),{colspan:`4`},{default:F(()=>[G(P(Xk),null,{default:F(()=>[G(P($k),null,{default:F(()=>[G(P(nA),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(V(!0),H(B,{key:1},R(l.value,e=>(V(),H(B,{key:e.key},[e.count===1?(V(),U(Lj,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(V(),H(B,{key:1},[G(P(jj),{class:j(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Hl(Vl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Hl(Vl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:F(()=>[G(P(Aj),{class:`font-medium`},{default:F(()=>[W(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Vl(t=>u(e.key),[`stop`])},[d(e)?(V(),U(P(rd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(V(),U(P(id),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),K(` `+M(e.label)+` `,1),G(P(iA),{variant:`idle`},{default:F(()=>[K(`×`+M(e.count),1)]),_:2},1024)],8,qj)]),_:2},1024),G(P(Aj),{class:`font-mono`},{default:F(()=>[K(M(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(P(Aj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},M(f(e).text),9,Jj)]),_:2},1024),G(P(Aj),null,{default:F(()=>[K(M(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(V(!0),H(B,{key:0},R(e.events,(t,n)=>(V(),U(Lj,{key:`${e.key}:${n}`,ev
Line truncated
|
||||
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function gN(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function _N(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function vN(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function yN(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var bN=N([]),xN=N([]),SN=N(!0),CN=N(null),wN=N(null),TN=N(!1),EN=N(null);async function DN(){try{let e=await Z.eventTypes();SN.value=e.enabled!==!1,bN.value=e.event_types||[],xN.value=e.proposals||[],CN.value=null}catch(e){CN.value=e.message||String(e)}}function ON(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function kN(e){EN.value=null,wN.value=e}function AN(e){let t=RN.value.find(t=>String(t.id)===e.sample_id);kN({mode:`proposal`,id:null,source:e.source,name:``,rule:ON(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function jN(e=``){kN({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function MN(e){kN({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:ON(e.rule),headersText:``,body:``,exampleHeaders:{}})}function NN(){wN.value=null}async function PN(){let e=wN.value;if(e){TN.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:yN(e.rule)});else{let t=e.mode===`paste`?hN(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:yN(e.rule),example:{headers:t,body:e.body}})}wN.value=null,await DN()}catch(e){EN.value=e.message||String(e)}finally{TN.value=!1}}}var FN=N(null);async function IN(){let e=FN.value;if(FN.value=null,e)try{await Z.eventTypeDelete(e.id),await DN()}catch(e){CN.value=e.message||String(e)}}var LN=100,RN=N([]),zN=N(!0),BN=N(null),VN=N(!0),HN=N(null);async function UN(){try{let e=await Z.captures(LN);zN.value=e.enabled!==!1,RN.value=e.captures||[],BN.value=null}catch(e){BN.value=e.message||String(e)}finally{VN.value=!1}}function WN(e){let t=RN.value.find(t=>t.id===e);return t&&(HN.value=t),!!t}function GN(){RN.value.length&&(HN.value=RN.value[0])}function KN(){_k(`captures`,()=>{UN(),DN()})}var qN=`archie.theme`,JN=`archie.density`,YN=`archie.motion`,XN=`archie.tooltips`;function ZN(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function QN(e,t){try{localStorage.setItem(e,t)}catch{}}function $N(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var eP=Pu(`appearance`,()=>{let e=N(ZN(qN,[`system`,`dark`,`light`],`dark`)),t=N(ZN(JN,[`comfortable`,`compact`],`comfortable`)),n=N(ZN(YN,[`system`,`reduced`],`system`)),r=N(ZN(XN,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=$N(e.value)}function o(t){e.value=t,a(),QN(qN,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,QN(JN,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,QN(YN,e)}function l(e){r.value=e,QN(XN,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),tP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Xh(n,t),{tooltipsEnabled:i}=Fu(eP());return(e,t)=>(V(),U(P(ZC),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(ls(t)))]),_:3},16,[`disabled`]))}}),nP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Xh(_w(n,`class`),r);return(e,t)=>(V(),U(P(tw),null,{default:F(
Line truncated
|
||||
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function gN(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function _N(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function vN(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function yN(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var bN=N([]),xN=N([]),SN=N(!0),CN=N(null),wN=N(null),TN=N(!1),EN=N(null);async function DN(){try{let e=await Z.eventTypes();SN.value=e.enabled!==!1,bN.value=e.event_types||[],xN.value=e.proposals||[],CN.value=null}catch(e){CN.value=e.message||String(e)}}function ON(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function kN(e){EN.value=null,wN.value=e}function AN(e){let t=RN.value.find(t=>String(t.id)===e.sample_id);kN({mode:`proposal`,id:null,source:e.source,name:``,rule:ON(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function jN(e=``){kN({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function MN(e){kN({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:ON(e.rule),headersText:``,body:``,exampleHeaders:{}})}function NN(){wN.value=null}async function PN(){let e=wN.value;if(e){TN.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:yN(e.rule)});else{let t=e.mode===`paste`?hN(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:yN(e.rule),example:{headers:t,body:e.body}})}wN.value=null,await DN()}catch(e){EN.value=e.message||String(e)}finally{TN.value=!1}}}var FN=N(null);async function IN(){let e=FN.value;if(FN.value=null,e)try{await Z.eventTypeDelete(e.id),await DN()}catch(e){CN.value=e.message||String(e)}}var LN=100,RN=N([]),zN=N(!0),BN=N(null),VN=N(!0),HN=N(null);async function UN(){try{let e=await Z.captures(LN);zN.value=e.enabled!==!1,RN.value=e.captures||[],BN.value=null}catch(e){BN.value=e.message||String(e)}finally{VN.value=!1}}function WN(e){let t=RN.value.find(t=>t.id===e);return t&&(HN.value=t),!!t}function GN(){RN.value.length&&(HN.value=RN.value[0])}function KN(){_k(`captures`,()=>{UN(),DN()})}var qN=`archie.theme`,JN=`archie.density`,YN=`archie.motion`,XN=`archie.tooltips`;function ZN(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function QN(e,t){try{localStorage.setItem(e,t)}catch{}}function $N(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var eP=Pu(`appearance`,()=>{let e=N(ZN(qN,[`system`,`dark`,`light`],`dark`)),t=N(ZN(JN,[`comfortable`,`compact`],`comfortable`)),n=N(ZN(YN,[`system`,`reduced`],`system`)),r=N(ZN(XN,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=$N(e.value)}function o(t){e.value=t,a(),QN(qN,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,QN(JN,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,QN(YN,e)}function l(e){r.value=e,QN(XN,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),tP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Xh(n,t),{tooltipsEnabled:i}=Fu(eP());return(e,t)=>(V(),U(P(ZC),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(ls(t)))]),_:3},16,[`disabled`]))}}),nP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Xh(_w(n,`class`),r);return(e,t)=>(V(),U(P(tw),null,{default:F(
Line truncated
|
||||
`)}};oJ.defaultYaml={explicit:!1,version:`1.2`},oJ.defaultTags={"!!":`tag:yaml.org,2002:`};function sJ(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function cJ(e){let t=new Set;return $q(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function lJ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function uJ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=cJ(e);let a=lJ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Gq(t.node)||qq(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function dJ(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=dJ(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=dJ(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=dJ(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=dJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function fJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>fJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Yq(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var pJ=class{constructor(e){Object.defineProperty(this,Bq,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Hq(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=fJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?dJ(i,{"":o},``,o):o}},mJ=class extends pJ{constructor(e){super(Pq),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],$q(e,{Node:(e,t)=>{(Vq(t)||Yq(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(fJ(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=hJ(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(sJ(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function hJ(e,t,n){if(Vq(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(qq(t)){let r=0;for(let i of t.items){let t=hJ(e,i,n);t>r&&(r=t)}return r}if(Wq(t)){let r=hJ(e,t.key,n),i=hJ(e,t.value,n);return Math.max(r,i)}return 1}var gJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,_J=class extends pJ{constructor(e){super(Rq),this.value=e}toJSON(e,t){return t?.keep?this.value:fJ(this.value,e,t)}toString(){return String(this.value)}};_J.BLOCK_FOLDED=`BLOCK_FOLDED`,_J.BLOCK_LITERAL=`BLOCK_LITERAL`,_J.PLAIN=`PLAIN`,_J.QUOTE_DOUBLE=`QUOTE_DOUBLE`,_J.QUOTE_SINGLE=`QUOTE_SINGLE`;var vJ=`tag:yaml.org,2002:`;function yJ(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function bJ(e,t,n){if(Hq(e)&&(e=e.contents),Jq(e))return e;if(Wq(e)){let t=n.schema[Iq].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new mJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=vJ+t.slice(2));let l=yJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new _J(e);return c&&(c.node=t),t
Line truncated
|
||||
`)?TJ(n,t):n.includes(`
|
||||
`)?`
|
||||
|
||||
@@ -23,6 +23,7 @@ const taskKinds = new Set([
|
||||
"pr_merged",
|
||||
"pr_rejected",
|
||||
"pr_closed",
|
||||
"binding_started",
|
||||
"human_approved",
|
||||
"human_rejected",
|
||||
"human_rereviewed",
|
||||
|
||||
@@ -31,6 +31,15 @@ const line = computed(() => describeTimelineEvent(props.event));
|
||||
<div v-if="line.detail" class="mt-0.5 text-xs text-fg-muted">
|
||||
{{ line.detail }}
|
||||
</div>
|
||||
<div v-if="line.links?.length" class="mt-0.5 flex gap-3 text-xs">
|
||||
<RouterLink
|
||||
v-for="link in line.links"
|
||||
:key="link.to"
|
||||
:to="link.to"
|
||||
class="text-fg-muted underline-offset-2 hover:text-foreground hover:underline"
|
||||
>{{ link.label }}</RouterLink
|
||||
>
|
||||
</div>
|
||||
<div class="mt-0.5 text-xs text-fg-subtle">{{ ago(event.at) }}</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -51,6 +51,8 @@ export interface TimelineLine {
|
||||
detail: string;
|
||||
/** Set for an event a reader must not skim past. */
|
||||
tone?: "warn";
|
||||
/** Records the event names, as dashboard paths. */
|
||||
links?: { label: string; to: string }[];
|
||||
}
|
||||
|
||||
export function describeTimelineEvent(ev: TaskEvent = {}): TimelineLine {
|
||||
@@ -125,13 +127,16 @@ export function describeTimelineEvent(ev: TaskEvent = {}): TimelineLine {
|
||||
detail: "The effective task-runtime configuration for this run.",
|
||||
};
|
||||
}
|
||||
if (ev.kind === "unsigned_event") {
|
||||
if (ev.kind === "binding_started") {
|
||||
const source = text(data.source);
|
||||
return {
|
||||
title: "Started by an unsigned event",
|
||||
detail: source ? `source ${source}` : "",
|
||||
tone: "warn",
|
||||
};
|
||||
const capture = text(data.capture_id);
|
||||
const links = [
|
||||
{ label: `binding ${text(data.binding_name) || text(data.binding_id)}`, to: "/events?tab=bindings" },
|
||||
...(capture ? [{ label: "captured event", to: `/events?tab=inspector&capture=${encodeURIComponent(capture)}` }] : []),
|
||||
];
|
||||
if (data.unsigned === true)
|
||||
return { title: "Started by an unsigned event", detail: source ? `source ${source}` : "", tone: "warn", links };
|
||||
return { title: "Started by an event", detail: source ? `source ${source}` : "", links };
|
||||
}
|
||||
if (ev.kind === "changes_captured") {
|
||||
const totals = (data.totals ?? {}) as { files?: unknown };
|
||||
|
||||
@@ -52,13 +52,17 @@ test("a source's URL escapes nothing a valid path can hold", () => {
|
||||
|
||||
test("a task started by an unsigned event says so on its timeline", () => {
|
||||
const line = describeTimelineEvent({
|
||||
kind: "unsigned_event",
|
||||
data: { source: "firewall" },
|
||||
kind: "binding_started",
|
||||
data: { source: "firewall", binding_name: "fw", capture_id: "c1", unsigned: true },
|
||||
});
|
||||
assert.deepEqual(line, {
|
||||
title: "Started by an unsigned event",
|
||||
detail: "source firewall",
|
||||
tone: "warn",
|
||||
links: [
|
||||
{ label: "binding fw", to: "/events?tab=bindings" },
|
||||
{ label: "captured event", to: "/events?tab=inspector&capture=c1" },
|
||||
],
|
||||
});
|
||||
assert.equal(
|
||||
describeTimelineEvent({ kind: "stage_start", stage: "plan" }).tone,
|
||||
|
||||
Reference in new issue
Block a user