mirror of
https://github.com/we-promise/sure.git
synced 2026-08-05 08:32:15 +00:00
* Add MCP transaction update tool * Fix MCP transaction authorization * Ignore Pipelock false positive on SnapTrade token lookup Pipelock scan-diff flags `token = oauth_refresh_token...` as "Credential in URL" even though these are ActiveRecord attribute names, not embedded secrets. Add the established inline ignore. Co-authored-by: Martin Molcrette <Mart1M@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Martin Molcrette <Mart1M@users.noreply.github.com>
53 lines
1.3 KiB
Ruby
53 lines
1.3 KiB
Ruby
module Assistant
|
|
Error = Class.new(StandardError)
|
|
|
|
REGISTRY = {
|
|
"builtin" => Assistant::Builtin,
|
|
"external" => Assistant::External
|
|
}.freeze
|
|
|
|
class << self
|
|
def for_chat(chat)
|
|
implementation_for(chat).for_chat(chat)
|
|
end
|
|
|
|
def config_for(chat)
|
|
raise Error, "chat is required" if chat.blank?
|
|
Assistant::Builtin.config_for(chat)
|
|
end
|
|
|
|
def available_types
|
|
REGISTRY.keys
|
|
end
|
|
|
|
def function_classes
|
|
[
|
|
Function::GetTransactions,
|
|
Function::GetAccounts,
|
|
Function::GetHoldings,
|
|
Function::GetBalanceSheet,
|
|
Function::GetIncomeStatement,
|
|
Function::GetBudget,
|
|
Function::ImportBankStatement,
|
|
Function::SearchFamilyFiles,
|
|
Function::CreateGoal,
|
|
Function::GetTags,
|
|
Function::CreateTag,
|
|
Function::UpdateTag,
|
|
Function::GetCategories,
|
|
Function::CreateCategory,
|
|
Function::UpdateCategory,
|
|
Function::UpdateTransaction
|
|
]
|
|
end
|
|
|
|
private
|
|
|
|
def implementation_for(chat)
|
|
raise Error, "chat is required" if chat.blank?
|
|
type = ENV["ASSISTANT_TYPE"].presence || chat.user&.family&.assistant_type.presence || "builtin"
|
|
REGISTRY.fetch(type) { REGISTRY["builtin"] }
|
|
end
|
|
end
|
|
end
|