From 32cf7169a69f393efa4eff5b7b6eed34a8ac8899 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 9 Feb 2026 10:55:21 -0800 Subject: [PATCH] fix: use Store class for v2 compat in model command, remove unused import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace raw JSON parsing with Store class (v1+v2 format support) - Remove unused listModels import from model.ts Written by Cameron ◯ Letta Code "Simplicity is the ultimate sophistication." -- Leonardo da Vinci --- src/commands/model.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/commands/model.ts b/src/commands/model.ts index 02be185..e815220 100644 --- a/src/commands/model.ts +++ b/src/commands/model.ts @@ -7,25 +7,17 @@ * lettabot model set - Set model by handle */ -import { existsSync, readFileSync } from 'node:fs'; -import { resolve } from 'node:path'; -import { getDataDir } from '../utils/paths.js'; -import { getAgentModel, updateAgentModel, listModels } from '../tools/letta-api.js'; +import { getAgentModel, updateAgentModel } from '../tools/letta-api.js'; import { buildModelOptions, handleModelSelection, getBillingTier } from '../utils/model-selection.js'; import { isLettaCloudUrl } from '../utils/server.js'; +import { Store } from '../core/store.js'; /** - * Get agent ID from store file + * Get agent ID from store file (supports v1 and v2 formats) */ function getAgentId(): string | null { - const storePath = resolve(getDataDir(), 'lettabot-agent.json'); - if (!existsSync(storePath)) return null; - try { - const store = JSON.parse(readFileSync(storePath, 'utf-8')); - return store.agentId || null; - } catch { - return null; - } + const store = new Store(); + return store.agentId; } /**