fix: save agent ID after first interaction
Agent ID is only available after initialization (first message sent), so move the save logic to after the interaction completes. 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta <noreply@letta.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
interactiveMode,
|
||||
showStatus,
|
||||
reset,
|
||||
sayHello,
|
||||
} from './fixer.js';
|
||||
|
||||
async function main() {
|
||||
@@ -53,14 +54,6 @@ async function main() {
|
||||
|
||||
// Get or create the agent
|
||||
const agent = await getOrCreateAgent(state);
|
||||
|
||||
// Save agent ID if new
|
||||
if (!state.agentId && agent.agentId) {
|
||||
state.agentId = agent.agentId;
|
||||
await saveState(state);
|
||||
console.log(`\x1b[90m[Agent: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[→ https://app.letta.com/agents/${agent.agentId}]\x1b[0m\n`);
|
||||
}
|
||||
|
||||
if (positionals.length > 0) {
|
||||
// Fix the specified bug
|
||||
@@ -71,6 +64,14 @@ async function main() {
|
||||
await interactiveMode(agent, state);
|
||||
}
|
||||
|
||||
// Save agent ID after first interaction (when it becomes available)
|
||||
if (!state.agentId && agent.agentId) {
|
||||
state.agentId = agent.agentId;
|
||||
await saveState(state);
|
||||
console.log(`\x1b[90m[Agent saved: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[→ https://app.letta.com/agents/${agent.agentId}]\x1b[0m\n`);
|
||||
}
|
||||
|
||||
agent.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,13 @@ export async function showStatus(state: BugFixerState): Promise<void> {
|
||||
console.log('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Say hello
|
||||
*/
|
||||
export function sayHello(): void {
|
||||
console.log('Hello');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset state
|
||||
*/
|
||||
|
||||
@@ -57,14 +57,6 @@ async function main() {
|
||||
|
||||
// Get or create the agent
|
||||
const agent = await getOrCreateAgent(state);
|
||||
|
||||
// Save agent ID if new
|
||||
if (!state.agentId && agent.agentId) {
|
||||
state.agentId = agent.agentId;
|
||||
await saveState(state);
|
||||
console.log(`\x1b[90m[Agent: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[→ https://app.letta.com/agents/${agent.agentId}]\x1b[0m\n`);
|
||||
}
|
||||
|
||||
if (positionals.length > 0) {
|
||||
// Organize the specified directory
|
||||
@@ -75,6 +67,14 @@ async function main() {
|
||||
await interactiveMode(agent, state);
|
||||
}
|
||||
|
||||
// Save agent ID after first interaction (when it becomes available)
|
||||
if (!state.agentId && agent.agentId) {
|
||||
state.agentId = agent.agentId;
|
||||
await saveState(state);
|
||||
console.log(`\x1b[90m[Agent saved: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[→ https://app.letta.com/agents/${agent.agentId}]\x1b[0m\n`);
|
||||
}
|
||||
|
||||
agent.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,17 +66,17 @@ async function main() {
|
||||
|
||||
// Get or create the agent
|
||||
const agent = await getOrCreateAgent(state);
|
||||
|
||||
// Save agent ID if new
|
||||
|
||||
await generateReleaseNotes(agent, state, fromRef, toRef, values.output);
|
||||
|
||||
// Save agent ID after first interaction (when it becomes available)
|
||||
if (!state.agentId && agent.agentId) {
|
||||
state.agentId = agent.agentId;
|
||||
await saveState(state);
|
||||
console.log(`\x1b[90m[Agent: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[Agent saved: ${agent.agentId}]\x1b[0m`);
|
||||
console.log(`\x1b[90m[→ https://app.letta.com/agents/${agent.agentId}]\x1b[0m\n`);
|
||||
}
|
||||
|
||||
await generateReleaseNotes(agent, state, fromRef, toRef, values.output);
|
||||
|
||||
agent.close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user