inloop-brain 0.0.5 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1225dd8339b48516cc2cfc3642082181a19da5404900ebeffa2fcec17b9139f
4
- data.tar.gz: 8f0925cd406f032862dafb9df8ed6b27c0a764086b51486098856aaaa26454ba
3
+ metadata.gz: b010ec1dfb8d235662298c1b6bfa1b5ac3449abbe57ef897f28c938a2bc40578
4
+ data.tar.gz: 7bd980f2aefaac9c121de941aa934f9d521082e94bef253938f9a545a0ac2eda
5
5
  SHA512:
6
- metadata.gz: 52051ef4783af702e228cb3e55c0cea27ee2d8a09e88d5c282748850293ecd6327dfe1957c43a92899a1d12b8679e8ee8e162e438d183516eebe5876e376dfd7
7
- data.tar.gz: 297cf080865234df41e84d3e603cf0eb2040164054a91a9b2f479d4652b88eac7d81e636ac972b42211bbf12b82e329da164e728cb9d29febf710715efd4faad
6
+ metadata.gz: 396a1272894e4f37b8774f1bd6982e27cf51afc62929506ce06523b52b22be04f0415d880189ca9215fc443445e2d7a80f659b077efe197b8260c0d70dedb038
7
+ data.tar.gz: 6927c57bcc86f9d089a73ebbfbcc7fab492d2eb28c2195253864f607c1f9c3ab3c3ac3e73b9df61cd7f3558657871f83921af88ab6d6b1c04da83ae8658b320b
data/LICENSE.txt ADDED
@@ -0,0 +1,5 @@
1
+ INLOOP v0.1 License
2
+
3
+ Copyright (c) 2025 Abhishek Parolkar & inloop.studio LP
4
+
5
+ ALL RIGHTS RESERVED
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Inloop Brain
2
+
3
+ A command-line tool for interacting with the Inloop Brain Access Kit API.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ gem install inloop-brain
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ echo "What can you do?" | inloop-brain --key=YOUR_ACCESS_KEY
15
+ ```
16
+
17
+ Or
18
+
19
+ ```
20
+ echo "What can you do?" | inloop-brain -k YOUR_ACCESS_KEY > output.txt
21
+ ```
22
+
23
+ ### Environment Variables
24
+
25
+ You can customize the target host and protocol:
26
+
27
+ - `INLOOP_BRAIN_HOST`: Host to connect to (default: localhost:3000)
28
+ - `INLOOP_BRAIN_PROTOCOL`: Protocol to use (default: http)
29
+
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the Nonstandard license of inloop.studio
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/inloop-brain CHANGED
@@ -13,6 +13,9 @@ parser = OptionParser.new do |opts|
13
13
  opts.on('-k KEY', '--key=KEY', 'Access key for the Brain Access Kit') do |key|
14
14
  options[:key] = key
15
15
  end
16
+ opts.on('-d', '--debug', 'Enable debug mode') do
17
+ options[:debug] = true
18
+ end
16
19
  opts.on('-h', '--help', 'Display this help message') do
17
20
  puts opts
18
21
  exit
@@ -44,30 +47,66 @@ if input.empty?
44
47
  end
45
48
 
46
49
  # Configure the API request
47
- host = ENV['INLOOP_BRAIN_HOST'] || 'localhost:3000' # Default to localhost:3000
48
- protocol = ENV['INLOOP_BRAIN_PROTOCOL'] || 'http' # Default to http
50
+ host = ENV['INLOOP_BRAIN_HOST'] || 'discovery.inloop.studio'
51
+ protocol = ENV['INLOOP_BRAIN_PROTOCOL'] || 'https'
49
52
  endpoint = "/web_tools/brain_access_kit/#{options[:key]}/handle_prompt.txt"
50
53
  uri = URI.parse("#{protocol}://#{host}#{endpoint}")
51
54
 
55
+ if options[:debug]
56
+ puts "Making request to: #{uri}"
57
+ end
58
+
52
59
  # Setup the HTTP request
53
60
  http = Net::HTTP.new(uri.host, uri.port)
54
61
  http.use_ssl = (uri.scheme == 'https')
55
62
 
63
+ # Add proper timeout settings
64
+ http.open_timeout = 10
65
+ http.read_timeout = 60
66
+
56
67
  request = Net::HTTP::Post.new(uri.path)
68
+ # Set proper headers
69
+ request['Content-Type'] = 'application/x-www-form-urlencoded'
70
+ request['Accept'] = 'text/plain'
71
+ request['User-Agent'] = 'Inloop-Brain-CLI/0.0.1'
72
+
73
+ # Set form data
57
74
  request.set_form_data('prompt' => input)
58
75
 
59
76
  # Send the request and handle the response
60
77
  begin
78
+ if options[:debug]
79
+ puts "Request headers:"
80
+ request.each_header { |key, value| puts " #{key}: #{value}" }
81
+ puts "Request body: #{request.body}"
82
+ end
83
+
61
84
  response = http.request(request)
62
85
 
86
+ if options[:debug]
87
+ puts "Response status: #{response.code}"
88
+ puts "Response headers:"
89
+ response.each_header { |key, value| puts " #{key}: #{value}" }
90
+ end
91
+
63
92
  if response.code.to_i == 200
64
93
  puts response.body
65
94
  else
66
95
  STDERR.puts "Error: API returned status code #{response.code}"
67
96
  STDERR.puts response.body
97
+
98
+ # Additional troubleshooting for 422 errors
99
+ if response.code.to_i == 422
100
+ STDERR.puts "\nThe 422 error typically indicates a validation problem. Possible issues:"
101
+ STDERR.puts "1. The endpoint format may have changed"
102
+ STDERR.puts "2. The access key format may be incorrect"
103
+ STDERR.puts "3. The prompt may be in an invalid format"
104
+ STDERR.puts "\nTry running with --debug for more information."
105
+ end
68
106
  exit 1
69
107
  end
70
108
  rescue => e
71
109
  STDERR.puts "Error: Failed to connect to the API: #{e.message}"
110
+ STDERR.puts e.backtrace.join("\n") if options[:debug]
72
111
  exit 1
73
112
  end
@@ -0,0 +1,32 @@
1
+
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "inloop-brain"
5
+ spec.version = "0.0.7"
6
+ spec.authors = ["Abhishek Parolkar"]
7
+ spec.email = ["abhishek@inloop.studio"]
8
+
9
+ spec.summary = "Command-line interface for the Inloop Brain Access Kit"
10
+ spec.description = "A simple command-line tool that sends prompts to the Inloop Brain Access Kit API and returns responses"
11
+ spec.homepage = "https://inloop.studio"
12
+ spec.license = "Nonstandard"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/inloopstudio-team/inloop-brain"
17
+ spec.metadata["changelog_uri"] = "https://github.com/inloopstudio-team/inloop-brain/blob/main/CHANGELOG.md" # Replace with actual changelog URL
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "bin"
25
+ spec.executables = ["inloop-brain"]
26
+
27
+
28
+ # Dependencies
29
+ spec.add_development_dependency "bundler", "~> 2.0"
30
+ spec.add_development_dependency "rake", "~> 13.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inloop-brain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhishek Parolkar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-14 00:00:00.000000000 Z
11
+ date: 2026-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,14 +61,18 @@ executables:
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
64
67
  - bin/inloop-brain
68
+ - inloop-brain.gemspec
65
69
  homepage: https://inloop.studio
66
70
  licenses:
67
71
  - Nonstandard
68
72
  metadata:
69
73
  homepage_uri: https://inloop.studio
70
- source_code_uri: https://github.com/parolkar/inloop-brain
71
- changelog_uri: https://github.com/parolkar/inloop-brain/blob/main/CHANGELOG.md
74
+ source_code_uri: https://github.com/inloopstudio-team/inloop-brain
75
+ changelog_uri: https://github.com/inloopstudio-team/inloop-brain/blob/main/CHANGELOG.md
72
76
  post_install_message:
73
77
  rdoc_options: []
74
78
  require_paths:
@@ -84,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
88
  - !ruby/object:Gem::Version
85
89
  version: '0'
86
90
  requirements: []
87
- rubygems_version: 3.5.11
91
+ rubygems_version: 3.5.22
88
92
  signing_key:
89
93
  specification_version: 4
90
94
  summary: Command-line interface for the Inloop Brain Access Kit