exa-ai 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +119 -73
- data/exe/exa-ai +41 -136
- data/exe/exa-ai-agent-run-create +55 -20
- data/exe/exa-ai-agent-run-delete +1 -8
- data/exe/exa-ai-agent-run-events +21 -1
- data/exe/exa-ai-agent-run-list +1 -1
- data/exe/exa-ai-agent-run-stop +93 -0
- data/exe/exa-ai-answer +25 -0
- data/exe/exa-ai-context +6 -2
- data/exe/exa-ai-find-similar +26 -68
- data/exe/exa-ai-get-contents +138 -42
- data/exe/exa-ai-search +27 -104
- data/exe/exa-ai-search-monitor-batch +93 -0
- data/exe/exa-ai-search-monitor-create +104 -0
- data/exe/exa-ai-search-monitor-delete +69 -0
- data/exe/exa-ai-search-monitor-get +69 -0
- data/exe/exa-ai-search-monitor-list +73 -0
- data/exe/exa-ai-search-monitor-runs-get +68 -0
- data/exe/exa-ai-search-monitor-runs-list +75 -0
- data/exe/exa-ai-search-monitor-trigger +69 -0
- data/exe/exa-ai-search-monitor-update +102 -0
- data/lib/exa/cli/base.rb +57 -0
- data/lib/exa/cli/contents_flags.rb +199 -0
- data/lib/exa/cli/formatters/agent_run_formatter.rb +79 -3
- data/lib/exa/cli/formatters/search_formatter.rb +18 -2
- data/lib/exa/cli/formatters/search_monitor_formatter.rb +98 -0
- data/lib/exa/cli/search_parser.rb +46 -87
- data/lib/exa/client.rb +186 -310
- data/lib/exa/resources/agent_run.rb +5 -3
- data/lib/exa/resources/agent_run_deletion.rb +17 -0
- data/lib/exa/resources/answer.rb +3 -3
- data/lib/exa/resources/contents_result.rb +5 -1
- data/lib/exa/resources/find_similar_result.rb +5 -1
- data/lib/exa/resources/search_monitor.rb +42 -0
- data/lib/exa/resources/search_monitor_batch_result.rb +11 -0
- data/lib/exa/resources/search_monitor_list.rb +19 -0
- data/lib/exa/resources/search_monitor_run.rb +46 -0
- data/lib/exa/resources/search_monitor_trigger_result.rb +11 -0
- data/lib/exa/resources/search_result.rb +11 -1
- data/lib/exa/services/agent_run_cancel.rb +1 -12
- data/lib/exa/services/agent_run_create.rb +1 -12
- data/lib/exa/services/agent_run_delete.rb +6 -14
- data/lib/exa/services/agent_run_events.rb +33 -4
- data/lib/exa/services/agent_run_get.rb +1 -12
- data/lib/exa/services/agent_run_list.rb +1 -12
- data/lib/exa/services/agent_run_stop.rb +21 -0
- data/lib/exa/services/agent_run_stream.rb +53 -51
- data/lib/exa/services/answer.rb +5 -2
- data/lib/exa/services/answer_stream.rb +54 -45
- data/lib/exa/services/context.rb +3 -1
- data/lib/exa/services/find_similar.rb +9 -2
- data/lib/exa/services/get_contents.rb +14 -15
- data/lib/exa/services/parameter_converter.rb +128 -111
- data/lib/exa/services/search.rb +58 -19
- data/lib/exa/services/search_monitors/batch.rb +36 -0
- data/lib/exa/services/search_monitors/create.rb +37 -0
- data/lib/exa/services/search_monitors/delete.rb +22 -0
- data/lib/exa/services/search_monitors/get.rb +22 -0
- data/lib/exa/services/search_monitors/list.rb +29 -0
- data/lib/exa/services/search_monitors/runs_get.rb +23 -0
- data/lib/exa/services/search_monitors/runs_list.rb +29 -0
- data/lib/exa/services/search_monitors/trigger.rb +22 -0
- data/lib/exa/services/search_monitors/update.rb +42 -0
- data/lib/exa/services/search_stream.rb +38 -0
- data/lib/exa/version.rb +1 -1
- data/lib/exa.rb +18 -50
- metadata +30 -84
- data/exe/exa-ai-enrichment-cancel +0 -108
- data/exe/exa-ai-enrichment-create +0 -226
- data/exe/exa-ai-enrichment-delete +0 -122
- data/exe/exa-ai-enrichment-get +0 -104
- data/exe/exa-ai-enrichment-list +0 -99
- data/exe/exa-ai-enrichment-update +0 -171
- data/exe/exa-ai-import-create +0 -253
- data/exe/exa-ai-import-delete +0 -92
- data/exe/exa-ai-import-get +0 -92
- data/exe/exa-ai-import-list +0 -72
- data/exe/exa-ai-import-update +0 -164
- data/exe/exa-ai-monitor-create +0 -223
- data/exe/exa-ai-monitor-delete +0 -101
- data/exe/exa-ai-monitor-get +0 -92
- data/exe/exa-ai-monitor-list +0 -90
- data/exe/exa-ai-monitor-runs-get +0 -103
- data/exe/exa-ai-monitor-runs-list +0 -110
- data/exe/exa-ai-monitor-update +0 -207
- data/exe/exa-ai-webset-cancel +0 -97
- data/exe/exa-ai-webset-create +0 -254
- data/exe/exa-ai-webset-delete +0 -111
- data/exe/exa-ai-webset-get +0 -93
- data/exe/exa-ai-webset-item-delete +0 -111
- data/exe/exa-ai-webset-item-get +0 -105
- data/exe/exa-ai-webset-item-list +0 -108
- data/exe/exa-ai-webset-list +0 -91
- data/exe/exa-ai-webset-search-cancel +0 -104
- data/exe/exa-ai-webset-search-create +0 -247
- data/exe/exa-ai-webset-search-get +0 -105
- data/exe/exa-ai-webset-update +0 -143
- data/lib/exa/cli/formatters/enrichment_formatter.rb +0 -125
- data/lib/exa/cli/formatters/import_formatter.rb +0 -153
- data/lib/exa/cli/formatters/monitor_formatter.rb +0 -144
- data/lib/exa/cli/formatters/monitor_run_formatter.rb +0 -126
- data/lib/exa/cli/formatters/webset_formatter.rb +0 -134
- data/lib/exa/cli/formatters/webset_item_formatter.rb +0 -131
- data/lib/exa/cli/formatters/webset_search_formatter.rb +0 -57
- data/lib/exa/constants/websets.rb +0 -19
- data/lib/exa/resources/import.rb +0 -86
- data/lib/exa/resources/import_collection.rb +0 -33
- data/lib/exa/resources/monitor.rb +0 -48
- data/lib/exa/resources/monitor_collection.rb +0 -30
- data/lib/exa/resources/monitor_run.rb +0 -52
- data/lib/exa/resources/monitor_run_collection.rb +0 -30
- data/lib/exa/resources/webset.rb +0 -74
- data/lib/exa/resources/webset_collection.rb +0 -33
- data/lib/exa/resources/webset_enrichment.rb +0 -71
- data/lib/exa/resources/webset_enrichment_collection.rb +0 -28
- data/lib/exa/resources/webset_item_collection.rb +0 -33
- data/lib/exa/resources/webset_search.rb +0 -112
- data/lib/exa/services/websets/cancel.rb +0 -36
- data/lib/exa/services/websets/cancel_enrichment.rb +0 -35
- data/lib/exa/services/websets/cancel_search.rb +0 -44
- data/lib/exa/services/websets/create.rb +0 -45
- data/lib/exa/services/websets/create_enrichment.rb +0 -35
- data/lib/exa/services/websets/create_search.rb +0 -48
- data/lib/exa/services/websets/create_search_validator.rb +0 -128
- data/lib/exa/services/websets/create_validator.rb +0 -213
- data/lib/exa/services/websets/delete.rb +0 -36
- data/lib/exa/services/websets/delete_enrichment.rb +0 -35
- data/lib/exa/services/websets/delete_item.rb +0 -20
- data/lib/exa/services/websets/get_item.rb +0 -20
- data/lib/exa/services/websets/get_search.rb +0 -43
- data/lib/exa/services/websets/import_create.rb +0 -40
- data/lib/exa/services/websets/import_delete.rb +0 -37
- data/lib/exa/services/websets/import_get.rb +0 -37
- data/lib/exa/services/websets/import_list.rb +0 -25
- data/lib/exa/services/websets/import_update.rb +0 -38
- data/lib/exa/services/websets/import_upload.rb +0 -59
- data/lib/exa/services/websets/list.rb +0 -25
- data/lib/exa/services/websets/list_items.rb +0 -26
- data/lib/exa/services/websets/monitors/create.rb +0 -42
- data/lib/exa/services/websets/monitors/delete.rb +0 -32
- data/lib/exa/services/websets/monitors/get.rb +0 -33
- data/lib/exa/services/websets/monitors/list.rb +0 -27
- data/lib/exa/services/websets/monitors/runs/get.rb +0 -37
- data/lib/exa/services/websets/monitors/runs/list.rb +0 -30
- data/lib/exa/services/websets/monitors/update.rb +0 -33
- data/lib/exa/services/websets/retrieve.rb +0 -47
- data/lib/exa/services/websets/retrieve_enrichment.rb +0 -35
- data/lib/exa/services/websets/update.rb +0 -37
- data/lib/exa/services/websets/update_enrichment.rb +0 -36
- data/lib/exa/services/websets_parameter_converter.rb +0 -45
data/exe/exa-ai-monitor-runs-get
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "exa-ai"
|
|
5
|
-
|
|
6
|
-
# Parse arguments
|
|
7
|
-
monitor_id = nil
|
|
8
|
-
run_id = nil
|
|
9
|
-
api_key = nil
|
|
10
|
-
output_format = "json"
|
|
11
|
-
|
|
12
|
-
args = ARGV.dup
|
|
13
|
-
while args.any?
|
|
14
|
-
arg = args.shift
|
|
15
|
-
case arg
|
|
16
|
-
when "--api-key"
|
|
17
|
-
api_key = args.shift
|
|
18
|
-
when "--output-format"
|
|
19
|
-
output_format = args.shift
|
|
20
|
-
when "--help", "-h"
|
|
21
|
-
puts <<~HELP
|
|
22
|
-
Usage: exa-ai monitor-runs-get <monitor_id> <run_id> [OPTIONS]
|
|
23
|
-
|
|
24
|
-
Retrieve details for a specific monitor run
|
|
25
|
-
|
|
26
|
-
Arguments:
|
|
27
|
-
monitor_id ID of the monitor (required)
|
|
28
|
-
run_id ID of the run to retrieve (required)
|
|
29
|
-
|
|
30
|
-
Options:
|
|
31
|
-
--api-key KEY Exa API key (or set EXA_API_KEY env var)
|
|
32
|
-
--output-format FMT Output format: json, pretty, or text (default: json)
|
|
33
|
-
--help, -h Show this help message
|
|
34
|
-
|
|
35
|
-
Examples:
|
|
36
|
-
exa-ai monitor-runs-get mon_abc123 run_xyz789
|
|
37
|
-
exa-ai monitor-runs-get mon_abc123 run_xyz789 --output-format pretty
|
|
38
|
-
HELP
|
|
39
|
-
exit 0
|
|
40
|
-
else
|
|
41
|
-
# First positional argument is monitor_id, second is run_id
|
|
42
|
-
if monitor_id.nil?
|
|
43
|
-
monitor_id = arg
|
|
44
|
-
elsif run_id.nil?
|
|
45
|
-
run_id = arg
|
|
46
|
-
else
|
|
47
|
-
$stderr.puts "Unknown option: #{arg}"
|
|
48
|
-
exit 1
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Validate
|
|
54
|
-
if monitor_id.nil?
|
|
55
|
-
$stderr.puts "Error: monitor_id argument is required"
|
|
56
|
-
$stderr.puts "Usage: exa-ai monitor-runs-get <monitor_id> <run_id> [OPTIONS]"
|
|
57
|
-
$stderr.puts "Try 'exa-ai monitor-runs-get --help' for more information"
|
|
58
|
-
exit 1
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
if run_id.nil?
|
|
62
|
-
$stderr.puts "Error: run_id argument is required"
|
|
63
|
-
$stderr.puts "Usage: exa-ai monitor-runs-get <monitor_id> <run_id> [OPTIONS]"
|
|
64
|
-
$stderr.puts "Try 'exa-ai monitor-runs-get --help' for more information"
|
|
65
|
-
exit 1
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
begin
|
|
69
|
-
# Resolve API key and format
|
|
70
|
-
api_key = Exa::CLI::Base.resolve_api_key(api_key)
|
|
71
|
-
output_format = Exa::CLI::Base.resolve_output_format(output_format)
|
|
72
|
-
|
|
73
|
-
# Build client
|
|
74
|
-
client = Exa::CLI::Base.build_client(api_key)
|
|
75
|
-
|
|
76
|
-
# Get monitor run
|
|
77
|
-
monitor_run = client.get_monitor_run(monitor_id: monitor_id, id: run_id)
|
|
78
|
-
|
|
79
|
-
# Format and output
|
|
80
|
-
output = Exa::CLI::Formatters::MonitorRunFormatter.format(monitor_run, output_format)
|
|
81
|
-
puts output
|
|
82
|
-
|
|
83
|
-
rescue Exa::NotFound => e
|
|
84
|
-
$stderr.puts "Monitor run not found: #{e.message}"
|
|
85
|
-
exit 1
|
|
86
|
-
rescue Exa::Unauthorized => e
|
|
87
|
-
$stderr.puts "Authentication error: #{e.message}"
|
|
88
|
-
$stderr.puts "Check your API key (set EXA_API_KEY or use --api-key)"
|
|
89
|
-
exit 1
|
|
90
|
-
rescue Exa::ClientError => e
|
|
91
|
-
$stderr.puts "Client error: #{e.message}"
|
|
92
|
-
exit 1
|
|
93
|
-
rescue Exa::ServerError => e
|
|
94
|
-
$stderr.puts "Server error: #{e.message}"
|
|
95
|
-
exit 1
|
|
96
|
-
rescue Exa::Error => e
|
|
97
|
-
$stderr.puts "Error: #{e.message}"
|
|
98
|
-
exit 1
|
|
99
|
-
rescue StandardError => e
|
|
100
|
-
$stderr.puts "Unexpected error: #{e.message}"
|
|
101
|
-
$stderr.puts e.backtrace.first(5) if ENV["DEBUG"]
|
|
102
|
-
exit 1
|
|
103
|
-
end
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "exa-ai"
|
|
5
|
-
|
|
6
|
-
# Parse arguments
|
|
7
|
-
monitor_id = nil
|
|
8
|
-
limit = nil
|
|
9
|
-
cursor = nil
|
|
10
|
-
api_key = nil
|
|
11
|
-
output_format = "json"
|
|
12
|
-
|
|
13
|
-
args = ARGV.dup
|
|
14
|
-
while args.any?
|
|
15
|
-
arg = args.shift
|
|
16
|
-
case arg
|
|
17
|
-
when "--limit"
|
|
18
|
-
limit = args.shift&.to_i
|
|
19
|
-
when "--cursor"
|
|
20
|
-
cursor = args.shift
|
|
21
|
-
when "--api-key"
|
|
22
|
-
api_key = args.shift
|
|
23
|
-
when "--output-format"
|
|
24
|
-
output_format = args.shift
|
|
25
|
-
when "--help", "-h"
|
|
26
|
-
puts <<~HELP
|
|
27
|
-
Usage: exa-ai monitor-runs-list <monitor_id> [OPTIONS]
|
|
28
|
-
|
|
29
|
-
List execution runs for a monitor
|
|
30
|
-
|
|
31
|
-
Arguments:
|
|
32
|
-
monitor_id ID of the monitor (required)
|
|
33
|
-
|
|
34
|
-
Options:
|
|
35
|
-
--limit N Maximum number of runs to return (default: 25, max: 100)
|
|
36
|
-
--cursor CURSOR Cursor for pagination (use nextCursor from previous response)
|
|
37
|
-
--api-key KEY Exa API key (or set EXA_API_KEY env var)
|
|
38
|
-
--output-format FMT Output format: json, pretty, or text (default: json)
|
|
39
|
-
--help, -h Show this help message
|
|
40
|
-
|
|
41
|
-
Examples:
|
|
42
|
-
exa-ai monitor-runs-list mon_abc123
|
|
43
|
-
exa-ai monitor-runs-list mon_abc123 --limit 10
|
|
44
|
-
exa-ai monitor-runs-list mon_abc123 --limit 5 --cursor "abc123"
|
|
45
|
-
exa-ai monitor-runs-list mon_abc123 --output-format pretty
|
|
46
|
-
HELP
|
|
47
|
-
exit 0
|
|
48
|
-
else
|
|
49
|
-
# First positional argument is monitor_id
|
|
50
|
-
if monitor_id.nil?
|
|
51
|
-
monitor_id = arg
|
|
52
|
-
else
|
|
53
|
-
$stderr.puts "Unknown option: #{arg}"
|
|
54
|
-
exit 1
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Validate
|
|
60
|
-
if monitor_id.nil?
|
|
61
|
-
$stderr.puts "Error: monitor_id argument is required"
|
|
62
|
-
$stderr.puts "Usage: exa-ai monitor-runs-list <monitor_id> [OPTIONS]"
|
|
63
|
-
$stderr.puts "Try 'exa-ai monitor-runs-list --help' for more information"
|
|
64
|
-
exit 1
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
begin
|
|
68
|
-
# Resolve API key and format
|
|
69
|
-
api_key = Exa::CLI::Base.resolve_api_key(api_key)
|
|
70
|
-
output_format = Exa::CLI::Base.resolve_output_format(output_format)
|
|
71
|
-
|
|
72
|
-
# Build client
|
|
73
|
-
client = Exa::CLI::Base.build_client(api_key)
|
|
74
|
-
|
|
75
|
-
# List monitor runs with optional pagination
|
|
76
|
-
list_params = {monitor_id: monitor_id}
|
|
77
|
-
list_params[:limit] = limit if limit
|
|
78
|
-
list_params[:cursor] = cursor if cursor
|
|
79
|
-
|
|
80
|
-
collection = client.list_monitor_runs(**list_params)
|
|
81
|
-
|
|
82
|
-
# Format and output
|
|
83
|
-
output = Exa::CLI::Formatters::MonitorRunFormatter.format_collection(collection, output_format)
|
|
84
|
-
puts output
|
|
85
|
-
|
|
86
|
-
rescue Exa::NotFound => e
|
|
87
|
-
$stderr.puts "Monitor not found: #{e.message}"
|
|
88
|
-
exit 1
|
|
89
|
-
rescue Exa::ConfigurationError => e
|
|
90
|
-
$stderr.puts "Configuration error: #{e.message}"
|
|
91
|
-
exit 1
|
|
92
|
-
rescue Exa::Unauthorized => e
|
|
93
|
-
$stderr.puts "Authentication error: #{e.message}"
|
|
94
|
-
$stderr.puts "Check your API key (set EXA_API_KEY or use --api-key)"
|
|
95
|
-
exit 1
|
|
96
|
-
rescue Exa::ClientError => e
|
|
97
|
-
$stderr.puts "Client error: #{e.message}"
|
|
98
|
-
exit 1
|
|
99
|
-
rescue Exa::ServerError => e
|
|
100
|
-
$stderr.puts "Server error: #{e.message}"
|
|
101
|
-
$stderr.puts "The Exa API may be experiencing issues. Please try again later."
|
|
102
|
-
exit 1
|
|
103
|
-
rescue Exa::Error => e
|
|
104
|
-
$stderr.puts "Error: #{e.message}"
|
|
105
|
-
exit 1
|
|
106
|
-
rescue StandardError => e
|
|
107
|
-
$stderr.puts "Unexpected error: #{e.message}"
|
|
108
|
-
$stderr.puts e.backtrace.first(5) if ENV["DEBUG"]
|
|
109
|
-
exit 1
|
|
110
|
-
end
|
data/exe/exa-ai-monitor-update
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "exa-ai"
|
|
5
|
-
|
|
6
|
-
VALID_BEHAVIOR_TYPES = %w[search refresh].freeze
|
|
7
|
-
|
|
8
|
-
# Recursively convert hash keys from strings to symbols
|
|
9
|
-
def deep_symbolize_keys(obj)
|
|
10
|
-
case obj
|
|
11
|
-
when Hash
|
|
12
|
-
obj.each_with_object({}) do |(key, value), result|
|
|
13
|
-
result[key.to_sym] = deep_symbolize_keys(value)
|
|
14
|
-
end
|
|
15
|
-
when Array
|
|
16
|
-
obj.map { |item| deep_symbolize_keys(item) }
|
|
17
|
-
else
|
|
18
|
-
obj
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Parse JSON string or load from file (supports @file.json syntax)
|
|
23
|
-
def parse_json_or_file(value)
|
|
24
|
-
json_data = if value.start_with?("@")
|
|
25
|
-
file_path = value[1..]
|
|
26
|
-
JSON.parse(File.read(file_path))
|
|
27
|
-
else
|
|
28
|
-
JSON.parse(value)
|
|
29
|
-
end
|
|
30
|
-
deep_symbolize_keys(json_data)
|
|
31
|
-
rescue JSON::ParserError => e
|
|
32
|
-
$stderr.puts "Error: Invalid JSON: #{e.message}"
|
|
33
|
-
exit 1
|
|
34
|
-
rescue Errno::ENOENT => e
|
|
35
|
-
$stderr.puts "Error: File not found: #{e.message}"
|
|
36
|
-
exit 1
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Parse command-line arguments
|
|
40
|
-
def parse_args(argv)
|
|
41
|
-
# Check for help first
|
|
42
|
-
if argv.include?("--help") || argv.include?("-h")
|
|
43
|
-
puts <<~HELP
|
|
44
|
-
Usage: exa-ai monitor-update <monitor_id> [OPTIONS]
|
|
45
|
-
|
|
46
|
-
Update a monitor's schedule or behavior
|
|
47
|
-
|
|
48
|
-
Required:
|
|
49
|
-
<monitor_id> Monitor ID
|
|
50
|
-
|
|
51
|
-
Cadence options:
|
|
52
|
-
--cron EXPR Cron expression (e.g., "0 0 * * *")
|
|
53
|
-
--timezone TZ Timezone (e.g., "America/New_York")
|
|
54
|
-
|
|
55
|
-
Behavior options:
|
|
56
|
-
--behavior-type TYPE One of: #{VALID_BEHAVIOR_TYPES.join(', ')}
|
|
57
|
-
--query TEXT Search query (for search behavior)
|
|
58
|
-
--count N Number of results (for search behavior)
|
|
59
|
-
--behavior-mode MODE Mode: override or append (for search behavior)
|
|
60
|
-
|
|
61
|
-
Other options:
|
|
62
|
-
--api-key KEY Exa API key (or set EXA_API_KEY env var)
|
|
63
|
-
--output-format FMT Output format: json, pretty, or text (default: json)
|
|
64
|
-
--help, -h Show this help message
|
|
65
|
-
|
|
66
|
-
Examples:
|
|
67
|
-
# Update cron schedule
|
|
68
|
-
exa-ai monitor-update mon_123 --cron "0 */12 * * *"
|
|
69
|
-
|
|
70
|
-
# Update search query
|
|
71
|
-
exa-ai monitor-update mon_123 --query "AI startups in Europe"
|
|
72
|
-
|
|
73
|
-
# Update multiple fields
|
|
74
|
-
exa-ai monitor-update mon_123 --cron "0 0 * * *" --timezone "UTC" \\
|
|
75
|
-
--query "New companies" --count 100
|
|
76
|
-
HELP
|
|
77
|
-
exit 0
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
args = {
|
|
81
|
-
output_format: "json",
|
|
82
|
-
api_key: nil
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
# First, check for positional argument (monitor_id)
|
|
86
|
-
if argv.empty? || argv[0].start_with?("--")
|
|
87
|
-
return args
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
args[:monitor_id] = argv[0]
|
|
91
|
-
i = 1
|
|
92
|
-
|
|
93
|
-
while i < argv.length
|
|
94
|
-
arg = argv[i]
|
|
95
|
-
case arg
|
|
96
|
-
when "--cron"
|
|
97
|
-
args[:cron] = argv[i + 1]
|
|
98
|
-
i += 2
|
|
99
|
-
when "--timezone"
|
|
100
|
-
args[:timezone] = argv[i + 1]
|
|
101
|
-
i += 2
|
|
102
|
-
when "--behavior-type"
|
|
103
|
-
args[:behavior_type] = argv[i + 1]
|
|
104
|
-
i += 2
|
|
105
|
-
when "--query"
|
|
106
|
-
args[:query] = argv[i + 1]
|
|
107
|
-
i += 2
|
|
108
|
-
when "--count"
|
|
109
|
-
args[:count] = argv[i + 1]&.to_i
|
|
110
|
-
i += 2
|
|
111
|
-
when "--behavior-mode"
|
|
112
|
-
args[:behavior_mode] = argv[i + 1]
|
|
113
|
-
i += 2
|
|
114
|
-
when "--api-key"
|
|
115
|
-
args[:api_key] = argv[i + 1]
|
|
116
|
-
i += 2
|
|
117
|
-
when "--output-format"
|
|
118
|
-
args[:output_format] = argv[i + 1]
|
|
119
|
-
i += 2
|
|
120
|
-
else
|
|
121
|
-
$stderr.puts "Unknown option: #{arg}"
|
|
122
|
-
exit 1
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
args
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
# Validate required arguments
|
|
130
|
-
def validate_args(args)
|
|
131
|
-
unless args[:monitor_id]
|
|
132
|
-
$stderr.puts "Error: monitor_id argument is required"
|
|
133
|
-
$stderr.puts "Usage: exa-ai monitor-update <monitor_id> [OPTIONS]"
|
|
134
|
-
$stderr.puts "Try 'exa-ai monitor-update --help' for more information"
|
|
135
|
-
exit 1
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# Validate behavior type if provided
|
|
139
|
-
if args[:behavior_type] && !VALID_BEHAVIOR_TYPES.include?(args[:behavior_type])
|
|
140
|
-
$stderr.puts "Error: --behavior-type must be one of: #{VALID_BEHAVIOR_TYPES.join(', ')}"
|
|
141
|
-
exit 1
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# Main execution
|
|
146
|
-
args = parse_args(ARGV)
|
|
147
|
-
validate_args(args)
|
|
148
|
-
|
|
149
|
-
begin
|
|
150
|
-
# Resolve API key and format
|
|
151
|
-
api_key = Exa::CLI::Base.resolve_api_key(args[:api_key])
|
|
152
|
-
output_format = Exa::CLI::Base.resolve_output_format(args[:output_format])
|
|
153
|
-
|
|
154
|
-
# Build client
|
|
155
|
-
client = Exa::CLI::Base.build_client(api_key)
|
|
156
|
-
|
|
157
|
-
# Build update params
|
|
158
|
-
update_params = {}
|
|
159
|
-
|
|
160
|
-
# Build cadence object if any cadence params provided
|
|
161
|
-
if args[:cron] || args[:timezone]
|
|
162
|
-
update_params[:cadence] = {}
|
|
163
|
-
update_params[:cadence][:cron] = args[:cron] if args[:cron]
|
|
164
|
-
update_params[:cadence][:timezone] = args[:timezone] if args[:timezone]
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
# Build behavior object if any behavior params provided
|
|
168
|
-
if args[:behavior_type] || args[:query] || args[:count] || args[:behavior_mode]
|
|
169
|
-
update_params[:behavior] = {}
|
|
170
|
-
update_params[:behavior][:type] = args[:behavior_type] if args[:behavior_type]
|
|
171
|
-
update_params[:behavior][:query] = args[:query] if args[:query]
|
|
172
|
-
update_params[:behavior][:count] = args[:count] if args[:count]
|
|
173
|
-
update_params[:behavior][:mode] = args[:behavior_mode] if args[:behavior_mode]
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
# Update monitor
|
|
177
|
-
monitor = client.update_monitor(args[:monitor_id], **update_params)
|
|
178
|
-
|
|
179
|
-
# Format and output
|
|
180
|
-
output = Exa::CLI::Formatters::MonitorFormatter.format(monitor, output_format)
|
|
181
|
-
puts output
|
|
182
|
-
|
|
183
|
-
rescue Exa::NotFound => e
|
|
184
|
-
$stderr.puts "Monitor not found: #{e.message}"
|
|
185
|
-
exit 1
|
|
186
|
-
rescue Exa::ConfigurationError => e
|
|
187
|
-
$stderr.puts "Configuration error: #{e.message}"
|
|
188
|
-
exit 1
|
|
189
|
-
rescue Exa::Unauthorized => e
|
|
190
|
-
$stderr.puts "Authentication error: #{e.message}"
|
|
191
|
-
$stderr.puts "Check your API key (set EXA_API_KEY or use --api-key)"
|
|
192
|
-
exit 1
|
|
193
|
-
rescue Exa::ClientError => e
|
|
194
|
-
$stderr.puts "Client error: #{e.message}"
|
|
195
|
-
exit 1
|
|
196
|
-
rescue Exa::ServerError => e
|
|
197
|
-
$stderr.puts "Server error: #{e.message}"
|
|
198
|
-
$stderr.puts "The Exa API may be experiencing issues. Please try again later."
|
|
199
|
-
exit 1
|
|
200
|
-
rescue Exa::Error => e
|
|
201
|
-
$stderr.puts "Error: #{e.message}"
|
|
202
|
-
exit 1
|
|
203
|
-
rescue StandardError => e
|
|
204
|
-
$stderr.puts "Unexpected error: #{e.message}"
|
|
205
|
-
$stderr.puts e.backtrace.first(5) if ENV["DEBUG"]
|
|
206
|
-
exit 1
|
|
207
|
-
end
|
data/exe/exa-ai-webset-cancel
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "exa-ai"
|
|
5
|
-
|
|
6
|
-
# Parse arguments
|
|
7
|
-
webset_id = nil
|
|
8
|
-
api_key = nil
|
|
9
|
-
output_format = "json"
|
|
10
|
-
|
|
11
|
-
args = ARGV.dup
|
|
12
|
-
while args.any?
|
|
13
|
-
arg = args.shift
|
|
14
|
-
case arg
|
|
15
|
-
when "--api-key"
|
|
16
|
-
api_key = args.shift
|
|
17
|
-
when "--output-format"
|
|
18
|
-
output_format = args.shift
|
|
19
|
-
when "--help", "-h"
|
|
20
|
-
puts <<~HELP
|
|
21
|
-
Usage: exa-ai webset-cancel <webset_id> [OPTIONS]
|
|
22
|
-
|
|
23
|
-
Cancel a running webset
|
|
24
|
-
|
|
25
|
-
Arguments:
|
|
26
|
-
webset_id ID of the webset to cancel (required)
|
|
27
|
-
|
|
28
|
-
Options:
|
|
29
|
-
--api-key KEY Exa API key (or set EXA_API_KEY env var)
|
|
30
|
-
--output-format FMT Output format: json, pretty, or text (default: json)
|
|
31
|
-
--help, -h Show this help message
|
|
32
|
-
|
|
33
|
-
Examples:
|
|
34
|
-
exa-ai webset-cancel ws_abc123
|
|
35
|
-
exa-ai webset-cancel ws_abc123 --output-format pretty
|
|
36
|
-
HELP
|
|
37
|
-
exit 0
|
|
38
|
-
else
|
|
39
|
-
# First positional argument is webset_id
|
|
40
|
-
if webset_id.nil?
|
|
41
|
-
webset_id = arg
|
|
42
|
-
else
|
|
43
|
-
$stderr.puts "Unknown option: #{arg}"
|
|
44
|
-
exit 1
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Validate
|
|
50
|
-
if webset_id.nil?
|
|
51
|
-
$stderr.puts "Error: webset_id argument is required"
|
|
52
|
-
$stderr.puts "Usage: exa-ai webset-cancel <webset_id> [OPTIONS]"
|
|
53
|
-
$stderr.puts "Try 'exa-ai webset-cancel --help' for more information"
|
|
54
|
-
exit 1
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
begin
|
|
58
|
-
# Resolve API key and format
|
|
59
|
-
api_key = Exa::CLI::Base.resolve_api_key(api_key)
|
|
60
|
-
output_format = Exa::CLI::Base.resolve_output_format(output_format)
|
|
61
|
-
|
|
62
|
-
# Build client
|
|
63
|
-
client = Exa::CLI::Base.build_client(api_key)
|
|
64
|
-
|
|
65
|
-
# Cancel webset
|
|
66
|
-
webset = client.cancel_webset(webset_id)
|
|
67
|
-
|
|
68
|
-
# Format and output
|
|
69
|
-
output = Exa::CLI::Formatters::WebsetFormatter.format(webset, output_format)
|
|
70
|
-
puts output
|
|
71
|
-
$stdout.flush
|
|
72
|
-
|
|
73
|
-
rescue Exa::NotFound => e
|
|
74
|
-
$stderr.puts "Webset not found: #{e.message}"
|
|
75
|
-
exit 1
|
|
76
|
-
rescue Exa::ConfigurationError => e
|
|
77
|
-
$stderr.puts "Configuration error: #{e.message}"
|
|
78
|
-
exit 1
|
|
79
|
-
rescue Exa::Unauthorized => e
|
|
80
|
-
$stderr.puts "Authentication error: #{e.message}"
|
|
81
|
-
$stderr.puts "Check your API key (set EXA_API_KEY or use --api-key)"
|
|
82
|
-
exit 1
|
|
83
|
-
rescue Exa::ClientError => e
|
|
84
|
-
$stderr.puts "Client error: #{e.message}"
|
|
85
|
-
exit 1
|
|
86
|
-
rescue Exa::ServerError => e
|
|
87
|
-
$stderr.puts "Server error: #{e.message}"
|
|
88
|
-
$stderr.puts "The Exa API may be experiencing issues. Please try again later."
|
|
89
|
-
exit 1
|
|
90
|
-
rescue Exa::Error => e
|
|
91
|
-
$stderr.puts "Error: #{e.message}"
|
|
92
|
-
exit 1
|
|
93
|
-
rescue StandardError => e
|
|
94
|
-
$stderr.puts "Unexpected error: #{e.message}"
|
|
95
|
-
$stderr.puts e.backtrace.first(5) if ENV["DEBUG"]
|
|
96
|
-
exit 1
|
|
97
|
-
end
|