import React from 'react'; import { Box, Text } from '@anthropic/ink'; import type { Theme } from '@anthropic/ink'; export type LocalMemoryViewProps = | { mode: 'list'; stores: string[] } | { mode: 'created'; store: string } | { mode: 'stored'; store: string; key: string } | { mode: 'fetched'; store: string; key: string; value: string } | { mode: 'not-found'; store: string; key?: string } | { mode: 'entries'; store: string; keys: string[] } | { mode: 'archived'; store: string } | { mode: 'error'; message: string }; export function LocalMemoryView(props: LocalMemoryViewProps): React.ReactNode { if (props.mode === 'list') { if (props.stores.length === 0) { return ( No memory stores found. Use /local-memory create <store> to create one. ); } return ( Local Memory Stores ({props.stores.length}) {props.stores.map(s => ( {s} ))} ); } if (props.mode === 'created') { return ( Store created: {props.store} ); } if (props.mode === 'stored') { return ( Stored entry {props.key} in {props.store} ); } if (props.mode === 'fetched') { return ( {props.store} / {props.key} {props.value} ); } if (props.mode === 'not-found') { return ( Not found: {props.store} {props.key ? ( <> / {props.key} ) : null} ); } if (props.mode === 'entries') { if (props.keys.length === 0) { return ( No entries in {props.store} . Use /local-memory store {props.store} <key> <value> to add one. ); } return ( {props.store} ({props.keys.length} entries) {props.keys.map(k => ( · {k} ))} ); } if (props.mode === 'archived') { return ( Archived store: {props.store} (renamed to {props.store}.archived) ); } // mode === 'error' return ( Error: {props.message} ); }