teapot-coding-agent 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=te,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>S(()=>L(o)));d=o,p=null;try{return F(s,!0)}finally{p=n,d=r}}function v(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[k.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),A(n,e))]}function y(e,t,n){j(N(e,t,!1,c))}function b(e,t,n){s=ne;let r=N(e,t,!1,c),i=O&&D(O);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):j(r)}function x(e,t,n){n=n?Object.assign({},a,n):a;let r=N(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,j(r),k.bind(r)}function S(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function C(e){b(()=>S(e))}function w(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[T,E]=v(!1);function D(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var O;function k(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)j(this);else{let e=m;m=null,F(()=>I(this),!1),m=e}}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function A(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&F(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&re(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function j(e){if(!e.fn)return;L(e);let t=g;M(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{F(()=>{f&&(f.running=!0),p=d=e,M(e,e.tValue,t),p=d=null},!1)})}function M(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(L),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(L),e.owned=null)),e.updatedAt=n+1,R(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?A(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function N(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function P(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return I(e);if(e.suspense&&S(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)j(e);else if((t?e.tState:e.state)===l){let t=m;m=null,F(()=>I(e,n[0]),!1),m=t}}}function F(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return ee(n),t}catch(e){n||(h=null),m=null,R(e)}}function ee(e){if(m&&=(te(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,F(()=>{for(let e of n)L(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)L(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}E(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,E(!0);return}}let n=h;h=null,n.length&&F(()=>s(n),!1),t&&t()}function te(e){for(let t=0;t<e.length;t++)P(e[t])}function ne(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:P(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)P(t[r])}function I(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&P(i):e===l&&I(i,t)}}}function re(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&re(r))}}function L(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)L(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)ie(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)L(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function ie(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)ie(e.owned[t])}function ae(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function oe(e,t,n){try{for(let n of t)n(e)}catch(e){R(e,n&&n.owner||null)}}function R(e,t=d){let n=o&&t&&t.context&&t.context[o],r=ae(e);if(!n)throw r;h?h.push({fn(){oe(r,n,t)},state:c}):oe(r,n,t)}var se=Symbol(`fallback`);function ce(e){for(let t=0;t<e.length;t++)e[t]()}function le(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return w(()=>ce(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],S(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(ce(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[se],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=v(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function z(e,t){return S(()=>e(t||{}))}var ue=e=>`Stale read from <${e}>.`;function B(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return x(le(()=>e.each,e.children,t||void 0))}function V(e){let t=e.keyed,n=x(()=>e.when,void 0,void 0),r=t?n:x(n,void 0,{equals:(e,t)=>!e==!t});return x(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?S(()=>a(t?i:()=>{if(!S(r))throw ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var H=e=>x(()=>e());function de(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var fe=`_$DX_DELEGATE`;function pe(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():q(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function U(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>S(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function me(e,t=window.document){let n=t[fe]||(t[fe]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,ge))}}function he(e,t,n){J(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function W(e,t){J(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function G(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function K(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function q(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Y(e,t,r,n);y(r=>Y(e,t(),r,n),r)}function J(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ge(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0),t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}function Y(e,t,n,r,i){let a=J(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Z(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Z(e,n,r)}else if(o===`function`)return y(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Y(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(X(o,t,n,i))return y(()=>n=Y(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Z(e,n,r),s)return n}else c?n.length===0?_e(e,o,r):de(e,n,o):(n&&Z(e),_e(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Z(e,n,r,t);Z(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function X(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=X(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=X(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function _e(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Z(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function ve(e){let t=ye(e.replace(/\r\n/g,`
2
+ `)).split(`
3
+ `),n=[],r=0;for(;r<t.length;){let e=t[r];if(/^```\w*\s*$/.test(e)){let e=[];for(r++;r<t.length&&!/^```\s*$/.test(t[r]);)e.push(t[r++]);r++,n.push(`<pre><code>${e.join(`
4
+ `)}</code></pre>`);continue}let a=e.match(/^(#{1,4})\s+(.*)$/);if(a){n.push(`<h${a[1].length}>${i(a[2])}</h${a[1].length}>`),r++;continue}let o=/^\s*\d+[.)]\s+/.test(e);if(o||/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length;){let n=t[r].match(/^\s*[-*]\s+(.*)$/)??(o?t[r].match(/^\s*\d+[.)]\s+(.*)$/):null);if(!n)break;e.push(`<li>${i(n[1])}</li>`),r++}n.push(o?`<ol>${e.join(``)}</ol>`:`<ul>${e.join(``)}</ul>`);continue}if(/^\s*$/.test(e)){r++;continue}let s=[];for(;r<t.length&&!/^\s*$/.test(t[r])&&!/^#{1,4}\s/.test(t[r])&&!/^```/.test(t[r])&&!/^\s*([-*]|\d+[.)])\s/.test(t[r]);)s.push(t[r++]);n.push(`<p>${s.map(i).join(`<br>`)}</p>`)}return n.join(`
5
+ `);function i(e){return e.replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/(^|\W)\*([^*]+)\*(?=\W|$)/g,`$1<em>$2</em>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" rel="noopener noreferrer" target="_blank">$1</a>`)}}function ye(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var be=U(`<br>`),xe=U(`<span class=sub>`),Se=U(`<header class=chan-head><span class=hash>#</span><span class=title></span><span></span><span class=sub> · <!>/<!> · turns <!> · tools `),Ce=U(`<div class=feed>`),we=U(`<div class=composer><form><input type=text><label><input type=checkbox>auto-start</label><button type=submit>send</button></form><div class=hint>enter to send · prompts are appended to the conversation and the agent keeps working toward its goal`),Te=U(`<h3>controls`),Ee=U(`<div class=btnrow><button>▶ start</button><button>■ stop</button><button>⑂ fork</button><button title="remove agent">🗑`),De=U(`<h3>goal <span>`),Oe=U(`<form style=display:flex;gap:4px;margin-bottom:6px><input id=goal-input type=text placeholder="set new goal…"style="flex:1;background:var(--bg-darkest);border:none;border-radius:6px;padding:6px 8px;color:var(--fg);font:inherit"><button type=submit style="background:var(--acc);border:none;border-radius:6px;color:#fff;padding:0 10px;cursor:pointer">✓`),ke=U(`<div class=card>`),Ae=U(`<h3>latest progress`),je=U(`<div class=card>
6
+ <!>
7
+ <span class=muted>`),Me=U(`<h3>branches`),Ne=U(`<h3>runtime`),Pe=U(`<div class="card muted">turns <!> · tools <!>
8
+ tokens in/out <!>/<!>
9
+ `),Fe=U(`<div class=layout><nav class=sidebar><h1>🫖 teapot<span style=float:right;display:flex;gap:4px><button class=iconbtn title="new agent">+</button><button class=iconbtn title=settings>⚙</button></span></h1><div class=metrics></div></nav><section class=channel></section><aside class=rightbar>`),Ie=U(`<span title="goal done">✓`),Le=U(`<div><span></span><span>`),Re=U(`<div class=muted style=display:grid;place-items:center;height:100%>select an agent`),ze=U(`<div class=muted>none yet`),Be=U(`<div><span>`),Ve=U(`<div> → `),He=U(`<div class=avatar>`),Ue=U(`<div class=msg-head><span class=author></span><span class=ts></span><span class=ts>`),We=U(`<div><div class=msg-body>`),Ge=U(`<span style=width:38px>`),Ke=U(`<div class=content>`),qe=U(`<div class=embed><b>⚙ </b><div class=mono>`),Je=U(`<div><div class=mono></div><div class=meta>ms`),Ye=U(`<div class=meta>`),Xe=U(`<div class=meta>⚠ `),Ze=U(`<div class=meta>→ `),Qe=U(`<div class=embed style=border-color:var(--ok)><div>📈 `),$e=U(`<div class="embed fail"><div class=mono>⚠ `),et=U(`<div class="content muted">`),tt=U(`<div class=overlay><div class=modal><div class=modal-head><b></b><button class=iconbtn>✕`),nt=U(`<span style=color:var(--err);font-size:13px>`),rt=U(`<form style=display:flex;flex-direction:column;gap:10px><label>workspace directory<div style=display:flex;gap:6px><input type=text class="w100 mono"><button type=button>go</button><button type=button>↑</button></div></label><div class=dirlist></div><div style=display:flex;gap:10px><label style=flex:1>agent name <input type=text placeholder="(directory name)"></label><label>provider<select></select></label><label style=flex:1>model <input type=text placeholder="(provider default)"></label></div><button type=submit style=align-self:flex-end>create & start`),it=U(`<div class=direntry>📁 `),at=U(`<option>`),ot=U(`<form style=display:flex;flex-direction:column;gap:10px><label>providers (<!>)<textarea rows=8 class="mono w100"></textarea></label><div style=display:flex;gap:10px><label style=flex:1>default provider <input type=text></label><label>progress interval (min) <input type=number min=1 style=width:90px></label></div><label>scheduled tasks (JSON array)<textarea rows=7 class="mono w100"></textarea></label><button type=submit style=align-self:flex-end>save`),st={user:{name:`you`,icon:`🧑`,color:`#faa81a`},message:{name:`agent`,icon:`🫖`,color:`#5865f2`},tool_call:{name:`tool`,icon:`🔧`,color:`#3ba0c9`},progress:{name:`progress`,icon:`📈`,color:`#3ba55d`}},ct=e=>st[e.type]??{name:e.type,icon:`•`,color:`#9298a5`},lt=new Set([`user`,`message`,`prompt`,`tool_call`,`tool_result`,`progress`]),ut=e=>lt.has(e.type),dt=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};async function Q(e,t){let n=await fetch(e,t);if(!n.ok)throw Error(`${e}: ${n.status}`);return n.json()}function ft(){let[e,t]=v([]),[n,r]=v(null),[i,a]=v([]),[o,s]=v([]),[c,l]=v(null),[u,d]=v(``),[f,p]=v(!0),[m,h]=v({providers:{}}),[g,_]=v(!1),[b,S]=v(!1),w=()=>Q(`/api/config`).then(h).catch(()=>{}),T=x(()=>e().find(e=>e.id===n())),E=()=>Q(`/api/agents`).then(e=>t(e.agents)).catch(()=>{}),D=()=>Q(`/api/metrics`).then(l).catch(()=>{});async function O(e){try{let[t,n]=await Promise.all([Q(`/api/agents/${e}/events?limit=300`),Q(`/api/agents/${e}/branches`)]);a(t.events),s(n.branches)}catch{}}async function k(e){r(e),await O(e),requestAnimationFrame(A)}function A(){let e=document.querySelector(`.feed`);e&&(e.scrollTop=e.scrollHeight)}C(()=>{w(),E().then(()=>e()[0]&&k(e()[0].id)),D();let t=null;new EventSource(`/api/events`).onmessage=e=>{JSON.parse(e.data),!t&&(t=setTimeout(async()=>{if(t=null,await E(),await D(),n()){let e=i().length;await O(n()),i().length!==e&&A()}},400))},setInterval(D,3e4)});let j=async e=>{if(e.preventDefault(),!n()||!u().trim())return;let t=u();d(``),await Q(`/api/agents/${n()}/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:t,start:f()})})},M=e=>()=>n()&&Q(`/api/agents/${n()}${e}`,{method:`POST`}).then(E),N=async e=>{e.preventDefault();let t=document.getElementById(`goal-input`);!n()||!t.value.trim()||(await Q(`/api/agents/${n()}/goal`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:t.value})}),t.value=``,E())};return[(()=>{var a=Fe(),s=a.firstChild,l=s.firstChild,m=l.firstChild.nextSibling.firstChild,h=m.nextSibling,g=l.nextSibling,v=s.nextSibling,b=v.nextSibling;return m.$$click=()=>{w(),_(!0)},h.$$click=()=>{w(),S(!0)},q(s,z(B,{get each(){return e()},children:e=>(()=>{var t=Le(),r=t.firstChild,i=r.nextSibling;return t.$$click=()=>k(e.id),q(i,()=>e.id),q(t,z(V,{get when(){return e.goal.status===`done`},get children(){return Ie()}}),null),y(i=>{var a=`agent-item`+(e.id===n()?` sel`:``),o=`dot ${e.status}`;return a!==i.e&&W(t,i.e=a),o!==i.t&&W(r,i.t=o),i},{e:void 0,t:void 0}),t})()}),g),q(g,z(V,{get when(){return c()},get children(){return[`master rss `,H(()=>c().rssMb),`MB · heap `,H(()=>c().heapUsedMb),`MB`,be(),`load1 `,H(()=>c().loadavg1),` · up `,H(()=>Math.floor(c().uptimeSec/60)),`m`]}})),q(v,z(V,{get when(){return T()},get fallback(){return Re()},get children(){return[(()=>{var e=Se(),t=e.firstChild.nextSibling,n=t.nextSibling,r=n.nextSibling,i=r.firstChild,a=i.nextSibling,o=a.nextSibling.nextSibling,s=o.nextSibling.nextSibling;return s.nextSibling,q(t,()=>T().id),q(n,()=>T().status),q(e,z(V,{get when(){return T().statusReason},get children(){var e=xe();return q(e,()=>T().statusReason),e}}),r),q(r,()=>T().model,i),q(r,()=>T().session,a),q(r,()=>T().branch,o),q(r,()=>T().stats.turns,s),q(r,()=>T().stats.toolCalls,null),y(()=>W(n,`badge ${T().status}`)),e})(),(()=>{var e=Ce();return q(e,z(B,{get each(){return i().filter(ut)},children:(e,t)=>z(pt,{e,get prev(){return i().filter(ut)[t()-1]}})})),e})(),(()=>{var e=we(),t=e.firstChild,n=t.firstChild,r=n.nextSibling.firstChild;return t.addEventListener(`submit`,j),n.$$input=e=>d(e.currentTarget.value),r.addEventListener(`change`,e=>p(e.currentTarget.checked)),y(()=>he(n,`placeholder`,`message #${T().id}`)),y(()=>n.value=u()),y(()=>r.checked=f()),e})()]}})),q(b,z(V,{get when(){return T()},get children(){return[Te(),(()=>{var n=Ee(),i=n.firstChild,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling;return G(i,`click`,M(`/start`),!0),G(a,`click`,M(`/stop`),!0),o.$$click=()=>Q(`/api/agents/${T().id}/fork`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`}).then(()=>k(T().id)),s.$$click=async()=>{confirm(`remove agent ${T().id}? (log is kept)`)&&(await Q(`/api/agents/${T().id}`,{method:`DELETE`}),r(null),t(e().filter(e=>e.id!==T().id)))},n})(),(()=>{var e=De(),t=e.firstChild.nextSibling;return q(t,()=>T().goal.status),y(()=>W(t,`badge ${T().goal.status===`done`?`done`:``}`)),e})(),(()=>{var e=Oe();return e.addEventListener(`submit`,N),e})(),(()=>{var e=ke();return q(e,()=>T().goal.text||`no goal set`),e})(),Ae(),z(V,{get when(){return T().latestProgress},get fallback(){return ze()},get children(){var e=je(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling.nextSibling;return q(e,()=>T().latestProgress.doing,t),q(e,()=>T().latestProgress.recent??``,n),q(r,()=>T().latestProgress.ts),e}}),Me(),z(B,{get each(){return o()},children:e=>(()=>{var t=Be(),n=t.firstChild;return q(t,()=>e.branch,n),q(n,()=>e.events),y(()=>W(t,`branch-row`+(e.branch===T().branch?` cur`:``))),t})()}),Ne(),(()=>{var e=Pe(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling,r=n.nextSibling.nextSibling,i=r.nextSibling.nextSibling;return i.nextSibling,q(e,()=>T().stats.turns,t),q(e,()=>T().stats.toolCalls,n),q(e,()=>T().stats.inputTokens,r),q(e,()=>T().stats.outputTokens,i),q(e,()=>T().workspace,null),e})()]}})),a})(),z(V,{get when(){return g()},get children(){return z(gt,{get providers(){return Object.keys(m().providers??{})},onClose:()=>_(!1),onCreated:e=>{_(!1),E(),k(e)}})}}),z(V,{get when(){return b()},get children(){return z(_t,{get cfg(){return m()},onClose:()=>S(!1),onSaved:w})}})]}function pt(e){let t=e.e,n=ct(t),r=e.prev&&e.prev.type===t.type&&t.session===e.prev.session&&t.branch===e.prev.branch;return t.type===`state`?t.data.from===t.data.to?null:(()=>{var e=Ve(),n=e.firstChild;return q(e,()=>t.data.from,n),q(e,()=>t.data.to,null),q(e,(()=>{var e=H(()=>!!t.data.reason);return()=>e()?` — ${t.data.reason}`:``})(),null),y(()=>W(e,`divider-msg`+(t.data.to===`error`?` err`:``))),e})():(()=>{var e=We(),i=e.firstChild;return W(e,`msg`+(r?` grouped`:``)),q(e,z(V,{when:!r,get fallback(){return Ge()},get children(){var e=He();return q(e,()=>n.icon),y(t=>{var r=n.color+`33`,i=`1px solid ${n.color}66`;return r!==t.e&&K(e,`background`,t.e=r),i!==t.t&&K(e,`border`,t.t=i),t},{e:void 0,t:void 0}),e}}),i),q(i,z(V,{when:!r,get children(){var e=Ue(),r=e.firstChild,i=r.nextSibling,a=i.nextSibling;return q(r,()=>n.name),q(i,()=>dt(t.ts)),q(a,()=>t.branch),y(e=>K(r,`color`,n.color)),e}}),null),q(i,z(mt,{e:t}),null),e})()}function mt(e){let t=e.e;switch(t.type){case`prompt`:return(()=>{var e=Ke();return y(()=>e.innerHTML=ve(String(t.data.text??``))),e})();case`message`:return(()=>{var e=Ke();return y(()=>e.innerHTML=ve(String(t.data.content??``))),e})();case`tool_call`:return(()=>{var e=qe(),n=e.firstChild;n.firstChild;var r=n.nextSibling;return q(n,()=>String(t.data.name),null),q(r,()=>$(JSON.stringify(t.data.args,null,1),500)),e})();case`tool_result`:return(()=>{var e=Je(),n=e.firstChild,r=n.nextSibling,i=r.firstChild;return q(n,()=>$(String(t.data.result),700)),q(r,()=>t.data.durationMs,i),q(r,()=>t.data.ok?``:` · FAILED`,null),y(()=>W(e,`embed`+(t.data.ok?``:` fail`))),e})();case`progress`:return(()=>{var e=Qe(),n=e.firstChild;return n.firstChild,q(n,()=>String(t.data.doing??``),null),q(e,z(V,{get when(){return t.data.recent},get children(){var e=Ye();return q(e,()=>String(t.data.recent)),e}}),null),q(e,z(V,{get when(){return t.data.problems},get children(){var e=Xe();return e.firstChild,q(e,()=>String(t.data.problems),null),e}}),null),q(e,z(V,{get when(){return t.data.next},get children(){var e=Ze();return e.firstChild,q(e,()=>String(t.data.next),null),e}}),null),e})();case`error`:return(()=>{var e=$e(),n=e.firstChild;return n.firstChild,q(n,()=>String(t.data.message??``),null),e})();default:return(()=>{var e=et();return q(e,()=>$(JSON.stringify(t.data),200)),e})()}}function $(e,t){return e.length>t?e.slice(0,t)+` …`:e}function ht(e){return(()=>{var t=tt(),n=t.firstChild,r=n.firstChild.firstChild,i=r.nextSibling;return t.$$click=t=>t.target===t.currentTarget&&e.onClose(),q(r,()=>e.title),G(i,`click`,e.onClose,!0),q(n,()=>e.children,null),t})()}function gt(e){let[t,n]=v(`~`),[r,i]=v([]),[a,o]=v(``),[s,c]=v(e.providers[0]??``),[l,u]=v(``),[d,f]=v(``);async function p(e){let t=await Q(`/api/fs${e?`?path=${encodeURIComponent(e)}`:``}`);n(t.path),i(t.entries)}C(()=>p(t()));let m=async n=>{n.preventDefault(),f(``);try{let n=await Q(`/api/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({workspace:t(),id:a(),provider:s()||void 0,model:l()||void 0})});e.onCreated(n.agent.id)}catch(e){f(String(e.message))}};return z(ht,{title:`new agent`,get onClose(){return e.onClose},get children(){var i=rt(),f=i.firstChild,h=f.firstChild.nextSibling.firstChild,g=h.nextSibling,_=g.nextSibling,v=f.nextSibling,b=v.nextSibling,x=b.firstChild,S=x.firstChild.nextSibling,C=x.nextSibling,w=C.firstChild.nextSibling,T=C.nextSibling.firstChild.nextSibling,E=b.nextSibling;return i.addEventListener(`submit`,m),h.$$input=e=>n(e.currentTarget.value),g.$$click=()=>p(t()),_.$$click=()=>p(`..`),q(v,z(B,{get each(){return r()},children:e=>(()=>{var n=it();return n.firstChild,n.$$click=()=>p(`${t()}/${e}`.replace(/\/+/g,`/`)),q(n,e,null),n})()})),S.$$input=e=>o(e.currentTarget.value),w.addEventListener(`change`,e=>c(e.currentTarget.value)),q(w,z(B,{get each(){return e.providers},children:e=>(()=>{var t=at();return q(t,e),t})()})),T.$$input=e=>u(e.currentTarget.value),q(i,z(V,{get when(){return d()},get children(){var e=nt();return q(e,d),e}}),E),y(()=>h.value=t()),y(()=>S.value=a()),y(()=>w.value=s()),y(()=>T.value=l()),i}})}function _t(e){let[t,n]=v(JSON.stringify(Object.fromEntries(Object.entries(e.cfg.providers??{}).map(([e,t])=>[e,{baseUrl:t.baseUrl,apiKey:t.apiKey??``,model:t.model??``}])),null,2)),[r,i]=v(e.cfg.defaultProvider??Object.keys(e.cfg.providers??{})[0]??``),[a,o]=v(Math.round((e.cfg.progressIntervalMs??6e5)/6e4)),[s,c]=v(JSON.stringify(e.cfg.tasks??[],null,2)),[l,u]=v(``),d=async n=>{n.preventDefault(),u(``);let i,o;try{i=JSON.parse(t())}catch{return u(`providers: invalid JSON`)}try{o=JSON.parse(s())}catch{return u(`tasks: invalid JSON`)}try{await Q(`/api/config`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({providers:i,defaultProvider:r(),progressIntervalMs:Math.max(1,a())*6e4,tasks:o})}),e.onSaved(),e.onClose()}catch(e){u(String(e.message))}};return z(ht,{title:`settings`,get onClose(){return e.onClose},get children(){var u=ot(),f=u.firstChild,p=f.firstChild.nextSibling,m=p.nextSibling.nextSibling,h=f.nextSibling,g=h.firstChild,_=g.firstChild.nextSibling,v=g.nextSibling.firstChild.nextSibling,b=h.nextSibling,x=b.firstChild.nextSibling,S=b.nextSibling;return u.addEventListener(`submit`,d),q(f,()=>e.cfg.configPath,p),m.$$input=e=>n(e.currentTarget.value),_.$$input=e=>i(e.currentTarget.value),v.$$input=e=>o(Number(e.currentTarget.value)),x.$$input=e=>c(e.currentTarget.value),q(u,z(V,{get when(){return l()},get children(){var e=nt();return q(e,l),e}}),S),y(()=>m.value=t()),y(()=>_.value=r()),y(()=>v.value=a()),y(()=>x.value=s()),u}})}me([`click`,`input`]),pe(()=>z(ft,{}),document.getElementById(`root`));
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>teapot</title>
7
+ <script type="module" crossorigin src="/assets/index-DkqgYCzJ.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-CxlAQ_0i.css">
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>