Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108<script lang="ts"> import { listArtifacts, type Artifact } from './api'; import { ago } from './format'; import MenuButton from './MenuButton.svelte'; import ArtifactTab from './ArtifactTab.svelte';
// The artifacts a session made: a page icon, with how many, that lists // them newest change first and opens one. Read again when the session's // work stops and when the list opens. Nothing shows until there is one. let { sessionId, busy = false, up = false, inline = false, onopen, }: { sessionId: string; busy?: boolean; up?: boolean; inline?: boolean; onopen: (artifact: Artifact) => void; } = $props(); let made = $state<Artifact[]>([]); let listed = $state(false);
$effect(() => { void busy; void listed; const reading = new AbortController(); listArtifacts({ session: sessionId, signal: reading.signal }).then( (found) => (made = found), () => {}, ); return () => reading.abort(); });</script>
{#if made.length || inline} <MenuButton label="artifacts this session made" count={made.length} {up} {inline} bind:open={listed} > {#snippet icon()} <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" ><rect x="2" y="3" width="12" height="10" rx="2" fill="none" stroke="currentColor" stroke-width="1.4" /><path d="M2 6h12" stroke="currentColor" stroke-width="1.4" /></svg > {/snippet} {#each made as artifact (artifact.id)} <li data-chip-target="artifact:{artifact.id}"> <button onclick={() => ((listed = false), onopen(artifact))}> <span class="title" title={artifact.title}>{artifact.title}</span> <span class="when" >{artifact.versions > 1 ? `v${artifact.version}` : ''}</span > <span class="when time" >{ago(new Date(artifact.updated_at).toISOString())}</span > </button> <ArtifactTab {artifact} onclick={() => (listed = false)} /> </li> {/each} </MenuButton>{/if}
<style> li { position: relative; display: flex; align-items: center; } li > button { flex: 1; min-width: 0; } .time { visibility: hidden; } li :global(.tab) { position: absolute; right: 6px; } @media (hover: hover) and (pointer: fine) { li:not(:hover):not(:focus-within) .time { visibility: visible; } li:not(:hover):not(:focus-within) :global(.tab) { opacity: 0; } } .title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }</style>