The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed app/src/components/memory/MemoryHitRow.tsx,app/src/components/memory/memoryForm
Steven Enamakel19eb75819039
diff --git a/app/src/components/memory/MemoryHitRow.tsx b/app/src/components/memory/MemoryHitRow.tsxindex 353caf320d..3edbd345c7 100644--- a/app/src/components/memory/MemoryHitRow.tsx+++ b/app/src/components/memory/MemoryHitRow.tsx@@ -1,12 +1,13 @@/*** One stored item — a recall citation, a raw fetch hit, or a learning — as a- * list row: kind badge, optional score, the text, and the metadata that says+ * list row: kind badge (plus "Built belief" for a learning the background+ * belief builder derived), optional score, the text, and the metadata that says* where it came from (file, folder, repo, thread, link).*/import type { ReactNode } from 'react';import { useT } from '../../lib/i18n/I18nContext';-import type { ItemKind, MemoryMeta } from '../../services/api/memoryApi';+import { isBuiltBelief, type ItemKind, type MemoryMeta } from '../../services/api/memoryApi';import { Badge } from '../ui';import { formatScore, KIND_VARIANT, kindLabel, metaFacts } from './memoryFormat';@@ -46,6 +47,11 @@ export default function MemoryHitRow({<div className="min-w-0 flex-1 space-y-1.5"><div className="flex flex-wrap items-center gap-2"><Badge variant={KIND_VARIANT[kind] ?? 'neutral'}>{kindLabel(kind, t)}</Badge>+ {isBuiltBelief(meta) && (+ <Badge variant="primary" data-testid="memory-hit-belief">+ {t('memoryPage.learnings.builtBelief')}+ </Badge>+ )}{scoreText !== null && (<spanclassName="font-mono text-[11px] text-content-muted"diff --git a/app/src/components/memory/memoryFormat.ts b/app/src/components/memory/memoryFormat.tsindex 665800c23a..5e73354e34 100644--- a/app/src/components/memory/memoryFormat.ts+++ b/app/src/components/memory/memoryFormat.ts@@ -80,3 +80,10 @@ export function parsePositiveInt(raw: string): number | null {const n = Number.parseInt(raw, 10);return n > 0 ? n : null;}++/** Parse an integer in `[min, max]` from a form field, or `null` when it is not one. */+export function parseIntInRange(raw: string, min: number, max: number): number | null {+ if (!/^\s*\d+\s*$/.test(raw)) return null;+ const n = Number.parseInt(raw, 10);+ return n >= min && n <= max ? n : null;+}diff --git a/app/src/components/memory/memoryHelpers.test.ts b/app/src/components/memory/memoryHelpers.test.tsindex f53e2d8705..4c3b15b128 100644--- a/app/src/components/memory/memoryHelpers.test.ts+++ b/app/src/components/memory/memoryHelpers.test.ts@@ -1,7 +1,14 @@import { describe, expect, it } from 'vitest';import { MEMORY_CHIPS, resolveMemoryChip } from './memoryChips';-import { fill, formatScore, formatTimestamp, metaFacts, parsePositiveInt } from './memoryFormat';+import {+ fill,+ formatScore,+ formatTimestamp,+ metaFacts,+ parseIntInRange,+ parsePositiveInt,+} from './memoryFormat';const t = (key: string) => key;@@ -63,4 +70,12 @@ describe('memoryFormat', () => {expect(parsePositiveInt('1.5')).toBeNull();expect(parsePositiveInt('')).toBeNull();});++ it('parses integers within a range only', () => {+ expect(parseIntInRange('0', 0, 50)).toBe(0);+ expect(parseIntInRange('50', 0, 50)).toBe(50);+ expect(parseIntInRange('51', 0, 50)).toBeNull();+ expect(parseIntInRange('99', 100, 16000)).toBeNull();+ expect(parseIntInRange('abc', 0, 50)).toBeNull();+ });});diff --git a/app/src/services/api/memoryApi.ts b/app/src/services/api/memoryApi.tsindex 09e89ac34b..dedc59e522 100644--- a/app/src/services/api/memoryApi.ts+++ b/app/src/services/api/memoryApi.ts@@ -62,6 +62,17 @@ export const LEARNING_KINDS: readonly LearningKind[] = ['other',];+/**+ * The tag TinyMemory's belief builder stamps on the learnings it derives+ * (`tinymemory_api::consolidate::BELIEF_TAG`).+ */+export const BELIEF_TAG = 'belief';++/** True when a stored item is a belief the background builder derived. */+export function isBuiltBelief(meta: { tags?: string[] | null } | null | undefined): boolean {+ return Boolean(meta?.tags?.includes(BELIEF_TAG));+}+/** Engine health as `memory_engine_get` reports it. `off` = no usable engine. */export type EngineStatus = 'ok' | 'degraded' | 'down' | 'off';