Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,10 @@ export const main = async (argv: string[]) => {

// Telemetry notice already printed above; only run update check here.
await printPostCommandNotices(false, updateCheck);

const exitMessage = getExitMessage();
if (exitMessage) {
console.log(`\n${exitMessage}`);
clearExitMessage();
}
};
4 changes: 2 additions & 2 deletions src/cli/commands/invoke/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ export const registerInvoke = (program: Command) => {
});
} else {
// No CLI options - interactive TUI mode (headers still passed if provided)
const { waitUntilExit } = render(
const { waitUntilExit, unmount } = render(
<InvokeScreen
isInteractive={true}
onExit={() => process.exit(0)}
onExit={() => unmount()}
Comment thread
aidandaly24 marked this conversation as resolved.
initialSessionId={cliOptions.sessionId}
initialUserId={cliOptions.userId}
initialHeaders={headers}
Expand Down
11 changes: 10 additions & 1 deletion src/cli/tui/screens/invoke/InvokeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { buildTraceConsoleUrl } from '../../../operations/traces';
import { GradientText, LogLink, Panel, Screen, SelectList, TextInput } from '../../components';
import { setExitMessage } from '../../exit-message';
import { useInvokeFlow } from './useInvokeFlow';
import { Box, Text, useInput, useStdout } from 'ink';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
Expand Down Expand Up @@ -145,6 +146,14 @@ export function InvokeScreen({
const justCancelledRef = useRef(false);
const mcpFetchTriggeredRef = useRef(false);

useEffect(() => {
if (sessionId && messages.length > 0) {
const cyan = '\x1b[36m';
const reset = '\x1b[0m';
setExitMessage(`To resume this session, run: ${cyan}agentcore invoke --session-id ${sessionId}${reset}`);
}
}, [sessionId, messages.length]);

// Compute auth type early so hooks can reference it
const currentAgent = config?.runtimes[selectedAgent];
const isCustomJwt = currentAgent?.authorizerType === 'CUSTOM_JWT';
Expand Down Expand Up @@ -398,7 +407,7 @@ export function InvokeScreen({
{mode !== 'select-agent' && (
<Box>
<Text>Session: </Text>
<Text color="magenta">{sessionId?.slice(0, 8) ?? 'none'}</Text>
<Text color="magenta">{sessionId ?? 'none'}</Text>
</Box>
)}
{mode !== 'select-agent' && (
Expand Down
Loading