fix: Model flag parsing and model args (#42)

This commit is contained in:
Devansh Jain
2025-10-30 20:23:21 -07:00
committed by GitHub
parent 77d78c22da
commit 32a3f7c7ab
7 changed files with 106 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ import type { StopReasonType } from "@letta-ai/letta-client/resources/runs/runs"
import { getClient } from "./agent/client";
import { createAgent } from "./agent/create";
import { sendMessageStream } from "./agent/message";
import { getModelUpdateArgs } from "./agent/model";
import { SessionStats } from "./agent/stats";
import { createBuffers, toLines } from "./cli/helpers/accumulator";
import { safeJsonParseOr } from "./cli/helpers/safeJsonParse";
@@ -25,6 +26,8 @@ export async function handleHeadlessCommand(argv: string[], model?: string) {
continue: { type: "boolean", short: "c" },
new: { type: "boolean" },
agent: { type: "string", short: "a" },
model: { type: "string", short: "m" },
prompt: { type: "boolean", short: "p" },
"output-format": { type: "string" },
},
strict: false,
@@ -70,7 +73,8 @@ export async function handleHeadlessCommand(argv: string[], model?: string) {
// Priority 2: Check if --new flag was passed (skip all resume logic)
if (!agent && forceNew) {
agent = await createAgent(undefined, model);
const updateArgs = getModelUpdateArgs(model);
agent = await createAgent(undefined, model, undefined, updateArgs);
}
// Priority 3: Try to resume from project settings (.letta/settings.local.json)
@@ -101,7 +105,8 @@ export async function handleHeadlessCommand(argv: string[], model?: string) {
// Priority 5: Create a new agent
if (!agent) {
agent = await createAgent(undefined, model);
const updateArgs = getModelUpdateArgs(model);
agent = await createAgent(undefined, model, undefined, updateArgs);
}
// Save agent ID to both project and global settings