| #!/usr/bin/env zsh |
|
|
| |
|
|
| |
| function _forge_action_new() { |
| local input_text="$1" |
| |
| |
| _forge_clear_conversation |
| _FORGE_ACTIVE_AGENT="forge" |
| |
| echo |
| |
| |
| if [[ -n "$input_text" ]]; then |
| |
| local new_id=$($_FORGE_BIN conversation new) |
| _forge_switch_conversation "$new_id" |
| |
| |
| _forge_exec_interactive -p "$input_text" --cid "$_FORGE_CONVERSATION_ID" |
| |
| |
| _forge_start_background_sync |
| |
| _forge_start_background_update |
| else |
| |
| _forge_exec banner |
| fi |
| } |
|
|
| |
| function _forge_action_info() { |
| echo |
| if [[ -n "$_FORGE_CONVERSATION_ID" ]]; then |
| _forge_exec info --cid "$_FORGE_CONVERSATION_ID" |
| else |
| _forge_exec info |
| fi |
| } |
|
|
| |
| function _forge_action_dump() { |
| local input_text="$1" |
| if [[ "$input_text" == "html" ]]; then |
| _forge_handle_conversation_command "dump" "--html" |
| else |
| _forge_handle_conversation_command "dump" |
| fi |
| } |
|
|
| |
| function _forge_action_compact() { |
| _forge_handle_conversation_command "compact" |
| } |
|
|
| |
| function _forge_action_retry() { |
| _forge_handle_conversation_command "retry" |
| } |
|
|
| |
| function _forge_action_help() { |
| echo |
| $_FORGE_BIN list command |
| } |
|
|
| |
| function _forge_handle_conversation_command() { |
| local subcommand="$1" |
| shift |
| |
| echo |
| |
| |
| if [[ -z "$_FORGE_CONVERSATION_ID" ]]; then |
| _forge_log error "No active conversation. Start a conversation first or use :conversation to see existing ones" |
| return 0 |
| fi |
| |
| |
| _forge_exec conversation "$subcommand" "$_FORGE_CONVERSATION_ID" "$@" |
| } |
|
|