fix(desktop): keep createdBy=learn through the starmap share code

The share-code codec encodes createdBy through a fixed table that only
knew none/agent/user, so idxOf returned 0 for 'learn' and a learned
skill round-tripped as createdBy: null. The 2-bit field has a free slot,
so 'learn' now occupies it, and metaBadges labels agent- and
learn-created skills alike as 'learned' — matching the Python side,
where both values count as learning signals.

Review finding: learn nodes lost createdBy in share-code round-trip.
This commit is contained in:
teknium1
2026-09-14 21:26:26 -07:00
committed by Teknium
parent 238720e928
commit d735097376
3 changed files with 3 additions and 3 deletions
@@ -29,7 +29,7 @@ function sampleGraph(): StarmapGraph {
},
{
category: 'devops',
createdBy: null,
createdBy: 'learn',
id: 'skill-b',
kind: 'skill',
label: 'skill-b',
+1 -1
View File
@@ -20,7 +20,7 @@ const trim = (s: string): string => (s.length > MAX_LABEL ? s.slice(0, MAX_LABEL
const KINDS = ['skill', 'memory'] as const
const STATES = ['active', 'archived', 'disabled', 'draft'] as const
const MEM_SOURCES = ['none', 'memory', 'profile'] as const
const CREATED_BY = ['none', 'agent', 'user'] as const
const CREATED_BY = ['none', 'agent', 'user', 'learn'] as const
const REC_BITS = 12 // time position resolution: 1/4096 of the span — sub-pixel here.
const REC_MAX = (1 << REC_BITS) - 1
+1 -1
View File
@@ -23,7 +23,7 @@ export function metaBadges(n: StarmapNode): string[] {
} else {
out.push(n.category)
if (n.createdBy === 'agent') {
if (n.createdBy === 'agent' || n.createdBy === 'learn') {
out.push('learned')
}